From a67e7bebb9c212b5e40abe6b74e1849dde7d769d Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 30 May 2009 23:31:10 +0000 Subject: [PATCH] 2.5 Constraints: * Wrapped the constraint layout to python and deleted the corresponding C code. ToDo: 4 constraints are still C code (IK, Script, Action and Rigid Body Joint) * Some Constraint RNA fixes. * Wrapped the Shrinkwrap Constraint in RNA. --- release/ui/buttons_object_constraint.py | 344 ++++++++- .../editors/interface/interface_templates.c | 701 +----------------- .../blender/makesrna/intern/rna_constraint.c | 181 +++-- 3 files changed, 453 insertions(+), 773 deletions(-) diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py index d44e6fdd10d..58683146ef0 100644 --- a/release/ui/buttons_object_constraint.py +++ b/release/ui/buttons_object_constraint.py @@ -11,9 +11,47 @@ class ConstraintButtonsPanel(bpy.types.Panel): box = layout.template_constraint(con) if box: - if con.type == "COPY_LOCATION": + if con.type == "CHILD_OF": + self.child_of(box, con) + elif con.type == "TRACK_TO": + self.track_to(box, con) + #elif con.type == "IK": + # self.ik(box, con) + elif con.type == "FOLLOW_PATH": + self.follow_path(box, con) + elif con.type == "LIMIT_ROTATION": + self.limit_rotation(box, con) + elif con.type == "LIMIT_LOCATION": + self.limit_location(box, con) + elif con.type == "LIMIT_SCALE": + self.limit_scale(box, con) + elif con.type == "COPY_ROTATION": + self.copy_rotation(box, con) + elif con.type == "COPY_LOCATION": self.copy_location(box, con) - + elif con.type == "COPY_SCALE": + self.copy_scale(box, con) + #elif con.type == "SCRIPT": + # self.script(box, con) + #elif con.type == "ACTION": + # self.action(box, con) + elif con.type == "LOCKED_TRACK": + self.locked_track(box, con) + elif con.type == "LIMIT_DISTANCE": + self.limit_distance(box, con) + elif con.type == "STRETCH_TO": + self.stretch_to(box, con) + elif con.type == "FLOOR": + self.floor(box, con) + #elif con.type == "RIGID_BODY_JOINT" + # self.rigid_body(box, con) + elif con.type == "CLAMP_TO": + self.clamp_to(box, con) + elif con.type == "TRANSFORM": + self.transform(box, con) + elif con.type == "SHRINKWRAP": + self.shrinkwrap(box, con) + # show/key buttons here are most likely obsolete now, with # keyframing functionality being part of every button if con.type not in ("RIGID_BODY_JOINT", "NULL"): @@ -47,6 +85,166 @@ class ConstraintButtonsPanel(bpy.types.Panel): elif con.target.type in ("MESH", "LATTICE"): layout.itemR(con, "subtarget", text="Vertex Group") # XXX autocomplete + def child_of(self, layout, con): + self.target_template(layout, con) + + layout.itemL(text="Use Channel(s):") + + row = layout.row(align=True) + row.itemR(con, "locationx", text="Loc X", toggle=True) + row.itemR(con, "locationy", text="Loc Y", toggle=True) + row.itemR(con, "locationz", text="Loc Z", toggle=True) + + row = layout.row(align=True) + row.itemR(con, "rotationx", text="Rot X", toggle=True) + row.itemR(con, "rotationy", text="Rot X", toggle=True) + row.itemR(con, "rotationz", text="Rot X", toggle=True) + + row = layout.row(align=True) + row.itemR(con, "sizex", text="Scale X", toggle=True) + row.itemR(con, "sizey", text="Scale X", toggle=True) + row.itemR(con, "sizez", text="Scale X", toggle=True) + + # Missing + row = layout.row() + row.itemL(text="SET OFFSET") + row.itemL(text="CLEAR OFFSET") + + def track_to(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="Align:") + row.itemR(con, "target_z", toggle=True) + + row = layout.row() + row.itemL(text="To:") + row.itemR(con, "track", expand=True) + row.itemL(text="Up:") + row.itemR(con, "up", expand=True) + + self.space_template(layout, con) + + #def ik(self, layout, con): + + def follow_path(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "curve_follow", toggle=True) + row.itemR(con, "offset") + + row = layout.row() + row.itemL(text="Forward:") + row.itemR(con, "forward", expand=True) + row.itemL(text="Up:") + row.itemR(con, "up", expand=True) + + def limit_rotation(self, layout, con): + row = layout.row(align=True) + row.itemR(con, "use_limit_x", toggle=True) + row.itemR(con, "minimum_x", text="Min") + row.itemR(con, "maximum_x", text="Max") + + row = layout.row(align=True) + row.itemR(con, "use_limit_y", toggle=True) + row.itemR(con, "minimum_y", text="Min") + row.itemR(con, "maximum_y", text="Max") + + row = layout.row(align=True) + row.itemR(con, "use_limit_z", toggle=True) + row.itemR(con, "minimum_z", text="Min") + row.itemR(con, "maximum_z", text="Max") + + row = layout.row() + row.itemR(con, "limit_transform", toggle=True) + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def limit_location(self, layout, con): + split = layout.split() + + col = split.column() + sub = col.row(align=True) + sub.itemR(con, "use_minimum_x", toggle=True) + sub.itemR(con, "minimum_x", text="") + sub = col.row(align=True) + sub.itemR(con, "use_minimum_y", toggle=True) + sub.itemR(con, "minimum_y", text="") + sub = col.row(align=True) + sub.itemR(con, "use_minimum_z", toggle=True) + sub.itemR(con, "minimum_z", text="") + + col = split.column() + sub = col.row(align=True) + sub.itemR(con, "use_maximum_x", toggle=True) + sub.itemR(con, "maximum_x", text="") + sub = col.row(align=True) + sub.itemR(con, "use_maximum_y", toggle=True) + sub.itemR(con, "maximum_y", text="") + sub = col.row(align=True) + sub.itemR(con, "use_maximum_z", toggle=True) + sub.itemR(con, "maximum_z", text="") + + row = layout.row() + row.itemR(con, "limit_transform", toggle=True) + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def limit_scale(self, layout, con): + split = layout.split() + + col = split.column() + sub = col.row(align=True) + sub.itemR(con, "use_minimum_x", toggle=True) + sub.itemR(con, "minimum_x", text="") + sub = col.row(align=True) + sub.itemR(con, "use_minimum_y", toggle=True) + sub.itemR(con, "minimum_y", text="") + sub = col.row(align=True) + sub.itemR(con, "use_minimum_z", toggle=True) + sub.itemR(con, "minimum_z", text="") + + col = split.column() + sub = col.row(align=True) + sub.itemR(con, "use_maximum_x", toggle=True) + sub.itemR(con, "maximum_x", text="") + sub = col.row(align=True) + sub.itemR(con, "use_maximum_y", toggle=True) + sub.itemR(con, "maximum_y", text="") + sub = col.row(align=True) + sub.itemR(con, "use_maximum_z", toggle=True) + sub.itemR(con, "maximum_z", text="") + + row = layout.row() + row.itemR(con, "limit_transform", toggle=True) + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def copy_rotation(self, layout, con): + self.target_template(layout, con) + + row = layout.row(align=True) + row.itemR(con, "rotate_like_x", text="X", toggle=True) + row.itemR(con, "invert_x", text="-", toggle=True) + row.itemR(con, "rotate_like_y", text="Y", toggle=True) + row.itemR(con, "invert_y", text="-", toggle=True) + row.itemR(con, "rotate_like_z", text="Z", toggle=True) + row.itemR(con, "invert_z", text="-", toggle=True) + + layout.itemR(con, "offset", toggle=True) + + self.space_template(layout, con) + def copy_location(self, layout, con): self.target_template(layout, con) @@ -58,10 +256,145 @@ class ConstraintButtonsPanel(bpy.types.Panel): row.itemR(con, "locate_like_z", text="Z", toggle=True) row.itemR(con, "invert_z", text="-", toggle=True) - layout.itemR(con, "offset") - + layout.itemR(con, "offset", toggle=True) + self.space_template(layout, con) + + def copy_scale(self, layout, con): + self.target_template(layout, con) + + row = layout.row(align=True) + row.itemR(con, "size_like_x", text="X", toggle=True) + row.itemR(con, "size_like_y", text="Y", toggle=True) + row.itemR(con, "size_like_z", text="Z", toggle=True) + layout.itemR(con, "offset", toggle=True) + + self.space_template(layout, con) + + #def sctipt(self, layout, con): + #def action(self, layout, con): + + def locked_track(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="To:") + row.itemR(con, "track", expand=True) + row.itemL(text="Lock:") + row.itemR(con, "locked", expand=True) + + def limit_distance(self, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "distance") + + row = layout.row() + row.itemL(text="Clamp Region:") + row.itemR(con, "limit_mode", text="") + #Missing: Recalculate Button + + def stretch_to(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "original_length", text="Rest Length") + row.itemR(con, "bulge", text="Volume Variation") + + row = layout.row() + row.itemL(text="Volume:") + row.itemR(con, "volume", expand=True) + row.itemL(text="Plane:") + row.itemR(con, "keep_axis", expand=True) + #Missing: Recalculate Button + + def floor(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "sticky", toggle=True) + row.itemR(con, "use_rotation", toggle=True) + + layout.itemR(con, "offset") + + row = layout.row() + row.itemL(text="Min/Max:") + row.itemR(con, "floor_location", expand=True) + + #def rigid_body(self, layout, con): + + def clamp_to(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="Main Axis:") + row.itemR(con, "main_axis", expand=True) + + row = layout.row() + row.itemL(text="Options") + row.itemR(con, "cyclic", toggle=True) + + def transform(self, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "extrapolate_motion", text="Extrapolate") + row.itemL() + + split = layout.split() + + col = split.column() + col.itemL(text="Source:") + col.row().itemR(con, "map_from", expand=True) + + sub = col.row(align=True) + sub.itemL(text="X:") + sub.itemR(con, "from_min_x", text="") + sub.itemR(con, "from_max_x", text="") + + sub = col.row(align=True) + sub.itemL(text="Y:") + sub.itemR(con, "from_min_y", text="") + sub.itemR(con, "from_max_y", text="") + + sub = col.row(align=True) + sub.itemL(text="Z:") + sub.itemR(con, "from_min_z", text="") + sub.itemR(con, "from_max_z", text="") + + col = split.column() + col.itemL(text="Destination:") + col.row().itemR(con, "map_to", expand=True) + + sub = col.row(align=True) + sub.itemR(con, "map_to_x_from", text="") + sub.itemR(con, "to_min_x", text="") + sub.itemR(con, "to_max_x", text="") + + sub = col.row(align=True) + sub.itemR(con, "map_to_y_from", text="") + sub.itemR(con, "to_min_y", text="") + sub.itemR(con, "to_max_y", text="") + + sub = col.row(align=True) + sub.itemR(con, "map_to_z_from", text="") + sub.itemR(con, "to_min_z", text="") + sub.itemR(con, "to_max_z", text="") + + self.space_template(layout, con) + + def shrinkwrap (self, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "distance") + layout.itemR(con, "shrinkwrap_type") + + if con.shrinkwrap_type == "PROJECT": + row = layout.row(align=True) + row.itemR(con, "axis_x", toggle=True) + row.itemR(con, "axis_y", toggle=True) + row.itemR(con, "axis_z", toggle=True) + class OBJECT_PT_constraints(ConstraintButtonsPanel): __idname__ = "OBJECT_PT_constraints" __label__ = "Constraints" @@ -104,5 +437,4 @@ class BONE_PT_constraints(ConstraintButtonsPanel): self.draw_constraint(con) bpy.types.register(OBJECT_PT_constraints) -bpy.types.register(BONE_PT_constraints) - +bpy.types.register(BONE_PT_constraints) \ No newline at end of file diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8e169023b18..f622113d6f5 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -694,8 +694,6 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i lx = x + 10; cy = y + 10 - 1; - // else if (md->type==eModifierType_Surface) { - // uiDefBut(block, LABEL, 1, "See Fields panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, ""); } if (md->error) { @@ -1185,52 +1183,9 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) draw_constraint_spaceselect(block, con, xco, yco-104, -1, is_armature_target(data->tar)); } break; - case CONSTRAINT_TYPE_CHILDOF: + /*case CONSTRAINT_TYPE_CHILDOF: { - bChildOfConstraint *data = con->data; - short normButWidth = (width/3); - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Parent:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object to use as Parent"); - - if (is_armature_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone to use as Parent"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - /* Draw triples of channel toggles */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Use Channel(s):", xco+65, yco-64, 150, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, CHILDOF_LOCX, B_CONSTRAINT_TEST, "Loc X", xco, yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-location"); - uiDefButBitI(block, TOG, CHILDOF_LOCY, B_CONSTRAINT_TEST, "Loc Y", xco+normButWidth, yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-location"); - uiDefButBitI(block, TOG, CHILDOF_LOCZ, B_CONSTRAINT_TEST, "Loc Z", xco+(normButWidth * 2), yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-location"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, CHILDOF_ROTX, B_CONSTRAINT_TEST, "Rot X", xco, yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-rotation"); - uiDefButBitI(block, TOG, CHILDOF_ROTY, B_CONSTRAINT_TEST, "Rot Y", xco+normButWidth, yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-rotation"); - uiDefButBitI(block, TOG, CHILDOF_ROTZ, B_CONSTRAINT_TEST, "Rot Z", xco+(normButWidth * 2), yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-rotation"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, CHILDOF_SIZEX, B_CONSTRAINT_TEST, "Scale X", xco, yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-scaling"); - uiDefButBitI(block, TOG, CHILDOF_SIZEY, B_CONSTRAINT_TEST, "Scale Y", xco+normButWidth, yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-scaling"); - uiDefButBitI(block, TOG, CHILDOF_SIZEZ, B_CONSTRAINT_TEST, "Scale Z", xco+(normButWidth * 2), yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-scaling"); - uiBlockEndAlign(block); - - - /* Inverse options */ + // Inverse options uiBlockBeginAlign(block); but=uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Set Offset", xco, yco-151, (width/2),18, NULL, 0, 24, 0, 0, "Calculate current Parent-Inverse Matrix (i.e. restore offset from parent)"); // XXX uiButSetFunc(but, childof_const_setinv, con, NULL); @@ -1239,84 +1194,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) // XXX uiButSetFunc(but, childof_const_clearinv, con, NULL); uiBlockEndAlign(block); } - break; - case CONSTRAINT_TYPE_ROTLIKE: - { - bRotateLikeConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - /* Draw XYZ toggles */ - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, ROTLIKE_X, B_CONSTRAINT_TEST, "X", xco+((width/2)-48), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component"); - uiDefButBitI(block, TOG, ROTLIKE_X_INVERT, B_CONSTRAINT_TEST, "-", xco+((width/2)-16), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert X component"); - uiDefButBitI(block, TOG, ROTLIKE_Y, B_CONSTRAINT_TEST, "Y", xco+((width/2)+16), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component"); - uiDefButBitI(block, TOG, ROTLIKE_Y_INVERT, B_CONSTRAINT_TEST, "-", xco+((width/2)+48), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component"); - uiDefButBitI(block, TOG, ROTLIKE_Z, B_CONSTRAINT_TEST, "Z", xco+((width/2)+96), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component"); - uiDefButBitI(block, TOG, ROTLIKE_Z_INVERT, B_CONSTRAINT_TEST, "-", xco+((width/2)+128), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component"); - uiBlockEndAlign(block); - - /* draw offset toggle */ - uiDefButBitI(block, TOG, ROTLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", xco, yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original rotation onto copied rotation"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-94, is_armature_owner(ob), is_armature_target(data->tar)); - } - break; - case CONSTRAINT_TYPE_SIZELIKE: - { - bSizeLikeConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - /* Draw XYZ toggles */ - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, SIZELIKE_X, B_CONSTRAINT_TEST, "X", xco+((width/2)-48), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component"); - uiDefButBitI(block, TOG, SIZELIKE_Y, B_CONSTRAINT_TEST, "Y", xco+((width/2)-16), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component"); - uiDefButBitI(block, TOG, SIZELIKE_Z, B_CONSTRAINT_TEST, "Z", xco+((width/2)+16), yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component"); - uiBlockEndAlign(block); - - /* draw offset toggle */ - uiDefButBitI(block, TOG, SIZELIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", xco, yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original scaling onto copied scaling"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-94, is_armature_owner(ob), is_armature_target(data->tar)); - } - break; + break; + */ case CONSTRAINT_TYPE_KINEMATIC: { bKinematicConstraint *data = con->data; @@ -1381,410 +1260,6 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) } } break; - case CONSTRAINT_TYPE_TRACKTO: - { - bTrackToConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Align:", xco+5, yco-42, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "TargetZ", xco+60, yco-42, 50, 18, &data->flags, 0, 1, 0, 0, "Target Z axis, not world Z axis, will constrain up direction"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", xco+12, yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", xco+39, yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "X axis points to the target object"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", xco+56, yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "Y axis points to the target object"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", xco+73, yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "Z axis points to the target object"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", xco+90, yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "-X axis points to the target object"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", xco+114, yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "-Y axis points to the target object"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", xco+138, yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "-Z axis points to the target object"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", xco+174, yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", xco+204, yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "X axis points upward"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", xco+221, yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "Y axis points upward"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", xco+238, yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "Z axis points upward"); - uiBlockEndAlign(block); - - if (is_armature_target(data->tar)) { - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", xco, yco-94, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-116, is_armature_owner(ob), is_armature_target(data->tar)); - } - else { - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-94, is_armature_owner(ob), is_armature_target(data->tar)); - } - } - break; - case CONSTRAINT_TYPE_MINMAX: - { - bMinMaxConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", xco, yco-44, 100, 18, &data->offset, -100, 100, 100.0, 0.0, "Offset from the position of the object center"); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - uiDefButBitI(block, TOG, MINMAX_STICKY, B_CONSTRAINT_TEST, "Sticky", xco, yco-24, 44, 18, &data->flag, 0, 24, 0, 0, "Immobilize object while constrained"); - uiDefButBitI(block, TOG, MINMAX_USEROT, B_CONSTRAINT_TEST, "Use Rot", xco+44, yco-24, 64, 18, &data->flag, 0, 24, 0, 0, "Use target object rotation"); - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Max/Min:", xco-8, yco-64, 54, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiBlockBeginAlign(block); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", xco+51, yco-64,17,18, &data->minmaxflag, 12.0, 0.0, 0, 0, "Will not pass below X of target"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", xco+67, yco-64,17,18, &data->minmaxflag, 12.0, 1.0, 0, 0, "Will not pass below Y of target"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", xco+85, yco-64,17,18, &data->minmaxflag, 12.0, 2.0, 0, 0, "Will not pass below Z of target"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", xco+102, yco-64,24,18, &data->minmaxflag, 12.0, 3.0, 0, 0, "Will not pass above X of target"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", xco+126, yco-64,24,18, &data->minmaxflag, 12.0, 4.0, 0, 0, "Will not pass above Y of target"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", xco+150, yco-64,24,18, &data->minmaxflag, 12.0, 5.0, 0, 0, "Will not pass above Z of target"); - uiBlockEndAlign(block); - - if (is_armature_target(data->tar)) { - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", xco, yco-86, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1"); - } - - } - break; - case CONSTRAINT_TYPE_LOCKTRACK: - { - bLockTrackConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", xco+12, yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", xco+39, yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "X axis points to the target object"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", xco+56, yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "Y axis points to the target object"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", xco+73, yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "Z axis points to the target object"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", xco+90, yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "-X axis points to the target object"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", xco+114, yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "-Y axis points to the target object"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", xco+138, yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "-Z axis points to the target object"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Lock:", xco+166, yco-64, 38, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", xco+204, yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "X axis is locked"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", xco+221, yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "Y axis is locked"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", xco+238, yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "Z axis is locked"); - uiBlockEndAlign(block); - } - break; - case CONSTRAINT_TYPE_FOLLOWPATH: - { - bFollowPathConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - /* Draw Curve Follow toggle */ - uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "CurveFollow", xco+39, yco-44, 100, 18, &data->followflag, 0, 24, 0, 0, "Object will follow the heading and banking of the curve"); - - /* Draw Offset number button */ - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", xco+155, yco-44, 100, 18, &data->offset, -MAXFRAMEF, MAXFRAMEF, 100.0, 0.0, "Offset from the position corresponding to the time frame"); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Fw:", xco+12, yco-64, 27, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", xco+39, yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points forward along the path"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", xco+56, yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points forward along the path"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", xco+73, yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points forward along the path"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", xco+90, yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points forward along the path"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", xco+114, yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points forward along the path"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", xco+138, yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points forward along the path"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", xco+174, yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", xco+204, yco-64,17,18, &data->upflag, 13.0, 0.0, 0, 0, "The axis that points upward"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", xco+221, yco-64,17,18, &data->upflag, 13.0, 1.0, 0, 0, "The axis that points upward"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", xco+238, yco-64,17,18, &data->upflag, 13.0, 2.0, 0, 0, "The axis that points upward"); - uiBlockEndAlign(block); - } - break; - case CONSTRAINT_TYPE_STRETCHTO: - { - bStretchToConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - if (is_armature_target(data->tar)) { - uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", xco, yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", xco+18, yco-60,139,18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", xco+155, yco-60,98,18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1"); - } - else { - uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", xco, yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", xco+18, yco-60, 237, 18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position"); - } - uiBlockEndAlign(block); - - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Volume Variation:", xco+18, yco-82, 237, 18, &data->bulge, 0.0, 100, 0.5, 0.5, "Factor between volume variation and stretching"); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Vol:",xco+14, yco-104,30,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"XZ", xco+44, yco-104,30,18, &data->volmode, 12.0, 0.0, 0, 0, "Keep Volume: Scaling X & Z"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", xco+74, yco-104,20,18, &data->volmode, 12.0, 1.0, 0, 0, "Keep Volume: Scaling X"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", xco+94, yco-104,20,18, &data->volmode, 12.0, 2.0, 0, 0, "Keep Volume: Scaling Z"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"NONE", xco+114, yco-104,50,18, &data->volmode, 12.0, 3.0, 0, 0, "Ignore Volume"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST,"Plane:",xco+175, yco-104,40,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", xco+215, yco-104,20,18, &data->plane, 12.0, 0.0, 0, 0, "Keep X axis"); - uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", xco+235, yco-104,20,18, &data->plane, 12.0, 2.0, 0, 0, "Keep Z axis"); - uiBlockEndAlign(block); - } - break; - case CONSTRAINT_TYPE_LOCLIMIT: - { - bLocLimitConstraint *data = con->data; - - int togButWidth = 50; - int textButWidth = ((width/2)-togButWidth); - - /* Draw Pairs of LimitToggle+LimitValue */ - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_XMIN, B_CONSTRAINT_TEST, "minX", xco, yco-28, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-28, (textButWidth-5), 18, &(data->xmin), -1000, 1000, 0.1,0.5,"Lowest x value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_XMAX, B_CONSTRAINT_TEST, "maxX", xco+(width-(textButWidth-5)-togButWidth), yco-28, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum x value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-28, (textButWidth-5), 18, &(data->xmax), -1000, 1000, 0.1,0.5,"Highest x value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_YMIN, B_CONSTRAINT_TEST, "minY", xco, yco-50, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-50, (textButWidth-5), 18, &(data->ymin), -1000, 1000, 0.1,0.5,"Lowest y value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_YMAX, B_CONSTRAINT_TEST, "maxY", xco+(width-(textButWidth-5)-togButWidth), yco-50, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum y value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-50, (textButWidth-5), 18, &(data->ymax), -1000, 1000, 0.1,0.5,"Highest y value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_ZMIN, B_CONSTRAINT_TEST, "minZ", xco, yco-72, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-72, (textButWidth-5), 18, &(data->zmin), -1000, 1000, 0.1,0.5,"Lowest z value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_ZMAX, B_CONSTRAINT_TEST, "maxZ", xco+(width-(textButWidth-5)-togButWidth), yco-72, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum z value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-72, (textButWidth-5), 18, &(data->zmax), -1000, 1000, 0.1,0.5,"Highest z value to allow"); - uiBlockEndAlign(block); - - /* special option(s) */ - uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", xco+(width/4), yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-130, is_armature_owner(ob), -1); - } - break; - case CONSTRAINT_TYPE_ROTLIMIT: - { - bRotLimitConstraint *data = con->data; - int normButWidth = (width/3); - - /* Draw Pairs of LimitToggle+LimitValue */ - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_XROT, B_CONSTRAINT_TEST, "LimitX", xco, yco-28, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on x-axis"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", xco+normButWidth, yco-28, normButWidth, 18, &(data->xmin), -360, 360, 0.1,0.5,"Lowest x value to allow"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", xco+(normButWidth * 2), yco-28, normButWidth, 18, &(data->xmax), -360, 360, 0.1,0.5,"Highest x value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_YROT, B_CONSTRAINT_TEST, "LimitY", xco, yco-50, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on y-axis"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", xco+normButWidth, yco-50, normButWidth, 18, &(data->ymin), -360, 360, 0.1,0.5,"Lowest y value to allow"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", xco+(normButWidth * 2), yco-50, normButWidth, 18, &(data->ymax), -360, 360, 0.1,0.5,"Highest y value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_ZROT, B_CONSTRAINT_TEST, "LimitZ", xco, yco-72, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on z-axis"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", xco+normButWidth, yco-72, normButWidth, 18, &(data->zmin), -360, 360, 0.1,0.5,"Lowest z value to allow"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", xco+(normButWidth * 2), yco-72, normButWidth, 18, &(data->zmax), -360, 360, 0.1,0.5,"Highest z value to allow"); - uiBlockEndAlign(block); - - /* special option(s) */ - uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", xco+(width/4), yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-130, is_armature_owner(ob), -1); - } - break; - case CONSTRAINT_TYPE_SIZELIMIT: - { - bSizeLimitConstraint *data = con->data; - - int togButWidth = 50; - int textButWidth = ((width/2)-togButWidth); - - /* Draw Pairs of LimitToggle+LimitValue */ - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_XMIN, B_CONSTRAINT_TEST, "minX", xco, yco-28, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-28, (textButWidth-5), 18, &(data->xmin), 0.0001, 1000, 0.1,0.5,"Lowest x value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_XMAX, B_CONSTRAINT_TEST, "maxX", xco+(width-(textButWidth-5)-togButWidth), yco-28, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum x value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-28, (textButWidth-5), 18, &(data->xmax), 0.0001, 1000, 0.1,0.5,"Highest x value to allow"); - uiBlockEndAlign(block); - - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_YMIN, B_CONSTRAINT_TEST, "minY", xco, yco-50, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-50, (textButWidth-5), 18, &(data->ymin), 0.0001, 1000, 0.1,0.5,"Lowest y value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_YMAX, B_CONSTRAINT_TEST, "maxY", xco+(width-(textButWidth-5)-togButWidth), yco-50, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum y value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-50, (textButWidth-5), 18, &(data->ymax), 0.0001, 1000, 0.1,0.5,"Highest y value to allow"); - uiBlockEndAlign(block); - - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_ZMIN, B_CONSTRAINT_TEST, "minZ", xco, yco-72, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-72, (textButWidth-5), 18, &(data->zmin), 0.0001, 1000, 0.1,0.5,"Lowest z value to allow"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, LIMIT_ZMAX, B_CONSTRAINT_TEST, "maxZ", xco+(width-(textButWidth-5)-togButWidth), yco-72, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum z value"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-72, (textButWidth-5), 18, &(data->zmax), 0.0001, 1000, 0.1,0.5,"Highest z value to allow"); - uiBlockEndAlign(block); - - /* special option(s) */ - uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", xco+(width/4), yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well"); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-130, is_armature_owner(ob), -1); - } - break; - case CONSTRAINT_TYPE_DISTLIMIT: - { - bDistLimitConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - if (is_armature_target(data->tar)) { - but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - if (is_armature_target(data->tar)) { - uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", xco, yco-60, 20, 18, &data->dist, 0, 0, 0, 0, "Recalculate distance"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Distance:", xco+18, yco-60,139,18, &data->dist, 0.0, 100, 0.5, 0.5, "Radius of limiting sphere"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", xco+155, yco-60,100,18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1"); - } - else { - uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", xco, yco-60, 20, 18, &data->dist, 0, 0, 0, 0, "Recalculate distance"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Distance:", xco+18, yco-60, 237, 18, &data->dist, 0.0, 100, 0.5, 0.5, "Radius of limiting sphere"); - } - - /* disabled soft-distance controls... currently it doesn't work yet. It was intended to be used for soft-ik (see xsi-blog for details) */ -#if 0 - uiDefButBitS(block, TOG, LIMITDIST_USESOFT, B_CONSTRAINT_TEST, "Soft", xco, yco-82, 50, 18, &data->flag, 0, 24, 0, 0, "Enables soft-distance"); - if (data->flag & LIMITDIST_USESOFT) - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Soft-Distance:", xco+50, yco-82, 187, 18, &data->soft, 0.0, 100, 0.5, 0.5, "Distance surrounding radius when transforms should get 'delayed'"); -#endif - uiBlockEndAlign(block); - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Clamp Region:",xco+((width/2)-110), yco-104,100,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButS(block, MENU, B_CONSTRAINT_TEST, "Limit Mode%t|Inside %x0|Outside %x1|Surface %x2", xco+(width/2), yco-104, 100, 18, &data->mode, 0, 24, 0, 0, "Distances in relation to sphere of influence to allow"); - } - break; case CONSTRAINT_TYPE_RIGIDBODYJOINT: { bRigidBodyJointConstraint *data = con->data; @@ -1885,178 +1360,12 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) } break; - case CONSTRAINT_TYPE_CLAMPTO: - { - bClampToConstraint *data = con->data; - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object"); - - /* Draw XYZ toggles */ - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Main Axis:", xco, yco-64, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Auto", xco+100, yco-64, 50, 18, &data->flag, 12.0, CLAMPTO_AUTO, 0, 0, "Automatically determine main-axis of movement"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST, "X", xco+150, yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_X, 0, 0, "Main axis of movement is x-axis"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Y", xco+182, yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_Y, 0, 0, "Main axis of movement is y-axis"); - uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Z", xco+214, yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_Z, 0, 0, "Main axis of movement is z-axis"); - uiBlockEndAlign(block); - - /* Extra Options Controlling Behaviour */ - //uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Options:", xco, yco-88, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButBitI(block, TOG, CLAMPTO_CYCLIC, B_CONSTRAINT_TEST, "Cyclic", xco+((width/2)), yco-88,60,19, &data->flag2, 0, 0, 0, 0, "Treat curve as cyclic curve (no clamping to curve bounding box)"); - //uiBlockEndAlign(block); - } - break; - case CONSTRAINT_TYPE_TRANSFORM: - { - bTransformConstraint *data = con->data; - float fmin, fmax, tmin, tmax; - - /* Draw target parameters */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* Draw target parameters */ - uiBlockBeginAlign(block); - uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->tar, "Target Object to use as Parent"); - - if (is_armature_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone to use as Parent"); - uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar); - } - else if (is_geom_target(data->tar)) { - but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+120, yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points"); - uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar); - } - else { - strcpy(data->subtarget, ""); - } - uiBlockEndAlign(block); - - /* Extrapolate Ranges? */ - uiDefButBitC(block, TOG, 1, B_CONSTRAINT_TEST, "Extrapolate", xco-10, yco-42,80,19, &data->expo, 0, 0, 0, 0, "Extrapolate ranges"); - - /* Draw options for source motion */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Source:", xco-10, yco-62, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* draw Loc/Rot/Size toggles */ - uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Loc", xco-5, yco-82, 45, 18, &data->from, 12.0, 0, 0, 0, "Use Location transform channels from Target"); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Rot", xco+40, yco-82, 45, 18, &data->from, 12.0, 1, 0, 0, "Use Rotation transform channels from Target"); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Scale", xco+85, yco-82, 45, 18, &data->from, 12.0, 2, 0, 0, "Use Scale transform channels from Target"); - uiBlockEndAlign(block); - - /* Draw Pairs of Axis: Min/Max Value*/ - if (data->from == 2) { - fmin= 0.0001; - fmax= 1000.0; - } - else if (data->from == 1) { - fmin= -360.0; - fmax= 360.0; - } - else { - fmin = -1000.0; - fmax= 1000.0; - } - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "X:", xco-10, yco-107, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+20, yco-107, 55, 18, &data->from_min[0], fmin, fmax, 0, 0, "Bottom of range of x-axis source motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+75, yco-107, 55, 18, &data->from_max[0], fmin, fmax, 0, 0, "Top of range of x-axis source motion for source->target mapping"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Y:", xco-10, yco-127, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+20, yco-127, 55, 18, &data->from_min[1], fmin, fmax, 0, 0, "Bottom of range of y-axis source motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+75, yco-127, 55, 18, &data->from_max[1], fmin, fmax, 0, 0, "Top of range of y-axis source motion for source->target mapping"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Z:", xco-10, yco-147, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+20, yco-147, 55, 18, &data->from_min[2], fmin, fmax, 0, 0, "Bottom of range of z-axis source motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+75, yco-147, 55, 18, &data->from_max[2], fmin, fmax, 0, 0, "Top of range of z-axis source motion for source->target mapping"); - uiBlockEndAlign(block); - - - /* Draw options for target motion */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Destination:", xco+150, yco-62, 150, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - - /* draw Loc/Rot/Size toggles */ - uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Loc", xco+150, yco-82, 45, 18, &data->to, 12.0, 0, 0, 0, "Use as Location transform"); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Rot", xco+195, yco-82, 45, 18, &data->to, 12.0, 1, 0, 0, "Use as Rotation transform"); - uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Scale", xco+245, yco-82, 45, 18, &data->to, 12.0, 2, 0, 0, "Use as Scale transform"); - uiBlockEndAlign(block); - - /* Draw Pairs of Source-Axis: Min/Max Value*/ - if (data->to == 2) { - tmin= 0.0001; - tmax= 1000.0; - } - else if (data->to == 1) { - tmin= -360.0; - tmax= 360.0; - } - else { - tmin = -1000.0; - tmax= 1000.0; - } - - uiBlockBeginAlign(block); - uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->X%x0|Y->X%x1|Z->X%x2", xco+150, yco-107, 40, 18, &data->map[0], 0, 24, 0, 0, "Specify which source axis the x-axis destination uses"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+175, yco-107, 50, 18, &data->to_min[0], tmin, tmax, 0, 0, "Bottom of range of x-axis destination motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+240, yco-107, 50, 18, &data->to_max[0], tmin, tmax, 0, 0, "Top of range of x-axis destination motion for source->target mapping"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->Y%x0|Y->Y%x1|Z->Y%x2", xco+150, yco-127, 40, 18, &data->map[1], 0, 24, 0, 0, "Specify which source axis the y-axis destination uses"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+175, yco-127, 50, 18, &data->to_min[1], tmin, tmax, 0, 0, "Bottom of range of y-axis destination motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+240, yco-127, 50, 18, &data->to_max[1], tmin, tmax, 0, 0, "Top of range of y-axis destination motion for source->target mapping"); - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->Z%x0|Y->Z%x1|Z->Z%x2", xco+150, yco-147, 40, 18, &data->map[2], 0, 24, 0, 0, "Specify which source axis the z-axis destination uses"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", xco+175, yco-147, 50, 18, &data->to_min[2], tmin, tmax, 0, 0, "Bottom of range of z-axis destination motion for source->target mapping"); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", xco+240, yco-147, 50, 18, &data->to_max[2], tmin, tmax, 0, 0, "Top of range of z-axis destination motion for source->target mapping"); - uiBlockEndAlign(block); - - /* constraint space settings */ - draw_constraint_spaceselect(block, con, xco, yco-170, is_armature_owner(ob), is_armature_target(data->tar)); - } - break; + case CONSTRAINT_TYPE_NULL: { uiItemL(box, "", 0); } break; - - case CONSTRAINT_TYPE_SHRINKWRAP: - { - bShrinkwrapConstraint *data = con->data; - - /* Draw parameters */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco+65, yco-24, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+120, yco-24, 135, 18, &data->target, "Target Object"); - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Dist:", xco + 75, yco-42, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+120, yco-42, 135, 18, &data->dist, -100.0f, 100.0f, 1.0f, 0.0f, "Distance to target"); - - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Type:", xco + 70, yco-60, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButS(block, MENU, B_MODIFIER_RECALC, "Shrinkwrap Type%t|Nearest Surface Point %x0|Projection %x1|Nearest Vertex %x2", xco+120, yco-60, 135, 18, &data->shrinkType, 0, 0, 0, 0, "Selects type of shrinkwrap algorithm for target position."); - - if(data->shrinkType == MOD_SHRINKWRAP_PROJECT) - { - /* Draw XYZ toggles */ - uiDefBut(block, LABEL,B_CONSTRAINT_TEST, "Axis:", xco+ 75, yco-78, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS, B_CONSTRAINT_TEST, "X",xco+120, yco-78, 45, 18, &data->projAxis, 0, 0, 0, 0, "Projection over X axis"); - uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS, B_CONSTRAINT_TEST, "Y",xco+165, yco-78, 45, 18, &data->projAxis, 0, 0, 0, 0, "Projection over Y axis"); - uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS, B_CONSTRAINT_TEST, "Z",xco+210, yco-78, 45, 18, &data->projAxis, 0, 0, 0, 0, "Projection over Z axis"); - } - } - break; default: result= box; break; diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index f4b2a8a7e1e..9880e25e9fd 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -29,6 +29,7 @@ #include "DNA_action_types.h" #include "DNA_constraint_types.h" +#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -55,6 +56,7 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", "Rigid Body Joint", ""}, {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", "Clamp To", ""}, {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""}, + {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", "Shrinkwrap", ""}, {0, NULL, NULL, NULL}}; @@ -110,6 +112,8 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) return &RNA_LimitScaleConstraint; case CONSTRAINT_TYPE_DISTLIMIT: return &RNA_LimitDistanceConstraint; + case CONSTRAINT_TYPE_SHRINKWRAP: + return &RNA_ShrinkwrapConstraint; default: return &RNA_UnknownType; } @@ -411,18 +415,18 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem track_items[] = { - {TRACK_X, "TRACK_X", "Track X", ""}, - {TRACK_Y, "TRACK_Y", "Track Y", ""}, - {TRACK_Z, "TRACK_Z", "Track Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Track Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Track Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Track Negative Z", ""}, + {TRACK_X, "TRACK_X", "X", ""}, + {TRACK_Y, "TRACK_Y", "Y", ""}, + {TRACK_Z, "TRACK_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem up_items[] = { - {TRACK_X, "UP_X", "Up X", ""}, - {TRACK_Y, "UP_Y", "Up Y", ""}, - {TRACK_Z, "UP_Z", "Up Z", ""}, + {TRACK_X, "UP_X", "X", ""}, + {TRACK_Y, "UP_Y", "Y", ""}, + {TRACK_Z, "UP_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint"); @@ -584,12 +588,12 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem minmax_items[] = { - {LOCLIKE_X, "FLOOR_X", "Floor X", ""}, - {LOCLIKE_Y, "FLOOR_Y", "Floor Y", ""}, - {LOCLIKE_Z, "FLOOR_Z", "Floor Z", ""}, - {LOCLIKE_X_INVERT, "FLOOR_NEGATIVE_X", "Floor Negative X", ""}, - {LOCLIKE_Y_INVERT, "FLOOR_NEGATIVE_Y", "Floor Negative Y", ""}, - {LOCLIKE_Z_INVERT, "FLOOR_NEGATIVE_Z", "Floor Negative Z", ""}, + {LOCLIKE_X, "FLOOR_X", "X", ""}, + {LOCLIKE_Y, "FLOOR_Y", "Y", ""}, + {LOCLIKE_Z, "FLOOR_Z", "Z", ""}, + {LOCLIKE_X_INVERT, "FLOOR_NEGATIVE_X", "-X", ""}, + {LOCLIKE_Y_INVERT, "FLOOR_NEGATIVE_Y", "-Y", ""}, + {LOCLIKE_Z_INVERT, "FLOOR_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "FloorConstraint", "Constraint"); @@ -706,7 +710,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, transform_channel_items); - RNA_def_property_ui_text(prop, "Transform Channel", "Transfromation channel from the target that is used to key the Action."); + RNA_def_property_ui_text(prop, "Transform Channel", "Transformation channel from the target that is used to key the Action."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); @@ -746,18 +750,18 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem locktrack_items[] = { - {TRACK_X, "TRACK_X", "Track X", ""}, - {TRACK_Y, "TRACK_Y", "Track Y", ""}, - {TRACK_Z, "TRACK_Z", "Track Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Track Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Track Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Track Negative Z", ""}, + {TRACK_X, "TRACK_X", "X", ""}, + {TRACK_Y, "TRACK_Y", "Y", ""}, + {TRACK_Z, "TRACK_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem lock_items[] = { - {TRACK_X, "LOCK_X", "Lock X", ""}, - {TRACK_Y, "LOCK_Y", "Lock Y", ""}, - {TRACK_Z, "LOCK_Z", "Lock Z", ""}, + {TRACK_X, "LOCK_X", "X", ""}, + {TRACK_Y, "LOCK_Y", "Y", ""}, + {TRACK_Z, "LOCK_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint"); @@ -794,18 +798,18 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem forwardpath_items[] = { - {TRACK_X, "FORWARD_X", "Forward X", ""}, - {TRACK_Y, "FORWARD_Y", "Forward Y", ""}, - {TRACK_Z, "FORWARD_Z", "Forward Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Forward Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Forward Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Forward Negative Z", ""}, + {TRACK_X, "FORWARD_X", "X", ""}, + {TRACK_Y, "FORWARD_Y", "Y", ""}, + {TRACK_Z, "FORWARD_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem pathup_items[] = { - {TRACK_X, "UP_X", "Up X", ""}, - {TRACK_Y, "UP_Y", "Up Y", ""}, - {TRACK_Z, "UP_Z", "Up Z", ""}, + {TRACK_X, "UP_X", "X", ""}, + {TRACK_Y, "UP_Y", "Y", ""}, + {TRACK_Z, "UP_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint"); @@ -847,15 +851,15 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem volume_items[] = { - {VOLUME_XZ, "VOLUME_XZX", "Volume XZ", ""}, - {VOLUME_XZ, "VOLUME_X", "Volume Y", ""}, - {VOLUME_XZ, "VOLUME_Z", "Volume Z", ""}, - {NO_VOLUME, "NO_VOLUME", "No Volume", ""}, + {VOLUME_XZ, "VOLUME_XZX", "XZ", ""}, + {VOLUME_X, "VOLUME_X", "Y", ""}, + {VOLUME_Z, "VOLUME_Z", "Z", ""}, + {NO_VOLUME, "NO_VOLUME", "None", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem plane_items[] = { - {PLANE_X, "PLANE_X", "Keep X Axis", ""}, - {PLANE_Z, "PLANE_Z", "Keep Z Axis", ""}, + {PLANE_X, "PLANE_X", "X", "Keep X Axis"}, + {PLANE_Z, "PLANE_Z", "Z", "Keep Z Axis"}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint"); @@ -982,10 +986,10 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem clamp_items[] = { - {CLAMPTO_AUTO, "CLAMPTO_AUTO", "Clamp Auto", ""}, - {CLAMPTO_X, "CLAMPTO_X", "Clamp X", ""}, - {CLAMPTO_Y, "CLAMPTO_Y", "Clamp Y", ""}, - {CLAMPTO_Z, "CLAMPTO_Z", "Clamp Z", ""}, + {CLAMPTO_AUTO, "CLAMPTO_AUTO", "Auto", ""}, + {CLAMPTO_X, "CLAMPTO_X", "X", ""}, + {CLAMPTO_Y, "CLAMPTO_Y", "Y", ""}, + {CLAMPTO_Z, "CLAMPTO_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "ClampToConstraint", "Constraint"); @@ -1016,8 +1020,8 @@ static void rna_def_constraint_transform(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem transform_items[] = { - {0, "LOCATION", "Location", ""}, - {1, "ROTATION", "Rotation", ""}, + {0, "LOCATION", "Loc", ""}, + {1, "ROTATION", "Rot", ""}, {2, "SCALE", "Scale", ""}, {0, NULL, NULL, NULL}}; @@ -1240,34 +1244,19 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object."); RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data"); - prop= RNA_def_property(srna, "use_minimum_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN); - RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value."); + prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT); + RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "use_minimum_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN); - RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value."); + prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT); + RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "use_minimum_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN); - RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX); - RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX); - RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX); - RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); + prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT); + RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); @@ -1432,6 +1421,55 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } +static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship."); + RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data"); + + static EnumPropertyItem type_items[] = { + {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", "Nearest Surface Point", ""}, + {MOD_SHRINKWRAP_PROJECT, "PROJECT", "Project", ""}, + {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", "Nearest Vertex", ""}, + {0, NULL, NULL, NULL}}; + + prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "target"); + RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); + + prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shrinkType"); + RNA_def_property_enum_items(prop, type_items); + RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "dist"); + RNA_def_property_range(prop, 0.0, 100.f); + RNA_def_property_ui_text(prop, "Distance", "Distance to Target."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS); + RNA_def_property_ui_text(prop, "Axis X", "Projection over X Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS); + RNA_def_property_ui_text(prop, "Axis Y", "Projection over Y Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS); + RNA_def_property_ui_text(prop, "Axis Z", "Projection over Z Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); +} + /* base struct for constraints */ void RNA_def_constraint(BlenderRNA *brna) { @@ -1517,6 +1555,7 @@ void RNA_def_constraint(BlenderRNA *brna) rna_def_constraint_rotation_limit(brna); rna_def_constraint_location_limit(brna); rna_def_constraint_transform(brna); + rna_def_constraint_shrinkwrap(brna); } -#endif +#endif \ No newline at end of file