Refactor block event handling and add load_model gizmo support#467
Refactor block event handling and add load_model gizmo support#467tracygardner wants to merge 1 commit intomainfrom
Conversation
- Add load_model to scale gizmo switch case in gizmos.js so dragging the scale gizmo creates/updates a resize block in the DO section, consistent with load_character/load_object/load_multi_object - Update load_model block handler to use handleParentLinkedUpdate alongside handleFieldOrChildChange, matching the load_multi_object pattern so BLOCK_CREATE events on value-input children (e.g. connecting a number block to X/Y/Z/SCALE) also trigger mesh updates https://claude.ai/code/session_01CVKFvSifik74xZnSM6Fdwp
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe load_model block's event-handling pipeline was refactored to prioritize mesh lifecycle changes and consolidate parent-linked and field-update handling logic. Additionally, gizmo scale-resize functionality was extended to support load_model blocks alongside similar block types. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
This PR improves the event handling logic in block models and extends gizmo support to include the
load_modeltype.Key Changes
Refactored block event handling in
blocks/models.js:handleMeshLifecycleChangecheck to execute first when the event targets this block or represents a block creationhandleParentLinkedUpdateandhandleFieldOrChildChangechecks into a single conditional blockthis.id !== changeEvent.blockId && changeEvent.type !== Blockly.Events.BLOCK_CHANGE && !isThisBlockCreatedAdded
load_modelgizmo case inui/gizmos.js:load_modelcase alongside existing model loading cases (load_multi_object,load_object,load_character)Implementation Details
The refactoring in
blocks/models.jsimproves code clarity by:https://claude.ai/code/session_01CVKFvSifik74xZnSM6Fdwp