diff --git a/indra/newview/llfloaterpathfindingbasic.cpp b/indra/newview/llfloaterpathfindingbasic.cpp index a875cae883..a1c333989e 100644 --- a/indra/newview/llfloaterpathfindingbasic.cpp +++ b/indra/newview/llfloaterpathfindingbasic.cpp @@ -30,6 +30,9 @@ #include "llsd.h" #include "llagent.h" +#include "lltextbase.h" +#include "llbutton.h" +#include "llviewerregion.h" //--------------------------------------------------------------------------- // LLFloaterPathfindingBasic @@ -37,15 +40,40 @@ BOOL LLFloaterPathfindingBasic::postBuild() { - childSetAction("enter_unfrozen_mode", boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this)); - childSetAction("enter_frozen_mode", boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this)); + mRegionNotEnabledText = findChild("disabled_warning_label"); + llassert(mRegionNotEnabledText != NULL); + + mUnfreezeLabel = findChild("unfreeze_label"); + llassert(mUnfreezeLabel != NULL); + + mUnfreezeButton = findChild("enter_unfrozen_mode"); + llassert(mUnfreezeButton != NULL); + mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this)); + + mFreezeLabel = findChild("freeze_label"); + llassert(mFreezeLabel != NULL); + + mFreezeButton = findChild("enter_frozen_mode"); + llassert(mFreezeButton != NULL); + mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this)); + + updateOnFrozenState(); return LLFloater::postBuild(); } +void LLFloaterPathfindingBasic::onOpen(const LLSD& key) +{ +} LLFloaterPathfindingBasic::LLFloaterPathfindingBasic(const LLSD& pSeed) - : LLFloater(pSeed) + : LLFloater(pSeed), + mRegionNotEnabledText(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), + mIsRegionFrozenXXX(true) { } @@ -53,12 +81,61 @@ LLFloaterPathfindingBasic::~LLFloaterPathfindingBasic() { } +std::string LLFloaterPathfindingBasic::getCapabilityURL() const +{ + std::string capURL(""); + + LLViewerRegion *region = gAgent.getRegion(); + if (region != NULL) + { + capURL = region->getCapability("RetrieveNavMeshSrc"); + } + + return capURL; +} + +void LLFloaterPathfindingBasic::updateOnFrozenState() +{ + std::string capURL = getCapabilityURL(); + + if (capURL.empty()) + { + mRegionNotEnabledText->setVisible(TRUE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + } + else + { + mRegionNotEnabledText->setVisible(FALSE); + if (mIsRegionFrozenXXX) + { + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + } + else + { + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + } + } +} + void LLFloaterPathfindingBasic::onUnfreezeClicked() { + mIsRegionFrozenXXX = false; + updateOnFrozenState(); llwarns << "functionality has not yet been implemented to set unfrozen state" << llendl; } void LLFloaterPathfindingBasic::onFreezeClicked() { + mIsRegionFrozenXXX = true; + updateOnFrozenState(); llwarns << "functionality has not yet been implemented to set frozen state" << llendl; } diff --git a/indra/newview/llfloaterpathfindingbasic.h b/indra/newview/llfloaterpathfindingbasic.h index 888d06c521..cd51964339 100644 --- a/indra/newview/llfloaterpathfindingbasic.h +++ b/indra/newview/llfloaterpathfindingbasic.h @@ -32,6 +32,8 @@ #include "llhandle.h" class LLSD; +class LLTextBase; +class LLButton; class LLFloaterPathfindingBasic : public LLFloater @@ -39,8 +41,8 @@ class LLFloaterPathfindingBasic friend class LLFloaterReg; public: - virtual BOOL postBuild(); + virtual void onOpen(const LLSD& key); protected: @@ -52,6 +54,17 @@ private: void onUnfreezeClicked(); void onFreezeClicked(); + + std::string getCapabilityURL() const; + + void updateOnFrozenState(); + + LLTextBase *mRegionNotEnabledText; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; + bool mIsRegionFrozenXXX; // XXX stinson : Feb 15, 2012 : I think this will be unneeded with the service }; #endif // LL_LLFLOATERPATHFINDINGBASIC_H diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 728efc52a4..1b948c442b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -70,10 +70,6 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHand BOOL LLFloaterPathfindingConsole::postBuild() { - childSetAction("view_characters_floater", boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("clear_path", boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); @@ -97,12 +93,37 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mShowWorldCheckBox != NULL); mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); + mViewCharactersButton = findChild("view_characters_floater"); + llassert(mViewCharactersButton != NULL); + mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); mEditTestTabContainer = findChild("edit_test_tab_container"); llassert(mEditTestTabContainer != NULL); + mUnfreezeLabel = findChild("unfreeze_label"); + llassert(mUnfreezeLabel != NULL); + + mUnfreezeButton = findChild("enter_unfrozen_mode"); + llassert(mUnfreezeButton != NULL); + mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onUnfreezeClicked, this)); + + mLinksetsLabel = findChild("edit_linksets_label"); + llassert(mLinksetsLabel != NULL); + + mLinksetsButton = findChild("view_and_edit_linksets"); + llassert(mLinksetsButton != NULL); + mLinksetsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mFreezeLabel = findChild("freeze_label"); + llassert(mFreezeLabel != NULL); + + mFreezeButton = findChild("enter_frozen_mode"); + llassert(mFreezeButton != NULL); + mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this)); + + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); @@ -113,6 +134,12 @@ BOOL LLFloaterPathfindingConsole::postBuild() mPathTestingStatus = findChild("path_test_status"); llassert(mPathTestingStatus != NULL); + + mClearPathButton = findChild("clear_path"); + llassert(mClearPathButton != NULL); + mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + + updateOnPathfindingServerStatus(); updatePathTestStatus(); return LLFloater::postBuild(); @@ -237,8 +264,8 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) mShowWorldCheckBox->set(pIsRenderWorld); } -LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const -{ +LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ ERenderHeatmapType renderHeatmapType; switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) @@ -265,10 +292,10 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get } return renderHeatmapType; -} - -void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) -{ +} + +void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) +{ LLSD comboBoxValue; switch (pRenderHeatmapType) @@ -295,7 +322,7 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRende } return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); -} +} F32 LLFloaterPathfindingConsole::getCharacterWidth() const { @@ -390,13 +417,22 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowExclusionVolumesCheckBox(NULL), mShowWorldCheckBox(NULL), mPathfindingStatus(NULL), + mViewCharactersButton(NULL), mEditTestTabContainer(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mLinksetsLabel(NULL), + mLinksetsButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), mPathTestingStatus(NULL), + mClearPathButton(NULL), mNavMeshCnt(0), mHasStartPoint(false), - mHasEndPoint(false) + mHasEndPoint(false), + mIsRegionFrozen(false) { mSelfHandle.bind(this); @@ -478,6 +514,21 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } } } + + updateOnPathfindingServerStatus(); +} + +std::string LLFloaterPathfindingConsole::getCurrentRegionCapabilityURL() const +{ + std::string capURL(""); + + LLViewerRegion *region = gAgent.getRegion(); + if (region != NULL) + { + capURL = region->getCapability("RetrieveNavMeshSrc"); + } + + return capURL; } void LLFloaterPathfindingConsole::onShowWalkabilitySet() @@ -573,6 +624,20 @@ void LLFloaterPathfindingConsole::onViewCharactersClicked() LLFloaterPathfindingCharacters::openCharactersViewer(); } +void LLFloaterPathfindingConsole::onUnfreezeClicked() +{ + mIsRegionFrozen = false; + updateOnPathfindingServerStatus(); + llwarns << "functionality has not yet been implemented to set unfrozen state" << llendl; +} + +void LLFloaterPathfindingConsole::onFreezeClicked() +{ + mIsRegionFrozen = true; + updateOnPathfindingServerStatus(); + llwarns << "functionality has not yet been implemented to set frozen state" << llendl; +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); @@ -585,6 +650,68 @@ void LLFloaterPathfindingConsole::onClearPathClicked() updatePathTestStatus(); } +void LLFloaterPathfindingConsole::updateOnPathfindingServerStatus() +{ + std::string capURL = getCurrentRegionCapabilityURL(); + + if (capURL.empty()) + { + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(FALSE); + mEditTestTabContainer->setEnabled(FALSE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeRadioGroup->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + + mEditTestTabContainer->selectTab(0); + } + else + { + mShowNavMeshCheckBox->setEnabled(TRUE); + mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); + mShowWalkablesCheckBox->setEnabled(TRUE); + mShowStaticObstaclesCheckBox->setEnabled(TRUE); + mShowMaterialVolumesCheckBox->setEnabled(TRUE); + mShowExclusionVolumesCheckBox->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->setEnabled(TRUE); + mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeRadioGroup->setEnabled(TRUE); + mClearPathButton->setEnabled(TRUE); + if (mIsRegionFrozen) + { + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + } + else + { + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + } + } +} + void LLFloaterPathfindingConsole::generatePath() { if (mHasStartPoint && mHasEndPoint) diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 726bf36636..10fcf26795 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -41,6 +41,7 @@ class LLTextBase; class LLCheckBoxCtrl; class LLTabContainer; class LLComboBox; +class LLButton; class LLFloaterPathfindingConsole : public LLFloater @@ -113,15 +114,20 @@ private: virtual ~LLFloaterPathfindingConsole(); virtual void onOpen(const LLSD& pKey); + std::string getCurrentRegionCapabilityURL() const; void onShowWalkabilitySet(); void onShowWorldToggle(); void onCharacterWidthSet(); void onCharacterTypeSwitch(); void onViewCharactersClicked(); + void onUnfreezeClicked(); + void onFreezeClicked(); void onViewEditLinksetClicked(); void onClearPathClicked(); + void updateOnPathfindingServerStatus(); + void generatePath(); void updatePathTestStatus(); @@ -134,10 +140,19 @@ private: LLCheckBoxCtrl *mShowExclusionVolumesCheckBox; LLCheckBoxCtrl *mShowWorldCheckBox; LLTextBase *mPathfindingStatus; + LLButton *mViewCharactersButton; LLTabContainer *mEditTestTabContainer; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mLinksetsLabel; + LLButton *mLinksetsButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; LLSliderCtrl *mCharacterWidthSlider; LLRadioGroup *mCharacterTypeRadioGroup; LLTextBase *mPathTestingStatus; + LLButton *mClearPathButton; + bool mIsRegionFrozen; LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; int mCurrentMDO; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 1b629f515b..12eea7844d 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -68,7 +68,6 @@ #include "llworld.h" #include "pipeline.h" #include "llviewershadermgr.h" -#include "llradiogroup.h" #include "lldrawpool.h" #include "lluictrlfactory.h" @@ -159,14 +158,6 @@ BOOL LLPanelVolume::postBuild() mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); } - // Pathfinding Parameters - { - // Pathfinding state - mPathfindingType = findChild("edit_pathfinding_state"); - llassert(mPathfindingType != NULL); - mPathfindingType->setCommitCallback(boost::bind(&LLPanelVolume::sendPathfindingType, this)); - } - std::map material_name_map; material_name_map["Stone"]= LLTrans::getString("Stone"); material_name_map["Metal"]= LLTrans::getString("Metal"); @@ -203,8 +194,7 @@ BOOL LLPanelVolume::postBuild() LLPanelVolume::LLPanelVolume() : LLPanel(), - mComboMaterialItemCount(0), - mPathfindingType(NULL) + mComboMaterialItemCount(0) { setMouseOpaque(FALSE); @@ -473,8 +463,6 @@ void LLPanelVolume::getState( ) mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution()); mSpinPhysicsRestitution->setEnabled(editable); - mPathfindingType->setEnabled(editable); - // update the physics shape combo to include allowed physics shapes mComboPhysicsShapeType->removeall(); mComboPhysicsShapeType->add(getString("None"), LLSD(1)); @@ -558,8 +546,6 @@ void LLPanelVolume::refresh() getChildView("Physics Friction")->setVisible(enable_mesh); getChildView("Physics Density")->setVisible(enable_mesh); getChildView("Physics Restitution")->setVisible(enable_mesh); - - mPathfindingType->setVisible(enable_mesh); /* TODO: add/remove individual physics shape types as per the PhysicsShapeTypes simulator features */ } @@ -614,8 +600,6 @@ void LLPanelVolume::clearCtrls() mSpinPhysicsDensity->setEnabled(FALSE); mSpinPhysicsRestitution->setEnabled(FALSE); - mPathfindingType->setEnabled(FALSE); - mComboMaterial->setEnabled( FALSE ); } @@ -701,12 +685,6 @@ void LLPanelVolume::sendPhysicsDensity(LLUICtrl* ctrl, void* userdata) LLSelectMgr::getInstance()->selectionSetDensity(val); } -void LLPanelVolume::sendPathfindingType() -{ - S32 val = mPathfindingType->getValue().asInteger(); - llwarns << "functionality to set '" << mPathfindingType->getName() << "' to value " << val << " has not been implemented." << llendl; -} - void LLPanelVolume::refreshCost() { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index ae66414b0f..0ef47db0d9 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -40,7 +40,6 @@ class LLButton; class LLViewerObject; class LLComboBox; class LLColorSwatchCtrl; -class LLRadioGroup; class LLPanelVolume : public LLPanel { @@ -85,8 +84,6 @@ protected: void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata); void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata); - void sendPathfindingType(); - /* LLTextBox* mLabelSelectSingleMessage; // Light @@ -121,8 +118,6 @@ protected: LLSpinCtrl* mSpinPhysicsFriction; LLSpinCtrl* mSpinPhysicsDensity; LLSpinCtrl* mSpinPhysicsRestitution; - - LLRadioGroup* mPathfindingType; }; #endif diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml index e21b6c842f..36c7f11f5d 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml @@ -2,7 +2,7 @@ - Permit object / terrain changes: + This region is not enabled for pathfinding. + + + Allow object / terrain changes: