Jump to content

disposed meshes having ._bind called


JCPalmer
 Share

Recommended Posts

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 stack
  • var ret = popped.modalReturnedValue // for return
  • calls popped.dispose()
  • makes the current top visible again
  • current.modalReturnedValue = ret
  • calls current.modalReturnCallBack, if set

Was 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();    }}
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...