diff options
author | Henrik Dick <weasel> | 2020-12-03 12:42:29 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-12-03 13:20:21 +0300 |
commit | a6c4e39876d8a0765290312f6d8c0175274114cd (patch) | |
tree | 98568a07fb46bb643cee07ea0ac08991f4f4db2e /release/scripts/startup/bl_ui | |
parent | 899dcc5f60667a54d9628fcb5656f7e9db642068 (diff) |
Add Custom Object Space to Constraints
Add Custom Space to the list of space conversions for constraints.
Constraints can use World Space, Local Space, Pose Space, Local with
Parent, and now also Custom Space with a custom object to define the
evaluation space.
The Custom Space option uses the Local Space of an other
object/bone/vertex group. If selected on owner or target it will show a
box for object selection. If an armature is selected, then it will also
show a box for bone selection. If a mesh object is selected it will show
the option for using the local space of a vertex group.
Reviewed By: #animation_rigging, sybren, Severin, angavrilov
Differential Revision: https://developer.blender.org/D7437
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_constraint.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index f46e9f9727f..71a7b056d07 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -85,14 +85,23 @@ class ConstraintButtonsPanel(Panel): row.operator("constraint.disable_keep_transform", text="", icon='CANCEL') @staticmethod - def space_template(layout, con, target=True, owner=True): + def space_template(layout, con, target=True, owner=True, separator=True): if target or owner: - layout.separator() + if separator: + layout.separator() if target: layout.prop(con, "target_space", text="Target") if owner: layout.prop(con, "owner_space", text="Owner") + if con.target_space == 'CUSTOM' or con.owner_space == 'CUSTOM': + col = layout.column() + col.prop(con, "space_object") + if con.space_object and con.space_object.type == 'ARMATURE': + col.prop_search(con, "space_subtarget", con.space_object.data, "bones", text="Bone") + elif con.space_object and con.space_object.type in {'MESH', 'LATTICE'}: + col.prop_search(con, "space_subtarget", con.space_object, "vertex_groups", text="Vertex Group") + @staticmethod def target_template(layout, con, subtargets=True): col = layout.column() @@ -237,7 +246,7 @@ class ConstraintButtonsPanel(Panel): row.label(icon="BLANK1") layout.prop(con, "use_transform_limit") - layout.prop(con, "owner_space") + self.space_template(layout, con, target=False, owner=True) self.draw_influence(layout, con) @@ -306,7 +315,7 @@ class ConstraintButtonsPanel(Panel): row.prop_decorator(con, "max_z") layout.prop(con, "use_transform_limit") - layout.prop(con, "owner_space") + self.space_template(layout, con, target=False, owner=True) self.draw_influence(layout, con) @@ -375,7 +384,7 @@ class ConstraintButtonsPanel(Panel): row.prop_decorator(con, "max_z") layout.prop(con, "use_transform_limit") - layout.prop(con, "owner_space") + self.space_template(layout, con, target=False, owner=True) self.draw_influence(layout, con) @@ -483,7 +492,7 @@ class ConstraintButtonsPanel(Panel): layout.prop(con, "volume") - layout.prop(con, "owner_space") + self.space_template(layout, con, target=False, owner=True) self.draw_influence(layout, con) @@ -1117,7 +1126,7 @@ class ConstraintButtonsSubPanel(Panel): col = layout.column() col.active = not con.use_eval_time col.prop(con, "transform_channel", text="Channel") - col.prop(con, "target_space") + ConstraintButtonsPanel.space_template(col, con, target=True, owner=False, separator=False) sub = col.column(align=True) sub.prop(con, "min", text="Range Min") |