From 002c9b3f3d85f8d023c7abd41f0f2c834d3f17cc Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 11 Apr 2012 16:02:24 -0500 Subject: MAINT-516 Potential fix for crash on startup in LLWindowWin32::switchContext --- indra/llwindow/llwindowwin32.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 987e9cb567..aceb8924f3 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -367,6 +367,10 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, U32 fsaa_samples) : LLWindow(callbacks, fullscreen, flags) { + + //MAINT-516 -- force a load of opengl32.dll just in case windows went sideways + LoadLibrary(L"opengl32.dll"); + mFSAASamples = fsaa_samples; mIconResource = gIconResource; mOverrideAspectRatio = 0.f; -- cgit v1.3 From bc4d0b0b0f0cf8ee305598d66c78f4a5a723a955 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 23 Feb 2012 21:02:46 +0200 Subject: Linux build fix. Moved type casts from protected base classes to derived LLCoord. (transplanted from fa4c01adac7224b909ab1dbfc90416b633e6d6c2) --- indra/llmath/llcoord.h | 19 +++++++++++++------ indra/llui/llfloater.cpp | 4 ++-- indra/llwindow/llwindow.cpp | 8 ++++---- 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h index 1f617e649e..a66f3c7424 100644 --- a/indra/llmath/llcoord.h +++ b/indra/llmath/llcoord.h @@ -26,6 +26,15 @@ #ifndef LL_LLCOORD_H #define LL_LLCOORD_H +template class LLCoord; +struct LL_COORD_TYPE_GL; +struct LL_COORD_TYPE_WINDOW; +struct LL_COORD_TYPE_SCREEN; + +typedef LLCoord LLCoordGL; +typedef LLCoord LLCoordWindow; +typedef LLCoord LLCoordScreen; + struct LLCoordCommon { LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {} @@ -62,6 +71,8 @@ public: bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; } bool operator!=(const self_t& other) const { return !(*this == other); } + static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast(self); } + static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast(self); } }; struct LL_COORD_TYPE_GL @@ -70,13 +81,13 @@ struct LL_COORD_TYPE_GL LLCoordCommon convertToCommon() const { - const LLCoord& self = static_cast&>(*this); + const LLCoordGL& self = LLCoordGL::getTypedCoords(*this); return LLCoordCommon(self.mX, self.mY); } void convertFromCommon(const LLCoordCommon& from) { - LLCoord& self = static_cast&>(*this); + LLCoordGL& self = LLCoordGL::getTypedCoords(*this); self.mX = from.mX; self.mY = from.mY; } @@ -98,8 +109,4 @@ struct LL_COORD_TYPE_SCREEN void convertFromCommon(const LLCoordCommon& from); }; -typedef LLCoord LLCoordGL; -typedef LLCoord LLCoordWindow; -typedef LLCoord LLCoordScreen; - #endif diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 22b20969fc..51611d547c 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3306,7 +3306,7 @@ bool LLCoordFloater::operator==(const LLCoordFloater& other) const LLCoordCommon LL_COORD_FLOATER::convertToCommon() const { - const LLCoordFloater& self = static_cast(*this); + const LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); @@ -3348,7 +3348,7 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { - LLCoordFloater& self = static_cast(*this); + LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 6834b34387..4e91271d83 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -440,7 +440,7 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window) //coordinate conversion utility funcs that forward to llwindow LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const { - const LLCoordWindow& self = static_cast(*this); + const LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this); LLWindow* windowp = &(*LLWindow::beginInstances()); LLCoordGL out; @@ -450,7 +450,7 @@ LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from) { - LLCoordWindow& self = static_cast(*this); + LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this); LLWindow* windowp = &(*LLWindow::beginInstances()); LLCoordGL from_gl(from); @@ -459,7 +459,7 @@ void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from) LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const { - const LLCoordScreen& self = static_cast(*this); + const LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this); LLWindow* windowp = &(*LLWindow::beginInstances()); LLCoordGL out; @@ -469,7 +469,7 @@ LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const void LL_COORD_TYPE_SCREEN::convertFromCommon(const LLCoordCommon& from) { - LLCoordScreen& self = static_cast(*this); + LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this); LLWindow* windowp = &(*LLWindow::beginInstances()); LLCoordGL from_gl(from); -- cgit v1.3 From 2115211328261d875dc0ccacdc2021f1c501a36d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 9 Apr 2012 18:53:52 -0700 Subject: Re-implementing the path testing functionality as a proper LLTool. --- indra/llcommon/llcursortypes.cpp | 1 + indra/llcommon/llcursortypes.h | 1 + indra/llwindow/llwindowwin32.cpp | 1 + indra/newview/CMakeLists.txt | 3 + indra/newview/llfloaterpathfindingconsole.cpp | 361 ++++++++++----------- indra/newview/llfloaterpathfindingconsole.h | 50 ++- indra/newview/llpathfindingpathtool.cpp | 206 ++++++++++++ indra/newview/llpathfindingpathtool.h | 102 ++++++ indra/newview/lltoolmgr.cpp | 2 + indra/newview/lltoolmgr.h | 6 +- indra/newview/llviewerwindow.cpp | 21 +- indra/newview/pipeline.cpp | 3 +- indra/newview/res/lltoolpathfinding.cur | Bin 0 -> 326 bytes indra/newview/res/viewerRes.rc | 1 + .../default/xui/en/floater_pathfinding_console.xml | 4 + 15 files changed, 524 insertions(+), 238 deletions(-) create mode 100644 indra/newview/llpathfindingpathtool.cpp create mode 100644 indra/newview/llpathfindingpathtool.h create mode 100644 indra/newview/res/lltoolpathfinding.cur (limited to 'indra/llwindow') diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index e987c397bd..dc308c30af 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -69,6 +69,7 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT; cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; + cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; } std::map::const_iterator iter = cursor_string_table.find(cursor_string); diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index bacb0a80ba..ea072ff4b4 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -65,6 +65,7 @@ enum ECursorType { UI_CURSOR_TOOLSIT, UI_CURSOR_TOOLBUY, UI_CURSOR_TOOLOPEN, + UI_CURSOR_TOOLPATHFINDING, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index bc85acbf45..f6e4f9f6e1 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1697,6 +1697,7 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT")); mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); + mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); // Color cursors mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY")); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f59bc457e2..d632220771 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -424,6 +424,7 @@ set(viewer_SOURCE_FILES llpathfindingnavmesh.cpp llpathfindingnavmeshstatus.cpp llpathfindingnavmeshzone.cpp + llpathfindingpathtool.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp llplacesinventorybridge.cpp @@ -980,6 +981,7 @@ set(viewer_HEADER_FILES llpathfindingnavmesh.h llpathfindingnavmeshstatus.h llpathfindingnavmeshzone.h + llpathfindingpathtool.h llphysicsmotion.h llphysicsshapebuilderutil.h llplacesinventorybridge.h @@ -1328,6 +1330,7 @@ if (WINDOWS) res/lltoolgrab.cur res/lltoolland.cur res/lltoolpan.cur + res/lltoolpathfinding.cur res/lltoolpipette.cur res/lltoolrotate.cur res/lltoolscale.cur diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c59f960d3f..7941fd52af 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -32,7 +32,6 @@ #include "llsd.h" #include "llhandle.h" -#include "llagent.h" #include "llpanel.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -42,13 +41,12 @@ #include "lltabcontainer.h" #include "llcombobox.h" #include "llfloaterreg.h" -#include "llviewerregion.h" -#include "llviewerwindow.h" -#include "llviewercamera.h" -#include "llviewercontrol.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingmanager.h" #include "llenvmanager.h" +#include "llpathfindingpathtool.h" +#include "lltoolmgr.h" +#include "lltoolfocus.h" #include "LLPathingLib.h" @@ -64,6 +62,7 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +#define XUI_EDIT_TAB_INDEX 0 #define XUI_TEST_TAB_INDEX 1 LLHandle LLFloaterPathfindingConsole::sInstanceHandle; @@ -105,6 +104,7 @@ BOOL LLFloaterPathfindingConsole::postBuild() mEditTestTabContainer = findChild("edit_test_tab_container"); llassert(mEditTestTabContainer != NULL); + mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); mEditTab = findChild("edit_panel"); llassert(mEditTab != NULL); @@ -154,6 +154,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + mPathfindingToolset = new LLToolset(); + mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); + mPathfindingToolset->addTool(LLToolCamera::getInstance()); + mPathfindingToolset->setShowFloaterTools(false); + return LLFloater::postBuild(); } @@ -192,13 +197,30 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); } + if (!mPathEventSlot.connected()) + { + mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); + } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); setDefaultInputs(); updatePathTestStatus(); + + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } } void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { + switchOutOfTestPathMode(); + + if (mPathEventSlot.connected()) + { + mPathEventSlot.disconnect(); + } + if (mRegionBoundarySlot.connected()) { mRegionBoundarySlot.disconnect(); @@ -225,46 +247,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) LLFloater::onClose(pIsAppQuitting); } -BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) -{ - if (isGeneratePathMode(mask, clicktype, down)) - { - LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); - LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); - LLVector3 rayStart = mousePos; - LLVector3 rayEnd = mousePos + dv * 150; - - if (mask & MASK_CONTROL) - { - mPathData.mStartPointA = rayStart; - mPathData.mEndPointA = rayEnd; - mHasStartPoint = true; - } - else if (mask & MASK_SHIFT) - { - mPathData.mStartPointB = rayStart; - mPathData.mEndPointB = rayEnd; - mHasEndPoint = true; - } - generatePath(); - updatePathTestStatus(); - - return TRUE; - } - else - { - return LLFloater::handleAnyMouseClick(x, y, mask, clicktype, down); - } -} - -BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const -{ - return (isShown() && (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) && - (clicktype == LLMouseHandler::CLICK_LEFT) && down && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || - ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); -} - LLHandle LLFloaterPathfindingConsole::getInstanceHandle() { if (sInstanceHandle.isDead()) @@ -279,11 +261,6 @@ LLHandle LLFloaterPathfindingConsole::getInstanceHa return sInstanceHandle; } -BOOL LLFloaterPathfindingConsole::isRenderPath() const -{ - return (mHasStartPoint && mHasEndPoint); -} - BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const { return mShowNavMeshCheckBox->get(); @@ -444,76 +421,6 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRende return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); } -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeComboBox->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_NONE : - characterType = kCharacterTypeNone; - break; - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeNone; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeNone : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - llassert(0); - break; - } - - mCharacterTypeComboBox->setValue(radioGroupValue); -} - LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), @@ -546,11 +453,11 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mIsNavMeshUpdating(false), mAgentStateSlot(), mRegionBoundarySlot(), + mPathEventSlot(), + mPathfindingToolset(NULL), + mSavedToolset(NULL), mConsoleState(kConsoleStateUnknown), - mPathData(), - mHasStartPoint(false), - mHasEndPoint(false), - mHasValidPath(false) + mShapeRenderFlags(0U) { mSelfHandle.bind(this); } @@ -594,21 +501,21 @@ void LLFloaterPathfindingConsole::onShowWalkabilitySet() } } -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - generatePath(); - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +void LLFloaterPathfindingConsole::onViewCharactersClicked() { - generatePath(); - updatePathTestStatus(); + LLFloaterPathfindingCharacters::openCharactersViewer(); } -void LLFloaterPathfindingConsole::onViewCharactersClicked() +void LLFloaterPathfindingConsole::onTabSwitch() { - LLFloaterPathfindingCharacters::openCharactersViewer(); + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } + else + { + switchOutOfTestPathMode(); + } } void LLFloaterPathfindingConsole::onUnfreezeClicked() @@ -628,12 +535,19 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + updateCharacterWidth(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + updateCharacterType(); +} + void LLFloaterPathfindingConsole::onClearPathClicked() { - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; - updatePathTestStatus(); + clearPath(); } void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) @@ -681,9 +595,43 @@ void LLFloaterPathfindingConsole::onRegionBoundaryCross() mShowWorldCheckBox->set(TRUE); } +void LLFloaterPathfindingConsole::onPathEvent() +{ + const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance(); + + mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth())); + + LLSD characterType; + switch (pathToolInstance->getCharacterType()) + { + case LLPathfindingPathTool::kCharacterTypeNone : + characterType = XUI_CHARACTER_TYPE_NONE; + break; + case LLPathfindingPathTool::kCharacterTypeA : + characterType = XUI_CHARACTER_TYPE_A; + break; + case LLPathfindingPathTool::kCharacterTypeB : + characterType = XUI_CHARACTER_TYPE_B; + break; + case LLPathfindingPathTool::kCharacterTypeC : + characterType = XUI_CHARACTER_TYPE_C; + break; + case LLPathfindingPathTool::kCharacterTypeD : + characterType = XUI_CHARACTER_TYPE_D; + break; + default : + characterType = XUI_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + mCharacterTypeComboBox->setValue(characterType); + + updatePathTestStatus(); +} + void LLFloaterPathfindingConsole::setDefaultInputs() { - mEditTestTabContainer->selectTab(0); + mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); mShowNavMeshCheckBox->set(FALSE); mShowWalkablesCheckBox->set(FALSE); mShowMaterialVolumesCheckBox->set(FALSE); @@ -721,9 +669,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mCharacterWidthSlider->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; + clearPath(); break; case kConsoleStateCheckingVersion : case kConsoleStateDownloading : @@ -742,9 +688,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mCharacterWidthSlider->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; + clearPath(); break; case kConsoleStateHasNavMesh : mShowNavMeshCheckBox->setEnabled(TRUE); @@ -943,36 +887,63 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat break; } } - -void LLFloaterPathfindingConsole::generatePath() + +void LLFloaterPathfindingConsole::switchIntoTestPathMode() +{ + llassert(mPathfindingToolset != NULL); + llassert(mSavedToolset == NULL); + mSavedToolset = LLToolMgr::getInstance()->getCurrentToolset(); + LLToolMgr::getInstance()->setCurrentToolset(mPathfindingToolset); +} + +void LLFloaterPathfindingConsole::switchOutOfTestPathMode() { - if (mHasStartPoint && mHasEndPoint) + llassert(mPathfindingToolset != NULL); + if (mSavedToolset != NULL) { - mPathData.mCharacterWidth = getCharacterWidth(); - switch (getCharacterType()) - { - case kCharacterTypeNone : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; - break; - default : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - } - LLPathingLib::LLPLResult pathingResult = LLPathingLib::getInstance()->generatePath(mPathData); - mHasValidPath = (pathingResult == LLPathingLib::LLPL_PATH_GENERATED_OK); + LLToolMgr::getInstance()->setCurrentToolset(mSavedToolset); + mSavedToolset = NULL; + } +} + +void LLFloaterPathfindingConsole::updateCharacterWidth() +{ + LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32()); +} + +void LLFloaterPathfindingConsole::updateCharacterType() +{ + LLPathfindingPathTool::ECharacterType characterType; + + switch (mCharacterTypeComboBox->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_NONE : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + break; + case XUI_CHARACTER_TYPE_A : + characterType = LLPathfindingPathTool::kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = LLPathfindingPathTool::kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = LLPathfindingPathTool::kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = LLPathfindingPathTool::kCharacterTypeD; + break; + default : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + llassert(0); + break; } + + LLPathfindingPathTool::getInstance()->setCharacterType(characterType); +} + +void LLFloaterPathfindingConsole::clearPath() +{ + LLPathfindingPathTool::getInstance()->clearPath(); } void LLFloaterPathfindingConsole::updatePathTestStatus() @@ -983,29 +954,47 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() std::string statusText(""); LLStyle::Params styleParams; - if (!mHasStartPoint && !mHasEndPoint) + switch (LLPathfindingPathTool::getInstance()->getPathStatus()) { + case LLPathfindingPathTool::kPathStatusUnknown : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : statusText = getString("pathing_choose_start_and_end_points"); styleParams.color = warningColor; - } - else if (!mHasStartPoint && mHasEndPoint) - { + break; + case LLPathfindingPathTool::kPathStatusChooseStartPoint : statusText = getString("pathing_choose_start_point"); styleParams.color = warningColor; - } - else if (mHasStartPoint && !mHasEndPoint) - { + break; + case LLPathfindingPathTool::kPathStatusChooseEndPoint : statusText = getString("pathing_choose_end_point"); styleParams.color = warningColor; - } - else if (mHasValidPath) - { + break; + case LLPathfindingPathTool::kPathStatusHasValidPath : statusText = getString("pathing_path_valid"); - } - else - { + break; + case LLPathfindingPathTool::kPathStatusHasInvalidPath : statusText = getString("pathing_path_invalid"); styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotEnabled : + statusText = getString("pathing_region_not_enabled"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotImplemented : + statusText = getString("pathing_library_not_implemented"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusError : + statusText = getString("pathing_error"); + styleParams.color = errorColor; + break; + default : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; } mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 85df38b370..7e0f8a4eaa 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -33,6 +33,7 @@ #include "LLPathingLib.h" #include "llpathfindingmanager.h" #include "llpathfindingnavmeshzone.h" +#include "llpathfindingpathtool.h" #include @@ -45,6 +46,7 @@ class LLCheckBoxCtrl; class LLTabContainer; class LLComboBox; class LLButton; +class LLToolset; class LLFloaterPathfindingConsole : public LLFloater @@ -61,26 +63,12 @@ public: kRenderHeatmapD } ERenderHeatmapType; - typedef enum - { - kCharacterTypeNone, - kCharacterTypeA, - kCharacterTypeB, - kCharacterTypeC, - kCharacterTypeD - } ECharacterType; - virtual BOOL postBuild(); virtual void onOpen(const LLSD& pKey); virtual void onClose(bool pIsAppQuitting); - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); - - BOOL isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const; static LLHandle getInstanceHandle(); - BOOL isRenderPath() const; - BOOL isRenderNavMesh() const; void setRenderNavMesh(BOOL pIsRenderNavMesh); @@ -108,12 +96,6 @@ public: ERenderHeatmapType getRenderHeatmapType() const; void setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType); - F32 getCharacterWidth() const; - void setCharacterWidth(F32 pCharacterWidth); - - ECharacterType getCharacterType() const; - void setCharacterType(ECharacterType pCharacterType); - int getHeatMapType() const; protected: @@ -136,16 +118,18 @@ private: virtual ~LLFloaterPathfindingConsole(); void onShowWalkabilitySet(); - void onCharacterWidthSet(); - void onCharacterTypeSwitch(); void onViewCharactersClicked(); + void onTabSwitch(); void onUnfreezeClicked(); void onFreezeClicked(); void onViewEditLinksetClicked(); + void onCharacterWidthSet(); + void onCharacterTypeSwitch(); void onClearPathClicked(); void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); void onRegionBoundaryCross(); + void onPathEvent(); void setDefaultInputs(); void setConsoleState(EConsoleState pConsoleState); @@ -158,8 +142,13 @@ private: void setAgentState(LLPathfindingManager::EAgentState pAgentState); - void generatePath(); + void switchIntoTestPathMode(); + void switchOutOfTestPathMode(); + void updateCharacterWidth(); + void updateCharacterType(); + void clearPath(); void updatePathTestStatus(); + void resetShapeRenderFlags() { mShapeRenderFlags = 0; } void setShapeRenderFlag( LLPathingLib::LLShapeType type ) { mShapeRenderFlags |= (1< sInstanceHandle; + static LLHandle sInstanceHandle; public: - LLPathingLib::NavMeshColors mNavMeshColors; + LLPathingLib::NavMeshColors mNavMeshColors; }; #endif // LL_LLFLOATERPATHFINDINGCONSOLE_H diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp new file mode 100644 index 0000000000..f27c722264 --- /dev/null +++ b/indra/newview/llpathfindingpathtool.cpp @@ -0,0 +1,206 @@ +/** + * @file llpathfindingpathtool.cpp + * @author William Todd Stinson + * @brief XXX + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llpathfindingpathtool.h" +#include "llsingleton.h" +#include "lltool.h" +#include "llviewerwindow.h" +#include "llviewercamera.h" +#include "llpathfindingmanager.h" +#include "llpathinglib.h" + +#include +#include + +#define PATH_TOOL_NAME "PathfindingPathTool" + +LLPathfindingPathTool::LLPathfindingPathTool() + : LLTool(PATH_TOOL_NAME), + LLSingleton(), + mPathData(), + mPathResult(LLPathingLib::LLPL_PATH_NOT_GENERATED), + mHasStartPoint(false), + mHasEndPoint(false), + mCharacterWidth(1.0f), + mCharacterType(kCharacterTypeNone), + mPathEventSignal() +{ + if (!LLPathingLib::getInstance()) + { + LLPathingLib::initSystem(); + } +} + +LLPathfindingPathTool::~LLPathfindingPathTool() +{ +} + +BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) +{ + if ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0) + { + LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY); + LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 rayStart = mousePos; + LLVector3 rayEnd = mousePos + dv * 150; + + if (pMask & MASK_CONTROL) + { + mPathData.mStartPointA = rayStart; + mPathData.mEndPointA = rayEnd; + mHasStartPoint = true; + } + else if (pMask & MASK_SHIFT) + { + mPathData.mStartPointB = rayStart; + mPathData.mEndPointB = rayEnd; + mHasEndPoint = true; + } + computePath(); + } + + return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0); +} + +BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) +{ + if ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING); + } + + return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0); +} + +LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const +{ + EPathStatus status = kPathStatusUnknown; + + if (LLPathingLib::getInstance() == NULL) + { + status = kPathStatusNotImplemented; + } + else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion()) + { + status = kPathStatusNotEnabled; + } + else if (!mHasStartPoint && !mHasEndPoint) + { + status = kPathStatusChooseStartAndEndPoints; + } + else if (!mHasStartPoint) + { + status = kPathStatusChooseStartPoint; + } + else if (!mHasEndPoint) + { + status = kPathStatusChooseEndPoint; + } + else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK) + { + status = kPathStatusHasValidPath; + } + else if (mPathResult == LLPathingLib::LLPL_NO_PATH) + { + status = kPathStatusHasInvalidPath; + } + else + { + status = kPathStatusError; + } + + return status; +} + +F32 LLPathfindingPathTool::getCharacterWidth() const +{ + return mCharacterWidth; +} + +void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth) +{ + mCharacterWidth = pCharacterWidth; + mPathData.mCharacterWidth = pCharacterWidth; + computePath(); +} + +LLPathfindingPathTool::ECharacterType LLPathfindingPathTool::getCharacterType() const +{ + return mCharacterType; +} + +void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType) +{ + mCharacterType = pCharacterType; + switch (pCharacterType) + { + case kCharacterTypeNone : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case kCharacterTypeA : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + computePath(); +} + +bool LLPathfindingPathTool::isRenderPath() const +{ + return (mHasStartPoint && mHasEndPoint); +} + +void LLPathfindingPathTool::clearPath() +{ + mHasStartPoint = false; + mHasEndPoint = false; + computePath(); +} + +LLPathfindingPathTool::path_event_slot_t LLPathfindingPathTool::registerPathEventListener(path_event_callback_t pPathEventCallback) +{ + return mPathEventSignal.connect(pPathEventCallback); +} + +void LLPathfindingPathTool::computePath() +{ + mPathResult = LLPathingLib::getInstance()->generatePath(mPathData); + mPathEventSignal(); +} diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h new file mode 100644 index 0000000000..80d3b4cceb --- /dev/null +++ b/indra/newview/llpathfindingpathtool.h @@ -0,0 +1,102 @@ +/** + * @file llpathfindingpathtool.h + * @author William Todd Stinson + * @brief XXX + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGPATHTOOL_H +#define LL_LLPATHFINDINGPATHTOOL_H + +#include "llsingleton.h" +#include "lltool.h" +#include "llpathinglib.h" + +#include +#include + +class LLPathfindingPathTool : public LLTool, public LLSingleton +{ +public: + typedef enum + { + kPathStatusUnknown, + kPathStatusChooseStartAndEndPoints, + kPathStatusChooseStartPoint, + kPathStatusChooseEndPoint, + kPathStatusHasValidPath, + kPathStatusHasInvalidPath, + kPathStatusNotEnabled, + kPathStatusNotImplemented, + kPathStatusError + } EPathStatus; + + typedef enum + { + kCharacterTypeNone, + kCharacterTypeA, + kCharacterTypeB, + kCharacterTypeC, + kCharacterTypeD + } ECharacterType; + + typedef + + LLPathfindingPathTool(); + virtual ~LLPathfindingPathTool(); + + typedef boost::function path_event_callback_t; + typedef boost::signals2::signal path_event_signal_t; + typedef boost::signals2::connection path_event_slot_t; + + virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask); + + EPathStatus getPathStatus() const; + + F32 getCharacterWidth() const; + void setCharacterWidth(F32 pCharacterWidth); + + ECharacterType getCharacterType() const; + void setCharacterType(ECharacterType pCharacterType); + + bool isRenderPath() const; + void clearPath(); + + path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback); + +protected: + +private: + void computePath(); + + LLPathingLib::PathingPacket mPathData; + LLPathingLib::LLPLResult mPathResult; + bool mHasStartPoint; + bool mHasEndPoint; + F32 mCharacterWidth; + ECharacterType mCharacterType; + path_event_signal_t mPathEventSignal; +}; + +#endif // LL_LLPATHFINDINGPATHTOOL_H diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index ac01316462..a135ba70f5 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -91,6 +91,8 @@ LLToolMgr::LLToolMgr() // gLandToolset = new LLToolset(); gMouselookToolset = new LLToolset(); gFaceEditToolset = new LLToolset(); + gMouselookToolset->setShowFloaterTools(false); + gFaceEditToolset->setShowFloaterTools(false); } void LLToolMgr::initTools() diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 12649cfba2..e7d1c56c83 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -89,7 +89,7 @@ protected: class LLToolset { public: - LLToolset() : mSelectedTool(NULL) {} + LLToolset() : mSelectedTool(NULL), mIsShowFloaterTools(true) {} LLTool* getSelectedTool() { return mSelectedTool; } @@ -105,10 +105,14 @@ public: BOOL isToolSelected( S32 index ); + void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;}; + bool isShowFloaterTools() const {return mIsShowFloaterTools;}; + protected: LLTool* mSelectedTool; typedef std::vector tool_list_t; tool_list_t mToolList; + bool mIsShowFloaterTools; }; // Globals diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index c5f31907c6..ee2171fb07 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -199,8 +199,6 @@ #include "llwindowlistener.h" #include "llviewerwindowlistener.h" #include "llpaneltopinfobar.h" -#include "LLPathingLib.h" -#include "llfloaterpathfindingconsole.h" #if LL_WINDOWS #include // For Unicode conversion methods @@ -834,7 +832,6 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - // only send mouse clicks to UI if UI is visible if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { @@ -948,26 +945,13 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK } } - //Determine if we have a pathing system and subsequently provide any mouse input - if (LLPathingLib::getInstance() != NULL) - { - LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); - if (!pathfindingConsoleHandle.isDead()) - { - LLFloaterPathfindingConsole *pathfindingConsoleFloater = pathfindingConsoleHandle.get(); - if (pathfindingConsoleFloater->isGeneratePathMode(mask, clicktype, down)) - { - return pathfindingConsoleFloater->handleAnyMouseClick(x, y, mask, clicktype, down); - } - } - } - // Do not allow tool manager to handle mouseclicks if we have disconnected if(!gDisconnected && LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) { return TRUE; } + // If we got this far on a down-click, it wasn't handled. // Up-clicks, though, are always handled as far as the OS is concerned. BOOL default_rtn = !down; @@ -3180,8 +3164,7 @@ void LLViewerWindow::updateLayout() || (tool != LLToolPie::getInstance() // not default tool && tool != LLToolCompGun::getInstance() // not coming out of mouselook && !suppress_toolbox // not override in third person - && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode - && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset + && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools() && (!captor || dynamic_cast(captor) != NULL))) // not dragging { // Force floater tools to be visible (unless minimized) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c2eb579bb9..526b4bb8d4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -106,6 +106,7 @@ #include "llnotifications.h" #include "LLPathingLib.h" #include "llfloaterpathfindingconsole.h" +#include "llpathfindingpathtool.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -4400,7 +4401,7 @@ void LLPipeline::renderDebug() gGL.flush(); } //User designated path - if ( pathfindingConsole->isRenderPath() ) + if ( LLPathfindingPathTool::getInstance()->isRenderPath() ) { LLGLEnable blend(GL_BLEND); if (LLGLSLShader::sNoFixedFunction) diff --git a/indra/newview/res/lltoolpathfinding.cur b/indra/newview/res/lltoolpathfinding.cur new file mode 100644 index 0000000000..2df80de0a6 Binary files /dev/null and b/indra/newview/res/lltoolpathfinding.cur differ diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index a53dece422..5b25714203 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -122,6 +122,7 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" TOOLBUY CURSOR "toolbuy.cur" TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" +TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" ///////////////////////////////////////////////////////////////////////////// // diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index e43fda01e0..28f0d9fa4a 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -27,11 +27,15 @@ Some navmesh regions are building. Some navmesh regions have pending changes and others are building. Navmesh is up-to-date. + + Cannot find pathing library implementation. + This region is not enabled for pathfinding. Please choose start and end points. Please choose start point. Please choose end point. Path is shown in orange. A path between the chosen points cannot be found. + An error occurred during path generation. Date: Wed, 11 Apr 2012 13:20:54 -0700 Subject: Refining the behavior of the pathing test tool behavior with regards to mouse clicks. --- indra/llcommon/llcursortypes.cpp | 1 + indra/llcommon/llcursortypes.h | 1 + indra/llwindow/llwindowwin32.cpp | 1 + indra/newview/llpathfindingpathtool.cpp | 54 ++++++++++++++++++++++++++++----- indra/newview/llpathfindingpathtool.h | 16 ++++++---- indra/newview/res/viewerRes.rc | 1 + 6 files changed, 60 insertions(+), 14 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index dc308c30af..0367e6e622 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -70,6 +70,7 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; + cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; } std::map::const_iterator iter = cursor_string_table.find(cursor_string); diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index ea072ff4b4..4662e90975 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -66,6 +66,7 @@ enum ECursorType { UI_CURSOR_TOOLBUY, UI_CURSOR_TOOLOPEN, UI_CURSOR_TOOLPATHFINDING, + UI_CURSOR_TOOLNO, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f6e4f9f6e1..a332bfddc4 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1698,6 +1698,7 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); + mCursor[ UI_CURSOR_TOOLNO ] = LoadCursor(module, TEXT("TOOLNO")); // Color cursors mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY")); diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index d838441dfb..03e441a7f2 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -46,7 +46,10 @@ LLPathfindingPathTool::LLPathfindingPathTool() mTempPathData(), mPathResult(LLPathingLib::LLPL_NO_PATH), mCharacterType(kCharacterTypeNone), - mPathEventSignal() + mPathEventSignal(), + mIsLeftMouseButtonHeld(false), + mIsMiddleMouseButtonHeld(false), + mIsRightMouseButtonHeld(false) { if (!LLPathingLib::getInstance()) { @@ -65,12 +68,16 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (isAnyPathToolModKeys(pMask)) + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { computeFinalPoints(pX, pY, pMask); + mIsLeftMouseButtonHeld = true; setMouseCapture(TRUE); returnVal = TRUE; } + mIsLeftMouseButtonHeld = true; return returnVal; } @@ -79,54 +86,85 @@ BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (isAnyPathToolModKeys(pMask)) + llinfos << "STINSON DEBUG: got here" << llendl; + + if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { computeFinalPoints(pX, pY, pMask); setMouseCapture(FALSE); returnVal = TRUE; } + mIsLeftMouseButtonHeld = false; return returnVal; } BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + setMouseCapture(TRUE); + mIsMiddleMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); return TRUE; } BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsMiddleMouseButtonHeld = false; return TRUE; } BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + setMouseCapture(TRUE); + mIsRightMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); return TRUE; } BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsRightMouseButtonHeld = false; return TRUE; } BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask) { + llinfos << "STINSON DEBUG: got here" << llendl; + return TRUE; } +void LLPathfindingPathTool::onMouseCaptureLost() +{ + llinfos << "STINSON DEBUG: got here" << llendl; +} + BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; + llinfos << "STINSON DEBUG: got here" << llendl; - if (isAnyPathToolModKeys(pMask)) + if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING); computeTempPoints(pX, pY, pMask); diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index ab1408826e..15ce97fe67 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -68,12 +68,13 @@ public: typedef boost::signals2::connection path_event_slot_t; virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual void onMouseCaptureLost(); virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask); @@ -128,6 +129,9 @@ private: LLPathingLib::LLPLResult mPathResult; ECharacterType mCharacterType; path_event_signal_t mPathEventSignal; + bool mIsLeftMouseButtonHeld; + bool mIsMiddleMouseButtonHeld; + bool mIsRightMouseButtonHeld; }; #endif // LL_LLPATHFINDINGPATHTOOL_H diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 5b25714203..686de0e7d5 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -123,6 +123,7 @@ TOOLBUY CURSOR "toolbuy.cur" TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" +TOOLNO CURSOR "llno.cur" ///////////////////////////////////////////////////////////////////////////// // -- cgit v1.3 From 9b27e32a8d73e2f50a86562cf79f4ef637e83dae Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 24 May 2012 16:07:31 -0700 Subject: Removing unused setting that is blocking my path to commit the subsequent change. --- indra/llwindow/llkeyboard.cpp | 2 +- indra/llwindow/llkeyboard.h | 12 ------- indra/llwindow/llkeyboardwin32.cpp | 60 ++------------------------------- indra/newview/app_settings/settings.xml | 11 ------ indra/newview/llviewercontrol.cpp | 10 ------ indra/newview/llviewerwindow.cpp | 3 -- 6 files changed, 3 insertions(+), 95 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 53cecf9d4a..8b356ba138 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -46,7 +46,7 @@ LLKeyStringTranslatorFunc* LLKeyboard::mStringTranslator = NULL; // Used for l10 // Class Implementation // -LLKeyboard::LLKeyboard() : mCallbacks(NULL), mNumpadDistinct(ND_NUMLOCK_OFF) +LLKeyboard::LLKeyboard() : mCallbacks(NULL) { S32 i; diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index ba472cfde5..c155c1b362 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -62,14 +62,6 @@ class LLWindowCallbacks; class LLKeyboard { -public: - typedef enum e_numpad_distinct - { - ND_NEVER, - ND_NUMLOCK_OFF, - ND_NUMLOCK_ON - } ENumpadDistinct; - public: LLKeyboard(); virtual ~LLKeyboard(); @@ -107,8 +99,6 @@ public: static BOOL keyFromString(const std::string& str, KEY *key); // False on failure static std::string stringFromKey(KEY key); static std::string stringFromAccelerator( MASK accel_mask, KEY key ); - e_numpad_distinct getNumpadDistinct() { return mNumpadDistinct; } - void setNumpadDistinct(e_numpad_distinct val) { mNumpadDistinct = val; } void setCallbacks(LLWindowCallbacks *cbs) { mCallbacks = cbs; } F32 getKeyElapsedTime( KEY key ); // Returns time in seconds since key was pressed. @@ -135,8 +125,6 @@ protected: static LLKeyStringTranslatorFunc* mStringTranslator; // Used for l10n + PC/Mac/Linux accelerator labeling - e_numpad_distinct mNumpadDistinct; - EKeyboardInsertMode mInsertMode; static std::map sKeysToNames; diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index df78816bd6..be3fe5deb0 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -299,69 +299,13 @@ void LLKeyboardWin32::scanKeyboard() BOOL LLKeyboardWin32::translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key) { - if(mNumpadDistinct == ND_NUMLOCK_ON) - { - std::map::iterator iter = mTranslateNumpadMap.find(os_key); - if (iter != mTranslateNumpadMap.end()) - { - *translated_key = iter->second; - return TRUE; - } - } - - BOOL success = translateKey(os_key, translated_key); - if(mNumpadDistinct != ND_NEVER) { - if(!success) return success; - if(mask & MASK_EXTENDED) - { - // this is where we'd create new keycodes for extended keys - // the set of extended keys includes the 'normal' arrow keys and - // the pgup/dn/insert/home/end/delete cluster above the arrow keys - // see http://windowssdk.msdn.microsoft.com/en-us/library/ms646280.aspx - - // only process the return key if numlock is off - if(((mNumpadDistinct == ND_NUMLOCK_OFF && - !(GetKeyState(VK_NUMLOCK) & 1)) - || mNumpadDistinct == ND_NUMLOCK_ON) && - *translated_key == KEY_RETURN) { - *translated_key = KEY_PAD_RETURN; - } - } - else - { - // the non-extended keys, those are in the numpad - switch (*translated_key) - { - case KEY_LEFT: - *translated_key = KEY_PAD_LEFT; break; - case KEY_RIGHT: - *translated_key = KEY_PAD_RIGHT; break; - case KEY_UP: - *translated_key = KEY_PAD_UP; break; - case KEY_DOWN: - *translated_key = KEY_PAD_DOWN; break; - case KEY_HOME: - *translated_key = KEY_PAD_HOME; break; - case KEY_END: - *translated_key = KEY_PAD_END; break; - case KEY_PAGE_UP: - *translated_key = KEY_PAD_PGUP; break; - case KEY_PAGE_DOWN: - *translated_key = KEY_PAD_PGDN; break; - case KEY_INSERT: - *translated_key = KEY_PAD_INS; break; - case KEY_DELETE: - *translated_key = KEY_PAD_DEL; break; - } - } - } - return success; + return translateKey(os_key, translated_key); } U16 LLKeyboardWin32::inverseTranslateExtendedKey(const KEY translated_key) { // if numlock is on, then we need to translate KEY_PAD_FOO to the corresponding number pad number - if((mNumpadDistinct == ND_NUMLOCK_ON) && (GetKeyState(VK_NUMLOCK) & 1)) + if(GetKeyState(VK_NUMLOCK) & 1) { std::map::iterator iter = mInvTranslateNumpadMap.find(translated_key); if (iter != mInvTranslateNumpadMap.end()) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 12e2ff71fd..a048f52556 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6345,17 +6345,6 @@ Value 0 - NumpadControl - - Comment - How numpad keys control your avatar. 0 = Like the normal arrow keys, 1 = Numpad moves avatar when numlock is off, 2 = Numpad moves avatar regardless of numlock (use this if you have no numlock) - Persist - 1 - Type - S32 - Value - 0 - ObjectCacheEnabled Comment diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 093b84413a..611aefed9f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -328,15 +328,6 @@ static bool handleUploadBakedTexOldChanged(const LLSD& newvalue) } -static bool handleNumpadControlChanged(const LLSD& newvalue) -{ - if (gKeyboard) - { - gKeyboard->setNumpadDistinct(static_cast(newvalue.asInteger())); - } - return true; -} - static bool handleWLSkyDetailChanged(const LLSD&) { if (gSky.mVOWLSkyp.notNull()) @@ -635,7 +626,6 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderPreferStreamDraw")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2)); - gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2)); gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 589714c25c..5550a0c88b 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1700,9 +1700,6 @@ LLViewerWindow::LLViewerWindow(const Params& p) // Can't have spaces in settings.ini strings, so use underscores instead and convert them. LLStringUtil::replaceChar(mOverlayTitle, '_', ' '); - // sync the keyboard's setting with the saved setting - gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); - mDebugText = new LLDebugText(this); mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale); -- cgit v1.3 From 7faa89ba6e4ccd2f0f987f72c44c90921adfd4c9 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 24 May 2012 22:40:50 -0700 Subject: BUILDFIX: Correcting linux and mac build issues. --- indra/llwindow/llkeyboardmacosx.cpp | 17 ----------------- indra/llwindow/llkeyboardsdl.cpp | 20 +------------------- 2 files changed, 1 insertion(+), 36 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index ecc2631669..7f8f303517 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -299,28 +299,11 @@ void LLKeyboardMacOSX::scanKeyboard() BOOL LLKeyboardMacOSX::translateNumpadKey( const U16 os_key, KEY *translated_key ) { - if(mNumpadDistinct == ND_NUMLOCK_ON) - { - std::map::iterator iter= mTranslateNumpadMap.find(os_key); - if(iter != mTranslateNumpadMap.end()) - { - *translated_key = iter->second; - return TRUE; - } - } return translateKey(os_key, translated_key); } U16 LLKeyboardMacOSX::inverseTranslateNumpadKey(const KEY translated_key) { - if(mNumpadDistinct == ND_NUMLOCK_ON) - { - std::map::iterator iter= mInvTranslateNumpadMap.find(translated_key); - if(iter != mInvTranslateNumpadMap.end()) - { - return iter->second; - } - } return inverseTranslateKey(translated_key); } diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp index 4bb9603368..7c9aa1d340 100644 --- a/indra/llwindow/llkeyboardsdl.cpp +++ b/indra/llwindow/llkeyboardsdl.cpp @@ -312,29 +312,11 @@ void LLKeyboardSDL::scanKeyboard() BOOL LLKeyboardSDL::translateNumpadKey( const U16 os_key, KEY *translated_key) { - if(mNumpadDistinct == ND_NUMLOCK_ON) - { - std::map::iterator iter= mTranslateNumpadMap.find(os_key); - if(iter != mTranslateNumpadMap.end()) - { - *translated_key = iter->second; - return TRUE; - } - } - BOOL success = translateKey(os_key, translated_key); - return success; + return translateKey(os_key, translated_key); } U16 LLKeyboardSDL::inverseTranslateNumpadKey(const KEY translated_key) { - if(mNumpadDistinct == ND_NUMLOCK_ON) - { - std::map::iterator iter= mInvTranslateNumpadMap.find(translated_key); - if(iter != mInvTranslateNumpadMap.end()) - { - return iter->second; - } - } return inverseTranslateKey(translated_key); } -- cgit v1.3 From 11b6e272abf05c5429865aaa1366bd450b8bc218 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 21 Jun 2012 16:39:35 -0700 Subject: PATH-743: Altering the mouse cursor to give more feed back when in path testing mode. --- indra/llcommon/llcursortypes.cpp | 2 + indra/llcommon/llcursortypes.h | 2 + indra/llwindow/llwindowwin32.cpp | 2 + indra/newview/CMakeLists.txt | 2 + indra/newview/llpathfindingpathtool.cpp | 49 +++++++++++++++++++---- indra/newview/llpathfindingpathtool.h | 1 + indra/newview/res/lltoolpathfinding.cur | Bin 326 -> 4286 bytes indra/newview/res/lltoolpathfindingpathend.cur | Bin 0 -> 326 bytes indra/newview/res/lltoolpathfindingpathstart.cur | Bin 0 -> 326 bytes indra/newview/res/viewerRes.rc | 2 + 10 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 indra/newview/res/lltoolpathfindingpathend.cur create mode 100644 indra/newview/res/lltoolpathfindingpathstart.cur (limited to 'indra/llwindow') diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index 0367e6e622..c0676f8c13 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -70,6 +70,8 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; + cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTART"] = UI_CURSOR_TOOLPATHFINDING_PATH_START; + cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHEND"] = UI_CURSOR_TOOLPATHFINDING_PATH_END; cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; } diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index 4662e90975..f47a328f77 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -66,6 +66,8 @@ enum ECursorType { UI_CURSOR_TOOLBUY, UI_CURSOR_TOOLOPEN, UI_CURSOR_TOOLPATHFINDING, + UI_CURSOR_TOOLPATHFINDING_PATH_START, + UI_CURSOR_TOOLPATHFINDING_PATH_END, UI_CURSOR_TOOLNO, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index a332bfddc4..9a52b7c09a 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1698,6 +1698,8 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); + mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_START ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHSTART")); + mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_END ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHEND")); mCursor[ UI_CURSOR_TOOLNO ] = LoadCursor(module, TEXT("TOOLNO")); // Color cursors diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 04d67b5108..ac78377abd 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1339,6 +1339,8 @@ if (WINDOWS) res/lltoolland.cur res/lltoolpan.cur res/lltoolpathfinding.cur + res/lltoolpathfindingpathend.cur + res/lltoolpathfindingpathstart.cur res/lltoolpipette.cur res/lltoolrotate.cur res/lltoolscale.cur diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 5567869a1c..82426920d8 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -66,12 +66,30 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) { - computeFinalPoints(pX, pY, pMask); - mIsLeftMouseButtonHeld = true; - setMouseCapture(TRUE); - returnVal = TRUE; + if (isAnyPathToolModKeys(pMask)) + { + if (isPointAModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START); + } + else if (isPointBModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END); + } + computeFinalPoints(pX, pY, pMask); + mIsLeftMouseButtonHeld = true; + setMouseCapture(TRUE); + returnVal = TRUE; + } + else if (!isCameraModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); + mIsLeftMouseButtonHeld = true; + setMouseCapture(TRUE); + returnVal = TRUE; + } } mIsLeftMouseButtonHeld = true; @@ -82,7 +100,7 @@ BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) { computeFinalPoints(pX, pY, pMask); setMouseCapture(FALSE); @@ -142,9 +160,21 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && !isAnyPathToolModKeys(pMask)) { gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING); + } + + if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) + { + if (isPointAModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START); + } + else if (isPointBModKeys(pMask)) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END); + } computeTempPoints(pX, pY, pMask); returnVal = TRUE; } @@ -291,6 +321,11 @@ bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const return ((pMask & MASK_SHIFT) != 0); } +bool LLPathfindingPathTool::isCameraModKeys(MASK pMask) const +{ + return ((pMask & MASK_ALT) != 0); +} + void LLPathfindingPathTool::getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const { LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY); diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 671f5bef95..8a79da43c9 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -98,6 +98,7 @@ private: bool isAnyPathToolModKeys(MASK pMask) const; bool isPointAModKeys(MASK pMask) const; bool isPointBModKeys(MASK pMask) const; + bool isCameraModKeys(MASK pMask) const; void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const; void computeFinalPoints(S32 pX, S32 pY, MASK pMask); diff --git a/indra/newview/res/lltoolpathfinding.cur b/indra/newview/res/lltoolpathfinding.cur index 2df80de0a6..acf5184227 100644 Binary files a/indra/newview/res/lltoolpathfinding.cur and b/indra/newview/res/lltoolpathfinding.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathend.cur b/indra/newview/res/lltoolpathfindingpathend.cur new file mode 100644 index 0000000000..6a1e007a67 Binary files /dev/null and b/indra/newview/res/lltoolpathfindingpathend.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathstart.cur b/indra/newview/res/lltoolpathfindingpathstart.cur new file mode 100644 index 0000000000..4446c491c4 Binary files /dev/null and b/indra/newview/res/lltoolpathfindingpathstart.cur differ diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 686de0e7d5..0b469c8d81 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -123,6 +123,8 @@ TOOLBUY CURSOR "toolbuy.cur" TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" +TOOLPATHFINDINGPATHSTART CURSOR "lltoolpathfindingpathstart.cur" +TOOLPATHFINDINGPATHEND CURSOR "lltoolpathfindingpathend.cur" TOOLNO CURSOR "llno.cur" ///////////////////////////////////////////////////////////////////////////// -- cgit v1.3 From bf1c1947d752e1f4d18d77b3190691d8244bc91f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 25 Jun 2012 14:28:21 -0700 Subject: PATH-743: Updating the cursors for path testing mode to final designs. --- indra/llcommon/llcursortypes.cpp | 2 ++ indra/llcommon/llcursortypes.h | 2 ++ indra/llwindow/llwindowwin32.cpp | 2 ++ indra/newview/CMakeLists.txt | 2 ++ indra/newview/llpathfindingpathtool.cpp | 22 +++++++++++++++++---- indra/newview/res/lltoolpathfinding.cur | Bin 4286 -> 2238 bytes indra/newview/res/lltoolpathfindingpathend.cur | Bin 4286 -> 2238 bytes indra/newview/res/lltoolpathfindingpathendadd.cur | Bin 0 -> 2238 bytes indra/newview/res/lltoolpathfindingpathstart.cur | Bin 4286 -> 2238 bytes .../newview/res/lltoolpathfindingpathstartadd.cur | Bin 0 -> 2238 bytes indra/newview/res/viewerRes.rc | 4 +++- 11 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 indra/newview/res/lltoolpathfindingpathendadd.cur create mode 100644 indra/newview/res/lltoolpathfindingpathstartadd.cur (limited to 'indra/llwindow') diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index c0676f8c13..ec60097195 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -71,7 +71,9 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTART"] = UI_CURSOR_TOOLPATHFINDING_PATH_START; + cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTARTADD"] = UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD; cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHEND"] = UI_CURSOR_TOOLPATHFINDING_PATH_END; + cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHENDADD"] = UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD; cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; } diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index f47a328f77..cb6d6636a0 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -67,7 +67,9 @@ enum ECursorType { UI_CURSOR_TOOLOPEN, UI_CURSOR_TOOLPATHFINDING, UI_CURSOR_TOOLPATHFINDING_PATH_START, + UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD, UI_CURSOR_TOOLPATHFINDING_PATH_END, + UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD, UI_CURSOR_TOOLNO, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 5f637bc6f1..be0f8bc7af 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1699,8 +1699,10 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); + mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHSTARTADD")); mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_START ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHSTART")); mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_END ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHEND")); + mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHENDADD")); mCursor[ UI_CURSOR_TOOLNO ] = LoadCursor(module, TEXT("TOOLNO")); // Color cursors diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 6358464fb0..ac0b0c0351 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1342,7 +1342,9 @@ if (WINDOWS) res/lltoolpan.cur res/lltoolpathfinding.cur res/lltoolpathfindingpathend.cur + res/lltoolpathfindingpathendadd.cur res/lltoolpathfindingpathstart.cur + res/lltoolpathfindingpathstartadd.cur res/lltoolpipette.cur res/lltoolrotate.cur res/lltoolscale.cur diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 82426920d8..fde2257777 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -72,11 +72,11 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) { if (isPointAModKeys(pMask)) { - gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START); + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD); } else if (isPointBModKeys(pMask)) { - gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END); + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD); } computeFinalPoints(pX, pY, pMask); mIsLeftMouseButtonHeld = true; @@ -169,11 +169,25 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) { if (isPointAModKeys(pMask)) { - gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START); + if (mIsLeftMouseButtonHeld) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD); + } + else + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START); + } } else if (isPointBModKeys(pMask)) { - gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END); + if (mIsLeftMouseButtonHeld) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD); + } + else + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING_PATH_END); + } } computeTempPoints(pX, pY, pMask); returnVal = TRUE; diff --git a/indra/newview/res/lltoolpathfinding.cur b/indra/newview/res/lltoolpathfinding.cur index 40c5a40905..2aba2daa45 100644 Binary files a/indra/newview/res/lltoolpathfinding.cur and b/indra/newview/res/lltoolpathfinding.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathend.cur b/indra/newview/res/lltoolpathfindingpathend.cur index df8d56d205..e951a6956b 100644 Binary files a/indra/newview/res/lltoolpathfindingpathend.cur and b/indra/newview/res/lltoolpathfindingpathend.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathendadd.cur b/indra/newview/res/lltoolpathfindingpathendadd.cur new file mode 100644 index 0000000000..0bf3201b23 Binary files /dev/null and b/indra/newview/res/lltoolpathfindingpathendadd.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathstart.cur b/indra/newview/res/lltoolpathfindingpathstart.cur index 5c38bb6c00..fecc716990 100644 Binary files a/indra/newview/res/lltoolpathfindingpathstart.cur and b/indra/newview/res/lltoolpathfindingpathstart.cur differ diff --git a/indra/newview/res/lltoolpathfindingpathstartadd.cur b/indra/newview/res/lltoolpathfindingpathstartadd.cur new file mode 100644 index 0000000000..45e23e5161 Binary files /dev/null and b/indra/newview/res/lltoolpathfindingpathstartadd.cur differ diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 0b469c8d81..df75f3f697 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -124,7 +124,9 @@ TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" TOOLPATHFINDINGPATHSTART CURSOR "lltoolpathfindingpathstart.cur" -TOOLPATHFINDINGPATHEND CURSOR "lltoolpathfindingpathend.cur" +TOOLPATHFINDINGPATHSTARTADD CURSOR "lltoolpathfindingpathstartadd.cur" +TOOLPATHFINDINGPATHEND CURSOR "lltoolpathfindingpathend.cur" +TOOLPATHFINDINGPATHENDADD CURSOR "lltoolpathfindingpathendadd.cur" TOOLNO CURSOR "llno.cur" ///////////////////////////////////////////////////////////////////////////// -- cgit v1.3