Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-09-25 01:22:24 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-09-25 01:22:24 +0400
commit1483fafd1372a3d3e025d08634e798adb7da512f (patch)
tree9191765749e29866339f4c31d892603f5f8b334d /release
parentc995c605f640d8d688e6e58e0fe247ca83f91696 (diff)
parent222fe6b1a5d49f67177cbb762f55a0e482145f5d (diff)
Merge of itasc branch. Project files, scons and cmake should be working. Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library.
Diffstat (limited to 'release')
-rw-r--r--release/ui/buttons_data_bone.py76
-rw-r--r--release/ui/buttons_object_constraint.py110
2 files changed, 143 insertions, 43 deletions
diff --git a/release/ui/buttons_data_bone.py b/release/ui/buttons_data_bone.py
index 510b41de8a7..dae969a7e5f 100644
--- a/release/ui/buttons_data_bone.py
+++ b/release/ui/buttons_data_bone.py
@@ -174,6 +174,9 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
bone = context.bone
pchan = ob.pose.pose_channels[context.bone.name]
+ row = layout.row()
+ row.itemR(ob.pose, "ik_solver")
+
split = layout.split(percentage=0.25)
split.itemR(pchan, "ik_dof_x", text="X")
row = split.row()
@@ -218,11 +221,27 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
row.itemR(pchan, "ik_min_z", text="")
row.itemR(pchan, "ik_max_z", text="")
row.active = pchan.ik_dof_z and pchan.ik_limit_z
-
split = layout.split()
split.itemR(pchan, "ik_stretch", text="Stretch", slider=True)
split.itemL()
+ if ob.pose.ik_solver == "ITASC":
+ layout.itemL(text="Joint constraint:")
+ split = layout.split(percentage=0.3)
+ row = split.row()
+ row.itemR(pchan, "ik_rot_control", text="Rotation")
+ row = split.row()
+ row.itemR(pchan, "ik_rot_weight", text="Weight", slider=True)
+ row.active = pchan.ik_rot_control
+ # not supported yet
+ #split = layout.split(percentage=0.3)
+ #row = split.row()
+ #row.itemR(pchan, "ik_lin_control", text="Size")
+ #row = split.row()
+ #row.itemR(pchan, "ik_lin_weight", text="Weight", slider=True)
+ #row.active = pchan.ik_lin_control
+
+
class BONE_PT_deform(BoneButtonsPanel):
__label__ = "Deform"
__default_closed__ = True
@@ -271,9 +290,64 @@ class BONE_PT_deform(BoneButtonsPanel):
col.itemL(text="Offset:")
col.itemR(bone, "cyclic_offset")
+class BONE_PT_iksolver_itasc(BoneButtonsPanel):
+ __idname__ = "BONE_PT_iksolver_itasc"
+ __label__ = "iTaSC parameters"
+ __default_closed__ = True
+
+ def poll(self, context):
+ ob = context.object
+ bone = context.bone
+
+ if ob and context.bone:
+ pchan = ob.pose.pose_channels[context.bone.name]
+ return pchan.has_ik and ob.pose.ik_solver == "ITASC" and ob.pose.ik_param
+
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+ ob = context.object
+ itasc = ob.pose.ik_param
+
+ layout.row().itemR(itasc, "simulation")
+ if itasc.simulation:
+ split = layout.split()
+ row = split.row()
+ row.itemR(itasc, "reiteration")
+ row = split.row()
+ if itasc.reiteration:
+ itasc.initial_reiteration = True
+ row.itemR(itasc, "initial_reiteration")
+ row.active = not itasc.reiteration
+
+ flow = layout.column_flow()
+ flow.itemR(itasc, "precision")
+ flow.itemR(itasc, "num_iter")
+ flow.active = not itasc.simulation or itasc.initial_reiteration or itasc.reiteration
+
+ if itasc.simulation:
+ layout.itemR(itasc, "auto_step")
+ row = layout.row()
+ if itasc.auto_step:
+ row.itemR(itasc, "min_step")
+ row.itemR(itasc, "max_step")
+ else:
+ row.itemR(itasc, "num_step")
+
+ layout.itemR(itasc, "solver")
+ if itasc.simulation:
+ layout.itemR(itasc, "feedback")
+ layout.itemR(itasc, "max_velocity")
+ if itasc.solver == "DLS":
+ row = layout.row()
+ row.itemR(itasc, "dampmax")
+ row.itemR(itasc, "dampeps")
+
bpy.types.register(BONE_PT_context_bone)
bpy.types.register(BONE_PT_transform)
bpy.types.register(BONE_PT_transform_locks)
bpy.types.register(BONE_PT_bone)
bpy.types.register(BONE_PT_deform)
bpy.types.register(BONE_PT_inverse_kinematics)
+bpy.types.register(BONE_PT_iksolver_itasc)
diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py
index 8671f9e25a8..ca5c86fddd7 100644
--- a/release/ui/buttons_object_constraint.py
+++ b/release/ui/buttons_object_constraint.py
@@ -6,14 +6,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
__region_type__ = 'WINDOW'
__context__ = "constraint"
- def draw_constraint(self, con):
+ def draw_constraint(self, context, con):
layout = self.layout
box = layout.template_constraint(con)
if box:
# match enum type to our functions, avoids a lookup table.
- getattr(self, con.type)(box, con)
+ getattr(self, con.type)(context, box, con)
# show/key buttons here are most likely obsolete now, with
# keyframing functionality being part of every button
@@ -48,8 +48,29 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemR(con, "head_tail", text="")
elif con.target.type in ('MESH', 'LATTICE'):
layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
+
+ def ik_template(self, layout, con):
+ layout.itemR(con, "pole_target")
+
+ if con.pole_target and con.pole_target.type == 'ARMATURE':
+ layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
+
+ if con.pole_target:
+ row = layout.row()
+ row.itemL()
+ row.itemR(con, "pole_angle")
+
+ split = layout.split()
+ col = split.column()
+ col.itemR(con, "tail")
+ col.itemR(con, "stretch")
+
+ col = split.column()
+ col.itemR(con, "iterations")
+ col.itemR(con, "chain_length")
+
- def CHILD_OF(self, layout, con):
+ def CHILD_OF(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -76,7 +97,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemO("constraint.childof_set_inverse")
row.itemO("constraint.childof_clear_inverse")
- def TRACK_TO(self, layout, con):
+ def TRACK_TO(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -90,35 +111,40 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def IK(self, layout, con):
+ def IK(self, context, layout, con):
+ if context.object.pose.ik_solver == "ITASC":
+ layout.itemR(con, "ik_type")
+ getattr(self, "IK_"+con.ik_type)(context, layout, con)
+ else:
+ self.IK_COPY_POSE(context, layout, con)
+
+ def IK_COPY_POSE(self, context, layout, con):
self.target_template(layout, con)
-
- layout.itemR(con, "pole_target")
-
- if con.pole_target and con.pole_target.type == 'ARMATURE':
- layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
-
+ self.ik_template(layout, con)
+
split = layout.split()
-
col = split.column()
- col.itemR(con, "iterations")
- col.itemR(con, "chain_length")
- sub = col.column()
- sub.active = con.pole_target
- sub.itemR(con, "pole_angle")
+ col.itemL()
+ col.itemR(con, "targetless")
+ col.itemR(con, "rotation")
+
+ col = split.column()
col.itemL(text="Weight:")
col.itemR(con, "weight", text="Position", slider=True)
sub = col.column()
sub.active = con.rotation
sub.itemR(con, "orient_weight", text="Rotation", slider=True)
- col = split.column()
- col.itemR(con, "tail")
- col.itemR(con, "rotation")
- col.itemR(con, "targetless")
- col.itemR(con, "stretch")
-
- def FOLLOW_PATH(self, layout, con):
+ def IK_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
+
+ layout.itemR(con, "limit_mode")
+ row = layout.row()
+ row.itemR(con, "weight", text="Weight", slider=True)
+ row.itemR(con, "distance", text="Distance", slider=True)
+
+ def FOLLOW_PATH(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -142,7 +168,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemR(con, "up", text="Up")
row.itemL()
- def LIMIT_ROTATION(self, layout, con):
+ def LIMIT_ROTATION(self, context, layout, con):
split = layout.split()
@@ -175,7 +201,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def LIMIT_LOCATION(self, layout, con):
+ def LIMIT_LOCATION(self, context, layout, con):
split = layout.split()
col = split.column()
@@ -216,7 +242,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def LIMIT_SCALE(self, layout, con):
+ def LIMIT_SCALE(self, context, layout, con):
split = layout.split()
col = split.column()
@@ -257,7 +283,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def COPY_ROTATION(self, layout, con):
+ def COPY_ROTATION(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -284,7 +310,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def COPY_LOCATION(self, layout, con):
+ def COPY_LOCATION(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -311,7 +337,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def COPY_SCALE(self, layout, con):
+ def COPY_SCALE(self, context, layout, con):
self.target_template(layout, con)
row = layout.row(align=True)
@@ -323,9 +349,9 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- #def SCRIPT(self, layout, con):
+ #def SCRIPT(self, context, layout, con):
- def ACTION(self, layout, con):
+ def ACTION(self, context, layout, con):
self.target_template(layout, con)
layout.itemR(con, "action")
@@ -345,7 +371,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def LOCKED_TRACK(self, layout, con):
+ def LOCKED_TRACK(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -356,7 +382,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Lock:")
row.itemR(con, "locked", expand=True)
- def LIMIT_DISTANCE(self, layout, con):
+ def LIMIT_DISTANCE(self, context, layout, con):
self.target_template(layout, con)
col = layout.column(align=True);
@@ -367,7 +393,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Clamp Region:")
row.itemR(con, "limit_mode", text="")
- def STRETCH_TO(self, layout, con):
+ def STRETCH_TO(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -383,7 +409,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Plane:")
row.itemR(con, "keep_axis", expand=True)
- def FLOOR(self, layout, con):
+ def FLOOR(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -396,7 +422,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Min/Max:")
row.itemR(con, "floor_location", expand=True)
- def RIGID_BODY_JOINT(self, layout, con):
+ def RIGID_BODY_JOINT(self, context, layout, con):
self.target_template(layout, con)
layout.itemR(con, "pivot_type")
@@ -422,7 +448,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
#Missing: Limit arrays (not wrapped in RNA yet)
- def CLAMP_TO(self, layout, con):
+ def CLAMP_TO(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -432,7 +458,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.itemR(con, "cyclic")
- def TRANSFORM(self, layout, con):
+ def TRANSFORM(self, context, layout, con):
self.target_template(layout, con)
layout.itemR(con, "extrapolate_motion", text="Extrapolate")
@@ -481,7 +507,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def SHRINKWRAP (self, layout, con):
+ def SHRINKWRAP (self, context, layout, con):
self.target_template(layout, con)
layout.itemR(con, "distance")
@@ -509,7 +535,7 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
row.itemL();
for con in ob.constraints:
- self.draw_constraint(con)
+ self.draw_constraint(context, con)
class BONE_PT_constraints(ConstraintButtonsPanel):
__label__ = "Constraints"
@@ -530,7 +556,7 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
row.itemL();
for con in pchan.constraints:
- self.draw_constraint(con)
+ self.draw_constraint(context, con)
bpy.types.register(OBJECT_PT_constraints)
bpy.types.register(BONE_PT_constraints)