From 60bdf2538816f4fedd62081c7b09df094e233d7e Mon Sep 17 00:00:00 2001 From: Lila Date: Sat, 28 Dec 2024 18:22:01 +0000 Subject: [PATCH] [SM64] Only throw empty gfx exception in actor exports (#413) * [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 --- fast64_internal/sm64/sm64_geolayout_writer.py | 22 ++++++------------- fast64_internal/sm64/sm64_level_writer.py | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/fast64_internal/sm64/sm64_geolayout_writer.py b/fast64_internal/sm64/sm64_geolayout_writer.py index d1d88eaac..340f09e39 100644 --- a/fast64_internal/sm64/sm64_geolayout_writer.py +++ b/fast64_internal/sm64/sm64_geolayout_writer.py @@ -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: @@ -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)) @@ -571,7 +570,6 @@ def exportGeolayoutObjectC( texDir, savePNG, texSeparate, - camera, groupName, headerType, dirName, @@ -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( @@ -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) @@ -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( @@ -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( @@ -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, @@ -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: @@ -2913,7 +2907,6 @@ def execute(self, context): *modelLoadInfo, textDumpFilePath, getAddressFromRAMAddress(int(context.scene.geoRAMAddr, 16)), - None, ) else: addrRange, segPointer = exportGeolayoutObjectBinary( @@ -2924,7 +2917,6 @@ def execute(self, context): segmentData, *modelLoadInfo, textDumpFilePath, - None, ) romfileOutput.close() diff --git a/fast64_internal/sm64/sm64_level_writer.py b/fast64_internal/sm64/sm64_level_writer.py index 8eda9a5e6..dc2d7408f 100644 --- a/fast64_internal/sm64/sm64_level_writer.py +++ b/fast64_internal/sm64/sm64_level_writer.py @@ -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,