urho3d/urho3d

Non-Master AnimatedModel Removing Skeleton

SirNate0 opened this issue · 0 comments

The non-master AnimatedModel for a Node can remove the Skeleton in a number of cases, resulting in very broken model renders. Basically, these are edge cases where the same underlying bug of #439 has not been fixed completely.

  1. SetModel(nullptr) calls RemoveRootBone(); // Remove existing root bone if any
  2. In certain circumstances just removing the non-master model can do it as well (specifically, if the node heirarchy has been edited to insert nodes between the AnimatedModel's node and the RootBone's node). When being removed from a node, the model has SetNode(nullptr) called on it (in Node::RemoveComponent) and then the component is actually erased from the Vector<SharedPtr<Component>> components_, which calls the destructor (assuming no other references). ~AnimatedModel() then checks for a node on the root bone, and if the node's parent does not have a(nother) AnimatedModel, the skeleton is removed.

I believe either scenario can be solved by adding a check for isMaster_ in AnimatedModel::RemoveRootBone(). However, I'm not sure I am not missing any subtleties that might make this approach fail or break something else.

Are there any thoughts on the matter?