summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-01-28 18:32:47 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-01-28 18:32:47 +0200
commitfd13bdef98c169c518685a223482c922aed5db06 (patch)
tree5e9dcbfad75007b9da126b495b955d35915decf9 /indra
parentac865de287b2e740acd9f6a8724301146df73ccf (diff)
SL-1945 Don't open floater if there is only one option to select from
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp64
-rw-r--r--indra/newview/llfloatereditextdaycycle.h2
-rw-r--r--indra/newview/lltrackpicker.cpp2
-rw-r--r--indra/newview/lltrackpicker.h2
4 files changed, 48 insertions, 22 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 33f3fcfecc..51bbc9fb90 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -804,7 +804,48 @@ void LLFloaterEditExtDayCycle::onRemoveFrame()
void LLFloaterEditExtDayCycle::onCloneTrack()
{
- doOpenTrackFloater();
+ const LLEnvironment::altitude_list_t &altitudes = LLEnvironment::instance().getRegionAltitudes();
+ bool use_altitudes = altitudes.size() > 0 && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
+
+ LLSD args = LLSD::emptyArray();
+
+ S32 populated_counter = 0;
+ for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++)
+ {
+ LLSD track;
+ track["id"] = LLSD::Integer(i);
+ bool populated = (!mEditDay->isTrackEmpty(i)) && (i != mCurrentTrack);
+ track["enabled"] = populated;
+ if (populated)
+ {
+ populated_counter++;
+ }
+ if (use_altitudes)
+ {
+ track["altitude"] = altitudes[i - 1];
+ }
+ args.append(track);
+ }
+
+ if (populated_counter > 1)
+ {
+ doOpenTrackFloater(args);
+ }
+ else if (populated_counter > 0)
+ {
+ for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++)
+ {
+ if ((!mEditDay->isTrackEmpty(i)) && (i != mCurrentTrack))
+ {
+ onPickerCommitTrackId(i);
+ }
+ }
+ }
+ else
+ {
+ // Should not happen
+ LL_WARNS("ENVDAYEDIT") << "Tried to copy tracks, but there are no available sources" << LL_ENDL;
+ }
}
@@ -1051,6 +1092,8 @@ void LLFloaterEditExtDayCycle::cloneTrack(const LLSettingsDay::ptr_t &source_day
mEditDay->setSettingsAtKeyframe(psky->buildDerivedClone(), track_frame.first, dest_index);
}
+ setDirtyFlag();
+
updateSlider();
updateTabs();
updateButtons();
@@ -1817,7 +1860,7 @@ void LLFloaterEditExtDayCycle::clearDirtyFlag()
}
-void LLFloaterEditExtDayCycle::doOpenTrackFloater()
+void LLFloaterEditExtDayCycle::doOpenTrackFloater(const LLSD &args)
{
LLFloaterTrackPicker *picker = static_cast<LLFloaterTrackPicker *>(mTrackFloater.get());
@@ -1831,23 +1874,6 @@ void LLFloaterEditExtDayCycle::doOpenTrackFloater()
picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitTrackId(data.asInteger()); });
}
- const LLEnvironment::altitude_list_t &altitudes = LLEnvironment::instance().getRegionAltitudes();
- bool use_altitudes = altitudes.size() > 0 && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
-
- LLSD args = LLSD::emptyArray();
-
- for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++)
- {
- LLSD track;
- track["id"] = LLSD::Integer(i);
- track["enabled"] = !mEditDay->isTrackEmpty(i);
- if (use_altitudes)
- {
- track["altitude"] = altitudes[i - 1];
- }
- args.append(track);
- }
-
picker->showPicker(args);
}
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index d780d5c993..f50c9f7e5f 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -160,7 +160,7 @@ private:
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
- void doOpenTrackFloater();
+ void doOpenTrackFloater(const LLSD &args);
void doCloseTrackFloater(bool quitting = false);
void onPickerCommitTrackId(U32 track_id);
diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp
index 07fdb5f476..bc918f4bd7 100644
--- a/indra/newview/lltrackpicker.cpp
+++ b/indra/newview/lltrackpicker.cpp
@@ -76,7 +76,7 @@ void LLFloaterTrackPicker::onClose(bool app_quitting)
}
}
-void LLFloaterTrackPicker::showPicker(LLSD &args)
+void LLFloaterTrackPicker::showPicker(const LLSD &args)
{
LLSD::array_const_iterator iter;
LLSD::array_const_iterator end = args.endArray();
diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h
index 601af27b61..dab3b72915 100644
--- a/indra/newview/lltrackpicker.h
+++ b/indra/newview/lltrackpicker.h
@@ -41,7 +41,7 @@ public:
virtual BOOL postBuild() override;
virtual void onClose(bool app_quitting) override;
- void showPicker(LLSD &args);
+ void showPicker(const LLSD &args);
virtual void draw() override;