JCPalmer Posted April 7, 2015 Share Posted April 7, 2015 I am trying to implement a modal stack of dialogs. The 2nd dialog pushed on the stack works (layermask of 0 hides 1st dialog). When the "OK" button is clicked, the assigned callback makes a call which:pops the dialog (mesh) off the stackvar ret = popped.modalReturnedValue // for returncalls popped.dispose()makes the current top visible againcurrent.modalReturnedValue = retcalls current.modalReturnCallBack, if setWas getting "TypeError: this._geometry is null" in mesh._bind. The scene is then frozen. The 2nd dialog is still there, no first dialog re-appearance.Thought I might have code doing stuff with disposed meshes, so I just set a var to only queue disposal. These "top level" dialogs have a before renderer, so it checks for the var next call & does it there. Same result. Modified _bind to write to console the effect & mesh name when geometry is null. Got the "top level" mesh that has the beforerenderer & the effect was "default". The closest I can do is to call a method I have, called removeAll(). It does not dispose() the caller itself. Then hide it. Anything I could differently?private _beforeRender() : void { if (this._queueDispose){ this.removeAll(); this.setLayerMask(0); }else if (this._dirty){ this.layout(); }} Quote Link to comment Share on other sites More sharing options...
fenomas Posted April 8, 2015 Share Posted April 8, 2015 Just a wild guess, but mesh.beforeRender takes place during the scene's render operation, right? And I'd think that disposing stuff halfway through a render would be generally unsafe. Did you try disposing stuff in the scene's beforeRender, or a tick function outside the render loop? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 8, 2015 Author Share Posted April 8, 2015 Thanks, that was enough for me to figure it out. This topic also answers the Jeopardy question: Why are there after render entry points? Disposal is back in the button callback itself. Button callbacks were actually happening in a before renderer. This was for look and feel. The pick callback would change the border material to orange & start the wait clock. After at least 1000 / 60 milli the before renderer would actual run the application callback, then change the material back. Moving disposal to the top level's before renderer just moved the problem. As an after render, no timing required, a single frame occurred with the border orange. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.