void CreateTool::MouseUp( const MouseButtonInput& e ) { if ( !e.MiddleDown() && m_PaintTimer.IsAlive() ) { m_PaintTimer.Stop(); } Base::MouseUp(e); }
bool CurveCreateTool::MouseDown( const MouseButtonInput& e ) { if ( m_Instance.ReferencesObject() && m_Scene->IsEditable() ) { Math::Vector3 position; PickPosition( e.GetPosition().x, e.GetPosition().y, position ); PointPtr point = new Core::Point( m_Scene, new Content::Point( position ) ); point->SetParent( m_Instance ); point->SetTransient( true ); m_Scene->AddObject( point ); m_Instance->Dirty(); m_Scene->Execute( true ); } return __super::MouseDown( e ); }
bool TransformManipulator::MouseDown( const MouseButtonInput& e ) { if (e.LeftDown()) m_Left = true; if (e.MiddleDown()) m_Middle = true; if (e.RightDown()) m_Right = true; m_StartX = e.GetPosition().x; m_StartY = e.GetPosition().y; m_Manipulated = false; m_Manipulating = true; return true; }
void TransformManipulator::MouseUp( const MouseButtonInput& e ) { m_Manipulating = false; if (m_Manipulated) { SetResult(); } if (e.LeftUp()) m_Left = false; if (e.MiddleUp()) m_Middle = false; if (e.RightUp()) m_Right = false; m_AllowSelection = true; }
bool CurveCreateTool::MouseDown( const MouseButtonInput& e ) { if ( m_Instance.ReferencesObject() && m_Scene->IsEditable() ) { Vector3 position; PickPosition( e.GetPosition().x, e.GetPosition().y, position ); CurveControlPointPtr point = new CurveControlPoint(); point->SetOwner( m_Scene ); point->Initialize(); point->SetParent( m_Instance ); point->SetTransient( true ); point->SetPosition( position ); m_Scene->AddObject( point ); m_Instance->Dirty(); m_Scene->Execute( true ); } return Base::MouseDown( e ); }
bool CreateTool::MouseDown( const MouseButtonInput& e ) { if ( e.MiddleDown() ) { Vector3 translation; Vector3 normal; { HELIUM_EDITOR_SCENE_SCOPE_TIMER( "Pick Location For Instance" ); DetermineTranslationAndNormal( e.GetPosition().x, e.GetPosition().y, translation, normal ); } CreateSingleObject( translation, normal ); if ( s_PaintMode ) { m_InstanceUpdateOffsets = true; CalculateInstanceRadiusAndBounds( m_InstanceRadius, m_InstanceBounds ); if ( e.ShiftIsDown() ) { CreateMultipleObjects( true ); } if ( !m_PaintTimer.IsAlive() ) { m_PaintTimer.Start(); } } { HELIUM_EDITOR_SCENE_SCOPE_TIMER( "Execute Scene" ); m_Scene->Execute(true); } } return Base::MouseDown( e ); }
void Camera::MouseUp( const MouseButtonInput& e ) { // we have changed movement mode, so reset our delta m_Prev = Point (e.GetPosition().x, e.GetPosition().y); }
bool CurveEditTool::MouseDown( const MouseButtonInput& e ) { bool success = true; if ( GetEditMode() == CurveEditModes::Modify ) { success = m_ControlPointManipulator->MouseDown( e ); } else { Curve* curve = NULL; { FrustumLinePickVisitor pick (m_Scene->GetViewport()->GetCamera(), e.GetPosition().x, e.GetPosition().y); m_Scene->Pick( &pick ); V_PickHitSmartPtr sorted; PickHit::Sort(m_Scene->GetViewport()->GetCamera(), pick.GetHits(), sorted, PickSortTypes::Intersection); for ( V_PickHitSmartPtr::const_iterator itr = sorted.begin(), end = sorted.end(); itr != end; ++itr ) { if ( curve = Reflect::SafeCast<Curve>( (*itr)->GetHitObject() ) ) { break; } } } if ( !curve || !m_Scene->IsEditable() ) { return false; } LinePickVisitor pick (m_Scene->GetViewport()->GetCamera(), e.GetPosition().x, e.GetPosition().y); switch ( GetEditMode() ) { case CurveEditModes::Insert: { std::pair<uint32_t, uint32_t> points; if ( !curve->ClosestControlPoints( &pick, points ) ) { return false; } CurveControlPoint* p0 = curve->GetControlPointByIndex( points.first ); CurveControlPoint* p1 = curve->GetControlPointByIndex( points.second ); Vector3 a( p0->GetPosition() ); Vector3 b( p1->GetPosition() ); Vector3 p; if ( curve->GetCurveType() == CurveType::Linear ) { float mu; if ( !pick.GetPickSpaceLine().IntersectsSegment( a, b, -1.0f, &mu ) ) { return false; } p = a * ( 1.0f - mu ) + b * mu; } else { p = ( a + b ) * 0.5f; } uint32_t index = points.first > points.second ? points.first : points.second; CurveControlPointPtr point = new CurveControlPoint(); point->SetOwner( curve->GetOwner() ); point->Initialize(); curve->GetOwner()->Push( curve->InsertControlPointAtIndex( index, point ) ); break; } case CurveEditModes::Remove: { int32_t index = curve->ClosestControlPoint( &pick ); if ( index < 0 ) { return false; } curve->GetOwner()->Push( curve->RemoveControlPointAtIndex( index ) ); break; } } curve->Dirty(); m_Scene->Execute( false ); } return success || Base::MouseDown( e ); }
void Helium::ConvertEvent( wxMouseEvent& event, MouseButtonInput& input ) { new (&input) MouseButtonInput (); ConvertMouseEvent( event, input ); if ( event.LeftUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Middle ); } if ( event.RightUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1Up() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2Up() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Backward ); } if ( event.LeftDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Middle ); } if ( event.RightDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1Down() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2Down() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Backward ); } if ( event.LeftDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Middle ); } if ( event.RightDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1DClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2DClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Backward ); } }