slow when in interactive console

Heu guys,

The problem is , it becomes incredibly sluggish when the interactive console is filled with characters. For example if i had a lot of objects in the scene and i printed it in the console using Blender.Object.Get(), all of the object names fills the console…and when i try to type the next command, its incredibly slow. Same thing happens when i check the functions and attributes of objects using ‘dir’.

I’m a newbie in Python and Blender. Can anyone tell me if there is a setting or something to overcome this? Or perhaps there is a buffer that i need to flush?

I noticed that if i increased the size of the console window, I can type a bit faster. I usually split half for scripting and the other a 3d window. And i split the 3d window to two …one the 3d window and the other interactive console…

Thanx

It’s the linewrap code in console.py. I think it must come that way as some kind of rite of passage.

yes, linewrap sucks and removing it will make a lot of improvement,
I had a look at adding some Python API calls that might make it faster but even down to the C/C++ level, doing line wrap is not easy.
Maybe the option to disable would be best for now.


        else: # WRAP?
            # LINE WRAP
            lwid = Draw.GetStringWidth(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0])
            if margin + lwid >  __CONSOLE_RECT__[2]:
                wrapLineList = []
                wtext = cmdBuffer[-consoleLineIdx].cmd
                wlimit = len(wtext)
                chunksz = int(( __CONSOLE_RECT__[2] - margin ) / (lwid / len(wtext)))
                lstart = 0
                fsize = __FONT_SIZES__[__FONT_SIZE__][0]
                while lstart < wlimit:
                    lend = min(lstart+chunksz,wlimit)
                    ttext = wtext[lstart:lend]
                    while lend < wlimit and Draw.GetStringWidth(ttext, fsize) + margin < __CONSOLE_RECT__[2]:
                        lend += 1
                        ttext = wtext[lstart:lend]
                    while lend > lstart+1 and Draw.GetStringWidth(ttext, fsize) + margin > __CONSOLE_RECT__[2]:
                        lend -= 1
                        ttext = wtext[lstart:lend]
                    wrapLineList.append(ttext)
                    lstart = lend
                
                # Now we have a list of lines, draw them (OpenGLs reverse ordering requires this odd change)
                wrapLineList.reverse()
                for wline in wrapLineList:
                    BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1]*((consoleLineIdx-__CONSOLE_LINE_OFFSET__) + wrapLineIndex)) - 8)
                    Draw.Text(wline, __FONT_SIZES__[__FONT_SIZE__][0])
                    wrapLineIndex += 1
                wrapLineIndex-=1 # otherwise we get a silly extra line.

Thank you jthill, I have done some quick tests and that works great!

When I started playing with the Python coding tutorials I noticed this as well, but being a newbie to Python I am curious where I would put such a correction code? Should I save it as a module and modify the console.py to import, or should I modify the console.py directly?

Thank you