Asset Pipeline v2 #145
@ -3,6 +3,17 @@ from .. import constants
|
|||||||
from .. import config
|
from .. import config
|
||||||
|
|
||||||
|
|
||||||
|
def set_local_task_layers(task_layer_keys: [str]):
|
||||||
|
local_task_layers = bpy.context.scene.asset_pipeline.local_task_layers
|
||||||
|
all_task_layers = bpy.context.scene.asset_pipeline.all_task_layers
|
||||||
|
# Update Local Task Layers for New File
|
||||||
|
local_task_layers.clear()
|
||||||
|
for task_layer in all_task_layers:
|
||||||
|
if task_layer.name in task_layer_keys:
|
||||||
|
new_local_task_layer = local_task_layers.add()
|
||||||
|
new_local_task_layer.name = task_layer.name
|
||||||
|
|
||||||
|
|
||||||
def get_local_task_layers():
|
def get_local_task_layers():
|
||||||
local_task_layers = bpy.context.scene.asset_pipeline.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]
|
return [task_layer.name for task_layer in local_task_layers]
|
||||||
|
@ -2,6 +2,7 @@ import bpy
|
|||||||
from . import config
|
from . import config
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from .merge.task_layer import set_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
|
||||||
from . import constants
|
from . import constants
|
||||||
@ -115,14 +116,8 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
|||||||
|
|
||||||
starting_file = ""
|
starting_file = ""
|
||||||
first_file = os.path.join(asset_path, Path(bpy.data.filepath).name)
|
first_file = os.path.join(asset_path, Path(bpy.data.filepath).name)
|
||||||
local_task_layers = context.scene.asset_pipeline.local_task_layers
|
|
||||||
|
|
||||||
# Update Local Task Layers for New File
|
set_local_task_layers(local_tls)
|
||||||
local_task_layers.clear()
|
|
||||||
for task_layer in all_task_layers:
|
|
||||||
if task_layer.is_local == True:
|
|
||||||
new_local_task_layer = local_task_layers.add()
|
|
||||||
new_local_task_layer.name = task_layer.name
|
|
||||||
|
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=first_file, copy=True)
|
bpy.ops.wm.save_as_mainfile(filepath=first_file, copy=True)
|
||||||
starting_file = first_file
|
starting_file = first_file
|
||||||
@ -145,9 +140,7 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
|||||||
do_local_ids=True, do_linked_ids=False, do_recursive=True
|
do_local_ids=True, do_linked_ids=False, do_recursive=True
|
||||||
)
|
)
|
||||||
|
|
||||||
local_task_layers.clear()
|
set_local_task_layers([task_layer_key])
|
||||||
new_local_task_layer = local_task_layers.add()
|
|
||||||
new_local_task_layer.name = task_layer_key
|
|
||||||
|
|
||||||
task_layer_file = os.path.join(asset_path, name)
|
task_layer_file = os.path.join(asset_path, name)
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=task_layer_file, copy=True)
|
bpy.ops.wm.save_as_mainfile(filepath=task_layer_file, copy=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user