Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-20 12:04:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-20 12:04:36 +0300
commit79c899da0040c7e058a30760f0b5178f3be672be (patch)
tree554ec11ec9fb03c3ff12d1a247209539d5b5a582 /io_scene_3ds
parentb99cd4de335fd7ca349cd6a38848d31d28442db3 (diff)
add 3ds export option, use_selection, also fix for exporting curves with no geometry data.
Diffstat (limited to 'io_scene_3ds')
-rw-r--r--io_scene_3ds/__init__.py2
-rw-r--r--io_scene_3ds/export_3ds.py27
2 files changed, 21 insertions, 8 deletions
diff --git a/io_scene_3ds/__init__.py b/io_scene_3ds/__init__.py
index 8e701abe..54840921 100644
--- a/io_scene_3ds/__init__.py
+++ b/io_scene_3ds/__init__.py
@@ -69,6 +69,8 @@ class Export3DS(bpy.types.Operator, ExportHelper):
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")))
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
index b4fb7deb..24013243 100644
--- a/io_scene_3ds/export_3ds.py
+++ b/io_scene_3ds/export_3ds.py
@@ -859,13 +859,16 @@ def make_kf_obj_node(obj, name_to_id):
"""
-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 @@ def save(operator, context, filepath=""):
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 @@ def save(operator, context, filepath=""):
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 @@ def save(operator, context, filepath=""):
# Debugging only: dump the chunk hierarchy:
#primary.dump()
-
+
return {'FINISHED'}