Add support for Compositor reloading in graphics presets
This commit is contained in:
parent
3fa13b7762
commit
1423e7d366
3 changed files with 9 additions and 3 deletions
|
@ -947,6 +947,8 @@ void warpGUIPointer(CameraGroup* cgroup, int x, int y)
|
|||
|
||||
void reloadCompositors(CameraGroup *cgroup)
|
||||
{
|
||||
cgroup->_viewer->getViewerBase()->stopThreading();
|
||||
|
||||
for (auto &info : cgroup->_cameras) {
|
||||
// Ignore the GUI camera
|
||||
if (info->flags & CameraInfo::GUI)
|
||||
|
@ -959,7 +961,6 @@ void reloadCompositors(CameraGroup *cgroup)
|
|||
SGReaderWriterOptions::fromPath(globals->get_fg_root());
|
||||
options->setPropertyNode(globals->get_props());
|
||||
|
||||
cgroup->_viewer->getViewerBase()->stopThreading();
|
||||
// Force deletion
|
||||
info->compositor.reset(nullptr);
|
||||
// Then replace it with a new instance
|
||||
|
@ -971,8 +972,10 @@ void reloadCompositors(CameraGroup *cgroup)
|
|||
viewport,
|
||||
compositor_path,
|
||||
options));
|
||||
cgroup->_viewer->getViewerBase()->startThreading();
|
||||
}
|
||||
|
||||
cgroup->_viewer->getViewerBase()->startThreading();
|
||||
fgSetBool("/sim/rendering/compositor-reload-required", false);
|
||||
}
|
||||
|
||||
void CameraGroup::buildDefaultGroup(osgViewer::View* viewer)
|
||||
|
|
|
@ -30,6 +30,7 @@ const char* kPresetActiveProp = "/sim/rendering/preset-active";
|
|||
|
||||
const char* kRestartRequiredProp = "/sim/rendering/restart-required";
|
||||
const char* kSceneryReloadRequiredProp = "/sim/rendering/scenery-reload-required";
|
||||
const char* kCompositorReloadRequiredProp = "/sim/rendering/compositor-reload-required";
|
||||
|
||||
// define the property prefixes which graphics presets are allowed to
|
||||
// modify. Changes to properties outside these prefixes will be
|
||||
|
@ -256,6 +257,7 @@ void GraphicsPresets::init()
|
|||
|
||||
_restartListener.reset(new RequiredPropertyListener{kRestartRequiredProp, graphicsPropsXML->getChild("restart-required")});
|
||||
_sceneryReloadListener.reset(new RequiredPropertyListener{kSceneryReloadRequiredProp, graphicsPropsXML->getChild("scenery-reload-required")});
|
||||
_compositorReloadListener.reset(new RequiredPropertyListener{kCompositorReloadRequiredProp, graphicsPropsXML->getChild("compositor-reload-required")});
|
||||
|
||||
SGPropertyNode_ptr toSave = graphicsPropsXML->getChild("save-to-file");
|
||||
if (toSave) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
void applyInitialPreset();
|
||||
|
||||
/**
|
||||
* @brief Apple the settings defined in the current graphics preset,
|
||||
* @brief Apply the settings defined in the current graphics preset,
|
||||
* to the property tree
|
||||
*
|
||||
*/
|
||||
|
@ -82,6 +82,7 @@ private:
|
|||
std::unique_ptr<GraphicsConfigChangeListener> _listener;
|
||||
std::unique_ptr<RequiredPropertyListener> _restartListener;
|
||||
std::unique_ptr<RequiredPropertyListener> _sceneryReloadListener;
|
||||
std::unique_ptr<RequiredPropertyListener> _compositorReloadListener;
|
||||
|
||||
string_list _propertiesToSave;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue