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


#80

how to check if threading is enabled ?

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


#81

Am not sure. I found Thread.isThreadingSupported() (import it from PandaModules), but that returns False here too. I believe SIMPLE_THREADS is enabled though, and fear that you can’t check that so easily. But I would really have no clue.
It’s best to disable it anyways, since you’ll run into race conditions when threading isn’t enabled also.


#82

I’ve provided a safe replacement for Python’s threading:

from direct.stdpy import threading

instead of:

import threading

will import a Panda-friendly threading module that also happens to have a similar interface to Python’s. It’s safe to use it in any of Panda’s threading models. It is, of course, only present on the CVS trunk right now.

For the record, though, Threading.isTrueThreads() will return True if Panda has been compiled with true threading enabled, which is the only case in which it’s safe to use ordinary Python threads. (But the new stdpy implementation is still a fine choice to use in this case as well.)

task._priority is intended to be a private data member, and is not meant to be accessed directly. The leading underscore is supposed to clue you in to that. :slight_smile: In the new world, this will be accessible via task.getSort(), since I have boldly renamed what used to be called “priority” to what is now called “sort” in the future. (I needed to do this to make room for a new parameter called “priority” which is more akin to thread priority.)

Edit: if Thread.isThreadingSupported() is returning false on your SIMPLE_THREADS branch, something’s wrong. That’s supposed to return true in this case.

David


#83

Ah, that sounds really useful. We really ought to put that on the manual sooner or later.

I just checked my dtool_config.h and SIMPLE_THREADS is undefined. Sorry, I thought ppremake enabled it by default; so it was correct after all.


#84

UPDATES :
[X] fixed EoL deletion redo bug
[X] fixed document’s changed status upon indentation undo/redo
[X] added join lines ability
[X] now you can change files tabs order, drag it with LMB
[X] removed wx modal dialog usage, so I don’t have to use multiple threads at all.
It’s replaced by my own dialog & polygonal buttons module :

Thus, it also minimizes the annoying window switch when going fullscreen on Windows.

Note : it’s still using python only task[Mgr]


#85

UPDATES :
[X] fixed document’s changed-after-saved status upon undo/redo
[X] improved “welcome screen” interface on Linux, so you can keep holding down ENTER/RETURN for 1 second to open the last edited files.
[X] improved “open recent files” interface :
1 added files removal
2 now uses report-view wx.ListCtrl, so you can multi-select its items easier than using wx.CheckListBox and you can sort it by name or location
[X] 1.6.0-messenger ready : fixed myFinder.crushInstance and myFinder.cleanup for not removing “_messengerId” attribute, so all unneeded events are correctly ignored.


#86

CRITICAL UPDATES :
[X] this is embarassing, I didn’t correctly fix document’s changed status after saved. Now it’s correct.
[X] improved exception handling : 1.6.0-Task[Orig/New] ready, but the rest of it is not ready.
[X] added sort order indicator image to “open recent files” list interface


#87

UPDATES :
[X] fixed IDE mode restoration upon closing “new macro name setting window” by clicking window’s ‘X’ button or ALT-F4.
[X] fixed screen capture upscale resolution
[X] fixed redo delete previous EoL
[X] fixed missing hyphen in “change to lower case” event name
[X] fixed another issue about document’s changed status after saved, the history grouping must be cut to avoid after saved status “bleeding” across the saved “border”.
[X] improved loading gauge and dialogs for better scale consistency across different window resolutions
[X] moved the framerate meter in IDE workspace to lower right corner
[X] adjusted framerate meter’s and IDE’s display regions sort order to the highest 2 maximum integer values
[X] any user-created display regions are removed on update by matching the camera
[X] base.a2d*'s children are also removed on update
[X] now you can explicitly cleanup your scene, not necessarily automatically paired with scene update
[X] now you can clear default cameras transforms, the default behavior on update is leaving its transform untouched
[X] added selection by mouse, works at character, word, and line modes. Word and line modes are triggered by double and triple clicks, respectively. Multiple clicks delay threshold is .3 second each. No column mode yet.
[X] added context menu for document’s tab.


#88

I’m trying this on a development version of 1.6.0 on the Mac, so I’m not sure if this even should work… I’m very interested in trying this out since it is similar to something I wanted to do. At any rate, I get two different errors:

[edit: I see now that the difference between the two errors is whether brokenClass.py is included in the list of files]

