From d3e1c610eeeb9aa3cf53bc87e5cc77036d00b4f1 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Tue, 9 Apr 2024 14:26:35 -0400 Subject: [PATCH] Asset Pipeline: Remove Pointer Property from Temp Transfer Data --- scripts-blender/addons/asset_pipeline/merge/core.py | 3 ++- .../merge/transfer_data/transfer_functions/attributes.py | 2 +- .../merge/transfer_data/transfer_functions/constraints.py | 2 +- .../merge/transfer_data/transfer_functions/materials.py | 2 +- .../merge/transfer_data/transfer_functions/modifers.py | 2 +- .../merge/transfer_data/transfer_functions/parent.py | 3 +-- .../asset_pipeline/merge/transfer_data/transfer_util.py | 2 +- scripts-blender/addons/asset_pipeline/opscore.py | 7 +++++-- scripts-blender/addons/asset_pipeline/props.py | 8 ++++---- 9 files changed, 17 insertions(+), 14 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/merge/core.py b/scripts-blender/addons/asset_pipeline/merge/core.py index 70603083..99ec2f3b 100644 --- a/scripts-blender/addons/asset_pipeline/merge/core.py +++ b/scripts-blender/addons/asset_pipeline/merge/core.py @@ -98,7 +98,8 @@ def ownership_set(temp_transfer_data: bpy.types.CollectionProperty) -> None: data and the object that contains this data. """ for transfer_data_item in temp_transfer_data: - transfer_data = transfer_data_item.obj.transfer_data_ownership + obj = bpy.data.objects.get(transfer_data_item.obj_name) + transfer_data = obj.transfer_data_ownership transfer_data_add_entry( transfer_data, transfer_data_item.name, diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/attributes.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/attributes.py index 76d2ace1..e68b68c7 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/attributes.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/attributes.py @@ -79,7 +79,7 @@ def init_attributes(scene, obj): name=atttribute.name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/constraints.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/constraints.py index 52e27371..024c6257 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/constraints.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/constraints.py @@ -45,7 +45,7 @@ def init_constraints(scene, obj): name=const.name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/materials.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/materials.py index de9ae738..14acc95c 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/materials.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/materials.py @@ -63,7 +63,7 @@ def init_materials(scene, obj): name=name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/modifers.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/modifers.py index fe24df90..72446c73 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/modifers.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_functions/modifers.py @@ -47,7 +47,7 @@ def init_modifiers(scene, obj): name=mod.name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) 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 e8007d2d..bafe36de 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 @@ -5,7 +5,6 @@ from ...naming import merge_get_basename from .... import constants, logging - def parent_clean(obj): logger = logging.get_logger() matches = check_transfer_data_entry( @@ -48,7 +47,7 @@ def init_parent(scene, obj): name=name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) diff --git a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_util.py b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_util.py index 441d1320..8452ec2f 100644 --- a/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_util.py +++ b/scripts-blender/addons/asset_pipeline/merge/transfer_data/transfer_util.py @@ -122,6 +122,6 @@ def transfer_data_item_init( name=item.name, owner=task_layer_owner, type=td_type_key, - obj=obj, + obj_name=obj.name, surrender=auto_surrender, ) diff --git a/scripts-blender/addons/asset_pipeline/opscore.py b/scripts-blender/addons/asset_pipeline/opscore.py index 1152cbda..d8486252 100644 --- a/scripts-blender/addons/asset_pipeline/opscore.py +++ b/scripts-blender/addons/asset_pipeline/opscore.py @@ -78,7 +78,10 @@ def sync_draw(self, context): row = layout.row() row.prop(self, "expand", text="", icon="COLLAPSEMENU", toggle=False) row.label(text="Show New Transferable Data") - objs = [transfer_data_item.obj for transfer_data_item in self._temp_transfer_data] + objs = [ + bpy.data.objects.get(transfer_data_item.obj_name) + for transfer_data_item in self._temp_transfer_data + ] if not self.expand: return @@ -87,7 +90,7 @@ def sync_draw(self, context): obj_ownership = [ transfer_data_item for transfer_data_item in self._temp_transfer_data - if transfer_data_item.obj == obj + if bpy.data.objects.get(transfer_data_item.obj_name) == obj ] box = layout.box() box.label(text=obj.name, icon="OBJECT_DATA") diff --git a/scripts-blender/addons/asset_pipeline/props.py b/scripts-blender/addons/asset_pipeline/props.py index aae29b4a..5a112ebb 100644 --- a/scripts-blender/addons/asset_pipeline/props.py +++ b/scripts-blender/addons/asset_pipeline/props.py @@ -51,13 +51,13 @@ class AssetTransferDataTemp(bpy.types.PropertyGroup): """Class used when finding new ownership data so it can be drawn with the same method as the existing ownership data from ASSET_TRANSFER_DATA""" - owner: bpy.props.StringProperty(name="OwneAr", default="NONE") + owner: bpy.props.StringProperty(name="Owner", default="NONE") type: bpy.props.EnumProperty( name="Transferable Data Type", items=constants.TRANSFER_DATA_TYPES_ENUM_ITEMS, ) surrender: bpy.props.BoolProperty(name="Surrender Ownership", default=False) - obj: bpy.props.PointerProperty(type=bpy.types.Object) + obj_name: bpy.props.StringProperty(name="Object Name") class TaskLayerSettings(bpy.types.PropertyGroup): @@ -113,13 +113,13 @@ class AssetPipeline(bpy.types.PropertyGroup): temp_transfer_data: bpy.props.CollectionProperty(type=AssetTransferDataTemp) - def add_temp_transfer_data(self, name, owner, type, obj, surrender): + def add_temp_transfer_data(self, name, owner, type, obj_name, surrender): new_transfer_data = self.temp_transfer_data transfer_data_item = new_transfer_data.add() transfer_data_item.name = name transfer_data_item.owner = owner transfer_data_item.type = type - transfer_data_item.obj = obj + transfer_data_item.obj_name = obj_name transfer_data_item.surrender = surrender ## NEW FILE -- 2.30.2