Asset Pipeline v2 #145
@ -17,14 +17,13 @@ from .naming import (
|
|||||||
get_id_type_name,
|
get_id_type_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .task_layer import get_local_task_layers
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from .. import constants
|
from .. import constants
|
||||||
|
|
||||||
|
|
||||||
def ownership_transfer_data_cleanup(
|
def ownership_transfer_data_cleanup(
|
||||||
|
asset_pipe: 'bpy.types.AssetPipeline',
|
||||||
obj: bpy.types.Object,
|
obj: bpy.types.Object,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Remove Transfer Data ownership items if the corrisponding data is missing
|
"""Remove Transfer Data ownership items if the corrisponding data is missing
|
||||||
@ -32,7 +31,7 @@ def ownership_transfer_data_cleanup(
|
|||||||
Args:
|
Args:
|
||||||
obj (bpy.types.Object): Object that contains the transfer data
|
obj (bpy.types.Object): Object that contains the transfer data
|
||||||
"""
|
"""
|
||||||
local_task_layer_keys = get_local_task_layers()
|
local_task_layer_keys = asset_pipe.get_local_task_layers()
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
to_remove = []
|
to_remove = []
|
||||||
for transfer_data_item in transfer_data:
|
for transfer_data_item in transfer_data:
|
||||||
@ -65,13 +64,13 @@ def ownership_get(
|
|||||||
asset_pipe = scene.asset_pipeline
|
asset_pipe = scene.asset_pipeline
|
||||||
asset_pipe.temp_transfer_data.clear()
|
asset_pipe.temp_transfer_data.clear()
|
||||||
|
|
||||||
default_task_layer = get_local_task_layers()[0]
|
default_task_layer = asset_pipe.get_local_task_layers()[0]
|
||||||
|
|
||||||
for col in asset_pipe.asset_collection.children:
|
for col in asset_pipe.asset_collection.children:
|
||||||
if col.asset_id_owner == "NONE":
|
if col.asset_id_owner == "NONE":
|
||||||
col.asset_id_owner = default_task_layer
|
col.asset_id_owner = default_task_layer
|
||||||
|
|
||||||
task_layer_objs = get_task_layer_objects()
|
task_layer_objs = get_task_layer_objects(asset_pipe)
|
||||||
|
|
||||||
for obj in local_col.all_objects:
|
for obj in local_col.all_objects:
|
||||||
# TODO REPLACE This is expensive to loop over everything again
|
# TODO REPLACE This is expensive to loop over everything again
|
||||||
@ -87,7 +86,7 @@ def ownership_get(
|
|||||||
# Skip items that have no owner
|
# Skip items that have no owner
|
||||||
if obj.asset_id_owner == "NONE":
|
if obj.asset_id_owner == "NONE":
|
||||||
continue
|
continue
|
||||||
ownership_transfer_data_cleanup(obj)
|
ownership_transfer_data_cleanup(asset_pipe, obj)
|
||||||
init_transfer_data(scene, obj)
|
init_transfer_data(scene, obj)
|
||||||
|
|
||||||
|
|
||||||
@ -111,6 +110,7 @@ def ownership_set(temp_transfer_data: bpy.types.CollectionProperty) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def get_invalid_objects(
|
def get_invalid_objects(
|
||||||
|
asset_pipe: 'bpy.types.AssetPipeline',
|
||||||
local_col: bpy.types.Collection,
|
local_col: bpy.types.Collection,
|
||||||
) -> list[bpy.types.Object]:
|
) -> list[bpy.types.Object]:
|
||||||
"""Returns a list of objects not used in the merge processing,
|
"""Returns a list of objects not used in the merge processing,
|
||||||
@ -124,8 +124,8 @@ def get_invalid_objects(
|
|||||||
Returns:
|
Returns:
|
||||||
list[bpy.types.Object]: List of Invalid Objects
|
list[bpy.types.Object]: List of Invalid Objects
|
||||||
"""
|
"""
|
||||||
local_task_layer_keys = get_local_task_layers()
|
local_task_layer_keys = asset_pipe.get_local_task_layers()
|
||||||
task_layer_objs = get_task_layer_objects()
|
task_layer_objs = get_task_layer_objects(asset_pipe)
|
||||||
|
|
||||||
invalid_obj = []
|
invalid_obj = []
|
||||||
for obj in local_col.all_objects:
|
for obj in local_col.all_objects:
|
||||||
@ -286,9 +286,8 @@ def import_data_from_lib(
|
|||||||
return eval(f"bpy.data.{data_category}['{data_name}']")
|
return eval(f"bpy.data.{data_category}['{data_name}']")
|
||||||
|
|
||||||
|
|
||||||
def get_task_layer_objects():
|
def get_task_layer_objects(asset_pipe):
|
||||||
asset_pipe = bpy.context.scene.asset_pipeline
|
local_task_layer_keys = asset_pipe.get_local_task_layers()
|
||||||
local_task_layer_keys = get_local_task_layers()
|
|
||||||
local_col = asset_pipe.asset_collection
|
local_col = asset_pipe.asset_collection
|
||||||
task_layer_objs = []
|
task_layer_objs = []
|
||||||
for col in local_col.children:
|
for col in local_col.children:
|
||||||
|
@ -2,7 +2,6 @@ import bpy
|
|||||||
from bpy_extras.id_map_utils import get_id_reference_map, get_all_referenced_ids
|
from bpy_extras.id_map_utils import get_id_reference_map, get_all_referenced_ids
|
||||||
from .util import get_fundamental_id_type
|
from .util import get_fundamental_id_type
|
||||||
from .. import constants
|
from .. import constants
|
||||||
from .task_layer import get_local_task_layers
|
|
||||||
|
|
||||||
|
|
||||||
def get_shared_ids(collection: bpy.types.Collection) -> list[bpy.types.ID]:
|
def get_shared_ids(collection: bpy.types.Collection) -> list[bpy.types.ID]:
|
||||||
@ -33,9 +32,9 @@ def init_shared_ids(scene: bpy.types.Scene) -> list[bpy.types.ID]:
|
|||||||
Returns:
|
Returns:
|
||||||
list[bpy.types.ID]: A list of new 'shared_ids' owned by the file's task layer
|
list[bpy.types.ID]: A list of new 'shared_ids' owned by the file's task layer
|
||||||
"""
|
"""
|
||||||
task_layer_key = get_local_task_layers()[0]
|
|
||||||
shared_ids = []
|
|
||||||
asset_pipe = scene.asset_pipeline
|
asset_pipe = scene.asset_pipeline
|
||||||
|
task_layer_key = asset_pipe.get_local_task_layers()[0]
|
||||||
|
shared_ids = []
|
||||||
local_col = asset_pipe.asset_collection
|
local_col = asset_pipe.asset_collection
|
||||||
for id in get_shared_ids(local_col):
|
for id in get_shared_ids(local_col):
|
||||||
if id.asset_id_owner == 'NONE':
|
if id.asset_id_owner == 'NONE':
|
||||||
|
@ -4,11 +4,6 @@ from .. import constants
|
|||||||
from .. import config
|
from .. import config
|
||||||
|
|
||||||
|
|
||||||
def get_local_task_layers():
|
|
||||||
local_task_layers = bpy.context.scene.asset_pipeline.local_task_layers
|
|
||||||
return [task_layer.name for task_layer in local_task_layers]
|
|
||||||
|
|
||||||
|
|
||||||
def get_default_task_layer(td_type: str, name=""):
|
def get_default_task_layer(td_type: str, name=""):
|
||||||
if td_type == constants.ATTRIBUTE_KEY:
|
if td_type == constants.ATTRIBUTE_KEY:
|
||||||
if name in config.DEFAULT_OWNERSHIP_ATTRIBUTES:
|
if name in config.DEFAULT_OWNERSHIP_ATTRIBUTES:
|
||||||
@ -16,15 +11,20 @@ def get_default_task_layer(td_type: str, name=""):
|
|||||||
return config.DEFAULT_OWNERSHIP[td_type]
|
return config.DEFAULT_OWNERSHIP[td_type]
|
||||||
|
|
||||||
|
|
||||||
def get_transfer_data_owner(td_type_key: str, use_default_owner: bool, name=""):
|
def get_transfer_data_owner(
|
||||||
|
asset_pipe: 'bpy.types.AssetPipeline',
|
||||||
|
td_type_key: str,
|
||||||
|
use_default_owner: bool,
|
||||||
|
name="",
|
||||||
|
):
|
||||||
default_tl = get_default_task_layer(td_type_key, name)
|
default_tl = get_default_task_layer(td_type_key, name)
|
||||||
if use_default_owner:
|
if use_default_owner:
|
||||||
return default_tl
|
return default_tl
|
||||||
else:
|
else:
|
||||||
if default_tl in get_local_task_layers():
|
if default_tl in asset_pipe.get_local_task_layers():
|
||||||
return default_tl
|
return default_tl
|
||||||
else:
|
else:
|
||||||
return get_local_task_layers()[0]
|
return asset_pipe.get_local_task_layers()[0]
|
||||||
|
|
||||||
|
|
||||||
def draw_task_layer_selection(
|
def draw_task_layer_selection(
|
||||||
|
@ -9,8 +9,6 @@ from .transfer_util import (
|
|||||||
check_transfer_data_entry,
|
check_transfer_data_entry,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..task_layer import get_local_task_layers
|
|
||||||
|
|
||||||
|
|
||||||
def copy_transfer_data_ownership(
|
def copy_transfer_data_ownership(
|
||||||
transfer_data_item, target_obj: bpy.types.Object
|
transfer_data_item, target_obj: bpy.types.Object
|
||||||
|
@ -222,15 +222,18 @@ def modifier_is_missing(transfer_data_item):
|
|||||||
|
|
||||||
|
|
||||||
def init_modifiers(scene, obj, use_default_owner: bool):
|
def init_modifiers(scene, obj, use_default_owner: bool):
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
td_type_key = constants.MODIFIER_KEY
|
td_type_key = constants.MODIFIER_KEY
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
task_layer_owner = get_transfer_data_owner(td_type_key, use_default_owner)
|
task_layer_owner = get_transfer_data_owner(
|
||||||
|
asset_pipe, td_type_key, use_default_owner
|
||||||
|
)
|
||||||
for mod in obj.modifiers:
|
for mod in obj.modifiers:
|
||||||
mod.name = task_layer_prefix_name_get(mod.name, task_layer_owner)
|
mod.name = task_layer_prefix_name_get(mod.name, task_layer_owner)
|
||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, mod.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, mod.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=mod.name,
|
name=mod.name,
|
||||||
owner=task_layer_owner,
|
owner=task_layer_owner,
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
@ -321,13 +324,16 @@ def constraint_is_missing(transfer_data_item):
|
|||||||
def init_constraints(scene, obj, use_default_owner: bool):
|
def init_constraints(scene, obj, use_default_owner: bool):
|
||||||
td_type_key = constants.CONSTRAINT_KEY
|
td_type_key = constants.CONSTRAINT_KEY
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
task_layer_owner = get_transfer_data_owner(td_type_key, use_default_owner)
|
asset_pipe = scene.asset_pipeline
|
||||||
|
task_layer_owner = get_transfer_data_owner(
|
||||||
|
asset_pipe, td_type_key, use_default_owner
|
||||||
|
)
|
||||||
for const in obj.constraints:
|
for const in obj.constraints:
|
||||||
const.name = task_layer_prefix_name_get(const.name, task_layer_owner)
|
const.name = task_layer_prefix_name_get(const.name, task_layer_owner)
|
||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, const.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, const.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=const.name,
|
name=const.name,
|
||||||
owner=task_layer_owner,
|
owner=task_layer_owner,
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
@ -412,6 +418,7 @@ def material_slots_is_missing(transfer_data_item):
|
|||||||
|
|
||||||
|
|
||||||
def init_material_slots(scene, obj, use_default_owner: bool):
|
def init_material_slots(scene, obj, use_default_owner: bool):
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
td_type_key = constants.MATERIAL_SLOT_KEY
|
td_type_key = constants.MATERIAL_SLOT_KEY
|
||||||
name = constants.MATERIAL_TRANSFER_DATA_ITEM_NAME
|
name = constants.MATERIAL_TRANSFER_DATA_ITEM_NAME
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
@ -432,9 +439,9 @@ def init_material_slots(scene, obj, use_default_owner: bool):
|
|||||||
matches = check_transfer_data_entry(transfer_data, name, td_type_key)
|
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
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=name,
|
name=name,
|
||||||
owner=get_transfer_data_owner(td_type_key, use_default_owner),
|
owner=get_transfer_data_owner(asset_pipe, td_type_key, use_default_owner),
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
use_default_owner=use_default_owner,
|
use_default_owner=use_default_owner,
|
||||||
@ -689,6 +696,7 @@ def attribute_is_missing(transfer_data_item):
|
|||||||
|
|
||||||
|
|
||||||
def init_attributes(scene, obj, use_default_owner: bool):
|
def init_attributes(scene, obj, use_default_owner: bool):
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
if obj.type != "MESH":
|
if obj.type != "MESH":
|
||||||
return
|
return
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
@ -697,10 +705,10 @@ def init_attributes(scene, obj, use_default_owner: bool):
|
|||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, atttribute.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, atttribute.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=atttribute.name,
|
name=atttribute.name,
|
||||||
owner=get_transfer_data_owner(
|
owner=get_transfer_data_owner(
|
||||||
td_type_key, use_default_owner, atttribute.name
|
asset_pipe, td_type_key, use_default_owner, atttribute.name
|
||||||
),
|
),
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
@ -761,6 +769,7 @@ def parent_is_missing(transfer_data_item):
|
|||||||
|
|
||||||
|
|
||||||
def init_parent(scene, obj, use_default_owner: bool):
|
def init_parent(scene, obj, use_default_owner: bool):
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
td_type_key = constants.PARENT_KEY
|
td_type_key = constants.PARENT_KEY
|
||||||
name = constants.PARENT_TRANSFER_DATA_ITEM_NAME
|
name = constants.PARENT_TRANSFER_DATA_ITEM_NAME
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
@ -771,9 +780,9 @@ def init_parent(scene, obj, use_default_owner: bool):
|
|||||||
matches = check_transfer_data_entry(transfer_data, name, td_type_key)
|
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
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=name,
|
name=name,
|
||||||
owner=get_transfer_data_owner(td_type_key, use_default_owner),
|
owner=get_transfer_data_owner(asset_pipe, td_type_key, use_default_owner),
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
use_default_owner=use_default_owner,
|
use_default_owner=use_default_owner,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from ... import constants
|
from ... import constants
|
||||||
from ..task_layer import draw_task_layer_selection, get_local_task_layers
|
from ..task_layer import draw_task_layer_selection
|
||||||
|
|
||||||
|
|
||||||
def draw_transfer_data_type(
|
def draw_transfer_data_type(
|
||||||
@ -30,7 +30,9 @@ def draw_transfer_data_type(
|
|||||||
|
|
||||||
if transfer_data_item.get("surrender"):
|
if transfer_data_item.get("surrender"):
|
||||||
enabled = (
|
enabled = (
|
||||||
False if transfer_data_item.owner in get_local_task_layers() else True
|
False
|
||||||
|
if transfer_data_item.owner in asset_pipe.get_local_task_layers()
|
||||||
|
else True
|
||||||
)
|
)
|
||||||
row.operator(
|
row.operator(
|
||||||
"assetpipe.update_surrendered_transfer_data"
|
"assetpipe.update_surrendered_transfer_data"
|
||||||
|
@ -104,15 +104,18 @@ def transfer_data_item_init(
|
|||||||
data_list (bpy.types.CollectionProperty): Collection Property containing a type of possible transfer data e.g. obj.modifiers
|
data_list (bpy.types.CollectionProperty): Collection Property containing a type of possible transfer data e.g. obj.modifiers
|
||||||
td_type_key (str): Key for the transfer data type
|
td_type_key (str): Key for the transfer data type
|
||||||
"""
|
"""
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
|
|
||||||
for item in data_list:
|
for item in data_list:
|
||||||
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
# Only add new ownership transfer_data_item if vertex group doesn't have an owner
|
||||||
matches = check_transfer_data_entry(transfer_data, item.name, td_type_key)
|
matches = check_transfer_data_entry(transfer_data, item.name, td_type_key)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_transfer_data(
|
asset_pipe.add_temp_transfer_data(
|
||||||
name=item.name,
|
name=item.name,
|
||||||
owner=get_transfer_data_owner(td_type_key, use_default_owner),
|
owner=get_transfer_data_owner(
|
||||||
|
asset_pipe, td_type_key, use_default_owner
|
||||||
|
),
|
||||||
type=td_type_key,
|
type=td_type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
use_default_owner=use_default_owner,
|
use_default_owner=use_default_owner,
|
||||||
|
@ -5,7 +5,6 @@ from pathlib import Path
|
|||||||
from .merge.naming import task_layer_prefix_transfer_data_update
|
from .merge.naming import task_layer_prefix_transfer_data_update
|
||||||
from .merge.task_layer import (
|
from .merge.task_layer import (
|
||||||
draw_task_layer_selection,
|
draw_task_layer_selection,
|
||||||
get_local_task_layers,
|
|
||||||
)
|
)
|
||||||
from .merge.publish import get_next_published_file, find_all_published
|
from .merge.publish import get_next_published_file, find_all_published
|
||||||
from .images import save_images
|
from .images import save_images
|
||||||
@ -692,6 +691,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
return [item for item in unfiltered_list if self.name_filter in item.name]
|
return [item for item in unfiltered_list if self.name_filter in item.name]
|
||||||
|
|
||||||
def _get_transfer_data_to_update(self, context):
|
def _get_transfer_data_to_update(self, context):
|
||||||
|
asset_pipe = context.scene.asset_pipeline
|
||||||
objs = self._get_objects(context)
|
objs = self._get_objects(context)
|
||||||
transfer_data_items_to_update = []
|
transfer_data_items_to_update = []
|
||||||
if self.data_type == "TRANSFER_DATA":
|
if self.data_type == "TRANSFER_DATA":
|
||||||
@ -709,7 +709,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
return [
|
return [
|
||||||
item
|
item
|
||||||
for item in transfer_data_items_to_update
|
for item in transfer_data_items_to_update
|
||||||
if item.owner in get_local_task_layers()
|
if item.owner in asset_pipe.get_local_task_layers()
|
||||||
]
|
]
|
||||||
return transfer_data_items_to_update
|
return transfer_data_items_to_update
|
||||||
|
|
||||||
@ -721,12 +721,13 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
return asset_objs if self.data_source == "ALL" else selected_asset_objs
|
return asset_objs if self.data_source == "ALL" else selected_asset_objs
|
||||||
|
|
||||||
def _get_filtered_objects(self, context):
|
def _get_filtered_objects(self, context):
|
||||||
|
asset_pipe = context.scene.asset_pipeline
|
||||||
objs = self._get_objects(context)
|
objs = self._get_objects(context)
|
||||||
if self.filter_owners == "LOCAL" and self.data_type == "OBJECT":
|
if self.filter_owners == "LOCAL" and self.data_type == "OBJECT":
|
||||||
return [
|
return [
|
||||||
item
|
item
|
||||||
for item in self._filter_by_name(context, objs)
|
for item in self._filter_by_name(context, objs)
|
||||||
if item.asset_id_owner in get_local_task_layers()
|
if item.asset_id_owner in asset_pipe.get_local_task_layers()
|
||||||
]
|
]
|
||||||
if self.filter_owners == "OWNED" and self.data_type == "OBJECT":
|
if self.filter_owners == "OWNED" and self.data_type == "OBJECT":
|
||||||
return [
|
return [
|
||||||
@ -803,6 +804,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
bottom_label_split.label(text=f"Change Ownership on {length} {data_type_name}")
|
bottom_label_split.label(text=f"Change Ownership on {length} {data_type_name}")
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context):
|
def execute(self, context: bpy.types.Context):
|
||||||
|
asset_pipe = context.scene.asset_pipeline
|
||||||
objs = self._get_filtered_objects(context)
|
objs = self._get_filtered_objects(context)
|
||||||
|
|
||||||
if self.data_type == "OBJECT":
|
if self.data_type == "OBJECT":
|
||||||
@ -813,7 +815,10 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
|
|
||||||
for transfer_data_item_to_update in transfer_data_items_to_update:
|
for transfer_data_item_to_update in transfer_data_items_to_update:
|
||||||
if self.surrender_selection:
|
if self.surrender_selection:
|
||||||
if transfer_data_item_to_update.owner in get_local_task_layers():
|
if (
|
||||||
|
transfer_data_item_to_update.owner
|
||||||
|
in asset_pipe.get_local_task_layers()
|
||||||
|
):
|
||||||
transfer_data_item_to_update.surrender = True
|
transfer_data_item_to_update.surrender = True
|
||||||
continue
|
continue
|
||||||
transfer_data_item_to_update.owner = self.owner_selection
|
transfer_data_item_to_update.owner = self.owner_selection
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from typing import List
|
from typing import List
|
||||||
from . import constants
|
from . import constants
|
||||||
from .merge.task_layer import get_local_task_layers
|
|
||||||
from .config import get_task_layer_presets_path
|
from .config import get_task_layer_presets_path
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from .prefs import get_addon_prefs
|
from .prefs import get_addon_prefs
|
||||||
@ -130,6 +129,9 @@ class AssetPipeline(bpy.types.PropertyGroup):
|
|||||||
new_local_task_layer = self.local_task_layers.add()
|
new_local_task_layer = self.local_task_layers.add()
|
||||||
new_local_task_layer.name = task_layer.name
|
new_local_task_layer.name = task_layer.name
|
||||||
|
|
||||||
|
def get_local_task_layers(self):
|
||||||
|
return [task_layer.name for task_layer in self.local_task_layers]
|
||||||
|
|
||||||
# UI BOOLS: used to show/hide transfer data elements
|
# UI BOOLS: used to show/hide transfer 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
|
||||||
|
@ -15,7 +15,6 @@ from .merge.transfer_data.transfer_ui import draw_transfer_data
|
|||||||
from .merge.shared_ids import get_shared_id_icon
|
from .merge.shared_ids import get_shared_id_icon
|
||||||
from . import constants
|
from . import constants
|
||||||
from . import config
|
from . import config
|
||||||
from .merge.task_layer import get_local_task_layers
|
|
||||||
|
|
||||||
|
|
||||||
def sync_poll(cls, context):
|
def sync_poll(cls, context):
|
||||||
@ -33,7 +32,8 @@ def sync_invoke(self, context):
|
|||||||
self._temp_transfer_data.clear()
|
self._temp_transfer_data.clear()
|
||||||
self._invalid_objs.clear()
|
self._invalid_objs.clear()
|
||||||
|
|
||||||
local_col = context.scene.asset_pipeline.asset_collection
|
asset_pipe = context.scene.asset_pipeline
|
||||||
|
local_col = asset_pipe.asset_collection
|
||||||
if not local_col:
|
if not local_col:
|
||||||
self.report({'ERROR'}, "Top level collection could not be found")
|
self.report({'ERROR'}, "Top level collection could not be found")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
@ -45,7 +45,7 @@ def sync_invoke(self, context):
|
|||||||
|
|
||||||
ownership_get(local_col, context.scene)
|
ownership_get(local_col, context.scene)
|
||||||
|
|
||||||
self._invalid_objs = get_invalid_objects(local_col)
|
self._invalid_objs = get_invalid_objects(asset_pipe, local_col)
|
||||||
self._shared_ids = init_shared_ids(context.scene)
|
self._shared_ids = init_shared_ids(context.scene)
|
||||||
|
|
||||||
|
|
||||||
@ -95,9 +95,10 @@ def sync_execute_update_ownership(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def sync_execute_prepare_sync(self, context):
|
def sync_execute_prepare_sync(self, context):
|
||||||
|
asset_pipe = context.scene.asset_pipeline
|
||||||
self._current_file = Path(bpy.data.filepath)
|
self._current_file = Path(bpy.data.filepath)
|
||||||
self._temp_dir = Path(bpy.app.tempdir).parent
|
self._temp_dir = Path(bpy.app.tempdir).parent
|
||||||
self._task_layer_keys = get_local_task_layers()
|
self._task_layer_keys = asset_pipe.get_local_task_layers()
|
||||||
# TODO Check if file contains a valid task layer
|
# TODO Check if file contains a valid task layer
|
||||||
# if self._task_layer_key == "NONE":
|
# if self._task_layer_key == "NONE":
|
||||||
# self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
# self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||||
|
@ -5,7 +5,6 @@ from .merge.transfer_data.transfer_ui import draw_transfer_data
|
|||||||
from .merge.task_layer import draw_task_layer_selection
|
from .merge.task_layer import draw_task_layer_selection
|
||||||
from .config import verify_json_data
|
from .config import verify_json_data
|
||||||
from . import constants
|
from . import constants
|
||||||
from .merge.task_layer import get_local_task_layers
|
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_PT_sync(bpy.types.Panel):
|
class ASSETPIPE_PT_sync(bpy.types.Panel):
|
||||||
@ -131,7 +130,11 @@ class ASSETPIPE_PT_ownership_inspector(bpy.types.Panel):
|
|||||||
row.label(text=f"{obj.name}: ", icon="OBJECT_DATA")
|
row.label(text=f"{obj.name}: ", icon="OBJECT_DATA")
|
||||||
|
|
||||||
if obj.get("asset_id_surrender"):
|
if obj.get("asset_id_surrender"):
|
||||||
enabled = False if obj.asset_id_owner in get_local_task_layers() else True
|
enabled = (
|
||||||
|
False
|
||||||
|
if obj.asset_id_owner in asset_pipe.get_local_task_layers()
|
||||||
|
else True
|
||||||
|
)
|
||||||
row.operator("assetpipe.update_surrendered_object")
|
row.operator("assetpipe.update_surrendered_object")
|
||||||
row.enabled = enabled
|
row.enabled = enabled
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user