Skip to content

Commit 3c2ba0c

Browse files
committed
cleanup: Format exporter and fission
1 parent 059defc commit 3c2ba0c

File tree

2 files changed

+79
-70
lines changed

2 files changed

+79
-70
lines changed

Diff for: exporter/SynthesisFusionAddin/src/UI/GamepieceConfigTab.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33

44
from src.Logging import logFailure
55
from src.Parser.ExporterOptions import ExporterOptions
6+
from src.Parser.SynthesisParser.Utilities import guid_occurrence
67
from src.Types import Gamepiece, UnitSystem
78
from src.UI.CreateCommandInputsHelper import (
89
createBooleanInput,
910
createTableInput,
1011
createTextBoxInput,
1112
)
1213
from src.Util import convertMassUnitsFrom, convertMassUnitsTo, getFusionUnitSystem
13-
from src.Parser.SynthesisParser.Utilities import (
14-
guid_occurrence,
15-
)
14+
1615

1716
class GamepieceConfigTab:
1817
selectedGamepieceList: list[adsk.fusion.Occurrence] = []

Diff for: fission/src/ui/panels/mirabuf/ImportMirabufPanel.tsx

+77-67
Original file line numberDiff line numberDiff line change
@@ -256,46 +256,50 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
256256
// Generate Item cards for cached robots.
257257
const cachedRobotElements = useMemo(
258258
() =>
259-
cachedRobots.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1).map(info =>
260-
ItemCard({
261-
name: info.name || info.cacheKey || "Unnamed Robot",
262-
id: info.id,
263-
primaryButtonNode: SynthesisIcons.AddLarge,
264-
primaryOnClick: () => {
265-
console.log(`Selecting cached robot: ${info.cacheKey}`)
266-
selectCache(info, MiraType.ROBOT)
267-
},
268-
secondaryOnClick: () => {
269-
console.log(`Deleting cache of: ${info.cacheKey}`)
270-
MirabufCachingService.Remove(info.cacheKey, info.id, MiraType.ROBOT)
271-
272-
setCachedRobots(GetCacheInfo(MiraType.ROBOT))
273-
},
274-
})
275-
),
259+
cachedRobots
260+
.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1)
261+
.map(info =>
262+
ItemCard({
263+
name: info.name || info.cacheKey || "Unnamed Robot",
264+
id: info.id,
265+
primaryButtonNode: SynthesisIcons.AddLarge,
266+
primaryOnClick: () => {
267+
console.log(`Selecting cached robot: ${info.cacheKey}`)
268+
selectCache(info, MiraType.ROBOT)
269+
},
270+
secondaryOnClick: () => {
271+
console.log(`Deleting cache of: ${info.cacheKey}`)
272+
MirabufCachingService.Remove(info.cacheKey, info.id, MiraType.ROBOT)
273+
274+
setCachedRobots(GetCacheInfo(MiraType.ROBOT))
275+
},
276+
})
277+
),
276278
[cachedRobots, selectCache, setCachedRobots]
277279
)
278280

279281
// Generate Item cards for cached fields.
280282
const cachedFieldElements = useMemo(
281283
() =>
282-
cachedFields.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1).map(info =>
283-
ItemCard({
284-
name: info.name || info.cacheKey || "Unnamed Field",
285-
id: info.id,
286-
primaryButtonNode: SynthesisIcons.AddLarge,
287-
primaryOnClick: () => {
288-
console.log(`Selecting cached field: ${info.cacheKey}`)
289-
selectCache(info, MiraType.FIELD)
290-
},
291-
secondaryOnClick: () => {
292-
console.log(`Deleting cache of: ${info.cacheKey}`)
293-
MirabufCachingService.Remove(info.cacheKey, info.id, MiraType.FIELD)
294-
295-
setCachedFields(GetCacheInfo(MiraType.FIELD))
296-
},
297-
})
298-
),
284+
cachedFields
285+
.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? -1)
286+
.map(info =>
287+
ItemCard({
288+
name: info.name || info.cacheKey || "Unnamed Field",
289+
id: info.id,
290+
primaryButtonNode: SynthesisIcons.AddLarge,
291+
primaryOnClick: () => {
292+
console.log(`Selecting cached field: ${info.cacheKey}`)
293+
selectCache(info, MiraType.FIELD)
294+
},
295+
secondaryOnClick: () => {
296+
console.log(`Deleting cache of: ${info.cacheKey}`)
297+
MirabufCachingService.Remove(info.cacheKey, info.id, MiraType.FIELD)
298+
299+
setCachedFields(GetCacheInfo(MiraType.FIELD))
300+
},
301+
})
302+
),
299303
[cachedFields, selectCache, setCachedFields]
300304
)
301305

