Answers for "blender transfer weight to multiple objects"

0

blender transfer weight to multiple objects

#Script for transferring weights from one object to multiple objects
#Select all your target objects first, then select the source last, and run the script

import bpy

source_mesh = bpy.context.active_object #variable for source
target_meshes = bpy.context.selected_objects[1:] #variable array for targets

for o in target_meshes:

    bpy.ops.object.select_all(action='DESELECT') #deselecting everything
    bpy.data.objects[o.name].select_set(True) #selecting target
    bpy.data.objects[source_mesh.name].select_set(True) #selecting source
    bpy.context.view_layer.objects.active = bpy.data.objects[o.name] #setting target as active

    bpy.ops.paint.weight_paint_toggle() #entering Weight Paint mode
    bpy.ops.object.data_transfer(use_reverse_transfer=True, data_type='VGROUP_WEIGHTS', layers_select_src='NAME', layers_select_dst='ALL') #transferring weights
    bpy.ops.paint.weight_paint_toggle() #exit Weight Paint Mode
Posted by: Guest on February-23-2021

Browse Popular Code Answers by Language