Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 82fd347ae8 - Show all commits

View File

@ -117,6 +117,7 @@ def add_suffix_to_hierarchy(collection: bpy.types.Collection, suffix_base: str)
def asset_prefix_name_get(name: str) -> str: def asset_prefix_name_get(name: str) -> str:
"""Returns a string with the asset prefix if it is not already set.
Users can specify a prefix to live on all objects during the Users can specify a prefix to live on all objects during the
asset creation process. This prefix is stored in the scene. asset creation process. This prefix is stored in the scene.
@ -134,12 +135,13 @@ def asset_prefix_name_get(name: str) -> str:
def task_layer_prefix_name_get(name: str, task_layer_owner: str) -> str: def task_layer_prefix_name_get(name: str, task_layer_owner: str) -> str:
"""Returns a string with the prefix if it is not already set. """Returns a string with the task layer prefix if one is not already set.
Users can specify a prefix to live on all objects during the Prefix for assets is defined task_layer.json file within TASK_LAYER_TYPES
asset creation process. This prefix is stored in the scene. Will return early if any prefix is found, cannot replace existing prefixes.
Args: Args:
name (str): Name to add prefix to name (str): Name to add prefix to
task_layer_owner (str):
Returns: Returns:
str: Returns name with prefix str: Returns name with prefix
@ -152,13 +154,36 @@ def task_layer_prefix_name_get(name: str, task_layer_owner: str) -> str:
def task_layer_prefix_basename_get(name: str) -> str: def task_layer_prefix_basename_get(name: str) -> str:
"""Get the base of a name if it contains a task layer prefix.
This prefix is set on some transfer data items, this functions
removes the prefixes and returns the basename
Args:
name (str): Original name including prefix
Returns:
str: Returns name without task layer prefix
"""
for task_layer_key in config.TASK_LAYER_TYPES: for task_layer_key in config.TASK_LAYER_TYPES:
if name.startswith(config.TASK_LAYER_TYPES[task_layer_key] + "."): if name.startswith(config.TASK_LAYER_TYPES[task_layer_key] + "."):
return name.replace(name.split(".")[0], "")[1:] return name.replace(name.split(".")[0], "")[1:]
return name return name
def task_layer_prefix_transfer_data_update(transfer_data_item): def task_layer_prefix_transfer_data_update(
transfer_data_item: bpy.types.CollectionProperty,
) -> bool:
"""Task Layer Prefix can become out of date with the actual owner of the task layer.
This will update the existing prefixes on transfer_data_item so it can match the
owner of that transfer_data_item. Will update both the transfer_data_item.name and the
name of the actual data the transfer_data_item is referring to.
Args:
transfer_data_item (bpy.types.CollectionProperty): Transfer Data Item that is named with prefix
Returns:
bool: Returns True if a change to the name was completed
"""
prefix_types = [constants.MODIFIER_KEY, constants.CONSTRAINT_KEY] prefix_types = [constants.MODIFIER_KEY, constants.CONSTRAINT_KEY]
if transfer_data_item.type not in prefix_types: if transfer_data_item.type not in prefix_types:
return return