fix more error logging errors
This commit is contained in:
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import threading
|
import threading
|
||||||
@@ -18,7 +19,7 @@ from bpy.utils import register_class
|
|||||||
from ..core.logging_setup import logger
|
from ..core.logging_setup import logger
|
||||||
from ..core.translations import t
|
from ..core.translations import t
|
||||||
from ..core.dictionaries import bone_names
|
from ..core.dictionaries import bone_names
|
||||||
from .dictionaries import reverse_bone_lookup, bone_names
|
from .dictionaries import reverse_bone_lookup, bone_names, simplify_bonename
|
||||||
|
|
||||||
class SceneMatClass(PropertyGroup):
|
class SceneMatClass(PropertyGroup):
|
||||||
mat: PointerProperty(type=Material)
|
mat: PointerProperty(type=Material)
|
||||||
@@ -202,7 +203,7 @@ def apply_pose_as_rest(context: Context, armature_obj: Object, meshes: List[Obje
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error applying pose as rest:", exception=e)
|
logger.error(f"Error applying pose as rest:", exception=e)
|
||||||
return False, str(e)
|
return False, traceback.format_exc()
|
||||||
|
|
||||||
def apply_armature_to_mesh(armature_obj: Object, mesh_obj: Object) -> None:
|
def apply_armature_to_mesh(armature_obj: Object, mesh_obj: Object) -> None:
|
||||||
"""Apply armature deformation to mesh"""
|
"""Apply armature deformation to mesh"""
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ logger: logging.Logger = logging.getLogger(__name__)
|
|||||||
import importlib.util
|
import importlib.util
|
||||||
|
|
||||||
if importlib.util.find_spec("io_scene_valvesource") is not None:
|
if importlib.util.find_spec("io_scene_valvesource") is not None:
|
||||||
from io_scene_valvesource.import_smd import SmdImporter
|
from io_scene_valvesource.import_smd import SmdImporter # type: ignore
|
||||||
|
|
||||||
class ImportProgress:
|
class ImportProgress:
|
||||||
"""Tracks and logs the progress of multi-file imports"""
|
"""Tracks and logs the progress of multi-file imports"""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
from types import FrameType
|
from types import FrameType
|
||||||
import bpy
|
import bpy
|
||||||
import bpy_extras
|
import bpy_extras
|
||||||
@@ -93,7 +94,7 @@ class AvatarToolkit_OT_ConvertResonite(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error during Resonite conversion:", exception=e)
|
logger.error(f"Error during Resonite conversion:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from typing import List, Optional, Dict, Set, Tuple, Any
|
from typing import List, Optional, Dict, Set, Tuple, Any
|
||||||
@@ -73,7 +74,7 @@ class AvatarToolkit_OT_MergeArmature(bpy.types.Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error merging armatures:", exception=e)
|
logger.error(f"Error merging armatures:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
def delete_rigidbodies_and_joints(armature: Object) -> None:
|
def delete_rigidbodies_and_joints(armature: Object) -> None:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator, Context, Object, ArmatureModifier, VertexGroup
|
from bpy.types import Operator, Context, Object, ArmatureModifier, VertexGroup
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
@@ -116,7 +117,7 @@ class AvatarToolkit_OT_AttachMesh(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to attach mesh:", exception=e)
|
logger.error(f"Failed to attach mesh:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
def validate_mesh_transforms(mesh: Optional[Object]) -> tuple[bool, str]:
|
def validate_mesh_transforms(mesh: Optional[Object]) -> tuple[bool, str]:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import re
|
import re
|
||||||
from typing import Set, Dict, List, Optional, Tuple
|
from typing import Set, Dict, List, Optional, Tuple
|
||||||
@@ -143,7 +144,7 @@ class AvatarToolkit_OT_CombineMaterials(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to combine materials:", exception=e)
|
logger.error(f"Failed to combine materials:", exception=e)
|
||||||
self.report({'ERROR'}, t("Optimization.error.combine_materials", error=str(e)))
|
self.report({'ERROR'}, t("Optimization.error.combine_materials", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
def consolidate_materials(self, meshes: List[Object]) -> int:
|
def consolidate_materials(self, meshes: List[Object]) -> int:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from typing import Set, List, Tuple, ClassVar
|
from typing import Set, List, Tuple, ClassVar
|
||||||
from bpy.types import Operator, Context, Object
|
from bpy.types import Operator, Context, Object
|
||||||
@@ -53,7 +54,7 @@ class AvatarToolkit_OT_JoinAllMeshes(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to join meshes:", exception=e)
|
logger.error(f"Failed to join meshes:", exception=e)
|
||||||
self.report({'ERROR'}, t("Optimization.error.join_meshes", error=str(e)))
|
self.report({'ERROR'}, t("Optimization.error.join_meshes", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_JoinSelectedMeshes(Operator):
|
class AvatarToolkit_OT_JoinSelectedMeshes(Operator):
|
||||||
@@ -97,5 +98,5 @@ class AvatarToolkit_OT_JoinSelectedMeshes(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to join selected meshes:", exception=e)
|
logger.error(f"Failed to join selected meshes:", exception=e)
|
||||||
self.report({'ERROR'}, t("Optimization.error.join_selected", error=str(e)))
|
self.report({'ERROR'}, t("Optimization.error.join_selected", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from typing import Set, Dict, List, Tuple, Optional, Any
|
from typing import Set, Dict, List, Tuple, Optional, Any
|
||||||
from bpy.props import StringProperty
|
from bpy.props import StringProperty
|
||||||
@@ -64,7 +65,7 @@ class AvatarToolkit_OT_StartPoseMode(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to start pose mode:", exception=e)
|
logger.error(f"Failed to start pose mode:", exception=e)
|
||||||
self.report({'ERROR'}, t("PoseMode.error.start", error=str(e)))
|
self.report({'ERROR'}, t("PoseMode.error.start", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_StopPoseMode(Operator):
|
class AvatarToolkit_OT_StopPoseMode(Operator):
|
||||||
@@ -87,7 +88,7 @@ class AvatarToolkit_OT_StopPoseMode(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to stop pose mode:", exception=e)
|
logger.error(f"Failed to stop pose mode:", exception=e)
|
||||||
self.report({'ERROR'}, t("PoseMode.error.stop", error=str(e)))
|
self.report({'ERROR'}, t("PoseMode.error.stop", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_ApplyPoseAsRest(Operator, BatchPoseOperationMixin):
|
class AvatarToolkit_OT_ApplyPoseAsRest(Operator, BatchPoseOperationMixin):
|
||||||
@@ -131,7 +132,7 @@ class AvatarToolkit_OT_ApplyPoseAsRest(Operator, BatchPoseOperationMixin):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to apply pose as shape key:", exception=e)
|
logger.error(f"Failed to apply pose as shape key:", exception=e)
|
||||||
self.report({'ERROR'}, t("PoseMode.error.shapekey", error=str(e)))
|
self.report({'ERROR'}, t("PoseMode.error.shapekey", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_ApplyPoseAsShapekey(Operator, BatchPoseOperationMixin):
|
class AvatarToolkit_OT_ApplyPoseAsShapekey(Operator, BatchPoseOperationMixin):
|
||||||
@@ -162,5 +163,5 @@ class AvatarToolkit_OT_ApplyPoseAsShapekey(Operator, BatchPoseOperationMixin):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to apply pose as rest:", exception=e)
|
logger.error(f"Failed to apply pose as rest:", exception=e)
|
||||||
self.report({'ERROR'}, t("PoseMode.error.rest_pose", error=str(e)))
|
self.report({'ERROR'}, t("PoseMode.error.rest_pose", error=traceback.format_exc()))
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from bpy.types import Operator, Context
|
from bpy.types import Operator, Context
|
||||||
@@ -44,7 +45,7 @@ class AvatarToolkit_OT_ApplyTransforms(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to apply transforms:", exception=e)
|
logger.error(f"Failed to apply transforms:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_CleanShapekeys(Operator):
|
class AvatarToolkit_OT_CleanShapekeys(Operator):
|
||||||
@@ -88,5 +89,5 @@ class AvatarToolkit_OT_CleanShapekeys(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to clean shape keys:", exception=e)
|
logger.error(f"Failed to clean shape keys:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import re
|
import re
|
||||||
from bpy.types import Operator, Context, EditBone, Object, Armature, Mesh
|
from bpy.types import Operator, Context, EditBone, Object, Armature, Mesh
|
||||||
@@ -99,7 +100,7 @@ class AvatarToolKit_OT_CreateDigitigradeLegs(Operator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.report({'ERROR'}, t("Tools.digitigrade_error", error=str(e)))
|
self.report({'ERROR'}, t("Tools.digitigrade_error", error=traceback.format_exc()))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def execute(self, context: Context) -> set[str]:
|
def execute(self, context: Context) -> set[str]:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import math
|
import math
|
||||||
from typing import Set, List
|
from typing import Set, List
|
||||||
@@ -52,7 +53,7 @@ class AvatarToolkit_OT_ConnectBones(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to connect bones:", exception=e)
|
logger.error(f"Failed to connect bones:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_MergeToActive(Operator):
|
class AvatarToolkit_OT_MergeToActive(Operator):
|
||||||
@@ -106,7 +107,7 @@ class AvatarToolkit_OT_MergeToActive(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to merge bones:", exception=e)
|
logger.error(f"Failed to merge bones:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolkit_OT_MergeToParent(Operator):
|
class AvatarToolkit_OT_MergeToParent(Operator):
|
||||||
@@ -158,5 +159,5 @@ class AvatarToolkit_OT_MergeToParent(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to merge bones:", exception=e)
|
logger.error(f"Failed to merge bones:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator, Context
|
from bpy.types import Operator, Context
|
||||||
from ...core.translations import t
|
from ...core.translations import t
|
||||||
@@ -33,7 +34,7 @@ class AvatarToolKit_OT_SeparateByMaterials(Operator):
|
|||||||
self.report({'INFO'}, t("Tools.separate_materials_success"))
|
self.report({'INFO'}, t("Tools.separate_materials_success"))
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolKit_OT_SeparateByLooseParts(Operator):
|
class AvatarToolKit_OT_SeparateByLooseParts(Operator):
|
||||||
@@ -65,5 +66,5 @@ class AvatarToolKit_OT_SeparateByLooseParts(Operator):
|
|||||||
self.report({'INFO'}, t("Tools.separate_loose_success"))
|
self.report({'INFO'}, t("Tools.separate_loose_success"))
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from typing import Dict, List, Set, Optional, Tuple, Any
|
from typing import Dict, List, Set, Optional, Tuple, Any
|
||||||
from bpy.types import Operator, Context, Object, PoseBone, EditBone, Bone, Constraint
|
from bpy.types import Operator, Context, Object, PoseBone, EditBone, Bone, Constraint
|
||||||
@@ -58,7 +59,7 @@ class AvatarToolkit_OT_ConvertRigifyToUnity(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to convert Rigify:", exception=e)
|
logger.error(f"Failed to convert Rigify:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
def cleanup_extra_bones(self, armature: Object) -> None:
|
def cleanup_extra_bones(self, armature: Object) -> None:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
import math
|
import math
|
||||||
from typing import Dict, List, Set, Tuple, Optional, Any, Union
|
from typing import Dict, List, Set, Tuple, Optional, Any, Union
|
||||||
@@ -104,7 +105,7 @@ class AvatarToolkit_OT_StandardizeArmature(Operator):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to standardize armature:", exception=e)
|
logger.error(f"Failed to standardize armature:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if original_mode == 'EDIT_ARMATURE':
|
if original_mode == 'EDIT_ARMATURE':
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# This code was taken from Cats Blender Plugin Unoffical, some of this code is by the original developers, however was improved by myself.
|
# This code was taken from Cats Blender Plugin Unoffical, some of this code is by the original developers, however was improved by myself.
|
||||||
# Didn't think it was necessary to re-make something that works well.
|
# Didn't think it was necessary to re-make something that works well.
|
||||||
|
|
||||||
|
import traceback
|
||||||
import bpy
|
import bpy
|
||||||
from typing import Dict, List, Optional, Tuple, Any, Set, Union
|
from typing import Dict, List, Optional, Tuple, Any, Set, Union
|
||||||
from bpy.types import Operator, Context, Object, ShapeKey
|
from bpy.types import Operator, Context, Object, ShapeKey
|
||||||
@@ -223,7 +224,7 @@ class ATOOLKIT_OT_create_visemes(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error creating visemes:", exception=e)
|
logger.error(f"Error creating visemes:", exception=e)
|
||||||
self.report({'ERROR'}, str(e))
|
self.report({'ERROR'}, traceback.format_exc())
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
def create_visemes(self, context: Context, mesh: Object) -> None:
|
def create_visemes(self, context: Context, mesh: Object) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user