bool reTranslateTool::OnMouseDown(wxMouseEvent& event, rwxGLCanvas* canvas){ reToolBase::OnMouseDown(event, canvas); rActor3* actor = PickActor(event, canvas); if (actor){ m_selectedAxis = m_gizmo->GetGizmoAxis(actor); if (m_selectedAxis == reGizmoAxis::NONE){ bool result = DoActorSelection(actor, event); m_gizmo->Update(); } else{ m_gizmo->Update(); SetDragPlaneFromSelectedAxis(); GetWorldSpaceDragPosition(canvas, m_previousWorldPosition); m_command = new reTranslateCommand(m_component->SelectionManager()->GetSelection(), m_component); } return true; } else{ m_gizmo->SetVisibility(false); return DoClearSelection(); } }
bool reTranslateTool::OnMouseDown(wxMouseEvent& event, rwxGLCanvas* canvas){ reToolBase::OnMouseDown(event, canvas); m_component->GetEngine()->viewports->SetActiveViewport(canvas->GetViewport()); m_gizmo->Update(); rRay3 selectionRay = GetSelectionRay(event, canvas); m_selectedAxis = m_gizmo->PickAxis(selectionRay); if (m_selectedAxis != reGizmoAxis::NONE) { m_gizmo->HighlightAxis(m_selectedAxis); m_gizmo->Update(); m_dragPlane = reToolBase::GetDragPlaneFromRay(selectionRay, m_gizmo->GetPosition()); GetWorldSpaceDragPosition(canvas, m_previousWorldPosition); m_command = new reTranslateCommand(m_component->SelectionManager()->GetSelection(), m_component); return true; } else { rActor3* actor = PickActor(event, canvas); if (actor) { bool result = DoActorSelection(actor, event); m_gizmo->Update(); return true; } else { m_gizmo->SetVisibility(false); return DoClearSelection(); } } }
void WindowWorld::OnMouseButtonDown(const InputMouse& args) { Window::OnMouseButtonDown(args); if (!m_world) { return; } const Vector2i position = m_world->GetCamera()->Project(GetBounds(), args.position); for (ListenerList::iterator iter = m_listeners.begin(); iter != m_listeners.end(); ++iter) { (*iter)->OnWorldMouseButtonDown(InputMouse(args.button, args.buttonState, position, Vector2i(0, 0), args.wheel, args.modifier)); } #ifdef DEVELOPER if (args.modifier & KMOD_SHIFT && args.button == SDL_BUTTON_LEFT) { boost::shared_ptr<Actor> actor = PickActor(position).lock(); if (actor) { TRACE_INFO(boost::format("Actor:\n\tAlias = %s\n\tId = %d\n\tName = %s\n\tLayer = %d\n\tPosition = (%.1f, %.1f)") % actor->GetAlias() % actor->GetId() % actor->GetName() % actor->GetLayer() % actor->GetPosition().x % actor->GetPosition().y); } } #endif }
int DllWrapperPickActor(int hWndPtrAddress) { HWND hWnd = (HWND)hWndPtrAddress; return PickActor(hWnd); }