Skip to content
Permalink
Browse files

Fix the crash described in #5132. Patches were submitting UndoMemento…

…s to the undo system even though they ended up not being added to the scene.

The new approach is to only add them to the scene after it's clear they are going to be kept.
  • Loading branch information
codereader committed Mar 23, 2020
1 parent 6ffd7e3 commit e1c31bb790b04cf5d4e8646b2f43fa4aa5a89277
Showing with 7 additions and 10 deletions.
  1. +0 −3 radiant/patch/Patch.cpp
  2. +7 −7 radiant/patch/algorithm/General.cpp
@@ -2539,9 +2539,6 @@ void Patch::createThickenedWall(const Patch& sourcePatch,

// Notify the patch about the change
controlPointsChanged();

// Texture the patch "naturally"
NaturalTexture();
}

void Patch::stitchTextureFrom(Patch& sourcePatch) {
@@ -53,10 +53,6 @@ void thicken(const PatchNodePtr& sourcePatch, float thickness, bool createSeams,
// Now create the four walls
for (int i = 0; i < 4; i++)
{
// Insert each node into the same parent as the existing patch
// It's vital to do this first, otherwise these patches won't have valid shaders
parent->addChildNode(nodes[i]);

// Retrieve the contained patch from the node
Patch* wallPatch = Node_getPatch(nodes[i]);

@@ -65,15 +61,19 @@ void thicken(const PatchNodePtr& sourcePatch, float thickness, bool createSeams,

if (!wallPatch->isDegenerate())
{
// Insert each node into the same parent as the existing patch
// It's vital to do this first, otherwise these patches won't have valid shaders
parent->addChildNode(nodes[i]);

// Now the shader is realised, apply natural scale
wallPatch->NaturalTexture();

// Now select the newly created patch
Node_setSelected(nodes[i], true);
}
else
{
rMessage() << "Thicken: Discarding degenerate patch." << std::endl;

// Remove again
parent->removeChildNode(nodes[i]);
}
}
}

0 comments on commit e1c31bb

Please sign in to comment.
You can’t perform that action at this time.