Skip to content

Gizmo/bone improvements#157

Merged
nmfisher merged 24 commits into
developfrom
port/gizmo-new-files
Apr 29, 2026
Merged

Gizmo/bone improvements#157
nmfisher merged 24 commits into
developfrom
port/gizmo-new-files

Conversation

@nmfisher
Copy link
Copy Markdown
Owner

@nmfisher nmfisher commented Apr 29, 2026

This PR supports attaching gizmos to bones (rather than simply top-level entities), and a material to assist with visualizing bones.

nmfisher and others added 15 commits April 29, 2026 12:28
…/gizmo

Port standalone new files from the feature/gizmo branch that have no
conflicts with develop. This includes:

- Custom TransformationGizmo with translation, rotation, scale modes
- GeometryHelper (sphere, cylinder, cone, torus, ring builders)
- Bone visualizer with Blender-style head/tail shapes
- Gizmo attachment delegate for click-to-attach entity/bone picking
- Chained input delegate for combining multiple handlers
- Compiled gizmo material resources and source (.mat)
- createGizmoMaterial() on FilamentApp
- Barrel export updates and build script

Some files have compile errors pending missing AnimationManager APIs
(getBoneEntities, getBoneParent, getBone) that will be ported separately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…sites

Port the two remaining missing APIs from feature/gizmo and update all
call sites to use the correct APIs on this branch (asset.getBones() etc.
instead of AnimationManager.getBoneEntities()).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add bone_overlay.mat (view-dependent unlit material with baseColorFactor)
- Add bone_overlay to materials/build.sh for compilation
- Add Material_createBoneOverlayMaterialRenderThread wrapper in
  ThermionDartRenderThreadApi.cpp to fix runtime symbol lookup error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…version

This fixes gizmo positioning for hierarchical entities (like bones).

Key changes:
- Changed attachTo to async and properly await show/update
- Changed update() to use getWorldTransform instead of getLocalTransform
- Added check to prevent gizmo repositioning during active drag
- Added _gizmoStartPosition and _lastComputedWorldTransform fields
- Added lastComputedWorldTransform getter for callbacks
- Updated startDrag to initialize new fields
- Updated _updateTranslationDrag to use world transforms and convert to local
- Updated _updateRotationDrag to use world transforms and convert to local
- Added _worldToLocalTransform helper method for proper hierarchy handling
- Updated endDrag and endDragAndRehover to clean up new fields
- Updated GizmoAttachmentDelegate to use lastComputedWorldTransform in callback

Resolves issue where gizmo was not showing up when attached to bones
because getLocalTransform was returning local coordinates instead of
world coordinates for bones in a hierarchy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The gizmo material was:
1. Not included in the materialSources map in build.dart
2. Using wrong material data (UNLIT_FIXED_SIZE instead of GIZMO)

This caused the gizmo to not render because:
- The material wasn't being linked into the native library
- Even if linked, it was loading the wrong material bytecode

Changes:
- Added 'gizmo' to materialSources map in hook/build.dart
- Added #include "material/gizmo.h" to TMaterialInstance.cpp
- Fixed Material_createGizmoMaterial to use GIZMO_GIZMO_DATA/SIZE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The gizmoType field was marked as final, which meant setGizmoType()
was recreating the gizmo with the same old type instead of the new type.

Changes:
- Removed final modifier from gizmoType field
- Updated setGizmoType to set gizmoType = type before recreating gizmo

This allows switching between rotation and translation gizmos correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
For skinned mesh bones, the gizmo should not directly set the entity
transform via TransformManager. Instead, bone transforms should only be
updated via AnimationManager.setBoneTransform().

The gizmo was calling setTransform() on bone entities, which conflicted
with the skinning system and caused rotation around origin instead of
translation along the selected axis.

Changes:
- Added _updateEntityTransform flag to TransformationGizmo
- Added updateEntityTransform parameter to attachTo() method
- Translation and rotation drags now check flag before calling setTransform
- GizmoAttachmentDelegate sets flag to false for bones, true for entities
- Simplified attachTo in delegate to always call gizmo.attachTo

This allows the callback to handle bone transforms through AnimationManager
while the gizmo still computes correct transforms for visual feedback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The gizmo and orbit camera delegates were both processing every left-mouse
event, so dragging a gizmo axis simultaneously orbited the camera. The
resulting visual looked like the target rotating around a fixed point.

Adds a `consumesEvents` hook on InputHandlerDelegate that ChainedDelegate
honors to stop propagation; GizmoAttachmentDelegate consumes events while an
axis drag is active. Also drops the `_updateEntityTransform` flag that
previously short-circuited bone transforms — bones now go through the same
world→local setTransform path as any other entity, with the skeleton_viewer
callback responsible for flushing skinning via updateBoneMatrices.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Flutter skeleton viewer that displays a glTF skinned mesh
alongside a runtime-constructed skinned mesh (two cubes, two bones
with parent-child hierarchy). Both share visibility toggles and gizmo
interaction. Runtime bone visualization uses bone overlay material
with priority 7 rendering and screen-space distance picking.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The cube_with_armature.glb asset was replaced; update test references
to use the equivalent cube_with_morph_targets.glb.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add render-thread-safe setTransformAsync to TransformManager for
setting transforms from outside the render pass (e.g. gizmo callbacks).
Update bone visualizer's update() to use it, avoiding race conditions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove AnimationManager.getBoneParent() from all layers (Dart, C API, C++).
Replace with helper functions in tests that use existing APIs:
- asset.getBones() to get bone entities
- FilamentApp.getParent() to get parent entity
- indexOf() to find parent bone index

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nmfisher nmfisher force-pushed the port/gizmo-new-files branch from de96b22 to 0aa86ca Compare April 29, 2026 04:28
nmfisher and others added 9 commits April 29, 2026 12:36
🤖 Generated with GitHub Actions
- Delete geometry.dart with GeometryHelper class
- Add plane.dart with quad, plane, and groundPlane geometries
- Add capsule.dart with capsule geometry
- Add cone.dart with conic geometry
- Add aabb.dart with fromAabb3 method
- Update utils.dart to export new geometry files
- Fix GeometryHelper references to use new split classes

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ils)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nmfisher nmfisher merged commit bcd8a3f into develop Apr 29, 2026
2 of 4 checks passed
@nmfisher nmfisher deleted the port/gizmo-new-files branch April 29, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant