From: Mikko Rasa Date: Tue, 6 May 2014 20:43:22 +0000 (+0300) Subject: Add an object property to control compound exporting X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=eb76b7a02f56d8bca6cb78a7c272b9670f7faace;p=libs%2Fgl.git Add an object property to control compound exporting --- diff --git a/blender/io_mspgl/__init__.py b/blender/io_mspgl/__init__.py index 7426685f..9f7c48e1 100644 --- a/blender/io_mspgl/__init__.py +++ b/blender/io_mspgl/__init__.py @@ -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__) diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index 18ae856a..cc8ee6ff 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -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 index 00000000..d2d36cb9 --- /dev/null +++ b/blender/io_mspgl/properties.py @@ -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")