summaryrefslogtreecommitdiff
path: root/collada_superbmd_export.py
diff options
context:
space:
mode:
Diffstat (limited to 'collada_superbmd_export.py')
-rw-r--r--collada_superbmd_export.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/collada_superbmd_export.py b/collada_superbmd_export.py
index 5d6f83f..ad1363b 100644
--- a/collada_superbmd_export.py
+++ b/collada_superbmd_export.py
@@ -26,6 +26,8 @@ def write_bmd_bdl_collada(context, filepath, triangulate):
# get armature object
armature = scene.objects.active
print("\nArmature found: \"%s\"" % (armature.name))
+ # change to object mode
+ bpy.ops.object.mode_set(mode='OBJECT')
# check if the armature contains only mesh objects inside
for obj in armature.children:
@@ -45,11 +47,15 @@ def write_bmd_bdl_collada(context, filepath, triangulate):
bpy.ops.object.modifier_add(type = 'ARMATURE')
mesh.modifiers["Armature"].object = armature
mesh.modifiers["Armature"].use_vertex_groups = True
- else: # ensure bind is to a vertex group
+ else: # ensure bind is to a vertex group and that the bind is to the actual parent armature
if (mesh.modifiers["Armature"].use_vertex_groups == False):
blender_funcs.disp_msg("\"%s\": armature modifier wasn't binded to vertex groups"
% (mesh.name))
mesh.modifiers["Armature"].use_vertex_groups = True
+ if (mesh.modifiers["Armature"].object != armature):
+ blender_funcs.disp_msg("\"%s\": armature modifier was binded to another armature object"
+ % (mesh.name))
+ mesh.modifiers["Armature"].object = armature;
# check if all the vertex groups in each mesh correspond to the name of a skeleton bone
bone_name_list = []
@@ -140,7 +146,7 @@ class export_superbmd_collada(Operator, ExportHelper):
filter_glob = StringProperty(default = "*.dae", options = {'HIDDEN'}, maxlen = 255)
triangulate = BoolProperty(name = "Triangulate meshes",
- description = "Triangulate meshes inside armatures",
+ description = "Triangulate meshes inside the armature",
default = False)
def execute(self, context):
return write_bmd_bdl_collada(context, self.filepath, self.triangulate)