If one were to attach a NodePath to “render”, and then almost immediately detach it in the same method, is there an opportunity for a frame to be automatically rendered…?
I ask because I’m currently debugging an issue related to object-positions, to which end I’ve tried attaching the offending NodePath to “render”, performing a few operations (setting position and heading), and then immediately detaching it again–and this seems to result in a crash due to a missing shader-input. Which is surprising, as I would expect that the object would have no opportunity to be rendered before it’s detached…
Update: Confusingly, it seems that only the call to detachNode, without the call to “reparentTo”, is called for–the following form likewise produces the crash:
But how might that be? Detaching the node shouldn’t require it to be rendered… o_0
(Note for clarity that the NodePath in question is initially not parented to anything.)
Only if you are using the multi-threaded render pipeline. You haven’t mentioned whether you have enabled it.
Is Panda crashing due to a missing shader input? That shouldn’t happen. At the very worst you should see an exception. You’re not using a special release-optimized build of Panda, are you? Can you share more details about the crash and surrounding messages?
I’m pretty confident that I’m not using that pipeline. A quick check of my calls to “loadPrcFileData” (I’m not using a custom “.prc” file) indicates that I experimented with it, but that the relevant call is commented out.
In all fairness, it’s probably less a crash than Python stopping due to the exception. Trying a quick test, I get an “AssertionError”, to be specific.
Sorry, I daresay that I should have differentiated that!
I am not.
Interestingly, an attempt at reproducing the issue with “detachNode” in a self-contained program has failed: in said program there is no exception produced when I use an event to do more or less what I outlined above. And that even with the multi-threaded pipeline enabled, I believe! Odd!
I imagine that there was something different in my main program, but I don’t know what, offhand.
Well, at the moment it’s become a non-issue for me: I found the source of the original object-position-related bug that I was dealing with, and believe that I have it sorted out–and that without the “attach-operate-and-detach” trick that I was experimenting with, and thus without the issue that I was seeing with the “detach” portion thereof.
I’m happy to leave this aside, unless you want to investigate further!