Asset Pipeline v2 #145
@ -3,7 +3,7 @@ from typing import Dict, Set
|
||||
from .naming import get_target_name, get_basename, get_name_with_asset_prefix
|
||||
from .util import get_storage_of_id
|
||||
from .transfer_data.transfer_util import transfer_data_add_entry
|
||||
from .other_ids import get_other_ids
|
||||
from .shared_ids import get_shared_ids
|
||||
from .. import constants
|
||||
|
||||
|
||||
@ -206,7 +206,7 @@ class AssetTransferMapping:
|
||||
|
||||
def _gen_other_id_map(self):
|
||||
other_id_map: Dict[bpy.types.ID, bpy.types.ID] = {}
|
||||
for local_id in get_other_ids(self._local_col):
|
||||
for local_id in get_shared_ids(self._local_col):
|
||||
external_id_name = get_target_name(local_id.name)
|
||||
id_storage = get_storage_of_id(local_id)
|
||||
external_id = id_storage.get(external_id_name)
|
||||
|
@ -1,17 +1,15 @@
|
||||
import bpy
|
||||
from bpy_extras.id_map_utils import get_id_reference_map, get_all_referenced_ids
|
||||
|
||||
# TODO find better name for 'other_ids'
|
||||
|
||||
|
||||
def get_other_ids(collection: bpy.types.Collection) -> list[bpy.types.ID]:
|
||||
def get_shared_ids(collection: bpy.types.Collection) -> list[bpy.types.ID]:
|
||||
"""Returns a list of any ID that is not covered by the merge process
|
||||
|
||||
Args:
|
||||
collection (bpy.types.Collection): Collection that contains data that references 'other_ids'
|
||||
collection (bpy.types.Collection): Collection that contains data that references 'shared_ids'
|
||||
|
||||
Returns:
|
||||
list[bpy.types.ID]: List of 'other_ids'
|
||||
list[bpy.types.ID]: List of 'shared_ids'
|
||||
"""
|
||||
ref_map = get_id_reference_map()
|
||||
all_ids_of_coll = get_all_referenced_ids(collection, ref_map)
|
||||
@ -22,21 +20,21 @@ def get_other_ids(collection: bpy.types.Collection) -> list[bpy.types.ID]:
|
||||
]
|
||||
|
||||
|
||||
def init_other_ids(scene: bpy.types.Scene) -> list[bpy.types.ID]:
|
||||
"""Intilizes any ID not covered by the transfer process as an 'other_id'
|
||||
and marks all 'other_ids' without an owner to the current task layer
|
||||
def init_shared_ids(scene: bpy.types.Scene) -> list[bpy.types.ID]:
|
||||
"""Intilizes any ID not covered by the transfer process as an 'shared_id'
|
||||
and marks all 'shared_ids' without an owner to the current task layer
|
||||
|
||||
Args:
|
||||
scene (bpy.types.Scene): Scene that contains a the file's asset
|
||||
|
||||
Returns:
|
||||
list[bpy.types.ID]: A list of new 'other_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
|
||||
"""
|
||||
other_ids = []
|
||||
shared_ids = []
|
||||
asset_pipe = scene.asset_pipeline
|
||||
local_col = asset_pipe.asset_collection
|
||||
for id in get_other_ids(local_col):
|
||||
for id in get_shared_ids(local_col):
|
||||
if id.asset_id_owner == 'NONE':
|
||||
id.asset_id_owner = asset_pipe.task_layer_name
|
||||
other_ids.append(id)
|
||||
return other_ids
|
||||
shared_ids.append(id)
|
||||
return shared_ids
|
@ -4,7 +4,7 @@ from .merge.publish import (
|
||||
find_sync_target,
|
||||
find_all_published,
|
||||
)
|
||||
from .merge.other_ids import init_other_ids
|
||||
from .merge.shared_ids import init_shared_ids
|
||||
from .merge.core import (
|
||||
ownership_get,
|
||||
ownership_set,
|
||||
@ -43,7 +43,7 @@ def sync_invoke(self, context):
|
||||
|
||||
# TODO Remove Invalid Objs Explicitly, some will be auto removed but not all
|
||||
self._invalid_objs = get_invalid_objects(local_col, context.scene)
|
||||
self._other_ids = init_other_ids(context.scene)
|
||||
self._shared_ids = init_shared_ids(context.scene)
|
||||
|
||||
|
||||
def sync_draw(self, context):
|
||||
@ -57,10 +57,10 @@ def sync_draw(self, context):
|
||||
for obj in self._invalid_objs:
|
||||
box.label(text=obj.name, icon="OBJECT_DATA")
|
||||
|
||||
if len(self._other_ids) != 0:
|
||||
if len(self._shared_ids) != 0:
|
||||
box = layout.box()
|
||||
box.label(text="New 'Other IDs' found")
|
||||
for id in self._other_ids:
|
||||
for id in self._shared_ids:
|
||||
box.label(text=id.name)
|
||||
|
||||
if len(self._temp_transfer_data) == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user