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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-01-17 02:40:14 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2004-01-17 02:40:14 +0300
commitf3c5206b717a9b2d6b78344e92277f6f58f24229 (patch)
tree6b0f3d73370366946eb8b5741c53355d68d8af0a /source/blender/src
parent24c43b835d48de0c02ced5160d0d0831bc5cb55e (diff)
Scripts menus:
-- added re-eval entry to Scripts Win -> Scripts menu -- added it also as a button at Info Win -> File Paths, Python path -- updated bpymenus code: added 'Blender' tag, for version; made a .Bpymenus file be written only if there's actual data to save made file->export menu open a scriptspace only if none is available already -- bug fixes (bugs 866 and 879, related) for linking and sharing mesh data: http://projects.blender.org/tracker/?func=detail&atid=125&aid=866&group_id=9 http://projects.blender.org/tracker/?func=detail&atid=125&aid=879&group_id=9
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/header_info.c3
-rw-r--r--source/blender/src/header_script.c25
-rw-r--r--source/blender/src/headerbuttons.c6
-rw-r--r--source/blender/src/space.c7
4 files changed, 37 insertions, 4 deletions
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index 1bb54d696fa..631258ccc16 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -700,7 +700,8 @@ static void do_info_file_exportmenu(void *arg, int event)
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
+ sa= find_biggest_area_of_type(SPACE_SCRIPT);
+ if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c
index a56cede0746..3c97575e528 100644
--- a/source/blender/src/header_script.c
+++ b/source/blender/src/header_script.c
@@ -114,6 +114,27 @@ static uiBlock *script_scripts_submenus(void *int_menutype)
return block;
}
+static void do_script_scriptsmenu(void *arg, int event)
+{
+ ScrArea *sa;
+ char dir[FILE_MAXDIR];
+
+ if(curarea->spacetype==SPACE_INFO) {
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+ }
+
+ /* these are no defines, easier this way, the codes are in the function below */
+ switch(event) {
+ case 0: /* update menus */
+ BPyMenu_RemoveAllEntries();
+ if (BPyMenu_Init(1) == -1) error("Invalid scripts dir: check console");
+ break;
+ }
+
+// allqueue(REDRAWSCRIPT, 0);
+}
+
/* Scripts menu */
static uiBlock *script_scriptsmenu(void *arg_unused)
{
@@ -124,12 +145,14 @@ static uiBlock *script_scriptsmenu(void *arg_unused)
int i;
block= uiNewBlock(&curarea->uiblocks, "script_scriptsmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- //uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
+ uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
for (i = 0; i < PYMENU_TOTAL; i++) {
uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, "");
}
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Update Menus", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "Use when you modify the scripts dir or its contents");
+
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 7057dd11445..ef3d78deab9 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -168,6 +168,7 @@
#include "BDR_editmball.h"
#include "BPY_extern.h"
+#include "BPY_menus.h"
#include "mydevice.h"
#include "blendef.h"
@@ -1502,6 +1503,11 @@ void do_global_buttons(unsigned short event)
activate_fileselect(FILE_SPECIAL, "SELECT RENDER PATH", U.renderdir, filesel_u_renderdir);
break;
+ case B_PYMENUEVAL: /* is button from space.c *info* */
+ BPyMenu_RemoveAllEntries(); /* free old data */
+ if (BPyMenu_Init(1) == -1) /* re-eval scripts registration in menus */
+ error("Invalid scripts dir: check console");
+ break;
case B_PYTHONDIRFILESEL: /* is button from space.c *info* */
if(curarea->spacetype==SPACE_INFO) {
sa= closest_bigger_area();
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index f0565357ad1..4d89b93ecde 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -1929,7 +1929,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
medprefbut = 193; /* standard size for medium preferences button */
largeprefbut = 292; /* standard size for large preferences button */
smfileselbut = buth; /* standard size for fileselect button (square) */
-
+
edgespace = 3; /* space from edge of end 'tab' to edge of end button */
midspace = 5; /* horizontal space between buttons */
@@ -2474,8 +2474,11 @@ void drawinfospace(ScrArea *sa, void *spacedata)
0, 0, 0, 0, 0, "Select the default render output location");
uiDefBut(block, TEX, 0, "Python: ",
- (xpos+edgespace+largeprefbut+midspace),y1,(largeprefbut-smfileselbut),buth,
+ (xpos+edgespace+largeprefbut+midspace),y1,(largeprefbut-2*smfileselbut),buth,
U.pythondir, 1.0, 63.0, 0, 0, "The default directory to search for Python scripts");
+ uiDefIconBut(block, BUT, B_PYMENUEVAL, ICON_SCRIPT,
+ (xpos+edgespace+(2*largeprefbut)+midspace-2*smfileselbut),y1,smfileselbut,buth,
+ 0, 0, 0, 0, 0, "Re-evaluate scripts registration in menus");
uiDefIconBut(block, BUT, B_PYTHONDIRFILESEL, ICON_FILESEL,
(xpos+edgespace+(2*largeprefbut)+midspace-smfileselbut),y1,smfileselbut,buth,
0, 0, 0, 0, 0, "Select the default Python script location");