Created
October 29, 2023 04:49
-
-
Save shiversoftdev/886e80af7362a46762d9e288c0427778 to your computer and use it in GitHub Desktop.
easy copy of bones for viewmodel stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.