]> git.tdb.fi Git - libs/gl.git/commitdiff
Add an object property to control compound exporting
authorMikko Rasa <tdb@tdb.fi>
Tue, 6 May 2014 20:43:22 +0000 (23:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 6 May 2014 20:43:22 +0000 (23:43 +0300)
blender/io_mspgl/__init__.py
blender/io_mspgl/export_mesh.py
blender/io_mspgl/properties.py [new file with mode: 0644]

index 7426685f49e70f9aa1ddd48b5b21aac2679b8cae..9f7c48e1ed38493cb846397f3a3bc4cf5bfe43e8 100644 (file)
@@ -7,7 +7,7 @@ bl_info = {
 
 if "bpy" in locals():
        import imp
-       for sub in "armature", "export_armature", "export_mesh", "export_object", "mesh", "outfile", "util":
+       for sub in "armature", "export_armature", "export_mesh", "export_object", "mesh", "outfile", "properties", "util":
                if sub in locals():
                        imp.reload(locals()[sub])
 
@@ -137,11 +137,16 @@ def menu_func_export(self, context):
        self.layout.operator(ExportMspGLObject.bl_idname, text="Msp GL object")
        self.layout.operator(ExportMspGLArmature.bl_idname, text="Msp GL armature")
 
+from .properties import MspGLProperties
+
 def register():
        bpy.utils.register_module(__name__)
 
        bpy.types.INFO_MT_file_export.append(menu_func_export)
 
+       from .properties import register_properties
+       register_properties();
+
 def unregister():
        bpy.utils.unregister_module(__name__)
 
index 18ae856a927ce8f28b70a45c51ab4ed5b9cfda00..cc8ee6ff9abbc1696fe2e13b16e752761ae7c58c 100644 (file)
@@ -194,6 +194,15 @@ class MeshExporter:
        def export(self, context, out_file):
                if self.compound:
                        objs = context.selected_objects
+                       check = objs
+                       while check:
+                               children = []
+                               for o in check:
+                                       for c in o.children:
+                                               if c.compound:
+                                                       children.append(c)
+                               objs += children
+                               check = children
                else:
                        objs = [context.active_object]
 
diff --git a/blender/io_mspgl/properties.py b/blender/io_mspgl/properties.py
new file mode 100644 (file)
index 0000000..d2d36cb
--- /dev/null
@@ -0,0 +1,16 @@
+import bpy
+
+class MspGLProperties(bpy.types.Panel):
+       bl_idname = "OBJECT_PT_mspgl_properties"
+       bl_label = "MspGL properties"
+       bl_space_type = "PROPERTIES"
+       bl_region_type = "WINDOW"
+       bl_context = "object"
+
+       def draw(self, context):
+               obj = context.active_object
+
+               self.layout.prop(obj, "compound");
+
+def register_properties():
+       bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")