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,24 +612,36 @@ int BPY_menu_do_python(short menutype, int event)
|
|||||||
if (G.obedit) exit_editmode(1);
|
if (G.obedit) exit_editmode(1);
|
||||||
|
|
||||||
/* let's find a proper area for an eventual script gui:
|
/* let's find a proper area for an eventual script gui:
|
||||||
* preference in order: Script, Buttons (if not a Wizards or Utils script),
|
* (still experimenting here, need definition on which win
|
||||||
* Text, any closest bigger area */
|
* each group will be put to code this properly) */
|
||||||
|
switch (menutype) {
|
||||||
|
|
||||||
|
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) {
|
if (curarea->spacetype != SPACE_SCRIPT) {
|
||||||
ScrArea *sa;
|
ScrArea *sa = NULL;
|
||||||
|
|
||||||
sa = find_biggest_area_of_type(SPACE_SCRIPT);
|
|
||||||
|
|
||||||
if (!sa) {
|
|
||||||
if ((menutype != PYMENU_WIZARDS) && (menutype != PYMENU_UTILS))
|
|
||||||
sa = find_biggest_area_of_type(SPACE_BUTS);
|
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_SCRIPT);
|
||||||
if (!sa) sa = find_biggest_area_of_type(SPACE_TEXT);
|
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;
|
script->id.us = 1;
|
||||||
script->flags = SCRIPT_RUNNING;
|
script->flags = SCRIPT_RUNNING;
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ static int bpymenu_group_atoi (char *str)
|
|||||||
else if (!strcmp(str, "Animation")) return PYMENU_ANIMATION;
|
else if (!strcmp(str, "Animation")) return PYMENU_ANIMATION;
|
||||||
else if (!strcmp(str, "Materials")) return PYMENU_MATERIALS;
|
else if (!strcmp(str, "Materials")) return PYMENU_MATERIALS;
|
||||||
else if (!strcmp(str, "UV")) return PYMENU_UV;
|
else if (!strcmp(str, "UV")) return PYMENU_UV;
|
||||||
else if (!strcmp(str, "Utils")) return PYMENU_UTILS;
|
|
||||||
else if (!strcmp(str, "Tools")) return PYMENU_TOOLS;
|
else if (!strcmp(str, "Tools")) return PYMENU_TOOLS;
|
||||||
/* "Misc" or an inexistent group name: use misc */
|
/* "Misc" or an inexistent group name: use misc */
|
||||||
else return PYMENU_MISC;
|
else return PYMENU_MISC;
|
||||||
@@ -120,9 +119,6 @@ char *BPyMenu_group_itoa (short menugroup)
|
|||||||
case PYMENU_UV:
|
case PYMENU_UV:
|
||||||
return "UV";
|
return "UV";
|
||||||
break;
|
break;
|
||||||
case PYMENU_UTILS:
|
|
||||||
return "Utils";
|
|
||||||
break;
|
|
||||||
case PYMENU_TOOLS:
|
case PYMENU_TOOLS:
|
||||||
return "Tools";
|
return "Tools";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ typedef struct BPyMenu {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
PYMENU_WIZARDS, /* complex 'app' scripts */
|
PYMENU_WIZARDS, /* complex 'app' scripts */
|
||||||
PYMENU_UV, /* UV editing tools, to go in UV/Image editor space, 'UV' menu */
|
PYMENU_UV, /* UV editing tools, to go in UV/Image editor space, 'UV' menu */
|
||||||
PYMENU_UTILS,
|
|
||||||
PYMENU_TOOLS,
|
PYMENU_TOOLS,
|
||||||
PYMENU_MODIFIERS, /* modifies existing obj *data* */
|
PYMENU_MODIFIERS, /* modifies existing obj *data* */
|
||||||
PYMENU_MISC,
|
PYMENU_MISC,
|
||||||
|
|||||||
Reference in New Issue
Block a user