Asset Pipeline v2 #145
@ -1,5 +1,5 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from .transfer_data import transfer_core, transfer_functions
|
from .transfer_data import transfer_core
|
||||||
|
|
||||||
from . import asset_suffix
|
from . import asset_suffix
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -12,7 +12,6 @@ from . import constants
|
|||||||
def ownership_transfer_data_cleanup(
|
def ownership_transfer_data_cleanup(
|
||||||
obj: bpy.types.Object, task_layer_name: str
|
obj: bpy.types.Object, task_layer_name: str
|
||||||
) -> None:
|
) -> None:
|
||||||
# TODO MOVE TRANSFER DATA SPECIFIC STUFF TO TRANSFER CORE
|
|
||||||
"""Remove Transfer Data ownership items if the corrisponding data is missing
|
"""Remove Transfer Data ownership items if the corrisponding data is missing
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -23,12 +22,7 @@ def ownership_transfer_data_cleanup(
|
|||||||
to_remove = []
|
to_remove = []
|
||||||
for item in ownership:
|
for item in ownership:
|
||||||
if constants.TASK_LAYER_KEYS[item["owner"]] == task_layer_name:
|
if constants.TASK_LAYER_KEYS[item["owner"]] == task_layer_name:
|
||||||
if (
|
if transfer_core.transfer_data_is_missing(item):
|
||||||
transfer_functions.vertex_group_is_missing(item)
|
|
||||||
or transfer_functions.modifiers_is_missing(item)
|
|
||||||
or transfer_functions.material_slot_is_missing(item)
|
|
||||||
or transfer_functions.constraints_is_missing(item)
|
|
||||||
):
|
|
||||||
to_remove.append(item.name)
|
to_remove.append(item.name)
|
||||||
|
|
||||||
for name in to_remove:
|
for name in to_remove:
|
||||||
@ -40,7 +34,6 @@ def ownership_get(
|
|||||||
task_layer_name: str,
|
task_layer_name: str,
|
||||||
temp_transfer_data: bpy.types.CollectionProperty,
|
temp_transfer_data: bpy.types.CollectionProperty,
|
||||||
) -> list[bpy.types.Object]:
|
) -> list[bpy.types.Object]:
|
||||||
# TODO MOVE TRANSFER DATA SPECIFIC STUFF TO TRANSFER CORE
|
|
||||||
"""Find new transfer data owned by the local task layer.
|
"""Find new transfer data owned by the local task layer.
|
||||||
Marks items as owned by the local task layer if they are in the
|
Marks items as owned by the local task layer if they are in the
|
||||||
corrisponding task layer collection and have no owner.
|
corrisponding task layer collection and have no owner.
|
||||||
@ -69,10 +62,7 @@ def ownership_get(
|
|||||||
invalid_objs.append(obj)
|
invalid_objs.append(obj)
|
||||||
continue
|
continue
|
||||||
ownership_transfer_data_cleanup(obj, task_layer_name)
|
ownership_transfer_data_cleanup(obj, task_layer_name)
|
||||||
transfer_functions.get_vertex_groups(obj, task_layer_name, temp_transfer_data)
|
transfer_core.get_transfer_data(obj, task_layer_name, temp_transfer_data)
|
||||||
transfer_functions.get_material_slots(obj, task_layer_name, temp_transfer_data)
|
|
||||||
transfer_functions.get_modifiers(obj, task_layer_name, temp_transfer_data)
|
|
||||||
transfer_functions.get_constraints(obj, task_layer_name, temp_transfer_data)
|
|
||||||
|
|
||||||
return invalid_objs
|
return invalid_objs
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ def copy_transfer_data_ownership(
|
|||||||
"""Copy transfer data item to object if non entry exists
|
"""Copy transfer data item to object if non entry exists
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
transfer_data_item (_type_): Item of bpy.types.CollectionProperty from source object
|
transfer_data_item: Item of bpy.types.CollectionProperty from source object
|
||||||
target_obj (bpy.types.Object): Object to add transfer data item to
|
target_obj (bpy.types.Object): Object to add transfer data item to
|
||||||
"""
|
"""
|
||||||
ownership = target_obj.transfer_data_ownership
|
ownership = target_obj.transfer_data_ownership
|
||||||
@ -24,6 +24,37 @@ def copy_transfer_data_ownership(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def transfer_data_is_missing(transfer_data_item) -> bool:
|
||||||
|
"""Check if Transfer Data item is missing
|
||||||
|
|
||||||
|
Args:
|
||||||
|
transfer_data_item: Item of class ASSET_TRANSFER_DATA
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: bool if item is missing
|
||||||
|
"""
|
||||||
|
return bool(
|
||||||
|
transfer_functions.vertex_group_is_missing(transfer_data_item)
|
||||||
|
or transfer_functions.modifiers_is_missing(transfer_data_item)
|
||||||
|
or transfer_functions.material_slot_is_missing(transfer_data_item)
|
||||||
|
or transfer_functions.constraints_is_missing(transfer_data_item)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_transfer_data(obj: bpy.types.Object, task_layer_name: str, temp_transfer_data):
|
||||||
|
"""Collect Transfer Data Items on a given object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (bpy.types.Object): Target object for transfer data
|
||||||
|
task_layer_name (str): Name of task layer
|
||||||
|
temp_transfer_data: Item of class ASSET_TRANSFER_DATA_TEMP
|
||||||
|
"""
|
||||||
|
transfer_functions.get_vertex_groups(obj, task_layer_name, temp_transfer_data)
|
||||||
|
transfer_functions.get_material_slots(obj, task_layer_name, temp_transfer_data)
|
||||||
|
transfer_functions.get_modifiers(obj, task_layer_name, temp_transfer_data)
|
||||||
|
transfer_functions.get_constraints(obj, task_layer_name, temp_transfer_data)
|
||||||
|
|
||||||
|
|
||||||
def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:
|
def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:
|
||||||
"""Apply all transfer data from transfer data map onto objects.
|
"""Apply all transfer data from transfer data map onto objects.
|
||||||
Copies any transfer data owned by local layer onto objects owned by external layers.
|
Copies any transfer data owned by local layer onto objects owned by external layers.
|
||||||
|
Loading…
Reference in New Issue
Block a user