[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12313] trunk/blender/release/scripts/ console.py: python console, removed word wrap - was far too slow
Campbell Barton
cbarton at metavr.com
Sat Oct 20 21:47:19 CEST 2007
Revision: 12313
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12313
Author: campbellbarton
Date: 2007-10-20 21:47:19 +0200 (Sat, 20 Oct 2007)
Log Message:
-----------
python console, removed word wrap - was far too slow
when console_autoexec.py wasnt present, the standard blender import wasnt executed.
Modified Paths:
--------------
trunk/blender/release/scripts/console.py
Modified: trunk/blender/release/scripts/console.py
===================================================================
--- trunk/blender/release/scripts/console.py 2007-10-20 19:12:06 UTC (rev 12312)
+++ trunk/blender/release/scripts/console.py 2007-10-20 19:47:19 UTC (rev 12313)
@@ -285,6 +285,8 @@
# Try and run the user entered line(s)
try:
# Load all variabls from global dict to local space.
+ __TMP_VAR_NAME__ = __TMP_VAR__ = '' # so as not to raise an error when del'ing
+
for __TMP_VAR_NAME__, __TMP_VAR__ in __CONSOLE_VAR_DICT__.items():
exec('%s%s' % (__TMP_VAR_NAME__,'=__TMP_VAR__'))
del __TMP_VAR_NAME__
@@ -295,7 +297,8 @@
# Flush global dict, allow the user to remove items.
__CONSOLE_VAR_DICT__ = {}
-
+
+ __TMP_VAR_NAME__ = '' # so as not to raise an error when del'ing
# Write local veriables to global __CONSOLE_VAR_DICT__
for __TMP_VAR_NAME__ in dir():
if __TMP_VAR_NAME__ != '__FILE_LIKE_STRING__' and\
@@ -715,6 +718,15 @@
else:
BGL.glColor3f(1, 1, 0)
+ if consoleLineIdx == 1: # user input
+ BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * (consoleLineIdx-__CONSOLE_LINE_OFFSET__)) - 8)
+ Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0])
+ else:
+ BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * ((consoleLineIdx-__CONSOLE_LINE_OFFSET__)+wrapLineIndex)) - 8)
+ Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0])
+
+ # Wrapping is totally slow, can even hang blender - dont do it!
+ '''
if consoleLineIdx == 1: # NEVER WRAP THE USER INPUT
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * (consoleLineIdx-__CONSOLE_LINE_OFFSET__)) - 8)
# BUG, LARGE TEXT DOSENT DISPLAY
@@ -751,7 +763,7 @@
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * ((consoleLineIdx-__CONSOLE_LINE_OFFSET__)+wrapLineIndex)) - 8)
Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0])
-
+ '''
consoleLineIdx += 1
@@ -806,7 +818,8 @@
# Execute an external py file as if local
exec(include(includeFile))
-
+
+def standard_imports():
# Write local to global __CONSOLE_VAR_DICT__ for reuse,
for ls in (dir(), dir(Blender)):
for __TMP_VAR_NAME__ in ls:
@@ -814,10 +827,12 @@
exec('%s%s' % ('__CONSOLE_VAR_DICT__[__TMP_VAR_NAME__]=', __TMP_VAR_NAME__))
exec('%s%s' % ('__CONSOLE_VAR_DICT__["bpy"]=', 'bpy'))
-
+
if scriptDir and console_autoexec:
include_console(console_autoexec) # pass the blender module
+standard_imports() # import Blender and bpy
+
#-end autoexec-----------------------------------------------------------------#
@@ -831,4 +846,4 @@
Draw.Register(draw_gui, handle_event, handle_button_event)
if __name__ == '__main__':
- main()
\ No newline at end of file
+ main()
More information about the Bf-blender-cvs
mailing list