summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp196
1 files changed, 159 insertions, 37 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 75bef846fe..5a1228768c 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -42,6 +42,7 @@
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llviewereventrecorder.h"
+#include "v4coloru.h"
// newview includes
#include "llagent.h"
@@ -106,6 +107,7 @@
#include "llsidepanelappearance.h"
#include "llspellcheckmenuhandler.h"
#include "llstatusbar.h"
+#include "llterrainpaintmap.h"
#include "lltextureview.h"
#include "lltoolbarview.h"
#include "lltoolcomp.h"
@@ -123,6 +125,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerstats.h"
#include "llviewerstatsrecorder.h"
+#include "llvlcomposition.h"
#include "llvoavatarself.h"
#include "llvoicevivox.h"
#include "llworld.h"
@@ -351,7 +354,10 @@ class LLMenuParcelObserver : public LLParcelObserver
public:
LLMenuParcelObserver();
~LLMenuParcelObserver();
- virtual void changed();
+ void changed() override;
+private:
+ LLHandle<LLUICtrl> mLandBuyHandle;
+ LLHandle<LLUICtrl> mLandBuyPassHandle;
};
static LLMenuParcelObserver* gMenuParcelObserver = NULL;
@@ -360,6 +366,8 @@ static LLUIListener sUIListener;
LLMenuParcelObserver::LLMenuParcelObserver()
{
+ mLandBuyHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy")->getHandle();
+ mLandBuyPassHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy Pass")->getHandle();
LLViewerParcelMgr::getInstance()->addObserver(this);
}
@@ -373,17 +381,16 @@ void LLMenuParcelObserver::changed()
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
if (gMenuLand && parcel)
{
- LLView* child = gMenuLand->findChild<LLView>("Land Buy Pass");
- if (child)
+ if (!mLandBuyPassHandle.isDead())
{
- child->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID()));
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ static_cast<LLMenuItemCallGL*>(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID()));
}
- child = gMenuLand->findChild<LLView>("Land Buy");
- if (child)
+ if (!mLandBuyHandle.isDead())
{
bool buyable = enable_buy_land(NULL);
- child->setEnabled(buyable);
+ static_cast<LLMenuItemCallGL*>(mLandBuyHandle.get())->setEnabled(buyable);
}
}
}
@@ -403,10 +410,34 @@ void initialize_menus();
// Break up groups of more than 6 items with separators
//-----------------------------------------------------------------------------
-void set_merchant_SLM_menu()
+void set_merchant_SLM_menu();
+
+class LLSLMMenuUpdater
+{
+public:
+ LLSLMMenuUpdater();
+ ~LLSLMMenuUpdater() = default;
+
+ void setMerchantMenu();
+ void checkMerchantStatus(bool force);
+
+private:
+ LLHandle<LLView> mMarketplaceListingsItem;
+};
+
+static LLSLMMenuUpdater* gSLMMenuUpdater = NULL;
+
+LLSLMMenuUpdater::LLSLMMenuUpdater()
+{
+ mMarketplaceListingsItem = gMenuHolder->getChild<LLView>("MarketplaceListings")->getHandle();
+}
+void LLSLMMenuUpdater::setMerchantMenu()
{
// All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool
- gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(true);
+ if(!mMarketplaceListingsItem.isDead())
+ {
+ mMarketplaceListingsItem.get()->setVisible(true);
+ }
LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
gToolBarView->enableCommand(command->id(), true);
@@ -423,7 +454,7 @@ void set_merchant_SLM_menu()
}
}
-void check_merchant_status(bool force)
+void LLSLMMenuUpdater::checkMerchantStatus(bool force)
{
if (force)
{
@@ -431,7 +462,10 @@ void check_merchant_status(bool force)
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED);
}
// Hide SLM related menu item
- gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(false);
+ if(!mMarketplaceListingsItem.isDead())
+ {
+ mMarketplaceListingsItem.get()->setVisible(false);
+ }
// Also disable the toolbar button for Marketplace Listings
LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
@@ -441,6 +475,16 @@ void check_merchant_status(bool force)
LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu));
}
+void set_merchant_SLM_menu()
+{
+ if(gSLMMenuUpdater) gSLMMenuUpdater->setMerchantMenu();
+}
+
+void check_merchant_status(bool force)
+{
+ if(gSLMMenuUpdater) gSLMMenuUpdater->checkMerchantStatus(force);
+}
+
void init_menus()
{
// Initialize actions
@@ -496,9 +540,7 @@ void init_menus()
///
/// set up the colors
///
- LLColor4 color;
-
- LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
+ LLUIColor context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
gMenuAvatarSelf->setBackgroundColor( context_menu_color );
gMenuAvatarOther->setBackgroundColor( context_menu_color );
@@ -508,7 +550,7 @@ void init_menus()
gMenuLand->setBackgroundColor( context_menu_color );
- color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
+ LLUIColor color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
gPopupMenuView->setBackgroundColor( color );
// If we are not in production, use a different color to make it apparent.
@@ -556,6 +598,8 @@ void init_menus()
// Let land based option enable when parcel changes
gMenuParcelObserver = new LLMenuParcelObserver();
+ gSLMMenuUpdater = new LLSLMMenuUpdater();
+
gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
gLoginMenuBarView->arrangeAndClear();
LLRect menuBarRect = gLoginMenuBarView->getRect();
@@ -1345,6 +1389,65 @@ class LLAdvancedResetInterestLists : public view_listener_t
};
+/////////////
+// TERRAIN //
+/////////////
+
+class LLAdvancedRebuildTerrain : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ gPipeline.rebuildTerrain();
+ return true;
+ }
+};
+
+class LLAdvancedTerrainCreateLocalPaintMap : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ {
+ LL_WARNS() << "Agent not in a region" << LL_ENDL;
+ return false;
+ }
+
+ U16 dim = (U16)gSavedSettings.getU32("TerrainPaintResolution");
+ // Ensure a reasonable image size of power two
+ const U32 max_resolution = gSavedSettings.getU32("RenderMaxTextureResolution");
+ dim = llclamp(dim, 16, max_resolution);
+ dim = 1 << U32(std::ceil(std::log2(dim)));
+ LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
+ LLPointer<LLViewerTexture> tex = LLViewerTextureManager::getLocalTexture(image_raw.get(), true);
+ const bool success = LLTerrainPaintMap::bakeHeightNoiseIntoPBRPaintMapRGB(*region, *tex);
+ // This calls gLocalTerrainMaterials.setPaintType
+ gSavedSettings.setBOOL("LocalTerrainPaintEnabled", true);
+ // If baking the paintmap failed, set the paintmap to nullptr. This
+ // causes LLDrawPoolTerrain to use a blank paintmap instead.
+ if (!success) { tex = nullptr; }
+ gLocalTerrainMaterials.setPaintMap(tex);
+
+ return true;
+ }
+};
+
+class LLAdvancedTerrainDeleteLocalPaintMap : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ // This calls gLocalTerrainMaterials.setPaintType
+ gSavedSettings.setBOOL("LocalTerrainPaintEnabled", false);
+ gLocalTerrainMaterials.setPaintMap(nullptr);
+
+ return true;
+ }
+};
+
+
+/////////////
+
+
class LLAdvancedBuyCurrencyTest : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -1850,10 +1953,9 @@ class LLAdvancedForceParamsToDefault : public view_listener_t
static void set_all_animation_time_factors(F32 time_factor)
{
LLMotionController::setCurrentTimeFactor(time_factor);
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
+ for (LLCharacter* character : LLCharacter::sInstances)
{
- (*iter)->setAnimTimeFactor(time_factor);
+ character->setAnimTimeFactor(time_factor);
}
}
@@ -2201,20 +2303,6 @@ class LLAdvancedPurgeShaderCache : public view_listener_t
}
};
-/////////////////////
-// REBUILD TERRAIN //
-/////////////////////
-
-
-class LLAdvancedRebuildTerrain : public view_listener_t
-{
- bool handleEvent(const LLSD& userdata)
- {
- gPipeline.rebuildTerrain();
- return true;
- }
-};
-
////////////////////
// EVENT Recorder //
///////////////////
@@ -2753,6 +2841,9 @@ class LLAdminOnSaveState: public view_listener_t
//-----------------------------------------------------------------------------
void cleanup_menus()
{
+ delete gSLMMenuUpdater;
+ gSLMMenuUpdater = nullptr;
+
delete gMenuParcelObserver;
gMenuParcelObserver = NULL;
@@ -2769,7 +2860,7 @@ void cleanup_menus()
gMenuAttachmentSelf = NULL;
delete gMenuAttachmentOther;
- gMenuAttachmentSelf = NULL;
+ gMenuAttachmentOther = NULL;
delete gMenuLand;
gMenuLand = NULL;
@@ -3324,7 +3415,9 @@ bool enable_os_exception()
bool enable_gltf()
{
static LLCachedControl<bool> enablegltf(gSavedSettings, "GLTFEnabled", false);
- return enablegltf;
+ static LLCachedControl<bool> can_use(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+
+ return enablegltf && can_use;
}
bool enable_gltf_save_as()
@@ -3354,6 +3447,12 @@ bool enable_gltf_upload()
return enable_gltf_save_as();
}
+bool enable_terrain_local_paintmap()
+{
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseTerrainBakeShaders", true);
+ return can_use_shaders;
+}
+
class LLSelfRemoveAllAttachments : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -8137,7 +8236,16 @@ class LLAdvancedClickGLTFOpen: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LL::GLTFSceneManager::instance().load();
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (can_use_shaders)
+ {
+ LL::GLTFSceneManager::instance().load();
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoSupportGLTFShader");
+ }
+
return true;
}
};
@@ -8160,6 +8268,15 @@ class LLAdvancedClickGLTFUpload: public view_listener_t
}
};
+class LLAdvancedClickGLTFEdit : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterReg::showInstance("gltf_asset_editor");
+ return true;
+ }
+};
+
class LLAdvancedClickResizeWindow : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -9815,9 +9932,9 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedClickGLTFOpen(), "Advanced.ClickGLTFOpen");
view_listener_t::addMenu(new LLAdvancedClickGLTFSaveAs(), "Advanced.ClickGLTFSaveAs");
view_listener_t::addMenu(new LLAdvancedClickGLTFUpload(), "Advanced.ClickGLTFUpload");
+ view_listener_t::addMenu(new LLAdvancedClickGLTFEdit(), "Advanced.ClickGLTFEdit");
view_listener_t::addMenu(new LLAdvancedClickResizeWindow(), "Advanced.ClickResizeWindow");
view_listener_t::addMenu(new LLAdvancedPurgeShaderCache(), "Advanced.ClearShaderCache");
- view_listener_t::addMenu(new LLAdvancedRebuildTerrain(), "Advanced.RebuildTerrain");
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode");
@@ -9834,6 +9951,11 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedCheckInterestList360Mode(), "Advanced.CheckInterestList360Mode");
view_listener_t::addMenu(new LLAdvancedResetInterestLists(), "Advanced.ResetInterestLists");
+ // Develop > Terrain
+ view_listener_t::addMenu(new LLAdvancedRebuildTerrain(), "Advanced.RebuildTerrain");
+ view_listener_t::addMenu(new LLAdvancedTerrainCreateLocalPaintMap(), "Advanced.TerrainCreateLocalPaintMap");
+ view_listener_t::addMenu(new LLAdvancedTerrainDeleteLocalPaintMap(), "Advanced.TerrainDeleteLocalPaintMap");
+
// Advanced > UI
commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser
commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2)); // this one opens the Web Content floater
@@ -10041,7 +10163,6 @@ void initialize_menus()
commit.add("Object.Buy", boost::bind(&handle_buy));
commit.add("Object.Edit", boost::bind(&handle_object_edit));
- commit.add("Object.Edit", boost::bind(&handle_object_edit));
commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material));
commit.add("Object.Inspect", boost::bind(&handle_object_inspect));
commit.add("Object.Open", boost::bind(&handle_object_open));
@@ -10123,6 +10244,7 @@ void initialize_menus()
enable.add("EnableGLTF", boost::bind(&enable_gltf));
enable.add("EnableGLTFSaveAs", boost::bind(&enable_gltf_save_as));
enable.add("EnableGLTFUpload", boost::bind(&enable_gltf_upload));
+ enable.add("EnableTerrainLocalPaintMap", std::bind(&enable_terrain_local_paintmap));
view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel");