Recreating NoesisView with the same content
Posted: 12 Sep 2023, 23:20
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.