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-07-03 21:28:15 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-07-03 21:28:15 +0400
commitcbe7471905bd6f34c00b5d1b6b9cde84f3f24cb4 (patch)
treee0a028d26d3cb6939c1ea396242d6f739fe124b0 /source/blender/src/header_view3d.c
parent5c543698c9fd5377aee5630ed22a87921593a3ad (diff)
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus. Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change. - added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button. BPython: - added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course. - updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh. - doc updates, minor fixes. Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
Diffstat (limited to 'source/blender/src/header_view3d.c')
-rw-r--r--source/blender/src/header_view3d.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index faf2b777c13..aaf063d28d1 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -104,6 +104,9 @@
#include "BIF_toolbox.h"
#include "BIF_gl.h"
+#include "BPY_extern.h"
+#include "BPY_menus.h"
+
#include "blendef.h"
#include "mydevice.h"
#include "butspace.h"
@@ -1628,6 +1631,35 @@ static uiBlock *view3d_edit_object_trackmenu(void *arg_unused)
return block;
}
+static void do_view3d_edit_object_scriptsmenu(void *arg, int event)
+{
+ BPY_menu_do_python(PYMENU_OBJECT, event);
+
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static uiBlock *view3d_edit_object_scriptsmenu(void *arg_unused)
+{
+ uiBlock *block;
+ short yco = 20, menuwidth = 120;
+ BPyMenu *pym;
+ int i = 0;
+
+ block= uiNewBlock(&curarea->uiblocks, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetButmFunc(block, do_view3d_edit_object_scriptsmenu, NULL);
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ for (pym = BPyMenuTable[PYMENU_OBJECT]; pym; pym = pym->next, i++) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
+ }
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 60);
+
+ return block;
+}
+
static void do_view3d_edit_objectmenu(void *arg, int event)
{
/* needed to check for valid selected objects */
@@ -1731,6 +1763,9 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
+
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
@@ -2103,6 +2138,35 @@ static uiBlock *view3d_edit_mesh_showhidemenu(void *arg_unused)
return block;
}
+static void do_view3d_edit_mesh_scriptsmenu(void *arg, int event)
+{
+ BPY_menu_do_python(PYMENU_MESH, event);
+
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static uiBlock *view3d_edit_mesh_scriptsmenu(void *arg_unused)
+{
+ uiBlock *block;
+ short yco = 20, menuwidth = 120;
+ BPyMenu *pym;
+ int i = 0;
+
+ block= uiNewBlock(&curarea->uiblocks, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetButmFunc(block, do_view3d_edit_mesh_scriptsmenu, NULL);
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ for (pym = BPyMenuTable[PYMENU_MESH]; pym; pym = pym->next, i++) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
+ }
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 60);
+
+ return block;
+}
+
static void do_view3d_edit_meshmenu(void *arg, int event)
{
switch(event) {
@@ -2206,6 +2270,9 @@ static uiBlock *view3d_edit_meshmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBlockBut(block, view3d_edit_mesh_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Vertices", 0, yco-=20, 120, 19, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);