diff --git a/blocks/models.js b/blocks/models.js index 3ce7b715..50806808 100644 --- a/blocks/models.js +++ b/blocks/models.js @@ -561,15 +561,16 @@ export function defineModelBlocks() { changeEvent.type === Blockly.Events.BLOCK_CREATE && Array.isArray(changeEvent.ids) && changeEvent.ids.includes(this.id); + if (changeEvent.blockId === this.id || isThisBlockCreated) { + if (handleMeshLifecycleChange(this, changeEvent)) return; + } + if ( - this.id !== changeEvent.blockId && - changeEvent.type !== Blockly.Events.BLOCK_CHANGE && - !isThisBlockCreated - ) + handleParentLinkedUpdate(this, changeEvent) || + handleFieldOrChildChange(this, changeEvent) + ) { return; - - if (handleMeshLifecycleChange(this, changeEvent)) return; - if (handleFieldOrChildChange(this, changeEvent)) return; + } }); addDoMutatorWithToggleBehavior(this); diff --git a/ui/addmeshes.js b/ui/addmeshes.js index aced16bf..3b8cc775 100644 --- a/ui/addmeshes.js +++ b/ui/addmeshes.js @@ -152,9 +152,9 @@ export function createMeshOnCanvas(block) { .connection.targetBlock() .getFieldValue("NUM"); - meshId = modelName + "_" + generateUniqueId(); - meshMap[meshId] = block; - meshBlockIdMap[meshId] = block.id; + meshId = `${modelName}__${block.id}`; + meshMap[block.id] = block; + meshBlockIdMap[block.id] = block.id; // Use flock API for loading models newMesh = flock.createModel({ diff --git a/ui/gizmos.js b/ui/gizmos.js index ea98a92e..86aa2f1a 100644 --- a/ui/gizmos.js +++ b/ui/gizmos.js @@ -1075,6 +1075,7 @@ export function toggleGizmo(gizmoType) { }); break; + case "load_model": case "load_multi_object": case "load_object": case "load_character": {