Onscreen IDE & dynamic instant update [_v0.5.4_]

Thanks. Its working now. I needed to run the file from the command prompt. It didn’t work when I used PyPE. It will take awhile to get use to it. Not being about to highlight lines/text with the cursor is harsh and I don’t seem to be able to copy and paste from other files. And when I hit F9 I got a Syntax Error pointing to the if name == main line of code.

The installation structure should be like this :

IDE_STARTER.pyw
IDE.py
<the rest of IDE’s .py files>
fonts
images
sounds

dyn1.py is just the test module, you can use your own.

Nothing is wrong with the clipboard here, both on Windows and Linux.
Which version of wx are you using ?
Where did you copy the text from ? Was it from PyPE ?

Or perhaps it’s related to your OS, or your wx ANSI version. Which version is yours ? I tried it on XP SP2.
That syntax error is funny. How does your main module look like ?

UPDATE :
[X] bugfix : auto-indent was accidentally broken
[X] startup:open file : add new file action now really appends files instead of replaces the old ones on the list.
[X] the recently closed files now inserted to the top of recent files list. So, if you accidentally close a file, it’s easier to load it back in.
[X] Panda’s default scenegraphs’ and main camera’s render state now correctly cleared. I tried it with the shadow sample, and then changed main module to no-light scene, and it works.
[X] the crusher now works too for classes derived from object type.
[X] all cameras (except Panda’s default and IDE’s code description RTT ones) and their graphics outputs will be removed. This works too for cameras which are not attached to Panda’s default scenegraphs. Once again, I did it by extending Camera class at runtime, so I can remove them simply by yelling at them using messenger.
[X] added buffer viewer toggle
[X] added jump to main module file
[X] added output redirection to a StringStream, displayed as log.txt in the IDE workspace. Use Ctrl-L to create/jump to it. It’s not created by default, but there is a config var you can change.
Here are its behavior :
+ if it’s already created and opened, but you’re editing other file, the log is still updated without interrupting anything you’re currently doing.
+ if you close it, its text display won’t be updated (until you open it again), though the output still fully recorded.
+ its scrolling behavior is similar to Linux’s terminal. If it’s scrolled to the end, upon output update it will be auto-scrolled, otherwise it’s not scrolled at all, so you can peacefully investigate the output without being annoyed by stupid auto-scroll as of Windows command prompt.
+ you can have it displayed too when you jump to scene. Not much you can do there, I only equipped it with the slider bar. I just don’t want to overwhelm your scene with more controls.
Unlike in IDE workspace, it’s displayed without the background layer, so you can see your scene’s real colors. And I don’t leave it rendered with only 1 color, that would make you hard to see it clearly over your colorful/dark/bright scene part. So, I created black halo around the white foreground color. This way, it remains readable no matter how your scene looks like. You can toggle show/hide it using F9.
The halo is created using PNMImage and the result is saved to disk and will be used at next runtime instead of creating it again.
The log file always saved to disk upon IDE shutdown.
[X] the files tab is skinned now.
The main module file tab label is colored green. I only created 5 skins, the 6th is only a combination of the others, showing that you can have asymetrical left-right edges. You can create your own skins, if you want.
The behavior of tab border :
1 if IDEtab_Rcorner.png exists, it will be used for right edge instead of the horizontally auto-flipped IDEtab_Lcorner.png
2 if IDEtab_mid.png exists, it will be used instead of U=1 (rightmost column) of IDEtab_Lcorner.png
The tab label skin has only behavior 1.
At runtime, you can cycle those skins using Ctrl-tilde. There is a config var for the default skin.

Possible problems :
[?] I couldn’t remove any shader, no matter what I tried. ShaderPool.releaseAllShaders() doesn’t work. So if I change a shader file, I couldn’t force it to be reloaded and compiled. I’m clueless, so I did it by hacking loader.loadShader. So, before sending the shader to ShaderPool, I temporarily alter its filename so it will be considered as new shader. That works great, but I believe it lets all old shaders floating around uselessly. I don’t know what to do about them.
[?] I couldn’t intercept Notify output in realtime. I monitor the output change only in a task, so all Notify output are accumulated at the end of frame, while Python’s print can be caught in realtime.

UPDATE :
[X] bugfix : I forgot to clear Ctrl down status when go back to IDE
[X] bugfix : I forgot to hide buffer viewer before shooting the scene
[X] the log over scene texture is saved per OS, since the letters arrangement is different on each OS.
[X] a buffer which doesn’t have a camera will be destroyed too, i.e. when an error occurs after buffer creation but before setting the camera for it.
[X] upon IDE/scene switch, the cursor hidden status is preserved.
[X] programmatic pointer movement is disabled when you go back to IDE. It will be repositioned to the last recorded resting coordinate at your next jump to scene, so you won’t get sudden movement if you use e.g. FPS camera controls. I do FPS all the time myself.
[X] the status bar is simple skinned and exploited a bit further to display some infos : errors count (per file), and the usual messages displayed at screen center are also displayed here too.
[X] better appearance consistency of tabs and status bar at different window resolutions.