$python IDE_STARTER.pyw 
########################################'
STARTING.....
########################################
Warning: DirectNotify: category 'Interval' already exists
Warning: DirectNotify: category 'Messenger' already exists
############### YOUR FILES ############### 
/Users/brent/code/panda3d-ide/testDynScene/dyn1.py
/Users/brent/code/panda3d-ide/testDynScene/jackClass.py
/Users/brent/code/panda3d-ide/testDynScene/pandaClass.py
/Users/brent/code/panda3d-ide/testDynScene/PauseResume.py
/Users/brent/code/panda3d-ide/testDynScene/smileyClass.py 
########################################## 
CWD :   /Users/brent/code/panda3d-ide/testDynScene 
########################################## 
DirectStart: Starting the game. 
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
:display(warning): FrameBufferProperties available less than requested.
:util(warning): Adjusting global clock's real time by 3.36406 seconds.
Couldn't create QTNewDataReferenceFromFullPathCFString().
OpenCV ERROR: Internal error (invalid Movie handle)
	in function icvClose_QT_Movie, cvcap_qt.cpp(259)
Terminating the application...

Then, if I run it again I get a different error:

$python IDE_STARTER.pyw 
########################################'
STARTING.....
########################################
Warning: DirectNotify: category 'Interval' already exists
Warning: DirectNotify: category 'Messenger' already exists
############### YOUR FILES ############### 
/Users/brent/code/panda3d-ide/testDynScene/brokenClass.py
/Users/brent/code/panda3d-ide/testDynScene/dyn1.py
/Users/brent/code/panda3d-ide/testDynScene/jackClass.py
/Users/brent/code/panda3d-ide/testDynScene/pandaClass.py
/Users/brent/code/panda3d-ide/testDynScene/PauseResume.py
/Users/brent/code/panda3d-ide/testDynScene/smileyClass.py 
########################################## 
CWD :   /Users/brent/code/panda3d-ide/testDynScene 
########################################## 
Traceback (most recent call last):
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 1004, in <module>
     renderFrame() # must be done to get the correct properties
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 686, in renderFrame
     base.graphicsEngine.renderFrame()
NameError :  global name 'base' is not defined 

#89

In the 2nd attempt, did you set dyn1.py as the main module ?
The IDE doesn’t import DirectStart, it’s the responsibility of one of the user’s main modules, to let user’s app run naturally.

About the 1st attempt, what is QT doing there ?
Did you edit the test files to import QT ?


#90

Yes, dyn1.py is set as the main module in each run.

QT isn’t related to the QT GUI toolkit; it is referring to Quicktime components required to play the avi on this platform I guess. This must be a problem with the build I have. I commented out lines 167 to 191 in dyn1.py and now get much further, but I think the error is deeper in the library than the IDE code.

$python IDE_STARTER.pyw 
########################################'
STARTING.....
########################################
Warning: DirectNotify: category 'Interval' already exists
Warning: DirectNotify: category 'Messenger' already exists
############### YOUR FILES ############### 
/Users/brent/code/panda3d-ide/testDynScene/dyn1.py
/Users/brent/code/panda3d-ide/testDynScene/jackClass.py
/Users/brent/code/panda3d-ide/testDynScene/pandaClass.py
/Users/brent/code/panda3d-ide/testDynScene/PauseResume.py
/Users/brent/code/panda3d-ide/testDynScene/smileyClass.py 
########################################## 
CWD :   /Users/brent/code/panda3d-ide/testDynScene 
########################################## 
DirectStart: Starting the game. 
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
:display(warning): FrameBufferProperties available less than requested.
:util(warning): Adjusting global clock's real time by 1.48053 seconds.
CC_TEMP CLEARED !! 
TextNode  (0 geoms)
  with font Nimbus Sans L Regular
  alignment is A_left
  text color is 0 0 0 1
  transform is: T:m(pos 0.066 0 0.0158333 scale 0.0395833 1 0.0395833)
  in coordinate system default
  text is 
:TaskManagerwarning: frame 1: task resetPrevTransform ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task dataLoop ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task doLaterProcessor ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task eventManager ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task asyncLoad ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task shakeMe ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-1-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-2-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-3-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-4-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-5-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-6-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-7-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-8-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-9-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-10-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-11-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task LerpFunctionInterval-12-play ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task unstoppable-moveLilsmi ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task move arrows ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task checkNotify ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task IDE_TASKS_handleWx ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task ivalLoop ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task collisionLoop ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task shadowCollisionLoop ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task igLoop ran for 0.04 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task audioLoop ran for 0.00 seconds, avg frame duration=0.00 seconds 
:TaskManagerwarning: frame 1: task allowGarbageCollect ran for 0.00 seconds, avg frame duration=0.00 seconds 
Assertion failed: do_has_ram_mipmap_image(n) at line 2802 of panda/src/gobj/texture.cxx
:ExceptionVarDump:info: printing traceback in case variable repr crashes the process...
Traceback (most recent call last):
  File "IDE.py", line 2237, in <module>
    IDE_toggleSceneActive()
  File "IDE.py", line 863, in IDE_toggleSceneActive
    IDE_pauseScene()
  File "IDE.py", line 918, in IDE_pauseScene
    shootScene()
  File "IDE.py", line 900, in shootScene
    cardTex.store(oimg)
