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:
authorThomas Dinges <blender@dingto.org>2009-05-31 03:31:10 +0400
committerThomas Dinges <blender@dingto.org>2009-05-31 03:31:10 +0400
commita67e7bebb9c212b5e40abe6b74e1849dde7d769d (patch)
tree67ecc8a1e183b47422fe6b7c1ad25aabf3bc3ef1 /release/ui
parentc41f8ea2ad9d2ec951cc978e44839460cd8f1f3a (diff)
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.
Diffstat (limited to 'release/ui')
-rw-r--r--release/ui/buttons_object_constraint.py342
1 files changed, 337 insertions, 5 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