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>2005-05-09 01:20:34 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2005-05-09 01:20:34 +0400
commit09fb5d6b8d1aafc66d33bded48b149105be41675 (patch)
treeb609f8ab8b109fc26db4c23a5557cc0e8327f454 /source/blender/python/BPY_extern.h
parent8077caa96ec59aac67ff597ff3c96c23fb71b046 (diff)
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None). - Updated Window and Window.Theme with new theme vars and the Time space. - Script links: -- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered. -- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only. -- Other small changes in the script buttons tab: When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it. Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name. -- Implemented Ton's space handler script links: Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender. Here's how it works: - scripts must have a proper header, like: # SPACEHANDLER.VIEW3D.EVENT and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active. EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module: import Blender from Blender import Draw evt = Blender.event if evt == Draw.AKEY: print "a" elif evt == Draw.LEFTMOUSE: print "left mouse button" else: return # ignore, pass event back to Blender Blender.event = None # tell Blender not to process itself the event DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes. To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always. Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine. - doc updates about the additions. ======= Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
Diffstat (limited to 'source/blender/python/BPY_extern.h')
-rw-r--r--source/blender/python/BPY_extern.h47
1 files changed, 29 insertions, 18 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index dbf464de019..97e8819c77a 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -23,7 +23,7 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * The Original Code is: source/blender/bpyton/include/BPY_extern.h
+ * The Original Code was in: source/blender/bpython/include/BPY_extern.h
*
* Contributor(s): Michel Selten, Willian P. Germano, Chris Keith
*
@@ -32,16 +32,16 @@
extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
-struct Text; /* defined in DNA_text_types.h */
-struct ID; /* defined in DNA_ID.h */
-struct ScriptLink; /* defined in DNA_scriptlink_types.h */
-struct ListBase; /* defined in DNA_listBase.h */
-struct SpaceText; /* defined in DNA_space_types.h */
-struct SpaceScript; /* defined in DNA_space_types.h */
-struct Script; /* defined in BPI_script.h */
-/*
-struct _object; // forward declaration for PyObject !
-*/
+struct Text; /* defined in DNA_text_types.h */
+struct ID; /* DNA_ID.h */
+struct ScriptLink; /* DNA_scriptlink_types.h */
+struct ListBase; /* DNA_listBase.h */
+struct SpaceText; /* DNA_space_types.h */
+struct SpaceScript; /* DNA_space_types.h */
+struct Script; /* BPI_script.h */
+struct ScrArea; /* DNA_screen_types.h */
+struct bScreen; /* DNA_screen_types.h */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,16 +49,18 @@ extern "C" {
void BPY_start_python( int argc, char **argv );
void BPY_end_python( void );
void BPY_post_start_python( void );
+ void init_syspath( int first_time );
+ void syspath_append( char *dir );
+
int BPY_Err_getLinenumber( void );
const char *BPY_Err_getFilename( void );
-/* void BPY_Err_Handle(struct Text *text); */
+
int BPY_txt_do_python_Text( struct Text *text );
int BPY_menu_do_python( short menutype, int event );
void BPY_run_python_script( char *filename );
void BPY_free_compiled_text( struct Text *text );
-/*void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */
+
void BPY_clear_bad_scriptlinks( struct Text *byebye );
-/*void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */
int BPY_has_onload_script( void );
void BPY_do_all_scripts( short event );
int BPY_check_all_scriptlinks( struct Text *text );
@@ -66,18 +68,27 @@ extern "C" {
void BPY_free_scriptlink( struct ScriptLink *slink );
void BPY_copy_scriptlink( struct ScriptLink *scriptlink );
+ int BPY_is_spacehandler(struct Text *text, char spacetype);
+ int BPY_del_spacehandler(struct Text *text, struct ScrArea *sa);
+ int BPY_add_spacehandler(struct Text *txt, struct ScrArea *sa,char spacetype);
+ int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa);
+ void BPY_screen_free_spacehandlers(struct bScreen *sc);
+ int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event,
+ unsigned short space_event);
+
/* format importer hook */
int BPY_call_importloader( char *name );
-//int BPY_spacetext_is_pywin(struct SpaceText *st);
void BPY_spacescript_do_pywin_draw( struct SpaceScript *sc );
void BPY_spacescript_do_pywin_event( struct SpaceScript *sc,
- unsigned short event, short val );
+ unsigned short event, short val, char ascii );
void BPY_clear_script( struct Script *script );
void BPY_free_finished_script( struct Script *script );
- void init_syspath( int first_time );
- void syspath_append( char *dir );
+/* void BPY_Err_Handle(struct Text *text); */
+/* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */
+/* void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */
+/* int BPY_spacetext_is_pywin(struct SpaceText *st); */
#ifdef __cplusplus
} /* extern "C" */