[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4360] trunk/py/scripts/addons/ io_mesh_vrml2: add the ability to export the selection
Campbell Barton
ideasman42 at gmail.com
Tue Mar 12 07:57:39 CET 2013
Revision: 4360
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4360
Author: campbellbarton
Date: 2013-03-12 06:57:38 +0000 (Tue, 12 Mar 2013)
Log Message:
-----------
add the ability to export the selection
Modified Paths:
--------------
trunk/py/scripts/addons/io_mesh_vrml2/__init__.py
trunk/py/scripts/addons/io_mesh_vrml2/export_vrml2.py
Modified: trunk/py/scripts/addons/io_mesh_vrml2/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_vrml2/__init__.py 2013-03-11 18:15:59 UTC (rev 4359)
+++ trunk/py/scripts/addons/io_mesh_vrml2/__init__.py 2013-03-12 06:57:38 UTC (rev 4360)
@@ -51,6 +51,12 @@
filename_ext = ".wrl"
filter_glob = StringProperty(default="*.wrl", options={'HIDDEN'})
+ use_selection = BoolProperty(
+ name="Selection Only",
+ description="Export selected objects only",
+ default=False,
+ )
+
use_mesh_modifiers = BoolProperty(
name="Apply Modifiers",
description="Apply Modifiers to the exported mesh",
@@ -91,17 +97,16 @@
def draw(self, context):
layout = self.layout
+ layout.prop(self, "use_selection")
+ layout.prop(self, "use_mesh_modifiers")
+
row = layout.row()
- row.prop(self, "use_mesh_modifiers")
- row = layout.row()
row.prop(self, "use_uv")
row.prop(self, "use_color")
row = layout.row()
row.active = self.use_color
row.prop(self, "color_type")
- row = layout.row()
- row.prop(self, "path_mode")
-
+ layout.prop(self, "path_mode")
def menu_func_export(self, context):
Modified: trunk/py/scripts/addons/io_mesh_vrml2/export_vrml2.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_vrml2/export_vrml2.py 2013-03-11 18:15:59 UTC (rev 4359)
+++ trunk/py/scripts/addons/io_mesh_vrml2/export_vrml2.py 2013-03-12 06:57:38 UTC (rev 4360)
@@ -39,7 +39,7 @@
filepath_full = bpy.path.abspath(filepath, library=uv_image.library)
filepath_ref = bpy_extras.io_utils.path_reference(filepath_full, base_src, base_dst, path_mode, "textures", copy_set, uv_image.library)
filepath_base = os.path.basename(filepath_full)
-
+
images = [
filepath_ref,
filepath_base,
@@ -90,7 +90,7 @@
except:
l = None
fw(c_none if l is None else ("%.2f %.2f %.2f " % l[color_layer][:]))
-
+
del v
fw(']\n') # end 'color[]'
fw('\t\t}\n') # end 'Color'
@@ -232,12 +232,15 @@
def save(operator,
context,
filepath="",
+ use_selection=False,
use_mesh_modifiers=True,
use_color=True,
color_type='MATERIAL',
use_uv=True,
path_mode='AUTO'):
+ scene = context.scene
+
# store files to copy
copy_set = set()
@@ -246,12 +249,20 @@
fw('#VRML V2.0 utf8\n')
fw('#modeled using blender3d http://blender.org\n')
- save_object(fw, context.scene, context.object,
- use_mesh_modifiers,
- use_color, color_type,
- use_uv,
- path_mode, copy_set)
+ if use_selection:
+ objects = context.selected_objects
+ else:
+ objects = scene.objects
+ for obj in objects:
+ if obj.type == 'MESH':
+ fw("\n# %r\n" % obj.name)
+ save_object(fw, scene, obj,
+ use_mesh_modifiers,
+ use_color, color_type,
+ use_uv,
+ path_mode, copy_set)
+
file.close()
# copy all collected files.
More information about the Bf-extensions-cvs
mailing list