diff --git a/src/hub/controllers/ThreeDimensionController.ts b/src/hub/controllers/ThreeDimensionController.ts index fb0bee92..cecb289a 100644 --- a/src/hub/controllers/ThreeDimensionController.ts +++ b/src/hub/controllers/ThreeDimensionController.ts @@ -516,12 +516,22 @@ export default class ThreeDimensionController implements TabController { } } + // Get all robot models + let allRobotModels: Set = new Set(); + let allSources = this.sourceList.getState(); + allSources.forEach((source) => { + if (["robot", "robotLegacy", "ghost", "ghostLegacy", "ghostZebra"].includes(source.type)) { + allRobotModels.add(source.options.model); + } + }); + return { game: this.GAME_SELECT.value, origin: origin, objects: objects, cameraOverride: cameraOverride, - autoDriverStation: getDriverStation(window.log, time!) + autoDriverStation: getDriverStation(window.log, time!), + allRobotModels: [...allRobotModels] }; } } diff --git a/src/shared/renderers/ThreeDimensionRenderer.ts b/src/shared/renderers/ThreeDimensionRenderer.ts index 4f402739..b9dc94b8 100644 --- a/src/shared/renderers/ThreeDimensionRenderer.ts +++ b/src/shared/renderers/ThreeDimensionRenderer.ts @@ -109,6 +109,7 @@ export type ThreeDimensionRendererCommand = { objects: ThreeDimensionRendererCommand_AnyObj[]; cameraOverride: AnnotatedPose3d | null; autoDriverStation: number; + allRobotModels: string[]; }; export type ThreeDimensionRendererCommand_AnyObj = diff --git a/src/shared/renderers/ThreeDimensionRendererImpl.ts b/src/shared/renderers/ThreeDimensionRendererImpl.ts index 7f347412..47649c9a 100644 --- a/src/shared/renderers/ThreeDimensionRendererImpl.ts +++ b/src/shared/renderers/ThreeDimensionRendererImpl.ts @@ -620,6 +620,24 @@ export default class ThreeDimensionRendererImpl implements TabRenderer { } entry.manager.setObjectData(object); }); + this.objectManagers.forEach((entry) => { + if (!entry.active && (entry.type === "robot" || entry.type === "ghost")) { + let model = (entry.manager as RobotManager).getModel(); + if (command.allRobotModels.includes(model)) { + entry.active = true; + entry.manager.setObjectData({ + type: entry.type as "robot" | "ghost", + model: model, + color: "#000000", + poses: [], + components: [], + mechanism: null, + visionTargets: [], + swerveStates: [] + }); + } + } + }); this.objectManagers .filter((entry) => !entry.active) .forEach((entry) => {