From baefa7f1eee04231f2ededc9a882330ee269fbaa Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Tue, 16 Jan 2024 10:47:29 -0500 Subject: [PATCH] Asset Pipeline: Make Parent Relationships Persistent --- .../asset_pipeline/merge/transfer_data/transfer_core.py | 9 ++------- .../merge/transfer_data/transfer_functions/parent.py | 7 ++----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_core.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_core.py index 9b17f0a0..05219a95 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_core.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_core.py @@ -18,9 +18,7 @@ from .transfer_util import ( ) -def copy_transfer_data_ownership( - transfer_data_item, target_obj: bpy.types.Object -) -> None: +def copy_transfer_data_ownership(transfer_data_item, target_obj: bpy.types.Object) -> None: """Copy Transferable Data item to object if non entry exists Args: @@ -67,7 +65,6 @@ def transfer_data_is_missing(transfer_data_item) -> bool: or constraints.constraint_is_missing(transfer_data_item) or shape_keys.shape_key_is_missing(transfer_data_item) or attributes.attribute_is_missing(transfer_data_item) - or parent.parent_is_missing(transfer_data_item) ) @@ -115,9 +112,7 @@ def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None: for name in transfer_data_map: temp_transfer_data = context.scene.asset_pipeline.temp_transfer_data transfer_data = transfer_data_map[name] - transfer_data_item = temp_transfer_data[ - transfer_data.get('transfer_data_item_index') - ] + transfer_data_item = temp_transfer_data[transfer_data.get('transfer_data_item_index')] target_obj = transfer_data.get('target_obj') source_obj = transfer_data.get('source_obj') if target_obj is None: diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/parent.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/parent.py index 98bb1abc..a94ad7ed 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/parent.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/parent.py @@ -33,11 +33,8 @@ def init_parent(scene, obj): name = constants.PARENT_TRANSFER_DATA_ITEM_NAME transfer_data = obj.transfer_data_ownership - # Only Execute if Material Slots exist on object - if obj.parent == None: - return - if obj.parent not in list(asset_pipe.asset_collection.all_objects): - raise Exception("Object parent cannot be outside of asset collection") + if obj.parent not in list(asset_pipe.asset_collection.all_objects) and obj.parent is not None: + raise Exception(f"Object parent {obj.parent.name} cannot be outside of asset collection") matches = check_transfer_data_entry(transfer_data, name, td_type_key) # Only add new ownership transfer_data_item if vertex group doesn't have an owner if len(matches) == 0: -- 2.30.2