Repository navigation
Expose skeletal animation data (mesh.bones, scene.animations) - #19
Merged
Merged
Conversation
Closes #14 - New Bone type: name, offset_matrix (4x4 tuple), parallel memoryviews weights (float32) / weight_vertex_ids (uint32), and armature_name / node_name (populated only with Process_PopulateArmatureData) - New Animation type: name, duration, ticks_per_second, channels - New NodeAnim type: node_name, position/rotation/scaling key tracks as parallel memoryviews (float64 times + float32 values), pre/post states - Mesh gains bones/num_bones; Scene gains animations/num_animations (empty lists when absent) - New constants: Process_PopulateArmatureData, AnimBehaviour_* - Stubs and README skeletal animation section - Tests: tests/test_skeletal.py + fox fixture in test_models.py using Fox.glb from KhronosGroup/glTF-Sample-Assets (license included)
memoryviews were created with a NULL base object, so their backing buffers were freed with the owning Mesh/Bone/NodeAnim even while views still referenced them - reading mesh.vertices after dropping the Scene was undefined behavior (present since 1.1.0; caught by the new test_memoryviews_outlive_scene). Buffers now transfer ownership to an internal _BufferKeeper type that exports the buffer protocol; views hold a strong reference to the keeper, and the data is freed when the last view is released. Also rewrite scripts/memprof.py as an RSS leak harness covering the skeletal paths (fox plain/skeletal/retained-views cases, global warmup, confirmation pass against allocator step noise); --lines keeps the old memory_profiler line mode.
- examples/demo.py: pygame + moderngl demo rendering the textured cyborg next to the GPU-skinned animated fox. Animation is evaluated from the new bones/animations API in numpy (keyframe lerp/slerp, hierarchy walk, palette = global(node) @ offset_matrix) and skinned in the vertex shader. Orbit camera, HUD, wireframe (skinned) and skeleton overlays; --screenshot for headless verification. Wire via 'pip install assimp-py[demo]' / 'make demo'. - scripts/memprof.py: RSS-based leak harness over cyborg/planet/fox (plain, skeletal, retained-memoryviews) cases with allocator warmup and a confirmation pass; --lines keeps memory_profiler line mode. - tests: memoryviews must stay valid after the Scene is released. - To guarantee that, exported memoryviews are now backed by an internal buffer-keeper object so the data lives as long as any view (previously buffers died with their owner while views could still exist).
Channel order comes from an unordered_map in assimp and differs across platforms (MSVC vs libstdc++); pinning channels[0] broke on Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14
API
Also included
test_memoryviews_outlive_scene.scripts/memprof.pyrewritten as an RSS leak harness (cyborg / planet / fox plain / fox skeletal / retained-memoryviews cases, allocator warmup + confirmation pass). All cases clean.examples/demo.py(pip install assimp-py[demo],make demo): pygame + moderngl demo — textured cyborg + GPU-skinned animated fox, animation evaluated in numpy from the new API (lerp/slerp keyframes, hierarchy walk,global(node) @ offset_matrixpalette), orbit camera, HUD, skinned wireframe + skeleton overlays,--screenshotheadless mode.tests/test_skeletal.py+ fox fixture — bones (counts, names, offset matrices, parallel weight views, per-vertex weight sums), animations (3 Fox cycles with pinned durations/keys), armature/node names with and without the flag, empty-list behavior for static meshes. Fixture:Fox.glbfrom KhronosGroup/glTF-Sample-Assets (license included)..pyistubs updated.Out of scope (follow-ups)
Morph-target/mesh-swap animation channels (needs
aiMesh::mAnimMeshesexposure), key-level interpolation data.