/// \todo Support view-dependent nudge. void RadiantSelectionSystem::NudgeManipulator(const Vector3& nudge, const Vector3& view) { if (ManipulatorMode() == eTranslate || ManipulatorMode() == eDrag || ManipulatorMode() == eClip) { translateSelected(nudge); // In clip mode, update the clipping plane if (ManipulatorMode() == eClip) { GlobalClipper().update(); } } }
void RadiantSelectionSystem::cancelMove() { // Unselect any currently selected manipulators to be sure _manipulator->setSelected(false); // Tell all the scene objects to revert their transformations RevertTransformForSelected walker; Node_traverseSubgraph(GlobalSceneGraph().root(), walker); _pivotMoving = false; pivotChanged(); // greebo: Deselect all faces if we are in brush and drag mode if (Mode() == ePrimitive && ManipulatorMode() == eDrag) { SelectAllComponentWalker faceSelector(false, SelectionSystem::eFace); Node_traverseSubgraph(GlobalSceneGraph().root(), faceSelector); } if (_undoBegun) { // Cancel the undo operation, if one has been begun GlobalUndoSystem().cancel(); _undoBegun = false; } // Update the views SceneChangeNotify(); }
// End the move, this freezes the current transforms void RadiantSelectionSystem::endMove() { freezeTransforms(); // greebo: Deselect all faces if we are in brush and drag mode if ((Mode() == ePrimitive || Mode() == eGroupPart) && ManipulatorMode() == eDrag) { SelectAllComponentWalker faceSelector(false, SelectionSystem::eFace); Node_traverseSubgraph(GlobalSceneGraph().root(), faceSelector); } // Remove all degenerated brushes from the scene graph (should emit a warning) foreachSelected(RemoveDegenerateBrushWalker()); _pivotMoving = false; pivotChanged(); // Update the views SceneChangeNotify(); // If we started an undoable operation, end it now and tell the console what happened if (_undoBegun) { std::ostringstream command; if (ManipulatorMode() == eTranslate) { command << "translateTool"; outputTranslation(command); } else if (ManipulatorMode() == eRotate) { command << "rotateTool"; outputRotation(command); } else if (ManipulatorMode() == eScale) { command << "scaleTool"; outputScale(command); } else if (ManipulatorMode() == eDrag) { command << "dragTool"; } _undoBegun = false; // Finish the undo move GlobalUndoSystem().finish(command.str()); } }
/* greebo: This is called by the ManipulateObserver class on the mouseDown event. It checks, if a manipulator * can be selected where the mouse is pointing to. */ bool RadiantSelectionSystem::SelectManipulator(const View& view, const Vector2& device_point, const Vector2& device_epsilon) { if (!nothingSelected() || (ManipulatorMode() == eDrag && Mode() == eComponent)) { // Unselect any currently selected manipulators to be sure _manipulator->setSelected(false); // Test, if the current manipulator can be selected if (!nothingSelected() || (ManipulatorMode() == eDrag && Mode() == eComponent)) { View scissored(view); ConstructSelectionTest(scissored, Rectangle::ConstructFromPoint(device_point, device_epsilon)); // The manipulator class checks on its own, if any of its components can be selected _manipulator->testSelect(scissored, GetPivot2World()); } // Save the pivot2world matrix startMove(); // This is true, if a manipulator could be selected _pivotMoving = _manipulator->isSelected(); // is a manipulator selected / the pivot moving? if (_pivotMoving) { Pivot2World pivot; pivot.update(GetPivot2World(), view.GetModelview(), view.GetProjection(), view.GetViewport()); _manip2pivotStart = _pivot2worldStart.getFullInverse().getMultipliedBy(pivot._worldSpace); Matrix4 device2manip; ConstructDevice2Manip(device2manip, _pivot2worldStart, view.GetModelview(), view.GetProjection(), view.GetViewport()); _manipulator->getActiveComponent()->Construct(device2manip, device_point[0], device_point[1]); _deviceStart = Vector2(device_point[0], device_point[1]); _undoBegun = false; } SceneChangeNotify(); } return _pivotMoving; }
/* greebo: This is called by the ManipulateObserver class on the mouseDown event. It checks, if a manipulator * can be selected where the mouse is pointing to. */ bool RadiantSelectionSystem::SelectManipulator(const View& view, const float device_point[2], const float device_epsilon[2]) { if (!nothingSelected() || (ManipulatorMode() == eDrag && Mode() == eComponent)) { #if defined (DEBUG_SELECTION) g_render_clipped.destroy(); #endif // Unselect any currently selected manipulators to be sure _manipulator->setSelected(false); // Test, if the current manipulator can be selected if (!nothingSelected() || (ManipulatorMode() == eDrag && Mode() == eComponent)) { View scissored(view); ConstructSelectionTest(scissored, SelectionBoxForPoint(device_point, device_epsilon)); // The manipulator class checks on its own, if any of its components can be selected _manipulator->testSelect(scissored, GetPivot2World()); } // Save the pivot2world matrix startMove(); // This is true, if a manipulator could be selected _pivotMoving = _manipulator->isSelected(); // is a manipulator selected / the pivot moving? if (_pivotMoving) { Pivot2World pivot; pivot.update(GetPivot2World(), view.GetModelview(), view.GetProjection(), view.GetViewport()); _manip2pivotStart = matrix4_multiplied_by_matrix4(matrix4_full_inverse(_pivot2worldStart), pivot.m_worldSpace); Matrix4 device2manip; ConstructDevice2Manip(device2manip, _pivot2worldStart, view.GetModelview(), view.GetProjection(), view.GetViewport()); _manipulator->GetManipulatable()->Construct(device2manip, device_point[0], device_point[1]); _undoBegun = false; } SceneChangeNotify(); } return _pivotMoving; }
/// \todo Support view-dependent nudge. void RadiantSelectionSystem::NudgeManipulator(const Vector3& nudge, const Vector3& view) { if(ManipulatorMode() == eTranslate || ManipulatorMode() == eDrag) { translateSelected(nudge); } }