[Blender_Kitsu] Add Operators to cleanup Animation Files #38

Merged
Nick Alberelli merged 12 commits from feature/enforce_naming into main 2023-05-09 17:12:20 +02:00
2 changed files with 21 additions and 1 deletions
Showing only changes of commit 4909040cdf - Show all commits

View File

@ -326,6 +326,21 @@ class KITSU_OT_anim_enforce_naming_convention(bpy.types.Operator):
) )
return {"FINISHED"} return {"FINISHED"}
class KITSU_OT_remove_override_hidden_collections(bpy.types.Operator):
bl_idname = "kitsu.remove_override_hidden_collections"
bl_label = "Cleanup Override Collections"
bl_options = {"REGISTER", "UNDO"}
bl_description = ("Unlink any Collection with Name 'OVERRIDE_HIDDEN' from current scene")
def execute(self, context):
remove_name = 'OVERRIDE_HIDDEN'
scene_cols = context.scene.collection.children
cols = [col for col in scene_cols if remove_name in col.name]
for col in cols:
scene_cols.unlink(col)
self.report({"INFO"}, f"Removed Collection '{col.name}'",)
return {"FINISHED"}
class KITSU_OT_anim_update_output_coll(bpy.types.Operator): class KITSU_OT_anim_update_output_coll(bpy.types.Operator):
bl_idname = "kitsu.anim_update_output_coll" bl_idname = "kitsu.anim_update_output_coll"
@ -389,6 +404,7 @@ classes = [
KITSU_OT_anim_check_action_names, KITSU_OT_anim_check_action_names,
KITSU_OT_anim_update_output_coll, KITSU_OT_anim_update_output_coll,
KITSU_OT_anim_enforce_naming_convention, KITSU_OT_anim_enforce_naming_convention,
KITSU_OT_remove_override_hidden_collections
] ]

View File

@ -100,6 +100,10 @@ class KITSU_PT_vi3d_anim_tools(bpy.types.Panel):
row = box.row(align=True) row = box.row(align=True)
row.operator("kitsu.anim_enforce_naming_convention", icon="SORTALPHA") row.operator("kitsu.anim_enforce_naming_convention", icon="SORTALPHA")
row = box.row(align=True)
row.operator("kitsu.remove_override_hidden_collections", icon="OUTLINER_COLLECTION")
# ---------REGISTER ----------. # ---------REGISTER ----------.