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

options to scale x3d and obj on export

parent 46c41ca8
No related branches found
No related tags found
No related merge requests found
......@@ -291,15 +291,6 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
default=False,
)
global_scale = FloatProperty(
name="Scale",
description="Scale all data",
min=0.01, max=1000.0,
soft_min=0.01,
soft_max=1000.0,
default=1.0,
)
axis_forward = EnumProperty(
name="Forward",
items=(('X', "X Forward", ""),
......@@ -323,6 +314,11 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
),
default='Y',
)
global_scale = FloatProperty(
name="Scale",
min=0.01, max=1000.0,
default=1.0,
)
path_mode = path_reference_mode
......@@ -339,13 +335,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
"filter_glob",
))
global_matrix = Matrix()
global_matrix[0][0] = \
global_matrix[1][1] = \
global_matrix[2][2] = self.global_scale
global_matrix = (global_matrix *
global_matrix = (Matrix.Scale(self.global_scale, 4) *
axis_conversion(to_forward=self.axis_forward,
to_up=self.axis_up,
).to_4x4())
......
......@@ -39,7 +39,7 @@ if "bpy" in locals():
imp.reload(export_x3d)
import bpy
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.props import StringProperty, BoolProperty, EnumProperty, FloatProperty
from bpy_extras.io_utils import (ImportHelper,
ExportHelper,
axis_conversion,
......@@ -168,20 +168,28 @@ class ExportX3D(bpy.types.Operator, ExportHelper):
),
default='Y',
)
global_scale = FloatProperty(
name="Scale",
min=0.01, max=1000.0,
default=1.0,
)
path_mode = path_reference_mode
def execute(self, context):
from . import export_x3d
from mathutils import Matrix
keywords = self.as_keywords(ignore=("axis_forward",
"axis_up",
"global_scale",
"check_existing",
"filter_glob",
))
global_matrix = axis_conversion(to_forward=self.axis_forward,
to_up=self.axis_up,
).to_4x4()
).to_4x4() * Matrix.Scale(self.global_scale, 4)
keywords["global_matrix"] = global_matrix
return export_x3d.save(self, context, **keywords)
......
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