Skip to content

Commit

Permalink
QUA stuff and fix workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Garcia committed Sep 10, 2024
1 parent 7b22c17 commit 0ffd08c
Show file tree
Hide file tree
Showing 12 changed files with 1,560 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Do package
run: python build/create_zip.py
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: toolkit
path: output/
Expand Down
121 changes: 93 additions & 28 deletions io_scene_halo/file_qua/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
EnumProperty,
StringProperty,
BoolProperty,
PointerProperty
PointerProperty,
IntProperty
)
from bpy.types import (
Panel,
Expand Down Expand Up @@ -73,6 +74,14 @@ def draw(self, context):
row.label(text='QUA Version:')
row.prop(scene_qua, "qua_version", text='')

if scene_qua.game_title == "halo4":
row = col.row()
row.label(text='QUA Type:')
row.prop(scene_qua, "qua_type", text='')
row = col.row()
row.label(text='QUA Revision:')
row.prop(scene_qua, "qua_revision", text='')

row = col.row()
row.label(text='Strip Identifier:')
row.prop(scene_qua, "strip_identifier", text='')
Expand All @@ -94,28 +103,69 @@ def draw(self, context):
row.label(text='Use As Default Export Settings:')
row.prop(scene_qua, "use_scene_properties", text='')

def version_settings_callback(self, context):
items=[('1', "1", "Non-functional")]

print(self.game_title)
if self.game_title == "halo3":
items.append(('2', "2", "Non-functional"))
items.append(('3', "3", "Non-functional"))
items.append(('4', "4", "Non-functional"))
items.append(('5', "5", "Retail"))

elif self.game_title == "halor":
items.append(('2', "2", "Retail"))

elif self.game_title == "halo4":
items.append(('2', "2", "Non-functional"))
items.append(('3', "3", "Non-functional"))
items.append(('4', "4", "Retail"))

return items

def update_version(self, context):
if self.game_title == "halo3":
self.qua_version = '5'

elif self.game_title == "halor":
self.qua_version = '2'

else:
self.qua_version = '4'

class QUA_ScenePropertiesGroup(PropertyGroup):
game_title: EnumProperty(
name="Game Title:",
description="What game will the Ubercam file be used for",
items=[ ('halo3', "Halo 3", "Export a QUA intended for Halo 3"),
('halor', "Halo Reach", "Export a QUA intended for Halo Reach"),
('halo4', "Halo 4", "Export a QUA intended for Halo 4"),
]
],
update = update_version
)

qua_version: EnumProperty(
name="Version:",
description="What version to use for the Ubercam file",
default="5",
items=[ ('1', "1", "Non-functional"),
('2', "2", "Non-functional"),
('3', "3", "Non-functional"),
('4', "4", "Non-functional"),
('5', "5", "Retail"),
options={'HIDDEN'},
items=version_settings_callback,
default=4
)

qua_type: EnumProperty(
name="Scene Type:",
description="What type of scene is the QUA file intended to be",
items=[ ('main', "Main", "Export a standard QUA scene"),
('segment', "Segment", "Export a segment QUA scene")
]
)

qua_revision: IntProperty(
name="Revision",
description="Set the file revision for the QUA",
default = 0,
)

strip_identifier: BoolProperty(
name ="Strip Identifier",
description = "Strip identifier from filename of animation paths",
Expand Down Expand Up @@ -152,21 +202,32 @@ class ExportQUA(Operator, ExportHelper):
items=[ ('halo3', "Halo 3", "Export a QUA intended for Halo 3"),
('halor', "Halo Reach", "Export a QUA intended for Halo Reach"),
('halo4', "Halo 4", "Export a QUA intended for Halo 4"),
]
],
update = update_version
)

