Blender Kitsu: Add option to Exclude Collections from Output Collection #120
@ -109,7 +109,11 @@ class KITSU_OT_anim_check_action_names(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
wrong: List[Tuple[bpy.types.Action, str]] = []
|
wrong: List[Tuple[bpy.types.Action, str]] = []
|
||||||
created: List[bpy.types.Action] = []
|
created: List[bpy.types.Action] = []
|
||||||
cleanup_empty_actions: bpy.props.BoolProperty(name="Delete Empty Action Data-Blocks", default=False, description="Remove any empty action data-blocks, actions that have 0 Fcurves/Keyframes")
|
cleanup_empty_actions: bpy.props.BoolProperty(
|
||||||
|
name="Delete Empty Action Data-Blocks",
|
||||||
|
default=False,
|
||||||
|
description="Remove any empty action data-blocks, actions that have 0 Fcurves/Keyframes",
|
||||||
|
)
|
||||||
|
|
||||||
# List of tuples that contains the action on index 0 with the wrong name
|
# List of tuples that contains the action on index 0 with the wrong name
|
||||||
# and the name it should have on index 1.
|
# and the name it should have on index 1.
|
||||||
@ -118,7 +122,7 @@ class KITSU_OT_anim_check_action_names(bpy.types.Operator):
|
|||||||
def poll(cls, context: bpy.types.Context) -> bool:
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
return bool(cache.shot_active_get())
|
return bool(cache.shot_active_get())
|
||||||
|
|
||||||
def get_action(self, action_name:str):
|
def get_action(self, action_name: str):
|
||||||
if bpy.data.actions.get(action_name):
|
if bpy.data.actions.get(action_name):
|
||||||
return bpy.data.actions.get(action_name)
|
return bpy.data.actions.get(action_name)
|
||||||
else:
|
else:
|
||||||
@ -135,17 +139,17 @@ class KITSU_OT_anim_check_action_names(bpy.types.Operator):
|
|||||||
succeeded = []
|
succeeded = []
|
||||||
removed = []
|
removed = []
|
||||||
|
|
||||||
|
|
||||||
if self.cleanup_empty_actions:
|
if self.cleanup_empty_actions:
|
||||||
for action in bpy.data.actions:
|
for action in bpy.data.actions:
|
||||||
if len(action.fcurves) == 0 and action.use_fake_user and action.users == 1:
|
if (
|
||||||
|
len(action.fcurves) == 0
|
||||||
|
and action.use_fake_user
|
||||||
|
and action.users == 1
|
||||||
|
):
|
||||||
removed.append(action.name)
|
removed.append(action.name)
|
||||||
action.use_fake_user = False
|
action.use_fake_user = False
|
||||||
bpy.data.actions.remove(action)
|
bpy.data.actions.remove(action)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for obj in [obj for obj in bpy.data.objects if obj.type == "ARMATURE"]:
|
for obj in [obj for obj in bpy.data.objects if obj.type == "ARMATURE"]:
|
||||||
# Cerate Action if None Exists
|
# Cerate Action if None Exists
|
||||||
if obj.animation_data is None or obj.animation_data.action is None:
|
if obj.animation_data is None or obj.animation_data.action is None:
|
||||||
@ -186,8 +190,6 @@ class KITSU_OT_anim_check_action_names(bpy.types.Operator):
|
|||||||
if len(self.created) != 0:
|
if len(self.created) != 0:
|
||||||
report_str += f" | Created Actions: {len(self.created)}"
|
report_str += f" | Created Actions: {len(self.created)}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.report(
|
self.report(
|
||||||
{report_state},
|
{report_state},
|
||||||
report_str,
|
report_str,
|
||||||
|
Loading…
Reference in New Issue
Block a user