Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-06-01 21:41:18 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-06-01 21:46:18 +0300
commit46fc0bb87ebda166d08b23cbcca799acb2c54158 (patch)
tree1566d535d93c4fb81b962cdbc1346ca8242460f2 /source/blender/blenkernel/intern/screen.c
parent7f564d74f9edaaa41ce27c6e854869096f70b4da (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/blenkernel/intern/screen.c')
-rw-r--r--source/blender/blenkernel/intern/screen.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index b1f8f574b7e..91d675535f3 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -53,6 +53,7 @@
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "BKE_screen.h"
+#include "BKE_workspace.h"
/* ************ Spacetype/regiontype handling ************** */
@@ -611,33 +612,20 @@ void BKE_screen_view3d_scene_sync(bScreen *sc, Scene *scene)
}
}
-/* XXX apply D2687 */
-void BKE_screen_view3d_twmode_remove(View3D *v3d, const int i)
+void BKE_screen_transform_orientation_remove(
+ const bScreen *screen, const WorkSpace *workspace, const TransformOrientation *orientation)
{
- const int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
- if (selected_index == i) {
- v3d->twmode = V3D_MANIP_GLOBAL;
- }
- else if (selected_index > i) {
- v3d->twmode--;
- }
-}
+ const int orientation_index = BKE_workspace_transform_orientation_get_index(workspace, orientation);
-/* XXX apply D2687 */
-void BKE_screen_view3d_main_twmode_remove(ListBase *screen_lb, Scene *scene, const int i)
-{
- bScreen *sc;
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
- for (sc = screen_lb->first; sc; sc = sc->id.next) {
- if (sc->scene == scene) {
- ScrArea *sa;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- SpaceLink *sl;
- for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- BKE_screen_view3d_twmode_remove(v3d, i);
- }
+ if (v3d->custom_orientation_index == orientation_index) {
+ /* could also use orientation_index-- */
+ v3d->twmode = V3D_MANIP_GLOBAL;
+ v3d->custom_orientation_index = -1;
}
}
}