Skip to content

Instantly share code, notes, and snippets.

@shiversoftdev
Created October 29, 2023 04:49
Show Gist options
  • Save shiversoftdev/886e80af7362a46762d9e288c0427778 to your computer and use it in GitHub Desktop.
Save shiversoftdev/886e80af7362a46762d9e288c0427778 to your computer and use it in GitHub Desktop.
easy copy of bones for viewmodel stuff
import bpy
context = bpy.context
scene = context.scene
ob = context.selected_objects[0]
ob1 = context.selected_objects[1]
for pb in ob.pose.bones:
# convert from pose to world
for pb2 in ob1.pose.bones:
if pb.name != pb2.name:
continue
mw = ob.convert_space(pose_bone=pb,
matrix=pb.matrix,
from_space='POSE',
to_space='WORLD')
mp = ob1.convert_space(pose_bone=pb2,
matrix=mw,
from_space = 'WORLD',
to_space = 'POSE')
pb2.matrix = mp
bpy.context.view_layer.update()
@shiversoftdev
Copy link
Author

Be in pose mode. Ctrl+click in order source armature and dest armature. All bones that match names will be positioned in same place. Moves dest armature to the pose of the source armature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment