Skip to content

Commit

Permalink
Fix #4559: Hitting ESC during a Model Resize operation now cancelling…
Browse files Browse the repository at this point in the history
… properly
  • Loading branch information
codereader committed Jul 9, 2017
1 parent 0065816 commit 0601c9c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
18 changes: 13 additions & 5 deletions plugins/model/PicoModelNode.cpp
Expand Up @@ -104,7 +104,7 @@ void PicoModelNode::insertLight(const RendererLight& light)
}

// Clear all lights from this model instance
void PicoModelNode::clearLights()
void PicoModelNode::clearLights()
{
_lights.clear();
}
Expand Down Expand Up @@ -137,14 +137,14 @@ bool PicoModelNode::getIntersection(const Ray& ray, Vector3& intersection)

// Renderable submission
void PicoModelNode::submitRenderables(RenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld,
const IRenderEntity& entity) const
const VolumeTest& volume,
const Matrix4& localToWorld,
const IRenderEntity& entity) const
{
// Test the model's intersection volume, if it intersects pass on the
// render call
if (volume.TestAABB(_picoModel->localAABB(), localToWorld) != VOLUME_OUTSIDE)
{
{
// Submit the lights
collector.setLights(_lights);

Expand Down Expand Up @@ -176,11 +176,19 @@ std::string PicoModelNode::getSkin() const

void PicoModelNode::_onTransformationChanged()
{
// Always revert to our original state before evaluating
if (getTransformationType() & TransformationType::Scale)
{
_picoModel->revertScale();
_picoModel->evaluateScale(getScale());
}
else if (getTransformationType() == TransformationType::NoTransform)
{
// Transformation has been changed but no transform mode is set,
// so the reason we got here is a cancelTransform() call, revert everything
_picoModel->revertScale();
_picoModel->evaluateScale(Vector3(1,1,1));
}
}

void PicoModelNode::_applyTransformation()
Expand Down
16 changes: 16 additions & 0 deletions radiant/selection/ManipulateMouseTool.cpp
Expand Up @@ -275,6 +275,22 @@ void ManipulateMouseTool::cancelMove()
{
transform->revertTransform();
}

// In case of entities, we need to inform the child nodes as well
if (Node_getEntity(node))
{
node->foreachNode([&](const scene::INodePtr& child)
{
ITransformablePtr transform = Node_getTransformable(child);

if (transform)
{
transform->revertTransform();
}

return true;
});
}
});

_manipulationActive = false;
Expand Down

0 comments on commit 0601c9c

Please sign in to comment.