diff options
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 4 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 74 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 3 |
4 files changed, 98 insertions, 2 deletions
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2ccba3604b..570a3f45eb 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -48,7 +48,7 @@ #include "llpathfindingpathtool.h" #include "lltoolmgr.h" #include "lltoolfocus.h" - +#include "pipeline.h" #include "llpathinglib.h" #define XUI_RENDER_HEATMAP_NONE 0 @@ -85,6 +85,8 @@ LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle; +extern LLPipeline gPipeline; + //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -97,8 +99,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowWorldCheckBox = findChild<LLCheckBoxCtrl>("show_world"); llassert(mShowWorldCheckBox != NULL); mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); - + mShowWorldMovablesOnlyCheckBox = findChild<LLCheckBoxCtrl>("show_world_movables_only"); + mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRenderWorldMovablesOnly, this)); llassert(mShowWorldMovablesOnlyCheckBox != NULL); mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh"); @@ -600,6 +603,18 @@ void LLFloaterPathfindingConsole::onClearPathClicked() clearPath(); } +void LLFloaterPathfindingConsole::onRenderWorldMovablesOnly() +{ + if ( mShowWorldMovablesOnlyCheckBox->get() ) + { + gPipeline.hidePermanentObjects( mRenderableRestoreList ); + } + else + { + gPipeline.restorePermanentObjects( mRenderableRestoreList ); + mRenderableRestoreList.clear(); + } +} void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) { switch (pNavMeshZoneRequestStatus) diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 72acc8a749..4af81698ff 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -126,6 +126,8 @@ private: void onCharacterWidthSet(); void onCharacterTypeSwitch(); void onClearPathClicked(); + void onRenderWorldMovablesOnly(); + void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); void onRegionBoundaryCross(); @@ -219,6 +221,8 @@ private: boost::signals2::connection mSavedSettingWaterSlot; EConsoleState mConsoleState; + + std::vector<U32> mRenderableRestoreList; static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle; }; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 72e47f54a0..e7123e24d2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2624,6 +2624,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) { const LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable; llassert(root); // trying to catch a bad assumption + if (root && // // this test may not be needed, see above root->getVObj()->isAttachment()) { @@ -2646,6 +2647,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) } else { + sCull->pushDrawable(drawablep); } @@ -10103,3 +10105,75 @@ void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) mDebugBlips.push_back(blip); } +void LLPipeline::hidePermanentObjects( std::vector<U32>& restoreList ) +{ + //This method is used to hide any vo's from the object list that may have + //the permanent flag set. + U32 objCnt = gObjectList.getNumObjects(); + for (U32 i = 0; i < objCnt; ++i) + { + LLViewerObject* pObject = gObjectList.getObject(i); + if ( pObject && pObject->flagObjectPermanent() ) + { + LLDrawable *pDrawable = pObject->mDrawable; + + if ( pDrawable ) + { + restoreList.push_back( i ); + pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //hide children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++ ) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if (drawable) + { + drawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } + } + } + } +} + +void LLPipeline::restorePermanentObjects( std::vector<U32>& restoreList ) +{ + //This method is used to restore(unhide) any vo's from the object list that may have + //been hidden because their permanency flag was set. + std::vector<U32>::iterator itCurrent = restoreList.begin(); + std::vector<U32>::iterator itEnd = restoreList.end(); + + while ( itCurrent != itEnd ) + { + U32 index = *itCurrent; + LLViewerObject* pObject = gObjectList.getObject( index ); + if ( pObject ) + { + LLDrawable *pDrawable = pObject->mDrawable; + if ( pDrawable ) + { + pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //restore children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if (drawable) + { + drawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } + } + } + ++itCurrent; + } +} + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 3c4e389ce0..5995fc0e5b 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -366,6 +366,9 @@ public: void addDebugBlip(const LLVector3& position, const LLColor4& color); + void hidePermanentObjects( std::vector<U32>& restoreList ); + void restorePermanentObjects( std::vector<U32>& restoreList ); + private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); |