Add find_node and find_material methods, remove deprecated count properties - #8
Merged
Merged
Conversation
- Add node_count property to get number of nodes in scene - Add mesh_count property to get number of meshes in scene - Add find_node(name) method to find node by name - Add find_material(name) method to find material by name - Add ufbx_find_node and ufbx_find_material extern declarations
- Remove Scene.node_count and Scene.mesh_count (not in API.md) - Update basic_usage.py to demonstrate find_node/find_material - Update tests to use len(scene.nodes) and len(scene.meshes) - Keep only API documented in API.md
Node new properties: - attrib_type: ElementType enum for attribute type - inherit_mode: InheritMode enum for transform inheritance - visible: bool visibility flag - euler_rotation: Vec3 euler angles in degrees Mesh new properties: - faces: list of (index_begin, num_indices) tuples - face_material: numpy array of face material indices - skin_deformers: list of SkinDeformer attached to mesh - blend_deformers: list of BlendDeformer attached to mesh - edge_crease: numpy array of edge crease values - vertex_crease: numpy array of vertex crease values Also updates: - ufbx_wrapper.h/c with new wrapper functions - __init__.pyi type hints - API.md documentation status
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.
Summary
This PR adds
find_node()andfind_material()methods to the Scene class for convenient lookup of nodes and materials by name, while removing the deprecatednode_countandmesh_countproperties in favor of usinglen(scene.nodes)andlen(scene.meshes).Key Changes
Scene.find_node(name)andScene.find_material(name)methods that wrap the underlying ufbx C library functions (ufbx_find_nodeandufbx_find_material)node_countandmesh_countproperties from the Scene class type hintsscene.node_countwithlen(scene.nodes)andscene.mesh_countwithlen(scene.meshes)throughout the codebaseImplementation Details
Noneif the requested node/material is not foundufbx_find_nodeandufbx_find_materialare declared in the Cython extern block