Created
May 13, 2018 16:18
-
-
Save dzava/ec38ed46a045728c6204a1d3e45ba55a to your computer and use it in GitHub Desktop.
This file contains 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 | |
def bones(): | |
active = context.active_pose_bone | |
if active is context.selected_pose_bones[0]: | |
return [active, context.selected_pose_bones[1]] | |
return [active, context.selected_pose_bones[0]] | |
def addRotationConstraint(): | |
[target, subtarget] = bones() | |
crc = target.constraints.new('COPY_ROTATION') | |
crc.target = context.selected_objects[0] | |
crc.subtarget = subtarget.name | |
crc.use_y = False | |
crc.use_z = False | |
crc.use_offset = True | |
crc.owner_space = "LOCAL" | |
crc.target_space = "LOCAL" | |
def lockRotation(): | |
for b in context.selected_pose_bones: | |
b.lock_rotation[1] = True | |
b.lock_rotation[2] = True | |
lockRotation() | |
#addRotationConstraint() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment