From 083c81f53f79f53aafdb380a178be081ae461018 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 27 Mar 2012 13:38:51 -0700 Subject: PATH-433: Pumping the character type selection from the console floater into the generatePath call of the pathing library. --- indra/newview/llfloaterpathfindingconsole.cpp | 79 +++++++++++----------- indra/newview/llfloaterpathfindingconsole.h | 12 ++-- .../default/xui/en/floater_pathfinding_console.xml | 64 +++++++----------- 3 files changed, 71 insertions(+), 84 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f830dc1fac..c83153a15d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -35,7 +35,7 @@ #include "llagent.h" #include "llpanel.h" #include "llbutton.h" -#include "llradiogroup.h" +#include "llcheckboxctrl.h" #include "llsliderctrl.h" #include "lllineeditor.h" #include "lltextbase.h" @@ -57,6 +57,7 @@ #define XUI_RENDER_HEATMAP_C 3 #define XUI_RENDER_HEATMAP_D 4 +#define XUI_CHARACTER_TYPE_NONE 0 #define XUI_CHARACTER_TYPE_A 1 #define XUI_CHARACTER_TYPE_B 2 #define XUI_CHARACTER_TYPE_C 3 @@ -139,9 +140,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + mCharacterTypeComboBox = findChild("path_character_type"); + llassert(mCharacterTypeComboBox != NULL); + mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); mPathTestingStatus = findChild("path_test_status"); llassert(mPathTestingStatus != NULL); @@ -441,8 +442,11 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar { ECharacterType characterType; - switch (mCharacterTypeRadioGroup->getValue().asInteger()) + switch (mCharacterTypeComboBox->getValue().asInteger()) { + case XUI_CHARACTER_TYPE_NONE : + characterType = kCharacterTypeNone; + break; case XUI_CHARACTER_TYPE_A : characterType = kCharacterTypeA; break; @@ -456,7 +460,7 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar characterType = kCharacterTypeD; break; default : - characterType = kCharacterTypeA; + characterType = kCharacterTypeNone; llassert(0); break; } @@ -470,6 +474,9 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType switch (pCharacterType) { + case kCharacterTypeNone : + radioGroupValue = XUI_CHARACTER_TYPE_NONE; + break; case kCharacterTypeA : radioGroupValue = XUI_CHARACTER_TYPE_A; break; @@ -483,12 +490,12 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType radioGroupValue = XUI_CHARACTER_TYPE_D; break; default : - radioGroupValue = XUI_CHARACTER_TYPE_A; + radioGroupValue = XUI_CHARACTER_TYPE_NONE; llassert(0); break; } - mCharacterTypeRadioGroup->setValue(radioGroupValue); + mCharacterTypeComboBox->setValue(radioGroupValue); } LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) @@ -514,7 +521,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mFreezeLabel(NULL), mFreezeButton(NULL), mCharacterWidthSlider(NULL), - mCharacterTypeRadioGroup(NULL), + mCharacterTypeComboBox(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), mNavMeshZoneSlot(), @@ -593,32 +600,7 @@ void LLFloaterPathfindingConsole::onCharacterWidthSet() void LLFloaterPathfindingConsole::onCharacterTypeSwitch() { - switch (getCharacterType()) - { - case kCharacterTypeA : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" - << llendl; - break; - case kCharacterTypeB : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" - << llendl; - break; - case kCharacterTypeC : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" - << llendl; - break; - case kCharacterTypeD : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" - << llendl; - break; - default : - llassert(0); - break; - } + generatePath(); updatePathTestStatus(); } @@ -715,7 +697,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeRadioGroup->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; @@ -734,7 +716,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeRadioGroup->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; @@ -750,7 +732,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); mCharacterWidthSlider->setEnabled(TRUE); - mCharacterTypeRadioGroup->setEnabled(TRUE); + mCharacterTypeComboBox->setEnabled(TRUE); mClearPathButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); break; @@ -928,6 +910,27 @@ void LLFloaterPathfindingConsole::generatePath() if (mHasStartPoint && mHasEndPoint) { 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::getInstance()->generatePath(mPathData); } } diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index dff9b08383..447eaf726d 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -36,7 +36,6 @@ class LLSD; class LLPanel; -class LLRadioGroup; class LLSliderCtrl; class LLLineEditor; class LLTextBase; @@ -62,10 +61,11 @@ public: typedef enum { - kCharacterTypeA = 0, - kCharacterTypeB = 1, - kCharacterTypeC = 2, - kCharacterTypeD = 3 + kCharacterTypeNone, + kCharacterTypeA, + kCharacterTypeB, + kCharacterTypeC, + kCharacterTypeD } ECharacterType; virtual BOOL postBuild(); @@ -179,7 +179,7 @@ private: LLTextBase *mFreezeLabel; LLButton *mFreezeButton; LLSliderCtrl *mCharacterWidthSlider; - LLRadioGroup *mCharacterTypeRadioGroup; + LLComboBox *mCharacterTypeComboBox; LLTextBase *mPathTestingStatus; LLButton *mClearPathButton; 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 c7b9e2bf19..a672ecce8e 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -30,7 +30,7 @@ Please choose start and end points. Please choose start point. Please choose end point. - Path is shown in blue. + Path is shown in olive green. Region boundary hit, navmesh may not be accurate. Character type - - + + - + - + - + - + name="path_character_type_d" + value="4" /> + Ctrl-click to select start point. -- cgit v1.2.3