[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1453] trunk/py/scripts/addons/ io_scene_3ds: add 3ds export option, use_selection, also fix for exporting curves with no geometry data.
Campbell Barton
ideasman42 at gmail.com
Thu Jan 20 10:04:37 CET 2011
Revision: 1453
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1453
Author: campbellbarton
Date: 2011-01-20 09:04:36 +0000 (Thu, 20 Jan 2011)
Log Message:
-----------
add 3ds export option, use_selection, also fix for exporting curves with no geometry data.
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_3ds/__init__.py
trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
Modified: trunk/py/scripts/addons/io_scene_3ds/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_3ds/__init__.py 2011-01-20 07:52:45 UTC (rev 1452)
+++ trunk/py/scripts/addons/io_scene_3ds/__init__.py 2011-01-20 09:04:36 UTC (rev 1453)
@@ -69,6 +69,8 @@
filename_ext = ".3ds"
filter_glob = StringProperty(default="*.3ds", options={'HIDDEN'})
+ use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default=False)
+
def execute(self, context):
from . import export_3ds
return export_3ds.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
Modified: trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
===================================================================
--- trunk/py/scripts/addons/io_scene_3ds/export_3ds.py 2011-01-20 07:52:45 UTC (rev 1452)
+++ trunk/py/scripts/addons/io_scene_3ds/export_3ds.py 2011-01-20 09:04:36 UTC (rev 1453)
@@ -859,13 +859,16 @@
"""
-def save(operator, context, filepath=""):
+def save(operator, context, filepath="",
+ use_selection=True,
+ ):
+
import bpy
import time
from io_utils import create_derived_objects, free_derived_objects
-
+
'''Save the Blender scene to a 3ds file.'''
-
+
# Time the export
time1 = time.clock()
# Blender.Window.WaitCursor(1)
@@ -900,9 +903,14 @@
materialDict = {}
mesh_objects = []
scene = context.scene
- for ob in [ob for ob in scene.objects if ob.is_visible(scene)]:
-# for ob in sce.objects.context:
+
+ if use_selection:
+ objects = (ob for ob in scene.objects if ob.is_visible(scene) and ob.select)
+ else:
+ objects = (ob for ob in scene.objects if ob.is_visible(scene))
+
+ for ob in objects:
# get derived objects
free, derived = create_derived_objects(scene, ob)
@@ -915,8 +923,11 @@
if ob.type not in ('MESH', 'CURVE', 'SURFACE', 'FONT', 'META'):
continue
- data = ob_derived.create_mesh(scene, True, 'PREVIEW')
-# data = getMeshFromObject(ob_derived, None, True, False, sce)
+ try:
+ data = ob_derived.create_mesh(scene, True, 'PREVIEW')
+ except:
+ data = None
+
if data:
data.transform(mat)
# data.transform(mat, recalc_normals=False)
@@ -1040,5 +1051,5 @@
# Debugging only: dump the chunk hierarchy:
#primary.dump()
-
+
return {'FINISHED'}
More information about the Bf-extensions-cvs
mailing list