Asset Pipeline v2 #145
@ -5,17 +5,22 @@ from pathlib import Path
|
|||||||
from . import transferable_data, constants
|
from . import transferable_data, constants
|
||||||
|
|
||||||
|
|
||||||
|
def get_task_layer_name_from_file(self):
|
||||||
|
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
||||||
|
task_layer_name = file_name.split(".")[-2]
|
||||||
|
if task_layer_name not in constants.TASK_LAYER_KEYS:
|
||||||
|
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||||
|
return {'CANCELLED'}
|
||||||
|
return task_layer_name
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
||||||
bl_idname = "assetpipe.update_ownership"
|
bl_idname = "assetpipe.update_ownership"
|
||||||
bl_label = 'Update Ownership'
|
bl_label = 'Update Ownership'
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
task_layer_name = get_task_layer_name_from_file(self)
|
||||||
task_layer_name = file_name.split(".")[-2]
|
|
||||||
if task_layer_name not in constants.TASK_LAYER_KEYS:
|
|
||||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
|
||||||
return {'CANCELLED'}
|
|
||||||
transferable_data.vertex_groups_update(obj, task_layer_name)
|
transferable_data.vertex_groups_update(obj, task_layer_name)
|
||||||
transferable_data.modifiers_update(obj, task_layer_name)
|
transferable_data.modifiers_update(obj, task_layer_name)
|
||||||
transferable_data.material_slot_update(obj, task_layer_name)
|
transferable_data.material_slot_update(obj, task_layer_name)
|
||||||
@ -30,8 +35,7 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
|||||||
# Find current task Layer
|
# Find current task Layer
|
||||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||||
current_file = Path(bpy.data.filepath)
|
current_file = Path(bpy.data.filepath)
|
||||||
# TODO check if exists in task_layer_constants
|
task_layer_name = get_task_layer_name_from_file(self)
|
||||||
task_layer_name = current_file.name.split('.')[-2]
|
|
||||||
pub_file = core.find_published_file(current_file)
|
pub_file = core.find_published_file(current_file)
|
||||||
pub_file_path = pub_file.__str__()
|
pub_file_path = pub_file.__str__()
|
||||||
bpy.ops.wm.open_mainfile(filepath=pub_file_path)
|
bpy.ops.wm.open_mainfile(filepath=pub_file_path)
|
||||||
@ -57,10 +61,8 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
|
|||||||
bl_label = 'Pull from Publish'
|
bl_label = 'Pull from Publish'
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
current_file = Path(bpy.data.filepath)
|
task_layer_name = get_task_layer_name_from_file(self)
|
||||||
# TODO check if exists in task_layer_constants
|
pub_file = core.find_published_file(Path(bpy.data.filepath))
|
||||||
task_layer_name = current_file.name.split('.')[-2]
|
|
||||||
pub_file = core.find_published_file(current_file)
|
|
||||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||||
core.merge_task_layer(
|
core.merge_task_layer(
|
||||||
context,
|
context,
|
||||||
|
Loading…
Reference in New Issue
Block a user