Created
March 27, 2012 19:51
-
-
Save neilus/2219680 to your computer and use it in GitHub Desktop.
A simple Blender UI for rigging
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 | |
class myButtons(bpy.types.Panel): | |
bl_label = "Rig Layers" | |
bl_space_type = "VIEW_3D" | |
bl_region_type = "UI" | |
@classmethod | |
def poll(self,context): | |
if(bpy.context.active_object.type == 'ARMATURE'): | |
return(True); | |
def draw(self,context): | |
layout = self.layout | |
row = layout.row() | |
row.label("Left Arm:") | |
row.prop(context.active_object.data, "layers", index=1, toggle=True, text="FK") | |
row.prop(context.active_object.data, "layers", index=2, toggle=True, text="IK") | |
bpy.utils.register_class(myButtons) | |
class mySlider(bpy.types.Panel): | |
driverMap = {'hand.L':2, 'forearm.L':2, 'hand.R':3, 'forearm.R':3, 'shin.L':1, 'foot.L':1, 'shin.R':2, 'foot.R':2} | |
driver = ['["IK.foot.L"]', '["IK.foot.R"]', '["IK.hand.L"]', '["IK.hand.R"]'] | |
bl_label = "IK Slider" | |
bl_space_type = "VIEW_3D" | |
bl_region_type = "UI" | |
@classmethod | |
def poll(self,context): | |
return (bpy.context.active_object.type == 'ARMATURE' and bpy.context.active_bone.name in self.driverMap) | |
def draw(self,context): | |
layout = self.layout | |
row = layout.row() | |
row.label( "IK Strength driver " + self.driver[self.driverMap[context.active_bone.name]] + ":" ) | |
# print bpy.context.active_bone.name | |
row.prop(context.active_object.data, self.driver[self.driverMap[bpy.context.active_bone.name]], slider=True, text="IK" ) | |
print(self.driver[self.driverMap[context.active_bone.name]]) | |
bpy.utils.register_class(mySlider) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment