work
save startup blend for animation tab & whatnot
This commit is contained in:
@@ -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__
|
||||
|
||||
@@ -305,7 +305,7 @@ class DLM_OT_migrator_migrate_nla(Operator):
|
||||
return {"CANCELLED"}
|
||||
try:
|
||||
from ..ops.migrator import run_mig_nla
|
||||
run_mig_nla(orig, rep, report=self.report)
|
||||
run_mig_nla(orig, rep, report=self.report, context=context)
|
||||
return {"FINISHED"}
|
||||
except Exception as e:
|
||||
self.report({"ERROR"}, str(e))
|
||||
@@ -399,7 +399,16 @@ class DLM_OT_migrator_basebody_shapekeys(Operator):
|
||||
from ..utils import descendants
|
||||
rep_descendants = descendants(rep)
|
||||
run_mig_bbody_shapekeys(orig, rep, rep_descendants, context)
|
||||
self.report({"INFO"}, "Migrate BaseBody shapekeys done.")
|
||||
props = context.scene.dynamic_link_manager
|
||||
if props.migbbody_manual_override and (
|
||||
not props.migbbody_orig_body or not props.migbbody_rep_body
|
||||
):
|
||||
self.report(
|
||||
{"WARNING"},
|
||||
"MigBBody: no CC-style base mesh matched. Pick Original/Replacement body meshes, then run again.",
|
||||
)
|
||||
else:
|
||||
self.report({"INFO"}, "Migrate BaseBody shapekeys done.")
|
||||
return {"FINISHED"}
|
||||
except Exception as e:
|
||||
self.report({"ERROR"}, str(e))
|
||||
@@ -531,9 +540,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, rep)
|
||||
if coll:
|
||||
coll_name = coll.name # Store name BEFORE removal (RNA invalidates after remove)
|
||||
context.scene.dynamic_link_manager.original_character = None
|
||||
@@ -541,10 +551,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}")
|
||||
|
||||
@@ -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")
|
||||
@@ -96,6 +98,14 @@ class DLM_PT_main_panel(Panel):
|
||||
# Situational
|
||||
situational_box = layout.box()
|
||||
situational_box.label(text="Situational Fixes", icon="QUESTION")
|
||||
row = situational_box.row()
|
||||
row.prop(props, "migbbody_manual_override", text="Manual body meshes")
|
||||
row = situational_box.row()
|
||||
row.enabled = props.migbbody_manual_override
|
||||
row.prop(props, "migbbody_orig_body", text="Original body")
|
||||
row = situational_box.row()
|
||||
row.enabled = props.migbbody_manual_override
|
||||
row.prop(props, "migbbody_rep_body", text="Replacement body")
|
||||
row = situational_box.row(align=True)
|
||||
row.operator("dlm.migrator_basebody_shapekeys", text="MigBBodyShapeKeys", icon="SHAPEKEY_DATA")
|
||||
row = situational_box.row(align=True)
|
||||
|
||||
@@ -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",
|
||||
@@ -60,6 +78,28 @@ class DynamicLinkManagerProperties(PropertyGroup):
|
||||
poll=lambda self, obj: obj and obj.type == "ARMATURE",
|
||||
)
|
||||
|
||||
# MigBBody: manual mesh pair when CC/iClone-style auto-detection fails
|
||||
migbbody_manual_override: BoolProperty(
|
||||
name="Manual body meshes",
|
||||
description=(
|
||||
"Enable to pick original and replacement body meshes manually. "
|
||||
"Auto-enables if MigBBody cannot find a base mesh (non-CC rigs)."
|
||||
),
|
||||
default=False,
|
||||
)
|
||||
migbbody_orig_body: PointerProperty(
|
||||
name="Original body",
|
||||
description="Original character body mesh (shape key source)",
|
||||
type=bpy.types.Object,
|
||||
poll=lambda self, obj: obj and obj.type == "MESH",
|
||||
)
|
||||
migbbody_rep_body: PointerProperty(
|
||||
name="Replacement body",
|
||||
description="Replacement character body mesh (shape key target)",
|
||||
type=bpy.types.Object,
|
||||
poll=lambda self, obj: obj and obj.type == "MESH",
|
||||
)
|
||||
|
||||
# Tweak tools (collapsible section)
|
||||
tweak_tools_section_expanded: BoolProperty(
|
||||
name="Tweak Tools Expanded",
|
||||
|
||||
Reference in New Issue
Block a user