begin implementing ARP functionality

This commit is contained in:
Nathan
2026-03-25 14:30:17 -06:00
parent c2b1829fbf
commit 3c0839249f
6 changed files with 1191 additions and 218 deletions
+10 -5
View File
@@ -9,7 +9,7 @@ from bpy.types import Operator
from bpy.props import StringProperty, BoolProperty
from bpy.props import StringProperty, IntProperty
from ..utils import collection_containing_armature
from ..utils.remove_original import resolve_collection_for_remove_original
ADDON_NAME = __package__.rsplit(".", 1)[0] if "." in __package__ else __package__
@@ -531,9 +531,10 @@ class DLM_OT_migrator_remove_original(Operator):
if removed_actions:
self.report({"INFO"}, f"Removed {len(removed_actions)} action(s) from original")
props = context.scene.dynamic_link_manager
rig_family = getattr(props, "migrator_rig_family", "RIGIFY")
try:
# Try to find and delete the collection containing the original character
coll = collection_containing_armature(orig)
coll = resolve_collection_for_remove_original(orig, rig_family, context.scene)
if coll:
coll_name = coll.name # Store name BEFORE removal (RNA invalidates after remove)
context.scene.dynamic_link_manager.original_character = None
@@ -541,10 +542,14 @@ class DLM_OT_migrator_remove_original(Operator):
bpy.data.collections.remove(coll)
self.report({"INFO"}, f"Removed collection: {coll_name}")
except Exception as remove_err:
# Collection may have already been removed by another process
self.report({"WARNING"}, f"Collection {coll_name} removal issue: {remove_err}")
try:
bpy.data.objects.remove(orig, do_unlink=True)
self.report({"INFO"}, f"Removed original object: {name}")
except Exception as e2:
self.report({"ERROR"}, f"Could not remove original after collection failure: {e2}")
return {"CANCELLED"}
else:
# Fallback: just delete the armature object
bpy.data.objects.remove(orig, do_unlink=True)
context.scene.dynamic_link_manager.original_character = None
self.report({"INFO"}, f"Removed original character: {name}")
+2
View File
@@ -76,6 +76,8 @@ class DLM_PT_main_panel(Panel):
box = layout.box()
box.label(text="Character Migrator")
row = box.row()
row.prop(props, "migrator_rig_family", expand=True)
row = box.row()
row.prop(props, "migrator_mode", text="Automatic pair discovery")
row = box.row()
row.prop(props, "original_character", text="Original")
+19 -1
View File
@@ -5,7 +5,14 @@
import bpy
from bpy.types import PropertyGroup
from bpy.props import IntProperty, StringProperty, BoolProperty, CollectionProperty, PointerProperty
from bpy.props import (
IntProperty,
StringProperty,
BoolProperty,
CollectionProperty,
PointerProperty,
EnumProperty,
)
class SearchPathItem(PropertyGroup):
@@ -41,6 +48,17 @@ class DynamicLinkManagerProperties(PropertyGroup):
)
selected_asset_path: StringProperty(name="Selected Asset Path", default="")
# Character migrator: rig family (future ARP-specific migration; Remove Original uses it for collection resolution)
migrator_rig_family: EnumProperty(
name="Rig family",
description="Rigify vs Auto-Rig Pro: affects Remove Original collection detection and future bone heuristics",
items=(
("RIGIFY", "Rigify", "Rigify rig naming and defaults"),
("ARP", "ARP", "Auto-Rig Pro rig naming and collection behavior"),
),
default="RIGIFY",
)
# Character migrator (manual mode)
migrator_mode: BoolProperty(
name="Automatic",