Skip to content

Commit 706bc60

Browse files
Merge dev + fix version string issue
2 parents a3685b4 + 43f9225 commit 706bc60

File tree

17 files changed

+287
-81
lines changed

17 files changed

+287
-81
lines changed

exporter/SynthesisFusionAddin/src/Parser/ExporterOptions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ExporterOptions:
5353
exportAsPart: bool = field(default=False)
5454

5555
exportLocation: ExportLocation = field(default=ExportLocation.DOWNLOAD)
56+
openSynthesisUponExport: bool = field(default=False)
5657

5758
hierarchy: ModelHierarchy = field(default=ModelHierarchy.FusionAssembly)
5859
visualQuality: TriangleMeshQualityOptions = field(default=TriangleMeshQualityOptions.LowQualityTriangleMesh)

exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"""
44

55
import os
6+
import webbrowser
67
from typing import Any
78

89
import adsk.core
910
import adsk.fusion
1011

11-
from src import gm
12+
from src import APP_WEBSITE_URL, gm
1213
from src.APS.APS import getAuth, getUserInfo
1314
from src.Logging import getLogger, logFailure
1415
from src.Parser.ExporterOptions import ExporterOptions
@@ -127,10 +128,10 @@ def notify(self, _: adsk.core.CommandEventArgs) -> None:
127128
docName, docVersion = designNameSplit[:2]
128129
else:
129130
docName = designNameSplit[0]
130-
docVersion = ""
131+
docVersion = "v0"
131132

132133
processedFileName = gm.app.activeDocument.name.replace(" ", "_")
133-
defaultFileName = "_".join([docName, docVersion]) + ".mira" if docVersion else f"{docName}.mira"
134+
defaultFileName = f"{'_'.join([docName, docVersion])}.mira"
134135
if generalConfigTab.exportLocation == ExportLocation.DOWNLOAD:
135136
savepath = FileDialogConfig.saveFileDialog(exporterOptions.fileLocation, defaultFileName)
136137
else:
@@ -161,13 +162,19 @@ def notify(self, _: adsk.core.CommandEventArgs) -> None:
161162
exportAsPart=generalConfigTab.exportAsPart,
162163
frictionOverride=generalConfigTab.overrideFriction,
163164
frictionOverrideCoeff=generalConfigTab.frictionOverrideCoeff,
165+
openSynthesisUponExport=generalConfigTab.openSynthesisUponExport,
164166
)
165167

166168
Parser(exporterOptions).export()
167169
exporterOptions.writeToDesign()
168170
jointConfigTab.reset()
169171
gamepieceConfigTab.reset()
170172

173+
if generalConfigTab.openSynthesisUponExport:
174+
res = webbrowser.open(APP_WEBSITE_URL)
175+
if not res:
176+
gm.ui.messageBox("Failed to open Synthesis in your default browser.")
177+
171178

172179
class CommandExecutePreviewHandler(PersistentEventHandler, adsk.core.CommandEventHandler):
173180
"""Called when an execute command is ready to be previewed."""

exporter/SynthesisFusionAddin/src/UI/GeneralConfigTab.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ def __init__(self, args: adsk.core.CommandCreatedEventArgs, exporterOptions: Exp
110110
frictionCoefficient.tooltip = "<i>Friction coefficients range from 0 (ice) to 1 (rubber).</i>"
111111
frictionCoefficient.isVisible = exporterOptions.frictionOverride
112112

113+
createBooleanInput(
114+
"openSynthesisOnExportButton",
115+
"Open Synthesis on Export",
116+
generalTabInputs,
117+
checked=exporterOptions.openSynthesisUponExport,
118+
tooltip="Launch the Synthesis website upon export.",
119+
)
120+
113121
if exporterOptions.exportMode == ExportMode.FIELD:
114122
autoCalcWeightButton.isVisible = False
115123
exportAsPartButton.isVisible = False
@@ -182,6 +190,13 @@ def frictionOverrideCoeff(self) -> float:
182190
)
183191
return frictionSlider.valueOne or -1.0
184192

193+
@property
194+
def openSynthesisUponExport(self) -> bool:
195+
openSynthesisButton: adsk.core.BoolValueCommandInput = self.generalOptionsTab.children.itemById(
196+
"openSynthesisOnExportButton"
197+
)
198+
return openSynthesisButton.value or False
199+
185200
@logFailure
186201
def handleInputChanged(self, args: adsk.core.InputChangedEventArgs) -> None:
187202
autoCalcWeightButton: adsk.core.BoolValueCommandInput = args.inputs.itemById("autoCalcWeightButton")

exporter/SynthesisFusionAddin/src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
APP_NAME = "Synthesis"
99
APP_TITLE = "Synthesis Robot Exporter"
10+
APP_WEBSITE_URL = "https://synthesis.autodesk.com/fission/"
1011
DESCRIPTION = "Exports files from Fusion into the Synthesis Format"
1112
INTERNAL_ID = "Synthesis"
1213
ADDIN_PATH = os.path.dirname(os.path.realpath(__file__))

fission/src/ui/components/Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Modal: React.FC<ModalProps> = ({
5656
<div
5757
id={modalId}
5858
key={modalId}
59-
className={`${className} flex flex-col absolute max-w-[98vw] max-h-[90vh] w-fit h-fit left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-background text-main-text m-auto border-5 rounded-2xl shadow-sm shadow-slate-800`}
59+
className={`${className} flex flex-col absolute max-w-[50vw] max-h-[95vh] w-fit h-fit left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-background text-main-text m-auto border-5 rounded-2xl shadow-sm shadow-slate-800`}
6060
>
6161
{name && (
6262
<div id="header" className="flex items-center gap-8 h-16">
@@ -78,7 +78,7 @@ const Modal: React.FC<ModalProps> = ({
7878
id="content"
7979
className={`${contentClassName || ""} ${
8080
!contentClassName?.includes("mx") ? "mx-[2rem]" : ""
81-
} flex flex-col gap-4 max-h-75vh p-4`}
81+
} flex flex-col gap-4 max-h-[75vh]`}
8282
>
8383
{children}
8484
</div>

fission/src/ui/components/StyledComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Label, { LabelSize } from "./Label"
33
import Button, { ButtonProps, ButtonSize } from "./Button"
44
import { IoCheckmark, IoPencil, IoPeople, IoTrashBin } from "react-icons/io5"
55
import { HiDownload } from "react-icons/hi"
6-
import { AiOutlinePlus } from "react-icons/ai"
76
import { BiRefresh } from "react-icons/bi"
87
import { AiFillWarning } from "react-icons/ai"
98
import { BsCodeSquare } from "react-icons/bs"
@@ -58,7 +57,8 @@ export class SynthesisIcons {
5857
/** Large icons: used for icon buttons */
5958
public static DeleteLarge = (<IoTrashBin size={"1.25rem"} />)
6059
public static DownloadLarge = (<HiDownload size={"1.25rem"} />)
61-
public static AddLarge = (<AiOutlinePlus size={"1.25rem"} />)
60+
public static AddLarge = (<FaPlus size={"1.25rem"} />)
61+
public static GearLarge = (<FaGear size={"1.25rem"} />)
6262
public static RefreshLarge = (<BiRefresh size={"1.25rem"} />)
6363
public static SelectLarge = (<IoCheckmark size={"1.25rem"} />)
6464
public static EditLarge = (<IoPencil size={"1.25rem"} />)

fission/src/ui/modals/configuring/SettingsModal.tsx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
import React, { useState } from "react"
22
import Modal, { ModalPropsImpl } from "@/components/Modal"
3-
import { FaGear } from "react-icons/fa6"
43
import Label, { LabelSize } from "@/components/Label"
54
import Dropdown from "@/components/Dropdown"
6-
import Slider from "@/components/Slider"
75
import Checkbox from "@/components/Checkbox"
86
import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
97
import { SceneOverlayEvent, SceneOverlayEventKey } from "@/ui/components/SceneOverlayEvents"
108
import { QualitySetting } from "@/systems/preferences/PreferenceTypes"
119
import { Box } from "@mui/material"
12-
import { Spacer } from "@/ui/components/StyledComponents"
10+
import { Spacer, SynthesisIcons } from "@/ui/components/StyledComponents"
1311
import World from "@/systems/World"
1412

1513
const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
1614
const [qualitySettings, setQualitySettings] = useState<string>(
1715
PreferencesSystem.getGlobalPreference<string>("QualitySettings")
1816
)
19-
const [zoomSensitivity, setZoomSensitivity] = useState<number>(
17+
18+
// Disabled until camera settings are implemented
19+
/* const [zoomSensitivity, setZoomSensitivity] = useState<number>(
2020
PreferencesSystem.getGlobalPreference<number>("ZoomSensitivity")
2121
)
2222
const [pitchSensitivity, setPitchSensitivity] = useState<number>(
2323
PreferencesSystem.getGlobalPreference<number>("PitchSensitivity")
2424
)
2525
const [yawSensitivity, setYawSensitivity] = useState<number>(
2626
PreferencesSystem.getGlobalPreference<number>("YawSensitivity")
27-
)
27+
) */
28+
2829
const [reportAnalytics, setReportAnalytics] = useState<boolean>(
2930
PreferencesSystem.getGlobalPreference<boolean>("ReportAnalytics")
3031
)
31-
const [useMetric, setUseMetric] = useState<boolean>(PreferencesSystem.getGlobalPreference<boolean>("UseMetric"))
32+
33+
// Disabled until use metric is implemented
34+
// const [useMetric, setUseMetric] = useState<boolean>(PreferencesSystem.getGlobalPreference<boolean>("UseMetric"))
35+
3236
const [renderScoringZones, setRenderScoringZones] = useState<boolean>(
3337
PreferencesSystem.getGlobalPreference<boolean>("RenderScoringZones")
3438
)
@@ -44,29 +48,32 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
4448

4549
const saveSettings = () => {
4650
PreferencesSystem.setGlobalPreference<string>("QualitySettings", qualitySettings)
47-
PreferencesSystem.setGlobalPreference<number>("ZoomSensitivity", zoomSensitivity)
48-
PreferencesSystem.setGlobalPreference<number>("PitchSensitivity", pitchSensitivity)
49-
PreferencesSystem.setGlobalPreference<number>("YawSensitivity", yawSensitivity)
51+
5052
PreferencesSystem.setGlobalPreference<boolean>("ReportAnalytics", reportAnalytics)
51-
PreferencesSystem.setGlobalPreference<boolean>("UseMetric", useMetric)
5253
PreferencesSystem.setGlobalPreference<boolean>("RenderScoringZones", renderScoringZones)
5354
PreferencesSystem.setGlobalPreference<boolean>("RenderSceneTags", renderSceneTags)
5455
PreferencesSystem.setGlobalPreference<boolean>("RenderScoreboard", renderScoreboard)
5556
PreferencesSystem.setGlobalPreference<boolean>("SubsystemGravity", subsystemGravity)
5657

58+
// Disabled until these settings are implemented
59+
/* PreferencesSystem.setGlobalPreference<number>("ZoomSensitivity", zoomSensitivity)
60+
PreferencesSystem.setGlobalPreference<number>("PitchSensitivity", pitchSensitivity)
61+
PreferencesSystem.setGlobalPreference<number>("YawSensitivity", yawSensitivity)
62+
PreferencesSystem.setGlobalPreference<boolean>("UseMetric", useMetric) */
63+
5764
PreferencesSystem.savePreferences()
5865
}
5966

6067
return (
6168
<Modal
6269
name="Settings"
63-
icon={<FaGear />}
70+
icon={SynthesisIcons.GearLarge}
6471
modalId={modalId}
6572
onAccept={() => {
6673
saveSettings()
6774
}}
6875
>
69-
<div className="flex overflow-y-auto flex-col gap-2 bg-background-secondary rounded-md p-2 max-h-[60vh]">
76+
<div className="flex overflow-y-auto flex-col gap-2 bg-background-secondary rounded-md p-2 max-h-[60vh] min-w-[20vw]">
7077
<Label size={LabelSize.Medium}>Screen Settings</Label>
7178
<Dropdown
7279
label="Quality Settings"
@@ -77,7 +84,9 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
7784
World.SceneRenderer.ChangeLighting(selected)
7885
}}
7986
/>
80-
{Spacer(5)}
87+
88+
{/* Disabled until these settings are implemented */}
89+
{/* {Spacer(5)}
8190
<Label size={LabelSize.Medium}>Camera Settings</Label>
8291
<Slider
8392
min={1}
@@ -106,7 +115,7 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
106115
format={{ maximumFractionDigits: 2 }}
107116
onChange={(_, value) => setYawSensitivity(value as number)}
108117
tooltipText="Moving the camera left and right."
109-
/>
118+
/>*/}
110119
{Spacer(20)}
111120
<Label size={LabelSize.Medium}>Preferences</Label>
112121
<Box display="flex" flexDirection={"column"}>
@@ -118,13 +127,15 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
118127
}}
119128
tooltipText="Record user data such as what robots are spawned and how they are configured. No personal data will be collected."
120129
/>
121-
<Checkbox
130+
{/* Disabled until this settings is implemented */}
131+
{/* <Checkbox
122132
label="Use Metric"
123133
defaultState={PreferencesSystem.getGlobalPreference<boolean>("UseMetric")}
124134
onClick={checked => {
125135
setUseMetric(checked)
126136
}}
127-
/>
137+
tooltipText="Metric measurements. (ex: meters instead of feet)"
138+
/> */}
128139
<Checkbox
129140
label="Realistic Subsystem Gravity"
130141
defaultState={PreferencesSystem.getGlobalPreference<boolean>("SubsystemGravity")}

fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const NewInputSchemeModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
1616
return (
1717
<Modal
1818
name="New Input Scheme"
19-
icon={SynthesisIcons.Add}
19+
icon={SynthesisIcons.AddLarge}
2020
modalId={modalId}
2121
onAccept={() => {
2222
const scheme = DefaultInputs.newBlankScheme

fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const ChooseInputSchemePanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
7373
sidePadding={8}
7474
acceptEnabled={false}
7575
icon={SynthesisIcons.Gamepad}
76-
cancelEnabled={selectedBrainIndexGlobal != undefined}
7776
cancelName="Close"
7877
>
7978
{/** A scroll view with buttons to select default and custom input schemes */}

fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,19 @@ const ConfigureInputsInterface = () => {
7777
// Fetch current custom schemes
7878
InputSchemeManager.saveSchemes()
7979
InputSchemeManager.resetDefaultSchemes()
80-
const schemes = PreferencesSystem.getGlobalPreference<InputScheme[]>("InputSchemes")
8180

82-
// Find and remove this input scheme
81+
// Find the scheme to remove in preferences
82+
const schemes = PreferencesSystem.getGlobalPreference<InputScheme[]>("InputSchemes")
8383
const index = schemes.indexOf(val.scheme)
84+
85+
// If currently bound to a robot, remove the binding
86+
for (const [key, value] of InputSystem.brainIndexSchemeMap.entries()) {
87+
if (value == schemes[index]) {
88+
InputSystem.brainIndexSchemeMap.delete(key)
89+
}
90+
}
91+
92+
// Find and remove this input scheme from preferences
8493
schemes.splice(index, 1)
8594

8695
// Save to preferences

0 commit comments

Comments
 (0)