diff --git a/fast64_internal/sm64/sm64_collision.py b/fast64_internal/sm64/sm64_collision.py index 6e2907f0c..bb3b59c72 100644 --- a/fast64_internal/sm64/sm64_collision.py +++ b/fast64_internal/sm64/sm64_collision.py @@ -387,7 +387,7 @@ def exportCollisionCommon(obj, transformMatrix, includeSpecials, includeChildren try: addCollisionTriangles(tempObj, collisionDict, includeChildren, transformMatrix, areaIndex) if not collisionDict: - raise PluginError("No collision data to export") + raise PluginError("No collision data to export", PluginError.exc_warn) cleanupDuplicatedObjects(allObjs) obj.select_set(True) bpy.context.view_layer.objects.active = obj diff --git a/fast64_internal/sm64/sm64_geolayout_writer.py b/fast64_internal/sm64/sm64_geolayout_writer.py index fbe779a97..0fd07e697 100644 --- a/fast64_internal/sm64/sm64_geolayout_writer.py +++ b/fast64_internal/sm64/sm64_geolayout_writer.py @@ -504,7 +504,7 @@ def convertObjectToGeolayout( convertTextureData, ) if is_actor and not meshGeolayout.has_data(): - raise PluginError("No gfx data to export, gfx export cancelled") + raise PluginError("No gfx data to export, gfx export cancelled", PluginError.exc_warn) except Exception as e: raise Exception(str(e)) finally: diff --git a/fast64_internal/sm64/sm64_objects.py b/fast64_internal/sm64/sm64_objects.py index 5a9470c08..dfdade5f1 100644 --- a/fast64_internal/sm64/sm64_objects.py +++ b/fast64_internal/sm64/sm64_objects.py @@ -1,5 +1,6 @@ import math, bpy, mathutils import os +import traceback from bpy.utils import register_class, unregister_class from re import findall, sub from pathlib import Path @@ -1863,7 +1864,7 @@ def execute_col(self, props, obj): bpy.ops.object.sm64_export_collision(export_obj=obj.name) except Exception as exc: # pass on multiple export, throw on singular - if not props.export_all_selected: + if not props.export_all_selected or not PluginError.check_exc_warn(exc): raise Exception(exc) from exc # writes model.inc.c, geo.inc.c file, geo_header.h @@ -1883,10 +1884,10 @@ def execute_gfx(self, props, context, obj, index): if props.export_script_loads and props.model_id != 0: self.export_model_id(context, props, index) self.export_script_load(context, props) - except Exception as e: + except Exception as exc: # pass on multiple export, throw on singular - if not props.export_all_selected: - raise Exception(e) + if not props.export_all_selected or not PluginError.check_exc_warn(exc): + raise Exception(exc) def execute(self, context): props = context.scene.fast64.sm64.combined_export @@ -1909,6 +1910,7 @@ def execute(self, context): props.context_obj = None # you've done it!~ self.report({"INFO"}, "Success!") + return {"FINISHED"} diff --git a/fast64_internal/utility.py b/fast64_internal/utility.py index 4c19b0b10..0f5e8f64a 100644 --- a/fast64_internal/utility.py +++ b/fast64_internal/utility.py @@ -10,7 +10,22 @@ class PluginError(Exception): - pass + # arguments for exception processing + exc_halt = "exc_halt" + exc_warn = "exc_warn" + + """ + because exceptions generally go through multiple funcs + and layers, the easiest way to check if we have an exception + of a certain type is to check for our input string + """ + + @classmethod + def check_exc_warn(self, exc): + for arg in exc.args: + if type(arg) is str and self.exc_warn in arg: + return True + return False class VertexWeightError(PluginError):