AssertionError: do_has_ram_mipmap_image(n) at line 2802 of panda/src/gobj/texture.cxx

Traceback (most recent call last):
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 2237, in <module>
     IDE_toggleSceneActive()
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 863, in IDE_toggleSceneActive
     IDE_pauseScene()
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 918, in IDE_pauseScene
     shootScene()
  File "/Users/brent/code/panda3d-ide/OnscreenIDEdynamic/IDE.py", line 900, in shootScene
     cardTex.store(oimg)
AssertionError :  do_has_ram_mipmap_image(n) at line 2802 of panda/src/gobj/texture.cxx 

#91

In case it’s related to playing videos: I think I can explain what could be wrong. Panda has two choices for playing videos: ffmpeg and OpenCV. The 1.6.0 pre build includes OpenCV and not ffmpeg – contrary to all the linux and windows builds, which just include ffmpeg.
I had to link OpenCV to OSX’s QuickTime libraries, so I assume Panda is picks OpenCV to play the videos which for some reason fails.
There probably is a bug in Panda’s OpenCV interface.

I could be entirely wrong though.


#92

Perhaps the copy to RAM process is simply queued until next frame.
Did you enable threading in your build ? I haven’t tried it with threading enabled. I’m using 1.6.0 too on Linux, 1.5.3 on Windows, both are fine.
In shootScene(), try to insert these lines :

    while not cardTex.hasRamImage():
       renderFrame()

after this line :

    cardTex=IDE_sceneCapture.getTexture()

See if it fix the problem, or stall instead.
If it failed, then it must be RTMCopyRam mode in addRenderTexture() doesn’t do its job well.

You could also try this :
insert :

    cardTex=Texture()

before addRenderTexture() line, and pass cardTex instead of Texture() to it, and drop this line :

    cardTex=IDE_sceneCapture.getTexture()

#93

I tried both suggestions and unfortunately, while the program does not outright crash, it is not running correctly. The scene pops up correctly for a split second before showing this:
http://www.fprimex.com/files/panda-ide.png

Thanks for looking into this, by the way.


#94

Wow, outrageous !!
For how long was that screen displayed ?
I assume it’s forever, since you even got a chance to shoot it.
If so, it means the texture couldn’t be copied to RAM at all. Otherwise, I don’t know what else to say. I recall it happened to me long time ago on Windows, long before this IDE was born. I can’t remember the responsible code caused that, all I remember is it was only some part of the texture got scrambled, not entirely.
And I can’t duplicate the problem. I guess you’re so lucky.

Normally, I don’t need to copy it to RAM at all. It’s just temporary work around the RTT problem I mentioned here :
discourse.panda3d.org/viewtopic.php?t=5225

Up to 1.5.3, it works correctly, but in 1.6.0, it’s broken.
Meanwhile, just drop the entire RTT code in shootScene(),
comment out this line :

    # render to texture initialization

until this one :

    IDE_sceneCapture.setTexture(newTex)

and replace them with this :

    IDE_sceneCapture=NodePath()

So, you’ll only get blank scene when it’s paused, only the IDE itself will be displayed.

[EDIT]:
after seeing your screenshot in real size (before posting, I watched it using my phone), it seems your console’s output is mixed with the texture of your scene’s shot. I’ve never seen that before.
Looks like driver issue to me. Do all RTT samples work ?


#95

Please ignore my last post.
I just duplicated the problem, but not entirely match your case. I got the same AssertionError : do_has_ram_mipmap_image(n) in shootScene() when the window is minimized.

I fixed it this way :

    cardTex=IDE_sceneCapture.getTexture()
    if cardTex.hasRamImage():
       ox,oy=cardTex.getXSize(),cardTex.getYSize()
       p2x,p2y=math.log(ox,2),math.log(oy,2)
       notP2X,notP2Y=math.modf(p2x)[0]!=.0, math.modf(p2y)[0]!=.0
   #     print 'ox,oy:',ox,oy,
       x,y=2**int(notP2X+p2x), 2**int(notP2Y+p2y)
   #     print 'x,y:',x,y
       oimg=PNMImage()
       cardTex.store(oimg)
       newImg=PNMImage(x,y)
       newImg.copySubImage(oimg,0,y-oy,0,0)
       newTex=Texture()
       newTex.load(newImg)
       IDE_sceneCapture.setTexture(newTex)
    else:
       IDE_sceneCapture.removeNode()

