diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-12 17:16:11 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-12 17:16:11 +0400 |
commit | 127c39b8a44df962b1ac20578497b387319efe87 (patch) | |
tree | 7f928e590060350708d4160b1637994ca758c025 /source/blender/editors/transform | |
parent | 5fcf9b1d2fe94798178beeea8e31f54faac31414 (diff) |
Fix for [#35224] Transform Orientation - order inconsistency
Fix turned out to remove as much "manual UI" from 3D view header as possible. Mode selector and all transform manipulators/orientations stuff are now RNA-based UI (leaving basically only edit mesh select modes with custom handlers, as they have some quite specific features).
To achieve this, four main modifications were done:
* enum-operator-generated menus are now MENU (i.e. dropdown lists) in headers too.
* All bit-flag enums expanded in ROW buttons now have a handling consistent with e.g. layers, or what we already have for transform manipulators, i.e. clicking select only one element, shift-click to select multiple ones.
* Consequently, the three RNA booleans manipulators flags are merged into a single bit-flag enum (yes, this is also an API change, though I doubt many scripts use it).
* Now the width of enum-based dropdown lists is computed from longest item name in enum, no more from a dummy place holder string (when no label/name is given).
All this allows to remove some code from 3DView/transform areas, that was actually mostly duplicating RNA/operator one.
Also done a few optimizations here and there (among others, do not pass &numitems to RNA_property_enum_items() when you do not need it, saves at least an iteration over enum items to count them).
Many thanks to Brecht for the reviews!
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.c | 29 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 69 |
2 files changed, 1 insertions, 97 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index dedf4d30f70..d440dc1fe9e 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -589,20 +589,6 @@ static void viewRedrawPost(bContext *C, TransInfo *t) /* ************************** TRANSFORMATIONS **************************** */ -void BIF_selectOrientation(void) -{ -#if 0 // TRANSFORM_FIX_ME - short val; - char *str_menu = BIF_menustringTransformOrientation("Orientation"); - val = pupmenu(str_menu); - MEM_freeN(str_menu); - - if (val >= 0) { - G.vd->twmode = val; - } -#endif -} - static void view_editmove(unsigned short UNUSED(event)) { #if 0 // TRANSFORM_FIX_ME @@ -1164,20 +1150,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) break; case SPACEKEY: - if ((t->spacetype == SPACE_VIEW3D) && event->alt) { -#if 0 // TRANSFORM_FIX_ME - int mval[2]; - - getmouseco_sc(mval); - BIF_selectOrientation(); - calc_manipulator_stats(curarea); - copy_m3_m4(t->spacemtx, G.vd->twmat); - warp_pointer(mval[0], mval[1]); -#endif - } - else { - t->state = TRANS_CONFIRM; - } + t->state = TRANS_CONFIRM; break; case MIDDLEMOUSE: diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 6090c2f2700..343592d4501 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -359,75 +359,6 @@ void BIF_selectTransformOrientationValue(bContext *C, int orientation) v3d->twmode = orientation; } -EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) -{ - Scene *scene; - ListBase *transform_spaces; - TransformOrientation *ts = NULL; - - EnumPropertyItem global = {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""}; - EnumPropertyItem normal = {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""}; - EnumPropertyItem local = {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""}; - EnumPropertyItem view = {V3D_MANIP_VIEW, "VIEW", 0, "View", ""}; - EnumPropertyItem tmp = {0, "", 0, "", ""}; - EnumPropertyItem *item = NULL; - int i = V3D_MANIP_CUSTOM, totitem = 0; - - RNA_enum_item_add(&item, &totitem, &global); - RNA_enum_item_add(&item, &totitem, &normal); - RNA_enum_item_add(&item, &totitem, &local); - RNA_enum_item_add(&item, &totitem, &view); - - if (C) { - scene = CTX_data_scene(C); - - if (scene) { - transform_spaces = &scene->transform_spaces; - ts = transform_spaces->first; - } - } - - if (ts) - RNA_enum_item_add_separator(&item, &totitem); - - for (; ts; ts = ts->next) { - tmp.identifier = "CUSTOM"; - tmp.name = ts->name; - tmp.value = i++; - RNA_enum_item_add(&item, &totitem, &tmp); - } - - RNA_enum_item_end(&item, &totitem); - - return item; -} - -const char *BIF_menustringTransformOrientation(const bContext *C, const char *title) -{ - const char *menu = IFACE_("%t|Global %x0|Local %x1|Gimbal %x4|Normal %x2|View %x3"); - ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; - TransformOrientation *ts; - int i = V3D_MANIP_CUSTOM; - char *str_menu, *p; - const int elem_size = MAX_NAME + 4; - size_t str_menu_size; - - title = IFACE_(title); - - str_menu_size = strlen(menu) + strlen(title) + 1 + (elem_size * BIF_countTransformOrientation(C)); - str_menu = MEM_callocN(str_menu_size, "UserTransSpace from matrix"); - - p = str_menu; - p += BLI_strncpy_rlen(p, title, str_menu_size); - p += BLI_strncpy_rlen(p, menu, str_menu_size - (p - str_menu)); - - for (ts = transform_spaces->first; ts; ts = ts->next) { - p += sprintf(p, "|%s %%x%d", ts->name, i++); - } - - return str_menu; -} - int BIF_countTransformOrientation(const bContext *C) { ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; |