Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SM64] Only throw empty gfx exception in actor exports #413

Merged
merged 9 commits into from
Dec 28, 2024
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 @@ -502,7 +501,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 @@ -569,7 +568,6 @@ def exportGeolayoutObjectC(
texDir,
savePNG,
texSeparate,
camera,
groupName,
headerType,
dirName,
Expand All @@ -579,7 +577,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 @@ -842,9 +840,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 @@ -892,10 +890,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 @@ -975,10 +972,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
Lilaa3 marked this conversation as resolved.
Show resolved Hide resolved
)

return saveGeolayoutBinary(
Expand Down Expand Up @@ -2861,7 +2857,6 @@ def execute(self, context):
bpy.context.scene.geoTexDir,
save_textures,
save_textures and bpy.context.scene.geoSeparateTextureDef,
None,
props.actor_group_name,
props.export_header_type,
props.obj_name_gfx,
Expand All @@ -2876,7 +2871,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 @@ -2911,7 +2905,6 @@ def execute(self, context):
*modelLoadInfo,
textDumpFilePath,
getAddressFromRAMAddress(int(context.scene.geoRAMAddr, 16)),
None,
)
else:
addrRange, segPointer = exportGeolayoutObjectBinary(
Expand All @@ -2922,7 +2915,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
Loading