2004-01-14 21:36:10 +00:00
|
|
|
/*
|
2004-10-07 19:25:40 +00:00
|
|
|
* $Id$
|
2004-01-14 21:36:10 +00:00
|
|
|
*
|
|
|
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version. The Blender
|
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
|
|
|
* about this.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This is a new part of Blender.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Willian P. Germano
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef BPY_MENUS_H
|
|
|
|
|
#define BPY_MENUS_H
|
|
|
|
|
|
|
|
|
|
/* This header exposes BPyMenu related public declarations. The implementation
|
|
|
|
|
* adds 'dynamic' menus to Blender, letting scripts register themselves in any
|
|
|
|
|
* of a few pre-defined (trivial to upgrade) places in menus. These places or
|
|
|
|
|
* slots are called groups here (Import, Export, etc). This is how it works:
|
2004-05-22 20:25:22 +00:00
|
|
|
* - scripts at dirs user pref U.pythondir and .blender/scripts/ are scanned
|
|
|
|
|
* for registration info.
|
2005-03-21 05:26:52 +00:00
|
|
|
* - this data is also saved to a Bpymenus file at the user's .blender/ dir and
|
2004-01-14 21:36:10 +00:00
|
|
|
* only re-created when the scripts folder gets modified.
|
|
|
|
|
* - on start-up Blender uses this info to fill a table, which is used to
|
|
|
|
|
* create the menu entries when they are needed (see header_info.c or
|
|
|
|
|
* header_script.c, under source/blender/src/, for examples).
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* These two structs hold py menu/submenu info.
|
|
|
|
|
* BPyMenu holds a script's name (as should appear in the menu) and filename,
|
|
|
|
|
* plus an optional list of submenus. Each submenu is related to a string
|
|
|
|
|
* (arg) that the script can get from the __script__ pydict, to know which
|
|
|
|
|
* submenu was chosen. */
|
|
|
|
|
|
|
|
|
|
typedef struct BPySubMenu {
|
|
|
|
|
char *name;
|
|
|
|
|
char *arg;
|
|
|
|
|
struct BPySubMenu *next;
|
|
|
|
|
} BPySubMenu;
|
|
|
|
|
|
|
|
|
|
typedef struct BPyMenu {
|
|
|
|
|
char *name;
|
|
|
|
|
char *filename;
|
|
|
|
|
char *tooltip;
|
2004-10-07 19:25:40 +00:00
|
|
|
short version; /* Blender version */
|
|
|
|
|
int dir; /* 0: default, 1: U.pythondir */
|
2004-01-14 21:36:10 +00:00
|
|
|
struct BPySubMenu *submenus;
|
|
|
|
|
struct BPyMenu *next;
|
|
|
|
|
} BPyMenu;
|
|
|
|
|
|
|
|
|
|
/* Scripts can be added to only a few pre-defined places in menus, like
|
|
|
|
|
* File->Import, File->Export, etc. (for speed and better control).
|
|
|
|
|
* To make a new menu 'slot' available for scripts:
|
2004-06-21 12:01:23 +00:00
|
|
|
* - add an entry to the enum below, before PYMENU_TOTAL, of course;
|
2004-01-14 21:36:10 +00:00
|
|
|
* - update the bpymenu_group_atoi() and BPyMenu_group_itoa() functions in
|
|
|
|
|
* BPY_menus.c;
|
|
|
|
|
* - add the necessary code to the header_***.c file in
|
|
|
|
|
* source/blender/src/, like done in header_info.c for import/export;
|
2004-10-07 19:25:40 +00:00
|
|
|
*/
|
2004-01-14 21:36:10 +00:00
|
|
|
typedef enum {
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
PYMENU_ADD,/* creates new objects */
|
2004-05-22 20:25:22 +00:00
|
|
|
PYMENU_ANIMATION,
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
PYMENU_EXPORT,
|
|
|
|
|
PYMENU_IMPORT,
|
|
|
|
|
PYMENU_MATERIALS,
|
|
|
|
|
PYMENU_MESH,
|
|
|
|
|
PYMENU_MISC,
|
|
|
|
|
PYMENU_OBJECT,
|
|
|
|
|
PYMENU_RENDER,/* exporters to external renderers */
|
|
|
|
|
PYMENU_THEMES,
|
|
|
|
|
PYMENU_UV,/* UV editing tools, to go in UV/Image editor space, 'UV' menu */
|
|
|
|
|
PYMENU_WIZARDS,/* complex 'app' scripts */
|
|
|
|
|
|
2005-03-21 05:26:52 +00:00
|
|
|
/* entries put after Wizards don't appear at the Scripts win->Scripts menu;
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
* see define right below */
|
|
|
|
|
|
|
|
|
|
PYMENU_FACESELECT,
|
|
|
|
|
PYMENU_HELP,/*Main Help menu items - prob best to leave for 'official' ones*/
|
|
|
|
|
PYMENU_HELPSYSTEM,/* Resources, troubleshooting, system tools */
|
|
|
|
|
PYMENU_HELPWEBSITES,/* Help -> Websites submenu */
|
|
|
|
|
|
2004-01-14 21:36:10 +00:00
|
|
|
PYMENU_TOTAL
|
|
|
|
|
} PYMENUHOOKS;
|
|
|
|
|
|
2005-03-21 05:26:52 +00:00
|
|
|
#define PYMENU_SCRIPTS_MENU_TOTAL (PYMENU_WIZARDS + 1)
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
2004-01-14 21:36:10 +00:00
|
|
|
/* BPyMenuTable holds all registered pymenus, as linked lists for each menu
|
|
|
|
|
* where they can appear (see PYMENUHOOKS enum above).
|
|
|
|
|
*/
|
2004-10-07 19:25:40 +00:00
|
|
|
extern BPyMenu *BPyMenuTable[]; /* defined in BPY_menus.c */
|
2004-01-14 21:36:10 +00:00
|
|
|
|
|
|
|
|
/* public functions: */
|
2004-10-07 19:25:40 +00:00
|
|
|
int BPyMenu_Init( int usedir );
|
|
|
|
|
void BPyMenu_RemoveAllEntries( void );
|
|
|
|
|
void BPyMenu_PrintAllEntries( void );
|
|
|
|
|
char *BPyMenu_CreatePupmenuStr( BPyMenu * pym, short group );
|
|
|
|
|
char *BPyMenu_group_itoa( short group );
|
|
|
|
|
struct BPyMenu *BPyMenu_GetEntry( short group, short pos );
|
2004-01-14 21:36:10 +00:00
|
|
|
|
2004-10-07 19:25:40 +00:00
|
|
|
#endif /* BPY_MENUS_H */
|