#96

UPDATES :
[X] restored aspect2d’s draw bin to “unsorted” upon update
[X] fixed a bug in (un)indent selection of unflattened textlines
[X] fixed redo join lines : the connector and strip spaces setting are saved to edit history
[X] join lines now removes backslash at lines’ end
[X] any message in screen center is cleared before displaying other messages
[X] improved polyButton module
[X] improved selection by mouse, cycling back to character mode doesn’t start new selection, but restores the selection back to character mode, so you won’t lose the selection.
[X] upon setting a file to be the main module, all .pyc under that file’s path are removed. It’s improved a bit, it’s removed only if the .py exists at the same location.
[X] code completion : added “anywhere” match mode
[X] added system’s color chooser dialog. If there is selected text, which is a comma-separated sequence of 3 numeric characters, it’ll be used as the dialog’s initial color, after clamped to 0…255. If they’re all in range 0…1, they’ll be scaled up to 0…255, otherwise left untouched.
[X] added find and replace, complete with regular expressions. Able to replace in all opened files, as well as filtered files under a directory, recursively. You can choose which files should be processed from the list. No scope selection yet.
Find in all files under directory is not there yet.


#97

:slight_smile: you been a human where i will be glad to meet! it seems your holy circle is flying on your head :smiley: :wink: a great person in computer graphix science and you never bored my eyes. thx

i think we should make anything which rocks soon with your device :smiley:


#98

Ahaha, Dirk, thanks for spending your time joking with me. I’m nothing but a hobbyist, you know ?
You speak like you can see through space and time.
Are you a psychic ?
Do you see twin/reversed/sequential numbers everywhere & everytime ?
I do. :astonished: :confused:
[EDIT]:
Oh, look, this post is the #30333 post. :laughing: :laughing: :laughing:
[EDIT]:
my last update was posted at 11:33pm here (+7), or 11:33am at ETC (-5).
How could that be ?

BTW, this IDE is generally a pain killer for me, on both Panda and editing sides.

EDITING side :
Every IDE I’ve tried has some unbelieveably unique ways in hurting me. I can’t do this or that, or have to do it in weird way. At the end I can only sighhhhhhhhh.
To mention some (in contrast with mine) :
1. Very small amount of recent files, and there is no way to adjust it.
2. Some IDE’s don’t save bookmarks, and some forcefully save bookmarks even if I don’t want to save the file.
3. I can’t easily stop at the edge when cycling over bookmarks, and some IDE’s simply forbid me to wrap to the other edge.
4. So far, no IDE I’ve tried offers me easy macro editing. All of them force me to read the commands reference, since there is no completion for IDE commands itself. It sounds like slouuuuuu hell if I only need to fix my mistakes when recording it, since I’m very aware that I’m just a mistakes factory.
5. So far, no IDE I’ve tried adjusts the recorded macro commands upon undo/redo, it just runs 1 way straight forward, blindfold without looking back, so I have to go through point (4) if I made mistakes.
6. I don’t know if there is IDE which displays indentation helper line only when needed, i.e. when the alignment notch is off the screen. The worst thing is if it’s offscreen, I can’t even see what it is. So, why don’t I just close my eyes instead ? Opening my eyes wouldn’t change anything.
7. I don’t know if there is IDE which shows me other than start-matched completion.
8. Any other IDE’s do multiple lines operation only on lines which have at least 1 selected character in it.
Imagine this, I put the cursor at the 1st column, and then select 2 lines downward, the line on which the cursor is now, won’t be included in the process. Now imagine if I do that in a macro, and I don’t put the cursor first at the first column, the result will be different at macro replay time.
Case 1: cursor is at column #1, there will be 2 processed lines
Case 2: cursor is at column #2, there will be 3 processed lines !!!

PANDA3D side :
If I use large models or textures, I need to load them only once at first, and the next scene updates will load them from the pools. So, I don’t have to waste my time waiting my scene loaded from disk, each time I want to see some changes. This saves lots of time when debuging or developing shaders.


#99

CRITICAL UPDATE:
[X] fixed an old bug in wx’s modal dialog on Linux
[X] used other bitmap for button which doesn’t exist on Linux