MAINT-8821: Tighten up floater. Allow apply from gear menu.
parent
e7ed4b4584
commit
294793b9a9
|
|
@ -366,9 +366,9 @@ bool LLEnvironment::canAgentUpdateParcelEnvironment(bool useselected) const
|
|||
{
|
||||
if (!LLEnvironment::instance().isExtendedEnvironmentEnabled())
|
||||
return false;
|
||||
// *TODO*
|
||||
//LLParcel* parcel = (useselected) ? LLViewerParcelMgr::instance().getParcelSelection() : LLViewerParcelMgr::instance().getAgentParcel();
|
||||
LLParcel* parcel = LLViewerParcelMgr::instance().getAgentParcel();
|
||||
|
||||
LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel());
|
||||
|
||||
if (parcel)
|
||||
{
|
||||
return parcel->allowTerraformBy(gAgent.getID());
|
||||
|
|
|
|||
|
|
@ -149,14 +149,14 @@ public:
|
|||
bool canEdit() const;
|
||||
bool isExtendedEnvironmentEnabled() const;
|
||||
bool isInventoryEnabled() const;
|
||||
bool canAgentUpdateParcelEnvironment(bool useselected = false) const;
|
||||
bool canAgentUpdateParcelEnvironment(bool useselected = true) const;
|
||||
bool canAgentUpdateRegionEnvironment() const;
|
||||
|
||||
LLSettingsDay::ptr_t getCurrentDay() const { return mCurrentEnvironment->getDayCycle(); }
|
||||
LLSettingsSky::ptr_t getCurrentSky() const { return mCurrentEnvironment->getSky(); }
|
||||
LLSettingsWater::ptr_t getCurrentWater() const { return mCurrentEnvironment->getWater(); }
|
||||
|
||||
static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky);
|
||||
static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky);
|
||||
|
||||
void update(const LLViewerCamera * cam);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@
|
|||
#include "llviewercontrol.h"
|
||||
#include "llfloaterperms.h"
|
||||
#include "llenvironment.h"
|
||||
#include "llparcel.h"
|
||||
#include "llviewerparcelmgr.h"
|
||||
|
||||
//=========================================================================
|
||||
namespace
|
||||
|
|
@ -61,6 +63,23 @@ namespace
|
|||
const std::string BUTTON_GEAR("btn_newsettings");
|
||||
const std::string BUTTON_DELETE("btn_del");
|
||||
|
||||
|
||||
const std::string ACTION_DOCREATE("MyEnvironments.DoCreate");
|
||||
const std::string ACTION_DOEDIT("MyEnvironments.DoEdit");
|
||||
const std::string ACTION_DOAPPLY("MyEnvironments.DoApply");
|
||||
const std::string ACTION_COPYPASTE("MyEnvironments.CopyPaste");
|
||||
const std::string ENABLE_ACTION("MyEnvironments.EnableAction");
|
||||
const std::string ENABLE_CANAPPLY("MyEnvironments.CanApply");
|
||||
const std::string ENABLE_ENVIRONMENT("MyEnvironments.EnvironmentEnabled");
|
||||
|
||||
const std::string PARAMETER_REGION("region");
|
||||
const std::string PARAMETER_PARCEL("parcel");
|
||||
const std::string PARAMETER_LOCAL("local");
|
||||
|
||||
const std::string PARAMETER_EDIT("edit");
|
||||
const std::string PARAMETER_COPY("copy");
|
||||
const std::string PARAMETER_PASTE("paste");
|
||||
const std::string PARAMETER_COPYUUID("copy_uuid");
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
|
@ -137,21 +156,15 @@ LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) :
|
|||
mTypeFilter((0x01 << static_cast<U64>(LLSettingsType::ST_DAYCYCLE)) | (0x01 << static_cast<U64>(LLSettingsType::ST_SKY)) | (0x01 << static_cast<U64>(LLSettingsType::ST_WATER))),
|
||||
mSelectedAsset()
|
||||
{
|
||||
mCommitCallbackRegistrar.add("MyEnvironments.DoCreate", [this](LLUICtrl *, const LLSD &userdata) { onDoCreate(userdata); });
|
||||
mCommitCallbackRegistrar.add(ACTION_DOCREATE, [this](LLUICtrl *, const LLSD &userdata) { onDoCreate(userdata); });
|
||||
mCommitCallbackRegistrar.add(ACTION_DOEDIT, [this](LLUICtrl *, const LLSD &userdata) {});
|
||||
mCommitCallbackRegistrar.add(ACTION_DOAPPLY, [this](LLUICtrl *, const LLSD &userdata) { onDoApply(userdata.asString()); });
|
||||
mCommitCallbackRegistrar.add(ACTION_COPYPASTE, [this](LLUICtrl *, const LLSD &userdata) {});
|
||||
|
||||
mEnableCallbackRegistrar.add("MyEnvironments.EnvironmentEnabled", [](LLUICtrl *, const LLSD &) { return LLEnvironment::instance().isInventoryEnabled(); });
|
||||
mEnableCallbackRegistrar.add(ENABLE_ACTION, [this](LLUICtrl *, const LLSD &userdata) { return canAction(userdata.asString()); });
|
||||
mEnableCallbackRegistrar.add(ENABLE_CANAPPLY, [this](LLUICtrl *, const LLSD &userdata) { return canApply(userdata.asString()); });
|
||||
mEnableCallbackRegistrar.add(ENABLE_ENVIRONMENT, [](LLUICtrl *, const LLSD &) { return LLEnvironment::instance().isInventoryEnabled(); });
|
||||
|
||||
#if 0
|
||||
mObserver = new LLFloaterGestureObserver(this);
|
||||
LLGestureMgr::instance().addObserver(mObserver);
|
||||
|
||||
mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
|
||||
mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
|
||||
mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
|
||||
mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
|
||||
|
||||
mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
|
||||
#endif
|
||||
}
|
||||
|
||||
LLFloaterMyEnvironment::~LLFloaterMyEnvironment()
|
||||
|
|
@ -279,8 +292,6 @@ void LLFloaterMyEnvironment::onDeleteSelected()
|
|||
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
|
||||
new_item->setParent(trash_id);
|
||||
// no need to restamp it though it's a move into trash because
|
||||
// it's a brand new item already.
|
||||
new_item->updateParentOnServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
}
|
||||
|
|
@ -294,6 +305,91 @@ void LLFloaterMyEnvironment::onDoCreate(const LLSD &data)
|
|||
menu_create_inventory_item(mInventoryList, NULL, data);
|
||||
}
|
||||
|
||||
void LLFloaterMyEnvironment::onDoApply(const std::string &context)
|
||||
{
|
||||
uuid_vec_t selected;
|
||||
getSelectedIds(selected);
|
||||
|
||||
if (selected.size() != 1) // Exactly one item selected.
|
||||
return;
|
||||
|
||||
LLUUID item_id(selected.front());
|
||||
|
||||
LLInventoryItem* itemp = gInventory.getItem(item_id);
|
||||
|
||||
if (itemp && itemp->getInventoryType() == LLInventoryType::IT_SETTINGS)
|
||||
{
|
||||
LLUUID asset_id = itemp->getAssetUUID();
|
||||
|
||||
if (context == PARAMETER_REGION)
|
||||
{
|
||||
LLEnvironment::instance().updateRegion(asset_id, -1, -1);
|
||||
}
|
||||
else if (context == PARAMETER_PARCEL)
|
||||
{
|
||||
LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel());
|
||||
if (!parcel)
|
||||
{
|
||||
LL_WARNS("ENVIRONMENT") << "Unable to determine parcel." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LLEnvironment::instance().updateParcel(parcel->getLocalID(), asset_id, -1, -1);
|
||||
}
|
||||
else if (context == PARAMETER_LOCAL)
|
||||
{
|
||||
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, asset_id);
|
||||
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LLFloaterMyEnvironment::canAction(const std::string &context)
|
||||
{
|
||||
// uuid_vec_t selected;
|
||||
// getSelectedIds(selected);
|
||||
//
|
||||
// if (selected.empty())
|
||||
// return false;
|
||||
//
|
||||
// if (context == PARAMETER_EDIT)
|
||||
// {
|
||||
// }
|
||||
// else if (context == PARAMETER_COPY)
|
||||
// {
|
||||
// }
|
||||
// else if (context == PARAMETER_PASTE)
|
||||
// {
|
||||
// }
|
||||
// else if (context == PARAMETER_COPYUUID)
|
||||
// {
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LLFloaterMyEnvironment::canApply(const std::string &context)
|
||||
{
|
||||
uuid_vec_t selected;
|
||||
getSelectedIds(selected);
|
||||
|
||||
if (selected.size() != 1) // Exactly one item selected.
|
||||
return false;
|
||||
|
||||
if (context == PARAMETER_REGION)
|
||||
{
|
||||
return LLEnvironment::instance().canAgentUpdateRegionEnvironment();
|
||||
}
|
||||
else if (context == PARAMETER_PARCEL)
|
||||
{
|
||||
return LLEnvironment::instance().canAgentUpdateParcelEnvironment();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (context == PARAMETER_LOCAL);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void LLFloaterMyEnvironment::refreshButtonStates()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ private:
|
|||
void onSelectionChange();
|
||||
void onDeleteSelected();
|
||||
void onDoCreate(const LLSD &data);
|
||||
void onDoApply(const std::string &context);
|
||||
bool canAction(const std::string &context);
|
||||
bool canApply(const std::string &context);
|
||||
|
||||
void getSelectedIds(uuid_vec_t& ids) const;
|
||||
void refreshButtonStates();
|
||||
|
|
|
|||
|
|
@ -6926,7 +6926,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action
|
|||
return;
|
||||
LLUUID asset_id = item->getAssetUUID();
|
||||
|
||||
LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel();
|
||||
LLParcel *parcel = LLViewerParcelMgr::instance().getAgentOrSelectedParcel();
|
||||
if (!parcel)
|
||||
{
|
||||
LL_WARNS("INVENTORY") << "could not identify parcel." << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
LLPanelSettingsSkyAtmosTab();
|
||||
|
||||
virtual BOOL postBuild() override;
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
virtual void setEnabled(BOOL enabled) override;
|
||||
|
||||
protected:
|
||||
virtual void refresh() override;
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
LLPanelSettingsSkyCloudTab();
|
||||
|
||||
virtual BOOL postBuild() override;
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
void setEnabled(BOOL enabled) override;
|
||||
|
||||
protected:
|
||||
virtual void refresh() override;
|
||||
|
|
@ -110,7 +110,7 @@ public:
|
|||
LLPanelSettingsSkySunMoonTab();
|
||||
|
||||
virtual BOOL postBuild() override;
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
virtual void setEnabled(BOOL enabled) override;
|
||||
|
||||
protected:
|
||||
virtual void refresh() override;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public:
|
|||
LLPanelSettingsWaterMainTab();
|
||||
|
||||
virtual BOOL postBuild() override;
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
virtual void setEnabled(BOOL enabled) override;
|
||||
|
||||
protected:
|
||||
virtual void refresh() override;
|
||||
|
|
|
|||
|
|
@ -647,6 +647,27 @@ LLParcel *LLViewerParcelMgr::getAgentParcel() const
|
|||
return mAgentParcel;
|
||||
}
|
||||
|
||||
|
||||
LLParcel * LLViewerParcelMgr::getAgentOrSelectedParcel() const
|
||||
{
|
||||
LLParcel *parcel(nullptr);
|
||||
|
||||
LLParcelSelectionHandle sel_handle(getFloatingParcelSelection());
|
||||
if (sel_handle)
|
||||
{
|
||||
LLParcelSelection *selection(sel_handle.get());
|
||||
if (selection)
|
||||
{
|
||||
parcel = selection->getParcel();
|
||||
}
|
||||
}
|
||||
|
||||
if (!parcel)
|
||||
parcel = LLViewerParcelMgr::instance().getAgentParcel();
|
||||
|
||||
return parcel;
|
||||
}
|
||||
|
||||
// Return whether the agent can build on the land they are on
|
||||
bool LLViewerParcelMgr::allowAgentBuild() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ public:
|
|||
|
||||
//LLParcel *getParcelSelection() const;
|
||||
LLParcel *getAgentParcel() const;
|
||||
LLParcel *getAgentOrSelectedParcel() const;
|
||||
|
||||
BOOL inAgentParcel(const LLVector3d &pos_global) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
layout="topleft"
|
||||
name="edit_settings">
|
||||
<on_click
|
||||
function="MyEnvironments.ShowPreview" />
|
||||
function="MyEnvironments.DoEdit" />
|
||||
<on_enable
|
||||
function="MyEnvironments.EnableAction"
|
||||
parameter="edit_settings" />
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
function="MyEnvironments.DoApply"
|
||||
parameter="parcel" />
|
||||
<menu_item_call.on_enable
|
||||
function="MyEnvironments.CanAppyl"
|
||||
function="MyEnvironments.CanApply"
|
||||
parameter="parcel"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
|
|
@ -41,10 +41,10 @@
|
|||
layout="topleft"
|
||||
label="Apply To Region">
|
||||
<menu_item_call.on_click
|
||||
function="MyEnvironments.DoToSelected"
|
||||
function="MyEnvironments.DoApply"
|
||||
parameter="region" />
|
||||
<menu_item_call.on_enable
|
||||
function="MyEnvironments.CanAppyl"
|
||||
function="MyEnvironments.CanApply"
|
||||
parameter="region"/>
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
|
|
|
|||
Loading…
Reference in New Issue