From e739b1c964dca47afe63465f05c55e1d9a318f7b Mon Sep 17 00:00:00 2001 From: rankaisija64 <65511061+rankaisija64@users.noreply.github.com> Date: Wed, 8 Mar 2023 02:31:50 +0200 Subject: [PATCH] add echo --- __init__.py | 2 +- export.py | 19 +++++++++---------- interface.py | 1 + properties.py | 2 ++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/__init__.py b/__init__.py index 09e8947..7744d2f 100644 --- a/__init__.py +++ b/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "SharpOcarina Export", "author": "dr.doodongo, Dragorn421, Campbell Barton, Bastien Montagne", - "version": (1, 0, 3), + "version": (1, 0, 4), "blender": (3, 0, 0), "location": "File > Export", "description": "Sharp Ocarina Tag Manager", diff --git a/export.py b/export.py index 91c96fb..c2c610d 100644 --- a/export.py +++ b/export.py @@ -146,6 +146,7 @@ def write_file_material_info(object:bpy.types.Object, material_name:str, scene:b [ 2, "has_camera", "camera", "#Camera" ], [ 2, "has_env", "env", "#IndoorEnv" ], [ 2, "has_exit", "exit", "#Exit" ], + [ 4, "", "echo", "#Echo" ], [ 3, "hookshot", "", "#Hookshot"], [ 3, "steep", "", "#Steep"], [ 3, "ignore_cam", "", "#IgnoreCamera"], @@ -171,6 +172,10 @@ def read_flag(origin, type, check_attr, val_attr, param) -> str: elif type == 3: if getattr(origin, check_attr): result = result + param + + elif type == 4: + if getattr(origin, val_attr) > 0: + result = result + param + "%02X" % getattr(origin, val_attr) return result @@ -228,7 +233,7 @@ def read_flag(origin, type, check_attr, val_attr, param) -> str: if mat_data.shift_x_0 != 0: result = result + "#ShiftS" + "%02d" % mat_data.shift_x_0 if mat_data.shift_y_0 != 0: - result = result + "#ShiftT" + "%02d" % mat_data.shift_x_0 + result = result + "#ShiftT" + "%02d" % mat_data.shift_y_0 if mat_data.texel_format != "Auto": result = result + mat_data.texel_format @@ -237,7 +242,7 @@ def read_flag(origin, type, check_attr, val_attr, param) -> str: if mat_data.shift_x_1 != 0: result = result + "#MultiShiftS%02d" % mat_data.shift_x_1 if mat_data.shift_y_1 != 0: - result = result + "#MultiShiftT%02d" % mat_data.shift_x_1 + result = result + "#MultiShiftT%02d" % mat_data.shift_y_1 result = result + "#MultiAlpha%02X" % mat_data.multi_alpha return result @@ -775,11 +780,8 @@ def _write( # Exit edit mode before exporting, so current object states are exported properly. - mode = bpy.context.mode - - if mode != "OBJECT": - if bpy.ops.object.mode_set.poll(): - bpy.ops.object.mode_set(mode="OBJECT") + if bpy.ops.object.mode_set.poll(): + bpy.ops.object.mode_set(mode="OBJECT") if EXPORT_SEL_ONLY: objects = context.selected_objects @@ -810,9 +812,6 @@ def _write( ) progress.leave_substeps() - if mode != "OBJECT": - if bpy.ops.object.mode_set.poll(): - bpy.ops.object.mode_set(mode=mode) def save( context, diff --git a/interface.py b/interface.py index d75a574..9586dfa 100644 --- a/interface.py +++ b/interface.py @@ -31,6 +31,7 @@ def draw_collision_params(xcol:properties.Properties_Collision, box:bpy.types.UI dependant_row_prop(box, xcol, "has_exit", "exit") dependant_row_prop(box, xcol, "has_env", "env") dependant_row_prop(box, xcol, "has_camera", "camera") + box.prop(xcol, "echo", slider=True) if not is_obj: row = box.row() diff --git a/properties.py b/properties.py index 7b5fcd0..02a9780 100644 --- a/properties.py +++ b/properties.py @@ -118,6 +118,8 @@ class Properties_Collision(bpy.types.PropertyGroup): ignore_actor: bpy.props.BoolProperty(default=False, name="Ignore Actor") ignore_proj: bpy.props.BoolProperty(default=False, name="Ignore Projectile") + echo: bpy.props.IntProperty(default=0, min=0, max=63, name="Echo") + class Properties_Material(bpy.types.PropertyGroup): is_ocarina_material: bpy.props.BoolProperty( default=False,