From b471e48c305b6fdee69a862b50547a59dd368c4d Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 22 May 2019 21:33:50 +0200 Subject: fix T64873 collada export crashes Blender on Mac --- source/blender/collada/AnimationExporter.cpp | 4 ++-- source/blender/collada/collada_utils.cpp | 13 +++++++------ source/blender/collada/collada_utils.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index a34f92f66d6..eaa1626f7d8 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -79,13 +79,13 @@ bool AnimationExporter::exportAnimations() { Scene *sce = blender_context.get_scene(); - LinkNode &export_set = *this->export_settings->export_set; + LinkNode *export_set = this->export_settings->export_set; bool has_anim_data = bc_has_animations(sce, export_set); int animation_count = 0; if (has_anim_data) { BCObjectSet animated_subset; - BCAnimationSampler::get_animated_from_export_set(animated_subset, export_set); + BCAnimationSampler::get_animated_from_export_set(animated_subset, *export_set); animation_count = animated_subset.size(); BCAnimationSampler animation_sampler(blender_context, animated_subset); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 9f2d3f951ec..c0e3ab2ca47 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -1026,15 +1026,16 @@ bool bc_has_animations(Object *ob) return false; } -bool bc_has_animations(Scene *sce, LinkNode &export_set) +bool bc_has_animations(Scene *sce, LinkNode *export_set) { LinkNode *node; + if (export_set) { + for (node = export_set; node; node = node->next) { + Object *ob = (Object *)node->link; - for (node = &export_set; node; node = node->next) { - Object *ob = (Object *)node->link; - - if (bc_has_animations(ob)) - return true; + if (bc_has_animations(ob)) + return true; + } } return false; } diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index dfd5519be31..522aeb1ad1e 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -235,7 +235,7 @@ extern bool bc_get_property_matrix(Bone *bone, std::string key, float mat[4][4]) extern void bc_enable_fcurves(bAction *act, char *bone_name); extern bool bc_bone_matrix_local_get(Object *ob, Bone *bone, Matrix &mat, bool for_opensim); extern bool bc_is_animated(BCMatrixSampleMap &values); -extern bool bc_has_animations(Scene *sce, LinkNode &node); +extern bool bc_has_animations(Scene *sce, LinkNode *node); extern bool bc_has_animations(Object *ob); extern void bc_create_restpose_mat(const ExportSettings *export_settings, -- cgit v1.2.3