qua_version: EnumProperty(
name="Version:",
description="What version to use for the Ubercam file",
default="5",
items=[ ('1', "1", "Non-functional"),
('2', "2", "Non-functional"),
('3', "3", "Non-functional"),
('4', "4", "Non-functional"),
('5', "5", "Retail"),
options={'HIDDEN'},
items=version_settings_callback,
default=4
)

qua_type: EnumProperty(
name="Scene Type:",
description="What type of scene is the QUA file intended to be",
items=[ ('main', "Main", "Export a standard QUA scene"),
('segment', "Segment", "Export a segment QUA scene")
]
)

qua_revision: IntProperty(
name="Revision",
description="Set the file revision for the QUA",
default = 0,
)

strip_identifier: BoolProperty(
name ="Strip Identifier",
description = "Strip identifier from filename of animation paths",
Expand Down Expand Up @@ -199,7 +260,7 @@ class ExportQUA(Operator, ExportHelper):
def execute(self, context):
from ..file_qua import export_qua

return global_functions.run_code("export_qua.write_file(context, self.filepath, self.game_title, int(self.qua_version), self.strip_identifier, self.hidden_geo, self.nonrender_geo, self.report)")
return global_functions.run_code("export_qua.write_file(context, self.filepath, self.game_title, int(self.qua_version), self.qua_type, self.qua_revision, self.strip_identifier, self.hidden_geo, self.nonrender_geo, self.report)")

def draw(self, context):
scene = context.scene
Expand Down Expand Up @@ -234,6 +295,14 @@ def draw(self, context):
row.label(text='QUA Version:')
row.prop(self, "qua_version", text='')

if self.game_title == "halo4":
row = col.row()
row.label(text='QUA Type:')
row.prop(self, "qua_type", text='')
row = col.row()
row.label(text='QUA Revision:')
row.prop(self, "qua_revision", text='')

row = col.row()
row.enabled = is_enabled
row.label(text='Strip Identifier:')
Expand Down Expand Up @@ -270,11 +339,9 @@ class ImportQUA(Operator, ImportHelper):
game_title: EnumProperty(
name="Game Title:",
description="What game was the cinematic file made for",
default="auto",
items=[ ('auto', "Auto", "Attempt to guess the game this animation was intended for. Will default to Halo CE if this fails."),
('halo1', "Halo 1", "Import an animation intended for Halo 1"),
('halo2', "Halo 2", "Import an animation intended for Halo 2"),
('halo3', "Halo 3", "Import an animation intended for Halo 3"),
items=[ ('halo3', "Halo 3", "Export a QUA intended for Halo 3"),
('halor', "Halo Reach", "Export a QUA intended for Halo Reach"),
('halo4', "Halo 4", "Export a QUA intended for Halo 4"),
]
)

Expand All @@ -291,7 +358,7 @@ class ImportQUA(Operator, ImportHelper):
def execute(self, context):
from ..file_qua import import_qua

return global_functions.run_code("import_qua.load_file(context, self.filepath, self.report)")
return global_functions.run_code("import_qua.load_file(context, self.game_title, self.filepath, self.report)")

def invoke(self, context, event):
if self.filepath:
Expand Down Expand Up @@ -321,11 +388,9 @@ class ImportQUA(Operator, ImportHelper):
game_title: EnumProperty(
name="Game Title:",
description="What game was the cinematic file made for",
default="auto",
items=[ ('auto', "Auto", "Attempt to guess the game this animation was intended for. Will default to Halo CE if this fails."),
('halo1', "Halo 1", "Import an animation intended for Halo 1"),
('halo2', "Halo 2", "Import an animation intended for Halo 2"),
('halo3', "Halo 3", "Import an animation intended for Halo 3"),
items=[ ('halo3', "Halo 3", "Export a QUA intended for Halo 3"),
('halor', "Halo Reach", "Export a QUA intended for Halo Reach"),
('halo4', "Halo 4", "Export a QUA intended for Halo 4"),
]
)

Expand All @@ -342,7 +407,7 @@ class ImportQUA(Operator, ImportHelper):
def execute(self, context):
from ..file_qua import import_qua

return global_functions.run_code("import_qua.load_file(context, self.filepath, self.report)")
return global_functions.run_code("import_qua.load_file(context, self.game_title, self.filepath, self.report)")

def menu_func_export(self, context):
self.layout.operator(ExportQUA.bl_idname, text='Halo Ubercam Animation (.qua)')
Expand Down
Loading

0 comments on commit 0ffd08c

Please sign in to comment.