Skip to content

Commit 650f1ee

Browse files
Merge dev
* 'dev' of github.com:Autodesk/synthesis: fix: make returns consistent fix: make the test match id not overlap with unit tests feat: update assetpack feat: load match mode configs from manifest file instead feat: hide unused wheeltypes feat: hide material tagging UI and mix and match toggle feat: store protected zones in devtools and configure the 2023 field fix: run formatter Update fission/src/mirabuf/MirabufSceneObject.ts Update fission/src/ui/panels/configuring/assembly-config/configure/AssemblySelection.tsx fix: make configure asset panel react to configuration changes and robot removals
2 parents b29d83b + e365104 commit 650f1ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+254
-214
lines changed

exporter/SynthesisFusionAddin/web/src/App.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useEffect, useState } from "react"
22

33
import "./App.css"
4-
import { RestartAlt, Settings, SportsFootball, Texture } from "@mui/icons-material"
4+
import { RestartAlt, Settings, SportsFootball } from "@mui/icons-material"
55
import DownloadIcon from "@mui/icons-material/Download"
66
import PrecisionManufacturingIcon from "@mui/icons-material/PrecisionManufacturing"
77
import SaveIcon from "@mui/icons-material/Save"
@@ -36,7 +36,7 @@ import GamepiecesConfigTab from "./ui/GamepiecesConfigTab.tsx"
3636
import GeneralConfigTab from "./ui/GeneralConfigTab.tsx"
3737
import GlobalAlert from "./ui/GlobalAlert.tsx"
3838
import JointsConfigTab from "./ui/JointsConfigTab.tsx"
39-
import MaterialTaggingTab, { type TaggedBody } from "./ui/MaterialTaggingTab.tsx"
39+
import type { TaggedBody } from "./ui/MaterialTaggingTab.tsx"
4040

