MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / SetAnimation

Method SetAnimation

src/Nazara/Graphics/SkeletalModel.cpp:274–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272 */
273
274 bool SkeletalModel::SetAnimation(Animation* animation)
275 {
276 #if NAZARA_GRAPHICS_SAFE
277 if (!m_mesh)
278 {
279 NazaraError("Model has no mesh");
280 return false;
281 }
282
283 if (animation)
284 {
285 if (!animation->IsValid())
286 {
287 NazaraError("Invalid animation");
288 return false;
289 }
290
291 if (animation->GetType() != m_mesh->GetAnimationType())
292 {
293 NazaraError("Animation type must match mesh animation type");
294 return false;
295 }
296
297 if (animation->GetJointCount() != m_mesh->GetJointCount())
298 {
299 NazaraError("Animation joint count must match mesh joint count");
300 return false;
301 }
302 }
303 #endif
304
305 m_animation = animation;
306 if (m_animation)
307 {
308 m_currentFrame = 0;
309 m_interpolation = 0.f;
310
311 SetSequence(0);
312 }
313
314 return true;
315 }
316
317 /*!
318 * \brief Sets the mesh for the model

Callers

nothing calls this directly

Calls 4

IsValidMethod · 0.45
GetTypeMethod · 0.45
GetAnimationTypeMethod · 0.45
GetJointCountMethod · 0.45

Tested by

no test coverage detected