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 /source/blender/makesrna/intern/rna_object_api.c | |
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 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index a04ad28f9c3..9fb883568c9 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -324,8 +324,27 @@ static void rna_Object_mat_convert_space(Object *ob, return; } } + /* These checks are extra security, they should never occur. */ + if (from == CONSTRAINT_SPACE_CUSTOM) { + const char *identifier = NULL; + RNA_enum_identifier(space_items, from, &identifier); + BKE_reportf(reports, + RPT_ERROR, + "'from_space' '%s' is invalid when no custom space is given!", + identifier); + return; + } + if (to == CONSTRAINT_SPACE_CUSTOM) { + const char *identifier = NULL; + RNA_enum_identifier(space_items, to, &identifier); + BKE_reportf(reports, + RPT_ERROR, + "'to_space' '%s' is invalid when no custom space is given!", + identifier); + return; + } - BKE_constraint_mat_convertspace(ob, pchan, (float(*)[4])mat_ret, from, to, false); + BKE_constraint_mat_convertspace(ob, pchan, NULL, (float(*)[4])mat_ret, from, to, false); } static void rna_Object_calc_matrix_camera(Object *ob, |