4141
function TabPanel(props: { children?: React.ReactNode; value: number; index: number }) {
4242
const { children, value, index, ...other } = props
@@ -179,7 +179,11 @@ function App() {
179179
return (
180180
<ThemeProvider theme={theme}>
181181
<Backdrop
182-
sx={theme => ({ color: "#fff", zIndex: theme.zIndex.drawer + 1, backdropFilter: "blur(0px)" })}
182+
sx={theme => ({
183+
color: "#fff",
184+
zIndex: theme.zIndex.drawer + 1,
185+
backdropFilter: "blur(0px)",
186+
})}
183187
open={isSelecting}
184188
onClick={() => {
185189
Global_SetAlert(
@@ -227,7 +231,7 @@ function App() {
227231
disabled={generalConfig.exportMode === ExportMode.ROBOT}
228232
/>
229233

230-
<Tab icon={<Texture />} iconPosition={"start"} label="Materials" />
234+
{/*<Tab icon={<Texture />} iconPosition={"start"} label="Materials" />*/}
231235

232236
{/*<Tab label="APS" />*/}
233237
</Tabs>
@@ -252,13 +256,13 @@ function App() {
252256
selection={{ isSelecting, setIsSelecting }}
253257
/>
254258
</TabPanel>
255-
<TabPanel value={activeTab} index={3}>
256-
<MaterialTaggingTab
257-
tags={taggedBodies}
258-
updateTags={updateTaggedBodies}
259-
selection={{ isSelecting, setIsSelecting }}
260-
/>
261-
</TabPanel>
259+
{/*<TabPanel value={activeTab} index={3}>*/}
260+
{/* <MaterialTaggingTab*/}
261+
{/* tags={taggedBodies}*/}
262+
{/* updateTags={updateTaggedBodies}*/}
263+
{/* selection={{ isSelecting, setIsSelecting }}*/}
264+
{/* />*/}
265+
{/*</TabPanel>*/}
262266
<Container
263267
sx={{
264268
position: "sticky",

exporter/SynthesisFusionAddin/web/src/ui/GeneralConfigTab.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import AnimationIcon from "@mui/icons-material/Animation"
22
import ArchiveIcon from "@mui/icons-material/Archive"
33
import BalanceIcon from "@mui/icons-material/Balance"
44
import LaunchIcon from "@mui/icons-material/Launch"
5-
import PrecisionManufacturingIcon from "@mui/icons-material/PrecisionManufacturing"
65
import SaveIcon from "@mui/icons-material/Save"
76
import TuneIcon from "@mui/icons-material/Tune"
87
import {
@@ -135,13 +134,14 @@ function GeneralConfigTab({ config, updateConfigItem }: ConfigTabProps): React.R
135134
<Switch edge="end" onChange={updateLiteral("compressOutput")} checked={config.compressOutput} />
136135
</ListItem>
137136
<Collapse in={config.exportMode === ExportMode.ROBOT}>
138-
<ListItem>
139-
<ListItemIcon>
140-
<PrecisionManufacturingIcon />
141-
</ListItemIcon>
142-
<ListItemText primary="Export as Part" secondary="Use to export as a part for Mix And Match" />
143-
<Switch edge="end" onChange={updateLiteral("exportAsPart")} checked={config.exportAsPart} />
144-
</ListItem>
137+
{/* TODO: enable when mix and match is created */}
138+
{/*<ListItem>*/}
139+
{/* <ListItemIcon>*/}
140+
{/* <PrecisionManufacturingIcon />*/}
141+
{/* </ListItemIcon>*/}
142+
{/* <ListItemText primary="Export as Part" secondary="Use to export as a part for Mix And Match" />*/}
143+
{/* <Switch edge="end" onChange={updateLiteral("exportAsPart")} checked={config.exportAsPart} />*/}
144+
{/*</ListItem>*/}
145145
<ListItem>
146146
<ListItemIcon>
147147
<TuneIcon />

exporter/SynthesisFusionAddin/web/src/ui/JointsConfigTab.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ function JointsConfigTab({ joints, updateJoints, selection }: JointsConfigTabPro
207207
/>
208208

209209
<h4>
210-
{joints.filter(j => j.isWheel).length} Wheel{joints.filter(j => j.isWheel).length !== 1 ? "s" : ""}
210+
{joints.filter(j => j.isWheel).length} Wheel
211+
{joints.filter(j => j.isWheel).length !== 1 ? "s" : ""}
211212
</h4>
212213
<TableContainer component={Paper} elevation={6}>
213214
<Table sx={{ minWidth: 650 }} aria-label="simple table">
@@ -241,8 +242,8 @@ function JointsConfigTab({ joints, updateJoints, selection }: JointsConfigTabPro
241242
fullWidth
242243
>
243244
<MenuItem value={WheelType.STANDARD}>Standard</MenuItem>
244-
<MenuItem value={WheelType.MECANUM}>Mecanum</MenuItem>
245-
<MenuItem value={WheelType.OMNI}>Omni</MenuItem>
245+
{/*<MenuItem value={WheelType.MECANUM}>Mecanum</MenuItem>*/}
246+
{/*<MenuItem value={WheelType.OMNI}>Omni</MenuItem>*/}
246247
</Select>
247248
</TableCell>
248249
</TableRow>

fission/public/assetpack.zip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:23bfaf7899d84b00331c12bf1ada20d27d3c50856b14bb5733821b44848812ba
3-
size 193147860
2+
oid sha256:ea7be96ce500ebef474d55314ad0e547dac7015763664574978417016d64a6f6
3+
size 193148563

fission/src/Window.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ declare interface Window {
22
convertAuthToken(code: string): void
33
gtag?: (command: "config" | "set" | "get" | "event" | "consent", ...args: unknown[]) => void
44
dataLayer?: unknown[][]
5+
World?: unknown
56
}

fission/src/main.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ import "./index.css"
44
import APS from "./aps/APS"
55

66
window.convertAuthToken = code => APS.convertAuthToken(code)
7-
87
ReactDOM.createRoot(document.getElementById("root")!).render(<Synthesis />)

fission/src/mirabuf/FieldMiraEditor.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import type MirabufSceneObject from "@/mirabuf/MirabufSceneObject.ts"
2+
import { ContactType } from "@/mirabuf/ZoneTypes.ts"
23
import { mirabuf } from "@/proto/mirabuf"
4+
import { MatchModeType } from "@/systems/match_mode/MatchModeTypes.ts"
35
import {
46
defaultFieldPreferences,
57
type FieldPreferences,
8+
type ProtectedZonePreferences,
69
type ScoringZonePreferences,
710
} from "@/systems/preferences/PreferenceTypes"
811

912
export interface DevtoolMiraData {
1013
"devtool:scoring_zones": ScoringZonePreferences[]
11-
"devtool:camera_locations": unknown
14+
"devtool:protected_zones": ProtectedZonePreferences[]
1215
"devtool:spawn_locations": FieldPreferences["spawnLocations"]
1316
"devtool:a": unknown
1417
"devtool:b": unknown
@@ -50,6 +53,40 @@ export const devtoolHandlers = {
5053
)
5154
},
5255
},
56+
"devtool:protected_zones": {
57+
get(field) {
58+
return field.fieldPreferences?.protectedZones ?? defaultFieldPreferences().protectedZones
59+
},
60+
set(field, val) {
61+
val ??= defaultFieldPreferences().protectedZones
62+
if (!field.fieldPreferences || !this.validate(val)) {
63+
console.warn("validation failed", val, field.fieldPreferences)
64+
return
65+
}
66+
field.fieldPreferences.protectedZones = val
67+
field.updateProtectedZones()
68+
},
69+
validate(val): val is ProtectedZonePreferences[] {
70+
if (!Array.isArray(val)) return false
71+
return val.every(
72+
z =>
73+
typeof z === "object" &&
74+
z !== null &&
75+
typeof z.name === "string" &&
76+
(z.alliance === "red" || z.alliance === "blue") &&
77+
(typeof z.parentNode === "string" || z.parentNode === undefined) &&
78+
typeof z.penaltyPoints === "number" &&
79+
typeof z.contactType === "string" &&
80+
Object.values(ContactType).includes(z.contactType as ContactType) &&
81+
Array.isArray(z.activeDuring) &&
82+
z.activeDuring.every(
83+
(v: unknown) =>
84+
typeof v === "string" && Object.values(MatchModeType).includes(v as MatchModeType)
85+
) &&
86+
Array.isArray(z.deltaTransformation)
87+
)
88+
},
89+
},
5390
"devtool:spawn_locations": {
5491
get(field) {
5592
return field.fieldPreferences?.spawnLocations ?? defaultFieldPreferences().spawnLocations

fission/src/mirabuf/MirabufSceneObject.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,12 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
313313
if (this.miraType === MiraType.ROBOT || !cameraControls.focusProvider) {
314314
cameraControls.focusProvider = this
315315
}
316+
317+
MirabufObjectChangeEvent.dispatch(this)
316318
}
317319

318320
// Centered in xz plane, bottom surface of object
319-
private getPositionTransform(vec: THREE.Vector3) {
321+
public getPositionTransform(vec: THREE.Vector3 = new THREE.Vector3()) {
320322
const box = this.computeBoundingBox()
321323
const transform = box.getCenter(vec)
322324
transform.setY(box.min.y)
@@ -431,6 +433,7 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
431433
if (this._brain && this._brain instanceof SynthesisBrain) {
432434
this._brain.clearControls()
433435
}
436+
MirabufObjectChangeEvent.dispatch(null)
434437
}
435438

436439
public eject() {
@@ -986,3 +989,29 @@ export class RigidNodeAssociate extends BodyAssociate {
986989
}
987990

988991
export default MirabufSceneObject
992+
993+
export class MirabufObjectChangeEvent extends Event {
994+
private static _eventKey = "MirabufObjectChange"
995+
private _obj: MirabufSceneObject | null
996+
997+
private constructor(obj: MirabufSceneObject | null) {
998+
super(MirabufObjectChangeEvent._eventKey)
999+
this._obj = obj
1000+
}
1001+
1002+
public static addEventListener(cb: (object: MirabufSceneObject | null) => void): () => void {
1003+
const listener = (event: Event) => {
1004+
if (event instanceof MirabufObjectChangeEvent) {
1005+
cb(event._obj)
1006+
} else {
1007+
cb(null)
1008+
}
1009+
}
1010+
window.addEventListener(this._eventKey, listener)
1011+
return () => window.removeEventListener(this._eventKey, listener)
1012+
}
1013+
1014+
public static dispatch(obj: MirabufSceneObject | null) {
1015+
window.dispatchEvent(new MirabufObjectChangeEvent(obj))
1016+
}
1017+
}

fission/src/systems/World.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ class World {
8686
} catch (_) {
8787
World._analyticsSystem = undefined
8888
}
89+
90+
if (import.meta.env.DEV) {
91+
window.World = World
92+
}
8993
}
9094

9195
public static destroyWorld() {
Lines changed: 34 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,44 @@
11
import type { MatchModeConfig } from "@/ui/panels/configuring/MatchModeConfigPanel"
2-
import { convertFeetToMeters } from "@/util/UnitConversions"
2+
import { API_URL } from "@/util/Consts.ts"
3+
4+
type ManifestMatchModeConfig = Omit<MatchModeConfig, "id"> & { id: string }
5+
interface MatchConfigManifest {
6+
private: Record<string, ManifestMatchModeConfig>
7+
public: Record<string, ManifestMatchModeConfig>
8+
}
39

410
/** The purpose of this class is to store any defaults related to match mode configurations. */
511
class DefaultMatchModeConfigs {
6-
static frcReefscape2025 = (): MatchModeConfig => {
7-
return {
8-
id: "FRC-Reefscape-2025",
9-
name: "FRC Reefscape 2025",
10-
isDefault: true,
11-
autonomousTime: 15,
12-
teleopTime: 135,
13-
endgameTime: 20,
14-
ignoreRotation: true,
15-
maxHeight: Number.MAX_SAFE_INTEGER,
16-
heightLimitPenalty: 0,
17-
sideMaxExtension: convertFeetToMeters(1.5),
18-
sideExtensionPenalty: 0,
19-
}
20-
}
12+
private static readonly MANIFEST_LOCATION = `${API_URL}/match_configs/manifest.json`
13+
private static _configs: MatchModeConfig[] = []
2114

22-
static frcCrescendo2024 = (): MatchModeConfig => {
23-
return {
24-
id: "FRC-Crescendo-2024",
25-
name: "FRC Crescendo 2024",
26-
isDefault: true,
27-
autonomousTime: 15,
28-
teleopTime: 135,
29-
endgameTime: 20,
30-
ignoreRotation: true,
31-
maxHeight: convertFeetToMeters(4),
32-
heightLimitPenalty: 2,
33-
sideMaxExtension: convertFeetToMeters(1),
34-
sideExtensionPenalty: 2,
35-
}
15+
static {
16+
setTimeout(() => this.reload())
3617
}
37-
38-
static frcPowerUp2023 = (): MatchModeConfig => {
39-
return {
40-
id: "FRC-Power-Up-2023",
41-
name: "FRC Power Up 2023",
42-
isDefault: true,
43-
autonomousTime: 15,
44-
teleopTime: 135,
45-
endgameTime: 30,
46-
ignoreRotation: true,
47-
maxHeight: convertFeetToMeters(6.5),
48-
heightLimitPenalty: 5,
49-
sideMaxExtension: convertFeetToMeters(4),
50-
sideExtensionPenalty: 5,
18+
static async reload() {
19+
const manifest = await fetch(this.MANIFEST_LOCATION)
20+
const json: MatchConfigManifest | undefined = await manifest.json().catch(e => {
21+
console.error(e)
22+
return undefined
23+
})
24+
if (json == null) {
25+
console.error("Could not load match mode manifest")
26+
return undefined
27+
}
28+
const keys: (keyof MatchConfigManifest)[] = import.meta.env.DEV
29+
? (["public", "private"] as const)
30+
: (["public"] as const)
31+
for (const key of keys) {
32+
const configs = json[key as keyof MatchConfigManifest]
33+
Object.entries(configs).forEach(([key, value]) => {
34+
value.id = key
35+
this._configs.push(value)
36+
})
5137
}
5238
}
5339

54-
static matchTest = (): MatchModeConfig => {
55-
return {
56-
id: "Match-Test",
57-
name: "Match Test",
58-
isDefault: true,
59-
autonomousTime: 5,
60-
teleopTime: 15,
61-
endgameTime: 5,
62-
ignoreRotation: true,
63-
maxHeight: Number.MAX_SAFE_INTEGER,
64-
heightLimitPenalty: 0,
65-
sideMaxExtension: Number.MAX_SAFE_INTEGER,
66-
sideExtensionPenalty: 0,
67-
}
40+
public static get configs(): MatchModeConfig[] {
41+
return this._configs
6842
}
6943

7044
static fallbackValues = (): MatchModeConfig => {
@@ -76,22 +50,12 @@ class DefaultMatchModeConfigs {
7650
teleopTime: 135,
7751
endgameTime: 20,
7852
ignoreRotation: true,
79-
maxHeight: Number.MAX_SAFE_INTEGER,
53+
maxHeight: -1,
8054
heightLimitPenalty: 2,
81-
sideMaxExtension: Number.MAX_SAFE_INTEGER,
55+
sideMaxExtension: -1,
8256
sideExtensionPenalty: 2,
8357
}
8458
}
85-
86-
/** @returns {MatchModeConfig[]} New copies of the default match mode configs without reference to any others. */
87-
public static get defaultMatchModeConfigCopies(): MatchModeConfig[] {
88-
return [
89-
DefaultMatchModeConfigs.frcReefscape2025(),
90-
DefaultMatchModeConfigs.frcCrescendo2024(),
91-
DefaultMatchModeConfigs.frcPowerUp2023(),
92-
DefaultMatchModeConfigs.matchTest(),
93-
]
94-
}
9559
}
9660

9761
export default DefaultMatchModeConfigs

0 commit comments

Comments
 (0)