SL-9620: Double check that commit actually passes back a day cycle from the editor.

Also hide the altitude setting interface for the moment.
meow-7.2.2
Rider Linden 2018-09-11 14:04:43 -07:00
parent fe28c3e886
commit a0b9c26218
3 changed files with 36 additions and 20 deletions

View File

@ -484,24 +484,31 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_
void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
{
std::string ctrl_action = ctrl->getName();
LLSettingsDay::ptr_t dayclone = mEditDay->buildClone(); // create a compressed copy
if (!dayclone)
{
LL_WARNS("ENVDAYEDIT") << "Unable to clone daycylce from editor." << LL_ENDL;
return;
}
if (ctrl_action == ACTION_SAVE)
{
doApplyUpdateInventory();
doApplyUpdateInventory(dayclone);
}
else if (ctrl_action == ACTION_SAVEAS)
{
doApplyCreateNewInventory();
doApplyCreateNewInventory(dayclone);
}
else if ((ctrl_action == ACTION_APPLY_LOCAL) ||
(ctrl_action == ACTION_APPLY_PARCEL) ||
(ctrl_action == ACTION_APPLY_REGION))
{
doApplyEnvironment(ctrl_action);
doApplyEnvironment(ctrl_action, dayclone);
}
else if (ctrl_action == ACTION_COMMIT)
{
doApplyCommit();
doApplyCommit(dayclone);
}
else
{
@ -1186,31 +1193,30 @@ void LLFloaterEditExtDayCycle::reblendSettings()
mWaterBlender->setPosition(position);
}
void LLFloaterEditExtDayCycle::doApplyCreateNewInventory()
void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day)
{
// This method knows what sort of settings object to create.
LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
// buildClone creates compressed copy
LLSettingsVOBase::createInventoryItem(mEditDay->buildClone(), parent_id,
LLSettingsVOBase::createInventoryItem(day, parent_id,
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
}
void LLFloaterEditExtDayCycle::doApplyUpdateInventory()
void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day)
{
if (mInventoryId.isNull())
LLSettingsVOBase::createInventoryItem(mEditDay->buildClone(), gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS),
LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS),
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
else
LLSettingsVOBase::updateInventoryItem(mEditDay->buildClone(), mInventoryId,
LLSettingsVOBase::updateInventoryItem(day, mInventoryId,
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); });
}
void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where)
void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day)
{
if (where == ACTION_APPLY_LOCAL)
{
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditDay->buildClone());
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, day);
}
else if (where == ACTION_APPLY_PARCEL)
{
@ -1229,11 +1235,11 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where)
return;
}
LLEnvironment::instance().updateParcel(parcel->getLocalID(), mEditDay->buildClone(), -1, -1);
LLEnvironment::instance().updateParcel(parcel->getLocalID(), day, -1, -1);
}
else if (where == ACTION_APPLY_REGION)
{
LLEnvironment::instance().updateRegion(mEditDay->buildClone(), -1, -1);
LLEnvironment::instance().updateRegion(day, -1, -1);
}
else
{
@ -1243,11 +1249,11 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where)
}
void LLFloaterEditExtDayCycle::doApplyCommit()
void LLFloaterEditExtDayCycle::doApplyCommit(LLSettingsDay::ptr_t day)
{
if (!mCommitSignal.empty())
{
mCommitSignal(mEditDay->buildClone());
mCommitSignal(day);
closeFloater();
}

View File

@ -136,10 +136,10 @@ private:
void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status);
void doImportFromDisk();
void doApplyCreateNewInventory();
void doApplyUpdateInventory();
void doApplyEnvironment(const std::string &where);
void doApplyCommit();
void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day);
void doApplyUpdateInventory(const LLSettingsDay::ptr_t &day);
void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day);
void doApplyCommit(LLSettingsDay::ptr_t day);
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results);

View File

@ -205,6 +205,10 @@ void LLPanelEnvironmentInfo::refresh()
udpateApparentTimeOfDay();
#if 1
// hiding the controls until Rider can get the simulator code to adjust altitudes done.
getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE);
#else
LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes();
if (altitudes.size() > 0)
{
@ -216,6 +220,7 @@ void LLPanelEnvironmentInfo::refresh()
mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]);
}
}
#endif
}
@ -610,6 +615,11 @@ void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id)
void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday)
{
if (!newday)
{
LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL;
return;
}
size_t newhash(newday->getHash());
size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0);