diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2012-06-16 02:00:25 +0400 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2012-06-16 02:00:25 +0400 |
commit | 9f6a66d5f9feb34377cf0e6465020cc80f673d8e (patch) | |
tree | 769bcd7da9a8f762f4a12dbb6206380703f8805b /source/blender/collada/collada_utils.cpp | |
parent | a2d4fddfd38ce0795d21ec9c5b5cc51fc50f3bd1 (diff) |
Collada: (Exporter) Add new option 'deform bones only'
Diffstat (limited to 'source/blender/collada/collada_utils.cpp')
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 28 |
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); +} |