Skip to content

Commit

Permalink
Don't reload models when rearranging robot objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Oct 6, 2024
1 parent d85e30c commit 1a04bbb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/shared/renderers/ThreeDimensionRendererImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,16 @@ export default class ThreeDimensionRendererImpl implements TabRenderer {
// Update object managers
this.objectManagers.forEach((entry) => (entry.active = false));
command.objects.forEach((object) => {
let entry = this.objectManagers.find((entry) => !entry.active && entry.type === object.type);
let entry = this.objectManagers.find(
(entry) =>
!entry.active &&
entry.type === object.type &&
((object.type !== "robot" && object.type !== "ghost") ||
object.model === (entry.manager as RobotManager).getModel())
);
if (entry === undefined) {
entry = this.objectManagers.find((entry) => !entry.active && entry.type === object.type);
}
if (entry === undefined) {
entry = {
type: object.type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export default class RobotManager extends ObjectManager<
this.hasNewAssets = true;
}

getModel(): string {
return this.lastModel;
}

setObjectData(object: ThreeDimensionRendererCommand_RobotObj | ThreeDimensionRendererCommand_GhostObj): void {
let robotConfig = window.assets?.robots.find((robotData) => robotData.name === object.model);

Expand Down

0 comments on commit 1a04bbb

Please sign in to comment.