MCPcopy Create free account
hub / github.com/Kitware/VTK / ResetAnimation

Method ResetAnimation

IO/Geometry/vtkGLTFDocumentLoader.cxx:1122–1154  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1120
1121//------------------------------------------------------------------------------
1122void vtkGLTFDocumentLoader::ResetAnimation(int animationId)
1123{
1124 const Animation& animation = this->InternalModel->Animations[animationId];
1125 for (const Animation::Channel& channel : animation.Channels)
1126 {
1127 if (channel.TargetNode >= static_cast<int>(this->InternalModel->Nodes.size()))
1128 {
1129 vtkWarningMacro("Invalid target node, skipping reset");
1130 continue;
1131 }
1132
1133 Node& node = this->InternalModel->Nodes[channel.TargetNode];
1134 switch (channel.TargetPath)
1135 {
1136 case Animation::Channel::PathType::ROTATION:
1137 node.Rotation = node.InitialRotation;
1138 break;
1139 case Animation::Channel::PathType::TRANSLATION:
1140 node.Translation = node.InitialTranslation;
1141 break;
1142 case Animation::Channel::PathType::SCALE:
1143 node.Scale = node.InitialScale;
1144 break;
1145 case Animation::Channel::PathType::WEIGHTS:
1146 node.Weights = node.InitialWeights;
1147 break;
1148 default:
1149 vtkErrorMacro(
1150 "Invalid animation.channel.target.path value for animation " << animation.Name);
1151 }
1152 node.UpdateTransform();
1153 }
1154}
1155
1156//------------------------------------------------------------------------------
1157bool vtkGLTFDocumentLoader::BuildPolyDataFromPrimitive(Primitive& primitive)

Callers 1

RequestDataMethod · 0.80

Calls 2

sizeMethod · 0.45
UpdateTransformMethod · 0.45

Tested by

no test coverage detected