Added pmxPhysicsNode - #7
Merged
Merged
Conversation
…ay mask, matrix4ToMMatrix
…gin include path)
~PhysicsNode() only called destroyWorld(), but the members self-clean: mSim tears down the Bullet world in its PIMPL destructor, mBodies/mJoints are plain vectors. postConstructor() was an empty no-op override. Keep destroyWorld() — it resets to the unbuilt state for in-place rebuilds (rebuildSimulationAtCurrentPose). As a polymorphic MPxNode subclass, the destructor is re-declared as an explicitly-defaulted override (defaulted out-of-line in the cpp) so the virtual-destruction intent is documented. Also replace clang-format-unstable multi-line NOLINTBEGIN/NOLINTEND and a reflowed line-end NOLINT with single-line NOLINTNEXTLINE comments so the suppressions survive formatting.
- rebuildSimulationAtCurrentPose: the pre-destroy updateKinematicAnchors() call ran against the old world that is discarded by destroyWorld() — its effect was wiped, only the post-rebuild re-apply matters. Removed. - physics_node.h: merge the duplicated 'THE collision mask' comment block on aBodyMaskGroup. - buildWorld: read gravity via one cached asDouble3() pointer instead of calling asDouble3() three times. - collectDrawData: the pre-first-compute plug fallback now skips disabled bodies (mirrors the solved-pose path). - integration test: drop the dead identity setAttr on anchorWorldMatrix[0] (immediately overwritten by the translated matrix).
…p inverse, configVersion
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
Native rigid-body physics node in as a registered plugin node and creates one empty
pmxPhysicsNodeper imported model — per the plan, the node exists but is not configured yet (no bodies/joints, no write-back — those come with the rigid-body commands PR).What's included
C++ node (
mmd/maya/nodes/)physics_node.{h,cpp}—pmxPhysicsNode, anMPxLocatorNodethat owns the Maya-free Bullet world frommmd/core(viammd_core). Full attribute surface (bodies/joints compound arrays, anchors, write-back offsets, outputs) + the timeline/state machine (compute()), adapted to the refined core API from Bullet physics engine #6:PhysicsMode/ColliderTypeenums with explicit attribute↔engine collider mapping (the persisted attribute enumkColliderBox=1…differs from the engine's PMX-alignedeSphere=0…)poseToTransform/storePose/btTransformToRowMatrix/doubleMatrixToBtTransform/rowMatrixMultiplymoved toMatrix4+bullet_bridge.hppdata()+out[0..2]write pattern (realArrayBoundfindings)mmd/maya/nodes/.clang-tidy— same profile as root minus three Maya-API-noise checks (copy-init, C-array decay, constant-array-index) for the adapter.mmd/MayaMMD.cpp— registerspmxPhysicsNode(locator + classification) and deregisters it. No draw override yet (intentionally — being redesigned), no commands.Python wiring (
mmd/maya/pmx/)rigid_body_builder.py(new) —create_physics_from_pmx_data(): creates the{model}_Physicsgroup + one emptypmxPhysicsNodeunder it, gravity set to −9.8.timeis deliberately not connected yet (empty bodies →compute()would fail every frame; the full builder connects it with the body population).pmx_naming_manager.py—get_physics_group_name()/get_physics_solver_name().pmx_scene_builder.py—build_pmx_scenecalls the builder and stamps the solver name on the model root (pmxPhysicsNodestring attribute) for discovery.