Skip to content

Commit eca5cdc

Browse files
committed
1.1.3 ready
1 parent c8558bc commit eca5cdc

File tree

3 files changed

+91
-61
lines changed

3 files changed

+91
-61
lines changed

export.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,8 @@ def save(
900900
use_selection=True,
901901
global_matrix=None,
902902
copy_textures=False,
903-
path_mode="AUTO"
903+
path_mode="AUTO",
904+
skip_dialog=False
904905
):
905906

906907
if path_mode == "AUTO":
@@ -932,6 +933,7 @@ def save(
932933
class ExportOBJ(bpy.types.Operator, ExportHelper):
933934
bl_idname = "export_obj_so.export"
934935
bl_label = "Export OBJ SO"
936+
bl_description = "Exports as SharpOcarina Object (.obj)"
935937
bl_options = {"PRESET"}
936938

937939
filename_ext = ".obj"
@@ -940,6 +942,8 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
940942
options={"HIDDEN"},
941943
)
942944

945+
skip_dialog: bpy.props.BoolProperty(default=False, options={"HIDDEN"})
946+
943947
# context group
944948
use_selection: BoolProperty(
945949
name="Selection Only",
@@ -1046,7 +1050,25 @@ def execute(self, context):
10461050
)
10471051

10481052
keywords["global_matrix"] = global_matrix
1049-
return save(context, **keywords)
1053+
1054+
result = save(context, **keywords)
1055+
1056+
# Save the chosen filepath
1057+
context.scene.SO_last_export_path = bpy.path.relpath(self.filepath)
1058+
1059+
return result
1060+
1061+
def invoke(self, context, event):
1062+
# If textbox already filled -> bypass file browser
1063+
if self.skip_dialog and context.scene.SO_last_export_path:
1064+
self.filepath = bpy.path.abspath(context.scene.SO_last_export_path)
1065+
result = self.execute(context)
1066+
self.report({'INFO'}, f"Exported to {self.filepath}")
1067+
return result
1068+
else:
1069+
# No path stored yet -> open file browser as usual
1070+
return ExportHelper.invoke(self, context, event)
1071+
10501072

10511073
def draw(self, context):
10521074
layout = self.layout
@@ -1065,7 +1087,7 @@ def draw(self, context):
10651087
# pass
10661088

10671089
def menu_func_export(self, context):
1068-
self.layout.operator(ExportOBJ.bl_idname, text="SharpOcarina Object (.obj)")
1090+
self.layout.operator(ExportOBJ.bl_idname, text="SharpOcarina Object (.obj)").skip_dialog = False
10691091

