[Bf-committers] Interactive python console #2 :)
Campbell Barton
cbarton at metavr.com
Fri Mar 25 14:27:02 CET 2005
Skipped content of type multipart/alternative-------------- next part --------------
#!BPY
""" Registration info for Blender menus:
Name: 'Blender Interactive Console'
Blender: 234
Group: 'Wizards'
Tip: 'Blenders python '
"""
import Blender
from Blender import *
import sys as python_sys
import StringIO
# Constants
__DELIMETERS__ = '. ,=+-*/%<>&~][{}():'
class cmdLine:
# cmd: is the command string, or any other message
# type: 0:user input 1:program feedback 2:error message. 3:option feedback
# exe; 0- not yet executed 1:executed
def __init__(self, cmd, type, exe):
self.cmd = cmd
self.type = type
self.exe = exe
# Include external file with internal namespace
def include(filename):
file = open(filename, 'r')
filedata = file.read()
file.close()
return compile(filedata, filename, 'exec')
# Writes command line data to a blender text file.
def writeCmdData(cmdLineList, type):
if type == 3:
typeList = [0,1,2, 3, None] # all
else:
typeList = [type] # so we can use athe lists 'in' methiod
newText = Text.New('command.py', 1)
for myCmd in cmdLineList:
if myCmd.type in typeList: # user input
newText.write('%s\n' % myCmd.cmd)
Draw.PupMenu('%s written' % newText.name)
COLLECTED_VAR_NAMES = {} # a list of keys, each key has a list of absolute paths
# Pain and simple recursice dir(), accepts a string
def rdir(dirString):
global COLLECTED_VAR_NAMES
dirStringSplit = dirString.split('.')
exec('dirList = dir(%s)' % dirString)
for d in dirList:
if not d.startswith('_'):
if d not in COLLECTED_VAR_NAMES.keys():
COLLECTED_VAR_NAMES[d] = []
# Add the string
splitD = dirString.split('"')[-2]
if splitD not in COLLECTED_VAR_NAMES[d]:
COLLECTED_VAR_NAMES[d].append(splitD)
# Stops recursice stuff, overlooping
if d not in dirStringSplit:
rdir( '%s.%s' % (dirString, d))
def recursive_dir():
global COLLECTED_VAR_NAMES
for name in __CONSOLE_VAR_DICT__.keys():
rdir('__CONSOLE_VAR_DICT__["%s"]' % name)
#print COLLECTED_VAR_NAMES
COLLECTED_VAR_NAMES[name] = ['']
return COLLECTED_VAR_NAMES
# Runs the code line(s) the user has entered and handle errors
# As well as feeding back the output into the blender window.
def runUserCode(__USER_CODE_STRING__):
global __CONSOLE_VAR_DICT__ # We manipulate the variables here. loading and saving from localspace to this global var.
# Open A File like object to write all output to, that would useually be printed.
python_sys.stdout.flush() # Get rid of whatever came before
__FILE_LIKE_STRING__ = StringIO.StringIO() # make a new file like string, this saves up from making a file.
__STD_OUTPUT__ = python_sys.stdout # we need to store the normal output.
python_sys.stdout=__FILE_LIKE_STRING__ # Now anything printed will be written to the file like string.
# Try and run the user entered line(s)
try:
# Load all variabls from global dict to local space.
for __TMP_VAR_NAME__ in __CONSOLE_VAR_DICT__.keys():
exec('%s%s%s%s' % (__TMP_VAR_NAME__,'=__CONSOLE_VAR_DICT__["', __TMP_VAR_NAME__, '"]'))
del __TMP_VAR_NAME__
# Now all the vars are loaded, execute the code.
exec(compile(__USER_CODE_STRING__, 'blender_cmd.py', 'exec'))
# Write local veriables to global __CONSOLE_VAR_DICT__
for __TMP_VAR_NAME__ in dir():
if __TMP_VAR_NAME__ != '__FILE_LIKE_STRING__' and\
__TMP_VAR_NAME__ != '__STD_OUTPUT__' and\
__TMP_VAR_NAME__ != '__TMP_VAR_NAME__' and\
__TMP_VAR_NAME__ != '__USER_CODE_STRING__':
# Execute the local > global coversion.
exec('%s%s' % ('__CONSOLE_VAR_DICT__[__TMP_VAR_NAME__]=', __TMP_VAR_NAME__))
del __TMP_VAR_NAME__
except: # Prints the REAL exception.
error = str(python_sys.exc_value)
for errorLine in error.split('\n'):
cmdBuffer.append(cmdLine(errorLine, 2, None)) # new line to type into
python_sys.stdout = __STD_OUTPUT__ # Go back to output to the normal blender console
# Copy all new output to cmdBuffer
__FILE_LIKE_STRING__.seek(0) # the readline function requires that we go back to the start of the file.
for line in __FILE_LIKE_STRING__.readlines():
cmdBuffer.append(cmdLine(line, 1, None))
cmdBuffer.append(cmdLine(' ', 0, 0)) # new line to type into
python_sys.stdout=__STD_OUTPUT__
__FILE_LIKE_STRING__.close()
#------------------------------------------------------------------------------#
# event handling code #
#------------------------------------------------------------------------------#
def handle_event(evt, val):
# Insert Char into the cammand line
def insCh(ch): # Instert a char
global cmdBuffer
global cursor
# Later account for a cursor variable
cmdBuffer[-1].cmd = ('%s%s%s' % ( cmdBuffer[-1].cmd[:cursor], ch, cmdBuffer[-1].cmd[cursor:]))
#------------------------------------------------------------------------------#
# Define Complex Key Actions #
#------------------------------------------------------------------------------#
def actionEnterKey():
global histIndex, cursor, cmdBuffer
# Check for the neter kay hit
if Window.GetKeyQualifiers() & Window.Qual.CTRL: # HOLDING DOWN SHIFT, GO TO NEXT LINE.
cmdBuffer.append(cmdLine(' ', 0, 0))
else:
# Multiline code will still run with 1 line,
if cmdBuffer[-1].cmd != ' ':
multiLineCode = [cmdBuffer[-1].cmd]
else:
multiLineCode = []
cmdBuffer[-1].exe = 1
i = 2
while cmdBuffer[-i].exe == 0:
if cmdBuffer[-i].cmd != ' ':
multiLineCode.append(cmdBuffer[-i].cmd)
# Mark as executed
cmdBuffer[-i].exe = 1
i+=1
multiLineCode.reverse()
runUserCode('\n'.join(multiLineCode))
histIndex = cursor = -1 # Reset cursor and history
def actionUpKey():
global histIndex, cmdBuffer
if abs(histIndex)+1 >= len(cmdBuffer):
histIndex = -1
histIndex -= 1
while cmdBuffer[histIndex].type != 0 and abs(histIndex) < len(cmdBuffer):
histIndex -= 1
if cmdBuffer[histIndex].type == 0: # we found one
cmdBuffer[-1].cmd = cmdBuffer[histIndex].cmd
def actionDownKey():
global histIndex, cmdBuffer
if histIndex >= -2:
histIndex = -len(cmdBuffer)
histIndex += 1
while cmdBuffer[histIndex].type != 0 and histIndex != -2:
histIndex += 1
if cmdBuffer[histIndex].type == 0: # we found one
cmdBuffer[-1].cmd = cmdBuffer[histIndex].cmd
def actionRightMouse():
choice = Draw.PupMenu('Console Menu%t|Write Input Data (white)|Write Output Data (blue)|Write Error Data (red)|Write All Text|Quit')
if choice == 1:
writeCmdData(cmdBuffer, 0) # type 0 user
elif choice == 2:
writeCmdData(cmdBuffer, 1) # type 1 user output
elif choice == 3:
writeCmdData(cmdBuffer, 2) # type 2 errors
elif choice == 4:
writeCmdData(cmdBuffer, 3) # All
elif choice == 5: # Exit
Draw.Exit()
# Auto compleating, quite complex- use recutsice dir for the moment.
def actionAutoCompleate(): # Ctrl + Tab
RECURSIVE_DIR = recursive_dir()
# get last name of user input
editVar = cmdBuffer[-1].cmd[:cursor]
# Split off spaces operators etc from the staryt of the command so we can use the startswith function.
for splitChar in __DELIMETERS__:
editVar = editVar.split(splitChar)[-1]
# Now we should have the var by its self
if editVar:
possibilities = []
print editVar, 'editVar'
for __TMP_VAR_NAME__ in RECURSIVE_DIR.keys():
if __TMP_VAR_NAME__ == editVar:
# print 'ADITVAR IS A VAR'
continue
elif __TMP_VAR_NAME__.startswith( editVar ):
possibilities.append( __TMP_VAR_NAME__ )
if len(possibilities) == 1:
cmdBuffer[-1].cmd = ('%s%s%s' % (cmdBuffer[-1].cmd[:cursor - len(editVar)], possibilities[0], cmdBuffer[-1].cmd[cursor:]))
elif possibilities: # If its not just []
# -1 with insert is the second last.
# Text choice
#cmdBuffer.insert(-1, cmdLine('options: %s' % ' '.join(possibilities), 3, None))
menuText = 'Choices (hold shift for whole name)%t|'
menuList = []
menuListAbs = []
possibilities.sort() # make nice :)
for __TMP_VAR_NAME__ in possibilities:
for usage in RECURSIVE_DIR[__TMP_VAR_NAME__]:
# Account for non absolute (variables for eg.)
if usage: # not ''
menuListAbs.append('%s.%s' % (usage, __TMP_VAR_NAME__)) # Used for names and can be entered when pressing shift.
else:
menuListAbs.append(__TMP_VAR_NAME__) # Used for names and can be entered when pressing shift.
menuList.append(__TMP_VAR_NAME__) # Used for non Shift
#choice = Draw.PupMenu('Select Variabe name%t|' + '|'.join(possibilities) )
choice = Draw.PupMenu(menuText + '|'.join(menuListAbs))
print choice, 'choice'
if choice != -1:
if not Window.GetKeyQualifiers() & Window.Qual.SHIFT: # Only paste in the Short name
cmdBuffer[-1].cmd = ('%s%s%s' % (cmdBuffer[-1].cmd[:cursor - len(editVar)], menuList[choice-1], cmdBuffer[-1].cmd[cursor:]))
else: # Put in the long name
cmdBuffer[-1].cmd = ('%s%s%s' % (cmdBuffer[-1].cmd[:cursor - len(editVar)], menuListAbs[choice-1], cmdBuffer[-1].cmd[cursor:]))
else:
# print 'NO EDITVAR'
return
# ------------------end------------------#
#if (evt == Draw.ESCKEY and not val):
# Draw.Exit()
if evt == Draw.MOUSEX: # AVOID TOO MANY REDRAWS.
return
elif evt == Draw.MOUSEY:
return
global cursor
global histIndex
if Window.GetKeyQualifiers() & Window.Qual.SHIFT:
__SHIFT_KEY_DOWN__ = True
else:
__SHIFT_KEY_DOWN__ = False
#------------------------------------------------------------------------------#
# key codes and key handling #
#------------------------------------------------------------------------------#
if (evt == Draw.AKEY and val and __SHIFT_KEY_DOWN__): insCh('A')
elif (evt == Draw.AKEY and val and not __SHIFT_KEY_DOWN__): insCh('a')
elif (evt == Draw.BKEY and val and __SHIFT_KEY_DOWN__): insCh('B')
elif (evt == Draw.BKEY and val and not __SHIFT_KEY_DOWN__): insCh('b')
elif (evt == Draw.CKEY and val and __SHIFT_KEY_DOWN__): insCh('C')
elif (evt == Draw.CKEY and val and not __SHIFT_KEY_DOWN__): insCh('c')
elif (evt == Draw.DKEY and val and __SHIFT_KEY_DOWN__): insCh('D')
elif (evt == Draw.DKEY and val and not __SHIFT_KEY_DOWN__): insCh('d')
elif (evt == Draw.EKEY and val and __SHIFT_KEY_DOWN__): insCh('E')
elif (evt == Draw.EKEY and val and not __SHIFT_KEY_DOWN__): insCh('e')
elif (evt == Draw.FKEY and val and __SHIFT_KEY_DOWN__): insCh('F')
elif (evt == Draw.FKEY and val and not __SHIFT_KEY_DOWN__): insCh('f')
elif (evt == Draw.GKEY and val and __SHIFT_KEY_DOWN__): insCh('G')
elif (evt == Draw.GKEY and val and not __SHIFT_KEY_DOWN__): insCh('g')
elif (evt == Draw.HKEY and val and __SHIFT_KEY_DOWN__): insCh('H')
elif (evt == Draw.HKEY and val and not __SHIFT_KEY_DOWN__): insCh('h')
elif (evt == Draw.IKEY and val and __SHIFT_KEY_DOWN__): insCh('I')
elif (evt == Draw.IKEY and val and not __SHIFT_KEY_DOWN__): insCh('i')
elif (evt == Draw.JKEY and val and __SHIFT_KEY_DOWN__): insCh('J')
elif (evt == Draw.JKEY and val and not __SHIFT_KEY_DOWN__): insCh('j')
elif (evt == Draw.KKEY and val and __SHIFT_KEY_DOWN__): insCh('K')
elif (evt == Draw.KKEY and val and not __SHIFT_KEY_DOWN__): insCh('j')
elif (evt == Draw.LKEY and val and __SHIFT_KEY_DOWN__): insCh('L')
elif (evt == Draw.LKEY and val and not __SHIFT_KEY_DOWN__): insCh('l')
elif (evt == Draw.MKEY and val and __SHIFT_KEY_DOWN__): insCh('M')
elif (evt == Draw.MKEY and val and not __SHIFT_KEY_DOWN__): insCh('m')
elif (evt == Draw.NKEY and val and __SHIFT_KEY_DOWN__): insCh('N')
elif (evt == Draw.NKEY and val and not __SHIFT_KEY_DOWN__): insCh('n')
elif (evt == Draw.OKEY and val and __SHIFT_KEY_DOWN__): insCh('O')
elif (evt == Draw.OKEY and val and not __SHIFT_KEY_DOWN__): insCh('o')
elif (evt == Draw.PKEY and val and __SHIFT_KEY_DOWN__): insCh('P')
elif (evt == Draw.PKEY and val and not __SHIFT_KEY_DOWN__): insCh('p')
elif (evt == Draw.QKEY and val and __SHIFT_KEY_DOWN__): insCh('Q')
elif (evt == Draw.QKEY and val and not __SHIFT_KEY_DOWN__): insCh('q')
elif (evt == Draw.RKEY and val and __SHIFT_KEY_DOWN__): insCh('R')
elif (evt == Draw.RKEY and val and not __SHIFT_KEY_DOWN__): insCh('r')
elif (evt == Draw.SKEY and val and __SHIFT_KEY_DOWN__): insCh('S')
elif (evt == Draw.SKEY and val and not __SHIFT_KEY_DOWN__): insCh('s')
elif (evt == Draw.TKEY and val and __SHIFT_KEY_DOWN__): insCh('T')
elif (evt == Draw.TKEY and val and not __SHIFT_KEY_DOWN__): insCh('t')
elif (evt == Draw.UKEY and val and __SHIFT_KEY_DOWN__): insCh('U')
elif (evt == Draw.UKEY and val and not __SHIFT_KEY_DOWN__): insCh('u')
elif (evt == Draw.VKEY and val and __SHIFT_KEY_DOWN__): insCh('V')
elif (evt == Draw.VKEY and val and not __SHIFT_KEY_DOWN__): insCh('v')
elif (evt == Draw.WKEY and val and __SHIFT_KEY_DOWN__): insCh('W')
elif (evt == Draw.WKEY and val and not __SHIFT_KEY_DOWN__): insCh('w')
elif (evt == Draw.XKEY and val and __SHIFT_KEY_DOWN__): insCh('X')
elif (evt == Draw.XKEY and val and not __SHIFT_KEY_DOWN__): insCh('x')
elif (evt == Draw.YKEY and val and __SHIFT_KEY_DOWN__): insCh('Y')
elif (evt == Draw.YKEY and val and not __SHIFT_KEY_DOWN__): insCh('y')
elif (evt == Draw.ZKEY and val and __SHIFT_KEY_DOWN__): insCh('Z')
elif (evt == Draw.ZKEY and val and not __SHIFT_KEY_DOWN__): insCh('z')
elif (evt == Draw.ONEKEY and val and __SHIFT_KEY_DOWN__): insCh('!')
elif (evt == Draw.ONEKEY and val and not __SHIFT_KEY_DOWN__): insCh('1')
elif (evt == Draw.TWOKEY and val and __SHIFT_KEY_DOWN__): insCh('@')
elif (evt == Draw.TWOKEY and val and not __SHIFT_KEY_DOWN__): insCh('2')
elif (evt == Draw.THREEKEY and val and __SHIFT_KEY_DOWN__): insCh('#')
elif (evt == Draw.THREEKEY and val and not __SHIFT_KEY_DOWN__): insCh('3')
elif (evt == Draw.FOURKEY and val and __SHIFT_KEY_DOWN__): insCh('$')
elif (evt == Draw.FOURKEY and val and not __SHIFT_KEY_DOWN__): insCh('4')
elif (evt == Draw.FIVEKEY and val and __SHIFT_KEY_DOWN__): insCh('%')
elif (evt == Draw.FIVEKEY and val and not __SHIFT_KEY_DOWN__): insCh('5')
elif (evt == Draw.SIXKEY and val and __SHIFT_KEY_DOWN__): insCh('^')
elif (evt == Draw.SIXKEY and val and not __SHIFT_KEY_DOWN__): insCh('6')
elif (evt == Draw.SEVENKEY and val and __SHIFT_KEY_DOWN__): insCh('&')
elif (evt == Draw.SEVENKEY and val and not __SHIFT_KEY_DOWN__): insCh('7')
elif (evt == Draw.EIGHTKEY and val and __SHIFT_KEY_DOWN__): insCh('*')
elif (evt == Draw.EIGHTKEY and val and not __SHIFT_KEY_DOWN__): insCh('8')
elif (evt == Draw.NINEKEY and val and __SHIFT_KEY_DOWN__): insCh('(')
elif (evt == Draw.NINEKEY and val and not __SHIFT_KEY_DOWN__): insCh('9')
elif (evt == Draw.ZEROKEY and val and __SHIFT_KEY_DOWN__): insCh(')')
elif (evt == Draw.ZEROKEY and val and not __SHIFT_KEY_DOWN__): insCh('0')
elif (evt == Draw.COMMAKEY and val and __SHIFT_KEY_DOWN__): insCh('<')
elif (evt == Draw.COMMAKEY and val and not __SHIFT_KEY_DOWN__): insCh(",")
elif (evt == Draw.PERIODKEY and val and __SHIFT_KEY_DOWN__): insCh('>')
elif (evt == Draw.PERIODKEY and val and not __SHIFT_KEY_DOWN__): insCh(".")
elif (evt == Draw.QUOTEKEY and val and __SHIFT_KEY_DOWN__): insCh('"')
elif (evt == Draw.QUOTEKEY and val and not __SHIFT_KEY_DOWN__): insCh("'")
elif (evt == Draw.LEFTBRACKETKEY and val and not __SHIFT_KEY_DOWN__): insCh('[')
elif (evt == Draw.LEFTBRACKETKEY and val and __SHIFT_KEY_DOWN__): insCh('{')
elif (evt == Draw.RIGHTBRACKETKEY and val and not __SHIFT_KEY_DOWN__): insCh(']')
elif (evt == Draw.RIGHTBRACKETKEY and val and __SHIFT_KEY_DOWN__): insCh('}')
elif (evt == Draw.SEMICOLONKEY and val and __SHIFT_KEY_DOWN__): insCh(':')
elif (evt == Draw.SEMICOLONKEY and val and not __SHIFT_KEY_DOWN__): insCh(';')
elif (evt == Draw.BACKSLASHKEY and val and __SHIFT_KEY_DOWN__): insCh('|')
elif (evt == Draw.BACKSLASHKEY and val and not __SHIFT_KEY_DOWN__): insCh('\\')
elif (evt == Draw.SLASHKEY and val and __SHIFT_KEY_DOWN__): insCh('?')
elif (evt == Draw.SLASHKEY and val and not __SHIFT_KEY_DOWN__): insCh('/')
elif (evt == Draw.MINUSKEY and val and __SHIFT_KEY_DOWN__): insCh("_")
elif (evt == Draw.MINUSKEY and val and not __SHIFT_KEY_DOWN__): insCh("-")
elif (evt == Draw.EQUALKEY and val and __SHIFT_KEY_DOWN__): insCh("+")
elif (evt == Draw.EQUALKEY and val and not __SHIFT_KEY_DOWN__): insCh("=")
elif (evt == Draw.HOMEKEY and val): cursor = -len(cmdBuffer[-1].cmd)
elif (evt == Draw.ENDKEY and val): cursor = -1
elif (evt == Draw.SPACEKEY and val): insCh(' ')
elif (evt == Draw.TABKEY and val):
if Window.GetKeyQualifiers() & Window.Qual.CTRL:
actionAutoCompleate()
else:
insCh('\t')
# UP DOWN ARROW KEYS, TO TRAVERSE HISTORY
elif (evt == Draw.UPARROWKEY and val): actionUpKey()
elif (evt == Draw.DOWNARROWKEY and val): actionDownKey()
elif (evt == Draw.RIGHTARROWKEY and val):
cursor +=1
if cursor > -1:
cursor = -1
elif (evt == Draw.LEFTARROWKEY and val):
cursor -=1
elif (evt == Draw.BACKSPACEKEY and val): cmdBuffer[-1].cmd = ('%s%s' % (cmdBuffer[-1].cmd[:cursor-1] , cmdBuffer[-1].cmd[cursor:]))
elif (evt == Draw.DELKEY and val) and cursor < -1:
cmdBuffer[-1].cmd = cmdBuffer[-1].cmd[:cursor] + cmdBuffer[-1].cmd[cursor+1:]
cursor +=1
elif (evt == Draw.RETKEY and val): actionEnterKey()
elif (evt == Draw.RIGHTMOUSE and not val):actionRightMouse(); return
Draw.Redraw()
def draw_gui():
lineHeight = 16
fontsize = "normal"
# Clear the screen
BGL.glClearColor(0.0, 0.0, 0.0, 1.0)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) # use it to clear the color buffer
# Draw cursor location colour
cmd2curWidth = Draw.GetStringWidth(cmdBuffer[-1].cmd[:cursor], fontsize)
BGL.glColor3f(0.8, 0.2, 0.2)
BGL.glRecti(cmd2curWidth-1,4,cmd2curWidth+1, 20)
BGL.glColor3f(1,1,1)
# Draw the set of cammands to the buffer
Ln = len(cmdBuffer)
while Ln:
if cmdBuffer[-Ln].type == 0:
BGL.glColor3f(1, 1, 1)
elif cmdBuffer[-Ln].type == 1:
BGL.glColor3f(.3, .3, 1)
elif cmdBuffer[-Ln].type == 2:
BGL.glColor3f(1.0, 0, 0)
elif cmdBuffer[-Ln].type == 3:
BGL.glColor3f(0, 0.8, 0)
else:
BGL.glColor3f(1, 1, 0)
BGL.glRasterPos2i(0, (lineHeight*Ln) - 8)
Draw.Text('%s' % cmdBuffer[-Ln].cmd )
Ln -= 1
# This recieves the event index, call a function from here depending on the event.
def handle_button_event(evt):
pass
# Run the console
__CONSOLE_VAR_DICT__ = {} # Initialize var dict
# Print Startup lines
cmdBuffer = [cmdLine("Welcome Ideasman's Blender Console", 1, None),\
cmdLine(' * Right Click: Save output', 1, None),\
cmdLine(' * Arrow Keys: Command history and cursor', 1, None),\
cmdLine(' * Ctrl + Tab: Auto compleate based on variable names and modules loaded, multiple choices popup a menu', 1, None),\
cmdLine(' * Ctrl + Enter: Multiline functions, delays executing code until only Enter is pressed.', 1, None)]
histIndex = cursor = -1 # How far back from the first letter are we? - in current CMD line, history if for moving up and down lines.
# Autoexec, startup code.
console_autoexec = '%s%s' % (Get('scriptsdir'), '/console_autoexec.py')
if not sys.exists(console_autoexec):
# touch the file
open(console_autoexec, 'w').close()
cmdBuffer.append(cmdLine('...console_autoexec.py not found, making new in scripts dir', 1, None))
else:
cmdBuffer.append(cmdLine('...Using existing console_autoexec.py in scripts dir', 1, None))
# Just use the function to jump into local naming mode.
# This is so we can loop through all of the autoexec functions / vars and add them to the __CONSOLE_VAR_DICT__
def autoexecToVarList():
global __CONSOLE_VAR_DICT__ # write autoexec vars to this.
# Execute an external py file as if local
exec(include(console_autoexec))
# Write local to global __CONSOLE_VAR_DICT__ for reuse,
for __TMP_VAR_NAME__ in dir() + dir(Blender):
# Execute the local > global coversion.
exec('%s%s' % ('__CONSOLE_VAR_DICT__[__TMP_VAR_NAME__]=', __TMP_VAR_NAME__))
autoexecToVarList() # pass the blender module
# Append new line to write to
cmdBuffer.append(cmdLine(' ', 0, 0))
#------------------------------------------------------------------------------#
# register the event handling code, GUI #
#------------------------------------------------------------------------------#
def main():
Draw.Register(draw_gui, handle_event, handle_button_event)
main()
More information about the Bf-committers
mailing list