| 32 | } |
| 33 | |
| 34 | void BoneSocket::UpdateTransformation() |
| 35 | { |
| 36 | const auto parent = dynamic_cast<AnimatedModel*>(GetParent()); |
| 37 | if (parent && parent->SkinnedModel) |
| 38 | { |
| 39 | if (_index == -1) |
| 40 | { |
| 41 | _index = parent->SkinnedModel->Skeleton.FindNode(_node); |
| 42 | if (_index == -1) |
| 43 | return; |
| 44 | // TODO: maybe track when skinned model gets unloaded to clear cached node _index? |
| 45 | } |
| 46 | |
| 47 | auto& nodes = parent->GraphInstance.NodesPose; |
| 48 | Transform t; |
| 49 | if (nodes.IsValidIndex(_index)) |
| 50 | nodes.Get()[_index].Decompose(t); |
| 51 | else |
| 52 | t = parent->SkinnedModel->Skeleton.GetNodeTransform(_index); |
| 53 | if (!_useScale) |
| 54 | t.Scale = _localTransform.Scale; |
| 55 | SetLocalTransform(t); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | #if USE_EDITOR |
| 60 |
no test coverage detected