Skip to content

Commit

Permalink
Expanded the hack on removeOriginFromChildPrimitives too.
Browse files Browse the repository at this point in the history
  • Loading branch information
stgatilov committed Aug 7, 2021
1 parent 8464877 commit f080e11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins/dm.gameconnection/GameConnection.cpp
Expand Up @@ -749,7 +749,7 @@ std::string saveMapDiff(const DiffEntityStatuses& entityStatuses)
registry::ScopedKeyChanger progressDisabler(RKEY_MAP_SUPPRESS_LOAD_STATUS_DIALOG, true);

// Hack: disable recalculateBrushWindings for this export
registry::ScopedKeyChanger<std::string> guard("MapExporter_recalculateBrushWindings_ignore", "yes");
registry::ScopedKeyChanger<std::string> guard("MapExporter_IgnoreBrushes", "yes");

// Get a scoped exporter class
auto exporter = GlobalMapModule().createMapExporter(writer, root, outStream);
Expand Down
26 changes: 14 additions & 12 deletions radiantcore/map/algorithm/MapExporter.cpp
Expand Up @@ -262,10 +262,14 @@ void MapExporter::disableProgressMessages()

void MapExporter::prepareScene()
{
removeOriginFromChildPrimitives(_root);
// stgatilov: Hack to disable recalculateBrushWindings for hot-reload diffs
if (registry::getValue<std::string>("MapExporter_IgnoreBrushes") != "yes")
{
removeOriginFromChildPrimitives(_root);

// Re-evaluate all brushes, to update the Winding calculations
recalculateBrushWindings();
// Re-evaluate all brushes, to update the Winding calculations
recalculateBrushWindings();
}

// Emit the pre-export event to give subscribers a chance to prepare the scene
GlobalMapResourceManager().signal_onResourceExporting().emit(_root);
Expand All @@ -276,10 +280,14 @@ void MapExporter::finishScene()
// Emit the post-export event to give subscribers a chance to cleanup the scene
GlobalMapResourceManager().signal_onResourceExported().emit(_root);

scene::addOriginToChildPrimitives(_root);
// stgatilov: Hack to disable recalculateBrushWindings for hot-reload diffs
if (registry::getValue<std::string>("MapExporter_IgnoreBrushes") != "yes")
{
scene::addOriginToChildPrimitives(_root);

// Re-evaluate all brushes, to update the Winding calculations
recalculateBrushWindings();
// Re-evaluate all brushes, to update the Winding calculations
recalculateBrushWindings();
}

if (_sendProgressMessages)
{
Expand All @@ -290,12 +298,6 @@ void MapExporter::finishScene()

void MapExporter::recalculateBrushWindings()
{
if (registry::getValue<std::string>("MapExporter_recalculateBrushWindings_ignore") == "yes")
{
// stgatilov: Hack to disable recalculateBrushWindings for hot-reload diffs
return;
}

_root->foreachNode([] (const scene::INodePtr& child)->bool
{
auto* brush = Node_getIBrush(child);
Expand Down

0 comments on commit f080e11

Please sign in to comment.