summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatereditextdaycycle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatereditextdaycycle.cpp')
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp81
1 files changed, 65 insertions, 16 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index a30e16ab2b..f9b25c1977 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -430,7 +430,6 @@ void LLFloaterEditExtDayCycle::refresh()
mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply);
mImportButton->setEnabled(mCanMod);
- mLoadFrame->setEnabled(mCanMod);
LLFloater::refresh();
}
@@ -903,6 +902,7 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )
mSkyTabLayoutContainer->setVisible(!show_water);
mWaterTabLayoutContainer->setVisible(show_water);
updateSlider();
+ updateLabels();
}
void LLFloaterEditExtDayCycle::selectFrame(F32 frame, F32 slop_factor)
@@ -1010,6 +1010,15 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky)
}
+void LLFloaterEditExtDayCycle::updateLabels()
+{
+ std::string label_arg = (mCurrentTrack == LLSettingsDay::TRACK_WATER) ? "water_label" : "sky_label";
+
+ mAddFrameButton->setLabelArg("[FRAME]", getString(label_arg));
+ mDeleteFrameButton->setLabelArg("[FRAME]", getString(label_arg));
+ mLoadFrame->setLabelArg("[FRAME]", getString(label_arg));
+}
+
void LLFloaterEditExtDayCycle::updateButtons()
{
// This logic appears to work in reverse, the add frame button
@@ -1020,8 +1029,9 @@ void LLFloaterEditExtDayCycle::updateButtons()
//bool can_add = static_cast<bool>(settings);
//mAddFrameButton->setEnabled(can_add);
//mDeleteFrameButton->setEnabled(!can_add);
- mAddFrameButton->setEnabled(mCanMod && mFramesSlider->canAddSliders());
+ mAddFrameButton->setEnabled(isAddingFrameAllowed() && mCanMod);
mDeleteFrameButton->setEnabled(isRemovingFrameAllowed() && mCanMod);
+ mLoadFrame->setEnabled(!mIsPlaying && mCanMod);
}
void LLFloaterEditExtDayCycle::updateSlider()
@@ -1327,11 +1337,20 @@ void LLFloaterEditExtDayCycle::reblendSettings()
void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name)
{
- // This method knows what sort of settings object to create.
- LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
-
- LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name,
+ if (mInventoryItem)
+ {
+ LLUUID parent_id = mInventoryItem->getParentUUID();
+ U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner();
+ LLSettingsVOBase::createInventoryItem(day, next_owner_perm, parent_id, settings_name,
+ [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
+ }
+ else
+ {
+ LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
+ // This method knows what sort of settings object to create.
+ LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name,
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
+ }
}
void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day)
@@ -1401,6 +1420,8 @@ void LLFloaterEditExtDayCycle::doApplyCommit(LLSettingsDay::ptr_t day)
bool LLFloaterEditExtDayCycle::isRemovingFrameAllowed()
{
+ if (mFramesSlider->getCurSlider().empty()) return false;
+
if (mCurrentTrack <= LLSettingsDay::TRACK_GROUND_LEVEL)
{
return (mSliderKeyMap.size() > 1);
@@ -1411,6 +1432,18 @@ bool LLFloaterEditExtDayCycle::isRemovingFrameAllowed()
}
}
+bool LLFloaterEditExtDayCycle::isAddingFrameAllowed()
+{
+ if (!mFramesSlider->getCurSlider().empty()) return false;
+
+ LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue());
+ if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
+ {
+ return false;
+ }
+ return mFramesSlider->canAddSliders();
+}
+
void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results)
{
LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL;
@@ -1536,6 +1569,7 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data)
self->mWaterBlender->setPosition(new_frame);
self->synchronizeTabs();
self->updateTimeAndLabel();
+ self->updateButtons();
}
}
@@ -1614,20 +1648,35 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID item_id, LLUUID asse
{
std::function<void()> cb = [this, settings, frame, track]()
{
- if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
+ if (mFramesSlider->getCurSlider().empty())
{
- LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
- return;
+ if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
+ {
+ LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
+ return;
+ }
+ if (!mFramesSlider->canAddSliders())
+ {
+ LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame when slider is full." << LL_ENDL;
+ return;
+ }
+ mEditDay->setSettingsAtKeyframe(settings, frame, track);
+ addSliderFrame(frame, settings, false);
+ reblendSettings();
+ synchronizeTabs();
}
- if (!mFramesSlider->canAddSliders())
+ else
{
- LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame when slider is full." << LL_ENDL;
- return;
+ if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
+ {
+ mEditDay->setWaterAtKeyframe(std::static_pointer_cast<LLSettingsWater>(settings), frame);
+ }
+ else
+ {
+ mEditDay->setSkyAtKeyframe(std::static_pointer_cast<LLSettingsSky>(settings), frame, track);
+ }
+ updateTabs();
}
- mEditDay->setSettingsAtKeyframe(settings, frame, track);
- addSliderFrame(frame, settings, false);
- reblendSettings();
- synchronizeTabs();
};
if (!settings || status)