Skip to content

Commit

Permalink
#5969: Ensure that the snapped control vertices are saved over the ac…
Browse files Browse the repository at this point in the history
…tual control point array before calling onControlPointsChanged()
  • Loading branch information
codereader committed Jun 6, 2022
1 parent 8487ddd commit d43ac8a
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions radiantcore/patch/PatchNode.cpp
Expand Up @@ -133,21 +133,24 @@ bool PatchNode::selectedVertices() {
return false;
}

void PatchNode::snapComponents(float snap) {
void PatchNode::snapComponents(float snap)
{
// Are there any selected vertices
if (selectedVertices()) {
// Tell the patch to save the current undo state
m_patch.undoSave();

// Cycle through all the selected control instances and snap them to the grid
for (PatchControlInstances::iterator i = m_ctrl_instances.begin(); i != m_ctrl_instances.end(); ++i) {
if(i->isSelected()) {
i->snapto(snap);
}
}
// Tell the patch that control points have changed
m_patch.controlPointsChanged();
}
if (!selectedVertices()) return;

// Cycle through all the selected control instances and snap them to the grid
for (auto& vertex : m_ctrl_instances)
{
if (vertex.isSelected())
{
vertex.snapto(snap);
}
}

// Save the transformed control point array to the real set
m_patch.freezeTransform();
// Tell the patch that control points have changed
m_patch.controlPointsChanged();
}

// Test the Patch instance for selection
Expand Down

0 comments on commit d43ac8a

Please sign in to comment.