tornavis/source
Willian Padovani Germano 09fb5d6b8d 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.
2005-05-08 21:20:34 +00:00
..
blender BPython: 2005-05-08 21:20:34 +00:00
creator BPython: 2005-05-08 21:20:34 +00:00
darwin Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/ 2005-04-16 18:25:42 +00:00
gameengine Added the docs & use Python booleans for physics reinstance. 2005-04-23 12:25:21 +00:00
icons - Revert to NaN makefiles 2004-01-05 00:06:11 +00:00
kernel Added #!/usr/bin/python standard script identifier to the start of SConscript files. 2004-05-16 13:07:20 +00:00
Makefile Moved sinclude for user-def.mk 2005-04-30 21:06:54 +00:00
SConscript Added #!/usr/bin/python standard script identifier to the start of SConscript files. 2004-05-16 13:07:20 +00:00
nan_compile.mk Uncommented a line in the FREE_WINDOWS section that appears to control the 2005-04-18 19:28:38 +00:00
nan_definitions.mk Moved sinclude for user-def.mk 2005-04-30 21:06:54 +00:00
nan_link.mk Support for SGI Prism: 2005-04-05 14:33:43 +00:00
nan_subdirs.mk Clean up for Makefiles: some of the directories were being printed 2005-04-09 22:40:34 +00:00
nan_warn.mk big warning hunt commit 2005-03-09 19:45:59 +00:00