Skip to content

Commit

Permalink
add echo
Browse files Browse the repository at this point in the history
  • Loading branch information
rankaisija64 committed Mar 8, 2023
1 parent 724abed commit e739b1c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 9 additions & 10 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e739b1c

Please sign in to comment.