Script menus:
-- new try so that scripts place their guis and file selectors in proper places:
should be ok now for any but the really weirdest screen layouts, will be updated when scripts are added to other menus in the interface.
This commit is contained in:
@@ -612,23 +612,35 @@ int BPY_menu_do_python(short menutype, int event)
|
||||
if (G.obedit) exit_editmode(1);
|
||||
|
||||
/* let's find a proper area for an eventual script gui:
|
||||
* preference in order: Script, Buttons (if not a Wizards or Utils script),
|
||||
* Text, any closest bigger area */
|
||||
if (curarea->spacetype != SPACE_SCRIPT) {
|
||||
ScrArea *sa;
|
||||
* (still experimenting here, need definition on which win
|
||||
* each group will be put to code this properly) */
|
||||
switch (menutype) {
|
||||
|
||||
sa = find_biggest_area_of_type(SPACE_SCRIPT);
|
||||
case PYMENU_IMPORT: /* first 3 were handled in header_info.c */
|
||||
case PYMENU_EXPORT:
|
||||
case PYMENU_HELP:
|
||||
case PYMENU_WIZARDS:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (curarea->spacetype != SPACE_SCRIPT) {
|
||||
ScrArea *sa = NULL;
|
||||
|
||||
if (!sa) {
|
||||
if ((menutype != PYMENU_WIZARDS) && (menutype != PYMENU_UTILS))
|
||||
sa = find_biggest_area_of_type(SPACE_BUTS);
|
||||
}
|
||||
if (sa) {
|
||||
if ((1.5 * sa->winx) < sa->winy) sa = NULL; /* too narrow? */
|
||||
}
|
||||
|
||||
if (!sa) sa = find_biggest_area_of_type(SPACE_TEXT);
|
||||
if (!sa) sa = find_biggest_area_of_type(SPACE_SCRIPT);
|
||||
if (!sa) sa = find_biggest_area_of_type(SPACE_TEXT);
|
||||
if (!sa) sa = find_biggest_area_of_type(SPACE_IMAGE); /* group UV */
|
||||
if (!sa) sa = find_biggest_area_of_type(SPACE_VIEW3D);
|
||||
|
||||
if (!sa) sa = closest_bigger_area();
|
||||
if (!sa) sa = find_biggest_area();
|
||||
|
||||
areawinset(sa->win);
|
||||
areawinset(sa->win);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
script->id.us = 1;
|
||||
|
||||
@@ -84,7 +84,6 @@ static int bpymenu_group_atoi (char *str)
|
||||
else if (!strcmp(str, "Animation")) return PYMENU_ANIMATION;
|
||||
else if (!strcmp(str, "Materials")) return PYMENU_MATERIALS;
|
||||
else if (!strcmp(str, "UV")) return PYMENU_UV;
|
||||
else if (!strcmp(str, "Utils")) return PYMENU_UTILS;
|
||||
else if (!strcmp(str, "Tools")) return PYMENU_TOOLS;
|
||||
/* "Misc" or an inexistent group name: use misc */
|
||||
else return PYMENU_MISC;
|
||||
@@ -120,9 +119,6 @@ char *BPyMenu_group_itoa (short menugroup)
|
||||
case PYMENU_UV:
|
||||
return "UV";
|
||||
break;
|
||||
case PYMENU_UTILS:
|
||||
return "Utils";
|
||||
break;
|
||||
case PYMENU_TOOLS:
|
||||
return "Tools";
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,6 @@ typedef struct BPyMenu {
|
||||
typedef enum {
|
||||
PYMENU_WIZARDS, /* complex 'app' scripts */
|
||||
PYMENU_UV, /* UV editing tools, to go in UV/Image editor space, 'UV' menu */
|
||||
PYMENU_UTILS,
|
||||
PYMENU_TOOLS,
|
||||
PYMENU_MODIFIERS, /* modifies existing obj *data* */
|
||||
PYMENU_MISC,
|
||||
|
||||
Reference in New Issue
Block a user