10701092
classes = (
10711093
ExportOBJ,

interface.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def execute(self, context):
166166
if mat.ootCollisionProperty.exitID > 0:
167167
mat.ocarina.collision.exit = mat.ootCollisionProperty.exitID-1
168168
mat.ocarina.collision.has_exit = True
169-
mat.ocarina.collision.camera = mat.ootCollisionProperty.cameraID
170-
mat.ocarina.collision.has_camera = True
169+
mat.ocarina.collision.camera = mat.ootCollisionProperty.cameraID
170+
mat.ocarina.collision.has_camera = True
171171

172172
if mat.ootCollisionProperty.conveyorOption != "None":
173173
mat.ocarina.collision.conveyor_dir = (mat.ootCollisionProperty.conveyorRotation / (2 * 3.14159265359))
@@ -391,7 +391,8 @@ def draw(self:bpy.types.Panel, context:bpy.types.Context):
391391
box = self.layout.box()
392392
box.operator('ocarina.massinit')
393393
box.operator('ocarina.refresh')
394-
box.operator("export_obj_so.export")
394+
box.operator("export_obj_so.export").skip_dialog = True
395+
box.prop(context.scene, "SO_last_export_path", text="Path")
395396
box.label(text="Object: " + obj_name)
396397

397398
if object != None and object.type == 'MESH':

properties.py

Lines changed: 62 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import bpy
22
from . import node_setup
3+
from bpy.props import StringProperty
34

45
class Properties_Scene(bpy.types.PropertyGroup):
56
ui_show_collision_3d: bpy.props.BoolProperty(default=False, name="Collision")
@@ -21,22 +22,22 @@ class Properties_Scene(bpy.types.PropertyGroup):
2122
class Properties_Collision(bpy.types.PropertyGroup):
2223
sound_type: bpy.props.EnumProperty(
2324
items=[
24-
("#SFX_0", "Dirt", "0x00"),
25-
("#SFX_1", "Sand", "0x01"),
26-
("#SFX_2", "Stone", "0x02"),
27-
("#SFX_3", "WetStone", "0x03"),
28-
("#SFX_4", "Water", "0x04"),
29-
("#SFX_5", "Shallow Water", "0x05"),
30-
("#SFX_6", "Bush", "0x06"),
31-
("#SFX_7", "Lava", "0x07"),
32-
("#SFX_8", "Grass", "0x08"),
33-
("#SFX_9", "Plank Wood", "0x09"),
34-
("#SFX_A", "Wood", "0x0A"),
35-
("#SFX_C", "Ice", "0x0C"),
36-
("#SFX_D", "Carpet", "0x0D"),
37-
("#SFX_B", "0x0B", "0x0B"),
38-
("#SFX_E", "0x0E", "0x0E"),
39-
("#SFX_F", "0x0F", "0x0F"),
25+
("#SFX_0", "Dirt", ""),
26+
("#SFX_1", "Sand", ""),
27+
("#SFX_2", "Stone", ""),
28+
("#SFX_3", "WetStone", ""),
29+
("#SFX_4", "Water", ""),
30+
("#SFX_5", "Shallow Water", ""),
31+
("#SFX_6", "Bush", ""),
32+
("#SFX_7", "Lava", ""),
33+
("#SFX_8", "Grass", ""),
34+
("#SFX_9", "Plank Wood", ""),
35+
("#SFX_A", "Wood", ""),
36+
("#SFX_C", "Ice", ""),
37+
("#SFX_D", "Carpet", ""),
38+
("#SFX_B", "~Unk B", "Customize via code"),
39+
("#SFX_E", "~Unk E", "Customize via code"),
40+
("#SFX_F", "~Unk F", "Customize via code"),
4041
],
4142
default="#SFX_2",
4243
name="Sound"
@@ -45,18 +46,18 @@ class Properties_Collision(bpy.types.PropertyGroup):
4546
has_floor_flags: bpy.props.BoolProperty(default=False,name="Floor")
4647
floor_flags: bpy.props.EnumProperty(
4748
items=[
48-
("#FLOORPROPERTY_UNK01", "Unk01", "0x01"),
49-
("#FLOORPROPERTY_UNK02", "Unk02", "0x02"),
50-
("#FLOORPROPERTY_UNK03", "Unk03", "0x03"),
51-
("#FLOORPROPERTY_UNK04", "Unk04", "0x04"),
52-
("#FLOORPROPERTY_SMALL_VOID", "Small Void", "0x05"),
53-
("#FLOORPROPERTY_HANG_LEDGE", "Hand Ledge", "0x06"),
54-
("#FLOORPROPERTY_UNK07", "Unk07", "0x07"),
55-
("#FLOORPROPERTY_STOP_AIR_MOMENTUM", "Stop Air Momentum", "0x08"),
56-
("#FLOORPROPERTY_NO_LEDGE_JUMP", "No Ledge Jump", "0x09"),
57-
("#FLOORPROPERTY_UNK0A", "Unk0A", "0x0A"),
58-
("#FLOORPROPERTY_DIVE", "Dive", "0x0B"),
59-
("#FLOORPROPERTY_VOID", "Void", "0x0C"),
49+
("#FLOORPROPERTY_SMALL_VOID", "Small Void", ""),
50+
("#FLOORPROPERTY_HANG_LEDGE", "Hand Ledge", ""),
51+
("#FLOORPROPERTY_STOP_AIR_MOMENTUM", "Stop Air Momentum", ""),
52+
("#FLOORPROPERTY_NO_LEDGE_JUMP", "No Ledge Jump", ""),
53+
("#FLOORPROPERTY_DIVE", "Dive", ""),
54+
("#FLOORPROPERTY_VOID", "Void", ""),
55+
("#FLOORPROPERTY_UNK01", "~Unk 1", ""),
56+
("#FLOORPROPERTY_UNK02", "~Unk 2", ""),
57+
("#FLOORPROPERTY_UNK03", "~Unk 3", ""),
58+
("#FLOORPROPERTY_UNK04", "~Unk 4", ""),
59+
("#FLOORPROPERTY_UNK07", "~Unk 7", ""),
60+
("#FLOORPROPERTY_UNK0A", "~Unk A", ""),
6061
],
6162
default="#FLOORPROPERTY_SMALL_VOID",
6263
name=""
@@ -65,21 +66,21 @@ class Properties_Collision(bpy.types.PropertyGroup):
6566
has_wall_flags: bpy.props.BoolProperty(default=False,name="Wall")
6667
wall_flags: bpy.props.EnumProperty(
6768
items=[
68-
("#WALLPROPERTY_NO_LEDGE_GRAB", "No Ledge Grab", "0x01"),
69-
("#WALLPROPERTY_LADDER", "Ladder", "0x02"),
70-
("#WALLPROPERTY_LADDER_TOP", "Ladder Top", "0x03"),
71-
("#WALLPROPERTY_VINE", "Climbable", "0x04"),
72-
("#WALLPROPERTY_CRAWL_A", "Crawl A", "0x05"),
73-
("#WALLPROPERTY_CRAWL_B", "Crawl B", "0x06"),
74-
("#WALLPROPERTY_PUSH", "Push", "0x07"),
75-
("#WALLPROPERTY_UNK08", "Unk08", "0x08"),
76-
("#WALLPROPERTY_UNK09", "Unk09", "0x09"),
77-
("#WALLPROPERTY_UNK0A", "Unk0A", "0x0A"),
78-
("#WALLPROPERTY_UNK0B", "Unk0B", "0x0B"),
79-
("#WALLPROPERTY_UNK0C", "Unk0C", "0x0C"),
80-
("#WALLPROPERTY_UNK0D", "Unk0D", "0x0D"),
81-
("#WALLPROPERTY_UNK0E", "Unk0E", "0x0E"),
82-
("#WALLPROPERTY_UNK0F", "Unk0F", "0x0F"),
69+
("#WALLPROPERTY_NO_LEDGE_GRAB", "No Ledge Grab", ""),
70+
("#WALLPROPERTY_LADDER", "Ladder", ""),
71+
("#WALLPROPERTY_LADDER_TOP", "Ladder Top", ""),
72+
("#WALLPROPERTY_VINE", "Climbable", ""),
73+
("#WALLPROPERTY_CRAWL_A", "Crawl A", ""),
74+
("#WALLPROPERTY_CRAWL_B", "Crawl B", "No difference between A and B"),
75+
("#WALLPROPERTY_PUSH", "Push", ""),
76+
("#WALLPROPERTY_UNK08", "~Unk 8", ""),
77+
("#WALLPROPERTY_UNK09", "~Unk 9", ""),
78+
("#WALLPROPERTY_UNK0A", "~Unk A", ""),
79+
("#WALLPROPERTY_UNK0B", "~Unk B", ""),
80+
("#WALLPROPERTY_UNK0C", "~Unk C", ""),
81+
("#WALLPROPERTY_UNK0D", "~Unk D", ""),
82+
("#WALLPROPERTY_UNK0E", "~Unk E", ""),
83+
("#WALLPROPERTY_UNK0F", "~Unk F", ""),
8384
],
8485
default="#WALLPROPERTY_NO_LEDGE_GRAB",
8586
name=""
@@ -88,18 +89,18 @@ class Properties_Collision(bpy.types.PropertyGroup):
8889
has_special_flags: bpy.props.BoolProperty(default=False,name="Special")
8990
special_flags: bpy.props.EnumProperty(
9091
items=[
91-
("#FLOORSPECIAL_UNK01", "Unk01 (Cam related)", "0x01"),
92-
("#FLOORSPECIAL_HURT_SPIKES", "Hurt", "0x02"),
93-
("#FLOORSPECIAL_HURT_LAVA", "Hurt (Lava)", "0x03"),
94-
("#FLOORSPECIAL_SAND", "Sand", "0x04"),
95-
("#FLOORSPECIAL_SLIPPERY", "Slippery", "0x05"),
96-
("#FLOORSPECIAL_NO_FALL_DAMAGE", "No Fall Damage", "0x06"),
97-
("#FLOORSPECIAL_QUICKSAND", "Quicksand", "0x07"),
98-
("#FLOORSPECIAL_JABU_WALL", "Jabu Wall", "0x08"),
99-
("#FLOORSPECIAL_VOID_ON_CONTACT", "Void on Contact", "0x09"),
100-
("#FLOORSPECIAL_LINK_LOOK_UP", "Look Up", "0x0A"),
101-
("#FLOORSPECIAL_QUICKSAND_EPONA", "Quicksand (Epona Crossable)", "0x0B"),
102-
("#FLOORSPECIAL_UNK0C", "Unk0C", "0x0C"),
92+
("#FLOORSPECIAL_UNK01", "Haunted Wasteland", ""),
93+
("#FLOORSPECIAL_HURT_SPIKES", "Hurt", ""),
94+
("#FLOORSPECIAL_HURT_LAVA", "Hurt (Lava)", ""),
95+
("#FLOORSPECIAL_SAND", "Sand", ""),
96+
("#FLOORSPECIAL_SLIPPERY", "Slippery", ""),
97+
("#FLOORSPECIAL_NO_FALL_DAMAGE", "No Fall Damage", ""),
98+
("#FLOORSPECIAL_QUICKSAND", "Quicksand", ""),
99+
("#FLOORSPECIAL_JABU_WALL", "Jabu Wall", ""),
100+
("#FLOORSPECIAL_VOID_ON_CONTACT", "Void on Contact", ""),
101+
("#FLOORSPECIAL_LINK_LOOK_UP", "Look Up", ""),
102+
("#FLOORSPECIAL_QUICKSAND_EPONA", "Quicksand (Epona Crossable)", ""),
103+
("#FLOORSPECIAL_UNK0C", "~Unk C", ""),
103104
],
104105
default="#FLOORSPECIAL_HURT_SPIKES",
105106
name=""
@@ -404,10 +405,16 @@ def register():
404405
bpy.types.Scene.ocarina = bpy.props.PointerProperty(type=Properties_Scene)
405406
bpy.types.Material.ocarina = bpy.props.PointerProperty(type=Properties_Material)
406407
bpy.types.Object.ocarina = bpy.props.PointerProperty(type=Properties_Object)
408+
bpy.types.Scene.SO_last_export_path = StringProperty(
409+
name="Export Path",
410+
description="Path used to automatically export the .obj, it autofills",
411+
default=""
412+
)
407413

408414
def unregister():
409415
del bpy.types.Material.ocarina
410416
del bpy.types.Scene.ocarina
417+
del bpy.types.Scene.SO_last_export_path
411418

412419
for clazz in reversed(classes):
413420
bpy.utils.unregister_class(clazz)

0 commit comments

Comments
 (0)