diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-03 09:33:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-03 09:33:14 +0400 |
commit | 845c077891e723ed9cb662a419b3f2847f2a1644 (patch) | |
tree | 9c3c6116edceced64d24ca9449725c46ef6cad02 /io_scene_obj | |
parent | 08ab06316b016b948ed0fbdb49f1b95027c858be (diff) |
move axis conversion check into blenders parent helper function.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/__init__.py | 10 | ||||
-rw-r--r-- | io_scene_obj/export_obj.py | 15 |
2 files changed, 9 insertions, 16 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index 74a30293..20216df3 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -51,7 +51,6 @@ from bpy_extras.io_utils import (ExportHelper, ImportHelper, path_reference_mode, axis_conversion, - axis_conversion_ensure, ) @@ -145,9 +144,6 @@ class ImportOBJ(bpy.types.Operator, ImportHelper): default='Y', ) - def check(self, context): - return axis_conversion_ensure(self, "axis_forward", "axis_up") - def execute(self, context): # print("Selected: " + context.active_object.name) from . import import_obj @@ -213,9 +209,6 @@ class ExportOBJ(bpy.types.Operator, ExportHelper): options={'HIDDEN'}, ) - # List of operator properties, the attributes will be assigned - # to the class instance from the operator settings before calling. - # context group use_selection = BoolProperty( name="Selection Only", @@ -339,8 +332,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper): path_mode = path_reference_mode - def check(self, context): - return axis_conversion_ensure(self, "axis_forward", "axis_up") + check_extension = True def execute(self, context): from . import export_obj diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index b043ec6d..a8534b67 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -34,12 +34,13 @@ def name_compat(name): def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): + from mathutils import Color world = scene.world if world: - worldAmb = world.ambient_color[:] + world_amb = world.ambient_color else: - worldAmb = 0.0, 0.0, 0.0 + world_amb = Color((0.0, 0.0, 0.0)) source_dir = bpy.data.filepath dest_dir = os.path.dirname(filepath) @@ -69,9 +70,9 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): file.write('Ns %.6f\n' % tspec) del tspec - file.write('Ka %.6f %.6f %.6f\n' % tuple(c * mat.ambient for c in worldAmb)) # Ambient, uses mirror colour, - file.write('Kd %.6f %.6f %.6f\n' % tuple(c * mat.diffuse_intensity for c in mat.diffuse_color)) # Diffuse - file.write('Ks %.6f %.6f %.6f\n' % tuple(c * mat.specular_intensity for c in mat.specular_color)) # Specular + file.write('Ka %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:]) # Ambient, uses mirror colour, + file.write('Kd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse + file.write('Ks %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular if hasattr(mat, "ior"): file.write('Ni %.6f\n' % mat.ior) # Refraction index else: @@ -89,7 +90,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): else: #write a dummy material here? file.write('Ns 0\n') - file.write('Ka %.6f %.6f %.6f\n' % tuple(c for c in worldAmb)) # Ambient, uses mirror colour, + file.write('Ka %.6f %.6f %.6f\n' % world_amb[:]) # Ambient, uses mirror colour, file.write('Kd 0.8 0.8 0.8\n') file.write('Ks 0.8 0.8 0.8\n') file.write('d 1\n') # No alpha @@ -413,7 +414,7 @@ def write_file(filepath, objects, scene, # except: faces.sort(lambda a,b: cmp(a.use_smooth, b.use_smooth)) # Set the default mat to no material and no image. - contextMat = 0, 0 # Can never be this, so we will label a new material teh first chance we get. + contextMat = 0, 0 # Can never be this, so we will label a new material the first chance we get. contextSmooth = None # Will either be true or false, set bad to force initialization switch. if EXPORT_BLEN_OBS or EXPORT_GROUP_BY_OB: |