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!=mObjects.end(); ++iter)
iter->second->setSubMode (subMode); 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; std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask) const;
void setSubMode (int subMode, unsigned int elementMask); 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; mDragMode = DragMode_None;
} }
void CSVRender::InstanceMode::dragAborted()
{
getWorldspaceWidget().reset (Mask_Reference);
mDragMode = DragMode_None;
}
void CSVRender::InstanceMode::dragWheel (int diff, double speedFactor) void CSVRender::InstanceMode::dragWheel (int diff, double speedFactor)
{ {
if (mDragMode==DragMode_Move) if (mDragMode==DragMode_Move)

@ -53,6 +53,10 @@ namespace CSVRender
virtual void dragCompleted(); 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 dragWheel (int diff, double speedFactor);
virtual void dragEnterEvent (QDragEnterEvent *event); virtual void dragEnterEvent (QDragEnterEvent *event);

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

@ -175,6 +175,10 @@ namespace CSVRender
void apply (QUndoStack& undoStack); void apply (QUndoStack& undoStack);
void setSubMode (int subMode); 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); 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::SceneToolToggle *CSVRender::PagedWorldspaceWidget::makeControlVisibilitySelector (
CSVWidget::SceneToolbar *parent) CSVWidget::SceneToolbar *parent)
{ {

@ -117,6 +117,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask); 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: protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool); virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);

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

@ -65,6 +65,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask); 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: private:
virtual void referenceableDataChanged (const QModelIndex& topLeft, virtual void referenceableDataChanged (const QModelIndex& topLeft,

@ -158,6 +158,9 @@ namespace CSVRender
virtual void setSubMode (int subMode, unsigned int elementMask) = 0; 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: protected:
/// Visual elements in a scene /// Visual elements in a scene

Loading…
Cancel
Save