diff --git a/examples/models/models_animation_blend_custom.c b/examples/models/models_animation_blend_custom.c index 6687609c2..690b9a0be 100644 --- a/examples/models/models_animation_blend_custom.c +++ b/examples/models/models_animation_blend_custom.c @@ -81,6 +81,16 @@ int main(void) int animCount = 0; ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/greenman.glb", &animCount); + // WARNING: Exit if example resources could not be loaded + if ((model.meshCount == 0) || (animCount == 0)) + { + TraceLog(LOG_WARNING, "MODEL: Example resources could not be loaded"); + UnloadModelAnimations(anims, animCount); + UnloadModel(model); + CloseWindow(); + return 1; + } + // Use specific animation indices: 2-walk/move, 3-attack int animIndex0 = 2; // Walk/Move animation (index 2) int animIndex1 = 3; // Attack animation (index 3) diff --git a/examples/models/models_animation_blending.c b/examples/models/models_animation_blending.c index 078e3978b..4cf14509c 100644 --- a/examples/models/models_animation_blending.c +++ b/examples/models/models_animation_blending.c @@ -71,6 +71,16 @@ int main(void) int animCount = 0; ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/robot.glb", &animCount); + // WARNING: Exit if example resources could not be loaded + if ((model.meshCount == 0) || (animCount == 0)) + { + TraceLog(LOG_WARNING, "MODEL: Example resources could not be loaded"); + UnloadModelAnimations(anims, animCount); + UnloadModel(model); + CloseWindow(); + return 1; + } + // Animation playing variables // NOTE: Two animations are played with a smooth transition between them int currentAnimPlaying = 0; // Current animation playing (0 o 1) diff --git a/examples/models/models_animation_gpu_skinning.c b/examples/models/models_animation_gpu_skinning.c index 4349ff0c2..bd354ac14 100644 --- a/examples/models/models_animation_gpu_skinning.c +++ b/examples/models/models_animation_gpu_skinning.c @@ -70,6 +70,16 @@ int main(void) int animCount = 0; ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/greenman.glb", &animCount); + // WARNING: Exit if example resources could not be loaded + if ((model.meshCount == 0) || (animCount == 0)) + { + TraceLog(LOG_WARNING, "MODEL: Example resources could not be loaded"); + UnloadModelAnimations(anims, animCount); + UnloadModel(model); + CloseWindow(); + return 1; + } + // Animation playing variables unsigned int animIndex = 0; // Current animation playing unsigned int animCurrentFrame = 0; // Current animation frame diff --git a/examples/models/models_animation_timing.c b/examples/models/models_animation_timing.c index b88deb49d..3325144d0 100644 --- a/examples/models/models_animation_timing.c +++ b/examples/models/models_animation_timing.c @@ -46,6 +46,16 @@ int main(void) int animCount = 0; ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/robot.glb", &animCount); + // WARNING: Exit if example resources could not be loaded + if ((model.meshCount == 0) || (animCount == 0)) + { + TraceLog(LOG_WARNING, "MODEL: Example resources could not be loaded"); + UnloadModelAnimations(anims, animCount); + UnloadModel(model); + CloseWindow(); + return 1; + } + // Animation playing variables int animIndex = 10; // Current animation playing float animCurrentFrame = 0.0f; // Current animation frame (supporting interpolated frames)