diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-06-01 21:41:18 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-06-01 21:46:18 +0300 |
commit | 46fc0bb87ebda166d08b23cbcca799acb2c54158 (patch) | |
tree | 1566d535d93c4fb81b962cdbc1346ca8242460f2 /source/blender/editors/transform/transform_constraints.c | |
parent | 7f564d74f9edaaa41ce27c6e854869096f70b4da (diff) |
Move custom transform orientations to workspace
This commit moves the list of transform orientations from scenes to workspaces.
Main reasons for this are:
* Transform orientations are UI data and should not be stored in the scene.
* Introducion of workspaces caused some (expected) glitches with transform orientations. Mainly when removing one.
* Improves code.
More technically speaking, this commit does:
* Move list of custom transform orientations from Scene to WorkSpace struct.
* Store active transform orientation index separate from View3D.twmode (twmode can only be set to preprocessor defined values now).
* Display custom transform orientation name in header when transforming in it (used to show "global" which isn't really correct).
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 7b658d9c636..9360727e9cf 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -653,7 +653,7 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) */ void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) { - char text[40]; + char text[256]; switch (orientation) { case V3D_MANIP_GLOBAL: @@ -685,10 +685,15 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal")); setConstraint(t, t->spacemtx, mode, text); break; - default: /* V3D_MANIP_CUSTOM */ - BLI_snprintf(text, sizeof(text), ftext, t->spacename); + case V3D_MANIP_CUSTOM: + { + char orientation_str[128]; + BLI_snprintf(orientation_str, sizeof(orientation_str), "%s \"%s\"", + IFACE_("custom orientation"), t->custom_orientation->name); + BLI_snprintf(text, sizeof(text), ftext, orientation_str); setConstraint(t, t->spacemtx, mode, text); break; + } } t->con.orientation = orientation; |