Blender Git Commit Log
Git Commits -> Revision 09fb5d6
Revision 09fb5d6 by Willian Padovani Germano (master) May 8, 2005, 21:20 (GMT) |
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. |
Commit Details:
Full Hash: 09fb5d6b8d1aafc66d33bded48b149105be41675
SVN Revision: 4396
Parent Commit: 8077caa
Lines Changed: +820, -131
36 Modified Paths:
/source/blender/blenkernel/bad_level_call_stubs/stubs.c (+1, -0) (Diff)
/source/blender/blenkernel/BKE_bad_level_calls.h (+3, -0) (Diff)
/source/blender/blenkernel/BKE_global.h (+1, -1) (Diff)
/source/blender/blenkernel/intern/blender.c (+4, -5) (Diff)
/source/blender/blenkernel/intern/object.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/scene.c (+3, -1) (Diff)
/source/blender/blenkernel/intern/screen.c (+2, -1) (Diff)
/source/blender/blenkernel/intern/text.c (+2, -1) (Diff)
/source/blender/blenloader/intern/readfile.c (+6, -1) (Diff)
/source/blender/blenloader/intern/writefile.c (+3, -0) (Diff)
/source/blender/makesdna/DNA_screen_types.h (+2, -0) (Diff)
/source/blender/makesdna/DNA_scriptlink_types.h (+14, -2) (Diff)
/source/blender/makesdna/DNA_text_types.h (+2, -2) (Diff)
/source/blender/python/api2_2x/Blender.c (+13, -1) (Diff)
/source/blender/python/api2_2x/doc/API_intro.py (+6, -5) (Diff)
/source/blender/python/api2_2x/doc/API_related.py (+149, -8) (Diff)
/source/blender/python/api2_2x/doc/Blender.py (+22, -8) (Diff)
/source/blender/python/api2_2x/doc/Draw.py (+3, -1) (Diff)
/source/blender/python/api2_2x/doc/Theme.py (+3, -0) (Diff)
/source/blender/python/api2_2x/Draw.c (+18, -4) (Diff)
/source/blender/python/api2_2x/Draw.h (+1, -1) (Diff)
/source/blender/python/api2_2x/gen_utils.c (+8, -0) (Diff)
/source/blender/python/api2_2x/Window.c (+1, -0) (Diff)
/source/blender/python/api2_2x/windowTheme.c (+26, -3) (Diff)
/source/blender/python/BPY_extern.h (+29, -18) (Diff)
/source/blender/python/BPY_interface.c (+272, -1) (Diff)
/source/blender/renderconverter/intern/convertBlenderScene.c (+1, -1) (Diff)
/source/blender/src/buttons_script.c (+95, -50) (Diff)
/source/blender/src/drawscript.c (+2, -1) (Diff)
/source/blender/src/drawview.c (+7, -3) (Diff)
/source/blender/src/headerbuttons.c (+1, -1) (Diff)
/source/blender/src/header_view3d.c (+92, -0) (Diff)
/source/blender/src/renderwin.c (+14, -0) (Diff)
/source/blender/src/space.c (+7, -2) (Diff)
/source/blender/src/usiblender.c (+2, -4) (Diff)
/source/creator/creator.c (+4, -4) (Diff)
/source/blender/blenkernel/BKE_bad_level_calls.h (+3, -0) (Diff)
/source/blender/blenkernel/BKE_global.h (+1, -1) (Diff)
/source/blender/blenkernel/intern/blender.c (+4, -5) (Diff)
/source/blender/blenkernel/intern/object.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/scene.c (+3, -1) (Diff)
/source/blender/blenkernel/intern/screen.c (+2, -1) (Diff)
/source/blender/blenkernel/intern/text.c (+2, -1) (Diff)
/source/blender/blenloader/intern/readfile.c (+6, -1) (Diff)
/source/blender/blenloader/intern/writefile.c (+3, -0) (Diff)
/source/blender/makesdna/DNA_screen_types.h (+2, -0) (Diff)
/source/blender/makesdna/DNA_scriptlink_types.h (+14, -2) (Diff)
/source/blender/makesdna/DNA_text_types.h (+2, -2) (Diff)
/source/blender/python/api2_2x/Blender.c (+13, -1) (Diff)
/source/blender/python/api2_2x/doc/API_intro.py (+6, -5) (Diff)
/source/blender/python/api2_2x/doc/API_related.py (+149, -8) (Diff)
/source/blender/python/api2_2x/doc/Blender.py (+22, -8) (Diff)
/source/blender/python/api2_2x/doc/Draw.py (+3, -1) (Diff)
/source/blender/python/api2_2x/doc/Theme.py (+3, -0) (Diff)
/source/blender/python/api2_2x/Draw.c (+18, -4) (Diff)
/source/blender/python/api2_2x/Draw.h (+1, -1) (Diff)
/source/blender/python/api2_2x/gen_utils.c (+8, -0) (Diff)
/source/blender/python/api2_2x/Window.c (+1, -0) (Diff)
/source/blender/python/api2_2x/windowTheme.c (+26, -3) (Diff)
/source/blender/python/BPY_extern.h (+29, -18) (Diff)
/source/blender/python/BPY_interface.c (+272, -1) (Diff)
/source/blender/renderconverter/intern/convertBlenderScene.c (+1, -1) (Diff)
/source/blender/src/buttons_script.c (+95, -50) (Diff)
/source/blender/src/drawscript.c (+2, -1) (Diff)
/source/blender/src/drawview.c (+7, -3) (Diff)
/source/blender/src/headerbuttons.c (+1, -1) (Diff)
/source/blender/src/header_view3d.c (+92, -0) (Diff)
/source/blender/src/renderwin.c (+14, -0) (Diff)
/source/blender/src/space.c (+7, -2) (Diff)
/source/blender/src/usiblender.c (+2, -4) (Diff)
/source/creator/creator.c (+4, -4) (Diff)