cancel instance move on drag abort

move
Marc Zinnschlag 9 years ago
parent d57021b23c
commit 1240e0c716

@ -376,3 +376,11 @@ void CSVRender::Cell::setSubMode (int subMode, unsigned int elementMask)
iter!=mObjects.end(); ++iter)
iter->second->setSubMode (subMode);
}
void CSVRender::Cell::reset (unsigned int elementMask)
{
if (elementMask & Mask_Reference)
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter)
iter->second->reset();
}

@ -122,6 +122,10 @@ namespace CSVRender
std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask) const;
void setSubMode (int subMode, unsigned int elementMask);
/// Erase all overrides and restore the visual representation of the cell to its
/// true state.
void reset (unsigned int elementMask);
};
}

@ -259,6 +259,12 @@ void CSVRender::InstanceMode::dragCompleted()
mDragMode = DragMode_None;
}
void CSVRender::InstanceMode::dragAborted()
{
getWorldspaceWidget().reset (Mask_Reference);
mDragMode = DragMode_None;
}
void CSVRender::InstanceMode::dragWheel (int diff, double speedFactor)
{
if (mDragMode==DragMode_Move)

@ -53,6 +53,10 @@ namespace CSVRender
virtual void dragCompleted();
/// \note dragAborted will not be called, if the drag is aborted via changing
/// editing mode
virtual void dragAborted();
virtual void dragWheel (int diff, double speedFactor);
virtual void dragEnterEvent (QDragEnterEvent *event);

@ -574,3 +574,10 @@ void CSVRender::Object::setSubMode (int subMode)
updateMarker();
}
}
void CSVRender::Object::reset()
{
mOverrideFlags = 0;
adjustTransform();
updateMarker();
}

@ -175,6 +175,10 @@ namespace CSVRender
void apply (QUndoStack& undoStack);
void setSubMode (int subMode);
/// Erase all overrides and restore the visual representation of the object to its
/// true state.
void reset();
};
}

@ -582,6 +582,13 @@ void CSVRender::PagedWorldspaceWidget::setSubMode (int subMode, unsigned int ele
iter->second->setSubMode (subMode, elementMask);
}
void CSVRender::PagedWorldspaceWidget::reset (unsigned int elementMask)
{
for (std::map<CSMWorld::CellCoordinates, Cell *>::const_iterator iter = mCells.begin();
iter!=mCells.end(); ++iter)
iter->second->reset (elementMask);
}
CSVWidget::SceneToolToggle *CSVRender::PagedWorldspaceWidget::makeControlVisibilitySelector (
CSVWidget::SceneToolbar *parent)
{

@ -117,6 +117,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask);
/// Erase all overrides and restore the visual representation to its true state.
virtual void reset (unsigned int elementMask);
protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);

@ -142,6 +142,11 @@ void CSVRender::UnpagedWorldspaceWidget::setSubMode (int subMode, unsigned int
mCell->setSubMode (subMode, elementMask);
}
void CSVRender::UnpagedWorldspaceWidget::reset (unsigned int elementMask)
{
mCell->reset (elementMask);
}
void CSVRender::UnpagedWorldspaceWidget::referenceableDataChanged (const QModelIndex& topLeft,
const QModelIndex& bottomRight)
{

@ -65,6 +65,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask);
/// Erase all overrides and restore the visual representation to its true state.
virtual void reset (unsigned int elementMask);
private:
virtual void referenceableDataChanged (const QModelIndex& topLeft,

@ -158,6 +158,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask) = 0;
/// Erase all overrides and restore the visual representation to its true state.
virtual void reset (unsigned int elementMask) = 0;
protected:
/// Visual elements in a scene

Loading…
Cancel
Save