UPDATE :
[X] if the last edited main module file doesn’t exist, a warning will be displayed at startup screen and the open last edited files button will be disabled.
[X] if some other files don’t exist, the retry open window will be displayed instead of silently left unloaded.
[X] the realtime clock in the test scene is not activated during loading to avoid waking up scheduled stuff too early. This fixes weird errors if you use render frame call or framework step during loading, so the loading time is longer than those stuff’s time schedule, especially if you’re not using model cache.
[X] fixed code description RTT for GPU which only able to create ParasiteBuffer, done by laying out more cards and cameras.
[X] the code description text is much clearer now.

This is on Linux, which I only get ParasiteBuffer :

Really impressive.

One of the most active and impressive project for the dev of Panda i see on this community.

Really thx

When I run the IDE_STARTER.pyw, I get this error:

I was able to use one of the earlier version, but this one doesn’t work.

I guess you must removed all files in your installation. This won’t work for fresh install, I just noticed. :astonished: :astonished:
I can’t upload the whole thing, there are some not-ready stuff going on.
NOTE: this is already fixed in the latest update.

Thank you very much :slight_smile:

UPDATE :
[X] bugfix : 1 more vanishing line bug is gone
[X] to avoid halt, globalClock will be reset to normal mode if there is an exception and after rebinding main module upon save
[X] arguments count/type mismatch error tracking now works at messenger level too, as demonstrated in the test scene by adding 3 more events to trigger the errors.
[X] the main module and the currently running module are correctly distinguished to be able to catch the errors, which are obviously belong to the running one.
[X] I guess I forgot to mention that you’re not necessarily have a World class to instantiate, in case you just need to try something very simple. It’s good I forgot about mentioning it afterall, since I just got the crusher work too for crushing main module’s global namespace. The needed framework components are not destroyed of course : base, bboard,directNotify, eventMgr, giveNotify, ivalMgr, jobMgr, loader, messenger, onScreenDebug, taskMgr. To demonstrate this, I created a DirectObject instance outside World class in dyn1.py, which accepts an event. Upon update, the event hook remains only 1, or if you comment it out, it will be gone. The consequence is the cleanup procedure is a bit longer, but it’s good for ensuring environment cleanliness.
Warning: this module global namespace cleanup doesn’t happen yet for the imported modules though, especially if those stuff in the imported modules are not meant to be exported, so they don’t exist in the importer module’s global namespace.
[X] updated PauseResume module to pause tasks which aren’t bound to any class
[X] the IDE now uses independent button thrower, so you can freely use the default button throwers. You can also create some more as you need, and the custom ones will be removed upon update. I only remove the ones parented under the default data root node, though. The default and custom ones are disabled when you’re in IDE workspace, and enabled when you jump to scene.

UPDATE :
[X] improved text rendering optimization trick. Previously, for thousands of lines, when a document is displayed for the 1st time after starting the IDE, there is a little halt. It’s because I used 1 huge bulk of display scenegraph and used stash/unstash to display the onscreen text lines, so I had to operate on a large number of nodes. There is a bit halt for lines insertion/deletion operation too, since I had to shift the lines’ Z below the inserted/deleted ones. I found this halt too annoying, so I decided to go further in optimizing it.
Now the text lines are parented to a floating parent (not attached to the display scenegraph). Each onscreen text line is instanced to display scenegraph and placed at its Z as you scroll, or whenever needed, which only takes 0.001 second to complete. This way, I need to adjust the Z only for the onscreen ones, not the rest of them. …sayonara halt…
[X] added bookmark
What’s special :
1 the bookmarks are saved. Some IDE don’t do this. KomodoEdit does this, but if I don’t save the file, the marks will be saved anyway, resulting in incorrect position. I guess the authors forgot to make copy of the marks, and end up modifying the stored marks list, which is intended to be updated upon file save only.
2 some IDEs always allow navigation cycle, which I dislike since I can’t stop cycling at the 1st/last one. Some use config variable to enable/disable it, but don’t provide a way to jump/wrap to the opposite end.
What I like are, I can stop at the 1st/last one, and also able to wrap to the 1st/last one, without using config var to toggle this behavior, or using additional keymap (I’d like to spend my brain surface to store more important stuff). So, I did it this way : if the cursor is at the 1st/last mark, it’ll stop there. If you want to wrap to the opposite end, keep holding down the keys for at least 0.75 second. Once the cursor is teleported there, there’ll be another 0.75 sec delay to give you a chance to release those keys, so it won’t start jumping around aggresively.
[X] the cursor position and page scroll are also saved too
[X] added bam cache for the text. This works best with OPTIMIZE-TEXT-AT-LOADING set to True, since the memory consumption is linear to the nodes count. If you have alot of RAM, I guess you’ll be fine setting it False. For 5000+ lines, without bam cache, generating the text takes 12+ secs (50 secs if O-T-A-L is True). With cache, it’s loaded in < 1.5 secs. The text display is saved to bam on disk upon manual file save. Upon scene update, the saved files’ text display are only saved to bam stream in RAM, and will be written to disk at exit or upon file close, it’s just to minimize HDD hit. The file’s bam cache will be removed if you change the file outside the IDE.
[X] PauseResume module : now doesn’t pause IDE’s tasks, e.g. wxPython loop on Linux.

