Montag, 11. April 2011

Advanced industrial robot rigging 2

From my point of view every good rig needs a custom properties panel in python. So I set it up today for my industrial robot. As I noticed that the locked track constrains do have influence sliders, it put drivers on them and created a FK<>Locked track switch :-).

Next topics I will focus on this series are
- rigging cables around robot
- changeable welding guns


Panel layout:














Custom property setup on root bone:



















Example driver setup:

















Here's the script for 2.57, license is CC0:

import bpy


class Welding_Robot_Properties(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Welding Robot Properties"


@classmethod
def poll(self, context):
try:
ob = context.active_object
mode = context.mode
return (ob.name == "Armature" and mode == "POSE")
except AttributeError:
return 0


def draw(self, context):
pose_bones = context.active_object.pose.bones
layout = self.layout
col = layout.column()


#FK <> Locked track switch
col.label(text="FK <> Locked track switch:")
col.prop(pose_bones["root"], '["guntip"]', text="welding gun", slider=True)
col.prop(pose_bones["root"], '["back"]', text="back", slider=True)


#turret transformation
col.label(text="Turret Z rotation:")
col.prop(pose_bones["turret"],'rotation_euler', index=1,text="Z Rotation", slider=False)


#welding gun transformation
col.label(text="Welding gun Z rotation:")
col.prop(pose_bones["welding"],'rotation_euler', index=1,text="Z Rotation", slider=False)


#bone layers
col.label(text="Bone layers:")
legs = col.row()
legs.prop(context.active_object.data, "layers", index=0, toggle=True, text="Locked track")
legs.prop(context.active_object.data, "layers", index=1, toggle=True, text="FK controls")

bpy.utils.register_class(Welding_Robot_Properties)

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.