Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 21 additions and 15 deletions
Showing only changes of commit f17a6fa203 - Show all commits

View File

@ -16,5 +16,11 @@ TRANSFER_DATA_TYPES = [
("MATERIAL_SLOT", "Material Slot", ""),
]
TRANSFER_DATA_KEYS = [item[0] for item in TRANSFER_DATA_TYPES]
VERTEX_GROUP_KEY = TRANSFER_DATA_KEYS[1]
MODIFIER_KEY = TRANSFER_DATA_KEYS[2]
MATERIAL_SLOT_KEY = TRANSFER_DATA_KEYS[3]
LOCAL_SUFFIX = "LOCAL"
EXTERNAL_SUFFIX = "EXTERNAL"

View File

@ -57,9 +57,8 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
else:
layout.label(text="No New Transfer Data found")
self.draw_transfer_data_items(layout, "VERTEX_GROUP")
self.draw_transfer_data_items(layout, "MODIFIER")
self.draw_transfer_data_items(layout, "MATERIAL_SLOT")
for key in constants.TRANSFER_DATA_KEYS:
self.draw_transfer_data_items(layout, key)
def execute(self, context: bpy.types.Context):
core.set_ownership(self._new_transfer_data)

View File

@ -1,8 +1,7 @@
import bpy
from . import transfer_functions
from .. import asset_suffix
from .. import asset_suffix, constants
# TODO Consider using transfer mapping here instead of matching suffixes
@ -29,16 +28,16 @@ def apply_transfer_data(
if asset_suffix.get_basename(target_obj.name) == asset_suffix.get_basename(
item.id_data.name
):
if item.type == "VERTEX_GROUP":
if item.type == constants.VERTEX_GROUP_KEY:
transfer_functions.transfer_vertex_group(
context=context,
vertex_group_name=item.name,
obj_target=target_obj,
obj_source=item.id_data,
)
if item.type == "MODIFIER":
if item.type == constants.MODIFIER_KEY:
transfer_functions.transfer_modifier(item, target_obj)
if item.type == "MATERIAL_SLOT":
if item.type == constants.MATERIAL_SLOT_KEY:
transfer_functions.transfer_material_slot(item, target_obj)
update_transfer_data_ownership(
transfer_data_item=item,

View File

@ -1,7 +1,7 @@
import bpy
from bpy import context
from . import transfer_core
from .. import asset_suffix
from .. import asset_suffix, constants
## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES
@ -13,7 +13,7 @@ def get_vertex_groups(obj, task_layer_name, new_transfer_data):
for vertex_group in obj.vertex_groups:
# Only add new ownership item if vertex group doesn't have an owner
matches = transfer_core.check_transfer_data_entry(
ownership, vertex_group.name, "VERTEX_GROUP"
ownership, vertex_group.name, constants.VERTEX_GROUP_KEY
)
if len(matches) == 0:
# NEED UNIQUE NAME INCASE OF DUPLICATES
@ -21,7 +21,7 @@ def get_vertex_groups(obj, task_layer_name, new_transfer_data):
new_transfer_data[name] = (
ownership,
vertex_group.name,
"VERTEX_GROUP",
constants.VERTEX_GROUP_KEY,
task_layer_name,
)
@ -59,14 +59,15 @@ def get_modifiers(obj, task_layer_name, new_transfer_data):
ownership = obj.transfer_data_ownership
for mod in obj.modifiers:
matches = transfer_core.check_transfer_data_entry(
ownership, mod.name, "MODIFIER"
ownership, mod.name, constants.MODIFIER_KEY
)
if len(matches) == 0:
# NEED UNIQUE NAME INCASE OF DUPLICATES
name = mod.name + '_' + obj.name
new_transfer_data[name] = (
ownership,
mod.name,
"MODIFIER",
constants.MODIFIER_KEY,
task_layer_name,
)
@ -133,14 +134,15 @@ def get_material_slots(obj, task_layer_name, new_transfer_data):
ownership = obj.transfer_data_ownership
for slot in obj.material_slots:
matches = transfer_core.check_transfer_data_entry(
ownership, slot.name, "MATERIAL_SLOT"
ownership, slot.name, constants.MATERIAL_SLOT_KEY
)
if len(matches) == 0:
# NEED UNIQUE NAME INCASE OF DUPLICATES
name = slot.name + '_' + obj.name
new_transfer_data[name] = (
ownership,
slot.name,
"MATERIAL_SLOT",
constants.MATERIAL_SLOT_KEY,
task_layer_name,
)