Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/collada/collada_utils.cpp')
-rw-r--r--source/blender/collada/collada_utils.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index aa6f0b3c515..041ffd48f9d 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -34,11 +34,14 @@
#include "collada_utils.h"
+extern "C" {
+
#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
+#include "DNA_armature_types.h"
#include "BLI_math.h"
@@ -49,13 +52,13 @@
#include "BKE_mesh.h"
#include "BKE_scene.h"
-extern "C" {
#include "BKE_DerivedMesh.h"
#include "BLI_linklist.h"
-}
+
#include "WM_api.h" // XXX hrm, see if we can do without this
#include "WM_types.h"
+}
float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
{
@@ -181,6 +184,7 @@ Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *o
return ancestor;
}
+
bool bc_is_base_node(LinkNode *export_set, Object *ob)
{
Object *root = bc_get_highest_selected_ancestor_or_self(export_set, ob);
@@ -253,3 +257,23 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
}
}
}
+
+/* Check if a bone is the top most exportable bone in the bone hierarchy.
+ * When deform_bones_only == false, then only bones with NO parent
+ * can be root bones. Otherwise the top most deform bones in the hierarchy
+ * are root bones.
+ */
+bool bc_is_root_bone(Bone *aBone, bool deform_bones_only) {
+ if(deform_bones_only) {
+ Bone *root = NULL;
+ Bone *bone = aBone;
+ while (bone) {
+ if (!(bone->flag & BONE_NO_DEFORM))
+ root = bone;
+ bone = bone->parent;
+ }
+ return aBone==root;
+ }
+ else
+ return !(aBone->parent);
+}