Asset Pipeline: Use a weak ref for Asset Collection to improve performance #213
@ -68,12 +68,29 @@ class AssetPipeline(bpy.types.PropertyGroup):
|
|||||||
description="Depreciated files do not recieve any updates when syncing from a task layer",
|
description="Depreciated files do not recieve any updates when syncing from a task layer",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
asset_collection: bpy.props.PointerProperty(
|
|
||||||
type=bpy.types.Collection,
|
@property
|
||||||
|
def asset_collection(self):
|
||||||
|
return bpy.data.collections.get(self.asset_collection_name)
|
||||||
|
|
||||||
|
@asset_collection.setter
|
||||||
|
def asset_collection(self, coll):
|
||||||
|
self.asset_collection_name = coll.name
|
||||||
|
|
||||||
|
asset_collection_name: bpy.props.StringProperty(
|
||||||
name="Asset",
|
name="Asset",
|
||||||
|
default="",
|
||||||
description="Top Level Collection of the Asset, all other collections of the asset will be children of this collection",
|
description="Top Level Collection of the Asset, all other collections of the asset will be children of this collection",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Commented out - Let's use a weak ref for now because this causes the collection to evaluate even when hidden, causing performance nightmares
|
||||||
|
# asset_collection: bpy.props.PointerProperty(
|
||||||
|
# type=bpy.types.Collection,
|
||||||
|
# name="Asset",
|
||||||
|
# description="Top Level Collection of the Asset, all other collections of the
|
||||||
|
# asset will be children of this collection",
|
||||||
|
# )
|
||||||
|
|
||||||
temp_transfer_data: bpy.props.CollectionProperty(type=AssetTransferDataTemp)
|
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, surrender):
|
||||||
@ -102,9 +119,7 @@ class AssetPipeline(bpy.types.PropertyGroup):
|
|||||||
)
|
)
|
||||||
name: bpy.props.StringProperty(name="Name", description="Name for new Asset")
|
name: bpy.props.StringProperty(name="Name", description="Name for new Asset")
|
||||||
|
|
||||||
prefix: bpy.props.StringProperty(
|
prefix: bpy.props.StringProperty(name="Prefix", description="Prefix for new Asset", default="")
|
||||||
name="Prefix", description="Prefix for new Asset", default=""
|
|
||||||
)
|
|
||||||
|
|
||||||
task_layer_config_type: bpy.props.EnumProperty(
|
task_layer_config_type: bpy.props.EnumProperty(
|
||||||
name="Task Layer Preset",
|
name="Task Layer Preset",
|
||||||
@ -132,18 +147,12 @@ class AssetPipeline(bpy.types.PropertyGroup):
|
|||||||
# UI BOOLS: used to show/hide Transferable Data elements
|
# UI BOOLS: used to show/hide Transferable Data elements
|
||||||
# The names are also hard coded in constants.py under TRANSFER_DATA_TYPES
|
# The names are also hard coded in constants.py under TRANSFER_DATA_TYPES
|
||||||
# any changes will need to be reflected both here and in that enum
|
# any changes will need to be reflected both here and in that enum
|
||||||
group_vertex_ui_bool: bpy.props.BoolProperty(
|
group_vertex_ui_bool: bpy.props.BoolProperty(name="Show/Hide Vertex Groups", default=False)
|
||||||
name="Show/Hide Vertex Groups", default=False
|
|
||||||
)
|
|
||||||
modifier_ui_bool: bpy.props.BoolProperty(name="Show/Hide Modifiers", default=False)
|
modifier_ui_bool: bpy.props.BoolProperty(name="Show/Hide Modifiers", default=False)
|
||||||
constraint_ui_bool: bpy.props.BoolProperty(
|
constraint_ui_bool: bpy.props.BoolProperty(name="Show/Hide Constraints", default=False)
|
||||||
name="Show/Hide Constraints", default=False
|
|
||||||
)
|
|
||||||
material_ui_bool: bpy.props.BoolProperty(name="Show/Hide Materials", default=False)
|
material_ui_bool: bpy.props.BoolProperty(name="Show/Hide Materials", default=False)
|
||||||
shapekey_ui_bool: bpy.props.BoolProperty(name="Show/Hide Shape Keys", default=False)
|
shapekey_ui_bool: bpy.props.BoolProperty(name="Show/Hide Shape Keys", default=False)
|
||||||
attribute_ui_bool: bpy.props.BoolProperty(
|
attribute_ui_bool: bpy.props.BoolProperty(name="Show/Hide Attributes", default=False)
|
||||||
name="Show/Hide Attributes", default=False
|
|
||||||
)
|
|
||||||
file_parent_ui_bool: bpy.props.BoolProperty(name="Show/Hide Parent", default=False)
|
file_parent_ui_bool: bpy.props.BoolProperty(name="Show/Hide Parent", default=False)
|
||||||
|
|
||||||
def get_asset_catalogs(self, context):
|
def get_asset_catalogs(self, context):
|
||||||
@ -167,9 +176,7 @@ classes = (
|
|||||||
def register():
|
def register():
|
||||||
for i in classes:
|
for i in classes:
|
||||||
bpy.utils.register_class(i)
|
bpy.utils.register_class(i)
|
||||||
bpy.types.Object.transfer_data_ownership = bpy.props.CollectionProperty(
|
bpy.types.Object.transfer_data_ownership = bpy.props.CollectionProperty(type=AssetTransferData)
|
||||||
type=AssetTransferData
|
|
||||||
)
|
|
||||||
bpy.types.Scene.asset_pipeline = bpy.props.PointerProperty(type=AssetPipeline)
|
bpy.types.Scene.asset_pipeline = bpy.props.PointerProperty(type=AssetPipeline)
|
||||||
bpy.types.ID.asset_id_owner = bpy.props.StringProperty(name="Owner", default="NONE")
|
bpy.types.ID.asset_id_owner = bpy.props.StringProperty(name="Owner", default="NONE")
|
||||||
bpy.types.ID.asset_id_surrender = bpy.props.BoolProperty(
|
bpy.types.ID.asset_id_surrender = bpy.props.BoolProperty(
|
||||||
|
@ -26,7 +26,7 @@ class ASSETPIPE_PT_sync(bpy.types.Panel):
|
|||||||
layout.prop(asset_pipe, "prefix")
|
layout.prop(asset_pipe, "prefix")
|
||||||
layout.prop(asset_pipe, "dir")
|
layout.prop(asset_pipe, "dir")
|
||||||
else:
|
else:
|
||||||
layout.prop(asset_pipe, "asset_collection")
|
layout.prop_search(asset_pipe, 'asset_collection_name', bpy.data, 'collections')
|
||||||
layout.operator("assetpipe.create_new_asset")
|
layout.operator("assetpipe.create_new_asset")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class ASSETPIPE_PT_sync(bpy.types.Panel):
|
|||||||
for task_layer in asset_pipe.local_task_layers:
|
for task_layer in asset_pipe.local_task_layers:
|
||||||
row.label(text=task_layer.name)
|
row.label(text=task_layer.name)
|
||||||
|
|
||||||
layout.prop(asset_pipe, "asset_collection")
|
layout.prop_search(asset_pipe, 'asset_collection_name', bpy.data, 'collections')
|
||||||
|
|
||||||
staged = is_staged_publish(Path(bpy.data.filepath))
|
staged = is_staged_publish(Path(bpy.data.filepath))
|
||||||
sync_target_name = "Staged" if staged else "Active"
|
sync_target_name = "Staged" if staged else "Active"
|
||||||
|
Loading…
Reference in New Issue
Block a user