Asset Pipeline v2 #145
@ -4,6 +4,7 @@ from . import core # TODO DEBUG WHY THIS DOESN'T WORK
|
|||||||
from .asset_naming import get_target_name, get_basename, get_name_with_asset_prefix
|
from .asset_naming import get_target_name, get_basename, get_name_with_asset_prefix
|
||||||
from .util import get_storage_of_id
|
from .util import get_storage_of_id
|
||||||
from .transfer_data.transfer_core import transfer_data_add_entry
|
from .transfer_data.transfer_core import transfer_data_add_entry
|
||||||
|
from .other_ids import get_other_ids
|
||||||
from . import constants
|
from . import constants
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ class AssetTransferMapping:
|
|||||||
|
|
||||||
def _gen_other_id_map(self):
|
def _gen_other_id_map(self):
|
||||||
other_id_map: Dict[bpy.types.ID, bpy.types.ID] = {}
|
other_id_map: Dict[bpy.types.ID, bpy.types.ID] = {}
|
||||||
for local_id in core.get_other_ids(self._local_col):
|
for local_id in get_other_ids(self._local_col):
|
||||||
external_id_name = get_target_name(local_id.name)
|
external_id_name = get_target_name(local_id.name)
|
||||||
id_storage = get_storage_of_id(local_id)
|
id_storage = get_storage_of_id(local_id)
|
||||||
external_id = id_storage.get(external_id_name)
|
external_id = id_storage.get(external_id_name)
|
||||||
|
@ -15,7 +15,6 @@ from .asset_naming import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from bpy_extras.id_map_utils import get_id_reference_map, get_all_referenced_ids
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from . import constants
|
from . import constants
|
||||||
@ -253,24 +252,3 @@ 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_other_ids(collection): # TODO find better name
|
|
||||||
ref_map = get_id_reference_map()
|
|
||||||
all_ids_of_coll = get_all_referenced_ids(collection, ref_map)
|
|
||||||
return [
|
|
||||||
id
|
|
||||||
for id in all_ids_of_coll
|
|
||||||
if type(id) == bpy.types.NodeGroup or type(id) == bpy.types.Image
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def init_other_ids(scene):
|
|
||||||
other_ids = []
|
|
||||||
asset_pipe = scene.asset_pipeline
|
|
||||||
local_col = asset_pipe.asset_collection
|
|
||||||
for id in get_other_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
|
|
||||||
|
@ -7,12 +7,12 @@ from .publish import (
|
|||||||
find_all_published,
|
find_all_published,
|
||||||
get_next_published_file,
|
get_next_published_file,
|
||||||
)
|
)
|
||||||
|
from .other_ids import init_other_ids
|
||||||
from .core import (
|
from .core import (
|
||||||
get_task_layer_col_name,
|
get_task_layer_col_name,
|
||||||
ownership_get,
|
ownership_get,
|
||||||
ownership_set,
|
ownership_set,
|
||||||
get_invalid_objects,
|
get_invalid_objects,
|
||||||
init_other_ids,
|
|
||||||
merge_task_layer,
|
merge_task_layer,
|
||||||
)
|
)
|
||||||
from .transfer_data.transfer_ui import draw_transfer_data
|
from .transfer_data.transfer_ui import draw_transfer_data
|
||||||
|
23
scripts-blender/addons/asset_pipeline_2/other_ids.py
Normal file
23
scripts-blender/addons/asset_pipeline_2/other_ids.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import bpy
|
||||||
|
from bpy_extras.id_map_utils import get_id_reference_map, get_all_referenced_ids
|
||||||
|
|
||||||
|
|
||||||
|
def get_other_ids(collection): # TODO find better name
|
||||||
|
ref_map = get_id_reference_map()
|
||||||
|
all_ids_of_coll = get_all_referenced_ids(collection, ref_map)
|
||||||
|
return [
|
||||||
|
id
|
||||||
|
for id in all_ids_of_coll
|
||||||
|
if type(id) == bpy.types.NodeGroup or type(id) == bpy.types.Image
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def init_other_ids(scene):
|
||||||
|
other_ids = []
|
||||||
|
asset_pipe = scene.asset_pipeline
|
||||||
|
local_col = asset_pipe.asset_collection
|
||||||
|
for id in get_other_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
|
Loading…
Reference in New Issue
Block a user