[Blender_Kitsu] Add Operators to cleanup Animation Files #38
@ -273,23 +273,13 @@ class KITSU_OT_anim_enforce_naming_convention(bpy.types.Operator):
|
|||||||
layout.prop(self, "remove_str")
|
layout.prop(self, "remove_str")
|
||||||
|
|
||||||
def rename_datablock(self, data_block, replace:str):
|
def rename_datablock(self, data_block, replace:str):
|
||||||
if data_block is None:
|
# Return Early if data_block is linked but not overriden
|
||||||
|
if data_block is None or data_block.library is not None:
|
||||||
return
|
return
|
||||||
if replace in data_block.name:
|
if replace in data_block.name:
|
||||||
data_block.name = data_block.name.replace(replace,"")
|
data_block.name = data_block.name.replace(replace,"")
|
||||||
return (data_block.name)
|
return (data_block.name)
|
||||||
|
|
||||||
def get_version_from_string(self, string:str):
|
|
||||||
try:
|
|
||||||
numbers = string.split(
|
|
||||||
".v")[-1]
|
|
||||||
if ".001" in numbers:
|
|
||||||
numbers = int(numbers.replace(".001", ""))+1
|
|
||||||
int_numbers = int(numbers)
|
|
||||||
return str(int_numbers)
|
|
||||||
except AttributeError:
|
|
||||||
return "001"
|
|
||||||
|
|
||||||
def execute(self, context:bpy.types.Context):
|
def execute(self, context:bpy.types.Context):
|
||||||
shot_base_name = bpy.path.basename(bpy.data.filepath).replace(".anim.blend","")
|
shot_base_name = bpy.path.basename(bpy.data.filepath).replace(".anim.blend","")
|
||||||
scene_col = context.scene.collection
|
scene_col = context.scene.collection
|
||||||
|
Loading…
Reference in New Issue
Block a user