2026-01-01
This commit is contained in:
@@ -7,6 +7,7 @@ from ..panels.bulk_path_management import (
|
||||
set_image_paths,
|
||||
ensure_directory_for_path,
|
||||
)
|
||||
from ..utils import compat
|
||||
|
||||
class AUTOMAT_OT_summary_dialog(bpy.types.Operator):
|
||||
"""Show AutoMat Extractor operation summary"""
|
||||
@@ -70,8 +71,9 @@ class AutoMatExtractor(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
# Get addon preferences
|
||||
addon_name = __package__.split('.')[0]
|
||||
prefs = context.preferences.addons.get(addon_name).preferences
|
||||
common_outside = prefs.automat_common_outside_blend
|
||||
addon_entry = context.preferences.addons.get(addon_name)
|
||||
prefs = addon_entry.preferences if addon_entry else None
|
||||
common_outside = prefs.automat_common_outside_blend if prefs else False
|
||||
|
||||
# Get selected images
|
||||
selected_images = [img for img in bpy.data.images if hasattr(img, "bst_selected") and img.bst_selected]
|
||||
@@ -190,12 +192,23 @@ class AutoMatExtractor(bpy.types.Operator):
|
||||
img = self.selected_images[self.current_index]
|
||||
props.operation_status = f"Building path for {img.name}..."
|
||||
|
||||
# Get blend file name
|
||||
blend_name = bpy.path.basename(bpy.data.filepath)
|
||||
if blend_name:
|
||||
blend_name = os.path.splitext(blend_name)[0]
|
||||
# Get blend file name - respect user preference if set
|
||||
if props.use_blend_subfolder:
|
||||
blend_name = props.blend_subfolder
|
||||
if not blend_name:
|
||||
# Fall back to filename if not specified
|
||||
blend_path = bpy.data.filepath
|
||||
if blend_path:
|
||||
blend_name = os.path.splitext(os.path.basename(blend_path))[0]
|
||||
else:
|
||||
blend_name = "untitled"
|
||||
else:
|
||||
blend_name = "untitled"
|
||||
# Derive from filename
|
||||
blend_path = bpy.data.filepath
|
||||
if blend_path:
|
||||
blend_name = os.path.splitext(os.path.basename(blend_path))[0]
|
||||
else:
|
||||
blend_name = "untitled"
|
||||
blend_name = self.sanitize_filename(blend_name)
|
||||
|
||||
# Determine common path
|
||||
@@ -532,9 +545,9 @@ classes = (
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
compat.safe_register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
compat.safe_unregister_class(cls)
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
import bpy
|
||||
import re
|
||||
from ..utils import compat
|
||||
|
||||
class RENAME_OT_summary_dialog(bpy.types.Operator):
|
||||
"""Show rename operation summary"""
|
||||
@@ -505,9 +506,9 @@ classes = (
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
compat.safe_register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
compat.safe_unregister_class(cls)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import bpy
|
||||
from bpy.types import Operator
|
||||
from ..utils import compat
|
||||
|
||||
class CreateOrthoCamera(Operator):
|
||||
"""Create an orthographic camera with predefined settings"""
|
||||
@@ -38,10 +39,10 @@ class CreateOrthoCamera(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(CreateOrthoCamera)
|
||||
compat.safe_register_class(CreateOrthoCamera)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(CreateOrthoCamera)
|
||||
compat.safe_unregister_class(CreateOrthoCamera)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -1,4 +1,5 @@
|
||||
import bpy
|
||||
from ..utils import compat
|
||||
|
||||
def safe_wgt_removal():
|
||||
"""Safely remove only WGT widget objects that are clearly ghosts"""
|
||||
@@ -680,11 +681,8 @@ classes = (
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
compat.safe_register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
try:
|
||||
bpy.utils.unregister_class(cls)
|
||||
except RuntimeError:
|
||||
pass
|
||||
compat.safe_unregister_class(cls)
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
import bpy
|
||||
from ..utils import compat
|
||||
|
||||
class RemoveCustomSplitNormals(bpy.types.Operator):
|
||||
"""Remove custom split normals and apply smooth shading to all accessible mesh objects"""
|
||||
@@ -53,10 +54,10 @@ class RemoveCustomSplitNormals(bpy.types.Operator):
|
||||
|
||||
# Registration
|
||||
def register():
|
||||
bpy.utils.register_class(MESH_OT_RemoveCustomSplitNormals)
|
||||
compat.safe_register_class(RemoveCustomSplitNormals)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(MESH_OT_RemoveCustomSplitNormals)
|
||||
compat.safe_unregister_class(RemoveCustomSplitNormals)
|
||||
|
||||
# Only run if this script is run directly
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user