2003-07-12 18:02:54 +00:00
|
|
|
# Blender.Draw module and the Button PyType object
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
The Blender.Draw submodule.
|
|
|
|
|
|
|
|
|
|
Draw
|
|
|
|
|
====
|
|
|
|
|
|
2005-05-20 05:14:03 +00:00
|
|
|
B{New}:
|
2005-10-11 15:11:39 +00:00
|
|
|
- access to ASCII values in L{events<Register>} callbacks;
|
2005-05-20 05:14:03 +00:00
|
|
|
- 'large' fonts for L{Text} and L{GetStringWidth}.
|
2006-01-08 18:59:55 +00:00
|
|
|
- Pop-up blocks with L{PupBlock}
|
2006-05-20 15:44:14 +00:00
|
|
|
- Color Picker button with L{ColorPicker}
|
2004-06-16 01:18:57 +00:00
|
|
|
|
2003-07-12 18:02:54 +00:00
|
|
|
This module provides access to a B{windowing interface} in Blender. Its widgets
|
|
|
|
|
include many kinds of buttons: push, toggle, menu, number, string, slider,
|
|
|
|
|
scrollbar, plus support for text drawing. It also includes keyboard keys and
|
2004-07-16 03:08:43 +00:00
|
|
|
mouse button code values in its dictionary, see a list after this example.
|
2003-07-12 18:02:54 +00:00
|
|
|
|
|
|
|
|
Example::
|
2004-01-28 19:16:50 +00:00
|
|
|
import Blender
|
|
|
|
|
from Blender import Draw, BGL
|
|
|
|
|
|
|
|
|
|
mystring = ""
|
|
|
|
|
mymsg = ""
|
|
|
|
|
toggle = 0
|
|
|
|
|
|
|
|
|
|
def event(evt, val): # the function to handle input events
|
|
|
|
|
global mystring, mymsg
|
|
|
|
|
|
|
|
|
|
if not val: # val = 0: it's a key/mbutton release
|
|
|
|
|
if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]:
|
|
|
|
|
mymsg = "You released a mouse button."
|
|
|
|
|
Draw.Redraw(1)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if evt == Draw.ESCKEY:
|
|
|
|
|
Draw.Exit() # exit when user presses ESC
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
elif Draw.AKEY <= evt <= Draw.ZKEY: mystring += chr(evt)
|
|
|
|
|
elif evt == Draw.SPACEKEY: mystring += ' '
|
|
|
|
|
elif evt == Draw.BACKSPACEKEY and len(mystring):
|
|
|
|
|
mystring = mystring[:-1]
|
|
|
|
|
else: return # no need to redraw if nothing changed
|
|
|
|
|
|
|
|
|
|
Draw.Redraw(1)
|
|
|
|
|
|
|
|
|
|
def button_event(evt): # the function to handle Draw Button events
|
|
|
|
|
global mymsg, toggle
|
|
|
|
|
if evt == 1:
|
|
|
|
|
mymsg = "You pressed the toggle button."
|
|
|
|
|
toggle = 1 - toggle
|
|
|
|
|
Draw.Redraw(1)
|
|
|
|
|
|
|
|
|
|
def gui(): # the function to draw the screen
|
|
|
|
|
global mystring, mymsg, toggle
|
|
|
|
|
if len(mystring) > 90: mystring = ""
|
|
|
|
|
BGL.glClearColor(0,0,1,1)
|
|
|
|
|
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
|
|
|
|
|
BGL.glColor3f(1,1,1)
|
|
|
|
|
Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
|
|
|
|
|
BGL.glRasterPos2i(72, 16)
|
|
|
|
|
if toggle: toggle_state = "down"
|
|
|
|
|
else: toggle_state = "up"
|
|
|
|
|
Draw.Text("The toggle button is %s." % toggle_state, "small")
|
|
|
|
|
BGL.glRasterPos2i(10, 230)
|
|
|
|
|
Draw.Text("Type letters from a to z, ESC to leave.")
|
|
|
|
|
BGL.glRasterPos2i(20, 200)
|
|
|
|
|
Draw.Text(mystring)
|
|
|
|
|
BGL.glColor3f(1,0.4,0.3)
|
|
|
|
|
BGL.glRasterPos2i(340, 70)
|
|
|
|
|
Draw.Text(mymsg, "tiny")
|
|
|
|
|
|
|
|
|
|
Draw.Register(gui, event, button_event) # registering the 3 callbacks
|
|
|
|
|
|
2004-07-16 03:08:43 +00:00
|
|
|
All available events:
|
|
|
|
|
- ACCENTGRAVEKEY
|
|
|
|
|
- AKEY
|
|
|
|
|
- BACKSLASHKEY
|
|
|
|
|
- BACKSPACEKEY
|
|
|
|
|
- BKEY
|
|
|
|
|
- CAPSLOCKKEY
|
|
|
|
|
- CKEY
|
|
|
|
|
- COMMAKEY
|
|
|
|
|
- DELKEY
|
|
|
|
|
- DKEY
|
|
|
|
|
- DOWNARROWKEY
|
|
|
|
|
- EIGHTKEY
|
|
|
|
|
- EKEY
|
|
|
|
|
- ENDKEY
|
|
|
|
|
- EQUALKEY
|
|
|
|
|
- ESCKEY
|
|
|
|
|
- F10KEY
|
|
|
|
|
- F11KEY
|
|
|
|
|
- F12KEY
|
|
|
|
|
- F1KEY
|
|
|
|
|
- F2KEY
|
|
|
|
|
- F3KEY
|
|
|
|
|
- F4KEY
|
|
|
|
|
- F5KEY
|
|
|
|
|
- F6KEY
|
|
|
|
|
- F7KEY
|
|
|
|
|
- F8KEY
|
|
|
|
|
- F9KEY
|
|
|
|
|
- FIVEKEY
|
|
|
|
|
- FKEY
|
|
|
|
|
- FOURKEY
|
|
|
|
|
- GKEY
|
|
|
|
|
- HKEY
|
|
|
|
|
- HOMEKEY
|
|
|
|
|
- IKEY
|
|
|
|
|
- INPUTCHANGE
|
|
|
|
|
- INSERTKEY
|
|
|
|
|
- JKEY
|
|
|
|
|
- KEYBD
|
|
|
|
|
- KKEY
|
|
|
|
|
- LEFTALTKEY
|
|
|
|
|
- LEFTARROWKEY
|
|
|
|
|
- LEFTBRACKETKEY
|
|
|
|
|
- LEFTCTRLKEY
|
|
|
|
|
- LEFTMOUSE
|
|
|
|
|
- LEFTSHIFTKEY
|
|
|
|
|
- LINEFEEDKEY
|
|
|
|
|
- LKEY
|
|
|
|
|
- MIDDLEMOUSE
|
|
|
|
|
- MINUSKEY
|
|
|
|
|
- MKEY
|
|
|
|
|
- MOUSEX
|
|
|
|
|
- MOUSEY
|
|
|
|
|
- NINEKEY
|
|
|
|
|
- NKEY
|
|
|
|
|
- OKEY
|
|
|
|
|
- ONEKEY
|
|
|
|
|
- PAD0
|
|
|
|
|
- PAD1
|
|
|
|
|
- PAD2
|
|
|
|
|
- PAD3
|
|
|
|
|
- PAD4
|
|
|
|
|
- PAD5
|
|
|
|
|
- PAD6
|
|
|
|
|
- PAD7
|
|
|
|
|
- PAD8
|
|
|
|
|
- PAD9
|
|
|
|
|
- PADASTERKEY
|
|
|
|
|
- PADENTER
|
|
|
|
|
- PADMINUS
|
|
|
|
|
- PADPERIOD
|
|
|
|
|
- PADPLUSKEY
|
|
|
|
|
- PADSLASHKEY
|
|
|
|
|
- PAGEDOWNKEY
|
|
|
|
|
- PAGEUPKEY
|
|
|
|
|
- PAUSEKEY
|
|
|
|
|
- PERIODKEY
|
|
|
|
|
- PKEY
|
|
|
|
|
- QFULL
|
|
|
|
|
- QKEY
|
|
|
|
|
- QUOTEKEY
|
|
|
|
|
- Q_FIRSTTIME
|
|
|
|
|
- RAWKEYBD
|
|
|
|
|
- REDRAW
|
|
|
|
|
- RETKEY
|
|
|
|
|
- RIGHTALTKEY
|
|
|
|
|
- RIGHTARROWKEY
|
|
|
|
|
- RIGHTBRACKETKEY
|
|
|
|
|
- RIGHTCTRLKEY
|
|
|
|
|
- RIGHTMOUSE
|
|
|
|
|
- RIGHTSHIFTKEY
|
|
|
|
|
- RKEY
|
|
|
|
|
- SEMICOLONKEY
|
|
|
|
|
- SEVENKEY
|
|
|
|
|
- SIXKEY
|
|
|
|
|
- SKEY
|
|
|
|
|
- SLASHKEY
|
|
|
|
|
- SPACEKEY
|
|
|
|
|
- TABKEY
|
|
|
|
|
- THREEKEY
|
|
|
|
|
- TIMER0
|
|
|
|
|
- TIMER1
|
|
|
|
|
- TIMER2
|
|
|
|
|
- TIMER3
|
|
|
|
|
- TKEY
|
|
|
|
|
- TWOKEY
|
|
|
|
|
- UKEY
|
|
|
|
|
- UPARROWKEY
|
|
|
|
|
- VKEY
|
|
|
|
|
- WHEELDOWNMOUSE
|
|
|
|
|
- WHEELUPMOUSE
|
|
|
|
|
- WINCLOSE
|
|
|
|
|
- WINFREEZE
|
|
|
|
|
- WINQUIT
|
|
|
|
|
- WINTHAW
|
|
|
|
|
- WKEY
|
|
|
|
|
- XKEY
|
|
|
|
|
- YKEY
|
|
|
|
|
- ZEROKEY
|
|
|
|
|
- ZKEY
|
2003-07-12 18:02:54 +00:00
|
|
|
|
Note: this commit includes new functionality to save and restore scripts configure options. This is ongoing work, scripts still have to be updated to use this feature and more tests are needed, though many have been performed. The new Scripts Config Editor script is the main part of this. If anyone wants to check it, only the AC3D importer and exporter have already been updated to use it: simply open them (you can then cancel with ESC) to have the data created, then try the config editor.
Scripts:
- Thanks Jean-Michel Soler (jms) for updated versions of dispaint, fixfromarmature and unweld (also renamed to remove version part).
- Thanks Bart for the upgraded VRML exporter (great doc webpage!). It is available as VRML 97 and the original VRML 2 is for now still there, to help users testing the new version. For the next release the old one should be removed, of course.
- New script: Scripts Config Editor (Scripts win -> Scripts -> System). Scripts with config options (simple data that is to be set according to user needs or preferences) can use this facility instead of providing a gui and writing config files to disk themselves.
- Added new menu: System, available in the Scripts win.
- Updated sys_info.py, help_browse.py and the AC3D importer and exporter.
- Removed use of the Scrollbar and added arrow keys and mouse wheel support instead in Daniel Dunbar's old doc_browser.py. The scrollbar events handling doesn't exist, Ton suggested removing the scrollbar from the API months ago. For now its ref doc is gone and no bundled script uses it, until we get time to implement it properly.
- Added module BPyRegistry.py with functions to handle reading / writing config files automatically to the scripts/bpydata/config dir.
- Removing dir release/bpydata and its contents (moved earlier to release/scripts/bpydata/)
- Bug #2379: made small changes to bevel_center's ui to fix a problem reported by Alexander Ewering (intrr):
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2379&group_id=9
BPython:
- Thanks Campbell Barton for new functionality: Blender.Get() now can also return all the paths from the user prefs -> file paths win and there is a new function: Blender.sys.expandpath() to transform Blender paths (those starting with '//' and ending with '#') to absolute paths.
- Added function Blender.ShowHelp(), to open the Scripts Help Browser with a given help page -- just a time saver for scripts.
- Improved function Blender.Run() to also work with gui and file select scripts.
- Found a (new?) crash related to NMesh.PutRaw when creating a new object while in edit mode. Leaving / entering edit mode fixes the problem, so a check for obj created, edit mode and leaving / re-entering it were added to the code for now (gdb didn't help much, no backtrace)
- doc updates, including splitting intro page in two, with bpython related stuff (registering / documenting / configuring scripts and command line mode (thanks Chris Want for "use system variables to pass parameters to scripts" idea).
- Registry: functions have been updated to support writing to / reading from disk, for the config editor -- only simple config data supported, for large amounts coders should write to a file themselves. This is done with a new parameter: Registry.GetKey(keyname, True) will also search for the key on the config dir, if not already loaded; equiv. for Registry.SetKey(keyname, dict, True). Data is only written to / read from disk when needed and only scripts already used (assuming they support this functionality) will have config data saved.
2005-04-16 05:25:42 +00:00
|
|
|
@note: function Button has an alias: L{PushButton}.
|
|
|
|
|
|
|
|
|
|
@warn: B{very important}: if using your script causes "Error totblock"
|
|
|
|
|
messages when Blender exits (meaning that memory has been leaked), this may
|
|
|
|
|
have been caused by an ignored return value from one of the button types. To
|
|
|
|
|
avoid this, assign created buttons return values to B{global} variables,
|
|
|
|
|
instead of ignoring them. Examples::
|
|
|
|
|
|
|
|
|
|
# avoid this, it can cause memory leaks:
|
|
|
|
|
Draw.Toggle(...)
|
|
|
|
|
Draw.Number(...)
|
|
|
|
|
Draw.String(...)
|
|
|
|
|
# this is correct -- assuming the variables are globals:
|
|
|
|
|
my_toggle_button = Draw.Toggle(...)
|
|
|
|
|
my_int_button = Draw.Number(...)
|
|
|
|
|
my_str_button = Draw.String(...)
|
|
|
|
|
|
2004-06-16 01:18:57 +00:00
|
|
|
|
2003-07-12 18:02:54 +00:00
|
|
|
@warn: Inside the windowing loop (after Draw.Register() has been executed and
|
|
|
|
|
before Draw.Exit() is called), don't use the redraw functions from other
|
|
|
|
|
modules (Blender and Window). The Draw submodule has its own Draw.Redraw() and
|
|
|
|
|
Draw.Draw() functions that can be used inside the windowing loop.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Exit():
|
|
|
|
|
"""
|
|
|
|
|
Exit the windowing interface.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Register(draw = None, event = None, button = None):
|
|
|
|
|
"""
|
|
|
|
|
Register callbacks for windowing.
|
|
|
|
|
@type draw: function
|
|
|
|
|
@type event: function
|
|
|
|
|
@type button: function
|
|
|
|
|
@param draw: A function to draw the screen, taking no arguments: f().
|
|
|
|
|
@param event: A function to handle keyboard and mouse input events, taking
|
|
|
|
|
two arguments: f(evt, val), where:
|
|
|
|
|
- 'evt' (int) is the event number;
|
|
|
|
|
- 'val' (int) is the value modifier. If val = 0, the event refers to a
|
|
|
|
|
key or mouse button being released. Otherwise it's a key/button press.
|
|
|
|
|
@param button: A function to handle Draw Button events, taking one argument:
|
|
|
|
|
f(evt), where:
|
|
|
|
|
- 'evt' is the button number (see the I{event} parameter in L{Button}).
|
2004-07-16 03:08:43 +00:00
|
|
|
@note: note that in the example at the beginning of this page Draw.Register
|
|
|
|
|
is called only once. It's not necessary to re-register the callbacks,
|
|
|
|
|
they will stay until Draw.Exit is called. It's enough to redraw the
|
|
|
|
|
screen, when a relevant event is caught.
|
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
|
|
|
@note: only during the B{event} callback: the L{Blender}.ascii variable holds
|
2005-10-11 15:11:39 +00:00
|
|
|
the ASCII integer value (if it exists and is valid) of the current event.
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Redraw(after = 0):
|
|
|
|
|
"""
|
|
|
|
|
Queue a redraw event. Redraw events are buffered so that, regardless of how
|
|
|
|
|
many events are queued, the window only receives one redraw event.
|
|
|
|
|
@type after: int
|
|
|
|
|
@param after: If non-zero, the redraw is processed before other input events.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Draw():
|
|
|
|
|
"""
|
|
|
|
|
Force an immediate redraw. Forced redraws are not buffered. In other words,
|
|
|
|
|
the window is redrawn once every time this function is called.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Create(value):
|
|
|
|
|
"""
|
|
|
|
|
Create a default Button object.
|
2006-05-20 15:44:14 +00:00
|
|
|
@type value: int, float, string or 3 floats
|
2003-07-12 18:02:54 +00:00
|
|
|
@param value: The value to store in the button.
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
|
|
|
|
"""
|
|
|
|
|
|
2004-06-16 01:18:57 +00:00
|
|
|
def PushButton(name, event, x, y, width, height, tooltip = None):
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
2004-06-16 01:18:57 +00:00
|
|
|
Create a new (push) Button object.
|
2003-07-12 18:02:54 +00:00
|
|
|
@type name: string
|
|
|
|
|
@param name: The string to display on the button.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
2004-06-16 01:18:57 +00:00
|
|
|
@note: This function used to be called only "Button". We added an
|
|
|
|
|
alternative alias to avoid a name clash with the L{Button} class/type that
|
|
|
|
|
caused trouble in this documentation's generation. The old name shouldn't
|
|
|
|
|
be deprecated, use Button or PushButton (better) at your choice.
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
|
|
|
|
|
2003-09-18 00:54:43 +00:00
|
|
|
def PupMenu(name, maxrow = None):
|
|
|
|
|
"""
|
|
|
|
|
Create a pop-up menu.
|
|
|
|
|
|
|
|
|
|
The menu options are specified through the 'name' parameter, like with
|
|
|
|
|
L{Menu}: options are followed by a format code and separated by the '|'
|
|
|
|
|
character. Valid format codes are:
|
|
|
|
|
- %t - The option should be used as the title of the pop-up;
|
2003-09-20 03:40:16 +00:00
|
|
|
- %l - insert a separating line (only works if 'maxrow' isn't given);
|
2003-09-18 00:54:43 +00:00
|
|
|
- %xB{N} - Chosen this option, PupMenu should return the integer B{N}.
|
|
|
|
|
|
|
|
|
|
Example::
|
2003-09-20 03:40:16 +00:00
|
|
|
name = "OK?%t|QUIT BLENDER" # if no %xN int is set, indices start from 1
|
2003-09-18 00:54:43 +00:00
|
|
|
result = Draw.PupMenu(name)
|
2003-09-20 03:40:16 +00:00
|
|
|
if result:
|
|
|
|
|
Draw.PupMenu("Really?%t|Yes|No")
|
2003-09-18 00:54:43 +00:00
|
|
|
|
|
|
|
|
@type name: string
|
|
|
|
|
@param name: The format string to define the contents of the button.
|
|
|
|
|
@type maxrow: int
|
|
|
|
|
@param maxrow: The maximum number of rows for each column in the pop-up.
|
|
|
|
|
@rtype: int
|
|
|
|
|
@return: the chosen entry number or -1 if none was chosen.
|
|
|
|
|
"""
|
|
|
|
|
|
2004-05-22 20:25:22 +00:00
|
|
|
def PupIntInput(text, default, min, max):
|
|
|
|
|
"""
|
|
|
|
|
Create an integer number input pop-up.
|
|
|
|
|
|
|
|
|
|
This allows python to use Blender's integer number popup input.
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
default = 50
|
|
|
|
|
min = 0
|
|
|
|
|
max = 100
|
2004-06-08 04:41:02 +00:00
|
|
|
|
|
|
|
|
msg = "Set this value between 0 and 100"
|
|
|
|
|
result = Draw.PupIntInput(msg, default, min, max)
|
2004-05-22 20:25:22 +00:00
|
|
|
if result != None:
|
|
|
|
|
print result
|
|
|
|
|
else:
|
|
|
|
|
print 'no user input'
|
|
|
|
|
|
|
|
|
|
@type text: string
|
|
|
|
|
@param text: The text that is displayed in the popup.
|
|
|
|
|
@type default: int
|
2004-06-16 01:18:57 +00:00
|
|
|
@param default: The value that the popup is set to initially.
|
2004-05-22 20:25:22 +00:00
|
|
|
@type min: int
|
|
|
|
|
@param min: The lowest value the popup will allow.
|
|
|
|
|
@type max: int
|
|
|
|
|
@param max: The highest value the popup will allow.
|
|
|
|
|
@rtype: int
|
|
|
|
|
@return: the number chosen or None if none was chosen.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def PupFloatInput(text, default, min, max, clickStep, floatLen):
|
|
|
|
|
"""
|
|
|
|
|
Create a floating point number input pop-up.
|
|
|
|
|
|
|
|
|
|
This allows python to use Blender's floating point popup input.
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
default = 50
|
2004-06-08 04:41:02 +00:00
|
|
|
min = 0.0
|
|
|
|
|
max = 10.0
|
|
|
|
|
clickStep = 100
|
2004-05-22 20:25:22 +00:00
|
|
|
floatLen = 3
|
2004-06-08 04:41:02 +00:00
|
|
|
|
|
|
|
|
msg = "Set this value between 0 and 100"
|
|
|
|
|
result = Draw.PupFloatInput(msg, default, min, max, clickStep, floatLen)
|
2004-05-22 20:25:22 +00:00
|
|
|
if result != None:
|
|
|
|
|
print result
|
|
|
|
|
else:
|
|
|
|
|
print 'no user input'
|
|
|
|
|
|
|
|
|
|
@type text: string
|
|
|
|
|
@param text: The text that is displayed in the popup.
|
|
|
|
|
@type default: float
|
2004-06-16 01:18:57 +00:00
|
|
|
@param default: The value that the popup is set to initially.
|
2004-05-22 20:25:22 +00:00
|
|
|
@type min: float
|
|
|
|
|
@param min: The lowest value the popup will allow.
|
|
|
|
|
@type max: float
|
|
|
|
|
@param max: The highest value the popup will allow.
|
|
|
|
|
@type clickStep: int
|
|
|
|
|
@param clickStep: How much is incremented per user click, 100 will increment 1.0, 10 will increment 0.1 etc.
|
|
|
|
|
@type floatLen: int
|
|
|
|
|
@param floatLen: The number of decimal places to display, between 2 and 4.
|
|
|
|
|
@rtype: float
|
|
|
|
|
@return: the number chosen or None if none was chosen.
|
|
|
|
|
"""
|
|
|
|
|
|
2004-06-16 01:18:57 +00:00
|
|
|
def PupStrInput(text, default, max = 20):
|
|
|
|
|
"""
|
|
|
|
|
Create a string input pop-up.
|
|
|
|
|
|
|
|
|
|
This allows python to use Blender's string popup input.
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
Blender.Draw.PupStrInput("Name:", "untitled", 25)
|
|
|
|
|
|
|
|
|
|
@type text: string
|
|
|
|
|
@param text: The text that is displayed in the popup.
|
|
|
|
|
@type default: string
|
|
|
|
|
@param default: The value that the popup is set to initially. If it's longer
|
|
|
|
|
then 'max', it's truncated.
|
|
|
|
|
@type max: int
|
|
|
|
|
@param max: The most characters the popup input will allow. If not given
|
|
|
|
|
it defaults to 20 chars. It should be in the range [1, 100].
|
|
|
|
|
@rtype: string
|
|
|
|
|
@return: The text entered by the user or None if none was chosen.
|
|
|
|
|
"""
|
|
|
|
|
|
2006-01-08 18:59:55 +00:00
|
|
|
def PupBlock(title, sequence):
|
|
|
|
|
"""
|
|
|
|
|
Display a pop-up block.
|
|
|
|
|
|
|
|
|
|
Possible formats for the items in the sequence parameter.
|
|
|
|
|
(Value are objects created with L{Create})
|
|
|
|
|
- string: Defines a label
|
|
|
|
|
- (string, Value, string): Defines a toggle button. The first string is the text on the button, the optional second string is the tooltip.
|
|
|
|
|
- (string, Value, min, max, string): Defines a numeric or string button, depending on the content of Value. The first string is the text on the button, the optional second string is the tooltip. I{For string, max is the maximum length of the string and min is unused.}
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
import Blender
|
|
|
|
|
|
|
|
|
|
text = Blender.Draw.Create("short text")
|
|
|
|
|
f = Blender.Draw.Create(1.0)
|
|
|
|
|
i = Blender.Draw.Create(2)
|
|
|
|
|
tog = Blender.Draw.Create(0)
|
|
|
|
|
|
|
|
|
|
block = []
|
|
|
|
|
|
|
|
|
|
block.append(("Name: ", text, 0, 30, "this is some tool tip"))
|
|
|
|
|
block.append("Some Label")
|
|
|
|
|
block.append(("Value: ", f, 0.0, 100.0))
|
|
|
|
|
block.append(("Value: ", i, 0, 100))
|
|
|
|
|
block.append(("Option", tog, "another tooltip"))
|
|
|
|
|
|
|
|
|
|
retval = Blender.Draw.PupBlock("PupBlock test", block)
|
|
|
|
|
|
|
|
|
|
print "PupBlock returned", retval
|
|
|
|
|
|
|
|
|
|
print "text\\t", text
|
|
|
|
|
print "float\\t", f
|
|
|
|
|
print "int\\t", i
|
|
|
|
|
print "toggle\\t", tog
|
|
|
|
|
|
|
|
|
|
@warning: On cancel, the Value objects are brought back to there initial values except for string values which will still contain the modified values.
|
|
|
|
|
@type title: string
|
|
|
|
|
@param title: The title of the block.
|
|
|
|
|
@param sequence: A sequence defining what the block contains.
|
|
|
|
|
The order of the list is the order of appearance, from top down.
|
|
|
|
|
@rtype: int
|
|
|
|
|
@return: 1 if the pop-up is confirmed, 0 otherwise
|
|
|
|
|
"""
|
|
|
|
|
|
2003-07-12 18:02:54 +00:00
|
|
|
def Menu(name, event, x, y, width, height, default, tooltip = None):
|
|
|
|
|
"""
|
|
|
|
|
Create a new Menu Button object.
|
|
|
|
|
|
|
|
|
|
The menu options are specified through the 'name' of the button. Options are
|
|
|
|
|
I{followed} by a format code and separated by the '|' (pipe) character. Valid
|
|
|
|
|
format codes are:
|
|
|
|
|
- %t - The option should be used as the title;
|
2003-09-18 00:54:43 +00:00
|
|
|
- %l - Insert a separating line;
|
2003-07-12 18:02:54 +00:00
|
|
|
- %xB{N} - The option should set the integer B{N} in the button value.
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
name = "The Title %t|First Entry %x1|Second Entry %x2|Third Entry %x3"
|
|
|
|
|
menu = Draw.Menu(name, 2, 60, 120, 200, 40, 3, "Just a test menu.")
|
|
|
|
|
# note that, since default = 3, the "Third Entry"
|
|
|
|
|
# will appear as the default choice in the Menu.
|
|
|
|
|
|
|
|
|
|
@type name: string
|
2003-09-18 00:54:43 +00:00
|
|
|
@param name: The format string to define the contents of the button.
|
2003-07-12 18:02:54 +00:00
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type default: int
|
|
|
|
|
@param default: The number of the option to be selected by default.
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Toggle(name, event, x, y, width, height, default, tooltip = None):
|
|
|
|
|
"""
|
|
|
|
|
Create a new Toggle Button object.
|
|
|
|
|
@type name: string
|
|
|
|
|
@param name: The string to display on the button.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type default: int
|
|
|
|
|
@param default: The value specifying the default state:
|
|
|
|
|
(0 for "up", 1 for "down").
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Slider(name, event, x, y, width, height, initial, min, max, realtime = 1,
|
|
|
|
|
tooltip = None):
|
|
|
|
|
"""
|
2004-07-16 03:08:43 +00:00
|
|
|
Create a new Slider Button object.
|
2003-07-12 18:02:54 +00:00
|
|
|
@type name: string
|
|
|
|
|
@param name: The string to display on the button.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type initial: int or float
|
|
|
|
|
@type min: int or float
|
|
|
|
|
@type max: int or float
|
|
|
|
|
@param initial: The initial value.
|
|
|
|
|
@param min: The minimum value.
|
|
|
|
|
@param max: The maximum value.
|
|
|
|
|
@type realtime: int
|
|
|
|
|
@param realtime: If non-zero (the default), the slider will emit events as
|
|
|
|
|
it is edited.
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
|
|
|
|
"""
|
|
|
|
|
|
Note: this commit includes new functionality to save and restore scripts configure options. This is ongoing work, scripts still have to be updated to use this feature and more tests are needed, though many have been performed. The new Scripts Config Editor script is the main part of this. If anyone wants to check it, only the AC3D importer and exporter have already been updated to use it: simply open them (you can then cancel with ESC) to have the data created, then try the config editor.
Scripts:
- Thanks Jean-Michel Soler (jms) for updated versions of dispaint, fixfromarmature and unweld (also renamed to remove version part).
- Thanks Bart for the upgraded VRML exporter (great doc webpage!). It is available as VRML 97 and the original VRML 2 is for now still there, to help users testing the new version. For the next release the old one should be removed, of course.
- New script: Scripts Config Editor (Scripts win -> Scripts -> System). Scripts with config options (simple data that is to be set according to user needs or preferences) can use this facility instead of providing a gui and writing config files to disk themselves.
- Added new menu: System, available in the Scripts win.
- Updated sys_info.py, help_browse.py and the AC3D importer and exporter.
- Removed use of the Scrollbar and added arrow keys and mouse wheel support instead in Daniel Dunbar's old doc_browser.py. The scrollbar events handling doesn't exist, Ton suggested removing the scrollbar from the API months ago. For now its ref doc is gone and no bundled script uses it, until we get time to implement it properly.
- Added module BPyRegistry.py with functions to handle reading / writing config files automatically to the scripts/bpydata/config dir.
- Removing dir release/bpydata and its contents (moved earlier to release/scripts/bpydata/)
- Bug #2379: made small changes to bevel_center's ui to fix a problem reported by Alexander Ewering (intrr):
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2379&group_id=9
BPython:
- Thanks Campbell Barton for new functionality: Blender.Get() now can also return all the paths from the user prefs -> file paths win and there is a new function: Blender.sys.expandpath() to transform Blender paths (those starting with '//' and ending with '#') to absolute paths.
- Added function Blender.ShowHelp(), to open the Scripts Help Browser with a given help page -- just a time saver for scripts.
- Improved function Blender.Run() to also work with gui and file select scripts.
- Found a (new?) crash related to NMesh.PutRaw when creating a new object while in edit mode. Leaving / entering edit mode fixes the problem, so a check for obj created, edit mode and leaving / re-entering it were added to the code for now (gdb didn't help much, no backtrace)
- doc updates, including splitting intro page in two, with bpython related stuff (registering / documenting / configuring scripts and command line mode (thanks Chris Want for "use system variables to pass parameters to scripts" idea).
- Registry: functions have been updated to support writing to / reading from disk, for the config editor -- only simple config data supported, for large amounts coders should write to a file themselves. This is done with a new parameter: Registry.GetKey(keyname, True) will also search for the key on the config dir, if not already loaded; equiv. for Registry.SetKey(keyname, dict, True). Data is only written to / read from disk when needed and only scripts already used (assuming they support this functionality) will have config data saved.
2005-04-16 05:25:42 +00:00
|
|
|
#def Scrollbar(event, x, y, width, height, initial, min, max, realtime = 1,
|
|
|
|
|
# tooltip = None):
|
|
|
|
|
# """
|
|
|
|
|
# Create a new Scrollbar Button object.
|
|
|
|
|
# @type event: int
|
|
|
|
|
# @param event: The event number to pass to the button event function when
|
|
|
|
|
# activated.
|
|
|
|
|
# @type x: int
|
|
|
|
|
# @type y: int
|
|
|
|
|
# @param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
# @param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
# @type width: int
|
|
|
|
|
# @type height: int
|
|
|
|
|
# @param width: The button width.
|
|
|
|
|
# @param height: The button height.
|
|
|
|
|
# @type initial: int or float
|
|
|
|
|
# @type min: int or float
|
|
|
|
|
# @type max: int or float
|
|
|
|
|
# @param initial: The initial value.
|
|
|
|
|
# @param min: The minimum value.
|
|
|
|
|
# @param max: The maximum value.
|
|
|
|
|
# @type realtime: int
|
|
|
|
|
# @param realtime: If non-zero (the default), the slider will emit events as
|
|
|
|
|
# it is edited.
|
|
|
|
|
# @type tooltip: string
|
|
|
|
|
# @param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
# is kept over the button).
|
|
|
|
|
# @rtype: Blender Button
|
|
|
|
|
# @return: The Button created.
|
|
|
|
|
# """
|
2003-07-12 18:02:54 +00:00
|
|
|
|
2006-05-20 15:44:14 +00:00
|
|
|
def ColorPicker(event, x, y, width, height, initial, tooltip = None):
|
|
|
|
|
"""
|
|
|
|
|
Create a new Color Picker Button object.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type initial: 3-float tuple
|
|
|
|
|
@param initial: The initial color value. All values must be between 0 and 1
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
2006-06-19 13:21:44 +00:00
|
|
|
@note: The color picker will not work if the Register's event function is None.
|
2006-05-20 15:44:14 +00:00
|
|
|
"""
|
|
|
|
|
|
2004-05-25 19:59:41 +00:00
|
|
|
def Number(name, event, x, y, width, height, initial, min, max, tooltip = None):
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
|
|
|
|
Create a new Number Button object.
|
|
|
|
|
@type name: string
|
|
|
|
|
@param name: The string to display on the button.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type initial: int or float
|
|
|
|
|
@type min: int or float
|
|
|
|
|
@type max: int or float
|
|
|
|
|
@param initial: The initial value.
|
|
|
|
|
@param min: The minimum value.
|
|
|
|
|
@param max: The maximum value.
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
2006-06-05 01:23:56 +00:00
|
|
|
|
|
|
|
|
I{B{Example:}}
|
|
|
|
|
|
|
|
|
|
This example draws a single floating point value::
|
|
|
|
|
from Blender import Draw
|
|
|
|
|
b= Draw.Create(0.0) # Data for floating point button
|
|
|
|
|
def bevent(evt):
|
|
|
|
|
print 'My Button event:', evt
|
|
|
|
|
def gui():
|
|
|
|
|
global b
|
|
|
|
|
b= Draw.Number('value: ', 1000, 0,0, 200, 20, b.val, 0,10, 'some text tip')
|
|
|
|
|
|
|
|
|
|
Draw.Register(gui, None, bevent) # we are not going to worry about keyboard and mouse events
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def String(name, event, x, y, width, height, initial, length, tooltip = None):
|
|
|
|
|
"""
|
|
|
|
|
Create a new String Button object.
|
|
|
|
|
@type name: string
|
|
|
|
|
@param name: The string to display on the button.
|
|
|
|
|
@type event: int
|
|
|
|
|
@param event: The event number to pass to the button event function when
|
|
|
|
|
activated.
|
|
|
|
|
@type x: int
|
|
|
|
|
@type y: int
|
|
|
|
|
@param x: The lower left x (horizontal) coordinate of the button.
|
|
|
|
|
@param y: The lower left y (vertical) coordinate of the button.
|
|
|
|
|
@type width: int
|
|
|
|
|
@type height: int
|
|
|
|
|
@param width: The button width.
|
|
|
|
|
@param height: The button height.
|
|
|
|
|
@type initial: string
|
|
|
|
|
@param initial: The string to display initially.
|
|
|
|
|
@type length: int
|
|
|
|
|
@param length: The maximum input length.
|
|
|
|
|
@type tooltip: string
|
|
|
|
|
@param tooltip: The button's tooltip (the string that appears when the mouse
|
|
|
|
|
is kept over the button).
|
|
|
|
|
@rtype: Blender Button
|
|
|
|
|
@return: The Button created.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def GetStringWidth(string, fontsize = 'normal'):
|
|
|
|
|
"""
|
|
|
|
|
Get the width in pixels of a string.
|
|
|
|
|
@type string: string
|
|
|
|
|
@param string: A string.
|
|
|
|
|
@type fontsize: string
|
2005-05-20 05:14:03 +00:00
|
|
|
@param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
|
2003-07-12 18:02:54 +00:00
|
|
|
@rtype: int
|
|
|
|
|
@return: The width of I{string} with the chosen I{fontsize}.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Text(string, fontsize = 'normal'):
|
|
|
|
|
"""
|
|
|
|
|
Draw a string on the screen.
|
|
|
|
|
@type string: string
|
|
|
|
|
@param string: The text string to draw.
|
|
|
|
|
@type fontsize: string
|
2005-05-20 05:14:03 +00:00
|
|
|
@param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
|
2003-07-12 18:02:54 +00:00
|
|
|
@rtype: int
|
|
|
|
|
@return: The width of I{string} drawn with the chosen I{fontsize}.
|
|
|
|
|
"""
|
2004-04-23 13:11:48 +00:00
|
|
|
|
2005-01-13 03:04:12 +00:00
|
|
|
def Image(image, x, y, zoomx=1.0, zoomy=1.0, clipx=0, clipy=0, clipw=-1, cliph=-1):
|
|
|
|
|
"""
|
|
|
|
|
Draw an image on the screen.
|
|
|
|
|
|
|
|
|
|
The image is drawn at the location specified by the coordinates (x,y). A
|
|
|
|
|
pair of optional zoom factors (in horizontal and vertical directions) can
|
|
|
|
|
be applied to the image as it is drawn, and an additional clipping rectangle
|
|
|
|
|
can be applied to extract a particular sub-region of the image to draw.
|
|
|
|
|
|
|
|
|
|
Note that the clipping rectangle is given in image space coordinates. In
|
|
|
|
|
image space, the origin is located at the bottom left, with x coordinates
|
|
|
|
|
increasing to the right and y coordinates increasing upwards. No matter
|
|
|
|
|
where the clipping rectangle is placed in image space, the lower-left pixel
|
|
|
|
|
drawn on the screen is always placed at the coordinates (x,y). The
|
|
|
|
|
clipping rectangle is itself clipped to the dimensions of the image. If
|
|
|
|
|
either the width or the height of the clipping rectangle are negative then
|
|
|
|
|
the corresponding dimension (width or height) is set to include as much of
|
|
|
|
|
the image as possible.
|
2005-10-11 15:11:39 +00:00
|
|
|
|
|
|
|
|
For drawing images with alpha blending with the background you will need to enable blending as shown in the example.
|
|
|
|
|
|
|
|
|
|
|
2005-01-13 03:04:12 +00:00
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
import Blender
|
|
|
|
|
from Blender import BGL, Image, Draw
|
|
|
|
|
|
|
|
|
|
myimage = Image.Load('myimage.png')
|
|
|
|
|
|
|
|
|
|
def gui():
|
2005-10-11 15:11:39 +00:00
|
|
|
BGL.glEnable( BGL.GL_BLEND ) # Only needed for alpha blending images with background.
|
|
|
|
|
BGL.glBlendFunc(BGL.GL_SRC_ALPHA, BGL.GL_ONE_MINUS_SRC_ALPHA)
|
|
|
|
|
|
2005-01-13 03:04:12 +00:00
|
|
|
Draw.Image(myimage, 50, 50)
|
2005-10-11 15:11:39 +00:00
|
|
|
|
|
|
|
|
BGL.glDisable( BGL.GL_BLEND )
|
2005-01-13 03:04:12 +00:00
|
|
|
def event(evt, val):
|
|
|
|
|
if evt == Draw.ESCKEY:
|
|
|
|
|
Draw.Exit()
|
|
|
|
|
|
|
|
|
|
Draw.Register(gui, event, None)
|
|
|
|
|
|
|
|
|
|
@type image: Blender.Image
|
|
|
|
|
@param image: The image to draw.
|
|
|
|
|
@type x: int
|
|
|
|
|
@param x: The lower left x (horizontal) position of the origin of the image.
|
|
|
|
|
@type y: int
|
|
|
|
|
@param y: The lower left y (vertical) position of the origin of the image.
|
|
|
|
|
@type zoomx: float
|
|
|
|
|
@param zoomx: The x (horizontal) zoom factor to use when drawing the image.
|
|
|
|
|
@type zoomy: float
|
|
|
|
|
@param zoomy: The y (vertical) zoom factor to use when drawing the image.
|
|
|
|
|
@type clipx: int
|
|
|
|
|
@param clipx: The lower left x (horizontal) origin of the clipping rectangle
|
|
|
|
|
within the image. A value of 0 indicates the left of the
|
|
|
|
|
image.
|
|
|
|
|
@type clipy: int
|
|
|
|
|
@param clipy: The lower left y (vertical) origin of the clipping rectangle
|
|
|
|
|
within the image. A value of 0 indicates the bottom of the
|
|
|
|
|
image.
|
|
|
|
|
@type clipw: int
|
|
|
|
|
@param clipw: The width of the clipping rectangle within the image. If this
|
|
|
|
|
value is negative then the clipping rectangle includes as much
|
|
|
|
|
of the image as possible in the x (horizontal) direction.
|
|
|
|
|
@type cliph: int
|
|
|
|
|
@param cliph: The height of the clipping rectangle within the image. If this
|
|
|
|
|
value is negative then the clipping rectangle includes as much
|
|
|
|
|
of the image as possible in the y (vertical) direction.
|
|
|
|
|
"""
|
|
|
|
|
|
2004-04-23 13:11:48 +00:00
|
|
|
class Button:
|
|
|
|
|
"""
|
|
|
|
|
The Button object
|
|
|
|
|
=================
|
|
|
|
|
This object represents a button in Blender's GUI.
|
2006-05-20 15:44:14 +00:00
|
|
|
@type val: int or float, string or 3-float tuple (depends on button type).
|
2005-06-15 06:22:26 +00:00
|
|
|
@ivar val: The button's value.
|
2004-04-23 13:11:48 +00:00
|
|
|
"""
|