Asset Pipeline v2 #145
@ -135,7 +135,7 @@ def get_name_with_asset_prefix(name: str) -> str:
|
|||||||
return prefix + name
|
return prefix + name
|
||||||
|
|
||||||
|
|
||||||
def get_name_with_task_layer_prefix(name: str, td_type_key: str) -> str:
|
def get_name_with_task_layer_prefix(name: str, task_layer_owner: str) -> str:
|
||||||
"""Returns a string with the prefix if it is not already set.
|
"""Returns a string with the 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.
|
||||||
@ -146,12 +146,10 @@ def get_name_with_task_layer_prefix(name: str, td_type_key: str) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Returns name with prefix
|
str: Returns name with prefix
|
||||||
"""
|
"""
|
||||||
default_task_layer = get_default_task_layer(td_type_key)
|
|
||||||
|
|
||||||
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
|
return name
|
||||||
prefix = config.TASK_LAYER_TYPES[default_task_layer]
|
prefix = config.TASK_LAYER_TYPES[task_layer_owner]
|
||||||
return prefix + "." + name
|
return prefix + "." + name
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,14 +103,15 @@ def modifier_is_missing(transfer_data_item):
|
|||||||
def init_modifiers(scene, obj, use_default_owner: bool):
|
def init_modifiers(scene, obj, use_default_owner: bool):
|
||||||
td_type_key = constants.MODIFIER_KEY
|
td_type_key = constants.MODIFIER_KEY
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
|
task_layer_owner = get_transfer_data_owner(td_type_key, use_default_owner)
|
||||||
for mod in obj.modifiers:
|
for mod in obj.modifiers:
|
||||||
mod.name = get_name_with_task_layer_prefix(mod.name, td_type_key)
|
mod.name = get_name_with_task_layer_prefix(mod.name, task_layer_owner)
|
||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, mod.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, mod.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
scene.asset_pipeline.add_temp_transfer_data(
|
||||||
name=mod.name,
|
name=mod.name,
|
||||||
owner=get_transfer_data_owner(td_type_key, use_default_owner),
|
owner=task_layer_owner,
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
)
|
)
|
||||||
@ -198,14 +199,15 @@ def constraint_is_missing(transfer_data_item):
|
|||||||
def init_constraints(scene, obj, use_default_owner: bool):
|
def init_constraints(scene, obj, use_default_owner: bool):
|
||||||
td_type_key = constants.CONSTRAINT_KEY
|
td_type_key = constants.CONSTRAINT_KEY
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
|
task_layer_owner = get_transfer_data_owner(td_type_key, use_default_owner)
|
||||||
for const in obj.constraints:
|
for const in obj.constraints:
|
||||||
const.name = get_name_with_task_layer_prefix(const.name, td_type_key)
|
const.name = get_name_with_task_layer_prefix(const.name, task_layer_owner)
|
||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, const.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, const.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
scene.asset_pipeline.add_temp_transfer_data(
|
||||||
name=const.name,
|
name=const.name,
|
||||||
owner=get_transfer_data_owner(td_type_key, use_default_owner),
|
owner=task_layer_owner,
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user