Skip to content

Commit

Permalink
[export] - Per blend export scale
Browse files Browse the repository at this point in the history
  • Loading branch information
rankaisija committed Jul 11, 2023
1 parent b95624d commit 145c164
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 2 additions & 10 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ class OBJEX_OT_export_base():
default=export_objex.ObjexWriter.default_options['KEEP_VERTEX_ORDER'],
)

global_scale = FloatProperty(
name='Scale',
soft_min=0.01, soft_max=1000.0,
default=1.0,
)

# logging
logging_level_console = IntProperty(
name='Log level',
Expand Down Expand Up @@ -285,7 +279,6 @@ class OBJEX_OT_export_base():
check_extension = True

def draw(self, context):
self.layout.prop(self, 'global_scale')
if self.use_selection:
box = self.layout.box()
box.prop(self, 'use_selection')
Expand Down Expand Up @@ -352,11 +345,10 @@ def draw(self, context):
box.prop(self, 'logging_file_path')
self.layout.prop(self, 'path_mode')

def execute(self, context):
def execute(self, context:bpy.types.Context):
from mathutils import Matrix
keywords = self.as_keywords(ignore=('axis_forward',
'axis_up',
'global_scale',
'check_existing',
'filter_glob',
'logging_level_console',
Expand All @@ -366,7 +358,7 @@ def execute(self, context):
))

global_matrix = blender_version_compatibility.matmul(
Matrix.Scale(self.global_scale, 4),
Matrix.Scale(context.scene.objex_bonus.blend_scale, 4),
axis_conversion(to_forward=self.axis_forward,
to_up=self.axis_up,
).to_4x4())
Expand Down
4 changes: 4 additions & 0 deletions interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ def draw(self, context):
box.prop(armature.data.objex_bonus, "joint_sphere_header_filepath")
box.prop(armature.data.objex_bonus, "joint_sphere_scale")
box.operator("objex.export_joint_sphere_header")

box = self.layout.box()
if foldable_menu(box, context.scene.objex_bonus, "menu_global"):
box.prop(context.scene.objex_bonus, 'blend_scale')

# material

Expand Down
7 changes: 7 additions & 0 deletions properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class SavedPose(bpy.types.PropertyGroup):

class ObjexSceneProperties(bpy.types.PropertyGroup):
is_objex_scene = bpy.props.BoolProperty()

blend_scale = bpy.props.FloatProperty(
name='Export Scale',
soft_min=0.01, soft_max=1000.0,
default=1.0,
)

colorspace_strategy = bpy.props.EnumProperty(
# if modifying these items, also edit __init__.OBJEX_AddonPreferences.colorspace_default_strategy
Expand Down Expand Up @@ -102,6 +108,7 @@ class ObjexSceneProperties(bpy.types.PropertyGroup):
menu_bone = bpy.props.BoolProperty(name='Bone')
menu_joint = bpy.props.BoolProperty(name='Joint Sphere')
menu_mesh = bpy.props.BoolProperty(name='Mesh')
menu_global = bpy.props.BoolProperty(name='Export Settings')
mode_menu = bpy.props.EnumProperty(
items=[
('menu_mode_combiner', 'Combiner', '(A-B)*C+D', 'SHADING_RENDERED', 0),
Expand Down

0 comments on commit 145c164

Please sign in to comment.