Asset Pipeline v2 #145
@ -6,17 +6,20 @@ from . import asset_suffix
|
|||||||
def transfer_vertex_group(
|
def transfer_vertex_group(
|
||||||
context,
|
context,
|
||||||
vertex_group_name: str,
|
vertex_group_name: str,
|
||||||
obj_source: bpy.types.Object,
|
|
||||||
obj_target: bpy.types.Object,
|
obj_target: bpy.types.Object,
|
||||||
|
obj_source: bpy.types.Object,
|
||||||
):
|
):
|
||||||
if obj_source == obj_target:
|
if obj_target == obj_source:
|
||||||
return
|
return
|
||||||
# TODO remove old vertex groups before transfer !!
|
|
||||||
obj_target.vertex_groups.active = obj_target.vertex_groups[vertex_group_name]
|
if obj_target.vertex_groups.get(vertex_group_name):
|
||||||
|
obj_target.vertex_groups.remove(obj_target.vertex_groups.get(vertex_group_name))
|
||||||
|
|
||||||
|
obj_source.vertex_groups.active = obj_source.vertex_groups[vertex_group_name]
|
||||||
override = context.copy()
|
override = context.copy()
|
||||||
override["selected_editable_objects"] = [obj_source, obj_target]
|
override["selected_editable_objects"] = [obj_target, obj_source]
|
||||||
override["active_object"] = obj_target
|
override["active_object"] = obj_source
|
||||||
override["object"] = obj_target
|
override["object"] = obj_source
|
||||||
with context.temp_override(**override):
|
with context.temp_override(**override):
|
||||||
bpy.ops.object.data_transfer(
|
bpy.ops.object.data_transfer(
|
||||||
data_type="VGROUP_WEIGHTS",
|
data_type="VGROUP_WEIGHTS",
|
||||||
|
@ -29,8 +29,8 @@ def apply_transfer_data(
|
|||||||
transfer_functions.transfer_vertex_group(
|
transfer_functions.transfer_vertex_group(
|
||||||
context=context,
|
context=context,
|
||||||
vertex_group_name=item.name,
|
vertex_group_name=item.name,
|
||||||
obj_source=target_obj,
|
obj_target=target_obj,
|
||||||
obj_target=item.id_data,
|
obj_source=item.id_data,
|
||||||
)
|
)
|
||||||
if item.type == "MODIFIER":
|
if item.type == "MODIFIER":
|
||||||
transfer_functions.transfer_modifier(item, target_obj)
|
transfer_functions.transfer_modifier(item, target_obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user