Asset Pipeline v2 #145
@ -4,17 +4,6 @@ from .. import constants
|
||||
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():
|
||||
local_task_layers = bpy.context.scene.asset_pipeline.local_task_layers
|
||||
return [task_layer.name for task_layer in local_task_layers]
|
||||
|
@ -4,7 +4,6 @@ import os
|
||||
from pathlib import Path
|
||||
from .merge.naming import task_layer_prefix_transfer_data_update
|
||||
from .merge.task_layer import (
|
||||
set_local_task_layers,
|
||||
draw_task_layer_selection,
|
||||
get_local_task_layers,
|
||||
)
|
||||
@ -176,14 +175,14 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
||||
|
||||
first_file = os.path.join(asset_directory, first_file_name)
|
||||
|
||||
set_local_task_layers(local_tls)
|
||||
self._asset_pipe.set_local_task_layers(local_tls)
|
||||
|
||||
bpy.ops.wm.save_as_mainfile(filepath=first_file, copy=True)
|
||||
return first_file
|
||||
|
||||
def _task_layer_file_create(self, context, task_layer_key, asset_directory):
|
||||
name = self._name + "." + task_layer_key.lower() + ".blend"
|
||||
set_local_task_layers([task_layer_key])
|
||||
self._asset_pipe.set_local_task_layers([task_layer_key])
|
||||
self._task_layer_collections_set(context, self._asset_pipe.asset_collection)
|
||||
|
||||
task_layer_file = os.path.join(asset_directory, name)
|
||||
@ -472,7 +471,7 @@ class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator):
|
||||
asset_pipe = context.scene.asset_pipeline
|
||||
all_task_layers = asset_pipe.all_task_layers
|
||||
local_tl = [tl.name for tl in all_task_layers if tl.is_local == True]
|
||||
set_local_task_layers(local_tl)
|
||||
asset_pipe.set_local_task_layers(local_tl)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import bpy
|
||||
from typing import List
|
||||
from . import constants
|
||||
from .merge.task_layer import get_local_task_layers
|
||||
from .config import get_task_layer_presets_path
|
||||
@ -121,6 +122,14 @@ class AssetPipeline(bpy.types.PropertyGroup):
|
||||
all_task_layers: bpy.props.CollectionProperty(type=TaskLayerSettings)
|
||||
local_task_layers: bpy.props.CollectionProperty(type=TaskLayerSettings)
|
||||
|
||||
def set_local_task_layers(self, task_layer_keys: List[str]):
|
||||
# Update Local Task Layers for New File
|
||||
self.local_task_layers.clear()
|
||||
for task_layer in self.all_task_layers:
|
||||
if task_layer.name in task_layer_keys:
|
||||
new_local_task_layer = self.local_task_layers.add()
|
||||
new_local_task_layer.name = task_layer.name
|
||||
|
||||
# UI BOOLS: used to show/hide transfer data elements
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user