Skip to content

Commit

Permalink
[SM64] Only throw empty gfx exception in actor exports (#413)
Browse files Browse the repository at this point in the history
* [SM64] Only throw empty gfx exception in actor exports

* type hint

* removed comment

* Remove other unused camera args

* don't pass in arg for camera

* remove last unused camera
  • Loading branch information
Lilaa3 authored Dec 28, 2024
1 parent c475ce3 commit 60bdf25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
22 changes: 7 additions & 15 deletions fast64_internal/sm64/sm64_geolayout_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,8 @@ def convertArmatureToGeolayout(armatureObj, obj, convertTransformMatrix, camera,
return geolayoutGraph, fModel


# Camera is unused here
def convertObjectToGeolayout(
obj, convertTransformMatrix, camera, name, fModel: FModel, areaObj, DLFormat, convertTextureData
obj, convertTransformMatrix, is_actor: bool, name, fModel: FModel, areaObj, DLFormat, convertTextureData
):
inline = bpy.context.scene.exportInlineF3D
if fModel is None:
Expand Down Expand Up @@ -504,7 +503,7 @@ def convertObjectToGeolayout(
True,
convertTextureData,
)
if not meshGeolayout.has_data():
if is_actor and not meshGeolayout.has_data():
raise PluginError("No gfx data to export, gfx export cancelled")
except Exception as e:
raise Exception(str(e))
Expand Down Expand Up @@ -571,7 +570,6 @@ def exportGeolayoutObjectC(
texDir,
savePNG,
texSeparate,
camera,
groupName,
headerType,
dirName,
Expand All @@ -581,7 +579,7 @@ def exportGeolayoutObjectC(
DLFormat,
):
geolayoutGraph, fModel = convertObjectToGeolayout(
obj, convertTransformMatrix, camera, dirName, None, None, DLFormat, not savePNG
obj, convertTransformMatrix, True, dirName, None, None, DLFormat, not savePNG
)

return saveGeolayoutC(
Expand Down Expand Up @@ -844,9 +842,9 @@ def exportGeolayoutArmatureInsertableBinary(armatureObj, obj, convertTransformMa
saveGeolayoutInsertableBinary(geolayoutGraph, fModel, filepath)


def exportGeolayoutObjectInsertableBinary(obj, convertTransformMatrix, filepath, camera):
def exportGeolayoutObjectInsertableBinary(obj, convertTransformMatrix, filepath):
geolayoutGraph, fModel = convertObjectToGeolayout(
obj, convertTransformMatrix, camera, obj.name, None, None, DLFormat.Static, True
obj, convertTransformMatrix, True, obj.name, None, None, DLFormat.Static, True
)

saveGeolayoutInsertableBinary(geolayoutGraph, fModel, filepath)
Expand Down Expand Up @@ -894,10 +892,9 @@ def exportGeolayoutObjectBinaryBank0(
modelID,
textDumpFilePath,
RAMAddr,
camera,
):
geolayoutGraph, fModel = convertObjectToGeolayout(
obj, convertTransformMatrix, camera, obj.name, None, None, DLFormat.Static, True
obj, convertTransformMatrix, True, obj.name, None, None, DLFormat.Static, True
)

return saveGeolayoutBinaryBank0(
Expand Down Expand Up @@ -977,10 +974,9 @@ def exportGeolayoutObjectBinary(
levelCommandPos,
modelID,
textDumpFilePath,
camera,
):
geolayoutGraph, fModel = convertObjectToGeolayout(
obj, convertTransformMatrix, camera, obj.name, None, None, DLFormat.Static, True
obj, convertTransformMatrix, True, obj.name, None, None, DLFormat.Static, True
)

return saveGeolayoutBinary(
Expand Down Expand Up @@ -2863,7 +2859,6 @@ def execute(self, context):
props.custom_include_directory,
save_textures,
save_textures and bpy.context.scene.geoSeparateTextureDef,
None,
props.actor_group_name,
props.export_header_type,
props.obj_name_gfx,
Expand All @@ -2878,7 +2873,6 @@ def execute(self, context):
obj,
final_transform,
bpy.path.abspath(bpy.context.scene.geoInsertableBinaryPath),
None,
)
self.report({"INFO"}, "Success! Data at " + context.scene.geoInsertableBinaryPath)
else:
Expand Down Expand Up @@ -2913,7 +2907,6 @@ def execute(self, context):
*modelLoadInfo,
textDumpFilePath,
getAddressFromRAMAddress(int(context.scene.geoRAMAddr, 16)),
None,
)
else:
addrRange, segPointer = exportGeolayoutObjectBinary(
Expand All @@ -2924,7 +2917,6 @@ def execute(self, context):
segmentData,
*modelLoadInfo,
textDumpFilePath,
None,
)

romfileOutput.close()
Expand Down
2 changes: 1 addition & 1 deletion fast64_internal/sm64/sm64_level_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ def include_proto(file_name):
geolayoutGraph, fModel = convertObjectToGeolayout(
obj,
transformMatrix,
area_root.areaCamera,
False,
f"{level_name}_{areaName}",
fModel,
area_root,
Expand Down

0 comments on commit 60bdf25

Please sign in to comment.