@@ -304,51 +308,57 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
304308
const remoteRobots = manifest?.robots.filter(
305309
path => !cachedRobots.some(info => info.cacheKey.includes(path.src))
306310
)
307-
return remoteRobots?.sort((a, b) => a.displayName.localeCompare(b.displayName)).map(path =>
308-
ItemCard({
309-
name: path.displayName,
310-
id: path.src,
311-
primaryButtonNode: SynthesisIcons.DownloadLarge,
312-
primaryOnClick: () => {
313-
console.log(`Selecting remote: ${path}`)
314-
selectRemote(path, MiraType.ROBOT)
315-
},
316-
})
317-
)
311+
return remoteRobots
312+
?.sort((a, b) => a.displayName.localeCompare(b.displayName))
313+
.map(path =>
314+
ItemCard({
315+
name: path.displayName,
316+
id: path.src,
317+
primaryButtonNode: SynthesisIcons.DownloadLarge,
318+
primaryOnClick: () => {
319+
console.log(`Selecting remote: ${path}`)
320+
selectRemote(path, MiraType.ROBOT)
321+
},
322+
})
323+
)
318324
}, [manifest?.robots, cachedRobots, selectRemote])
319325

320326
// Generate Item cards for remote fields.
321327
const remoteFieldElements = useMemo(() => {
322328
const remoteFields = manifest?.fields.filter(
323329
path => !cachedFields.some(info => info.cacheKey.includes(path.src))
324330
)
325-
return remoteFields?.sort((a, b) => a.displayName.localeCompare(b.displayName)).map(path =>
326-
ItemCard({
327-
name: path.displayName,
328-
id: path.src,
329-
primaryButtonNode: SynthesisIcons.DownloadLarge,
330-
primaryOnClick: () => {
331-
console.log(`Selecting remote: ${path}`)
332-
selectRemote(path, MiraType.FIELD)
333-
},
334-
})
335-
)
336-
}, [manifest?.fields, cachedFields, selectRemote])
337-
338-
// Generate Item cards for APS robots and fields.
339-
const hubElements = useMemo(
340-
() =>
341-
files?.sort((a, b) => a.attributes.displayName!.localeCompare(b.attributes.displayName!)).map(file =>
331+
return remoteFields
332+
?.sort((a, b) => a.displayName.localeCompare(b.displayName))
333+
.map(path =>
342334
ItemCard({
343-
name: `${file.attributes.displayName!.replace(".mira", "")}${file.attributes.versionNumber != undefined ? ` (v${file.attributes.versionNumber})` : ''}`,
344-
id: file.id,
335+
name: path.displayName,
336+
id: path.src,
345337
primaryButtonNode: SynthesisIcons.DownloadLarge,
346338
primaryOnClick: () => {
347-
console.debug(file.raw)
348-
selectAPS(file, viewType)
339+
console.log(`Selecting remote: ${path}`)
340+
selectRemote(path, MiraType.FIELD)
349341
},
350342
})
351-
),
343+
)
344+
}, [manifest?.fields, cachedFields, selectRemote])
345+
346+
// Generate Item cards for APS robots and fields.
347+
const hubElements = useMemo(
348+
() =>
349+
files
350+
?.sort((a, b) => a.attributes.displayName!.localeCompare(b.attributes.displayName!))
351+
.map(file =>
352+
ItemCard({
353+
name: `${file.attributes.displayName!.replace(".mira", "")}${file.attributes.versionNumber != undefined ? ` (v${file.attributes.versionNumber})` : ""}`,
354+
id: file.id,
355+
primaryButtonNode: SynthesisIcons.DownloadLarge,
356+
primaryOnClick: () => {
357+
console.debug(file.raw)
358+
selectAPS(file, viewType)
359+
},
360+
})
361+
),
352362
[files, selectAPS, viewType]
353363
)
354364

0 commit comments

Comments
 (0)