:smiley: WOW !!! :open_mouth: genuis!

but one thing :wink: , you need to know that the download link from 3th august isnt working.

Thanks for your appreciation, all.

Dirk, did you mean this one : ynjh.panda3dprojects.com/OIDE/IDE_STARTER.pyw ?
It was just a temporary fix. The latest update already covers that bug, of course, so I removed it. I should’ve put that link away. Now it’s gone, so it won’t confuse anyone else again.

Not tested your IDE but read your note about ShaderPool.releaseAllShaders. Do you already have a solution. So far I discovered the following fancy thing (I don’t understand it, but maybe it has something to do with a RefCount).

If I write my shader reload snippet like this, I can reload shaders without restarting the appliaciton, by first pressing “2” and than press “1”.

def clearShader():
    world.clearShader()
    ShaderPool.releaseAllShaders()
def loadShader():
    shader = loader.loadShader("shader.sha")
    world.setShader(shader)
base.accept("1", loadShader)
base.accept("2", clearShader)

If I rewrite loadShader:

def loadShader():
    clearShader()
    shader = loader.loadShader("shader.sha")
    world.setShader(shader)

Then pressing only “1” won’t reload the shader.

Wow, you’ve just saved the day, Azraiyl. Great experiments. Thanks for opening my eyes.
So the refcount must be entirely dropped to 0 at the next frame after the clearing process. You need to advance the frame, either by base.graphicsEngine.renderFrame() or taskMgr.step() before reload.

MINOR UPDATES :
[X] since 1.5.3, DirectScrolledFrame uses ScissorAttrib (DisplayRegion) (which can’t be overriden at descendant level) instead of clip planes, so the linemarks were clipped. It’s fixed by parenting them directly to the DSF instead of the canvas, and scrolled separately as the canvas scrolls.
[X] fixed inefficient shader reload
[X] smart paste : the pasted multiple lines now auto-indented following the 1st line
[X] added repeated character(s) insertion

[EDIT] (repeated characters interface) :
[+] simplified, no longer using “insert” buttons. Replaced by pressing ENTER/RETURN at the “Counts” or “Fill until column” textbox.
[+] the textboxes values are preserved

UPDATES :
[X] repeated characters interface : pressing ESCAPE cancels it
[X] exit & save files window : widgets navigation (TAB & ENTER) is now active and handled manually on Windows, since wx eventloop is not used on Windows because it steals P3D keystrokes. Temporarily enabling that loop doesn’t help.
[X] changed keys for “change case” commands
[X] fixed CWD update at “open last files” screen
[X] added brackets & quotes pair completion
[X] finally, edit history is available, so it’s pretty safe to use, and I consider the status is now alpha
[X] added macro recording, replaying, and editing
features :
(+) unlike some editors, mine respects undo & redo operations while recording. The currently recorded commands are synchronized accordingly to edit history, so you neither have to be very careful when recording, nor need to edit it later if you made mistakes.
(+) unlike some editors, in which a paste command always injects whatever clipboard content at macro replay time, you can choose to inject clipboard content statically or dynamically, per paste recording. So, you don’t have to type it by hands if you want to use it only as fixed text.
(+) I don’t save every macro to an independent hand-editable text file. Instead, I simply pickle all macros to disk. In case you need to edit any macro, there is graphical macro editor, integrated to macro manager. Its usage is simple, just change any options and save it. All exposed command arguments are associated accordingly to the widgets.

I just got the chance to try it out. It’s really neat! Thanks alot for making this.
Although, it has some issues with the 1.6 branch of Panda3D:

  • Please get those “thread” and “threading” imports out! In the new 1.6 branch which enables threading by default, Panda will crash and burn in a horrible cloud of black smoke when using python’s threading modules, so get them out. At least don’t have them checked by default.
  • You are using task._priority, although, interrogate doesn’t support direct access to data members. Please use getPriority() instead. I had to change it before I was able to run it.

Other than that, keep up the good work!

how to check if threading is enabled ?

that’s the new C++ task mgr, right ?
I haven’t looked at it at all.