Fix T39563: Tiny unit-display problem in constraint panels.

There is no good solution here, since RNA props can only have one type/unit.
Tried to find the less worse one - have different RNA props for same DNA value
(a bit like the angle/length for camera lens).

Also fixed two other issues with Transform conctraint:
* Angle were still in degrees (yes, another backward-compatibility breacking).
* Scale was absolute, unlike loc/rot.

Also cleaned up a bit the code, replaced some magic numbers by proper enums, ...
This commit is contained in:
2014-04-07 12:10:37 +02:00
parent f3db0389c0
commit 8714ae09f8
6 changed files with 219 additions and 43 deletions

View File

@@ -653,21 +653,22 @@ class ConstraintButtonsPanel():
col.row().prop(con, "map_from", expand=True)
split = layout.split()
ext = "" if con.map_from == 'LOCATION' else "_rot" if con.map_from == 'ROTATION' else "_scale"
sub = split.column(align=True)
sub.label(text="X:")
sub.prop(con, "from_min_x", text="Min")
sub.prop(con, "from_max_x", text="Max")
sub.prop(con, "from_min_x" + ext, text="Min")
sub.prop(con, "from_max_x" + ext, text="Max")
sub = split.column(align=True)
sub.label(text="Y:")
sub.prop(con, "from_min_y", text="Min")
sub.prop(con, "from_max_y", text="Max")
sub.prop(con, "from_min_y" + ext, text="Min")
sub.prop(con, "from_max_y" + ext, text="Max")
sub = split.column(align=True)
sub.label(text="Z:")
sub.prop(con, "from_min_z", text="Min")
sub.prop(con, "from_max_z", text="Max")
sub.prop(con, "from_min_z" + ext, text="Min")
sub.prop(con, "from_max_z" + ext, text="Max")
col = layout.column()
row = col.row()
@@ -694,27 +695,28 @@ class ConstraintButtonsPanel():
col.row().prop(con, "map_to", expand=True)
split = layout.split()
ext = "" if con.map_to == 'LOCATION' else "_rot" if con.map_to == 'ROTATION' else "_scale"
col = split.column()
col.label(text="X:")
sub = col.column(align=True)
sub.prop(con, "to_min_x", text="Min")
sub.prop(con, "to_max_x", text="Max")
sub.prop(con, "to_min_x" + ext, text="Min")
sub.prop(con, "to_max_x" + ext, text="Max")
col = split.column()
col.label(text="Y:")
sub = col.column(align=True)
sub.prop(con, "to_min_y", text="Min")
sub.prop(con, "to_max_y", text="Max")
sub.prop(con, "to_min_y" + ext, text="Min")
sub.prop(con, "to_max_y" + ext, text="Max")
col = split.column()
col.label(text="Z:")
sub = col.column(align=True)
sub.prop(con, "to_min_z", text="Min")
sub.prop(con, "to_max_z", text="Max")
sub.prop(con, "to_min_z" + ext, text="Min")
sub.prop(con, "to_max_z" + ext, text="Max")
self.space_template(layout, con)