diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-27 04:03:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-27 04:03:49 +0400 |
commit | 1b1667018e3e960d21ec0c802290a5e49ffe2a90 (patch) | |
tree | cc64d18d4f6cad2b436f9ae0b00365b12923797b /release | |
parent | b89fb7d8fdea03549f0108554c5631b19f4be770 (diff) |
UI:
* Added Constraints template and Add Constraint operator.
* Added toggle=True/False parameter to uiItemR, to get a
toggle button (actual button) rather than an "option"
button (checkbox)
* Added OPTION/OPTIONN button type, to distinguish with
TOG/TOGN.
RNA:
* Make all modifier pointers editable, including correct updates.
* Added notifiers and updates to constraints.
* Fix a stack corruption, pointed out by Andrea, and potentially
causing crashes.
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/buttons_data_modifier.py | 35 | ||||
-rw-r--r-- | release/ui/buttons_object_constraint.py | 54 |
2 files changed, 74 insertions, 15 deletions
diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py index d60df5df528..93fa122caf8 100644 --- a/release/ui/buttons_data_modifier.py +++ b/release/ui/buttons_data_modifier.py @@ -23,9 +23,9 @@ class DATA_PT_modifiers(DataButtonsPanel): row.itemL(); for md in ob.modifiers: - box = layout.template_modifier(context, md) + box = layout.template_modifier(md) - if md.expanded: + if box: if md.type == 'ARMATURE': self.armature(box, md) if md.type == 'ARRAY': @@ -103,7 +103,7 @@ class DATA_PT_modifiers(DataButtonsPanel): if md.fit_type == 'FIT_LENGTH': layout.itemR(md, "length") if md.fit_type == 'FIT_CURVE': - layout.itemR(md, "curve") + layout.itemR(md, "curve") split = layout.split() @@ -150,9 +150,11 @@ class DATA_PT_modifiers(DataButtonsPanel): def build(self, layout, md): layout.itemR(md, "start") layout.itemR(md, "length") - layout.itemR(md, "randomize") + + row = layout.row() + row.itemR(md, "randomize") if md.randomize: - layout.itemR(md, "seed") + row.itemR(md, "seed") def cast(self, layout, md): layout.itemR(md, "cast_type") @@ -173,7 +175,7 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemL(text="See Collision panel.") def curve(self, layout, md): - layout.itemR(md, "curve") + layout.itemR(md, "object") layout.itemR(md, "vertex_group") layout.itemR(md, "deform_axis") @@ -218,7 +220,7 @@ class DATA_PT_modifiers(DataButtonsPanel): # Missing: "Reset" and "Recenter" def lattice(self, layout, md): - layout.itemR(md, "lattice") + layout.itemR(md, "object") layout.itemR(md, "vertex_group") def mask(self, layout, md): @@ -230,7 +232,7 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "inverse") def meshdeform(self, layout, md): - layout.itemR(md, "mesh") + layout.itemR(md, "object") layout.itemR(md, "vertex_group") layout.itemR(md, "invert") layout.itemR(md, "precision") @@ -312,9 +314,10 @@ class DATA_PT_modifiers(DataButtonsPanel): def smooth(self, layout, md): split = layout.split() sub = split.column() - sub.itemR(md, "x") - sub.itemR(md, "y") - sub.itemR(md, "z") + row = sub.row(align=True) + row.itemR(md, "x", toggle=True) + row.itemR(md, "y", toggle=True) + row.itemR(md, "z", toggle=True) sub = split.column() sub.itemR(md, "factor") sub.itemR(md, "repeat") @@ -353,9 +356,10 @@ class DATA_PT_modifiers(DataButtonsPanel): sub = split.column() sub.itemR(md, "normals") if md.normals: - sub.itemR(md, "x_normal", text="X") - sub.itemR(md, "y_normal", text="Y") - sub.itemR(md, "z_normal", text="Z") + row = sub.row(align=True) + row.itemR(md, "x_normal", text="X", toggle=True) + row.itemR(md, "y_normal", text="Y", toggle=True) + row.itemR(md, "z_normal", text="Z", toggle=True) col = layout.column_flow() col.itemR(md, "time_offset") @@ -380,4 +384,5 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "width", slider=True) col.itemR(md, "narrowness", slider=True) -bpy.types.register(DATA_PT_modifiers)
\ No newline at end of file +bpy.types.register(DATA_PT_modifiers) + diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py new file mode 100644 index 00000000000..bf1f5cd208e --- /dev/null +++ b/release/ui/buttons_object_constraint.py @@ -0,0 +1,54 @@ + +import bpy + +class DataButtonsPanel(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 + layout = self.layout + + row = layout.row() + row.item_menu_enumO("OBJECT_OT_constraint_add", "type") + row.itemL(); + + for con in ob.constraints: + box = layout.template_constraint(con) + + if box: + if con.type == 'COPY_LOCATION': + self.copy_location(box, con) + + def copy_location(self, layout, con): + layout.itemR(con, "target") + + if con.target and con.target.type == "ARMATURE": + layout.itemR(con, "subtarget", text="Bone") # XXX autocomplete + row = layout.row() + row.itemL(text="Head/Tail:") + row.itemR(con, "head_tail", text="") + elif con.target and con.target.type == "MESH": + layout.itemR(con, "subtarget", text="Vertex Group") # XXX autocomplete + + row = layout.row(align=True) + row.itemR(con, "locate_like_x", text="X", toggle=True) + row.itemR(con, "invert_x", text="-", toggle=True) + row.itemR(con, "locate_like_y", text="Y", toggle=True) + row.itemR(con, "invert_y", text="-", toggle=True) + row.itemR(con, "locate_like_z", text="Z", toggle=True) + row.itemR(con, "invert_z", text="-", toggle=True) + + layout.itemR(con, "offset") + +bpy.types.register(DATA_PT_constraints) + |