Skip to content

Commit

Permalink
#5281: Visibility and active status are persisted to the .darkradiant…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
codereader committed Oct 29, 2022
1 parent b11ee57 commit c702222
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions radiantcore/layers/LayerInfoFileModule.cpp
Expand Up @@ -8,6 +8,7 @@
#include "string/convert.h"
#include "debugging/ScenegraphUtils.h"
#include "parser/DefTokeniser.h"
#include "string/join.h"

namespace scene
{
Expand Down Expand Up @@ -75,8 +76,15 @@ void LayerInfoFileModule::onBeginSaveMap(const scene::IMapRootNodePtr& root)
{
_layerNameBuffer << "\t\t" << LAYER << " " << layerId << " { " << layerName << " }" << std::endl;
_layerHierarchyBuffer << "\t\t" << LAYER << " " << layerId << " " << PARENT << " { " << layerManager.getParentLayer(layerId) << " }" << std::endl;

if (!layerManager.layerIsVisible(layerId))
{
_hiddenLayerIds.push_back(layerId);
}
});

_activeLayerId = layerManager.getActiveLayer();

// Close both blocks
_layerNameBuffer << "\t}" << std::endl;
_layerHierarchyBuffer << "\t}" << std::endl;
Expand Down Expand Up @@ -128,6 +136,13 @@ void LayerInfoFileModule::writeBlocks(std::ostream& stream)
// Write the layer names block
stream << _layerNameBuffer.str();

// Write the layer properties block
stream << "\t" << LAYER_PROPERTIES << std::endl;
stream << "\t{" << std::endl;
stream << "\t\t" << ACTIVE_LAYER << " { " << _activeLayerId << " }" << std::endl;
stream << "\t\t" << HIDDEN_LAYERS << " { " << string::join(_hiddenLayerIds, " ") << " }" << std::endl;
stream << "\t}" << std::endl;

// Write the layer hierarchy block
stream << _layerHierarchyBuffer.str();

Expand Down

0 comments on commit c702222

Please sign in to comment.