Recreating NoesisView with the same content
We've integrated Noesis into an engine. We're wondering if there's a way to recreate or clone a view and its content (FrameworkElement).
We have a bunch of subsystems that create views. However, the engine's renderer could reset at anytime (due to rendering config changes or from switching gfx apis at runtime).
When this happens, we cannot simply get the view's renderer, shut it down and reinitialize it.
In Renderer::Shutdown(), there's a specific comment saying:
- GetContent() from the view
- Call Shutdown on the view's renderer and release the view
- Create a new view using the content from GetContent()
This works okay with some views, but not others.
For example, this work flow asserts with a specific view in TimeManager::AddMasterClock(...) where the target pointer member is NULL.
Is there a way to be able to change the View's renderer or recreate the same view and its content when the renderer changes?
Or are we forced to have each system using Noesis to reset themselves (destroy all views, states, and reinitialize)?
Thank you.
We have a bunch of subsystems that create views. However, the engine's renderer could reset at anytime (due to rendering config changes or from switching gfx apis at runtime).
When this happens, we cannot simply get the view's renderer, shut it down and reinitialize it.
In Renderer::Shutdown(), there's a specific comment saying:
To get around this, we do the following instead:// mInitialized is left to true because we only support one Init()/Shutdown() cycle for now
- GetContent() from the view
- Call Shutdown on the view's renderer and release the view
- Create a new view using the content from GetContent()
This works okay with some views, but not others.
For example, this work flow asserts with a specific view in TimeManager::AddMasterClock(...) where the target pointer member is NULL.
Is there a way to be able to change the View's renderer or recreate the same view and its content when the renderer changes?
Or are we forced to have each system using Noesis to reset themselves (destroy all views, states, and reinitialize)?
Thank you.
Re: Recreating NoesisView with the same content
Theoretically this should work. Although it is a not well tested path. Could you please open a ticket about this?To get around this, we do the following instead:
- GetContent() from the view
- Call Shutdown on the view's renderer and release the view
- Create a new view using the content from GetContent()
This is definitely the safest option, but probably the hardest to implement on your side, right?Or are we forced to have each system using Noesis to reset themselves (destroy all views, states, and reinitialize)?
Re: Recreating NoesisView with the same content
Hello @jsantos.
I'll open up a ticket with further information.
Cheers.
I'll open up a ticket with further information.
That would not be ideal indeed. It'd require quite a bit of refactoring instead of being able to automate this in a common logic for all views when the renderer is being reset.This is definitely the safest option, but probably the hardest to implement on your side, right?
Cheers.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest