Blender Kitsu: Add option to Exclude Collections from Output Collection #120

Merged
Nick Alberelli merged 9 commits from :feature/exclude-output-collections into main 2023-07-13 19:54:03 +02:00
Showing only changes of commit 62f4d00429 - Show all commits

View File

@ -109,16 +109,20 @@ 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.
@classmethod @classmethod
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:
@ -185,8 +189,6 @@ class KITSU_OT_anim_check_action_names(bpy.types.Operator):
report_str += f" | Rename Failed: {len(failed)}" report_str += f" | Rename Failed: {len(failed)}"
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},