Move Anim_Setup module into Blender_Kitsu #5

Merged
Nick Alberelli merged 27 commits from :feature/merge_anim_setup_into_blender_kitsu into master 2023-04-05 17:38:41 +02:00
2 changed files with 20 additions and 10 deletions
Showing only changes of commit 6fc39c1a5f - Show all commits

View File

@ -342,6 +342,19 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
description="All Shots built by 'Shot_builder' should begin at this frame", description="All Shots built by 'Shot_builder' should begin at this frame",
default=101, default=101,
) )
shot_builder_armature_prefix: bpy.props.StringProperty( # type: ignore
name="Armature Prefix",
description="Naming convention prefix that exists on published assets containing armatures. Used to create/name actions during 'Shot_Build'. Armature name example:'{prefix}{base_name}'",
default="RIG-",
)
shot_builder_action_prefix: bpy.props.StringProperty( # type: ignore
name="Action Prefix",
description="Naming convention prefix to add to new actions. Actions will be named '{prefix}{base_name}.{shot_name}.v001' and set to fake user during 'Shot_Build'",
default="ANI-",
)
session: Session = Session() session: Session = Session()
tasks: bpy.props.CollectionProperty(type=KITSU_task) tasks: bpy.props.CollectionProperty(type=KITSU_task)
@ -431,6 +444,8 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
start_frame_row = box.row() start_frame_row = box.row()
start_frame_row.label(text="Start Frame Offset") start_frame_row.label(text="Start Frame Offset")
start_frame_row.prop(self, "shot_builder_frame_offset", text="") start_frame_row.prop(self, "shot_builder_frame_offset", text="")
box.row().prop(self, "shot_builder_armature_prefix")
box.row().prop(self, "shot_builder_action_prefix")
# Misc settings. # Misc settings.
box = layout.box() box = layout.box()
@ -445,11 +460,6 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
box.row().prop(self, "shot_counter_digits") box.row().prop(self, "shot_counter_digits")
box.row().prop(self, "shot_counter_increment") box.row().prop(self, "shot_counter_increment")
# Misc settings.
box = layout.box()
box.label(text="Shot Builder", icon="MOD_BUILD")
box.row().prop(self, "edit_export_dir")
box.row().prop(self, "edit_export_file_pattern")
@property @property
def playblast_root_path(self) -> Optional[Path]: def playblast_root_path(self) -> Optional[Path]:

View File

@ -172,10 +172,10 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
# Initilize armatures # Initilize armatures
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"]:
base_name = obj.name.split('RIG-')[-1] #BLEDNER-STUDIO NAMING CONVENTION base_name = obj.name.split(addon_prefs.shot_builder_armature_prefix)[-1]
action = bpy.data.actions.new(f"ANI-{base_name}.{shot.name}.v001") new_action = bpy.data.actions.new(f"{addon_prefs.shot_builder_action_prefix}{base_name}.{shot.name}.v001")
action.use_fake_user = True new_action.use_fake_user = True
obj.animation_data.action = action obj.animation_data.action = new_action
# Set Shot Frame Range # Set Shot Frame Range
context.scene.frame_start = addon_prefs.shot_builder_frame_offset context.scene.frame_start = addon_prefs.shot_builder_frame_offset