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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 03:45:50 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 03:45:50 +0400
commit276a75ae071ac44e813a0b5e499846e752d80b1e (patch)
tree851afc75fdc0f86578e1e487bb8125d4d409c662 /release/ui/buttons_object_constraint.py
parentfacb94461665934e3c1bf32a4cfec0c14892ce53 (diff)
UI:
* Added panels with dummy preview template. * Added constraints panel for bones next to objects, though it doesn't work that well yet, the operators and code need to be changed so they don't assume it is one or the other in/out of posemode. * Added some graying out in the scene and world buttons.
Diffstat (limited to 'release/ui/buttons_object_constraint.py')
-rw-r--r--release/ui/buttons_object_constraint.py91
1 files changed, 70 insertions, 21 deletions
diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py
index 1ff1bec199d..d44e6fdd10d 100644
--- a/release/ui/buttons_object_constraint.py
+++ b/release/ui/buttons_object_constraint.py
@@ -1,34 +1,39 @@
import bpy
-class DataButtonsPanel(bpy.types.Panel):
+class ConstraintButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "object"
- def poll(self, context):
- ob = context.active_object
- return (ob != None)
-
-class DATA_PT_constraints(DataButtonsPanel):
- __idname__ = "DATA_PT_constraints"
- __label__ = "Constraints"
-
- def draw(self, context):
- ob = context.active_object
+ def draw_constraint(self, con):
layout = self.layout
+ box = layout.template_constraint(con)
- row = layout.row()
- row.item_menu_enumO("OBJECT_OT_constraint_add", "type")
- row.itemL();
+ if box:
+ if con.type == "COPY_LOCATION":
+ self.copy_location(box, con)
- for con in ob.constraints:
- box = layout.template_constraint(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"):
+ box.itemR(con, "influence")
+
+ def space_template(self, layout, con, target=True, owner=True):
+ if target or owner:
+ row = layout.row()
+
+ row.itemL(text="Convert:")
+
+ if target:
+ row.itemR(con, "target_space", text="")
- if box:
- if con.type == 'COPY_LOCATION':
- self.copy_location(box, con)
-
+ if target and owner:
+ row.itemL(icon=8) # XXX
+
+ if owner:
+ row.itemR(con, "owner_space", text="")
+
def target_template(self, layout, con, subtargets=True):
layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object
@@ -55,5 +60,49 @@ class DATA_PT_constraints(DataButtonsPanel):
layout.itemR(con, "offset")
-bpy.types.register(DATA_PT_constraints)
+ self.space_template(layout, con)
+
+class OBJECT_PT_constraints(ConstraintButtonsPanel):
+ __idname__ = "OBJECT_PT_constraints"
+ __label__ = "Constraints"
+ __context__ = "object"
+
+ def poll(self, context):
+ ob = context.active_object
+ return (ob != None)
+
+ def draw(self, context):
+ ob = context.active_object
+ layout = self.layout
+
+ row = layout.row()
+ row.item_menu_enumO("OBJECT_OT_constraint_add", "type")
+ row.itemL();
+
+ for con in ob.constraints:
+ self.draw_constraint(con)
+
+class BONE_PT_constraints(ConstraintButtonsPanel):
+ __idname__ = "BONE_PT_constraints"
+ __label__ = "Constraints"
+ __context__ = "bone"
+
+ def poll(self, context):
+ ob = context.active_object
+ return (ob and ob.type == "ARMATURE")
+
+ def draw(self, context):
+ ob = context.active_object
+ pchan = ob.pose.pose_channels[0]
+ layout = self.layout
+
+ #row = layout.row()
+ #row.item_menu_enumO("BONE_OT_constraint_add", "type")
+ #row.itemL();
+
+ for con in pchan.constraints:
+ self.draw_constraint(con)
+
+bpy.types.register(OBJECT_PT_constraints)
+bpy.types.register(BONE_PT_constraints)