Asset Pipeline: Remove Pointer Property from Temp Transfer Data #282

Merged
Simon Thommes merged 1 commits from TinyNick/blender-studio-pipeline:fix/remove-object-pointer into main 2024-04-10 12:52:39 +02:00
9 changed files with 17 additions and 14 deletions
Showing only changes of commit d3e1c610ee - Show all commits

View File

@ -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,

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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")

View File

@ -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