Skip to content
Snippets Groups Projects
Commit 845c0778 authored by Campbell Barton's avatar Campbell Barton
Browse files

move axis conversion check into blenders parent helper function.

parent 08ab0631
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,6 @@ from bpy.props import StringProperty, FloatProperty, BoolProperty, EnumProperty
from bpy_extras.io_utils import (ImportHelper,
ExportHelper,
axis_conversion,
axis_conversion_ensure,
)
......@@ -104,9 +103,6 @@ class Import3DS(bpy.types.Operator, ImportHelper):
default='Z',
)
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
def execute(self, context):
from . import import_3ds
......@@ -164,9 +160,6 @@ class Export3DS(bpy.types.Operator, ExportHelper):
default='Z',
)
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
def execute(self, context):
from . import export_3ds
......
......@@ -27,8 +27,8 @@ bl_info = {
"description": ("Export FBX meshes, UV's, vertex colors, materials, "
"textures, cameras, lamps and actions"),
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
"Scripts/Import-Export/Autodesk_FBX",
"wiki_url": ("http://wiki.blender.org/index.php/Extensions:2.5/Py/"
"Scripts/Import-Export/Autodesk_FBX"),
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Import-Export"}
......@@ -46,7 +46,6 @@ from bpy.props import StringProperty, BoolProperty, FloatProperty, EnumProperty
from bpy_extras.io_utils import (ExportHelper,
path_reference_mode,
axis_conversion,
axis_conversion_ensure,
)
......@@ -226,14 +225,9 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
return self.batch_mode == 'OFF'
def check(self, context):
is_def_change = super().check(context)
is_xna_change = self._validate_xna_options()
is_axis_change = axis_conversion_ensure(self,
"axis_forward",
"axis_up")
if is_xna_change or is_axis_change:
return True
else:
return False
return (is_xna_change or is_def_change)
def execute(self, context):
from mathutils import Matrix
......
......@@ -83,11 +83,6 @@ class ExportMAP(bpy.types.Operator, ExportHelper):
default='0 0 0 1 1 0 0 0',
)
'''
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
'''
def execute(self, context):
# import math
# from mathutils import Matrix
......
......@@ -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
......
......@@ -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:
......
......@@ -44,7 +44,6 @@ from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy_extras.io_utils import (ImportHelper,
ExportHelper,
axis_conversion,
axis_conversion_ensure,
path_reference_mode,
)
......@@ -81,9 +80,6 @@ class ImportX3D(bpy.types.Operator, ImportHelper):
default='Y',
)
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
def execute(self, context):
from . import import_x3d
......@@ -136,9 +132,6 @@ class ExportX3D(bpy.types.Operator, ExportHelper):
path_mode = path_reference_mode
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
def execute(self, context):
from . import export_x3d
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment