diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 042b38cc3..7867b1ec7 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -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) diff --git a/src/Viewer/GraphicsPresets.cxx b/src/Viewer/GraphicsPresets.cxx index 3942b8a1b..2ade67e9b 100644 --- a/src/Viewer/GraphicsPresets.cxx +++ b/src/Viewer/GraphicsPresets.cxx @@ -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) { diff --git a/src/Viewer/GraphicsPresets.hxx b/src/Viewer/GraphicsPresets.hxx index bc2d3037a..deaa80584 100644 --- a/src/Viewer/GraphicsPresets.hxx +++ b/src/Viewer/GraphicsPresets.hxx @@ -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 _listener; std::unique_ptr _restartListener; std::unique_ptr _sceneryReloadListener; + std::unique_ptr _compositorReloadListener; string_list _propertiesToSave; };