summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt123
-rw-r--r--indra/newview/app_settings/settings.xml97
-rw-r--r--indra/newview/app_settings/windlight/days/Colder%20Tones.xml28
-rw-r--r--indra/newview/app_settings/windlight/days/Dynamic%20Richness.xml32
-rw-r--r--indra/newview/app_settings/windlight/days/Pirate%27s%20Dream.xml44
-rw-r--r--indra/newview/app_settings/windlight/days/Psycho%20Strobe%21.xml72
-rw-r--r--indra/newview/app_settings/windlight/days/Tropicalia.xml32
-rw-r--r--indra/newview/app_settings/windlight/days/Weird-O.xml56
-rw-r--r--indra/newview/app_settings/windlight/skies/Midday.xml141
-rw-r--r--indra/newview/app_settings/windlight/skies/Midnight.xml141
-rw-r--r--indra/newview/app_settings/windlight/skies/Sunrise.xml141
-rw-r--r--indra/newview/app_settings/windlight/skies/Sunset.xml142
-rw-r--r--indra/newview/featuretable.txt2
-rw-r--r--indra/newview/featuretable_linux.txt2
-rw-r--r--indra/newview/featuretable_mac.txt2
-rw-r--r--indra/newview/featuretable_xp.txt2
-rw-r--r--indra/newview/llagent.cpp15
-rw-r--r--indra/newview/llappviewer.cpp10
-rw-r--r--indra/newview/llcloud.cpp538
-rw-r--r--indra/newview/llcloud.h199
-rw-r--r--indra/newview/lldaycyclemanager.cpp230
-rw-r--r--indra/newview/lldaycyclemanager.h84
-rw-r--r--indra/newview/lldrawable.cpp5
-rw-r--r--indra/newview/lldrawpool.cpp1
-rw-r--r--indra/newview/lldrawpoolalpha.cpp1
-rw-r--r--indra/newview/lldrawpoolclouds.cpp97
-rw-r--r--indra/newview/lldrawpoolclouds.h54
-rw-r--r--indra/newview/lldrawpoolwater.cpp4
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp10
-rw-r--r--indra/newview/llenvmanager.cpp1194
-rw-r--r--indra/newview/llenvmanager.h379
-rw-r--r--indra/newview/llfloaterdaycycle.cpp406
-rw-r--r--indra/newview/llfloaterdaycycle.h83
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.cpp285
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.h62
-rw-r--r--indra/newview/llfloatereditdaycycle.cpp825
-rw-r--r--indra/newview/llfloatereditdaycycle.h137
-rw-r--r--indra/newview/llfloatereditsky.cpp922
-rw-r--r--indra/newview/llfloatereditsky.h113
-rw-r--r--indra/newview/llfloatereditwater.cpp772
-rw-r--r--indra/newview/llfloatereditwater.h115
-rw-r--r--indra/newview/llfloaterenvironmentsettings.cpp282
-rw-r--r--indra/newview/llfloaterenvironmentsettings.h71
-rw-r--r--indra/newview/llfloaterenvsettings.cpp166
-rw-r--r--indra/newview/llfloaterenvsettings.h32
-rw-r--r--indra/newview/llfloaterregioninfo.cpp1033
-rw-r--r--indra/newview/llfloaterregioninfo.h118
-rw-r--r--indra/newview/llfloaterwater.cpp131
-rw-r--r--indra/newview/llfloaterwater.h7
-rw-r--r--indra/newview/llfloaterwindlight.cpp652
-rw-r--r--indra/newview/llfloaterwindlight.h75
-rw-r--r--indra/newview/llregioninfomodel.cpp106
-rw-r--r--indra/newview/llregioninfomodel.h82
-rw-r--r--indra/newview/llspatialpartition.cpp2
-rw-r--r--indra/newview/llspatialpartition.h7
-rw-r--r--indra/newview/llstartup.cpp8
-rw-r--r--indra/newview/lltexturectrl.cpp4
-rw-r--r--indra/newview/llviewerdisplay.cpp4
-rw-r--r--indra/newview/llviewerfloaterreg.cpp12
-rw-r--r--indra/newview/llviewermenu.cpp103
-rw-r--r--indra/newview/llviewerobject.cpp3
-rw-r--r--indra/newview/llviewerobject.h2
-rw-r--r--indra/newview/llviewerobjectlist.cpp3
-rw-r--r--indra/newview/llviewerregion.cpp25
-rw-r--r--indra/newview/llviewerregion.h8
-rw-r--r--indra/newview/llviewershadermgr.cpp14
-rw-r--r--indra/newview/llviewershadermgr.h16
-rw-r--r--indra/newview/llvlmanager.cpp2
-rw-r--r--indra/newview/llvoclouds.cpp297
-rw-r--r--indra/newview/llvoclouds.h79
-rw-r--r--indra/newview/llvosky.cpp42
-rw-r--r--indra/newview/llvowlsky.cpp4
-rw-r--r--indra/newview/llwaterparammanager.cpp328
-rw-r--r--indra/newview/llwaterparammanager.h76
-rw-r--r--indra/newview/llwaterparamset.cpp43
-rw-r--r--indra/newview/llwlanimator.cpp202
-rw-r--r--indra/newview/llwlanimator.h86
-rw-r--r--indra/newview/llwldaycycle.cpp241
-rw-r--r--indra/newview/llwldaycycle.h54
-rw-r--r--indra/newview/llwlhandlers.cpp203
-rw-r--r--indra/newview/llwlhandlers.h109
-rw-r--r--indra/newview/llwlparammanager.cpp556
-rw-r--r--indra/newview/llwlparammanager.h210
-rw-r--r--indra/newview/llwlparamset.cpp59
-rw-r--r--indra/newview/llwlparamset.h2
-rw-r--r--indra/newview/llworld.cpp94
-rw-r--r--indra/newview/skins/default/colors.xml10
-rw-r--r--indra/newview/skins/default/xui/en/floater_day_cycle_options.xml144
-rw-r--r--indra/newview/skins/default/xui/en/floater_delete_env_preset.xml59
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml485
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml953
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_water_preset.xml448
-rw-r--r--indra/newview/skins/default/xui/en/floater_env_settings.xml10
-rw-r--r--indra/newview/skins/default/xui/en/floater_environment_settings.xml162
-rw-r--r--indra/newview/skins/default/xui/en/floater_region_info.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_windlight_options.xml10
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml117
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml74
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml149
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_estate.xml311
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_terrain.xml349
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_texture.xml327
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml6
-rw-r--r--indra/newview/skins/default/xui/en/widgets/time.xml16
-rw-r--r--indra/newview/tests/lldir_stub.cpp45
-rw-r--r--indra/newview/tests/llfloaterdaycycle_stub.cpp20
-rw-r--r--indra/newview/tests/llfloaterenvsettings_stub.cpp20
-rw-r--r--indra/newview/tests/llfloaterwindlight_stub.cpp20
-rw-r--r--indra/newview/tests/llglslshader_stub.cpp22
-rw-r--r--indra/newview/tests/llpipeline_stub.cpp15
-rw-r--r--indra/newview/tests/llsky_stub.cpp20
-rw-r--r--indra/newview/tests/llviewershadermgr_stub.cpp33
-rw-r--r--indra/newview/tests/llwlanimator_stub.cpp12
-rw-r--r--indra/newview/tests/llwldaycycle_stub.cpp35
-rw-r--r--indra/newview/tests/llwlparammanager_test.cpp257
-rw-r--r--indra/newview/tests/llwlparamset_stub.cpp24
116 files changed, 13570 insertions, 3836 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 523ea8a394..e930b2ac71 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -120,7 +120,6 @@ set(viewer_SOURCE_FILES
llchiclet.cpp
llclassifiedinfo.cpp
llclassifiedstatsresponder.cpp
- llcloud.cpp
llcofwearables.cpp
llcolorswatch.cpp
llcommanddispatcherlistener.cpp
@@ -131,6 +130,7 @@ set(viewer_SOURCE_FILES
llcurrencyuimanager.cpp
llcylinder.cpp
lldateutil.cpp
+ lldaycyclemanager.cpp
lldebugmessagebox.cpp
lldebugview.cpp
lldelayedgestureerror.cpp
@@ -150,6 +150,7 @@ set(viewer_SOURCE_FILES
lldrawpoolwlsky.cpp
lldriverparam.cpp
lldynamictexture.cpp
+ llenvmanager.cpp
llemote.cpp
lleventnotifier.cpp
lleventpoll.cpp
@@ -180,8 +181,13 @@ set(viewer_SOURCE_FILES
llfloatercamera.cpp
llfloatercolorpicker.cpp
llfloaterdaycycle.cpp
+ llfloaterdeleteenvpreset.cpp
llfloaterdisplayname.cpp
+ llfloatereditdaycycle.cpp
+ llfloatereditsky.cpp
+ llfloatereditwater.cpp
llfloaterenvsettings.cpp
+ llfloaterenvironmentsettings.cpp
llfloaterevent.cpp
llfloaterfonttest.cpp
llfloatergesture.cpp
@@ -411,6 +417,7 @@ set(viewer_SOURCE_FILES
llproductinforequest.cpp
llprogressview.cpp
llrecentpeople.cpp
+ llregioninfomodel.cpp
llregionposition.cpp
llremoteparcelrequest.cpp
llsavedsettingsglue.cpp
@@ -519,7 +526,7 @@ set(viewer_SOURCE_FILES
llviewerfloaterreg.cpp
llviewerfoldertype.cpp
llviewergenericmessage.cpp
- llviewergesture.cpp
+ llviewergesture.cpp
llviewerhelp.cpp
llviewerhelputil.cpp
llviewerhome.cpp
@@ -566,7 +573,6 @@ set(viewer_SOURCE_FILES
llvoavatardefines.cpp
llvoavatarself.cpp
llvocache.cpp
- llvoclouds.cpp
llvograss.cpp
llvoground.cpp
llvoicecallhandler.cpp
@@ -595,6 +601,7 @@ set(viewer_SOURCE_FILES
llwind.cpp
llwlanimator.cpp
llwldaycycle.cpp
+ llwlhandlers.cpp
llwlparammanager.cpp
llwlparamset.cpp
llworld.cpp
@@ -673,7 +680,6 @@ set(viewer_HEADER_FILES
llchiclet.h
llclassifiedinfo.h
llclassifiedstatsresponder.h
- llcloud.h
llcofwearables.h
llcolorswatch.h
llcommanddispatcherlistener.h
@@ -684,6 +690,7 @@ set(viewer_HEADER_FILES
llcurrencyuimanager.h
llcylinder.h
lldateutil.h
+ lldaycyclemanager.h
lldebugmessagebox.h
lldebugview.h
lldelayedgestureerror.h
@@ -694,7 +701,6 @@ set(viewer_HEADER_FILES
lldrawpoolalpha.h
lldrawpoolavatar.h
lldrawpoolbump.h
- lldrawpoolclouds.h
lldrawpoolground.h
lldrawpoolsimple.h
lldrawpoolsky.h
@@ -705,6 +711,7 @@ set(viewer_HEADER_FILES
lldriverparam.h
lldynamictexture.h
llemote.h
+ llenvmanager.h
lleventnotifier.h
lleventpoll.h
llexpandabletextbox.h
@@ -734,8 +741,13 @@ set(viewer_HEADER_FILES
llfloatercamera.h
llfloatercolorpicker.h
llfloaterdaycycle.h
+ llfloaterdeleteenvpreset.h
llfloaterdisplayname.h
+ llfloatereditdaycycle.h
+ llfloatereditsky.h
+ llfloatereditwater.h
llfloaterenvsettings.h
+ llfloaterenvironmentsettings.h
llfloaterevent.h
llfloaterfonttest.h
llfloatergesture.h
@@ -959,6 +971,7 @@ set(viewer_HEADER_FILES
llproductinforequest.h
llprogressview.h
llrecentpeople.h
+ llregioninfomodel.h
llregionposition.h
llremoteparcelrequest.h
llresourcedata.h
@@ -998,7 +1011,7 @@ set(viewer_HEADER_FILES
llsurface.h
llsurfacepatch.h
llsyswellitem.h
- llsyswellwindow.h
+ llsyswellwindow.h
lltable.h
llteleporthistory.h
llteleporthistorystorage.h
@@ -1070,7 +1083,7 @@ set(viewer_HEADER_FILES
llviewerfloaterreg.h
llviewerfoldertype.h
llviewergenericmessage.h
- llviewergesture.h
+ llviewergesture.h
llviewerhelp.h
llviewerhome.h
llviewerinventory.h
@@ -1114,7 +1127,6 @@ set(viewer_HEADER_FILES
llvoavatardefines.h
llvoavatarself.h
llvocache.h
- llvoclouds.h
llvograss.h
llvoground.h
llvoicechannel.h
@@ -1143,6 +1155,7 @@ set(viewer_HEADER_FILES
llwind.h
llwlanimator.h
llwldaycycle.h
+ llwlhandlers.h
llwlparammanager.h
llwlparamset.h
llworld.h
@@ -1225,7 +1238,7 @@ if (WINDOWS)
# precompiled header configuration
# llviewerprecompiledheaders.cpp generates
# the .pch file.
- # All sources added to viewer_SOURCE_FILES
+ # All sources added to viewer_SOURCE_FILES
# at this point use it.
if(USE_PRECOMPILED_HEADERS)
set_source_files_properties(llviewerprecompiledheaders.cpp
@@ -1234,7 +1247,7 @@ if (WINDOWS)
)
set(viewer_SOURCE_FILES "${viewer_SOURCE_FILES}" llviewerprecompiledheaders.cpp)
endif(USE_PRECOMPILED_HEADERS)
-
+
# Add resource files to the project.
# viewerRes.rc is the only buildable file, but
# the rest are all dependencies of it.
@@ -1279,8 +1292,8 @@ if (WINDOWS)
set_source_files_properties(${viewer_RESOURCE_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
- set(viewer_RESOURCE_FILES
- res/viewerRes.rc
+ set(viewer_RESOURCE_FILES
+ res/viewerRes.rc
${viewer_RESOURCE_FILES}
)
@@ -1288,7 +1301,7 @@ if (WINDOWS)
if (NOT STANDALONE)
list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES})
- endif (NOT STANDALONE)
+ endif (NOT STANDALONE)
find_library(DINPUT_LIBRARY dinput8 ${DIRECTX_LIBRARY_DIR})
find_library(DXGUID_LIBRARY dxguid ${DIRECTX_LIBRARY_DIR})
@@ -1497,7 +1510,7 @@ if (WINDOWS)
${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
)
endif(USE_GOOGLE_PERFTOOLS)
-
+
set(COPY_INPUT_DEPENDENCIES
# The following commented dependencies are determined at variably at build time. Can't do this here.
@@ -1595,24 +1608,24 @@ if (WINDOWS)
--grid=${GRID}
--source=${CMAKE_CURRENT_SOURCE_DIR}
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
- DEPENDS
+ DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
stage_third_party_libs
${COPY_INPUT_DEPENDENCIES}
COMMENT "Performing viewer_manifest copy"
)
-
- add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat)
+
+ add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat)
add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest)
-
+
if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)
endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
-
- add_dependencies(${VIEWER_BINARY_NAME}
- SLPlugin
- windows-updater
+
+ add_dependencies(${VIEWER_BINARY_NAME}
+ SLPlugin
+ windows-updater
windows-crash-logger
)
@@ -1622,7 +1635,7 @@ if (WINDOWS)
TARGET ${VIEWER_BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe
ARGS
- --solution
+ --solution
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln
--workingdir
${VIEWER_BINARY_NAME}
@@ -1640,12 +1653,12 @@ if (WINDOWS)
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CFG_INTDIR}
- DEPENDS
- lleventhost
+ DEPENDS
+ lleventhost
${EVENT_HOST_SCRIPTS}
${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py
)
-
+
add_custom_command(
OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat
COMMAND ${PYTHON_EXECUTABLE}
@@ -1661,15 +1674,15 @@ if (WINDOWS)
--login_channel=${VIEWER_LOGIN_CHANNEL}
--source=${CMAKE_CURRENT_SOURCE_DIR}
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat
- DEPENDS
- ${VIEWER_BINARY_NAME}
+ DEPENDS
+ ${VIEWER_BINARY_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
${COPY_INPUT_DEPENDENCIES}
)
- add_custom_target(package ALL DEPENDS
+ add_custom_target(package ALL DEPENDS
${CMAKE_CFG_INTDIR}/touched.bat
- windows-setup-build-all
+ windows-setup-build-all
)
# temporarily disable packaging of event_host until hg subrepos get
# sorted out on the parabuild cluster...
@@ -1737,7 +1750,7 @@ else (USE_KDU)
${LLIMAGEJ2COJ_LIBRARIES}
)
endif (USE_KDU)
-
+
build_version(viewer)
set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
@@ -1796,13 +1809,13 @@ if (LINUX)
--dest=${CMAKE_CURRENT_BINARY_DIR}/packaged
--grid=${GRID}
--source=${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS
+ DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
${COPY_INPUT_DEPENDENCIES}
COMMENT "Performing viewer_manifest copy"
)
-
- add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched)
+
+ add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched)
if (PACKAGE)
add_custom_target(package ALL DEPENDS ${product}.tar.bz2)
@@ -1847,7 +1860,7 @@ if (DARWIN)
add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit mac-updater mac-crash-logger)
if (PACKAGE)
- add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME})
+ add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME})
add_custom_command(
TARGET package POST_BUILD
@@ -1942,7 +1955,7 @@ if (LL_TESTS)
)
##################################################
- # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
+ # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
##################################################
# if(USE_PRECOMPILED_HEADERS)
# set_source_files_properties(
@@ -1956,33 +1969,33 @@ if (LL_TESTS)
#set(TEST_DEBUG on)
set(test_sources llcapabilitylistener.cpp)
##################################################
- # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
+ # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
##################################################
# if(USE_PRECOMPILED_HEADERS)
# set(test_sources "${test_sources}" llviewerprecompiledheaders.cpp)
# endif(USE_PRECOMPILED_HEADERS)
- set(test_libs
- ${LLMESSAGE_LIBRARIES}
- ${WINDOWS_LIBRARIES}
+ set(test_libs
+ ${LLMESSAGE_LIBRARIES}
+ ${WINDOWS_LIBRARIES}
${LLVFS_LIBRARIES}
${LLMATH_LIBRARIES}
- ${LLCOMMON_LIBRARIES}
+ ${LLCOMMON_LIBRARIES}
${GOOGLEMOCK_LIBRARIES}
)
- LL_ADD_INTEGRATION_TEST(llcapabilitylistener
- "${test_sources}"
+ LL_ADD_INTEGRATION_TEST(llcapabilitylistener
+ "${test_sources}"
"${test_libs}"
${PYTHON_EXECUTABLE}
"${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py"
)
- set(test_libs
- ${LLMESSAGE_LIBRARIES}
- ${WINDOWS_LIBRARIES}
+ set(test_libs
+ ${LLMESSAGE_LIBRARIES}
+ ${WINDOWS_LIBRARIES}
${LLVFS_LIBRARIES}
${LLMATH_LIBRARIES}
- ${LLCOMMON_LIBRARIES}
+ ${LLCOMMON_LIBRARIES}
${GOOGLEMOCK_LIBRARIES}
${OPENSSL_LIBRARIES}
${CRYPTO_LIBRARIES}
@@ -2030,6 +2043,22 @@ if (LL_TESTS)
#ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer)
#ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer)
+include(LLAddBuildTest)
+SET(viewer_TEST_SOURCE_FILES
+ llagentaccess.cpp
+ llwlparammanager.cpp
+ # Not *actually* a unit test, it's an integration test.
+ # Because it won't work in the new unit test iface, i've commented out
+ # and notified Nat. Delete this when it's replaced!
+ # + poppy & brad 2009-06-05
+ # llcapabilitylistener.cpp
+ )
+set_source_files_properties(
+ ${viewer_TEST_SOURCE_FILES}
+ PROPERTIES
+ LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp
+ )
+
endif (LL_TESTS)
check_message_template(${VIEWER_BINARY_NAME})
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 594285b92b..efe605e5e6 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10289,17 +10289,6 @@
<real>0.1</real>
</array>
</map>
- <key>SkyUseClassicClouds</key>
- <map>
- <key>Comment</key>
- <string>Whether to use the old Second Life particle clouds or not</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>1</integer>
- </map>
<key>SnapEnabled</key>
<map>
<key>Comment</key>
@@ -10914,7 +10903,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <real>-2</real>
+ <real>-1</real>
</map>
<key>UIExtraTriangleWidth</key>
<map>
@@ -10925,7 +10914,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <real>2</real>
+ <real>4</real>
</map>
<key>UIFloaterCloseBoxSize</key>
<map>
@@ -11917,6 +11906,61 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>UseEnvironmentFromRegion</key>
+ <map>
+ <key>Comment</key>
+ <string>Choose whether to use the region's environment settings, or override them with the local settings.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
+ <key>UseDayCycle</key>
+ <map>
+ <key>Comment</key>
+ <string>Whether to use use a day cycle or a fixed sky.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
+ <key>WaterPresetName</key>
+ <map>
+ <key>Comment</key>
+ <string>Water preset to use. May be superseded by region settings.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Default</string>
+ </map>
+ <key>SkyPresetName</key>
+ <map>
+ <key>Comment</key>
+ <string>Sky preset to use. May be superseded by region settings or by a day cycle (see DayCycleName).</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Default</string>
+ </map>
+ <key>DayCycleName</key>
+ <map>
+ <key>Comment</key>
+ <string>Day cycle to use. May be superseded by region settings.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Default</string>
+ </map>
<key>UseExternalBrowser</key>
<map>
<key>Comment</key>
@@ -12510,33 +12554,6 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>WaterFogColor</key>
- <map>
- <key>Comment</key>
- <string>Water fog color</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>0.0863</real>
- <real>0.168</real>
- <real>0.212</real>
- <real>0</real>
- </array>
- </map>
- <key>WaterFogDensity</key>
- <map>
- <key>Comment</key>
- <string>Water fog density</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>16.0</real>
- </map>
<key>WaterGLFogDensityScale</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/windlight/days/Colder%20Tones.xml b/indra/newview/app_settings/windlight/days/Colder%20Tones.xml
new file mode 100644
index 0000000000..63d0b099e1
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Colder%20Tones.xml
@@ -0,0 +1,28 @@
+<llsd>
+ <array>
+ <array>
+ <real>0</real>
+ <string>Midnight</string>
+ </array>
+ <array>
+ <real>0.24999989569187164</real>
+ <string>Purple</string>
+ </array>
+ <array>
+ <real>0.49999979138374329</real>
+ <string>Blue Midday</string>
+ </array>
+ <array>
+ <real>0.74999970197677612</real>
+ <string>Blizzard</string>
+ </array>
+ <array>
+ <real>0.87499958276748657</real>
+ <string>Ghost</string>
+ </array>
+ <array>
+ <real>0.99999958276748657</real>
+ <string>Midnight</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/days/Dynamic%20Richness.xml b/indra/newview/app_settings/windlight/days/Dynamic%20Richness.xml
new file mode 100644
index 0000000000..f75b52e6ed
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Dynamic%20Richness.xml
@@ -0,0 +1,32 @@
+<llsd>
+ <array>
+ <array>
+ <real>0</real>
+ <string>Night</string>
+ </array>
+ <array>
+ <real>0.12499994784593582</real>
+ <string>Blizzard</string>
+ </array>
+ <array>
+ <real>0.24999989569187164</real>
+ <string>Sunrise</string>
+ </array>
+ <array>
+ <real>0.49999979138374329</real>
+ <string>Midday 3</string>
+ </array>
+ <array>
+ <real>0.68749970197677612</real>
+ <string>Pirate</string>
+ </array>
+ <array>
+ <real>0.81249970197677612</real>
+ <string>Coastal Sunset</string>
+ </array>
+ <array>
+ <real>0.99999958276748657</real>
+ <string>Midnight</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/days/Pirate%27s%20Dream.xml b/indra/newview/app_settings/windlight/days/Pirate%27s%20Dream.xml
new file mode 100644
index 0000000000..6dc1ba9f4d
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Pirate%27s%20Dream.xml
@@ -0,0 +1,44 @@
+<llsd>
+ <array>
+ <array>
+ <real>0</real>
+ <string>A-12AM</string>
+ </array>
+ <array>
+ <real>0.12499994784593582</real>
+ <string>A-3AM</string>
+ </array>
+ <array>
+ <real>0.22222213447093964</real>
+ <string>Barcelona</string>
+ </array>
+ <array>
+ <real>0.30208322405815125</real>
+ <string>Sunrise</string>
+ </array>
+ <array>
+ <real>0.37499985098838806</real>
+ <string>Sailor&apos;s Delight</string>
+ </array>
+ <array>
+ <real>0.53819423913955688</real>
+ <string>Coastal Afternoon</string>
+ </array>
+ <array>
+ <real>0.63194417953491211</real>
+ <string>Pirate</string>
+ </array>
+ <array>
+ <real>0.7048608660697937</real>
+ <string>Desert Sunset</string>
+ </array>
+ <array>
+ <real>0.74999970197677612</real>
+ <string>Coastal Sunset</string>
+ </array>
+ <array>
+ <real>0.87499958276748657</real>
+ <string>Blizzard</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/days/Psycho%20Strobe%21.xml b/indra/newview/app_settings/windlight/days/Psycho%20Strobe%21.xml
new file mode 100644
index 0000000000..302af5a9ba
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Psycho%20Strobe%21.xml
@@ -0,0 +1,72 @@
+<llsd>
+ <array>
+ <array>
+ <real>0</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.062499973922967911</real>
+ <string>A-12AM</string>
+ </array>
+ <array>
+ <real>0.12499994784593582</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.18749992549419403</real>
+ <string>A-3AM</string>
+ </array>
+ <array>
+ <real>0.24999989569187164</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.31249985098838806</real>
+ <string>A-6AM</string>
+ </array>
+ <array>
+ <real>0.37499985098838806</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.43749979138374329</real>
+ <string>A-9AM</string>
+ </array>
+ <array>
+ <real>0.49999979138374329</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.5624997615814209</real>
+ <string>A-12PM</string>
+ </array>
+ <array>
+ <real>0.62499970197677612</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.68749970197677612</real>
+ <string>A-3PM</string>
+ </array>
+ <array>
+ <real>0.74999970197677612</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.81249970197677612</real>
+ <string>A-6PM</string>
+ </array>
+ <array>
+ <real>0.87499958276748657</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.93749958276748657</real>
+ <string>A-9PM</string>
+ </array>
+ <array>
+ <real>0.99999958276748657</real>
+ <string>Sheer Surreality</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/days/Tropicalia.xml b/indra/newview/app_settings/windlight/days/Tropicalia.xml
new file mode 100644
index 0000000000..89a56d4a13
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Tropicalia.xml
@@ -0,0 +1,32 @@
+<llsd>
+ <array>
+ <array>
+ <real>0.062499973922967911</real>
+ <string>Purple</string>
+ </array>
+ <array>
+ <real>0.16666659712791443</real>
+ <string>Funky Funky</string>
+ </array>
+ <array>
+ <real>0.31249985098838806</real>
+ <string>Sunrise</string>
+ </array>
+ <array>
+ <real>0.49999979138374329</real>
+ <string>Fine Day</string>
+ </array>
+ <array>
+ <real>0.66666638851165771</real>
+ <string>Desert Sunset</string>
+ </array>
+ <array>
+ <real>0.74999970197677612</real>
+ <string>Sailor&apos;s Delight</string>
+ </array>
+ <array>
+ <real>0.95833295583724976</real>
+ <string>Midnight</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/days/Weird-O.xml b/indra/newview/app_settings/windlight/days/Weird-O.xml
new file mode 100644
index 0000000000..1e312f2464
--- /dev/null
+++ b/indra/newview/app_settings/windlight/days/Weird-O.xml
@@ -0,0 +1,56 @@
+<llsd>
+ <array>
+ <array>
+ <real>0</real>
+ <string>Funky Funky</string>
+ </array>
+ <array>
+ <real>0.13194438815116882</real>
+ <string>Funky Funky Funky</string>
+ </array>
+ <array>
+ <real>0.26041656732559204</real>
+ <string>Gelatto</string>
+ </array>
+ <array>
+ <real>0.40624985098838806</real>
+ <string>Funky Funky Funky</string>
+ </array>
+ <array>
+ <real>0.43749979138374329</real>
+ <string>Ghost</string>
+ </array>
+ <array>
+ <real>0.46874979138374329</real>
+ <string>Gelatto</string>
+ </array>
+ <array>
+ <real>0.5486108660697937</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.6076386570930481</real>
+ <string>Gelatto</string>
+ </array>
+ <array>
+ <real>0.68055528402328491</real>
+ <string>Ghost</string>
+ </array>
+ <array>
+ <real>0.75694411993026733</real>
+ <string>Sheer Surreality</string>
+ </array>
+ <array>
+ <real>0.87847185134887695</real>
+ <string>Gelatto</string>
+ </array>
+ <array>
+ <real>0.91319411993026733</real>
+ <string>Funky Funky Funky</string>
+ </array>
+ <array>
+ <real>0.96527737379074097</real>
+ <string>Funky Funky Funky</string>
+ </array>
+ </array>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/skies/Midday.xml b/indra/newview/app_settings/windlight/skies/Midday.xml
new file mode 100644
index 0000000000..119b3e1418
--- /dev/null
+++ b/indra/newview/app_settings/windlight/skies/Midday.xml
@@ -0,0 +1,141 @@
+<llsd>
+ <map>
+ <key>ambient</key>
+ <array>
+ <real>1.0499999523162842</real>
+ <real>1.0499999523162842</real>
+ <real>1.0499999523162842</real>
+ <real>0.34999999403953552</real>
+ </array>
+ <key>blue_density</key>
+ <array>
+ <real>0.24475815892219543</real>
+ <real>0.44872328639030457</real>
+ <real>0.75999999046325684</real>
+ <real>0.37999999523162842</real>
+ </array>
+ <key>blue_horizon</key>
+ <array>
+ <real>0.49548381567001343</real>
+ <real>0.49548381567001343</real>
+ <real>0.63999998569488525</real>
+ <real>0.31999999284744263</real>
+ </array>
+ <key>cloud_color</key>
+ <array>
+ <real>0.40999999642372131</real>
+ <real>0.40999999642372131</real>
+ <real>0.40999999642372131</real>
+ <real>0.40999999642372131</real>
+ </array>
+ <key>cloud_pos_density1</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>1</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density2</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.125</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scale</key>
+ <array>
+ <real>0.41999998688697815</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scroll_rate</key>
+ <array>
+ <real>10.199999809265137</real>
+ <real>10.01099967956543</real>
+ </array>
+ <key>cloud_shadow</key>
+ <array>
+ <real>0.26999998092651367</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>density_multiplier</key>
+ <array>
+ <real>0.00017999998817685992</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>distance_multiplier</key>
+ <array>
+ <real>0.80000001192092896</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>east_angle</key>
+ <real>0</real>
+ <key>enable_cloud_scroll</key>
+ <array>
+ <boolean>1</boolean>
+ <boolean>1</boolean>
+ </array>
+ <key>gamma</key>
+ <array>
+ <real>1</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>glow</key>
+ <array>
+ <real>5</real>
+ <real>0.0010000000474974513</real>
+ <real>-0.47999998927116394</real>
+ <real>1</real>
+ </array>
+ <key>haze_density</key>
+ <array>
+ <real>0.69999998807907104</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>haze_horizon</key>
+ <array>
+ <real>0.18999999761581421</real>
+ <real>0.19915600121021271</real>
+ <real>0.19915600121021271</real>
+ <real>1</real>
+ </array>
+ <key>lightnorm</key>
+ <array>
+ <real>0</real>
+ <real>1</real>
+ <real>-4.3711388286737929e-008</real>
+ <real>0</real>
+ </array>
+ <key>max_y</key>
+ <array>
+ <real>1605</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>preset_num</key>
+ <integer>22</integer>
+ <key>star_brightness</key>
+ <real>0</real>
+ <key>sun_angle</key>
+ <real>1.5707963705062866</real>
+ <key>sunlight_color</key>
+ <array>
+ <real>0.7342105507850647</real>
+ <real>0.78157895803451538</real>
+ <real>0.89999997615814209</real>
+ <real>0.29999998211860657</real>
+ </array>
+ </map>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/skies/Midnight.xml b/indra/newview/app_settings/windlight/skies/Midnight.xml
new file mode 100644
index 0000000000..0aba31214a
--- /dev/null
+++ b/indra/newview/app_settings/windlight/skies/Midnight.xml
@@ -0,0 +1,141 @@
+<llsd>
+ <map>
+ <key>ambient</key>
+ <array>
+ <real>0.20405027270317078</real>
+ <real>0.24246673285961151</real>
+ <real>0.32999998331069946</real>
+ <real>0.10999999940395355</real>
+ </array>
+ <key>blue_density</key>
+ <array>
+ <real>0.44999998807907104</real>
+ <real>0.44999998807907104</real>
+ <real>0.44999998807907104</real>
+ <real>1</real>
+ </array>
+ <key>blue_horizon</key>
+ <array>
+ <real>0.23999999463558197</real>
+ <real>0.23999999463558197</real>
+ <real>0.23999999463558197</real>
+ <real>1</real>
+ </array>
+ <key>cloud_color</key>
+ <array>
+ <real>0.22615399956703186</real>
+ <real>0.22615399956703186</real>
+ <real>0.22615399956703186</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density1</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.87999999523162842</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density2</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.125</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scale</key>
+ <array>
+ <real>0.41999998688697815</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scroll_rate</key>
+ <array>
+ <real>10.49940013885498</real>
+ <real>10.01099967956543</real>
+ </array>
+ <key>cloud_shadow</key>
+ <array>
+ <real>0.26999998092651367</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>density_multiplier</key>
+ <array>
+ <real>0.00030000001424923539</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>distance_multiplier</key>
+ <array>
+ <real>0</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>east_angle</key>
+ <real>0</real>
+ <key>enable_cloud_scroll</key>
+ <array>
+ <boolean>1</boolean>
+ <boolean>1</boolean>
+ </array>
+ <key>gamma</key>
+ <array>
+ <real>1</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>glow</key>
+ <array>
+ <real>5</real>
+ <real>0.0010000000474974513</real>
+ <real>-0.47999998927116394</real>
+ <real>1</real>
+ </array>
+ <key>haze_density</key>
+ <array>
+ <real>4</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>haze_horizon</key>
+ <array>
+ <real>0</real>
+ <real>0.19915600121021271</real>
+ <real>0.19915600121021271</real>
+ <real>1</real>
+ </array>
+ <key>lightnorm</key>
+ <array>
+ <real>0</real>
+ <real>1</real>
+ <real>-4.8876205482883961e-007</real>
+ <real>1</real>
+ </array>
+ <key>max_y</key>
+ <array>
+ <real>906.20001220703125</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>preset_num</key>
+ <integer>22</integer>
+ <key>star_brightness</key>
+ <real>2</real>
+ <key>sun_angle</key>
+ <real>4.7123894691467285</real>
+ <key>sunlight_color</key>
+ <array>
+ <real>0.34876692295074463</real>
+ <real>0.35574248433113098</real>
+ <real>0.65999996662139893</real>
+ <real>0.2199999988079071</real>
+ </array>
+ </map>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/skies/Sunrise.xml b/indra/newview/app_settings/windlight/skies/Sunrise.xml
new file mode 100644
index 0000000000..bbc7aeec59
--- /dev/null
+++ b/indra/newview/app_settings/windlight/skies/Sunrise.xml
@@ -0,0 +1,141 @@
+<llsd>
+ <map>
+ <key>ambient</key>
+ <array>
+ <real>0.80999994277954102</real>
+ <real>0.46289783716201782</real>
+ <real>0.62999993562698364</real>
+ <real>0.26999998092651367</real>
+ </array>
+ <key>blue_density</key>
+ <array>
+ <real>0.15793180465698242</real>
+ <real>0.43499568104743958</real>
+ <real>0.87000000476837158</real>
+ <real>0.87000000476837158</real>
+ </array>
+ <key>blue_horizon</key>
+ <array>
+ <real>0.20673196017742157</real>
+ <real>0.40988314151763916</real>
+ <real>0.47999998927116394</real>
+ <real>0.47999998927116394</real>
+ </array>
+ <key>cloud_color</key>
+ <array>
+ <real>0.22616604226328718</real>
+ <real>0.22616604226328718</real>
+ <real>0.22616604226328718</real>
+ <real>0.99997219085526012</real>
+ </array>
+ <key>cloud_pos_density1</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.88000025272481253</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density2</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.125</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scale</key>
+ <array>
+ <real>0.41999998688697815</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scroll_rate</key>
+ <array>
+ <real>10.49940013883861</real>
+ <real>10.010999679576344</real>
+ </array>
+ <key>cloud_shadow</key>
+ <array>
+ <real>0.26999998092651367</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>density_multiplier</key>
+ <array>
+ <real>0.00062000000616535544</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>distance_multiplier</key>
+ <array>
+ <real>2.6999279499073054</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>east_angle</key>
+ <real>0</real>
+ <key>enable_cloud_scroll</key>
+ <array>
+ <boolean>1</boolean>
+ <boolean>1</boolean>
+ </array>
+ <key>gamma</key>
+ <array>
+ <real>1</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>glow</key>
+ <array>
+ <real>5.0009990693069994</real>
+ <real>0.0010000000474963411</real>
+ <real>-0.48000101923815919</real>
+ <real>1</real>
+ </array>
+ <key>haze_density</key>
+ <array>
+ <real>0.53999996185302734</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>haze_horizon</key>
+ <array>
+ <real>0.15999999642372131</real>
+ <real>0.19915600121021271</real>
+ <real>0.19915600121021271</real>
+ <real>1</real>
+ </array>
+ <key>lightnorm</key>
+ <array>
+ <real>0</real>
+ <real>0.094108223915100098</real>
+ <real>0.99556195735931396</real>
+ <real>0</real>
+ </array>
+ <key>max_y</key>
+ <array>
+ <real>563</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>preset_num</key>
+ <integer>22</integer>
+ <key>star_brightness</key>
+ <real>0</real>
+ <key>sun_angle</key>
+ <real>0.094247691333293915</real>
+ <key>sunlight_color</key>
+ <array>
+ <real>2.369999885559082</real>
+ <real>2.369999885559082</real>
+ <real>2.369999885559082</real>
+ <real>0.78999996185302734</real>
+ </array>
+ </map>
+</llsd>
diff --git a/indra/newview/app_settings/windlight/skies/Sunset.xml b/indra/newview/app_settings/windlight/skies/Sunset.xml
new file mode 100644
index 0000000000..ebf08e1a3f
--- /dev/null
+++ b/indra/newview/app_settings/windlight/skies/Sunset.xml
@@ -0,0 +1,142 @@
+<llsd>
+ <map>
+ <key>ambient</key>
+ <array>
+ <real>1.0199999809265137</real>
+ <real>0.80999994277954102</real>
+ <real>0.80999994277954102</real>
+ <real>1.0199999809265137</real>
+ </array>
+ <key>blue_density</key>
+ <array>
+ <real>0.14522500336170197</real>
+ <real>0.39999699592590332</real>
+ <real>0.80000197887420654</real>
+ <real>1</real>
+ </array>
+ <key>blue_horizon</key>
+ <array>
+ <real>0.10767599940299988</real>
+ <real>0.21348699927330017</real>
+ <real>0.25</real>
+ <real>1</real>
+ </array>
+ <key>cloud_color</key>
+ <array>
+ <real>0.22615399956703186</real>
+ <real>0.22615399956703186</real>
+ <real>0.22615399956703186</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density1</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.87999999523162842</real>
+ <real>1</real>
+ </array>
+ <key>cloud_pos_density2</key>
+ <array>
+ <real>1.6884100437164307</real>
+ <real>0.52609699964523315</real>
+ <real>0.125</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scale</key>
+ <array>
+ <real>0.41999998688697815</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>cloud_scroll_rate</key>
+ <array>
+ <real>10.49940013885498</real>
+ <real>10.01099967956543</real>
+ </array>
+ <key>cloud_shadow</key>
+ <array>
+ <real>0.26999998092651367</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>density_multiplier</key>
+ <array>
+ <real>0.00046000001020729542</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>distance_multiplier</key>
+ <array>
+ <real>1</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>east_angle</key>
+ <real>0</real>
+ <key>enable_cloud_scroll</key>
+ <array>
+ <boolean>1</boolean>
+ <boolean>1</boolean>
+ </array>
+ <key>gamma</key>
+ <array>
+ <real>1</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>glow</key>
+ <array>
+ <real>5</real>
+ <real>0.0010000000474974513</real>
+ <real>-0.47999998927116394</real>
+ <real>1</real>
+ </array>
+ <key>haze_density</key>
+ <array>
+ <real>0.69999998807907104</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>haze_horizon</key>
+ <array>
+ <real>0.15999999642372131</real>
+ <real>0.19915600121021271</real>
+ <real>0.19915600121021271</real>
+ <real>1</real>
+ </array>
+ <key>lightnorm</key>
+ <array>
+ <real>0</real>
+ <real>0.07532646507024765</real>
+ <real>-0.99715894460678101</real>
+ <real>0</real>
+ </array>
+ <key>max_y</key>
+ <array>
+ <real>562.5</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1</real>
+ </array>
+ <key>preset_num</key>
+ <integer>22</integer>
+ <key>star_brightness</key>
+ <real>0</real>
+ <key>sun_angle</key>
+ <real>3.0661947727203369</real>
+ <key>sunlight_color</key>
+ <array>
+ <real>2.8385701179504395</real>
+ <real>2.8385701179504395</real>
+ <real>2.8385701179504395</real>
+ <real>1</real>
+ </array>
+ </map>
+</llsd>
+
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index 5384660d4c..22c79a4cbd 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -60,7 +60,6 @@ Disregard96DefaultDrawDistance 1 1
RenderTextureMemoryMultiple 1 1.0
RenderShaderLightingMaxLevel 1 3
RenderDeferred 1 1
-SkyUseClassicClouds 1 1
RenderDeferredSSAO 1 1
RenderShadowDetail 1 2
WatchdogDisabled 1 1
@@ -93,7 +92,6 @@ RenderVolumeLODFactor 1 0.5
VertexShaderEnable 1 0
WindLightUseAtmosShaders 1 0
WLSkyDetail 1 48
-SkyUseClassicClouds 1 0
RenderDeferred 1 0
RenderDeferredSSAO 1 0
RenderShadowDetail 1 0
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index dab73dc3d1..649f5ebd18 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -58,7 +58,6 @@ WLSkyDetail 1 128
Disregard128DefaultDrawDistance 1 1
Disregard96DefaultDrawDistance 1 1
RenderTextureMemoryMultiple 1 1.0
-SkyUseClassicClouds 1 1
RenderShaderLightingMaxLevel 1 3
RenderDeferred 1 1
RenderDeferredSSAO 1 1
@@ -91,7 +90,6 @@ RenderVolumeLODFactor 1 0.5
VertexShaderEnable 1 0
WindLightUseAtmosShaders 1 0
WLSkyDetail 1 48
-SkyUseClassicClouds 1 0
RenderDeferred 1 0
RenderDeferredSSAO 1 0
RenderShadowDetail 1 0
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index a1e25aae08..ee08e78af5 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -59,7 +59,6 @@ Disregard128DefaultDrawDistance 1 1
Disregard96DefaultDrawDistance 1 1
RenderTextureMemoryMultiple 1 0.5
RenderShaderLightingMaxLevel 1 3
-SkyUseClassicClouds 1 1
RenderDeferred 1 1
RenderDeferredSSAO 1 1
RenderShadowDetail 1 2
@@ -93,7 +92,6 @@ RenderVolumeLODFactor 1 0.5
VertexShaderEnable 1 0
WindLightUseAtmosShaders 1 0
WLSkyDetail 1 48
-SkyUseClassicClouds 1 0
RenderDeferred 1 0
RenderDeferredSSAO 1 0
RenderShadowDetail 1 0
diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt
index ce2adac221..ba74f9a6c2 100644
--- a/indra/newview/featuretable_xp.txt
+++ b/indra/newview/featuretable_xp.txt
@@ -59,7 +59,6 @@ Disregard128DefaultDrawDistance 1 1
Disregard96DefaultDrawDistance 1 1
RenderTextureMemoryMultiple 1 1.0
RenderShaderLightingMaxLevel 1 3
-SkyUseClassicClouds 1 1
RenderDeferred 1 0
RenderDeferredSSAO 1 0
RenderShadowDetail 1 0
@@ -93,7 +92,6 @@ RenderVolumeLODFactor 1 0.5
VertexShaderEnable 1 0
WindLightUseAtmosShaders 1 0
WLSkyDetail 1 48
-SkyUseClassicClouds 1 0
RenderDeferred 1 0
RenderDeferredSSAO 1 0
RenderShadowDetail 1 0
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 446ded8096..fa6488e486 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -41,6 +41,7 @@
#include "llcapabilitylistener.h"
#include "llchannelmanager.h"
#include "llconsole.h"
+#include "llenvmanager.h"
#include "llfirstuse.h"
#include "llfloatercamera.h"
#include "llfloaterreg.h"
@@ -84,6 +85,7 @@
#include "llwindow.h"
#include "llworld.h"
#include "llworldmap.h"
+#include "stringize.h"
using namespace LLVOAvatarDefines;
@@ -608,6 +610,8 @@ void LLAgent::standUp()
//-----------------------------------------------------------------------------
void LLAgent::setRegion(LLViewerRegion *regionp)
{
+ bool teleport = true;
+
llassert(regionp);
if (mRegionp != regionp)
{
@@ -645,6 +649,8 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
gSky.mVOGroundp->setRegion(regionp);
}
+ // Notify windlight managers
+ teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE);
}
else
{
@@ -685,6 +691,15 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
LLSelectMgr::getInstance()->updateSelectionCenter();
LLFloaterMove::sUpdateFlyingStatus();
+
+ if (teleport)
+ {
+ LLEnvManagerNew::instance().onTeleport();
+ }
+ else
+ {
+ LLEnvManagerNew::instance().onRegionCrossing();
+ }
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d2582d524d..1d9519d675 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1,4 +1,4 @@
- /**
+/**
* @file llappviewer.cpp
* @brief The LLAppViewer class definitions
*
@@ -1640,9 +1640,7 @@ bool LLAppViewer::cleanup()
llinfos << "Cleaning up Objects" << llendflush;
LLViewerObject::cleanupVOClasses();
-
- LLWaterParamManager::cleanupClass();
- LLWLParamManager::cleanupClass();
+
LLPostProcess::cleanupClass();
LLTracker::cleanupInstance();
@@ -4341,7 +4339,6 @@ void LLAppViewer::idle()
//
// Update weather effects
//
- LLWorld::getInstance()->updateClouds(gFrameDTClamped);
gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets
// Update wind vector
@@ -4357,9 +4354,6 @@ void LLAppViewer::idle()
// Compute average wind and use to drive motion of water
average_wind = regionp->mWind.getAverage();
- F32 cloud_density = regionp->mCloudLayer.getDensityRegion(wind_position_region);
-
- gSky.setCloudDensityAtAgent(cloud_density);
gSky.setWind(average_wind);
//LLVOWater::setWind(average_wind);
}
diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp
deleted file mode 100644
index cda0f6e4a2..0000000000
--- a/indra/newview/llcloud.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/**
- * @file llcloud.cpp
- * @brief Implementation of viewer LLCloudLayer class
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llmath.h"
-//#include "vmath.h"
-#include "v3math.h"
-#include "v4math.h"
-#include "llquaternion.h"
-#include "llrand.h"
-#include "v4color.h"
-
-#include "llwind.h"
-#include "llcloud.h"
-#include "llgl.h"
-#include "llviewerobjectlist.h"
-#include "llvoclouds.h"
-#include "llvosky.h"
-#include "llsky.h"
-#include "llviewerregion.h"
-#include "patch_dct.h"
-#include "patch_code.h"
-#include "llglheaders.h"
-#include "pipeline.h"
-#include "lldrawpool.h"
-#include "llworld.h"
-
-extern LLPipeline gPipeline;
-
-const F32 CLOUD_UPDATE_RATE = 1.0f; // Global time dilation for clouds
-const F32 CLOUD_GROW_RATE = 0.05f;
-const F32 CLOUD_DECAY_RATE = -0.05f;
-const F32 CLOUD_VELOCITY_SCALE = 0.01f;
-const F32 CLOUD_DENSITY = 25.f;
-const S32 CLOUD_COUNT_MAX = 20;
-const F32 CLOUD_HEIGHT_RANGE = 48.f;
-const F32 CLOUD_HEIGHT_MEAN = 192.f;
-
-enum
-{
- LL_PUFF_GROWING = 0,
- LL_PUFF_DYING = 1
-};
-
-// Used for patch decoder
-S32 gBuffer[16*16];
-
-
-//static
-S32 LLCloudPuff::sPuffCount = 0;
-
-LLCloudPuff::LLCloudPuff() :
- mAlpha(0.01f),
- mRate(CLOUD_GROW_RATE*CLOUD_UPDATE_RATE),
- mLifeState(LL_PUFF_GROWING)
-{
-}
-
-LLCloudGroup::LLCloudGroup() :
- mCloudLayerp(NULL),
- mDensity(0.f),
- mTargetPuffCount(0),
- mVOCloudsp(NULL)
-{
-}
-
-void LLCloudGroup::cleanup()
-{
- if (mVOCloudsp)
- {
- if (!mVOCloudsp->isDead())
- {
- gObjectList.killObject(mVOCloudsp);
- }
- mVOCloudsp = NULL;
- }
-}
-
-void LLCloudGroup::setCenterRegion(const LLVector3 &center)
-{
- mCenterRegion = center;
-}
-
-void LLCloudGroup::updatePuffs(const F32 dt)
-{
- mDensity = mCloudLayerp->getDensityRegion(mCenterRegion);
-
- if (!mVOCloudsp)
- {
- mVOCloudsp = (LLVOClouds *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_CLOUDS, mCloudLayerp->getRegion());
- mVOCloudsp->setCloudGroup(this);
- mVOCloudsp->setPositionRegion(mCenterRegion);
- mVOCloudsp->setScale(LLVector3(256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH,
- 256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH,
- CLOUD_HEIGHT_RANGE + CLOUD_PUFF_HEIGHT)*0.5f);
- gPipeline.createObject(mVOCloudsp);
- }
-
- LLVector3 velocity;
- LLVector3d vel_d;
- // Update the positions of all of the clouds
- for (U32 i = 0; i < mCloudPuffs.size(); i++)
- {
- LLCloudPuff &puff = mCloudPuffs[i];
- velocity = mCloudLayerp->getRegion()->mWind.getCloudVelocity(mCloudLayerp->getRegion()->getPosRegionFromGlobal(puff.mPositionGlobal));
- velocity *= CLOUD_VELOCITY_SCALE*CLOUD_UPDATE_RATE;
- vel_d.setVec(velocity);
- mCloudPuffs[i].mPositionGlobal += vel_d;
- mCloudPuffs[i].mAlpha += mCloudPuffs[i].mRate * dt;
- mCloudPuffs[i].mAlpha = llmin(1.f, mCloudPuffs[i].mAlpha);
- mCloudPuffs[i].mAlpha = llmax(0.f, mCloudPuffs[i].mAlpha);
- }
-}
-
-void LLCloudGroup::updatePuffOwnership()
-{
- U32 i = 0;
- while (i < mCloudPuffs.size())
- {
- if (mCloudPuffs[i].getLifeState() == LL_PUFF_DYING)
- {
- i++;
- continue;
- }
- if (inGroup(mCloudPuffs[i]))
- {
- i++;
- continue;
- }
-
- //llinfos << "Cloud moving to new group" << llendl;
- LLCloudGroup *new_cgp = LLWorld::getInstance()->findCloudGroup(mCloudPuffs[i]);
- if (!new_cgp)
- {
- //llinfos << "Killing puff not in group" << llendl;
- mCloudPuffs[i].setLifeState(LL_PUFF_DYING);
- mCloudPuffs[i].mRate = CLOUD_DECAY_RATE*CLOUD_UPDATE_RATE;
- i++;
- continue;
- }
- //llinfos << "Puff handed off!" << llendl;
- LLCloudPuff puff;
- puff.mPositionGlobal = mCloudPuffs[i].mPositionGlobal;
- puff.mAlpha = mCloudPuffs[i].mAlpha;
- mCloudPuffs.erase(mCloudPuffs.begin() + i);
- new_cgp->mCloudPuffs.push_back(puff);
- }
-
- //llinfos << "Puff count: " << LLCloudPuff::sPuffCount << llendl;
-}
-
-void LLCloudGroup::updatePuffCount()
-{
- if (!mVOCloudsp)
- {
- return;
- }
- S32 i;
- S32 target_puff_count = llround(CLOUD_DENSITY * mDensity);
- target_puff_count = llmax(0, target_puff_count);
- target_puff_count = llmin(CLOUD_COUNT_MAX, target_puff_count);
- S32 current_puff_count = (S32) mCloudPuffs.size();
- // Create a new cloud if we need one
- if (current_puff_count < target_puff_count)
- {
- LLVector3d puff_pos_global;
- mCloudPuffs.resize(target_puff_count);
- for (i = current_puff_count; i < target_puff_count; i++)
- {
- puff_pos_global = mVOCloudsp->getPositionGlobal();
- F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE;
- F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE;
- F32 z = ll_frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE;
- puff_pos_global += LLVector3d(x, y, z);
- mCloudPuffs[i].mPositionGlobal = puff_pos_global;
- mCloudPuffs[i].mAlpha = 0.01f;
- LLCloudPuff::sPuffCount++;
- }
- }
-
- // Count the number of live puffs
- S32 live_puff_count = 0;
- for (i = 0; i < (S32) mCloudPuffs.size(); i++)
- {
- if (mCloudPuffs[i].getLifeState() != LL_PUFF_DYING)
- {
- live_puff_count++;
- }
- }
-
-
- // Start killing enough puffs so the live puff count == target puff count
- S32 new_dying_count = llmax(0, live_puff_count - target_puff_count);
- i = 0;
- while (new_dying_count > 0)
- {
- if (mCloudPuffs[i].getLifeState() != LL_PUFF_DYING)
- {
- //llinfos << "Killing extra live cloud" << llendl;
- mCloudPuffs[i].setLifeState(LL_PUFF_DYING);
- mCloudPuffs[i].mRate = CLOUD_DECAY_RATE*CLOUD_UPDATE_RATE;
- new_dying_count--;
- }
- i++;
- }
-
- // Remove fully dead puffs
- i = 0;
- while (i < (S32) mCloudPuffs.size())
- {
- if (mCloudPuffs[i].isDead())
- {
- //llinfos << "Removing dead puff!" << llendl;
- mCloudPuffs.erase(mCloudPuffs.begin() + i);
- LLCloudPuff::sPuffCount--;
- }
- else
- {
- i++;
- }
- }
-}
-
-BOOL LLCloudGroup::inGroup(const LLCloudPuff &puff) const
-{
- // Do min/max check on center of the cloud puff
- F32 min_x, min_y, max_x, max_y;
- F32 delta = 128.f/CLOUD_GROUPS_PER_EDGE;
- min_x = mCenterRegion.mV[VX] - delta;
- min_y = mCenterRegion.mV[VY] - delta;
- max_x = mCenterRegion.mV[VX] + delta;
- max_y = mCenterRegion.mV[VY] + delta;
-
- LLVector3 pos_region = mCloudLayerp->getRegion()->getPosRegionFromGlobal(puff.getPositionGlobal());
-
- if ((pos_region.mV[VX] < min_x)
- || (pos_region.mV[VY] < min_y)
- || (pos_region.mV[VX] > max_x)
- || (pos_region.mV[VY] > max_y))
- {
- return FALSE;
- }
- return TRUE;
-}
-
-LLCloudLayer::LLCloudLayer()
-: mOriginGlobal(0.0f, 0.0f, 0.0f),
- mMetersPerEdge(1.0f),
- mMetersPerGrid(1.0f),
- mWindp(NULL),
- mDensityp(NULL)
-{
- S32 i, j;
- for (i = 0; i < 4; i++)
- {
- mNeighbors[i] = NULL;
- }
-
- F32 x, y;
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- y = (0.5f + i)*(256.f/CLOUD_GROUPS_PER_EDGE);
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- x = (0.5f + j)*(256.f/CLOUD_GROUPS_PER_EDGE);
-
- mCloudGroups[i][j].setCloudLayerp(this);
- mCloudGroups[i][j].setCenterRegion(LLVector3(x, y, CLOUD_HEIGHT_MEAN));
- }
- }
-}
-
-
-
-LLCloudLayer::~LLCloudLayer()
-{
- destroy();
-}
-
-
-void LLCloudLayer::create(LLViewerRegion *regionp)
-{
- llassert(regionp);
-
- mRegionp = regionp;
- mDensityp = new F32 [CLOUD_GRIDS_PER_EDGE * CLOUD_GRIDS_PER_EDGE];
-
- U32 i;
- for (i = 0; i < CLOUD_GRIDS_PER_EDGE*CLOUD_GRIDS_PER_EDGE; i++)
- {
- mDensityp[i] = 0.f;
- }
-}
-
-void LLCloudLayer::setRegion(LLViewerRegion *regionp)
-{
- mRegionp = regionp;
-}
-
-void LLCloudLayer::destroy()
-{
- reset();
-
- delete [] mDensityp;
- mDensityp = NULL;
- mWindp = NULL;
-}
-
-
-void LLCloudLayer::reset()
-{
- // Kill all of the existing puffs
- S32 i, j;
-
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- mCloudGroups[i][j].cleanup();
- }
- }
-}
-
-void LLCloudLayer::setWindPointer(LLWind *windp)
-{
- if (mWindp)
- {
- mWindp->setCloudDensityPointer(NULL);
- }
- mWindp = windp;
- if (mWindp)
- {
- mWindp->setCloudDensityPointer(mDensityp);
- }
-}
-
-
-void LLCloudLayer::setWidth(F32 width)
-{
- mMetersPerEdge = width;
- mMetersPerGrid = width / CLOUD_GRIDS_PER_EDGE;
-}
-
-
-F32 LLCloudLayer::getDensityRegion(const LLVector3 &pos_region)
-{
- // "position" is region-local
- S32 i, j, ii, jj;
-
- i = lltrunc(pos_region.mV[VX] / mMetersPerGrid);
- j = lltrunc(pos_region.mV[VY] / mMetersPerGrid);
- ii = i + 1;
- jj = j + 1;
-
-
- // clamp
- if (i >= (S32)CLOUD_GRIDS_PER_EDGE)
- {
- i = CLOUD_GRIDS_PER_EDGE - 1;
- ii = i;
- }
- else if (i < 0)
- {
- i = 0;
- ii = i;
- }
- else if (ii >= (S32)CLOUD_GRIDS_PER_EDGE || ii < 0)
- {
- ii = i;
- }
-
- if (j >= (S32)CLOUD_GRIDS_PER_EDGE)
- {
- j = CLOUD_GRIDS_PER_EDGE - 1;
- jj = j;
- }
- else if (j < 0)
- {
- j = 0;
- jj = j;
- }
- else if (jj >= (S32)CLOUD_GRIDS_PER_EDGE || jj < 0)
- {
- jj = j;
- }
-
- F32 dx = (pos_region.mV[VX] - (F32) i * mMetersPerGrid) / mMetersPerGrid;
- F32 dy = (pos_region.mV[VY] - (F32) j * mMetersPerGrid) / mMetersPerGrid;
- F32 omdx = 1.0f - dx;
- F32 omdy = 1.0f - dy;
-
- F32 density = dx * dy * *(mDensityp + ii + jj * CLOUD_GRIDS_PER_EDGE) +
- dx * omdy * *(mDensityp + i + jj * CLOUD_GRIDS_PER_EDGE) +
- omdx * dy * *(mDensityp + ii + j * CLOUD_GRIDS_PER_EDGE) +
- omdx * omdy * *(mDensityp + i + j * CLOUD_GRIDS_PER_EDGE);
-
- return density;
-}
-
-void LLCloudLayer::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp)
-{
- LLPatchHeader patch_header;
-
- init_patch_decompressor(group_headerp->patch_size);
-
- // Don't use the packed group_header stride because the strides used on
- // simulator and viewer are not equal.
- group_headerp->stride = group_headerp->patch_size; // offset required to step up one row
- set_group_of_patch_header(group_headerp);
-
- decode_patch_header(bitpack, &patch_header);
- decode_patch(bitpack, gBuffer);
- decompress_patch(mDensityp, gBuffer, &patch_header);
-}
-
-void LLCloudLayer::updatePuffs(const F32 dt)
-{
- // We want to iterate through all of the cloud groups
- // and update their density targets
-
- S32 i, j;
-
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- mCloudGroups[i][j].updatePuffs(dt);
- }
- }
-}
-
-void LLCloudLayer::updatePuffOwnership()
-{
- S32 i, j;
-
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- mCloudGroups[i][j].updatePuffOwnership();
- }
- }
-}
-
-void LLCloudLayer::updatePuffCount()
-{
- S32 i, j;
-
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- mCloudGroups[i][j].updatePuffCount();
- }
- }
-}
-
-LLCloudGroup *LLCloudLayer::findCloudGroup(const LLCloudPuff &puff)
-{
- S32 i, j;
-
- for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
- {
- for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
- {
- if (mCloudGroups[i][j].inGroup(puff))
- {
- return &(mCloudGroups[i][j]);
- }
- }
- }
- return NULL;
-}
-
-
-
-void LLCloudLayer::connectNeighbor(LLCloudLayer *cloudp, U32 direction)
-{
- if (direction >= 4)
- {
- // Only care about cardinal 4 directions.
- return;
- }
-
- mNeighbors[direction] = cloudp;
- if (cloudp)
- mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = this;
-}
-
-
-void LLCloudLayer::disconnectNeighbor(U32 direction)
-{
- if (direction >= 4)
- {
- // Only care about cardinal 4 directions.
- return;
- }
-
- if (mNeighbors[direction])
- {
- mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = NULL;
- mNeighbors[direction] = NULL;
- }
-}
-
-
-void LLCloudLayer::disconnectAllNeighbors()
-{
- S32 i;
- for (i = 0; i < 4; i++)
- {
- disconnectNeighbor(i);
- }
-}
diff --git a/indra/newview/llcloud.h b/indra/newview/llcloud.h
deleted file mode 100644
index 0435ba1ece..0000000000
--- a/indra/newview/llcloud.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * @file llcloud.h
- * @brief Description of viewer LLCloudLayer class
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLCLOUD_H
-#define LL_LLCLOUD_H
-
-// Some ideas on how clouds should work
-//
-// Each region has a cloud layer
-// Each cloud layer has pre-allocated space for N clouds
-// The LLSky class knows the max number of clouds to render M.
-// All clouds use the same texture, but the tex-coords can take on 8 configurations
-// (four rotations, front and back)
-//
-// The sky's part
-// --------------
-// The sky knows that A clouds have been assigned to regions and there are B left over.
-// Divide B by number of active regions to get C.
-// Ask each region to add C more clouds and return total number D.
-// Add up all the D's to get a new A.
-//
-// The cloud layer's part
-// ----------------------
-// The cloud layer is a grid of possibility. Each grid's value represents the probablility
-// (0.0 to 1.0) that a cloud placement query will succeed.
-//
-// The sky asks the region to add C more clouds.
-// The cloud layer tries a total of E times to place clouds and returns total cloud count.
-//
-// Clouds move according to local wind velocity.
-// If a cloud moves out of region then it's location is sent to neighbor region
-// or it is allowed to drift and decay.
-//
-// The clouds in non-visible regions do not propagate every frame.
-// Each frame one non-visible region is allowed to propagate it's clouds
-// (might have to check to see if incoming cloud was already visible or not).
-//
-//
-
-#include "llmath.h"
-//#include "vmath.h"
-#include "v3math.h"
-#include "v3dmath.h"
-#include "v4math.h"
-#include "v4color.h"
-#include "llpointer.h"
-#include "lldarray.h"
-
-#include "llframetimer.h"
-
-const U32 CLOUD_GRIDS_PER_EDGE = 16;
-
-const F32 CLOUD_PUFF_WIDTH = 64.f;
-const F32 CLOUD_PUFF_HEIGHT = 48.f;
-
-class LLWind;
-class LLVOClouds;
-class LLViewerRegion;
-class LLCloudLayer;
-class LLBitPack;
-class LLGroupHeader;
-
-const S32 CLOUD_GROUPS_PER_EDGE = 4;
-
-class LLCloudPuff
-{
-public:
- LLCloudPuff();
-
- const LLVector3d &getPositionGlobal() const { return mPositionGlobal; }
- friend class LLCloudGroup;
-
- void updatePuffs(const F32 dt);
- void updatePuffOwnership();
-
- F32 getAlpha() const { return mAlpha; }
- U32 getLifeState() const { return mLifeState; }
- void setLifeState(const U32 state) { mLifeState = state; }
- BOOL isDead() const { return mAlpha <= 0.f; }
-
-
- static S32 sPuffCount;
-protected:
- F32 mAlpha;
- F32 mRate;
- LLVector3d mPositionGlobal;
-
- BOOL mLifeState;
-};
-
-class LLCloudGroup
-{
-public:
- LLCloudGroup();
-
- void cleanup();
-
- void setCloudLayerp(LLCloudLayer *clp) { mCloudLayerp = clp; }
- void setCenterRegion(const LLVector3 &center);
-
- void updatePuffs(const F32 dt);
- void updatePuffOwnership();
- void updatePuffCount();
-
- BOOL inGroup(const LLCloudPuff &puff) const;
-
- F32 getDensity() const { return mDensity; }
- S32 getNumPuffs() const { return (S32) mCloudPuffs.size(); }
- const LLCloudPuff &getPuff(const S32 i) { return mCloudPuffs[i]; }
-protected:
- LLCloudLayer *mCloudLayerp;
- LLVector3 mCenterRegion;
- F32 mDensity;
- S32 mTargetPuffCount;
-
- std::vector<LLCloudPuff> mCloudPuffs;
- LLPointer<LLVOClouds> mVOCloudsp;
-};
-
-
-class LLCloudLayer
-{
-public:
- LLCloudLayer();
- ~LLCloudLayer();
-
- void create(LLViewerRegion *regionp);
- void destroy();
-
- void reset(); // Clears all active cloud puffs
-
-
- void updatePuffs(const F32 dt);
- void updatePuffOwnership();
- void updatePuffCount();
-
- LLCloudGroup *findCloudGroup(const LLCloudPuff &puff);
-
- void setRegion(LLViewerRegion *regionp);
- LLViewerRegion* getRegion() const { return mRegionp; }
- void setWindPointer(LLWind *windp);
- void setOriginGlobal(const LLVector3d &origin_global) { mOriginGlobal = origin_global; }
- void setWidth(F32 width);
-
- void setBrightness(F32 brightness);
- void setSunColor(const LLColor4 &color);
-
- F32 getDensityRegion(const LLVector3 &pos_region); // "position" is in local coordinates
-
- void decompress(LLBitPack &bitpack, LLGroupHeader *group_header);
-
- LLCloudLayer* getNeighbor(const S32 n) const { return mNeighbors[n]; }
-
- void connectNeighbor(LLCloudLayer *cloudp, U32 direction);
- void disconnectNeighbor(U32 direction);
- void disconnectAllNeighbors();
-
-public:
- LLVector3d mOriginGlobal;
- F32 mMetersPerEdge;
- F32 mMetersPerGrid;
-
-
- F32 mMaxAlpha; // The max cloud puff _render_ alpha
-
-protected:
- LLCloudLayer *mNeighbors[4];
- LLWind *mWindp;
- LLViewerRegion *mRegionp;
- F32 *mDensityp; // the probability density grid
-
- LLCloudGroup mCloudGroups[CLOUD_GROUPS_PER_EDGE][CLOUD_GROUPS_PER_EDGE];
-};
-
-
-#endif
diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp
new file mode 100644
index 0000000000..347a467a8b
--- /dev/null
+++ b/indra/newview/lldaycyclemanager.cpp
@@ -0,0 +1,230 @@
+/**
+ * @file lldaycyclemanager.cpp
+ * @brief Implementation for the LLDayCycleManager class.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "lldaycyclemanager.h"
+
+#include "lldiriterator.h"
+
+void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const
+{
+ names.clear();
+
+ for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it)
+ {
+ names.push_back(it->first);
+ }
+}
+
+void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const
+{
+ user.clear();
+ sys.clear();
+
+ for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it)
+ {
+ const std::string& name = it->first;
+
+ if (isSystemPreset(name))
+ {
+ sys.push_back(name);
+ }
+ else
+ {
+ user.push_back(name);
+ }
+ }
+}
+
+void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const
+{
+ preset_name_list_t sys; // unused
+ getPresetNames(user, sys);
+}
+
+bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycle) const
+{
+ dc_map_t::const_iterator it = mDayCycleMap.find(name);
+ if (it == mDayCycleMap.end())
+ {
+ return false;
+ }
+
+ day_cycle = it->second;
+ return true;
+}
+
+bool LLDayCycleManager::getPreset(const std::string name, LLSD& day_cycle) const
+{
+ LLWLDayCycle dc;
+ if (!getPreset(name, dc))
+ {
+ return false;
+ }
+
+ day_cycle = dc.asLLSD();
+ return true;
+}
+
+bool LLDayCycleManager::presetExists(const std::string name) const
+{
+ LLWLDayCycle dummy;
+ return getPreset(name, dummy);
+}
+
+bool LLDayCycleManager::isSystemPreset(const std::string& name) const
+{
+ return gDirUtilp->fileExists(getSysDir() + LLURI::escape(name) + ".xml");
+}
+
+bool LLDayCycleManager::savePreset(const std::string& name, const LLSD& data)
+{
+ // Save given preset.
+ LLWLDayCycle day;
+ day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL);
+ day.save(getUserDir() + LLURI::escape(name) + ".xml");
+
+ // Add it to our map.
+ addPreset(name, data);
+ mModifySignal();
+ return true;
+}
+
+bool LLDayCycleManager::deletePreset(const std::string& name)
+{
+ // Remove it from the map.
+ dc_map_t::iterator it = mDayCycleMap.find(name);
+ if (it == mDayCycleMap.end())
+ {
+ LL_WARNS("Windlight") << "No day cycle named " << name << LL_ENDL;
+ return false;
+ }
+ mDayCycleMap.erase(it);
+
+ // Remove from the filesystem.
+ std::string filename = LLURI::escape(name) + ".xml";
+ if (gDirUtilp->fileExists(getUserDir() + filename))
+ {
+ gDirUtilp->deleteFilesInDir(getUserDir(), filename);
+ }
+
+ // Signal interested parties.
+ mModifySignal();
+ return true;
+}
+
+bool LLDayCycleManager::isSkyPresetReferenced(const std::string& preset_name) const
+{
+ // We're traversing local day cycles, they can only reference local skies.
+ LLWLParamKey key(preset_name, LLEnvKey::SCOPE_LOCAL);
+
+ for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it)
+ {
+ if (it->second.hasReferencesTo(key))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+boost::signals2::connection LLDayCycleManager::setModifyCallback(const modify_signal_t::slot_type& cb)
+{
+ return mModifySignal.connect(cb);
+}
+
+// virtual
+void LLDayCycleManager::initSingleton()
+{
+ LL_DEBUGS("Windlight") << "Loading all day cycles" << LL_ENDL;
+ loadAllPresets();
+}
+
+void LLDayCycleManager::loadAllPresets()
+{
+ mDayCycleMap.clear();
+
+ // First, load system (coming out of the box) day cycles.
+ loadPresets(getSysDir());
+
+ // Then load user presets. Note that user day cycles will modify any system ones already loaded.
+ loadPresets(getUserDir());
+}
+
+void LLDayCycleManager::loadPresets(const std::string& dir)
+{
+ LLDirIterator dir_iter(dir, "*.xml");
+
+ while (1)
+ {
+ std::string file;
+ if (!dir_iter.next(file)) break; // no more files
+ loadPreset(dir + file);
+ }
+}
+
+bool LLDayCycleManager::loadPreset(const std::string& path)
+{
+ LLSD data = LLWLDayCycle::loadDayCycleFromPath(path);
+ if (data.isUndefined())
+ {
+ llwarns << "Error loading day cycle from " << path << llendl;
+ return false;
+ }
+
+ std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
+ addPreset(name, data);
+
+ return true;
+}
+
+bool LLDayCycleManager::addPreset(const std::string& name, const LLSD& data)
+{
+ if (name.empty())
+ {
+ llassert(name.empty());
+ return false;
+ }
+
+ LLWLDayCycle day;
+ day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL);
+ mDayCycleMap[name] = day;
+ return true;
+}
+
+// static
+std::string LLDayCycleManager::getSysDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", "");
+}
+
+// static
+std::string LLDayCycleManager::getUserDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/days", "");
+}
diff --git a/indra/newview/lldaycyclemanager.h b/indra/newview/lldaycyclemanager.h
new file mode 100644
index 0000000000..3d2144960d
--- /dev/null
+++ b/indra/newview/lldaycyclemanager.h
@@ -0,0 +1,84 @@
+/**
+ * @file lldaycyclemanager.h
+ * @brief Implementation for the LLDayCycleManager class.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLDAYCYCLEMANAGER_H
+#define LL_LLDAYCYCLEMANAGER_H
+
+#include <map>
+#include <string>
+
+#include "llwldaycycle.h"
+#include "llwlparammanager.h"
+
+/**
+ * WindLight day cycles manager class
+ *
+ * Provides interface for accessing, loading and saving day cycles.
+ */
+class LLDayCycleManager : public LLSingleton<LLDayCycleManager>
+{
+ LOG_CLASS(LLDayCycleManager);
+
+public:
+ typedef std::list<std::string> preset_name_list_t;
+
+ typedef std::map<std::string, LLWLDayCycle> dc_map_t;
+ typedef boost::signals2::signal<void()> modify_signal_t;
+
+ void getPresetNames(preset_name_list_t& names) const;
+ void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const;
+ void getUserPresetNames(preset_name_list_t& user) const;
+
+ bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const;
+ bool getPreset(const std::string name, LLSD& day_cycle) const;
+ bool presetExists(const std::string name) const;
+ bool isSystemPreset(const std::string& name) const;
+ bool savePreset(const std::string& name, const LLSD& data);
+ bool deletePreset(const std::string& name);
+
+ /// @return true if there is a day cycle that refers to the sky preset.
+ bool isSkyPresetReferenced(const std::string& preset_name) const;
+
+ /// Emitted when a preset gets added or deleted.
+ boost::signals2::connection setModifyCallback(const modify_signal_t::slot_type& cb);
+
+private:
+ friend class LLSingleton<LLDayCycleManager>;
+ /*virtual*/ void initSingleton();
+
+ void loadAllPresets();
+ void loadPresets(const std::string& dir);
+ bool loadPreset(const std::string& path);
+ bool addPreset(const std::string& name, const LLSD& data);
+
+ static std::string getSysDir();
+ static std::string getUserDir();
+
+ dc_map_t mDayCycleMap;
+ modify_signal_t mModifySignal;
+};
+
+#endif // LL_LLDAYCYCLEMANAGER_H
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index ad3710843c..debac9dcbf 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -387,7 +387,6 @@ void LLDrawable::makeActive()
pcode == LLViewerObject::LL_VO_SURFACE_PATCH ||
pcode == LLViewerObject::LL_VO_PART_GROUP ||
pcode == LLViewerObject::LL_VO_HUD_PART_GROUP ||
- pcode == LLViewerObject::LL_VO_CLOUDS ||
pcode == LLViewerObject::LL_VO_GROUND ||
pcode == LLViewerObject::LL_VO_SKY)
{
@@ -1519,10 +1518,6 @@ BOOL LLDrawable::isAnimating() const
{
return TRUE;
}
- if (mVObjp->getPCode() == LLViewerObject::LL_VO_CLOUDS)
- {
- return TRUE;
- }
if (!isRoot() && !mVObjp->getAngularVelocity().isExactlyZero())
{
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index f5483d969d..fa7d6e2a40 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -35,7 +35,6 @@
#include "lldrawpoolalpha.h"
#include "lldrawpoolavatar.h"
#include "lldrawpoolbump.h"
-#include "lldrawpoolclouds.h"
#include "lldrawpoolground.h"
#include "lldrawpoolsimple.h"
#include "lldrawpoolsky.h"
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 8d46133912..5e4d5319ec 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -359,7 +359,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
bool draw_glow_for_this_partition = mVertexShaderLevel > 0 && // no shaders = no glow.
// All particle systems seem to come off the wire with texture entries which claim that they glow. This is probably a bug in the data. Suppress.
group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_PARTICLE &&
- group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_CLOUD &&
group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD_PARTICLE;
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
diff --git a/indra/newview/lldrawpoolclouds.cpp b/indra/newview/lldrawpoolclouds.cpp
deleted file mode 100644
index 5db1d8cfed..0000000000
--- a/indra/newview/lldrawpoolclouds.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file lldrawpoolclouds.cpp
- * @brief LLDrawPoolClouds class implementation
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "lldrawpoolclouds.h"
-
-#include "llface.h"
-#include "llsky.h"
-#include "llviewercamera.h"
-#include "llvoclouds.h"
-#include "pipeline.h"
-
-LLDrawPoolClouds::LLDrawPoolClouds() :
- LLDrawPool(POOL_CLOUDS)
-{
-}
-
-LLDrawPool *LLDrawPoolClouds::instancePool()
-{
- return new LLDrawPoolClouds();
-}
-
-BOOL LLDrawPoolClouds::addFace(LLFace* face)
-{
- llerrs << "WTF?" << llendl;
- return FALSE;
-}
-
-void LLDrawPoolClouds::enqueue(LLFace *facep)
-{
- mDrawFace.push_back(facep);
- facep->mDistance = (facep->mCenterAgent - gCamera->getOrigin()) * gCamera->getAtAxis();
-}
-
-void LLDrawPoolClouds::beginRenderPass(S32 pass)
-{
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
-}
-
-void LLDrawPoolClouds::prerender()
-{
- mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT);
-}
-
-void LLDrawPoolClouds::render(S32 pass)
-{
- LLFastTimer ftm(LLFastTimer::FTM_RENDER_CLOUDS);
- if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
- {
- return;
- }
-
- if (mDrawFace.empty())
- {
- return;
- }
-
- LLGLSPipelineAlpha gls_pipeline_alpha;
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- glAlphaFunc(GL_GREATER,0.01f);
-
- gPipeline.enableLightsFullbright(LLColor4(1.f,1.f,1.f));
-
- mDrawFace[0]->bindTexture();
-
- std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater());
-
- drawLoop();
-}
-
-
diff --git a/indra/newview/lldrawpoolclouds.h b/indra/newview/lldrawpoolclouds.h
deleted file mode 100644
index 019f11a795..0000000000
--- a/indra/newview/lldrawpoolclouds.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file lldrawpoolclouds.h
- * @brief LLDrawPoolClouds class definition
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLDRAWPOOLCLOUDS_H
-#define LL_LLDRAWPOOLCLOUDS_H
-
-#include "lldrawpool.h"
-
-class LLDrawPoolClouds : public LLDrawPool
-{
-public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0
- };
-
- BOOL addFace(LLFace* face);
- virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
-
- LLDrawPoolClouds();
-
- /*virtual*/ void prerender();
- /*virtual*/ LLDrawPool *instancePool();
- /*virtual*/ void enqueue(LLFace *face);
- /*virtual*/ void beginRenderPass(S32 pass);
- /*virtual*/ void render(S32 pass = 0);
-};
-
-#endif // LL_LLDRAWPOOLSKY_H
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index dc94924da4..31c14361b5 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -108,7 +108,7 @@ void LLDrawPoolWater::prerender()
// got rid of modulation by light color since it got a little too
// green at sunset and sl-57047 (underwater turns black at 8:00)
- sWaterFogColor = LLWaterParamManager::instance()->getFogColor();
+ sWaterFogColor = LLWaterParamManager::instance().getFogColor();
sWaterFogColor.mV[3] = 0;
}
@@ -527,7 +527,7 @@ void LLDrawPoolWater::shade()
//bind normal map
S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP);
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = &LLWaterParamManager::instance();
// change mWaterNormp if needed
if (mWaterNormp->getID() != param_mgr->getNormalMapID())
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 409b18d522..bf79c2100c 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -34,6 +34,8 @@
#include "llviewercamera.h"
#include "llimage.h"
#include "llwlparammanager.h"
+#include "llviewershadermgr.h"
+#include "llglslshader.h"
#include "llsky.h"
#include "llvowlsky.h"
#include "llviewerregion.h"
@@ -68,7 +70,7 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE);
- LLWLParamManager::instance()->propagateParameters();
+ LLWLParamManager::getInstance()->propagateParameters();
}
LLDrawPoolWLSky::~LLDrawPoolWLSky()
@@ -178,7 +180,7 @@ void LLDrawPoolWLSky::renderStars(void) const
// clamping and allow the star_alpha param to brighten the stars.
bool error;
LLColor4 star_alpha(LLColor4::black);
- star_alpha.mV[3] = LLWLParamManager::instance()->mCurParams.getFloat("star_brightness", error) / 2.f;
+ star_alpha.mV[3] = LLWLParamManager::getInstance()->mCurParams.getFloat("star_brightness", error) / 2.f;
llassert_always(!error);
gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());
@@ -266,7 +268,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
}
LLFastTimer ftm(FTM_RENDER_WL_SKY);
- const F32 camHeightLocal = LLWLParamManager::instance()->getDomeOffset() * LLWLParamManager::instance()->getDomeRadius();
+ const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius();
LLGLSNoFog disableFog;
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
@@ -313,7 +315,7 @@ void LLDrawPoolWLSky::render(S32 pass)
}
LLFastTimer ftm(FTM_RENDER_WL_SKY);
- const F32 camHeightLocal = LLWLParamManager::instance()->getDomeOffset() * LLWLParamManager::instance()->getDomeRadius();
+ const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius();
LLGLSNoFog disableFog;
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
new file mode 100644
index 0000000000..4051a4d8db
--- /dev/null
+++ b/indra/newview/llenvmanager.cpp
@@ -0,0 +1,1194 @@
+/**
+ * @file llenvmanager.cpp
+ * @brief Implementation of classes managing WindLight and water settings.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llenvmanager.h"
+
+#include "llagent.h"
+#include "llviewerregion.h"
+
+#include "lldaycyclemanager.h"
+#include "llfloaterreg.h"
+#include "llfloaterwindlight.h"
+#include "llfloaterwater.h"
+#include "llfloaterenvsettings.h"
+#include "llwlparammanager.h"
+#include "llwaterparammanager.h"
+#include "llfloaterregioninfo.h"
+//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet)
+#include "llwlhandlers.h"
+#include "llnotifications.h"
+
+extern LLControlGroup gSavedSettings;
+
+/*virtual*/ void LLEnvManager::initSingleton()
+{
+ LL_DEBUGS("Windlight") << "Initializing LLEnvManager" << LL_ENDL;
+
+ mOrigSettingStore[LLEnvKey::SCOPE_LOCAL] = lindenDefaults();
+ mCurNormalScope = (gSavedSettings.getBOOL("UseEnvironmentFromRegion") ? LLEnvKey::SCOPE_REGION : LLEnvKey::SCOPE_LOCAL);
+ mInterpNextChangeMessage = true;
+ mPendingOutgoingMessage = false;
+ mIsEditing = false;
+}
+
+/*******
+ * Region Changes
+ *******/
+
+void LLEnvManager::notifyLogin()
+{
+ changedRegion(false);
+}
+void LLEnvManager::notifyCrossing()
+{
+ changedRegion(true);
+}
+void LLEnvManager::notifyTP()
+{
+ changedRegion(false);
+}
+void LLEnvManager::changedRegion(bool interp)
+{
+ mInterpNextChangeMessage = interp;
+ mPendingOutgoingMessage = false;
+
+ LLFloaterReg::hideInstance("old_env_settings");
+ LLFloaterReg::hideInstance("env_settings");
+
+ resetInternalsToDefault(LLEnvKey::SCOPE_REGION);
+
+ maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false);
+}
+
+/*******
+ * Editing settings / UI mode
+ *******/
+
+void LLEnvManager::startEditingScope(LLEnvKey::EScope scope)
+{
+ LL_DEBUGS("Windlight") << "Starting editing scope " << scope << LL_ENDL;
+
+ if (mIsEditing)
+ {
+ LL_WARNS("Windlight") << "Tried to start editing windlight settings while already editing some settings (possibly others)! Ignoring..." << LL_ENDL;
+ return;
+ }
+ if (!canEdit(scope))
+ {
+ LL_WARNS("Windlight") << "Tried to start editing windlight settings while not allowed to! Ignoring..." << LL_ENDL;
+ return;
+ }
+
+ mIsEditing = true;
+ mCurEditingScope = scope;
+
+ // Back up local settings so that we can switch back to them later.
+ if (scope != LLEnvKey::SCOPE_LOCAL)
+ {
+ backUpLocalSettingsIfNeeded();
+ }
+
+ // show scope being edited
+ loadSettingsIntoManagers(scope, false);
+
+ switch (scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ // not implemented here (yet)
+ return;
+ case LLEnvKey::SCOPE_REGION:
+ /* LLPanelRegionTerrainInfo::instance()->setCommitControls(true); the windlight settings are no longer on the region terrain panel */
+ break;
+ default:
+ return;
+ }
+}
+
+void LLEnvManager::maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit)
+{
+ if (mIsEditing && mCurEditingScope == scope)
+ {
+ maybeClearEditingScope(user_initiated, was_commit); // handles UI, updating managers, etc.
+ }
+}
+
+void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit)
+{
+ bool clear_now = true;
+ if (mIsEditing && !was_commit)
+ {
+ if(user_initiated)
+ {
+ LLSD args;
+ args["SCOPE"] = getScopeString(mCurEditingScope);
+ LLNotifications::instance().add("EnvEditUnsavedChangesCancel", args, LLSD(),
+ boost::bind(&LLEnvManager::clearEditingScope, this, _1, _2));
+ clear_now = false;
+ }
+ else
+ {
+ LLNotifications::instance().add("EnvEditExternalCancel", LLSD(), LLSD());
+ }
+ }
+
+ if(clear_now)
+ {
+ clearEditingScope(LLSD(), LLSD());
+ }
+}
+
+void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& response)
+{
+ if(notification.isDefined() && response.isDefined() && LLNotification::getSelectedOption(notification, response) != 0)
+ {
+#if 0
+ // *TODO: select terrain panel here
+ mIsEditing = false;
+ LLFloaterReg::showTypedInstance<LLFloaterRegionInfo>("regioninfo");
+#endif
+ return;
+ }
+
+ mIsEditing = false;
+
+ updateUIFromEditability();
+ /* LLPanelRegionTerrainInfo::instance()->cancelChanges(); the terrain panel no longer has windlight data - if this is needed, it should move. */
+
+ loadSettingsIntoManagers(mCurNormalScope, true);
+}
+
+void LLEnvManager::updateUIFromEditability()
+{
+ // *TODO When the checkbox from LLFloaterEnvSettings is moved elsewhere, opening the local environment settings window should auto-display local settings
+ // Currently, disable all editing to ensure region settings are hidden from those that can't edit them (to preserve possibility of future tradable assets)
+ // Remove "!gSavedSettings.getBOOL(...)" when the desired behavior is implemented
+// LLFloaterEnvSettings::instance()->setControlsEnabled(canEdit(LLEnvKey::SCOPE_LOCAL) && !gSavedSettings.getBOOL("UseEnvironmentFromRegion"));
+// LLPanelRegionTerrainInfo::instance()->setEnvControls(canEdit(LLEnvKey::SCOPE_REGION));
+ // enable estate UI iff canEdit(LLEnvKey::SCOPE_ESTATE), etc.
+}
+
+bool LLEnvManager::regionCapable()
+{
+ return !gAgent.getRegion()->getCapability("EnvironmentSettings").empty();
+}
+
+const std::string LLEnvManager::getScopeString(LLEnvKey::EScope scope)
+{
+ switch(scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ return LLTrans::getString("LocalSettings");
+ case LLEnvKey::SCOPE_REGION:
+ return LLTrans::getString("RegionSettings");
+ default:
+ return " (?)";
+ }
+}
+
+bool LLEnvManager::canEdit(LLEnvKey::EScope scope)
+{
+ // can't edit while a message is being sent or if already editing
+ if (mPendingOutgoingMessage || mIsEditing)
+ {
+ return false;
+ }
+
+ // check permissions and caps
+ switch (scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ return true; // always permitted to edit local
+ case LLEnvKey::SCOPE_REGION:
+ bool owner_or_god_or_manager;
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (NULL == region || region->getCapability("EnvironmentSettings").empty())
+ {
+ // not a windlight-aware region
+ return false;
+ }
+ owner_or_god_or_manager = gAgent.isGodlike()
+ || (region && (region->getOwner() == gAgent.getID()))
+ || (region && region->isEstateManager());
+ }
+ return owner_or_god_or_manager;
+ default:
+ return false;
+ }
+}
+
+/*******
+ * Incoming Messaging
+ *******/
+
+void LLEnvManager::refreshFromStorage(LLEnvKey::EScope scope)
+{
+ // Back up local env. settings so that we can switch to them later.
+ if (scope != LLEnvKey::SCOPE_LOCAL)
+ {
+ backUpLocalSettingsIfNeeded();
+ }
+
+ switch (scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ if (!LLEnvironmentRequest::initiate())
+ {
+ // don't have a cap for this, presume invalid response
+ processIncomingMessage(LLSD(), scope);
+ }
+ break;
+ default:
+ processIncomingMessage(LLSD(), scope);
+ break;
+ }
+}
+
+bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const LLEnvKey::EScope scope)
+{
+ if (scope != LLEnvKey::SCOPE_REGION)
+ {
+ return false;
+ }
+
+ // Start out with defaults
+ resetInternalsToDefault(scope);
+ updateUIFromEditability();
+
+ // Validate
+ //std::set<std::string> empty_set;
+ //LLWLPacketScrubber scrubber(scope, empty_set);
+ //LLSD windlight_llsd = scrubber.scrub(unvalidated_content);
+
+ //bool valid = windlight_llsd.isDefined(); // successful scrub
+
+ // *HACK - Don't have the validator, so just use content without validating. Should validate here for third-party grids.
+ LLSD windlight_llsd(unvalidated_content);
+ bool valid = true;
+ // end HACK
+
+ mLastReceivedID = unvalidated_content[0]["messageID"].asUUID(); // if the message was valid, grab the UUID from it and save it for next outbound update message
+ LL_DEBUGS("Windlight Sync") << "mLastReceivedID: " << mLastReceivedID << LL_ENDL;
+ LL_DEBUGS("Windlight Sync") << "windlight_llsd: " << windlight_llsd << LL_ENDL;
+
+ if (valid)
+ {
+ // TODO - the sun controls are moving; this should be updated
+ F32 sun_hour = 0;
+ LLPanelRegionTerrainInfo* terrain_panel = LLPanelRegionTerrainInfo::instance();
+
+ if (terrain_panel)
+ {
+ sun_hour = terrain_panel->getSunHour(); // this slider is kept up to date
+ }
+ else
+ {
+ llwarns << "Cannot instantiate the terrain panel (exiting?)" << llendl;
+ }
+
+ LLWLParamManager::getInstance()->addAllSkies(scope, windlight_llsd[2]);
+ LLEnvironmentSettings newSettings(windlight_llsd[1], windlight_llsd[2], windlight_llsd[3], sun_hour);
+ mOrigSettingStore[scope] = newSettings;
+ }
+ else
+ {
+ LL_WARNS("Windlight Sync") << "Failed to parse windlight settings!" << LL_ENDL;
+ // presume defaults (already reset above)
+ }
+
+ maybeClearEditingScope(scope, false, false);
+
+ // refresh display with new settings, if applicable
+ if (mCurNormalScope == scope && !mIsEditing) // if mIsEditing still, must be editing some other scope, so don't load
+ {
+ loadSettingsIntoManagers(scope, mInterpNextChangeMessage);
+ }
+ else
+ {
+ LL_DEBUGS("Windlight Sync") << "Not loading settings (mCurNormalScope=" << mCurNormalScope << ", scope=" << scope << ", mIsEditing=" << mIsEditing << ")" << LL_ENDL;
+ }
+
+ mInterpNextChangeMessage = true; // reset flag
+
+ return valid;
+}
+
+
+/*******
+ * Outgoing Messaging
+ *******/
+
+void LLEnvManager::commitSettings(LLEnvKey::EScope scope)
+{
+ LL_DEBUGS("Windlight Sync") << "commitSettings(scope = " << scope << ")" << LL_ENDL;
+
+ bool success = true;
+ switch (scope)
+ {
+ case (LLEnvKey::SCOPE_LOCAL):
+ // not implemented - LLWLParamManager and LLWaterParamManager currently manage local storage themselves
+ break;
+ case (LLEnvKey::SCOPE_REGION):
+ mPendingOutgoingMessage = true;
+ LLSD metadata(LLSD::emptyMap());
+ metadata["regionID"] = gAgent.getRegion()->getRegionID();
+ metadata["messageID"] = mLastReceivedID; // add last received update ID to outbound message so simulator can handle concurrent updates
+
+ saveSettingsFromManagers(scope); // save current settings into settings store before grabbing from settings store and sending
+ success = LLEnvironmentApply::initiateRequest(makePacket(LLEnvKey::SCOPE_REGION, metadata));
+ if(success)
+ {
+ // while waiting for the return message, render old settings
+ // (as of Aug 09, we should get an updated RegionInfo packet, which triggers a re-request of Windlight data, which causes us to show new settings)
+ loadSettingsIntoManagers(LLEnvKey::SCOPE_REGION, true);
+ }
+ break;
+ }
+
+ if(success)
+ {
+ // with mPendingOutgoingMessage = true, nothing is editable
+ updateUIFromEditability();
+ maybeClearEditingScope(true, true);
+ }
+ else
+ {
+ mPendingOutgoingMessage = false;
+ }
+}
+
+LLSD LLEnvManager::makePacket(LLEnvKey::EScope scope, const LLSD& metadata)
+{
+ return mOrigSettingStore[scope].makePacket(metadata);
+}
+
+void LLEnvManager::commitSettingsFinished(LLEnvKey::EScope scope)
+{
+ mPendingOutgoingMessage = false;
+
+ updateUIFromEditability();
+}
+
+void LLEnvManager::applyLocalSettingsToRegion()
+{
+ // Immediately apply current environment settings to region.
+ LLEnvManager::instance().commitSettings(LLEnvKey::SCOPE_REGION);
+}
+
+/*******
+ * Loading defaults
+ *******/
+
+void LLEnvManager::resetInternalsToDefault(LLEnvKey::EScope scope)
+{
+ if (LLEnvKey::SCOPE_LOCAL != scope)
+ {
+ LLWLParamManager::getInstance()->clearParamSetsOfScope(scope);
+ }
+
+ mOrigSettingStore[scope] = lindenDefaults();
+ LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN);
+}
+
+const LLEnvironmentSettings& LLEnvManager::lindenDefaults()
+{
+ static bool loaded = false;
+ static LLEnvironmentSettings defSettings;
+
+ if (!loaded)
+ {
+ LLWaterParamSet defaultWater;
+ LLWaterParamManager::instance().getParamSet("default", defaultWater);
+
+ // *TODO save default skies (remove hack in LLWLDayCycle::loadDayCycle when this is done)
+
+ defSettings.saveParams(
+ LLWLDayCycle::loadCycleDataFromFile("default.xml"), // frames will refer to local presets, which is okay
+ LLSD(LLSD::emptyMap()), // should never lose the default sky presets (read-only)
+ defaultWater.getAll(),
+ 0.0);
+
+ loaded = true;
+ }
+
+ return defSettings;
+}
+
+/*******
+ * Manipulation of Param Managers
+ *******/
+
+void LLEnvManager::loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate)
+{
+ LL_DEBUGS("Windlight Sync") << "Loading settings (scope = " << scope << ")" << LL_ENDL;
+
+ LLEnvironmentSettings settings = mOrigSettingStore[scope];
+
+ if(interpolate)
+ {
+ LLWLParamManager::getInstance()->mAnimator.startInterpolation(settings.getWaterParams());
+ }
+
+ LLWLParamManager::getInstance()->addAllSkies(scope, settings.getSkyMap());
+ LLWLParamManager::getInstance()->mDay.loadDayCycle(settings.getWLDayCycle(), scope);
+ LLWLParamManager::getInstance()->resetAnimator(settings.getDayTime(), true);
+
+ LLWaterParamManager::getInstance()->mCurParams.setAll(settings.getWaterParams());
+}
+
+void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope)
+{
+ LL_DEBUGS("Windlight Sync") << "Saving settings (scope = " << scope << ")" << LL_ENDL;
+ switch (scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ mOrigSettingStore[scope].saveParams(
+ LLWLParamManager::getInstance()->mDay.asLLSD(),
+ LLSD(LLSD::emptyMap()), // never overwrite
+ LLWaterParamManager::getInstance()->mCurParams.getAll(),
+ LLWLParamManager::getInstance()->mAnimator.mDayTime);
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ {
+ // ensure only referenced region-scope skies are saved, resolve naming collisions, etc.
+ std::map<LLWLParamKey, LLWLParamSet> final_references = LLWLParamManager::getInstance()->finalizeFromDayCycle(scope);
+ LLSD referenced_skies = LLWLParamManager::createSkyMap(final_references);
+
+ LL_DEBUGS("Windlight Sync") << "Dumping referenced skies (" << final_references.size() << ") to LLSD: " << referenced_skies << LL_ENDL;
+
+ mOrigSettingStore[scope].saveParams(
+ LLWLParamManager::getInstance()->mDay.asLLSD(),
+ referenced_skies,
+ LLWaterParamManager::getInstance()->mCurParams.getAll(),
+ LLWLParamManager::getInstance()->mAnimator.mDayTime);
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+void LLEnvManager::backUpLocalSettingsIfNeeded()
+{
+ // *HACK: Back up local env. settings so that we can switch to them later.
+ // Otherwise local day cycle is likely to be reset.
+ static bool sSavedLocalSettings = false;
+
+ if (!sSavedLocalSettings)
+ {
+ LL_DEBUGS("Windlight") << "Backing up local environment settings" << LL_ENDL;
+ saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL);
+ sSavedLocalSettings = true;
+ }
+}
+
+/*******
+ * Setting desired display level
+ *******/
+
+void LLEnvManager::setNormallyDisplayedScope(LLEnvKey::EScope new_scope)
+{
+ // temp, just save the scope directly as a value in the future when there's more than two
+ bool want_region = (LLEnvKey::SCOPE_REGION == new_scope);
+ gSavedSettings.setBOOL("UseEnvironmentFromRegion", want_region);
+
+ if (mCurNormalScope != new_scope)
+ {
+ LL_INFOS("Windlight") << "Switching to scope " << new_scope << LL_ENDL;
+ mCurNormalScope = new_scope;
+ notifyOptInChange();
+ }
+}
+
+LLEnvKey::EScope LLEnvManager::getNormallyDisplayedScope() const
+{
+ return mCurNormalScope;
+}
+
+void LLEnvManager::notifyOptInChange()
+{
+ bool opt_in = gSavedSettings.getBOOL("UseEnvironmentFromRegion");
+
+ // Save local settings if switching to region
+ if(opt_in)
+ {
+ LL_INFOS("Windlight") << "Saving currently-displayed settings as current local settings..." << LL_ENDL;
+ saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL);
+ }
+
+ maybeClearEditingScope(true, false);
+}
+
+void LLEnvManager::dumpScopes()
+{
+ LLSD scope_dump;
+
+ scope_dump = makePacket(LLEnvKey::SCOPE_LOCAL, LLSD());
+ LL_DEBUGS("Windlight") << "Local scope:" << scope_dump << LL_ENDL;
+
+ scope_dump = makePacket(LLEnvKey::SCOPE_REGION, LLSD());
+ LL_DEBUGS("Windlight") << "Region scope:" << scope_dump << LL_ENDL;
+}
+
+
+//=============================================================================
+
+std::string LLEnvPrefs::getWaterPresetName() const
+{
+ if (mWaterPresetName.empty())
+ {
+ llwarns << "Water preset name is empty" << llendl;
+ }
+
+ return mWaterPresetName;
+}
+
+std::string LLEnvPrefs::getSkyPresetName() const
+{
+ if (mSkyPresetName.empty())
+ {
+ llwarns << "Sky preset name is empty" << llendl;
+ }
+
+ return mSkyPresetName;
+}
+
+std::string LLEnvPrefs::getDayCycleName() const
+{
+ if (mDayCycleName.empty())
+ {
+ llwarns << "Day cycle name is empty" << llendl;
+ }
+
+ return mDayCycleName;
+}
+
+void LLEnvPrefs::setUseRegionSettings(bool val)
+{
+ mUseRegionSettings = val;
+}
+
+void LLEnvPrefs::setUseWaterPreset(const std::string& name)
+{
+ mUseRegionSettings = false;
+ mWaterPresetName = name;
+}
+
+void LLEnvPrefs::setUseSkyPreset(const std::string& name)
+{
+ mUseRegionSettings = false;
+ mUseDayCycle = false;
+ mSkyPresetName = name;
+}
+
+void LLEnvPrefs::setUseDayCycle(const std::string& name)
+{
+ mUseRegionSettings = false;
+ mUseDayCycle = true;
+ mDayCycleName = name;
+}
+
+//=============================================================================
+LLEnvManagerNew::LLEnvManagerNew()
+{
+ mInterpNextChangeMessage = true;
+
+ // Set default environment settings.
+ mUserPrefs.mUseRegionSettings = true;
+ mUserPrefs.mUseDayCycle = true;
+ mUserPrefs.mWaterPresetName = "Default";
+ mUserPrefs.mSkyPresetName = "Default";
+ mUserPrefs.mDayCycleName = "Default";
+}
+
+bool LLEnvManagerNew::getUseRegionSettings() const
+{
+ return mUserPrefs.getUseRegionSettings();
+}
+
+bool LLEnvManagerNew::getUseDayCycle() const
+{
+ return mUserPrefs.getUseDayCycle();
+}
+
+bool LLEnvManagerNew::getUseFixedSky() const
+{
+ return mUserPrefs.getUseFixedSky();
+}
+
+std::string LLEnvManagerNew::getWaterPresetName() const
+{
+ return mUserPrefs.getWaterPresetName();
+}
+
+std::string LLEnvManagerNew::getSkyPresetName() const
+{
+ return mUserPrefs.getSkyPresetName();
+}
+
+std::string LLEnvManagerNew::getDayCycleName() const
+{
+ return mUserPrefs.getDayCycleName();
+}
+
+const LLEnvironmentSettings& LLEnvManagerNew::getRegionSettings() const
+{
+ return !mNewRegionPrefs.isEmpty() ? mNewRegionPrefs : mCachedRegionPrefs;
+}
+
+void LLEnvManagerNew::setRegionSettings(const LLEnvironmentSettings& new_settings)
+{
+ // Set region settings override that will be used locally
+ // until user either uploads the changes or goes to another region.
+ mNewRegionPrefs = new_settings;
+}
+
+bool LLEnvManagerNew::usePrefs()
+{
+ LL_DEBUGS("Windlight") << "Displaying preferred environment" << LL_ENDL;
+ updateManagersFromPrefs(false);
+ return true;
+}
+
+bool LLEnvManagerNew::useDefaults()
+{
+ bool rslt;
+
+ rslt = useDefaultWater();
+ rslt &= useDefaultSky();
+
+ return rslt;
+}
+
+bool LLEnvManagerNew::useRegionSettings()
+{
+ bool rslt;
+
+ rslt = useRegionSky();
+ rslt &= useRegionWater();
+
+ return rslt;
+}
+
+bool LLEnvManagerNew::useWaterPreset(const std::string& name)
+{
+ LL_DEBUGS("Windlight") << "Displaying water preset " << name << LL_ENDL;
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ bool rslt = water_mgr.getParamSet(name, water_mgr.mCurParams);
+ llassert(rslt == true);
+ return rslt;
+}
+
+bool LLEnvManagerNew::useWaterParams(const LLSD& params)
+{
+ LL_DEBUGS("Windlight") << "Displaying water params" << LL_ENDL;
+ LLWaterParamManager::instance().mCurParams.setAll(params);
+ return true;
+}
+
+bool LLEnvManagerNew::useSkyPreset(const std::string& name)
+{
+ LLWLParamManager& sky_mgr = LLWLParamManager::instance();
+ LLWLParamSet param_set;
+
+ if (!sky_mgr.getParamSet(LLWLParamKey(name, LLEnvKey::SCOPE_LOCAL), param_set))
+ {
+ llwarns << "No sky preset named " << name << llendl;
+ return false;
+ }
+
+ LL_DEBUGS("Windlight") << "Displaying sky preset " << name << LL_ENDL;
+ sky_mgr.applySkyParams(param_set.getAll());
+ return true;
+}
+
+bool LLEnvManagerNew::useSkyParams(const LLSD& params)
+{
+ LL_DEBUGS("Windlight") << "Displaying sky params" << LL_ENDL;
+ LLWLParamManager::instance().applySkyParams(params);
+ return true;
+}
+
+bool LLEnvManagerNew::useDayCycle(const std::string& name, LLEnvKey::EScope scope)
+{
+ LLSD params;
+
+ if (scope == LLEnvKey::SCOPE_REGION)
+ {
+ LL_DEBUGS("Windlight") << "Displaying region day cycle " << name << LL_ENDL;
+ params = getRegionSettings().getWLDayCycle();
+ }
+ else
+ {
+ LL_DEBUGS("Windlight") << "Displaying local day cycle " << name << LL_ENDL;
+
+ if (!LLDayCycleManager::instance().getPreset(name, params))
+ {
+ llwarns << "No day cycle named " << name << llendl;
+ return false;
+ }
+ }
+
+ bool rslt = LLWLParamManager::instance().applyDayCycleParams(params, scope);
+ llassert(rslt == true);
+ return rslt;
+}
+
+bool LLEnvManagerNew::useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time /* = 0.5*/)
+{
+ LL_DEBUGS("Windlight") << "Displaying day cycle params" << LL_ENDL;
+ return LLWLParamManager::instance().applyDayCycleParams(params, scope);
+}
+
+void LLEnvManagerNew::setUseRegionSettings(bool val)
+{
+ mUserPrefs.setUseRegionSettings(val);
+ saveUserPrefs();
+ updateManagersFromPrefs(false);
+}
+
+void LLEnvManagerNew::setUseWaterPreset(const std::string& name)
+{
+ // *TODO: make sure the preset exists.
+ if (name.empty())
+ {
+ llwarns << "Empty water preset name passed" << llendl;
+ return;
+ }
+
+ mUserPrefs.setUseWaterPreset(name);
+ saveUserPrefs();
+ updateManagersFromPrefs(false);
+}
+
+void LLEnvManagerNew::setUseSkyPreset(const std::string& name)
+{
+ // *TODO: make sure the preset exists.
+ if (name.empty())
+ {
+ llwarns << "Empty sky preset name passed" << llendl;
+ return;
+ }
+
+ mUserPrefs.setUseSkyPreset(name);
+ saveUserPrefs();
+ updateManagersFromPrefs(false);
+}
+
+void LLEnvManagerNew::setUseDayCycle(const std::string& name)
+{
+ if (!LLDayCycleManager::instance().presetExists(name))
+ {
+ llwarns << "Invalid day cycle name passed" << llendl;
+ return;
+ }
+
+ mUserPrefs.setUseDayCycle(name);
+ saveUserPrefs();
+ updateManagersFromPrefs(false);
+}
+
+void LLEnvManagerNew::loadUserPrefs()
+{
+ // operate on members directly to avoid side effects
+ mUserPrefs.mWaterPresetName = gSavedSettings.getString("WaterPresetName");
+ mUserPrefs.mSkyPresetName = gSavedSettings.getString("SkyPresetName");
+ mUserPrefs.mDayCycleName = gSavedSettings.getString("DayCycleName");
+
+ mUserPrefs.mUseRegionSettings = gSavedSettings.getBOOL("UseEnvironmentFromRegion");
+ mUserPrefs.mUseDayCycle = gSavedSettings.getBOOL("UseDayCycle");
+}
+
+void LLEnvManagerNew::saveUserPrefs()
+{
+ gSavedSettings.setString("WaterPresetName", getWaterPresetName());
+ gSavedSettings.setString("SkyPresetName", getSkyPresetName());
+ gSavedSettings.setString("DayCycleName", getDayCycleName());
+
+ gSavedSettings.setBOOL("UseEnvironmentFromRegion", getUseRegionSettings());
+ gSavedSettings.setBOOL("UseDayCycle", getUseDayCycle());
+
+ mUsePrefsChangeSignal();
+}
+
+void LLEnvManagerNew::setUserPrefs(
+ const std::string& water_preset,
+ const std::string& sky_preset,
+ const std::string& day_cycle_preset,
+ bool use_fixed_sky,
+ bool use_region_settings)
+{
+ // operate on members directly to avoid side effects
+ mUserPrefs.mWaterPresetName = water_preset;
+ mUserPrefs.mSkyPresetName = sky_preset;
+ mUserPrefs.mDayCycleName = day_cycle_preset;
+
+ mUserPrefs.mUseRegionSettings = use_region_settings;
+ mUserPrefs.mUseDayCycle = !use_fixed_sky;
+
+ saveUserPrefs();
+ updateManagersFromPrefs(false);
+}
+
+void LLEnvManagerNew::dumpUserPrefs()
+{
+ LL_DEBUGS("Windlight") << "WaterPresetName: " << gSavedSettings.getString("WaterPresetName") << LL_ENDL;
+ LL_DEBUGS("Windlight") << "SkyPresetName: " << gSavedSettings.getString("SkyPresetName") << LL_ENDL;
+ LL_DEBUGS("Windlight") << "DayCycleName: " << gSavedSettings.getString("DayCycleName") << LL_ENDL;
+
+ LL_DEBUGS("Windlight") << "UseEnvironmentFromRegion: " << gSavedSettings.getBOOL("UseEnvironmentFromRegion") << LL_ENDL;
+ LL_DEBUGS("Windlight") << "UseDayCycle: " << gSavedSettings.getBOOL("UseDayCycle") << LL_ENDL;
+}
+
+void LLEnvManagerNew::dumpPresets()
+{
+ const LLEnvironmentSettings& region_settings = getRegionSettings();
+ std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : "Unknown region";
+
+ // Dump water presets.
+ LL_DEBUGS("Windlight") << "Waters:" << LL_ENDL;
+ if (region_settings.getWaterParams().size() != 0)
+ {
+ LL_DEBUGS("Windlight") << " - " << region_name << LL_ENDL;
+ }
+ LLWaterParamManager::preset_name_list_t water_presets;
+ LLWaterParamManager::instance().getPresetNames(water_presets);
+ for (LLWaterParamManager::preset_name_list_t::const_iterator it = water_presets.begin(); it != water_presets.end(); ++it)
+ {
+ LL_DEBUGS("Windlight") << " - " << *it << LL_ENDL;
+ }
+
+ // Dump sky presets.
+ LL_DEBUGS("Windlight") << "Skies:" << LL_ENDL;
+ LLWLParamManager::preset_key_list_t sky_preset_keys;
+ LLWLParamManager::instance().getPresetKeys(sky_preset_keys);
+ for (LLWLParamManager::preset_key_list_t::const_iterator it = sky_preset_keys.begin(); it != sky_preset_keys.end(); ++it)
+ {
+ std::string preset_name = it->name;
+ std::string item_title;
+
+ if (it->scope == LLEnvKey::SCOPE_LOCAL) // local preset
+ {
+ item_title = preset_name;
+ }
+ else // region preset
+ {
+ item_title = preset_name + " (" + region_name + ")";
+ }
+ LL_DEBUGS("Windlight") << " - " << item_title << LL_ENDL;
+ }
+
+ // Dump day cycles.
+ LL_DEBUGS("Windlight") << "Days:" << LL_ENDL;
+ const LLSD& cur_region_dc = region_settings.getWLDayCycle();
+ if (cur_region_dc.size() != 0)
+ {
+ LL_DEBUGS("Windlight") << " - " << region_name << LL_ENDL;
+ }
+ LLDayCycleManager::preset_name_list_t days;
+ LLDayCycleManager::instance().getPresetNames(days);
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = days.begin(); it != days.end(); ++it)
+ {
+ LL_DEBUGS("Windlight") << " - " << *it << LL_ENDL;
+ }
+}
+
+void LLEnvManagerNew::requestRegionSettings()
+{
+ LLEnvironmentRequest::initiate();
+}
+
+bool LLEnvManagerNew::sendRegionSettings(const LLEnvironmentSettings& new_settings)
+{
+ LLSD metadata;
+
+ metadata["regionID"] = gAgent.getRegion()->getRegionID();
+ // add last received update ID to outbound message so simulator can handle concurrent updates
+ metadata["messageID"] = mLastReceivedID;
+
+ return LLEnvironmentApply::initiateRequest(new_settings.makePacket(metadata));
+}
+
+boost::signals2::connection LLEnvManagerNew::setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb)
+{
+ return mUsePrefsChangeSignal.connect(cb);
+}
+
+boost::signals2::connection LLEnvManagerNew::setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb)
+{
+ return mRegionSettingsChangeSignal.connect(cb);
+}
+
+boost::signals2::connection LLEnvManagerNew::setRegionChangeCallback(const region_change_signal_t::slot_type& cb)
+{
+ return mRegionChangeSignal.connect(cb);
+}
+
+boost::signals2::connection LLEnvManagerNew::setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb)
+{
+ return mRegionSettingsAppliedSignal.connect(cb);
+}
+
+// static
+bool LLEnvManagerNew::canEditRegionSettings()
+{
+ LLViewerRegion* region = gAgent.getRegion();
+ BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID());
+ BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager());
+
+ LL_DEBUGS("Windlight") << "Can edit region settings: " << (bool) owner_or_god_or_manager << LL_ENDL;
+ return owner_or_god_or_manager;
+}
+
+void LLEnvManagerNew::onRegionCrossing()
+{
+ LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL;
+ onRegionChange(true);
+}
+
+void LLEnvManagerNew::onTeleport()
+{
+ LL_DEBUGS("Windlight") << "Teleported" << LL_ENDL;
+ onRegionChange(false);
+}
+
+void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
+{
+ // If the message was valid, grab the UUID from it and save it for next outbound update message.
+ mLastReceivedID = content[0]["messageID"].asUUID();
+
+ // Refresh cached region settings.
+ LL_DEBUGS("Windlight") << "Caching region environment settings: " << content << LL_ENDL;
+ F32 sun_hour = 0; // *TODO
+ LLEnvironmentSettings new_settings(content[1], content[2], content[3], sun_hour);
+ mCachedRegionPrefs = new_settings;
+
+ // Load region sky presets.
+ LLWLParamManager::instance().refreshRegionPresets();
+
+ // If using server settings, update managers.
+ if (getUseRegionSettings())
+ {
+ updateManagersFromPrefs(mInterpNextChangeMessage);
+ }
+
+ // Let interested parties know about the region settings update.
+ mRegionSettingsChangeSignal();
+
+ // reset
+ mInterpNextChangeMessage = false;
+}
+
+void LLEnvManagerNew::onRegionSettingsApplyResponse(bool ok)
+{
+ LL_DEBUGS("Windlight") << "Applying region settings " << (ok ? "succeeded" : "failed") << LL_ENDL;
+
+ // Clear locally modified region settings because they have just been uploaded.
+ mNewRegionPrefs.clear();
+
+ mRegionSettingsAppliedSignal(ok);
+}
+
+//-- private methods ----------------------------------------------------------
+
+// virtual
+void LLEnvManagerNew::initSingleton()
+{
+ LL_DEBUGS("Windlight") << "Initializing LLEnvManagerNew" << LL_ENDL;
+
+ loadUserPrefs();
+}
+
+void LLEnvManagerNew::updateSkyFromPrefs()
+{
+ bool success = true;
+
+ // Sync sky with user prefs.
+ if (getUseRegionSettings()) // apply region-wide settings
+ {
+ success = useRegionSky();
+ }
+ else // apply user-specified settings
+ {
+ if (getUseDayCycle())
+ {
+ success = useDayCycle(getDayCycleName(), LLEnvKey::SCOPE_LOCAL);
+ }
+ else
+ {
+ success = useSkyPreset(getSkyPresetName());
+ }
+ }
+
+ // If something went wrong, fall back to defaults.
+ if (!success)
+ {
+ // *TODO: fix user prefs
+ useDefaultSky();
+ }
+}
+
+void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate)
+{
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ LLSD target_water_params;
+
+ // Determine new water settings based on user prefs.
+
+ {
+ // Fall back to default water.
+ LLWaterParamSet default_water;
+ water_mgr.getParamSet("Default", default_water);
+ target_water_params = default_water.getAll();
+ }
+
+ if (getUseRegionSettings())
+ {
+ // *TODO: make sure whether region settings belong to the current region?
+ const LLSD& region_water_params = getRegionSettings().getWaterParams();
+ if (region_water_params.size() != 0) // region has no water settings
+ {
+ LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL;
+ target_water_params = region_water_params;
+ }
+ else
+ {
+ LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL;
+ }
+ }
+ else
+ {
+ std::string water = getWaterPresetName();
+ LL_DEBUGS("Windlight") << "Applying water preset [" << water << "]" << LL_ENDL;
+ LLWaterParamSet params;
+ if (!water_mgr.getParamSet(water, params))
+ {
+ llwarns << "No water preset named " << water << ", falling back to defaults" << llendl;
+ water_mgr.getParamSet("Default", params);
+
+ // *TODO: Fix user preferences accordingly.
+ }
+ target_water_params = params.getAll();
+ }
+
+ // Sync water with user prefs.
+ water_mgr.applyParams(target_water_params, interpolate);
+}
+
+void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate)
+{
+ // Apply water settings.
+ updateWaterFromPrefs(interpolate);
+
+ // Apply sky settings.
+ updateSkyFromPrefs();
+}
+
+bool LLEnvManagerNew::useRegionSky()
+{
+ const LLEnvironmentSettings& region_settings = getRegionSettings();
+
+ // If region is set to defaults,
+ if (region_settings.getSkyMap().size() == 0)
+ {
+ // well... apply the default sky settings.
+ useDefaultSky();
+ return true;
+ }
+
+ // *TODO: Support fixed sky from region.
+
+ // Otherwise apply region day cycle.
+ LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL;
+ return useDayCycleParams(
+ region_settings.getWLDayCycle(),
+ LLEnvKey::SCOPE_REGION,
+ region_settings.getDayTime());
+}
+
+bool LLEnvManagerNew::useRegionWater()
+{
+ const LLEnvironmentSettings& region_settings = getRegionSettings();
+ const LLSD& region_water = region_settings.getWaterParams();
+
+ // If region is set to defaults,
+ if (region_water.size() == 0)
+ {
+ // well... apply the default water settings.
+ return useDefaultWater();
+ }
+
+ // Otherwise apply region water.
+ LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL;
+ return useWaterParams(region_water);
+}
+
+bool LLEnvManagerNew::useDefaultSky()
+{
+ return useDayCycle("Default", LLEnvKey::SCOPE_LOCAL);
+}
+
+bool LLEnvManagerNew::useDefaultWater()
+{
+ return useWaterPreset("Default");
+}
+
+
+void LLEnvManagerNew::onRegionChange(bool interpolate)
+{
+ // Avoid duplicating region setting requests
+ // by checking whether the region is actually changing.
+ LLViewerRegion* regionp = gAgent.getRegion();
+ LLUUID region_uuid = regionp ? regionp->getRegionID() : LLUUID::null;
+ if (region_uuid == mCurRegionUUID)
+ {
+ return;
+ }
+
+ // Clear locally modified region settings.
+ mNewRegionPrefs.clear();
+
+ // *TODO: clear environment settings of the previous region?
+
+ // Request environment settings of the new region.
+ LL_DEBUGS("Windlight") << "New viewer region: " << region_uuid << LL_ENDL;
+ mCurRegionUUID = region_uuid;
+ mInterpNextChangeMessage = interpolate;
+ requestRegionSettings();
+
+ // Let interested parties know agent region has been changed.
+ mRegionChangeSignal();
+}
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
new file mode 100644
index 0000000000..343416634c
--- /dev/null
+++ b/indra/newview/llenvmanager.h
@@ -0,0 +1,379 @@
+/**
+ * @file llenvmanager.h
+ * @brief Declaration of classes managing WindLight and water settings.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLENVMANAGER_H
+#define LL_LLENVMANAGER_H
+
+#include "llmemory.h"
+#include "llsd.h"
+
+class LLWLParamManager;
+class LLWaterParamManager;
+class LLWLAnimator;
+
+// generic key
+struct LLEnvKey
+{
+public:
+ // Note: enum ordering is important; for example, a region-level floater (1) will see local and region (all values that are <=)
+ typedef enum e_scope
+ {
+ SCOPE_LOCAL, // 0
+ SCOPE_REGION//, // 1
+ // SCOPE_ESTATE, // 2
+ // etc.
+ } EScope;
+};
+
+class LLEnvironmentSettings
+{
+public:
+ LLEnvironmentSettings() :
+ mWLDayCycle(LLSD::emptyMap()),
+ mSkyMap(LLSD::emptyMap()),
+ mWaterParams(LLSD::emptyMap()),
+ mDayTime(0.f)
+ {}
+ LLEnvironmentSettings(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime) :
+ mWLDayCycle(dayCycle),
+ mSkyMap(skyMap),
+ mWaterParams(waterParams),
+ mDayTime(dayTime)
+ {}
+ ~LLEnvironmentSettings() {}
+
+ void saveParams(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime)
+ {
+ mWLDayCycle = dayCycle;
+ mSkyMap = skyMap;
+ mWaterParams = waterParams;
+ mDayTime = dayTime;
+ }
+
+ const LLSD& getWLDayCycle() const
+ {
+ return mWLDayCycle;
+ }
+
+ const LLSD& getWaterParams() const
+ {
+ return mWaterParams;
+ }
+
+ const LLSD& getSkyMap() const
+ {
+ return mSkyMap;
+ }
+
+ F64 getDayTime() const
+ {
+ return mDayTime;
+ }
+
+ bool isEmpty() const
+ {
+ return mWLDayCycle.size() == 0;
+ }
+
+ void clear()
+ {
+ *this = LLEnvironmentSettings();
+ }
+
+ LLSD makePacket(const LLSD& metadata) const
+ {
+ LLSD full_packet = LLSD::emptyArray();
+
+ // 0: metadata
+ full_packet.append(metadata);
+
+ // 1: day cycle
+ full_packet.append(mWLDayCycle);
+
+ // 2: map of sky setting names to sky settings (as LLSD)
+ full_packet.append(mSkyMap);
+
+ // 3: water params
+ full_packet.append(mWaterParams);
+
+ return full_packet;
+ }
+
+private:
+ LLSD mWLDayCycle, mWaterParams, mSkyMap;
+ F64 mDayTime;
+};
+
+// not thread-safe
+class LLEnvManager : public LLSingleton<LLEnvManager>
+{
+ LOG_CLASS(LLEnvManager);
+public:
+ // sets scopes (currently, only region-scope) to startup states
+ // delay calling these until as close as possible to knowing whether the remote service is capable of holding windlight settings
+ void notifyCrossing();
+ // these avoid interpolation on the next incoming message (if it comes)
+ void notifyLogin();
+ void notifyTP();
+
+ // request settings again from remote storage (currently implemented only for region)
+ void refreshFromStorage(LLEnvKey::EScope scope);
+ // stores settings and starts transitions (as necessary)
+ // validates packet and returns whether it was valid
+ // loads defaults if not valid
+ // returns whether or not arguments were valid
+ bool processIncomingMessage(const LLSD& packet, LLEnvKey::EScope scope);
+ // saves settings in the given scope to persistent storage appropriate for that scope
+ void commitSettings(LLEnvKey::EScope scope);
+ // called back when the commit finishes
+ void commitSettingsFinished(LLEnvKey::EScope scope);
+ // Immediately apply current settings from managers to region.
+ void applyLocalSettingsToRegion();
+
+ /*
+ * notify of changes in god/not-god mode, estate ownership, etc.
+ * should be called every time after entering new region (after receiving new caps)
+ */
+ void notifyPermissionChange();
+
+ bool regionCapable();
+ static const std::string getScopeString(LLEnvKey::EScope scope);
+ bool canEdit(LLEnvKey::EScope scope);
+ // enables and populates UI
+ // populates display (param managers) with scope's settings
+ // silently fails if canEdit(scope) is false!
+ void startEditingScope(LLEnvKey::EScope scope);
+ // cancel and close UI as necessary
+ // reapplies unedited settings
+ // displays the settings from the scope that user has set (i.e. opt-in setting for now)
+ void maybeClearEditingScope(bool user_initiated, bool was_commit);
+ // clear the scope only if was editing that scope
+ void maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit);
+ // actually do the clearing
+ void clearEditingScope(const LLSD& notification, const LLSD& response);
+
+ // clear and reload defaults into scope
+ void resetInternalsToDefault(LLEnvKey::EScope scope);
+
+ // sets which scope is to be displayed
+ // fix me if/when adding more levels of scope
+ void setNormallyDisplayedScope(LLEnvKey::EScope scope);
+ // gets normally displayed scope
+ LLEnvKey::EScope getNormallyDisplayedScope() const;
+
+ // for debugging purposes
+ void dumpScopes();
+
+private:
+ // overriden initializer
+ friend class LLSingleton<LLEnvManager>;
+ virtual void initSingleton();
+ // helper function (when region changes, but before caps are received)
+ void changedRegion(bool interpolate);
+ // apply to current display and UI
+ void loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate);
+ // save from current display and UI into memory (mOrigSettingStore)
+ void saveSettingsFromManagers(LLEnvKey::EScope scope);
+ // If not done already, save current local environment settings, so that we can switch to them later.
+ void backUpLocalSettingsIfNeeded();
+
+ // Save copy of settings from the current ones in the param managers
+ LLEnvironmentSettings collateFromParamManagers();
+ // bundle settings (already committed from UI) into an LLSD
+ LLSD makePacket(LLEnvKey::EScope scope, const LLSD& metadata);
+
+ void updateUIFromEditability();
+
+ // only call when setting *changes*, not just when it might have changed
+ // saves local settings into mOrigSettingStore when necessary
+ void notifyOptInChange();
+
+ // calculate Linden default settings
+ static const LLEnvironmentSettings& lindenDefaults();
+
+ std::map<LLEnvKey::EScope, LLEnvironmentSettings> mOrigSettingStore; // settings which have been committed from UI
+
+ bool mInterpNextChangeMessage;
+ bool mPendingOutgoingMessage;
+ bool mIsEditing;
+ LLEnvKey::EScope mCurNormalScope; // scope being displayed when not editing (i.e. most of the time)
+ LLEnvKey::EScope mCurEditingScope;
+ LLUUID mLastReceivedID;
+};
+
+/**
+ * User environment preferences.
+ */
+class LLEnvPrefs
+{
+public:
+ LLEnvPrefs() : mUseRegionSettings(true), mUseDayCycle(true) {}
+
+ bool getUseRegionSettings() const { return mUseRegionSettings; }
+ bool getUseDayCycle() const { return mUseDayCycle; }
+ bool getUseFixedSky() const { return !getUseDayCycle(); }
+
+ std::string getWaterPresetName() const;
+ std::string getSkyPresetName() const;
+ std::string getDayCycleName() const;
+
+ void setUseRegionSettings(bool val);
+ void setUseWaterPreset(const std::string& name);
+ void setUseSkyPreset(const std::string& name);
+ void setUseDayCycle(const std::string& name);
+
+ bool mUseRegionSettings;
+ bool mUseDayCycle;
+ std::string mWaterPresetName;
+ std::string mSkyPresetName;
+ std::string mDayCycleName;
+};
+
+/**
+ * Setting:
+ * 1. Use region settings.
+ * 2. Use my setting: <water preset> + <fixed_sky>|<day_cycle>
+ */
+class LLEnvManagerNew : public LLSingleton<LLEnvManagerNew>
+{
+ LOG_CLASS(LLEnvManagerNew);
+public:
+ typedef boost::signals2::signal<void()> prefs_change_signal_t;
+ typedef boost::signals2::signal<void()> region_settings_change_signal_t;
+ typedef boost::signals2::signal<void()> region_change_signal_t;
+ typedef boost::signals2::signal<void(bool)> region_settings_applied_signal_t;
+
+ LLEnvManagerNew();
+
+ // getters to access user env. preferences
+ bool getUseRegionSettings() const;
+ bool getUseDayCycle() const;
+ bool getUseFixedSky() const;
+ std::string getWaterPresetName() const;
+ std::string getSkyPresetName() const;
+ std::string getDayCycleName() const;
+
+ /// @return cached env. settings of the current region.
+ const LLEnvironmentSettings& getRegionSettings() const;
+
+ /**
+ * Set new region settings without uploading them to the region.
+ *
+ * The override will be reset when the changes are applied to the region (=uploaded)
+ * or user teleports to another region.
+ */
+ void setRegionSettings(const LLEnvironmentSettings& new_settings);
+
+ // Change environment w/o changing user preferences.
+ bool usePrefs();
+ bool useDefaults();
+ bool useRegionSettings();
+ bool useWaterPreset(const std::string& name);
+ bool useWaterParams(const LLSD& params);
+ bool useSkyPreset(const std::string& name);
+ bool useSkyParams(const LLSD& params);
+ bool useDayCycle(const std::string& name, LLEnvKey::EScope scope);
+ bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5);
+
+ // setters for user env. preferences
+ void setUseRegionSettings(bool val);
+ void setUseWaterPreset(const std::string& name);
+ void setUseSkyPreset(const std::string& name);
+ void setUseDayCycle(const std::string& name);
+ void setUserPrefs(
+ const std::string& water_preset,
+ const std::string& sky_preset,
+ const std::string& day_cycle_preset,
+ bool use_fixed_sky,
+ bool use_region_settings);
+
+ // debugging methods
+ void dumpUserPrefs();
+ void dumpPresets();
+
+ // Misc.
+ void requestRegionSettings();
+ bool sendRegionSettings(const LLEnvironmentSettings& new_settings);
+ boost::signals2::connection setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb);
+ boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb);
+ boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb);
+ boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb);
+
+ static bool canEditRegionSettings(); /// @return true if we have access to editing region environment
+
+ // Public callbacks.
+ void onRegionCrossing();
+ void onTeleport();
+ void onRegionSettingsResponse(const LLSD& content);
+ void onRegionSettingsApplyResponse(bool ok);
+
+private:
+ friend class LLSingleton<LLEnvManagerNew>;
+ /*virtual*/ void initSingleton();
+
+ void loadUserPrefs();
+ void saveUserPrefs();
+
+ void updateSkyFromPrefs();
+ void updateWaterFromPrefs(bool interpolate);
+ void updateManagersFromPrefs(bool interpolate);
+
+ bool useRegionSky();
+ bool useRegionWater();
+
+ bool useDefaultSky();
+ bool useDefaultWater();
+
+ void onRegionChange(bool interpolate);
+
+ /// Emitted when user environment preferences change.
+ prefs_change_signal_t mUsePrefsChangeSignal;
+
+ /// Emitted when region environment settings update comes.
+ region_settings_change_signal_t mRegionSettingsChangeSignal;
+
+ /// Emitted when agent region changes. Move to LLAgent?
+ region_change_signal_t mRegionChangeSignal;
+
+ /// Emitted when agent region changes. Move to LLAgent?
+ region_settings_applied_signal_t mRegionSettingsAppliedSignal;
+
+ LLEnvPrefs mUserPrefs; /// User environment preferences.
+ LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings.
+ LLEnvironmentSettings mNewRegionPrefs; /// Not-yet-uploaded modified region env. settings.
+ bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change.
+ LLUUID mCurRegionUUID; /// To avoid duplicated region env. settings requests.
+ LLUUID mLastReceivedID; /// Id of last received region env. settings.
+};
+
+#endif // LL_LLENVMANAGER_H
+
diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp
index 22816ee802..9fcfc41f77 100644
--- a/indra/newview/llfloaterdaycycle.cpp
+++ b/indra/newview/llfloaterdaycycle.cpp
@@ -41,6 +41,8 @@
#include "llcombobox.h"
#include "lllineeditor.h"
#include "llwlanimator.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
#include "v4math.h"
#include "llviewerdisplay.h"
@@ -51,34 +53,29 @@
#include "llwlparammanager.h"
#include "llpostprocess.h"
#include "llfloaterwindlight.h"
+//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet)
+#include "llenvmanager.h"
+#include "llfloaterreg.h"
-
-std::map<std::string, LLWLSkyKey> LLFloaterDayCycle::sSliderToKey;
+LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL;
const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f;
+std::map<std::string, LLWLCycleSliderKey> LLFloaterDayCycle::sSliderToKey;
+LLEnvKey::EScope LLFloaterDayCycle::sScope;
+std::string LLFloaterDayCycle::sOriginalTitle;
+LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN;
-LLFloaterDayCycle::LLFloaterDayCycle(const LLSD& key)
-: LLFloater(key)
+LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key)
{
}
+// virtual
BOOL LLFloaterDayCycle::postBuild()
{
- // add the combo boxes
- LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets");
-
- if(keyCombo != NULL)
- {
- keyCombo->removeall();
- std::map<std::string, LLWLParamSet>::iterator mIt =
- LLWLParamManager::instance()->mParamList.begin();
- for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++)
- {
- keyCombo->add(std::string(mIt->first));
- }
+ sOriginalTitle = getTitle();
- // set defaults on combo boxes
- keyCombo->selectFirstItem();
- }
+ // *HACK commented out since this code isn't released (yet)
+ //llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild<LLMultiSliderCtrl>("WLDayCycleKeys")->getMaxValue() &&
+ // LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild<LLMultiSliderCtrl>("WLDayCycleKeys")->getMaxValue());
// add the time slider
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
@@ -88,9 +85,6 @@ BOOL LLFloaterDayCycle::postBuild()
// load it up
initCallbacks();
- syncMenu();
- syncSliderTrack();
-
return TRUE;
}
@@ -98,79 +92,64 @@ LLFloaterDayCycle::~LLFloaterDayCycle()
{
}
+void LLFloaterDayCycle::onClickHelp(void* data)
+{
+ std::string xml_alert = *(std::string *) data;
+ LLNotifications::instance().add(xml_alert, LLSD(), LLSD());
+}
+
+void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert)
+{
+ childSetAction(name, onClickHelp, new std::string(xml_alert));
+}
+
void LLFloaterDayCycle::initCallbacks(void)
{
+ initHelpBtn("WLDayCycleHelp", "HelpDayCycle");
+
// WL Day Cycle
- getChild<LLUICtrl>("WLTimeSlider")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeSliderMoved, this, _1));
- getChild<LLUICtrl>("WLDayCycleKeys")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeMoved, this, _1));
- getChild<LLUICtrl>("WLCurKeyHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1));
- getChild<LLUICtrl>("WLCurKeyMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1));
- getChild<LLUICtrl>("WLKeyPresets")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyPresetChanged, this, _1));
-
- getChild<LLUICtrl>("WLLengthOfDayHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
- getChild<LLUICtrl>("WLLengthOfDayMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
- getChild<LLUICtrl>("WLLengthOfDaySec")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
- getChild<LLUICtrl>("WLUseLindenTime")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onUseLindenTime, this, _1));
- getChild<LLUICtrl>("WLAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onRunAnimSky, this, _1));
- getChild<LLUICtrl>("WLStopAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onStopAnimSky, this, _1));
-
- getChild<LLUICtrl>("WLLoadDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onLoadDayCycle, this, _1));
- getChild<LLUICtrl>("WLSaveDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onSaveDayCycle, this, _1));
-
- getChild<LLUICtrl>("WLAddKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onAddKey, this, _1));
- getChild<LLUICtrl>("WLDeleteKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onDeleteKey, this, _1));
+ childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL);
+ childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL);
+ childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL);
+ childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL);
+ childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL);
+
+ childSetAction("WLAddKey", onAddKey, NULL);
+ childSetAction("WLDeleteKey", onDeleteKey, NULL);
}
void LLFloaterDayCycle::syncMenu()
{
-// std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues;
-
// set time
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
- sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay);
-
- LLSpinCtrl* secSpin = getChild<LLSpinCtrl>("WLLengthOfDaySec");
- LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLLengthOfDayMin");
- LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLLengthOfDayHour");
-
- F32 curRate;
- F32 hours, min, sec;
-
- // get the current rate
- curRate = LLWLParamManager::instance()->mDay.mDayRate;
- hours = (F32)((int)(curRate / 60 / 60));
- curRate -= (hours * 60 * 60);
- min = (F32)((int)(curRate / 60));
- curRate -= (min * 60);
- sec = curRate;
-
- hourSpin->setValue(hours);
- minSpin->setValue(min);
- secSpin->setValue(sec);
+ LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
+ sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay);
// turn off Use Estate Time button if it's already being used
- if( LLWLParamManager::instance()->mAnimator.mUseLindenTime == true)
+ if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime())
{
- getChildView("WLUseLindenTime")->setEnabled(FALSE);
+ LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime");
}
else
{
- getChildView("WLUseLindenTime")->setEnabled(TRUE);
+ LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime");
}
}
void LLFloaterDayCycle::syncSliderTrack()
{
// clear the slider
- LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
+ LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
kSldr->clear();
sSliderToKey.clear();
// add sliders
- std::map<F32, std::string>::iterator mIt =
- LLWLParamManager::instance()->mDay.mTimeMap.begin();
- for(; mIt != LLWLParamManager::instance()->mDay.mTimeMap.end(); mIt++)
+
+ lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl;
+
+ std::map<F32, LLWLParamKey>::iterator mIt =
+ LLWLParamManager::getInstance()->mDay.mTimeMap.begin();
+ for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++)
{
addSliderKey(mIt->first * sHoursPerDay, mIt->second);
}
@@ -178,136 +157,151 @@ void LLFloaterDayCycle::syncSliderTrack()
void LLFloaterDayCycle::syncTrack()
{
+ lldebugs << "Syncing track (" << sSliderToKey.size() << ")" << llendl;
+
// if no keys, do nothing
if(sSliderToKey.size() == 0)
{
+ lldebugs << "No keys, not syncing" << llendl;
return;
}
LLMultiSliderCtrl* sldr;
- sldr = getChild<LLMultiSliderCtrl>(
+ sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
- tSldr = getChild<LLMultiSliderCtrl>(
+ tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
// create a new animation track
- LLWLParamManager::instance()->mDay.clearKeys();
+ LLWLParamManager::getInstance()->mDay.clearKeyframes();
// add the keys one by one
- std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.begin();
+ std::map<std::string, LLWLCycleSliderKey>::iterator mIt = sSliderToKey.begin();
for(; mIt != sSliderToKey.end(); mIt++)
{
- LLWLParamManager::instance()->mDay.addKey(mIt->second.time / sHoursPerDay,
- mIt->second.presetName);
+ LLWLParamManager::getInstance()->mDay.addKeyframe(mIt->second.time / sHoursPerDay,
+ mIt->second.keyframe);
}
// set the param manager's track to the new one
- LLWLParamManager::instance()->resetAnimator(
+ LLWLParamManager::getInstance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLWLParamManager::getInstance()->mAnimator.update(
+ LLWLParamManager::getInstance()->mCurParams);
}
-void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl)
+void LLFloaterDayCycle::refreshPresetsFromParamManager()
{
- // if no keys, do nothing
- if(sSliderToKey.size() == 0)
- {
- return;
- }
-
- LLMultiSliderCtrl* sldr;
- sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
- llassert_always(sSliderToKey.size() == sldr->getValue().size());
+ LLComboBox* keyCombo = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
- LLMultiSliderCtrl* tSldr;
- tSldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
-
- // turn off linden time
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-
- // set the param manager's track to the new one
- LLWLParamManager::instance()->resetAnimator(
- tSldr->getCurSliderValue() / sHoursPerDay, true);
+ if(keyCombo != NULL)
+ {
+ LLWLParamManager::preset_key_list_t preset_keys;
+ LLWLParamManager::instance().getPresetKeys(preset_keys);
+ for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it)
+ {
+ if (it->scope <= sScope)
+ {
+ const LLWLParamKey& key = *it;
+ llinfos << "Adding key: " << key.toString() << llendl;
+ keyCombo->add(key.toString(), LLSD(key.toStringVal()));
+ }
+ }
- llassert_always(LLWLParamManager::instance()->mAnimator.mTimeTrack.size() == sldr->getValue().size());
+ // set defaults on combo boxes
+ keyCombo->selectFirstItem();
+ }
}
-void LLFloaterDayCycle::onStopAnimSky(LLUICtrl* ctrl)
+// static
+LLFloaterDayCycle* LLFloaterDayCycle::instance()
{
- // if no keys, do nothing
- if(sSliderToKey.size() == 0) {
- return;
+ if (!sDayCycle)
+ {
+ lldebugs << "Instantiating Day Cycle floater" << llendl;
+ sDayCycle = LLFloaterReg::getTypedInstance<LLFloaterDayCycle>("env_day_cycle");
+ llassert(sDayCycle);
+ // sDayCycle->open();
+ // sDayCycle->setFocus(TRUE);
}
-
- // turn off animation and using linden time
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
+ return sDayCycle;
}
-void LLFloaterDayCycle::onUseLindenTime(LLUICtrl* ctrl)
+bool LLFloaterDayCycle::isOpen()
{
- LLComboBox* box = getChild<LLComboBox>("WLPresetsCombo");
- box->selectByValue("");
-
- LLWLParamManager::instance()->mAnimator.mIsRunning = true;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
+ if (sDayCycle != NULL)
+ {
+ return true;
+ }
+ return false;
}
-void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl)
+void LLFloaterDayCycle::show(LLEnvKey::EScope scope)
{
- LLWLParamManager::instance()->mDay.loadDayCycle("Default.xml");
-
- // sync it all up
+ LLFloaterDayCycle* dayCycle = instance();
+ if(scope != sScope && ((LLView*)dayCycle)->getVisible())
+ {
+ LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD());
+ return;
+ }
+ sScope = scope;
+ std::string title = sOriginalTitle + " (" + LLEnvManager::getScopeString(sScope) + ")";
+ dayCycle->setTitle(title);
+ refreshPresetsFromParamManager();
+ dayCycle->syncMenu();
syncSliderTrack();
- syncMenu();
- // set the param manager's track to the new one
- LLMultiSliderCtrl* tSldr;
- tSldr = getChild<LLMultiSliderCtrl>(
- "WLTimeSlider");
- LLWLParamManager::instance()->resetAnimator(
- tSldr->getCurSliderValue() / sHoursPerDay, false);
+ // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially)
+ const std::string& curSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys")->getCurSlider();
+ if(strlen(curSldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map
+ {
+ sDayCycle->getChild<LLComboBox>("WLKeyPresets")->selectByValue(sSliderToKey[curSldr].keyframe.toStringVal());
+ }
+
+ // comment in if you want the menu to rebuild each time
+ //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml");
+ //dayCycle->initCallbacks();
- // and draw it
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ dayCycle->openFloater();
}
-void LLFloaterDayCycle::onSaveDayCycle(LLUICtrl* ctrl)
+// virtual
+void LLFloaterDayCycle::onClose(bool app_quitting)
{
- LLWLParamManager::instance()->mDay.saveDayCycle("Default.xml");
+ if (sDayCycle)
+ {
+ lldebugs << "Destorying Day Cycle floater" << llendl;
+ sDayCycle = NULL;
+ }
}
-
-void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
{
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
/// get the slider value
F32 val = sldr->getCurSliderValue() / sHoursPerDay;
// set the value, turn off animation
- LLWLParamManager::instance()->mAnimator.setDayTime((F64)val);
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
+ LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLWLParamManager::getInstance()->mAnimator.update(
+ LLWLParamManager::getInstance()->mCurParams);
}
-void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData)
{
- LLComboBox* comboBox = getChild<LLComboBox>("WLKeyPresets");
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
- LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour");
- LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin");
+ LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
+ LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
+ LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
if(sldr->getValue().size() == 0) {
return;
@@ -322,11 +316,11 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl)
F32 time = sldr->getCurSliderValue();
// check to see if a key exists
- std::string presetName = sSliderToKey[curSldr].presetName;
+ LLWLParamKey key = sSliderToKey[curSldr].keyframe;
sSliderToKey[curSldr].time = time;
// if it exists, turn on check box
- comboBox->selectByValue(presetName);
+ comboBox->selectByValue(key.toStringVal());
// now set the spinners
F32 hour = (F32)((S32)time);
@@ -345,18 +339,18 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl)
}
-void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData)
{
// if no keys, skipped
if(sSliderToKey.size() == 0) {
return;
}
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
- LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>(
+ LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyHour");
- LLSpinCtrl* minSpin = getChild<LLSpinCtrl>(
+ LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyMin");
F32 hour = hourSpin->get();
@@ -368,18 +362,17 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl)
F32 time = sldr->getCurSliderValue() / sHoursPerDay;
// now set the key's time in the sliderToKey map
- std::string presetName = sSliderToKey[curSldr].presetName;
sSliderToKey[curSldr].time = time;
syncTrack();
}
-void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData)
{
// get the time
- LLComboBox* comboBox = getChild<LLComboBox>(
+ LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// do nothing if no sliders
@@ -388,7 +381,9 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl)
}
// change the map
- std::string newPreset(comboBox->getSelectedValue().asString());
+
+ std::string stringVal = comboBox->getSelectedValue().asString();
+ LLWLParamKey newKey(stringVal);
const std::string& curSldr = sldr->getCurSlider();
// if null, don't use
@@ -396,62 +391,57 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl)
return;
}
- sSliderToKey[curSldr].presetName = newPreset;
+ sSliderToKey[curSldr].keyframe = newKey;
syncTrack();
}
-void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onAddKey(void* userData)
{
- // get the time
- LLSpinCtrl* secSpin = getChild<LLSpinCtrl>(
- "WLLengthOfDaySec");
-
- LLSpinCtrl* minSpin = getChild<LLSpinCtrl>(
- "WLLengthOfDayMin");
-
- LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>(
- "WLLengthOfDayHour");
-
- F32 hour;
- hour = (F32)hourSpin->getValue().asReal();
- F32 min;
- min = (F32)minSpin->getValue().asReal();
- F32 sec;
- sec = (F32)secSpin->getValue().asReal();
-
- F32 time = 60.0f * 60.0f * hour + 60.0f * min + sec;
- if(time <= 0) {
- time = 1;
- }
- LLWLParamManager::instance()->mDay.mDayRate = time;
-
- syncTrack();
-}
-
-void LLFloaterDayCycle::onAddKey(LLUICtrl* ctrl)
-{
- LLComboBox* comboBox = getChild<LLComboBox>(
+ LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
- LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
- LLMultiSliderCtrl* tSldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
+ S32 max_sliders;
+ switch(sScope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ max_sliders = 20; // *HACK this should be LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES;
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ max_sliders = 12; // *HACK this should be LLWLPacketScrubber::MAX_REGION_KEY_FRAMES;
+ break;
+ default:
+ max_sliders = (S32)kSldr->getMaxValue();
+ break;
+ }
+
+ if ((S32)sSliderToKey.size() >= max_sliders)
+ {
+ LLSD args;
+ args["SCOPE"] = LLEnvManager::getScopeString(sScope);
+ args["MAX"] = max_sliders;
+ LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING);
+ return;
+ }
+
// get the values
- std::string newPreset(comboBox->getSelectedValue().asString());
+ LLWLParamKey newKeyframe(comboBox->getSelectedValue());
// add the slider key
- addSliderKey(tSldr->getCurSliderValue(), newPreset);
+ addSliderKey(tSldr->getCurSliderValue(), newKeyframe);
syncTrack();
}
-void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName)
+void LLFloaterDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe)
{
- LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>(
+ LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// make a slider
@@ -461,30 +451,28 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName)
}
// set the key
- LLWLSkyKey newKey;
- newKey.presetName = presetName;
- newKey.time = kSldr->getCurSliderValue();
+ LLWLCycleSliderKey newKey(keyframe, kSldr->getCurSliderValue());
llassert_always(sldrName != LLStringUtil::null);
// add to map
- sSliderToKey.insert(std::pair<std::string, LLWLSkyKey>(sldrName, newKey));
+ sSliderToKey.insert(std::pair<std::string, LLWLCycleSliderKey>(sldrName, newKey));
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
}
-void LLFloaterDayCycle::deletePreset(std::string& presetName)
+void LLFloaterDayCycle::deletePreset(LLWLParamKey keyframe)
{
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
/// delete any reference
- std::map<std::string, LLWLSkyKey>::iterator curr_preset, next_preset;
+ std::map<std::string, LLWLCycleSliderKey>::iterator curr_preset, next_preset;
for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset)
{
next_preset = curr_preset;
++next_preset;
- if (curr_preset->second.presetName == presetName)
+ if (curr_preset->second.keyframe == keyframe)
{
sldr->deleteSlider(curr_preset->first);
sSliderToKey.erase(curr_preset);
@@ -492,19 +480,25 @@ void LLFloaterDayCycle::deletePreset(std::string& presetName)
}
}
-void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl)
+void LLFloaterDayCycle::onDeleteKey(void* userData)
{
- if(sSliderToKey.size() == 0) {
+ if(sSliderToKey.size() == 0)
+ {
+ return;
+ }
+ else if(sSliderToKey.size() == 1)
+ {
+ LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD());
return;
}
- LLComboBox* comboBox = getChild<LLComboBox>(
+ LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
- LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
+ LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
// delete from map
const std::string& sldrName = sldr->getCurSlider();
- std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.find(sldrName);
+ std::map<std::string, LLWLCycleSliderKey>::iterator mIt = sSliderToKey.find(sldrName);
sSliderToKey.erase(mIt);
sldr->deleteCurSlider();
@@ -514,11 +508,11 @@ void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl)
}
const std::string& name = sldr->getCurSlider();
- comboBox->selectByValue(sSliderToKey[name].presetName);
+ comboBox->selectByValue(sSliderToKey[name].keyframe.toLLSD());
F32 time = sSliderToKey[name].time;
- LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour");
- LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin");
+ LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
+ LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
// now set the spinners
F32 hour = (F32)((S32)time);
diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h
index 993ddb8f07..1454298269 100644
--- a/indra/newview/llfloaterdaycycle.h
+++ b/indra/newview/llfloaterdaycycle.h
@@ -32,15 +32,19 @@
#include <vector>
#include "llwlparamset.h"
#include "llwlanimator.h"
+#include "llwlparammanager.h"
struct WLColorControl;
struct WLFloatControl;
-/// convenience class for holding keys mapped to sliders
-struct LLWLSkyKey
+/// convenience class for holding keyframes mapped to sliders
+struct LLWLCycleSliderKey
{
public:
- std::string presetName;
+ LLWLCycleSliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {}
+ LLWLCycleSliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor
+
+ LLWLParamKey keyframe;
F32 time;
};
@@ -48,72 +52,79 @@ public:
/// Menuing system for adjusting the atmospheric settings of the world.
class LLFloaterDayCycle : public LLFloater
{
+ LOG_CLASS(LLFloaterDayCycle);
public:
-
- LLFloaterDayCycle(const LLSD& key);
+ LLFloaterDayCycle(const LLSD &key);
virtual ~LLFloaterDayCycle();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
+
+ // map of sliders to parameters
+ static std::map<std::string, LLWLCycleSliderKey> sSliderToKey;
+
+ /// help button stuff
+ static void onClickHelp(void* data);
+ void initHelpBtn(const std::string& name, const std::string& xml_alert);
/// initialize all
void initCallbacks(void);
+ /// one and one instance only
+ static LLFloaterDayCycle* instance();
+
/// on time slider moved
- void onTimeSliderMoved(LLUICtrl* ctrl);
+ static void onTimeSliderMoved(LLUICtrl* ctrl, void* userData);
/// what happens when you move the key frame
- void onKeyTimeMoved(LLUICtrl* ctrl);
+ static void onKeyTimeMoved(LLUICtrl* ctrl, void* userData);
/// what happens when you change the key frame's time
- void onKeyTimeChanged(LLUICtrl* ctrl);
+ static void onKeyTimeChanged(LLUICtrl* ctrl, void* userData);
/// if you change the combo box, change the frame
- void onKeyPresetChanged(LLUICtrl* ctrl);
+ static void onKeyPresetChanged(LLUICtrl* ctrl, void* userData);
- /// run this when user says to run the sky animation
- void onRunAnimSky(LLUICtrl* ctrl);
-
- /// run this when user says to stop the sky animation
- void onStopAnimSky(LLUICtrl* ctrl);
-
- /// if you change the combo box, change the frame
- void onTimeRateChanged(LLUICtrl* ctrl);
-
/// add a new key on slider
- void onAddKey(LLUICtrl* ctrl);
+ static void onAddKey(void* userData);
/// delete any and all reference to a preset
- void deletePreset(std::string& presetName);
+ void deletePreset(LLWLParamKey keyframe);
/// delete a key frame
- void onDeleteKey(LLUICtrl* ctrl);
+ static void onDeleteKey(void* userData);
+
+
+ //// menu management
- /// button to load day
- void onLoadDayCycle(LLUICtrl* ctrl);
+ /// show off our menu
+ static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL);
- /// button to save day
- void onSaveDayCycle(LLUICtrl* ctrl);
+ /// return if the menu exists or not
+ static bool isOpen();
- /// toggle for Linden time
- void onUseLindenTime(LLUICtrl* ctrl);
+ /// stuff to do on exit
+ virtual void onClose(bool app_quitting);
/// sync up sliders with day cycle structure
- void syncMenu();
+ static void syncMenu();
// makes sure key slider has what's in day cycle
- void syncSliderTrack();
+ static void syncSliderTrack();
/// makes sure day cycle data structure has what's in menu
- void syncTrack();
+ static void syncTrack();
+
+ /// refresh combox box from param manager
+ static void refreshPresetsFromParamManager();
/// add a slider to the track
- void addSliderKey(F32 time, const std::string& presetName);
+ static void addSliderKey(F32 time, LLWLParamKey keyframe);
private:
-
- // map of sliders to parameters
- static std::map<std::string, LLWLSkyKey> sSliderToKey;
-
+ static LLFloaterDayCycle* sDayCycle; // one instance on the inside
static const F32 sHoursPerDay;
+ static LLEnvKey::EScope sScope;
+ static std::string sOriginalTitle;
+ static LLWLAnimator::ETime sPreviousTimeType;
};
diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp
new file mode 100644
index 0000000000..4fefd2242a
--- /dev/null
+++ b/indra/newview/llfloaterdeleteenvpreset.cpp
@@ -0,0 +1,285 @@
+/**
+ * @file llfloaterdeleteenvpreset.cpp
+ * @brief Floater to delete a water / sky / day cycle preset.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterdeleteenvpreset.h"
+
+// libs
+#include "llbutton.h"
+#include "llcombobox.h"
+#include "llnotificationsutil.h"
+
+// newview
+#include "lldaycyclemanager.h"
+#include "llwaterparammanager.h"
+
+static bool confirmation_callback(const LLSD& notification, const LLSD& response, boost::function<void()> cb)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ cb();
+ }
+ return false;
+
+}
+
+LLFloaterDeleteEnvPreset::LLFloaterDeleteEnvPreset(const LLSD &key)
+: LLFloater(key)
+, mPresetCombo(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterDeleteEnvPreset::postBuild()
+{
+ mPresetCombo = getChild<LLComboBox>("preset_combo");
+ mPresetCombo->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::postPopulate, this));
+
+ getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this));
+
+ // Listen to user preferences change, in which case we need to rebuild the presets list
+ // to disable the [new] current preset.
+ LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populatePresetsList, this));
+
+ // Listen to presets addition/removal.
+ LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateDayCyclesList, this));
+ LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateSkyPresetsList, this));
+ LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateWaterPresetsList, this));
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)
+{
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string combo_label = getString(std::string("label_" + param));
+
+ // Update floater title.
+ setTitle(floater_title);
+
+ // Update the combobox label.
+ getChild<LLUICtrl>("label")->setValue(combo_label);
+
+ // Populate the combobox.
+ populatePresetsList();
+}
+
+void LLFloaterDeleteEnvPreset::onBtnDelete()
+{
+ std::string param = mKey.asString();
+ std::string preset_name = mPresetCombo->getValue().asString();
+ boost::function<void()> confirm_cb;
+
+ if (param == "water")
+ {
+ // Don't allow deleting system presets.
+ if (LLWaterParamManager::instance().isSystemPreset(preset_name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteWaterPresetConfirmation, this);
+ }
+ else if (param == "sky")
+ {
+ // Don't allow deleting presets referenced by local day cycles.
+ if (LLDayCycleManager::instance().isSkyPresetReferenced(preset_name))
+ {
+ LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", getString("msg_sky_is_referenced")));
+ return;
+ }
+
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+
+ // Don't allow deleting system presets.
+ if (wl_mgr.isSystemPreset(preset_name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation, this);
+ }
+ else if (param == "day_cycle")
+ {
+ LLDayCycleManager& day_mgr = LLDayCycleManager::instance();
+
+ // Don't allow deleting system presets.
+ if (day_mgr.isSystemPreset(preset_name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation, this);
+ }
+ else
+ {
+ llwarns << "Unrecognized key" << llendl;
+ }
+
+ LLSD args;
+ args["MESSAGE"] = getString("msg_confirm_deletion");
+ LLNotificationsUtil::add("GenericAlertYesCancel", args, LLSD(),
+ boost::bind(&confirmation_callback, _1, _2, confirm_cb));
+}
+
+void LLFloaterDeleteEnvPreset::onBtnCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterDeleteEnvPreset::populatePresetsList()
+{
+ std::string param = mKey.asString();
+
+ if (param == "water")
+ {
+ populateWaterPresetsList();
+ }
+ else if (param == "sky")
+ {
+ populateSkyPresetsList();
+ }
+ else if (param == "day_cycle")
+ {
+ populateDayCyclesList();
+ }
+ else
+ {
+ llwarns << "Unrecognized key" << llendl;
+ }
+}
+
+void LLFloaterDeleteEnvPreset::populateWaterPresetsList()
+{
+ if (mKey.asString() != "water") return;
+
+ mPresetCombo->removeall();
+
+ std::string cur_preset;
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ if (!env_mgr.getUseRegionSettings())
+ {
+ cur_preset = env_mgr.getWaterPresetName();
+ }
+
+ LLWaterParamManager::preset_name_list_t presets;
+ LLWaterParamManager::instance().getUserPresetNames(presets); // list only user presets
+ for (LLWaterParamManager::preset_name_list_t::const_iterator it = presets.begin(); it != presets.end(); ++it)
+ {
+ std::string name = *it;
+
+ bool enabled = (name != cur_preset); // don't allow deleting current preset
+ mPresetCombo->add(name, ADD_BOTTOM, enabled);
+ }
+
+ postPopulate();
+}
+
+void LLFloaterDeleteEnvPreset::populateSkyPresetsList()
+{
+ if (mKey.asString() != "sky") return;
+
+ mPresetCombo->removeall();
+
+ std::string cur_preset;
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ if (!env_mgr.getUseRegionSettings() && env_mgr.getUseFixedSky())
+ {
+ cur_preset = env_mgr.getSkyPresetName();
+ }
+
+ LLWLParamManager::preset_name_list_t user_presets;
+ LLWLParamManager::instance().getUserPresetNames(user_presets);
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ const std::string& name = *it;
+ mPresetCombo->add(name, ADD_BOTTOM, /*enabled = */ name != cur_preset);
+ }
+
+ postPopulate();
+}
+
+void LLFloaterDeleteEnvPreset::populateDayCyclesList()
+{
+ if (mKey.asString() != "day_cycle") return;
+
+ mPresetCombo->removeall();
+
+ std::string cur_day;
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ if (!env_mgr.getUseRegionSettings() && env_mgr.getUseDayCycle())
+ {
+ cur_day = env_mgr.getDayCycleName();
+ }
+
+ LLDayCycleManager& day_mgr = LLDayCycleManager::instance();
+ LLDayCycleManager::preset_name_list_t user_days;
+ day_mgr.getUserPresetNames(user_days); // list only user presets
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it)
+ {
+ const std::string& name = *it;
+ mPresetCombo->add(name, ADD_BOTTOM, name != cur_day);
+ }
+
+ postPopulate();
+}
+
+void LLFloaterDeleteEnvPreset::postPopulate()
+{
+ // Handle empty list and empty selection.
+ bool has_selection = mPresetCombo->getItemCount() > 1 && mPresetCombo->getSelectedValue().isDefined();
+
+ if (!has_selection)
+ {
+ mPresetCombo->setLabel(getString("combo_label"));
+ }
+
+ getChild<LLButton>("delete")->setEnabled(has_selection);
+}
+
+void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation()
+{
+ LLDayCycleManager::instance().deletePreset(mPresetCombo->getValue().asString());
+}
+
+void LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation()
+{
+ LLWLParamKey key(mPresetCombo->getValue().asString(), LLEnvKey::SCOPE_LOCAL);
+ LLWLParamManager::instance().removeParamSet(key, true);
+}
+
+void LLFloaterDeleteEnvPreset::onDeleteWaterPresetConfirmation()
+{
+ LLWaterParamManager::instance().removeParamSet(mPresetCombo->getValue().asString(), true);
+}
diff --git a/indra/newview/llfloaterdeleteenvpreset.h b/indra/newview/llfloaterdeleteenvpreset.h
new file mode 100644
index 0000000000..1211505273
--- /dev/null
+++ b/indra/newview/llfloaterdeleteenvpreset.h
@@ -0,0 +1,62 @@
+/**
+ * @file llfloaterdeleteenvpreset.h
+ * @brief Floater to delete a water / sky / day cycle preset.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERDELETEENVPRESET_H
+#define LL_LLFLOATERDELETEENVPRESET_H
+
+#include "llfloater.h"
+
+class LLComboBox;
+
+class LLFloaterDeleteEnvPreset : public LLFloater
+{
+ LOG_CLASS(LLFloaterDeleteEnvPreset);
+
+public:
+ LLFloaterDeleteEnvPreset(const LLSD &key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ void onBtnDelete();
+ void onBtnCancel();
+
+private:
+ void populatePresetsList();
+ void populateWaterPresetsList();
+ void populateSkyPresetsList();
+ void populateDayCyclesList();
+
+ void postPopulate();
+
+ void onDeleteDayCycleConfirmation();
+ void onDeleteSkyPresetConfirmation();
+ void onDeleteWaterPresetConfirmation();
+
+ LLComboBox* mPresetCombo;
+};
+
+#endif // LL_LLFLOATERDELETEENVPRESET_H
diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp
new file mode 100644
index 0000000000..165b271133
--- /dev/null
+++ b/indra/newview/llfloatereditdaycycle.cpp
@@ -0,0 +1,825 @@
+/**
+ * @file llfloatereditdaycycle.cpp
+ * @brief Floater to create or edit a day cycle
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloatereditdaycycle.h"
+
+// libs
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
+#include "llloadingindicator.h"
+#include "llmultisliderctrl.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llspinctrl.h"
+#include "lltimectrl.h"
+
+// newview
+#include "llagent.h"
+#include "lldaycyclemanager.h"
+#include "llenvmanager.h"
+#include "llregioninfomodel.h"
+#include "llviewerregion.h"
+#include "llwlparammanager.h"
+
+const F32 LLFloaterEditDayCycle::sHoursPerDay = 24.0f;
+
+LLFloaterEditDayCycle::LLFloaterEditDayCycle(const LLSD &key)
+: LLFloater(key)
+, mDayCycleNameEditor(NULL)
+, mDayCyclesCombo(NULL)
+, mTimeSlider(NULL)
+, mKeysSlider(NULL)
+, mSkyPresetsCombo(NULL)
+, mTimeCtrl(NULL)
+, mMakeDefaultCheckBox(NULL)
+, mSaveButton(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterEditDayCycle::postBuild()
+{
+ mDayCycleNameEditor = getChild<LLLineEditor>("day_cycle_name");
+ mDayCyclesCombo = getChild<LLComboBox>("day_cycle_combo");
+
+ mTimeSlider = getChild<LLMultiSliderCtrl>("WLTimeSlider");
+ mKeysSlider = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
+ mSkyPresetsCombo = getChild<LLComboBox>("WLSkyPresets");
+ mTimeCtrl = getChild<LLTimeCtrl>("time");
+ mSaveButton = getChild<LLButton>("save");
+ mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
+
+ initCallbacks();
+
+ // add the time slider
+ mTimeSlider->addSlider();
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterEditDayCycle::onOpen(const LLSD& key)
+{
+ bool new_day = isNewDay();
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string hint = getString(std::string("hint_" + param));
+
+ // Update floater title.
+ setTitle(floater_title);
+
+ // Update the hint at the top.
+ getChild<LLUICtrl>("hint")->setValue(hint);
+
+ // Hide the hint to the right of the combo if we're invoked to create a new preset.
+ getChildView("note")->setVisible(!new_day);
+
+ // Switch between the day cycle presets combobox and day cycle name input field.
+ mDayCyclesCombo->setVisible(!new_day);
+ mDayCycleNameEditor->setVisible(new_day);
+
+ // TODO: Make sure only one instance of the floater exists?
+
+ reset();
+}
+
+// virtual
+void LLFloaterEditDayCycle::onClose(bool app_quitting)
+{
+ if (!app_quitting) // there's no point to change environment if we're quitting
+ {
+ LLEnvManagerNew::instance().usePrefs(); // revert changes made to current day cycle
+ }
+}
+
+// virtual
+void LLFloaterEditDayCycle::draw()
+{
+ syncTimeSlider();
+ LLFloater::draw();
+}
+
+void LLFloaterEditDayCycle::initCallbacks(void)
+{
+ mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this), NULL);
+ mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleSelected, this));
+ mDayCyclesCombo->setTextEntryCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this));
+ mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onTimeSliderMoved, this));
+ mKeysSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeMoved, this));
+ mTimeCtrl->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeChanged, this));
+ mSkyPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyPresetChanged, this));
+
+ getChild<LLButton>("WLAddKey")->setClickedCallback(boost::bind(&LLFloaterEditDayCycle::onAddKey, this));
+ getChild<LLButton>("WLDeleteKey")->setClickedCallback(boost::bind(&LLFloaterEditDayCycle::onDeleteKey, this));
+
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnSave, this));
+ mSaveButton->setRightMouseDownCallback(boost::bind(&LLFloaterEditDayCycle::dumpTrack, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnCancel, this));
+
+ // Connect to env manager events.
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsChange, this));
+ env_mgr.setRegionChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this));
+ env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsApplied, this, _1));
+
+ // Connect to day cycle manager events.
+ LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleListChange, this));
+
+ // Connect to sky preset list changes.
+ LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditDayCycle::onSkyPresetListChange, this));
+
+ // Connect to region info updates.
+ LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditDayCycle::onRegionInfoUpdate, this));
+}
+
+void LLFloaterEditDayCycle::syncTimeSlider()
+{
+ // set time
+ mTimeSlider->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay);
+}
+
+void LLFloaterEditDayCycle::loadTrack()
+{
+ // clear the slider
+ mKeysSlider->clear();
+ mSliderToKey.clear();
+
+ // add sliders
+
+ lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl;
+
+ LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay;
+ for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it)
+ {
+ addSliderKey(it->first * sHoursPerDay, it->second);
+ }
+
+ // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially)
+ const std::string& cur_sldr = mKeysSlider->getCurSlider();
+ if (strlen(cur_sldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map
+ {
+ mSkyPresetsCombo->selectByValue(mSliderToKey[cur_sldr].keyframe.toStringVal());
+ }
+
+ syncTimeSlider();
+}
+
+void LLFloaterEditDayCycle::applyTrack()
+{
+ lldebugs << "Applying track (" << mSliderToKey.size() << ")" << llendl;
+
+ // if no keys, do nothing
+ if (mSliderToKey.size() == 0)
+ {
+ lldebugs << "No keys, not syncing" << llendl;
+ return;
+ }
+
+ llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size());
+
+ // create a new animation track
+ LLWLParamManager::getInstance()->mDay.clearKeyframes();
+
+ // add the keys one by one
+ for (std::map<std::string, SliderKey>::iterator it = mSliderToKey.begin();
+ it != mSliderToKey.end(); ++it)
+ {
+ LLWLParamManager::getInstance()->mDay.addKeyframe(it->second.time / sHoursPerDay,
+ it->second.keyframe);
+ }
+
+ // set the param manager's track to the new one
+ LLWLParamManager::getInstance()->resetAnimator(
+ mTimeSlider->getCurSliderValue() / sHoursPerDay, false);
+
+ LLWLParamManager::getInstance()->mAnimator.update(
+ LLWLParamManager::getInstance()->mCurParams);
+}
+
+void LLFloaterEditDayCycle::refreshSkyPresetsList()
+{
+ // Don't allow selecting region skies for a local day cycle,
+ // because thus we may end up with invalid day cycle.
+ bool include_region_skies = getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION;
+
+ mSkyPresetsCombo->removeall();
+
+ LLWLParamManager::preset_name_list_t region_presets;
+ LLWLParamManager::preset_name_list_t user_presets, sys_presets;
+ LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets);
+
+ if (include_region_skies)
+ {
+ // Add region presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it)
+ {
+ std::string preset_name = *it;
+ std::string item_title = preset_name + " (" + getRegionName() + ")";
+ mSkyPresetsCombo->add(preset_name, LLWLParamKey(*it, LLEnvKey::SCOPE_REGION).toStringVal());
+ }
+
+ if (!region_presets.empty())
+ {
+ mSkyPresetsCombo->addSeparator();
+ }
+ }
+
+ // Add user presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mSkyPresetsCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ if (!user_presets.empty())
+ {
+ mSkyPresetsCombo->addSeparator();
+ }
+
+ // Add system presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it)
+ {
+ mSkyPresetsCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ // set defaults on combo boxes
+ mSkyPresetsCombo->selectFirstItem();
+}
+
+void LLFloaterEditDayCycle::refreshDayCyclesList()
+{
+ llassert(isNewDay() == false);
+
+ mDayCyclesCombo->removeall();
+
+#if 0 // Disable editing existing day cycle until the workflow is clear enough.
+ const LLSD& region_day = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle();
+ if (region_day.size() > 0)
+ {
+ LLWLParamKey key(getRegionName(), LLEnvKey::SCOPE_REGION);
+ mDayCyclesCombo->add(key.name, key.toLLSD());
+ mDayCyclesCombo->addSeparator();
+ }
+#endif
+
+ LLDayCycleManager::preset_name_list_t user_days, sys_days;
+ LLDayCycleManager::instance().getPresetNames(user_days, sys_days);
+
+ // Add user days.
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it)
+ {
+ mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ if (user_days.size() > 0)
+ {
+ mDayCyclesCombo->addSeparator();
+ }
+
+ // Add system days.
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it)
+ {
+ mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ mDayCyclesCombo->setLabel(getString("combo_label"));
+}
+
+void LLFloaterEditDayCycle::onTimeSliderMoved()
+{
+ /// get the slider value
+ F32 val = mTimeSlider->getCurSliderValue() / sHoursPerDay;
+
+ // set the value, turn off animation
+ LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ // then call update once
+ LLWLParamManager::getInstance()->mAnimator.update(
+ LLWLParamManager::getInstance()->mCurParams);
+}
+
+void LLFloaterEditDayCycle::onKeyTimeMoved()
+{
+ if (mKeysSlider->getValue().size() == 0)
+ {
+ return;
+ }
+
+ // make sure we have a slider
+ const std::string& cur_sldr = mKeysSlider->getCurSlider();
+ if (cur_sldr == "")
+ {
+ return;
+ }
+
+ F32 time24 = mKeysSlider->getCurSliderValue();
+
+ // check to see if a key exists
+ LLWLParamKey key = mSliderToKey[cur_sldr].keyframe;
+ lldebugs << "Setting key time: " << time24 << LL_ENDL;
+ mSliderToKey[cur_sldr].time = time24;
+
+ // if it exists, turn on check box
+ mSkyPresetsCombo->selectByValue(key.toStringVal());
+
+ mTimeCtrl->setTime24(time24);
+
+ applyTrack();
+}
+
+void LLFloaterEditDayCycle::onKeyTimeChanged()
+{
+ // if no keys, skipped
+ if (mSliderToKey.size() == 0)
+ {
+ return;
+ }
+
+ F32 time24 = mTimeCtrl->getTime24();
+
+ const std::string& cur_sldr = mKeysSlider->getCurSlider();
+ mKeysSlider->setCurSliderValue(time24, TRUE);
+ F32 time = mKeysSlider->getCurSliderValue() / sHoursPerDay;
+
+ // now set the key's time in the sliderToKey map
+ lldebugs << "Setting key time: " << time << LL_ENDL;
+ mSliderToKey[cur_sldr].time = time;
+
+ applyTrack();
+}
+
+void LLFloaterEditDayCycle::onKeyPresetChanged()
+{
+ // do nothing if no sliders
+ if (mKeysSlider->getValue().size() == 0)
+ {
+ return;
+ }
+
+ // change the map
+
+ std::string stringVal = mSkyPresetsCombo->getSelectedValue().asString();
+ LLWLParamKey new_key(stringVal);
+ llassert(!new_key.name.empty());
+ const std::string& cur_sldr = mKeysSlider->getCurSlider();
+
+ // if null, don't use
+ if (cur_sldr == "")
+ {
+ return;
+ }
+
+ mSliderToKey[cur_sldr].keyframe = new_key;
+
+ // Apply changes to current day cycle.
+ applyTrack();
+}
+
+void LLFloaterEditDayCycle::onAddKey()
+{
+ llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size());
+
+ S32 max_sliders;
+ LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL; // *TODO: editing region day cycle
+ switch (scope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ max_sliders = 20; // *HACK this should be LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES;
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ max_sliders = 12; // *HACK this should be LLWLPacketScrubber::MAX_REGION_KEY_FRAMES;
+ break;
+ default:
+ max_sliders = (S32) mKeysSlider->getMaxValue();
+ break;
+ }
+
+ if ((S32)mSliderToKey.size() >= max_sliders)
+ {
+ LLSD args;
+ args["SCOPE"] = LLEnvManager::getScopeString(scope);
+ args["MAX"] = max_sliders;
+ LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING);
+ return;
+ }
+
+ // add the slider key
+ std::string key_val = mSkyPresetsCombo->getSelectedValue().asString();
+ LLWLParamKey sky_params(key_val);
+ llassert(!sky_params.name.empty());
+
+ F32 time = mTimeSlider->getCurSliderValue();
+ addSliderKey(time, sky_params);
+
+ // apply the change to current day cycles
+ applyTrack();
+}
+
+void LLFloaterEditDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe)
+{
+ // make a slider
+ const std::string& sldr_name = mKeysSlider->addSlider(time);
+ if (sldr_name.empty())
+ {
+ return;
+ }
+
+ // set the key
+ SliderKey newKey(keyframe, mKeysSlider->getCurSliderValue());
+
+ llassert_always(sldr_name != LLStringUtil::null);
+
+ // add to map
+ mSliderToKey.insert(std::pair<std::string, SliderKey>(sldr_name, newKey));
+
+ llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size());
+}
+
+LLWLParamKey LLFloaterEditDayCycle::getSelectedDayCycle()
+{
+ LLWLParamKey dc_key;
+
+ if (mDayCycleNameEditor->getVisible())
+ {
+ dc_key.name = mDayCycleNameEditor->getText();
+ dc_key.scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ LLSD combo_val = mDayCyclesCombo->getValue();
+
+ if (!combo_val.isArray()) // manually typed text
+ {
+ dc_key.name = combo_val.asString();
+ dc_key.scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ dc_key.fromLLSD(combo_val);
+ }
+ }
+
+ return dc_key;
+}
+
+bool LLFloaterEditDayCycle::isNewDay() const
+{
+ return mKey.asString() == "new";
+}
+
+void LLFloaterEditDayCycle::dumpTrack()
+{
+ LL_DEBUGS("Windlight") << "Dumping day cycle" << LL_ENDL;
+
+ LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay;
+ for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it)
+ {
+ F32 time = it->first * 24.0f;
+ S32 h = (S32) time;
+ S32 m = (S32) ((time - h) * 60.0f);
+ LL_DEBUGS("Windlight") << llformat("(%.3f) %02d:%02d", time, h, m) << " => " << it->second.name << LL_ENDL;
+ }
+}
+
+void LLFloaterEditDayCycle::enableEditing(bool enable)
+{
+ mSkyPresetsCombo->setEnabled(enable);
+ mTimeCtrl->setEnabled(enable);
+ getChild<LLPanel>("day_cycle_slider_panel")->setCtrlsEnabled(enable);
+ mSaveButton->setEnabled(enable);
+ mMakeDefaultCheckBox->setEnabled(enable);
+}
+
+void LLFloaterEditDayCycle::reset()
+{
+ // clear the slider
+ mKeysSlider->clear();
+ mSliderToKey.clear();
+
+ refreshSkyPresetsList();
+
+ if (isNewDay())
+ {
+ mDayCycleNameEditor->setValue(LLSD());
+ F32 time = 0.5f * sHoursPerDay;
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ mTimeSlider->setCurSliderValue(time);
+
+ addSliderKey(time, LLWLParamKey("Default", LLEnvKey::SCOPE_LOCAL));
+ onKeyTimeMoved(); // update the time control and sky sky combo
+
+ applyTrack();
+ }
+ else
+ {
+ refreshDayCyclesList();
+
+ // Disable controls until a day cycle to edit is selected.
+ enableEditing(false);
+ }
+}
+
+void LLFloaterEditDayCycle::saveRegionDayCycle()
+{
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; // the day cycle being edited
+
+ // Get current day cycle and the sky preset it references.
+ LLSD day_cycle = cur_dayp.asLLSD();
+ LLSD sky_map;
+ cur_dayp.getSkyMap(sky_map);
+
+ // Apply it to the region.
+ LLEnvironmentSettings new_region_settings;
+ new_region_settings.saveParams(day_cycle, sky_map, env_mgr.getRegionSettings().getWaterParams(), 0.0f);
+
+#if 1
+ LLEnvManagerNew::instance().setRegionSettings(new_region_settings);
+#else // Temporary disabled ability to upload new region settings from the Day Cycle Editor.
+ if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings))
+ {
+ llwarns << "Error applying region environment settings" << llendl;
+ return;
+ }
+
+ setApplyProgress(true);
+#endif
+}
+
+void LLFloaterEditDayCycle::setApplyProgress(bool started)
+{
+ LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("progress_indicator");
+
+ indicator->setVisible(started);
+
+ if (started)
+ {
+ indicator->start();
+ }
+ else
+ {
+ indicator->stop();
+ }
+}
+
+bool LLFloaterEditDayCycle::getApplyProgress() const
+{
+ return getChild<LLLoadingIndicator>("progress_indicator")->getVisible();
+}
+
+void LLFloaterEditDayCycle::onDeleteKey()
+{
+ if (mSliderToKey.size() == 0)
+ {
+ return;
+ }
+ else if (mSliderToKey.size() == 1)
+ {
+ LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD());
+ return;
+ }
+
+ // delete from map
+ const std::string& sldr_name = mKeysSlider->getCurSlider();
+ std::map<std::string, SliderKey>::iterator mIt = mSliderToKey.find(sldr_name);
+ mSliderToKey.erase(mIt);
+
+ mKeysSlider->deleteCurSlider();
+
+ if (mSliderToKey.size() == 0)
+ {
+ return;
+ }
+
+ const std::string& name = mKeysSlider->getCurSlider();
+ mSkyPresetsCombo->selectByValue(mSliderToKey[name].keyframe.toStringVal());
+ F32 time24 = mSliderToKey[name].time;
+
+ mTimeCtrl->setTime24(time24);
+
+ applyTrack();
+}
+
+void LLFloaterEditDayCycle::onRegionSettingsChange()
+{
+ LL_DEBUGS("Windlight") << "Region settings changed" << LL_ENDL;
+
+ if (getApplyProgress()) // our region settings have being applied
+ {
+ setApplyProgress(false);
+
+ // Change preference if requested.
+ if (mMakeDefaultCheckBox->getValue())
+ {
+ LL_DEBUGS("Windlight") << "Changed environment preference to region settings" << llendl;
+ LLEnvManagerNew::instance().setUseRegionSettings(true);
+ }
+
+ closeFloater();
+ }
+}
+
+void LLFloaterEditDayCycle::onRegionChange()
+{
+ LL_DEBUGS("Windlight") << "Region changed" << LL_ENDL;
+
+ // If we're editing the region day cycle
+ if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION)
+ {
+ reset(); // undoes all unsaved changes
+ }
+}
+
+void LLFloaterEditDayCycle::onRegionSettingsApplied(bool success)
+{
+ LL_DEBUGS("Windlight") << "Region settings applied: " << success << LL_ENDL;
+
+ if (!success)
+ {
+ // stop progress indicator
+ setApplyProgress(false);
+ }
+}
+
+void LLFloaterEditDayCycle::onRegionInfoUpdate()
+{
+ LL_DEBUGS("Windlight") << "Region info updated" << LL_ENDL;
+ bool can_edit = true;
+
+ // If we've selected the region day cycle for editing.
+ if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION)
+ {
+ // check whether we have the access
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
+
+ enableEditing(can_edit);
+}
+
+void LLFloaterEditDayCycle::onDayCycleNameEdited()
+{
+ // Disable saving a day cycle having empty name.
+ LLWLParamKey key = getSelectedDayCycle();
+ mSaveButton->setEnabled(!key.name.empty());
+}
+
+void LLFloaterEditDayCycle::onDayCycleSelected()
+{
+ LLSD day_data;
+ LLWLParamKey dc_key = getSelectedDayCycle();
+ bool can_edit = true;
+
+ if (dc_key.scope == LLEnvKey::SCOPE_LOCAL)
+ {
+ if (!LLDayCycleManager::instance().getPreset(dc_key.name, day_data))
+ {
+ llwarns << "No day cycle named " << dc_key.name << llendl;
+ return;
+ }
+ }
+ else
+ {
+ day_data = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle();
+ if (day_data.size() == 0)
+ {
+ llwarns << "Empty region day cycle" << llendl;
+ llassert(day_data.size() > 0);
+ return;
+ }
+
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
+
+ // We may need to add or remove region skies from the list.
+ refreshSkyPresetsList();
+
+ F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay;
+ LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time);
+ loadTrack();
+
+ enableEditing(can_edit);
+}
+
+void LLFloaterEditDayCycle::onBtnSave()
+{
+ LLDayCycleManager& day_mgr = LLDayCycleManager::instance();
+ LLWLParamKey selected_day = getSelectedDayCycle();
+
+ if (selected_day.scope == LLEnvKey::SCOPE_REGION)
+ {
+ saveRegionDayCycle();
+ closeFloater();
+ return;
+ }
+
+ std::string name = selected_day.name;
+ if (name.empty())
+ {
+ // *TODO: show an alert
+ llwarns << "Empty day cycle name" << llendl;
+ return;
+ }
+
+ // Don't allow overwriting system presets.
+ if (day_mgr.isSystemPreset(name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ // Save, ask for confirmation for overwriting an existing preset.
+ if (day_mgr.presetExists(name))
+ {
+ LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditDayCycle::onSaveAnswer, this, _1, _2));
+ }
+ else
+ {
+ // new preset, hence no confirmation needed
+ onSaveConfirmed();
+ }
+}
+
+void LLFloaterEditDayCycle::onBtnCancel()
+{
+ closeFloater();
+}
+
+bool LLFloaterEditDayCycle::onSaveAnswer(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ // If they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ onSaveConfirmed();
+ }
+
+ return false;
+}
+
+void LLFloaterEditDayCycle::onSaveConfirmed()
+{
+ std::string name = getSelectedDayCycle().name;
+
+ // Save preset.
+ LLSD data = LLWLParamManager::instance().mDay.asLLSD();
+ LL_DEBUGS("Windlight") << "Saving day cycle " << name << ": " << data << LL_ENDL;
+ LLDayCycleManager::instance().savePreset(name, data);
+
+ // Change preference if requested.
+ if (mMakeDefaultCheckBox->getValue())
+ {
+ LL_DEBUGS("Windlight") << name << " is now the new preferred day cycle" << llendl;
+ LLEnvManagerNew::instance().setUseDayCycle(name);
+ }
+
+ closeFloater();
+}
+
+void LLFloaterEditDayCycle::onDayCycleListChange()
+{
+ if (!isNewDay())
+ {
+ refreshDayCyclesList();
+ }
+}
+
+void LLFloaterEditDayCycle::onSkyPresetListChange()
+{
+ refreshSkyPresetsList();
+
+ // Refresh sliders from the currently visible day cycle.
+ loadTrack();
+}
+
+// static
+std::string LLFloaterEditDayCycle::getRegionName()
+{
+ return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown");
+}
diff --git a/indra/newview/llfloatereditdaycycle.h b/indra/newview/llfloatereditdaycycle.h
new file mode 100644
index 0000000000..e6e4fe39c1
--- /dev/null
+++ b/indra/newview/llfloatereditdaycycle.h
@@ -0,0 +1,137 @@
+/**
+ * @file llfloatereditdaycycle.h
+ * @brief Floater to create or edit a day cycle
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATEREDITDAYCYCLE_H
+#define LL_LLFLOATEREDITDAYCYCLE_H
+
+#include "llfloater.h"
+
+#include "llwlparammanager.h" // for LLWLParamKey
+
+class LLCheckBoxCtrl;
+class LLComboBox;
+class LLLineEditor;
+class LLMultiSliderCtrl;
+class LLTimeCtrl;
+
+/**
+ * Floater for creating or editing a day cycle.
+ */
+class LLFloaterEditDayCycle : public LLFloater
+{
+ LOG_CLASS(LLFloaterEditDayCycle);
+
+public:
+ LLFloaterEditDayCycle(const LLSD &key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void draw();
+
+private:
+
+ /// sync the time slider with day cycle structure
+ void syncTimeSlider();
+
+ // makes sure key slider has what's in day cycle
+ void loadTrack();
+
+ /// makes sure day cycle data structure has what's in menu
+ void applyTrack();
+
+ /// refresh the sky presets combobox
+ void refreshSkyPresetsList();
+
+ /// refresh the day cycle combobox
+ void refreshDayCyclesList();
+
+ /// add a slider to the track
+ void addSliderKey(F32 time, LLWLParamKey keyframe);
+
+ void initCallbacks();
+ LLWLParamKey getSelectedDayCycle();
+ bool isNewDay() const;
+ void dumpTrack();
+ void enableEditing(bool enable);
+ void reset();
+ void saveRegionDayCycle();
+
+ void setApplyProgress(bool started);
+ bool getApplyProgress() const;
+
+ void onTimeSliderMoved(); /// time slider moved
+ void onKeyTimeMoved(); /// a key frame moved
+ void onKeyTimeChanged(); /// a key frame's time changed
+ void onKeyPresetChanged(); /// sky preset selected
+ void onAddKey(); /// new key added on slider
+ void onDeleteKey(); /// a key frame deleted
+
+ void onRegionSettingsChange();
+ void onRegionChange();
+ void onRegionSettingsApplied(bool success);
+ void onRegionInfoUpdate();
+
+ void onDayCycleNameEdited();
+ void onDayCycleSelected();
+ void onBtnSave();
+ void onBtnCancel();
+
+ bool onSaveAnswer(const LLSD& notification, const LLSD& response);
+ void onSaveConfirmed();
+
+ void onDayCycleListChange();
+ void onSkyPresetListChange();
+
+ static std::string getRegionName();
+
+ /// convenience class for holding keyframes mapped to sliders
+ struct SliderKey
+ {
+ public:
+ SliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {}
+ SliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor
+
+ LLWLParamKey keyframe;
+ F32 time;
+ };
+
+ static const F32 sHoursPerDay;
+
+ LLLineEditor* mDayCycleNameEditor;
+ LLComboBox* mDayCyclesCombo;
+ LLMultiSliderCtrl* mTimeSlider;
+ LLMultiSliderCtrl* mKeysSlider;
+ LLComboBox* mSkyPresetsCombo;
+ LLTimeCtrl* mTimeCtrl;
+ LLCheckBoxCtrl* mMakeDefaultCheckBox;
+ LLButton* mSaveButton;
+
+ // map of sliders to parameters
+ std::map<std::string, SliderKey> mSliderToKey;
+};
+
+#endif // LL_LLFLOATEREDITDAYCYCLE_H
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
new file mode 100644
index 0000000000..0163dfbf30
--- /dev/null
+++ b/indra/newview/llfloatereditsky.cpp
@@ -0,0 +1,922 @@
+/**
+ * @file llfloatereditsky.cpp
+ * @brief Floater to create or edit a sky preset
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloatereditsky.h"
+
+// libs
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
+#include "llmultisliderctrl.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llsliderctrl.h"
+#include "lltabcontainer.h"
+#include "lltimectrl.h"
+
+// newview
+#include "llagent.h"
+#include "llcolorswatch.h"
+#include "llregioninfomodel.h"
+#include "llviewerregion.h"
+
+static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
+static const F32 WL_BLUE_HORIZON_DENSITY_SCALE = 2.0f;
+static const F32 WL_CLOUD_SLIDER_SCALE = 1.0f;
+
+static F32 sun_pos_to_time24(F32 sun_pos)
+{
+ return fmodf(sun_pos * 24.0f + 6, 24.0f);
+}
+
+static F32 time24_to_sun_pos(F32 time24)
+{
+ F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f);
+ if (sun_pos < 0) ++sun_pos;
+ return sun_pos;
+}
+
+LLFloaterEditSky::LLFloaterEditSky(const LLSD &key)
+: LLFloater(key)
+, mSkyPresetNameEditor(NULL)
+, mSkyPresetCombo(NULL)
+, mMakeDefaultCheckBox(NULL)
+, mSaveButton(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterEditSky::postBuild()
+{
+ mSkyPresetNameEditor = getChild<LLLineEditor>("sky_preset_name");
+ mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo");
+ mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
+ mSaveButton = getChild<LLButton>("save");
+
+ initCallbacks();
+
+ // Create the sun position scrubber on the slider.
+ getChild<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f);
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterEditSky::onOpen(const LLSD& key)
+{
+ bool new_preset = isNewPreset();
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string hint = getString(std::string("hint_" + param));
+
+ // Update floater title.
+ setTitle(floater_title);
+
+ // Update the hint at the top.
+ getChild<LLUICtrl>("hint")->setValue(hint);
+
+ // Hide the hint to the right of the combo if we're invoked to create a new preset.
+ getChildView("note")->setVisible(!new_preset);
+
+ // Switch between the sky presets combobox and preset name input field.
+ mSkyPresetCombo->setVisible(!new_preset);
+ mSkyPresetNameEditor->setVisible(new_preset);
+
+ reset();
+}
+
+// virtual
+void LLFloaterEditSky::onClose(bool app_quitting)
+{
+ if (!app_quitting) // there's no point to change environment if we're quitting
+ {
+ LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment
+ }
+}
+
+// virtual
+void LLFloaterEditSky::draw()
+{
+ syncControls();
+ LLFloater::draw();
+}
+
+void LLFloaterEditSky::initCallbacks(void)
+{
+ // *TODO: warn user if a region environment update comes while we're editing a region sky preset.
+
+ mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL);
+ mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this));
+ mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this));
+
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
+
+ LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditSky::onRegionSettingsChange, this));
+ LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
+
+ // Connect to region info updates.
+ LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
+
+ //-------------------------------------------------------------------------
+
+ LLWLParamManager& param_mgr = LLWLParamManager::instance();
+
+ // blue horizon
+ getChild<LLUICtrl>("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mBlueHorizon));
+
+ // haze density, horizon, mult, and altitude
+ getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mHazeDensity));
+ getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mHazeHorizon));
+ getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mDensityMult));
+ getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mMaxAlt));
+
+ // blue density
+ getChild<LLUICtrl>("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mBlueDensity));
+
+ // Lighting
+
+ // sunlight
+ getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mSunlight));
+
+ // glow
+ getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &param_mgr.mGlow));
+ getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &param_mgr.mGlow));
+
+ // ambient
+ getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mAmbient));
+
+ // time of day
+ getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm)); // multi-slider
+ getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
+ getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm));
+
+ // Clouds
+
+ // Cloud Color
+ getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mCloudColor));
+
+ // Cloud
+ getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mCloudMain));
+ getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &param_mgr.mCloudMain));
+ getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &param_mgr.mCloudMain));
+
+ // Cloud Detail
+ getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mCloudDetail));
+ getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &param_mgr.mCloudDetail));
+ getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &param_mgr.mCloudDetail));
+
+ // Cloud extras
+ getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mCloudCoverage));
+ getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mCloudScale));
+ getChild<LLUICtrl>("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXToggled, this, _1));
+ getChild<LLUICtrl>("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYToggled, this, _1));
+ getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
+ getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
+ getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mDistanceMult));
+
+ // Dome
+ getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mWLGamma));
+ getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
+}
+
+//=================================================================================================
+
+void LLFloaterEditSky::syncControls()
+{
+ bool err;
+
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
+
+ LLWLParamSet& cur_params = param_mgr->mCurParams;
+
+ // blue horizon
+ param_mgr->mBlueHorizon = cur_params.getVector(param_mgr->mBlueHorizon.mName, err);
+ setColorSwatch("WLBlueHorizon", param_mgr->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE);
+
+ // haze density, horizon, mult, and altitude
+ param_mgr->mHazeDensity = cur_params.getVector(param_mgr->mHazeDensity.mName, err);
+ childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r);
+ param_mgr->mHazeHorizon = cur_params.getVector(param_mgr->mHazeHorizon.mName, err);
+ childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r);
+ param_mgr->mDensityMult = cur_params.getVector(param_mgr->mDensityMult.mName, err);
+ childSetValue("WLDensityMult", param_mgr->mDensityMult.x *
+ param_mgr->mDensityMult.mult);
+ param_mgr->mMaxAlt = cur_params.getVector(param_mgr->mMaxAlt.mName, err);
+ childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x);
+
+ // blue density
+ param_mgr->mBlueDensity = cur_params.getVector(param_mgr->mBlueDensity.mName, err);
+ setColorSwatch("WLBlueDensity", param_mgr->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE);
+
+ // Lighting
+
+ // sunlight
+ param_mgr->mSunlight = cur_params.getVector(param_mgr->mSunlight.mName, err);
+ setColorSwatch("WLSunlight", param_mgr->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
+
+ // glow
+ param_mgr->mGlow = cur_params.getVector(param_mgr->mGlow.mName, err);
+ childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f);
+ childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f);
+
+ // ambient
+ param_mgr->mAmbient = cur_params.getVector(param_mgr->mAmbient.mName, err);
+ setColorSwatch("WLAmbient", param_mgr->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE);
+
+ F32 sun_pos = param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI;
+ getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(sun_pos_to_time24(sun_pos), TRUE);
+ childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI);
+
+ // Clouds
+
+ // Cloud Color
+ param_mgr->mCloudColor = cur_params.getVector(param_mgr->mCloudColor.mName, err);
+ setColorSwatch("WLCloudColor", param_mgr->mCloudColor, WL_CLOUD_SLIDER_SCALE);
+
+ // Cloud
+ param_mgr->mCloudMain = cur_params.getVector(param_mgr->mCloudMain.mName, err);
+ childSetValue("WLCloudX", param_mgr->mCloudMain.r);
+ childSetValue("WLCloudY", param_mgr->mCloudMain.g);
+ childSetValue("WLCloudDensity", param_mgr->mCloudMain.b);
+
+ // Cloud Detail
+ param_mgr->mCloudDetail = cur_params.getVector(param_mgr->mCloudDetail.mName, err);
+ childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r);
+ childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g);
+ childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
+
+ // Cloud extras
+ param_mgr->mCloudCoverage = cur_params.getVector(param_mgr->mCloudCoverage.mName, err);
+ param_mgr->mCloudScale = cur_params.getVector(param_mgr->mCloudScale.mName, err);
+ childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x);
+ childSetValue("WLCloudScale", param_mgr->mCloudScale.x);
+
+ // cloud scrolling
+ bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX();
+ bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY();
+ childSetValue("WLCloudLockX", lockX);
+ childSetValue("WLCloudLockY", lockY);
+
+ // disable if locked, enable if not
+ if (lockX)
+ {
+ childDisable("WLCloudScrollX");
+ }
+ else
+ {
+ childEnable("WLCloudScrollX");
+ }
+ if (lockY)
+ {
+ childDisable("WLCloudScrollY");
+ }
+ else
+ {
+ childEnable("WLCloudScrollY");
+ }
+
+ // *HACK cloud scrolling is off my an additive of 10
+ childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
+ childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
+
+ param_mgr->mDistanceMult = cur_params.getVector(param_mgr->mDistanceMult.mName, err);
+ childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x);
+
+ // Tweak extras
+
+ param_mgr->mWLGamma = cur_params.getVector(param_mgr->mWLGamma.mName, err);
+ childSetValue("WLGamma", param_mgr->mWLGamma.x);
+
+ childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
+}
+
+void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
+{
+ // Set the value, dividing it by <k> first.
+ LLVector4 color_vec = from_ctrl;
+ getChild<LLColorSwatchCtrl>(name)->set(LLColor4(color_vec / k));
+}
+
+// color control callbacks
+void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
+ LLVector4 color_vec(swatch->get().mV);
+
+ // Set intensity to maximum of the RGB values.
+ color_vec.mV[3] = llmax(color_vec.mV[0], llmax(color_vec.mV[1], color_vec.mV[2]));
+
+ // Multiply RGB values by the appropriate factor.
+ F32 k = WL_CLOUD_SLIDER_SCALE;
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+
+ color_vec *= k; // intensity isn't affected by the multiplication
+
+ // Apply the new RGBI value.
+ *color_ctrl = color_vec;
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ color_ctrl->r = sldr_ctrl->getValueF32();
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ color_ctrl->r *= WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ color_ctrl->r *= WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+
+ // move i if it's the max
+ if (color_ctrl->r >= color_ctrl->g && color_ctrl->r >= color_ctrl->b && color_ctrl->hasSliderName)
+ {
+ color_ctrl->i = color_ctrl->r;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ childSetValue(name, color_ctrl->r / WL_SUN_AMBIENT_SLIDER_SCALE);
+ }
+ else if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ childSetValue(name, color_ctrl->r / WL_BLUE_HORIZON_DENSITY_SCALE);
+ }
+ else
+ {
+ childSetValue(name, color_ctrl->r);
+ }
+ }
+
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ color_ctrl->g = sldr_ctrl->getValueF32();
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ color_ctrl->g *= WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ color_ctrl->g *= WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+
+ // move i if it's the max
+ if (color_ctrl->g >= color_ctrl->r && color_ctrl->g >= color_ctrl->b && color_ctrl->hasSliderName)
+ {
+ color_ctrl->i = color_ctrl->g;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ childSetValue(name, color_ctrl->g / WL_SUN_AMBIENT_SLIDER_SCALE);
+ }
+ else if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ childSetValue(name, color_ctrl->g / WL_BLUE_HORIZON_DENSITY_SCALE);
+ }
+ else
+ {
+ childSetValue(name, color_ctrl->g);
+ }
+ }
+
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ color_ctrl->b = sldr_ctrl->getValueF32();
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ color_ctrl->b *= WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ color_ctrl->b *= WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+
+ // move i if it's the max
+ if (color_ctrl->b >= color_ctrl->r && color_ctrl->b >= color_ctrl->g && color_ctrl->hasSliderName)
+ {
+ color_ctrl->i = color_ctrl->b;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ if (color_ctrl->isSunOrAmbientColor)
+ {
+ childSetValue(name, color_ctrl->b / WL_SUN_AMBIENT_SLIDER_SCALE);
+ }
+ else if (color_ctrl->isBlueHorizonOrDensity)
+ {
+ childSetValue(name, color_ctrl->b / WL_BLUE_HORIZON_DENSITY_SCALE);
+ }
+ else
+ {
+ childSetValue(name, color_ctrl->b);
+ }
+ }
+
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+/// GLOW SPECIFIC CODE
+void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ // scaled by 20
+ color_ctrl->r = (2 - sldr_ctrl->getValueF32()) * 20;
+
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+/// \NOTE that we want NEGATIVE (-) B
+void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
+ color_ctrl->b = -sldr_ctrl->getValueF32() * 5;
+
+ color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
+
+ floatControl->x = sldr_ctrl->getValueF32() / floatControl->mult;
+
+ floatControl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
+}
+
+
+// Lighting callbacks
+
+// time of day
+void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
+ LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
+ LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+
+ F32 time24 = sun_msldr->getCurSliderValue();
+ time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position
+
+ // get the two angles
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
+
+ param_mgr->mCurParams.setSunAngle(F_TWO_PI * time24_to_sun_pos(time24));
+ param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32());
+
+ // set the sun vector
+ color_ctrl->r = -sin(param_mgr->mCurParams.getEastAngle()) *
+ cos(param_mgr->mCurParams.getSunAngle());
+ color_ctrl->g = sin(param_mgr->mCurParams.getSunAngle());
+ color_ctrl->b = cos(param_mgr->mCurParams.getEastAngle()) *
+ cos(param_mgr->mCurParams.getSunAngle());
+ color_ctrl->i = 1.f;
+
+ color_ctrl->update(param_mgr->mCurParams);
+ param_mgr->propagateParameters();
+}
+
+void LLFloaterEditSky::onTimeChanged()
+{
+ F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
+ getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
+ onSunMoved(getChild<LLUICtrl>("WLSunPos"), &LLWLParamManager::instance().mLightnorm);
+}
+
+void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldr_ctrl->getValueF32());
+}
+
+// Clouds
+void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ // *HACK all cloud scrolling is off by an additive of 10.
+ LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldr_ctrl->getValueF32() + 10.0f);
+}
+
+void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ // *HACK all cloud scrolling is off by an additive of 10.
+ LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldr_ctrl->getValueF32() + 10.0f);
+}
+
+void LLFloaterEditSky::onCloudScrollXToggled(LLUICtrl* ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
+
+ bool lock = cb_ctrl->get();
+ LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock);
+
+ LLSliderCtrl* sldr = getChild<LLSliderCtrl>("WLCloudScrollX");
+
+ if (cb_ctrl->get())
+ {
+ sldr->setEnabled(false);
+ }
+ else
+ {
+ sldr->setEnabled(true);
+ }
+
+}
+
+void LLFloaterEditSky::onCloudScrollYToggled(LLUICtrl* ctrl)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
+ bool lock = cb_ctrl->get();
+ LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
+
+ LLSliderCtrl* sldr = getChild<LLSliderCtrl>("WLCloudScrollY");
+
+ if (cb_ctrl->get())
+ {
+ sldr->setEnabled(false);
+ }
+ else
+ {
+ sldr->setEnabled(true);
+ }
+}
+
+//=================================================================================================
+
+void LLFloaterEditSky::reset()
+{
+ if (isNewPreset())
+ {
+ mSkyPresetNameEditor->setValue(LLSD());
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ }
+ else
+ {
+ refreshSkyPresetsList();
+
+ // Disable controls until a sky preset to edit is selected.
+ enableEditing(false);
+ }
+}
+
+bool LLFloaterEditSky::isNewPreset() const
+{
+ return mKey.asString() == "new";
+}
+
+void LLFloaterEditSky::refreshSkyPresetsList()
+{
+ mSkyPresetCombo->removeall();
+
+ LLWLParamManager::preset_name_list_t region_presets, user_presets, sys_presets;
+ LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets);
+
+#if 0 // Disable editing region skies until the workflow is clear enough.
+ // Add region presets.
+ std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown");
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it)
+ {
+ std::string item_title = *it + " (" + region_name + ")";
+ mSkyPresetCombo->add(item_title, LLWLParamKey(*it, LLEnvKey::SCOPE_REGION).toLLSD());
+ }
+ if (region_presets.size() > 0)
+ {
+ mSkyPresetCombo->addSeparator();
+ }
+#endif
+
+ // Add user presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+ if (user_presets.size() > 0)
+ {
+ mSkyPresetCombo->addSeparator();
+ }
+
+ // Add system presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ mSkyPresetCombo->setLabel(getString("combo_label"));
+}
+
+void LLFloaterEditSky::enableEditing(bool enable)
+{
+ // Enable/disable the tab and their contents.
+ LLTabContainer* tab_container = getChild<LLTabContainer>("WindLight Tabs");
+ tab_container->setEnabled(enable);
+ for (S32 i = 0; i < tab_container->getTabCount(); ++i)
+ {
+ tab_container->enableTabButton(i, enable);
+ tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable);
+ }
+
+ // Enable/disable saving.
+ mSaveButton->setEnabled(enable);
+ mMakeDefaultCheckBox->setEnabled(enable);
+}
+
+void LLFloaterEditSky::saveRegionSky()
+{
+ LLWLParamKey key(getSelectedSkyPreset());
+ llassert(key.scope == LLEnvKey::SCOPE_REGION);
+
+ LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+ wl_mgr.mCurParams.mName = key.name;
+ wl_mgr.setParamSet(key, wl_mgr.mCurParams);
+
+ // *TODO: save to cached region settings.
+ LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL;
+}
+
+LLWLParamKey LLFloaterEditSky::getSelectedSkyPreset()
+{
+ LLWLParamKey key;
+
+ if (mSkyPresetNameEditor->getVisible())
+ {
+ key.name = mSkyPresetNameEditor->getText();
+ key.scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ LLSD combo_val = mSkyPresetCombo->getValue();
+
+ if (!combo_val.isArray()) // manually typed text
+ {
+ key.name = combo_val.asString();
+ key.scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ key.fromLLSD(combo_val);
+ }
+ }
+
+ return key;
+}
+
+void LLFloaterEditSky::onSkyPresetNameEdited()
+{
+ // Disable saving a sky preset having empty name.
+ LLWLParamKey key = getSelectedSkyPreset();
+ mSaveButton->setEnabled(!key.name.empty());
+}
+
+void LLFloaterEditSky::onSkyPresetSelected()
+{
+ LLWLParamKey key = getSelectedSkyPreset();
+ LLWLParamSet sky_params;
+
+ if (!LLWLParamManager::instance().getParamSet(key, sky_params))
+ {
+ // Manually entered string?
+ LL_WARNS("Windlight") << "No sky preset named " << key.toString() << LL_ENDL;
+ return;
+ }
+
+ LLEnvManagerNew::instance().useSkyParams(sky_params.getAll());
+ //syncControls();
+
+ bool can_edit = (key.scope == LLEnvKey::SCOPE_LOCAL || LLEnvManagerNew::canEditRegionSettings());
+ enableEditing(can_edit);
+
+ mMakeDefaultCheckBox->setEnabled(key.scope == LLEnvKey::SCOPE_LOCAL);
+}
+
+bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ // If they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ onSaveConfirmed();
+ }
+
+ return false;
+}
+
+void LLFloaterEditSky::onSaveConfirmed()
+{
+ // Save current params to the selected preset.
+ LLWLParamKey key(getSelectedSkyPreset());
+
+ LL_DEBUGS("Windlight") << "Saving sky preset " << key.name << LL_ENDL;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+ if (wl_mgr.hasParamSet(key))
+ {
+ wl_mgr.setParamSet(key, wl_mgr.mCurParams);
+ }
+ else
+ {
+ wl_mgr.addParamSet(key, wl_mgr.mCurParams);
+ }
+
+ wl_mgr.savePreset(key);
+
+ // Change preference if requested.
+ if (mMakeDefaultCheckBox->getValue())
+ {
+ LL_DEBUGS("Windlight") << key.name << " is now the new preferred sky preset" << llendl;
+ LLEnvManagerNew::instance().setUseSkyPreset(key.name);
+ }
+
+ closeFloater();
+}
+
+void LLFloaterEditSky::onBtnSave()
+{
+ LLWLParamKey selected_sky = getSelectedSkyPreset();
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+
+ if (selected_sky.scope == LLEnvKey::SCOPE_REGION)
+ {
+ saveRegionSky();
+ closeFloater();
+ return;
+ }
+
+ std::string name = selected_sky.name;
+ if (name.empty())
+ {
+ // *TODO: show an alert
+ llwarns << "Empty sky preset name" << llendl;
+ return;
+ }
+
+ // Don't allow overwriting system presets.
+ if (wl_mgr.isSystemPreset(name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ // Save, ask for confirmation for overwriting an existing preset.
+ if (wl_mgr.hasParamSet(selected_sky))
+ {
+ LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditSky::onSaveAnswer, this, _1, _2));
+ }
+ else
+ {
+ // new preset, hence no confirmation needed
+ onSaveConfirmed();
+ }
+}
+
+void LLFloaterEditSky::onBtnCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterEditSky::onSkyPresetListChange()
+{
+ LLWLParamKey key = getSelectedSkyPreset(); // preset being edited
+ if (!LLWLParamManager::instance().hasParamSet(key))
+ {
+ // Preset we've been editing doesn't exist anymore. Close the floater.
+ closeFloater(false);
+ }
+ else
+ {
+ // A new preset has been added.
+ // Refresh the presets list, though it may not make sense as the floater is about to be closed.
+ refreshSkyPresetsList();
+ }
+}
+
+void LLFloaterEditSky::onRegionSettingsChange()
+{
+ // If creating a new sky, don't bother.
+ if (isNewPreset())
+ {
+ return;
+ }
+
+ if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky
+ {
+ // reset the floater to its initial state
+ reset();
+
+ // *TODO: Notify user?
+ }
+ else // editing a local sky
+ {
+ refreshSkyPresetsList();
+ }
+}
+
+void LLFloaterEditSky::onRegionInfoUpdate()
+{
+ bool can_edit = true;
+
+ // If we've selected a region sky preset for editing.
+ if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION)
+ {
+ // check whether we have the access
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
+
+ enableEditing(can_edit);
+}
diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h
new file mode 100644
index 0000000000..a06c4fc5fa
--- /dev/null
+++ b/indra/newview/llfloatereditsky.h
@@ -0,0 +1,113 @@
+/**
+ * @file llfloatereditsky.h
+ * @brief Floater to create or edit a sky preset
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATEREDITSKY_H
+#define LL_LLFLOATEREDITSKY_H
+
+#include "llfloater.h"
+#include "llwlparammanager.h"
+
+class LLButton;
+class LLCheckBoxCtrl;
+class LLComboBox;
+class LLLineEditor;
+
+/**
+ * Floater for creating or editing a sky preset.
+ */
+class LLFloaterEditSky : public LLFloater
+{
+ LOG_CLASS(LLFloaterEditSky);
+
+public:
+ LLFloaterEditSky(const LLSD &key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void draw();
+
+private:
+ void initCallbacks(void);
+
+ //-- WL stuff begins ------------------------------------------------------
+
+ void syncControls(); /// sync up sliders with parameters
+
+ void setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k);
+
+ // general purpose callbacks for dealing with color controllers
+ void onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl);
+ void onColorControlRMoved(LLUICtrl* ctrl, void* userdata);
+ void onColorControlGMoved(LLUICtrl* ctrl, void* userdata);
+ void onColorControlBMoved(LLUICtrl* ctrl, void* userdata);
+ void onFloatControlMoved(LLUICtrl* ctrl, void* userdata);
+
+ // lighting callbacks for glow
+ void onGlowRMoved(LLUICtrl* ctrl, void* userdata);
+ void onGlowBMoved(LLUICtrl* ctrl, void* userdata);
+
+ // lighting callbacks for sun
+ void onSunMoved(LLUICtrl* ctrl, void* userdata);
+ void onTimeChanged();
+
+ // for handling when the star slider is moved to adjust the alpha
+ void onStarAlphaMoved(LLUICtrl* ctrl);
+
+ // handle cloud scrolling
+ void onCloudScrollXMoved(LLUICtrl* ctrl);
+ void onCloudScrollYMoved(LLUICtrl* ctrl);
+ void onCloudScrollXToggled(LLUICtrl* ctrl);
+ void onCloudScrollYToggled(LLUICtrl* ctrl);
+
+ //-- WL stuff ends --------------------------------------------------------
+
+ void reset(); /// reset the floater to its initial state
+ bool isNewPreset() const;
+ void refreshSkyPresetsList();
+ void enableEditing(bool enable);
+ void saveRegionSky();
+ LLWLParamKey getSelectedSkyPreset();
+
+ void onSkyPresetNameEdited();
+ void onSkyPresetSelected();
+ bool onSaveAnswer(const LLSD& notification, const LLSD& response);
+ void onSaveConfirmed();
+
+ void onBtnSave();
+ void onBtnCancel();
+
+ void onSkyPresetListChange();
+ void onRegionSettingsChange();
+ void onRegionInfoUpdate();
+
+ LLLineEditor* mSkyPresetNameEditor;
+ LLComboBox* mSkyPresetCombo;
+ LLCheckBoxCtrl* mMakeDefaultCheckBox;
+ LLButton* mSaveButton;
+};
+
+#endif // LL_LLFLOATEREDITSKY_H
diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp
new file mode 100644
index 0000000000..64cfc4054f
--- /dev/null
+++ b/indra/newview/llfloatereditwater.cpp
@@ -0,0 +1,772 @@
+/**
+ * @file llfloatereditwater.cpp
+ * @brief Floater to create or edit a water preset
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloatereditwater.h"
+
+// libs
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llcolorswatch.h"
+#include "llcombobox.h"
+//#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llsliderctrl.h"
+#include "lltexturectrl.h"
+
+// newview
+#include "llagent.h"
+#include "llregioninfomodel.h"
+#include "llviewerregion.h"
+#include "llwaterparammanager.h"
+
+#undef max // Fixes a Windows compiler error
+
+LLFloaterEditWater::LLFloaterEditWater(const LLSD &key)
+: LLFloater(key)
+, mWaterPresetNameEditor(NULL)
+, mWaterPresetCombo(NULL)
+, mMakeDefaultCheckBox(NULL)
+, mSaveButton(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterEditWater::postBuild()
+{
+ mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name");
+ mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo");
+ mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
+ mSaveButton = getChild<LLButton>("save");
+
+ initCallbacks();
+ refreshWaterPresetsList();
+ syncControls();
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterEditWater::onOpen(const LLSD& key)
+{
+ bool new_preset = isNewPreset();
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string hint = getString(std::string("hint_" + param));
+
+ // Update floater title.
+ setTitle(floater_title);
+
+ // Update the hint at the top.
+ getChild<LLUICtrl>("hint")->setValue(hint);
+
+ // Hide the hint to the right of the combo if we're invoked to create a new preset.
+ getChildView("note")->setVisible(!new_preset);
+
+ // Switch between the water presets combobox and preset name input field.
+ mWaterPresetCombo->setVisible(!new_preset);
+ mWaterPresetNameEditor->setVisible(new_preset);
+
+ reset();
+}
+
+// virtual
+void LLFloaterEditWater::onClose(bool app_quitting)
+{
+ if (!app_quitting) // there's no point to change environment if we're quitting
+ {
+ LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment
+ }
+}
+
+// virtual
+void LLFloaterEditWater::draw()
+{
+ syncControls();
+ LLFloater::draw();
+}
+
+void LLFloaterEditWater::initCallbacks(void)
+{
+ mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL);
+ mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this));
+ mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this));
+
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this));
+
+ LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditWater::onRegionSettingsChange, this));
+ LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this));
+
+ // Connect to region info updates.
+ LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this));
+
+ //-------------------------------------------------------------------------
+
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+
+ getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterFogColorMoved, this, _1, &water_mgr.mFogColor));
+ //getChild<LLUICtrl>("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlAMoved, this, _1, &water_mgr.mFogColor));
+
+ // fog density
+ getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &water_mgr.mFogDensity));
+ getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mUnderWaterFogMod));
+
+ // blue density
+ getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &water_mgr.mNormalScale));
+ getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &water_mgr.mNormalScale));
+ getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &water_mgr.mNormalScale));
+
+ // fresnel
+ getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelScale));
+ getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelOffset));
+
+ // scale above/below
+ getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mScaleAbove));
+ getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mScaleBelow));
+
+ // blur mult
+ getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &water_mgr.mBlurMultiplier));
+
+ // wave direction
+ getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave1Dir));
+ getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave1Dir));
+ getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave2Dir));
+ getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave2Dir));
+
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap");
+ texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
+ texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1));
+}
+
+//=============================================================================
+
+void LLFloaterEditWater::syncControls()
+{
+ // *TODO: Eliminate slow getChild() calls.
+
+ bool err;
+
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+
+ LLWaterParamSet& current_params = water_mgr.mCurParams;
+
+ // blue horizon
+ water_mgr.mFogColor = current_params.getVector4(water_mgr.mFogColor.mName, err);
+
+ LLColor4 col = water_mgr.getFogColor();
+ //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
+ col.mV[3] = 1.0f;
+ getChild<LLColorSwatchCtrl>("WaterFogColor")->set(col);
+
+ // fog and wavelets
+ water_mgr.mFogDensity.mExp =
+ log(current_params.getFloat(water_mgr.mFogDensity.mName, err)) /
+ log(water_mgr.mFogDensity.mBase);
+ water_mgr.setDensitySliderValue(water_mgr.mFogDensity.mExp);
+ getChild<LLUICtrl>("WaterFogDensity")->setValue(water_mgr.mFogDensity.mExp);
+
+ water_mgr.mUnderWaterFogMod.mX =
+ current_params.getFloat(water_mgr.mUnderWaterFogMod.mName, err);
+ getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(water_mgr.mUnderWaterFogMod.mX);
+
+ water_mgr.mNormalScale = current_params.getVector3(water_mgr.mNormalScale.mName, err);
+ getChild<LLUICtrl>("WaterNormalScaleX")->setValue(water_mgr.mNormalScale.mX);
+ getChild<LLUICtrl>("WaterNormalScaleY")->setValue(water_mgr.mNormalScale.mY);
+ getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(water_mgr.mNormalScale.mZ);
+
+ // Fresnel
+ water_mgr.mFresnelScale.mX = current_params.getFloat(water_mgr.mFresnelScale.mName, err);
+ getChild<LLUICtrl>("WaterFresnelScale")->setValue(water_mgr.mFresnelScale.mX);
+ water_mgr.mFresnelOffset.mX = current_params.getFloat(water_mgr.mFresnelOffset.mName, err);
+ getChild<LLUICtrl>("WaterFresnelOffset")->setValue(water_mgr.mFresnelOffset.mX);
+
+ // Scale Above/Below
+ water_mgr.mScaleAbove.mX = current_params.getFloat(water_mgr.mScaleAbove.mName, err);
+ getChild<LLUICtrl>("WaterScaleAbove")->setValue(water_mgr.mScaleAbove.mX);
+ water_mgr.mScaleBelow.mX = current_params.getFloat(water_mgr.mScaleBelow.mName, err);
+ getChild<LLUICtrl>("WaterScaleBelow")->setValue(water_mgr.mScaleBelow.mX);
+
+ // blur mult
+ water_mgr.mBlurMultiplier.mX = current_params.getFloat(water_mgr.mBlurMultiplier.mName, err);
+ getChild<LLUICtrl>("WaterBlurMult")->setValue(water_mgr.mBlurMultiplier.mX);
+
+ // wave directions
+ water_mgr.mWave1Dir = current_params.getVector2(water_mgr.mWave1Dir.mName, err);
+ getChild<LLUICtrl>("WaterWave1DirX")->setValue(water_mgr.mWave1Dir.mX);
+ getChild<LLUICtrl>("WaterWave1DirY")->setValue(water_mgr.mWave1Dir.mY);
+
+ water_mgr.mWave2Dir = current_params.getVector2(water_mgr.mWave2Dir.mName, err);
+ getChild<LLUICtrl>("WaterWave2DirX")->setValue(water_mgr.mWave2Dir.mX);
+ getChild<LLUICtrl>("WaterWave2DirY")->setValue(water_mgr.mWave2Dir.mY);
+
+ LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
+ textCtrl->setImageAssetID(water_mgr.getNormalMapID());
+}
+
+// color control callbacks
+void LLFloaterEditWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ color_ctrl->mR = sldr_ctrl->getValueF32();
+
+ // move i if it's the max
+ if (color_ctrl->mR >= color_ctrl->mG
+ && color_ctrl->mR >= color_ctrl->mB
+ && color_ctrl->mHasSliderName)
+ {
+ color_ctrl->mI = color_ctrl->mR;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ getChild<LLUICtrl>(name)->setValue(color_ctrl->mR);
+ }
+
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ color_ctrl->mG = sldr_ctrl->getValueF32();
+
+ // move i if it's the max
+ if (color_ctrl->mG >= color_ctrl->mR
+ && color_ctrl->mG >= color_ctrl->mB
+ && color_ctrl->mHasSliderName)
+ {
+ color_ctrl->mI = color_ctrl->mG;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ getChild<LLUICtrl>(name)->setValue(color_ctrl->mG);
+
+ }
+
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ color_ctrl->mB = sldr_ctrl->getValueF32();
+
+ // move i if it's the max
+ if (color_ctrl->mB >= color_ctrl->mR
+ && color_ctrl->mB >= color_ctrl->mG
+ && color_ctrl->mHasSliderName)
+ {
+ color_ctrl->mI = color_ctrl->mB;
+ std::string name = color_ctrl->mSliderName;
+ name.append("I");
+
+ getChild<LLUICtrl>(name)->setValue(color_ctrl->mB);
+ }
+
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ color_ctrl->mA = sldr_ctrl->getValueF32();
+
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+
+void LLFloaterEditWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ color_ctrl->mI = sldr_ctrl->getValueF32();
+
+ // only for sliders where we pass a name
+ if (color_ctrl->mHasSliderName)
+ {
+ // set it to the top
+ F32 maxVal = std::max(std::max(color_ctrl->mR, color_ctrl->mG), color_ctrl->mB);
+ F32 iVal;
+
+ iVal = color_ctrl->mI;
+
+ // get the names of the other sliders
+ std::string rName = color_ctrl->mSliderName;
+ rName.append("R");
+ std::string gName = color_ctrl->mSliderName;
+ gName.append("G");
+ std::string bName = color_ctrl->mSliderName;
+ bName.append("B");
+
+ // handle if at 0
+ if (iVal == 0)
+ {
+ color_ctrl->mR = 0;
+ color_ctrl->mG = 0;
+ color_ctrl->mB = 0;
+
+ // if all at the start
+ // set them all to the intensity
+ }
+ else if (maxVal == 0)
+ {
+ color_ctrl->mR = iVal;
+ color_ctrl->mG = iVal;
+ color_ctrl->mB = iVal;
+ }
+ else
+ {
+ // add delta amounts to each
+ F32 delta = (iVal - maxVal) / maxVal;
+ color_ctrl->mR *= (1.0f + delta);
+ color_ctrl->mG *= (1.0f + delta);
+ color_ctrl->mB *= (1.0f + delta);
+ }
+
+ // set the sliders to the new vals
+ getChild<LLUICtrl>(rName)->setValue(color_ctrl->mR);
+ getChild<LLUICtrl>(gName)->setValue(color_ctrl->mG);
+ getChild<LLUICtrl>(bName)->setValue(color_ctrl->mB);
+ }
+
+ // now update the current parameters and send them to shaders
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+// vector control callbacks
+void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ vector_ctrl->mX = sldr_ctrl->getValueF32();
+
+ vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+// vector control callbacks
+void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ vector_ctrl->mY = sldr_ctrl->getValueF32();
+
+ vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+// vector control callbacks
+void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ vector_ctrl->mZ = sldr_ctrl->getValueF32();
+
+ vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+
+// vector control callbacks
+void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ vector_ctrl->mX = sldr_ctrl->getValueF32();
+
+ vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+// vector control callbacks
+void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ vector_ctrl->mY = sldr_ctrl->getValueF32();
+
+ vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ floatControl->mX = sldr_ctrl->getValueF32() / floatControl->mMult;
+
+ floatControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
+{
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ F32 val = sldr_ctrl->getValueF32();
+ expFloatControl->mExp = val;
+ LLWaterParamManager::getInstance()->setDensitySliderValue(val);
+
+ expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl)
+{
+ LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
+ *color_ctrl = swatch->get();
+
+ color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
+}
+
+void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl)
+{
+ LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
+ LLUUID textID = textCtrl->getImageAssetID();
+ LLWaterParamManager::getInstance()->setNormalMapID(textID);
+}
+
+//=============================================================================
+
+void LLFloaterEditWater::reset()
+{
+ if (isNewPreset())
+ {
+ mWaterPresetNameEditor->setValue(LLSD());
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ }
+ else
+ {
+ refreshWaterPresetsList();
+
+ // Disable controls until a water preset to edit is selected.
+ enableEditing(false);
+ }
+}
+
+bool LLFloaterEditWater::isNewPreset() const
+{
+ return mKey.asString() == "new";
+}
+
+void LLFloaterEditWater::refreshWaterPresetsList()
+{
+ mWaterPresetCombo->removeall();
+
+#if 0 // *TODO: enable when we have a clear workflow to edit existing region environment
+ // If the region already has water params, add them to the list.
+ const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ if (region_settings.getWaterParams().size() != 0)
+ {
+ const std::string& region_name = gAgent.getRegion()->getName();
+ mWaterPresetCombo->add(region_name, LLSD().with(0, region_name).with(1, LLEnvKey::SCOPE_REGION));
+ mWaterPresetCombo->addSeparator();
+ }
+#endif
+
+ std::list<std::string> user_presets, system_presets;
+ LLWaterParamManager::instance().getPresetNames(user_presets, system_presets);
+
+ // Add local user presets first.
+ for (std::list<std::string>::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ const std::string& name = *it;
+ mWaterPresetCombo->add(name, LLSD().with(0, name).with(1, LLEnvKey::SCOPE_LOCAL)); // [<name>, <scope>]
+ }
+
+ if (user_presets.size() > 0)
+ {
+ mWaterPresetCombo->addSeparator();
+ }
+
+ // Add local system presets.
+ for (std::list<std::string>::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it)
+ {
+ const std::string& name = *it;
+ mWaterPresetCombo->add(name, LLSD().with(0, name).with(1, LLEnvKey::SCOPE_LOCAL)); // [<name>, <scope>]
+ }
+
+ mWaterPresetCombo->setLabel(getString("combo_label"));
+}
+
+void LLFloaterEditWater::enableEditing(bool enable)
+{
+ // Enable/disable water controls.
+ getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable);
+
+ // Enable/disable saving.
+ mSaveButton->setEnabled(enable);
+ mMakeDefaultCheckBox->setEnabled(enable);
+}
+
+void LLFloaterEditWater::saveRegionWater()
+{
+ llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water
+
+ LL_DEBUGS("Windlight") << "Saving region water preset" << llendl;
+
+ //LLWaterParamSet region_water = water_mgr.mCurParams;
+
+ // *TODO: save to cached region settings.
+ LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL;
+}
+
+std::string LLFloaterEditWater::getCurrentPresetName() const
+{
+ std::string name;
+ LLEnvKey::EScope scope;
+ getSelectedPreset(name, scope);
+ return name;
+}
+
+LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const
+{
+ std::string name;
+ LLEnvKey::EScope scope;
+ getSelectedPreset(name, scope);
+ return scope;
+}
+
+void LLFloaterEditWater::getSelectedPreset(std::string& name, LLEnvKey::EScope& scope) const
+{
+ if (mWaterPresetNameEditor->getVisible())
+ {
+ name = mWaterPresetNameEditor->getText();
+ scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ LLSD combo_val = mWaterPresetCombo->getValue();
+
+ if (!combo_val.isArray()) // manually typed text
+ {
+ name = combo_val.asString();
+ scope = LLEnvKey::SCOPE_LOCAL;
+ }
+ else
+ {
+ name = combo_val[0].asString();
+ scope = (LLEnvKey::EScope) combo_val[1].asInteger();
+ }
+ }
+}
+
+void LLFloaterEditWater::onWaterPresetNameEdited()
+{
+ // Disable saving a water preset having empty name.
+ mSaveButton->setEnabled(!getCurrentPresetName().empty());
+}
+
+void LLFloaterEditWater::onWaterPresetSelected()
+{
+ LLWaterParamSet water_params;
+ std::string name;
+ LLEnvKey::EScope scope;
+
+ getSelectedPreset(name, scope);
+
+ // Display selected preset.
+ if (scope == LLEnvKey::SCOPE_REGION)
+ {
+ water_params.setAll(LLEnvManagerNew::instance().getRegionSettings().getWaterParams());
+ }
+ else // local preset selected
+ {
+ if (!LLWaterParamManager::instance().getParamSet(name, water_params))
+ {
+ // Manually entered string?
+ LL_WARNS("Windlight") << "No water preset named " << name << LL_ENDL;
+ return;
+ }
+ }
+
+ LLEnvManagerNew::instance().useWaterParams(water_params.getAll());
+
+ bool can_edit = (scope == LLEnvKey::SCOPE_LOCAL || LLEnvManagerNew::canEditRegionSettings());
+ enableEditing(can_edit);
+
+ mMakeDefaultCheckBox->setEnabled(scope == LLEnvKey::SCOPE_LOCAL);
+}
+
+bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ // If they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ onSaveConfirmed();
+ }
+
+ return false;
+}
+
+void LLFloaterEditWater::onSaveConfirmed()
+{
+ // Save currently displayed water params to the selected preset.
+ std::string name = getCurrentPresetName();
+
+ LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ if (water_mgr.hasParamSet(name))
+ {
+ water_mgr.setParamSet(name, water_mgr.mCurParams);
+ }
+ else
+ {
+ water_mgr.addParamSet(name, water_mgr.mCurParams);
+ }
+
+ water_mgr.savePreset(name);
+
+ // Change preference if requested.
+ if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
+ {
+ LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << llendl;
+ LLEnvManagerNew::instance().setUseWaterPreset(name);
+ }
+
+ closeFloater();
+}
+
+void LLFloaterEditWater::onBtnSave()
+{
+ LLEnvKey::EScope scope;
+ std::string name;
+ getSelectedPreset(name, scope);
+
+ if (scope == LLEnvKey::SCOPE_REGION)
+ {
+ saveRegionWater();
+ closeFloater();
+ return;
+ }
+
+ if (name.empty())
+ {
+ // *TODO: show an alert
+ llwarns << "Empty water preset name" << llendl;
+ return;
+ }
+
+ // Don't allow overwriting system presets.
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ if (water_mgr.isSystemPreset(name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ // Save, ask for confirmation for overwriting an existing preset.
+ if (water_mgr.hasParamSet(name))
+ {
+ LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditWater::onSaveAnswer, this, _1, _2));
+ }
+ else
+ {
+ // new preset, hence no confirmation needed
+ onSaveConfirmed();
+ }
+}
+
+void LLFloaterEditWater::onBtnCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterEditWater::onWaterPresetListChange()
+{
+ std::string name;
+ LLEnvKey::EScope scope;
+ getSelectedPreset(name, scope); // preset being edited
+
+ if (scope == LLEnvKey::SCOPE_LOCAL && !LLWaterParamManager::instance().hasParamSet(name))
+ {
+ // Preset we've been editing doesn't exist anymore. Close the floater.
+ closeFloater(false);
+ }
+ else
+ {
+ // A new preset has been added.
+ // Refresh the presets list, though it may not make sense as the floater is about to be closed.
+ refreshWaterPresetsList();
+ }
+}
+
+void LLFloaterEditWater::onRegionSettingsChange()
+{
+ // If creating a new preset, don't bother.
+ if (isNewPreset())
+ {
+ return;
+ }
+
+ if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water
+ {
+ // reset the floater to its initial state
+ reset();
+
+ // *TODO: Notify user?
+ }
+ else // editing a local preset
+ {
+ refreshWaterPresetsList();
+ }
+}
+
+void LLFloaterEditWater::onRegionInfoUpdate()
+{
+ bool can_edit = true;
+
+ // If we've selected the region water for editing.
+ if (getCurrentScope() == LLEnvKey::SCOPE_REGION)
+ {
+ // check whether we have the access
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
+
+ enableEditing(can_edit);
+}
diff --git a/indra/newview/llfloatereditwater.h b/indra/newview/llfloatereditwater.h
new file mode 100644
index 0000000000..2211bca59f
--- /dev/null
+++ b/indra/newview/llfloatereditwater.h
@@ -0,0 +1,115 @@
+/**
+ * @file llfloatereditwater.h
+ * @brief Floater to create or edit a water preset
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATEREDITWATER_H
+#define LL_LLFLOATEREDITWATER_H
+
+#include "llfloater.h"
+#include "llenvmanager.h" // for LLEnvKey
+
+class LLButton;
+class LLCheckBoxCtrl;
+class LLComboBox;
+class LLLineEditor;
+
+struct WaterVector2Control;
+struct WaterVector3Control;
+struct WaterColorControl;
+struct WaterFloatControl;
+struct WaterExpFloatControl;
+
+class LLFloaterEditWater : public LLFloater
+{
+ LOG_CLASS(LLFloaterEditWater);
+
+public:
+ LLFloaterEditWater(const LLSD &key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void draw();
+
+private:
+ void initCallbacks(void);
+
+ //-- WL stuff begins ------------------------------------------------------
+
+ void syncControls(); /// sync up sliders with parameters
+
+ // general purpose callbacks for dealing with color controllers
+ void onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+ void onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+ void onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+ void onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+ void onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+
+ void onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl);
+ void onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl);
+ void onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl);
+
+ void onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl);
+ void onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl);
+
+ void onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl);
+
+ void onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl);
+
+ void onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl);
+
+ void onNormalMapPicked(LLUICtrl* ctrl); /// handle if they choose a new normal map
+
+ //-- WL stuff ends --------------------------------------------------------
+
+ void reset();
+ bool isNewPreset() const;
+ void refreshWaterPresetsList();
+ void enableEditing(bool enable);
+ void saveRegionWater();
+
+ std::string getCurrentPresetName() const;
+ LLEnvKey::EScope getCurrentScope() const;
+ void getSelectedPreset(std::string& name, LLEnvKey::EScope& scope) const;
+
+ void onWaterPresetNameEdited();
+ void onWaterPresetSelected();
+ bool onSaveAnswer(const LLSD& notification, const LLSD& response);
+ void onSaveConfirmed();
+
+ void onBtnSave();
+ void onBtnCancel();
+
+ void onWaterPresetListChange();
+ void onRegionSettingsChange();
+ void onRegionInfoUpdate();
+
+ LLLineEditor* mWaterPresetNameEditor;
+ LLComboBox* mWaterPresetCombo;
+ LLCheckBoxCtrl* mMakeDefaultCheckBox;
+ LLButton* mSaveButton;
+};
+
+#endif // LL_LLFLOATEREDITWATER_H
diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp
new file mode 100644
index 0000000000..4dbc8cdee0
--- /dev/null
+++ b/indra/newview/llfloaterenvironmentsettings.cpp
@@ -0,0 +1,282 @@
+/**
+ * @file llfloaterenvironmentsettings.cpp
+ * @brief LLFloaterEnvironmentSettings class definition
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterenvironmentsettings.h"
+
+#include "llcombobox.h"
+#include "llradiogroup.h"
+
+#include "lldaycyclemanager.h"
+#include "llenvmanager.h"
+#include "llwaterparammanager.h"
+#include "llwlparamset.h"
+#include "llwlparammanager.h"
+
+LLFloaterEnvironmentSettings::LLFloaterEnvironmentSettings(const LLSD &key)
+: LLFloater(key)
+ ,mRegionSettingsRadioGroup(NULL)
+ ,mDayCycleSettingsRadioGroup(NULL)
+ ,mWaterPresetCombo(NULL)
+ ,mSkyPresetCombo(NULL)
+ ,mDayCyclePresetCombo(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterEnvironmentSettings::postBuild()
+{
+ mRegionSettingsRadioGroup = getChild<LLRadioGroup>("region_settings_radio_group");
+ mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLFloaterEnvironmentSettings::onSwitchRegionSettings, this));
+
+ mDayCycleSettingsRadioGroup = getChild<LLRadioGroup>("sky_dayc_settings_radio_group");
+ mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLFloaterEnvironmentSettings::onSwitchDayCycle, this));
+
+ mWaterPresetCombo = getChild<LLComboBox>("water_settings_preset_combo");
+ mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEnvironmentSettings::onSelectWaterPreset, this));
+
+ mSkyPresetCombo = getChild<LLComboBox>("sky_settings_preset_combo");
+ mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEnvironmentSettings::onSelectSkyPreset, this));
+
+ mDayCyclePresetCombo = getChild<LLComboBox>("dayc_settings_preset_combo");
+ mDayCyclePresetCombo->setCommitCallback(boost::bind(&LLFloaterEnvironmentSettings::onSelectDayCyclePreset, this));
+
+ childSetCommitCallback("ok_btn", boost::bind(&LLFloaterEnvironmentSettings::onBtnOK, this), NULL);
+ getChild<LLUICtrl>("ok_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, LLEnvManagerNew::getInstance()));
+ childSetCommitCallback("cancel_btn", boost::bind(&LLFloaterEnvironmentSettings::onBtnCancel, this), NULL);
+ getChild<LLUICtrl>("cancel_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpPresets, LLEnvManagerNew::getInstance()));
+
+ setCloseCallback(boost::bind(&LLFloaterEnvironmentSettings::cancel, this));
+
+ LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::refresh, this));
+ LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEnvironmentSettings::populateDayCyclePresetsList, this));
+ LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::populateSkyPresetsList, this));
+ LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::populateWaterPresetsList, this));
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterEnvironmentSettings::onOpen(const LLSD& key)
+{
+ refresh();
+}
+
+void LLFloaterEnvironmentSettings::onSwitchRegionSettings()
+{
+ getChild<LLView>("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0);
+
+ apply();
+}
+
+void LLFloaterEnvironmentSettings::onSwitchDayCycle()
+{
+ bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+
+ mSkyPresetCombo->setEnabled(is_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
+
+ apply();
+}
+
+void LLFloaterEnvironmentSettings::onSelectWaterPreset()
+{
+ apply();
+}
+
+void LLFloaterEnvironmentSettings::onSelectSkyPreset()
+{
+ apply();
+}
+
+void LLFloaterEnvironmentSettings::onSelectDayCyclePreset()
+{
+ apply();
+}
+
+void LLFloaterEnvironmentSettings::onBtnOK()
+{
+ // Save and apply new user preferences.
+ bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+ std::string water_preset = mWaterPresetCombo->getValue().asString();
+ std::string sky_preset = mSkyPresetCombo->getValue().asString();
+ std::string day_cycle = mDayCyclePresetCombo->getValue().asString();
+
+ LLEnvManagerNew::instance().setUserPrefs(
+ water_preset,
+ sky_preset,
+ day_cycle,
+ use_fixed_sky,
+ use_region_settings);
+
+ // *TODO: This triggers applying user preferences again, which is suboptimal.
+ closeFloater();
+}
+
+void LLFloaterEnvironmentSettings::onBtnCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterEnvironmentSettings::refresh()
+{
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+
+ bool use_region_settings = env_mgr.getUseRegionSettings();
+ bool use_fixed_sky = env_mgr.getUseFixedSky();
+
+ // Set up radio buttons according to user preferences.
+ mRegionSettingsRadioGroup->setSelectedIndex(use_region_settings ? 0 : 1);
+ mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1);
+
+ // Populate the combo boxes with appropriate lists of available presets.
+ populateWaterPresetsList();
+ populateSkyPresetsList();
+ populateDayCyclePresetsList();
+
+ // Enable/disable other controls based on user preferences.
+ getChild<LLView>("user_environment_settings")->setEnabled(!use_region_settings);
+ mSkyPresetCombo->setEnabled(use_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!use_fixed_sky);
+
+ // Select the current presets in combo boxes.
+ mWaterPresetCombo->selectByValue(env_mgr.getWaterPresetName());
+ mSkyPresetCombo->selectByValue(env_mgr.getSkyPresetName());
+ mDayCyclePresetCombo->selectByValue(env_mgr.getDayCycleName());
+}
+
+void LLFloaterEnvironmentSettings::apply()
+{
+ // Update environment with the user choice.
+ bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+ std::string water_preset = mWaterPresetCombo->getValue().asString();
+ std::string sky_preset = mSkyPresetCombo->getValue().asString();
+ std::string day_cycle = mDayCyclePresetCombo->getValue().asString();
+
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ if (use_region_settings)
+ {
+ env_mgr.useRegionSettings();
+ }
+ else
+ {
+ if (use_fixed_sky)
+ {
+ env_mgr.useSkyPreset(sky_preset);
+ }
+ else
+ {
+ env_mgr.useDayCycle(day_cycle, LLEnvKey::SCOPE_LOCAL);
+ }
+
+ env_mgr.useWaterPreset(water_preset);
+ }
+}
+
+void LLFloaterEnvironmentSettings::cancel()
+{
+ // Revert environment to user preferences.
+ LLEnvManagerNew::instance().usePrefs();
+}
+
+void LLFloaterEnvironmentSettings::populateWaterPresetsList()
+{
+ mWaterPresetCombo->removeall();
+
+ std::list<std::string> user_presets, system_presets;
+ LLWaterParamManager::instance().getPresetNames(user_presets, system_presets);
+
+ // Add user presets first.
+ for (std::list<std::string>::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mWaterPresetCombo->add(*it);
+ }
+
+ if (user_presets.size() > 0)
+ {
+ mWaterPresetCombo->addSeparator();
+ }
+
+ // Add system presets.
+ for (std::list<std::string>::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it)
+ {
+ mWaterPresetCombo->add(*it);
+ }
+}
+
+void LLFloaterEnvironmentSettings::populateSkyPresetsList()
+{
+ mSkyPresetCombo->removeall();
+
+ LLWLParamManager::preset_name_list_t region_presets; // unused as we don't list region presets here
+ LLWLParamManager::preset_name_list_t user_presets, sys_presets;
+ LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets);
+
+ // Add user presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it);
+ }
+
+ if (!user_presets.empty())
+ {
+ mSkyPresetCombo->addSeparator();
+ }
+
+ // Add system presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it);
+ }
+}
+
+void LLFloaterEnvironmentSettings::populateDayCyclePresetsList()
+{
+ mDayCyclePresetCombo->removeall();
+
+ LLDayCycleManager::preset_name_list_t user_days, sys_days;
+ LLDayCycleManager::instance().getPresetNames(user_days, sys_days);
+
+ // Add user days.
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it)
+ {
+ mDayCyclePresetCombo->add(*it);
+ }
+
+ if (user_days.size() > 0)
+ {
+ mDayCyclePresetCombo->addSeparator();
+ }
+
+ // Add system days.
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it)
+ {
+ mDayCyclePresetCombo->add(*it);
+ }
+}
diff --git a/indra/newview/llfloaterenvironmentsettings.h b/indra/newview/llfloaterenvironmentsettings.h
new file mode 100644
index 0000000000..0ab458a0f6
--- /dev/null
+++ b/indra/newview/llfloaterenvironmentsettings.h
@@ -0,0 +1,71 @@
+/**
+ * @file llfloaterenvironmentsettings.h
+ * @brief LLFloaterEnvironmentSettings class definition
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERENVIRONMENTSETTINGS_H
+#define LL_LLFLOATERENVIRONMENTSETTINGS_H
+
+#include "llfloater.h"
+
+class LLComboBox;
+class LLRadioGroup;
+
+class LLFloaterEnvironmentSettings : public LLFloater
+{
+ LOG_CLASS(LLFloaterEnvironmentSettings);
+
+public:
+ LLFloaterEnvironmentSettings(const LLSD &key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+private:
+ void onSwitchRegionSettings();
+ void onSwitchDayCycle();
+
+ void onSelectWaterPreset();
+ void onSelectSkyPreset();
+ void onSelectDayCyclePreset();
+
+ void onBtnOK();
+ void onBtnCancel();
+
+ void refresh(); /// update controls with user prefs
+ void apply();
+ void cancel();
+
+ void populateWaterPresetsList();
+ void populateSkyPresetsList();
+ void populateDayCyclePresetsList();
+
+ LLRadioGroup* mRegionSettingsRadioGroup;
+ LLRadioGroup* mDayCycleSettingsRadioGroup;
+
+ LLComboBox* mWaterPresetCombo;
+ LLComboBox* mSkyPresetCombo;
+ LLComboBox* mDayCyclePresetCombo;
+};
+
+#endif // LL_LLFLOATERENVIRONMENTSETTINGS_H
diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp
index fcaef1f34b..bb476e5d00 100644
--- a/indra/newview/llfloaterenvsettings.cpp
+++ b/indra/newview/llfloaterenvsettings.cpp
@@ -31,55 +31,70 @@
#include "llfloaterreg.h"
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
+#include "llfloaterdaycycle.h"
+#include "llfloaterregioninfo.h"
#include "lluictrlfactory.h"
#include "llsliderctrl.h"
#include "llcombobox.h"
#include "llcolorswatch.h"
#include "llwlanimator.h"
+#include "llnotifications.h"
#include "llwlparamset.h"
#include "llwlparammanager.h"
#include "llwaterparammanager.h"
#include "llmath.h"
#include "llviewerwindow.h"
+#include "llviewercontrol.h"
+
+#include "llcheckboxctrl.h"
#include "pipeline.h"
#include <sstream>
-LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD& key)
- : LLFloater(key)
-{
+// LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL;
+
+LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD &key) : LLFloater(key)
+{
+ lldebugs << "Creating env settings floater" << llendl;
}
-// virtual
+
LLFloaterEnvSettings::~LLFloaterEnvSettings()
{
}
+
// virtual
BOOL LLFloaterEnvSettings::postBuild()
{
// load it up
initCallbacks();
syncMenu();
+
return TRUE;
}
void LLFloaterEnvSettings::initCallbacks(void)
{
// our three sliders
- getChild<LLUICtrl>("EnvTimeSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeDayTime, this, _1));
- getChild<LLUICtrl>("EnvCloudSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeCloudCoverage, this, _1));
- getChild<LLUICtrl>("EnvWaterFogSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterFogDensity, this, _1, &LLWaterParamManager::instance()->mFogDensity));
+ childSetCommitCallback("EnvTimeSlider", &LLFloaterEnvSettings::onChangeDayTime, NULL);
+ childSetCommitCallback("EnvCloudSlider", &LLFloaterEnvSettings::onChangeCloudCoverage, NULL);
+ childSetCommitCallback("EnvWaterFogSlider", &LLFloaterEnvSettings::onChangeWaterFogDensity, &LLWaterParamManager::instance().mFogDensity);
// color picker
- getChild<LLUICtrl>("EnvWaterColor")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterColor, this, _1, &LLWaterParamManager::instance()->mFogColor));
+ childSetCommitCallback("EnvWaterColor", &LLFloaterEnvSettings::onChangeWaterColor, &LLWaterParamManager::instance().mFogColor);
// WL Top
- getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedSky, this));
- getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedWater, this));
- getChild<LLUICtrl>("EnvUseEstateTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseEstateTime, this));
+ childSetCommitCallback("EnvAdvancedSkyButton", &LLFloaterEnvSettings::onOpenAdvancedSky, NULL);
+ childSetCommitCallback("EnvAdvancedWaterButton", &LLFloaterEnvSettings::onOpenAdvancedWater, NULL);
+ childSetCommitCallback("EnvUseEstateTimeButton", &LLFloaterEnvSettings::onUseEstateTime, NULL);
+ getChild<LLUICtrl>("EnvUseLocalTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseLocalTime));
+
+ getChild<LLUICtrl>("EnvUseLocalTimeButton")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, &LLEnvManagerNew::instance()));
+ getChild<LLUICtrl>("EnvUseEstateTimeButton")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, &LLEnvManagerNew::instance()));
}
+
// menu maintenance functions
void LLFloaterEnvSettings::syncMenu()
@@ -88,8 +103,8 @@ void LLFloaterEnvSettings::syncMenu()
sldr = getChild<LLSliderCtrl>("EnvTimeSlider");
// sync the clock
- F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime();
- std::string timeStr = timeToString(val);
+ F32 val = (F32)LLWLParamManager::getInstance()->mAnimator.getDayTime();
+ std::string timeStr = LLWLAnimator::timeToString(val);
LLTextBox* textBox;
textBox = getChild<LLTextBox>("EnvTimeText");
@@ -106,62 +121,59 @@ void LLFloaterEnvSettings::syncMenu()
// sync cloud coverage
bool err;
- getChild<LLUICtrl>("EnvCloudSlider")->setValue(LLWLParamManager::instance()->mCurParams.getFloat("cloud_shadow", err));
+ childSetValue("EnvCloudSlider", LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", err));
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance();
// sync water params
LLColor4 col = param_mgr->getFogColor();
LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor");
col.mV[3] = 1.0f;
colCtrl->set(col);
- getChild<LLUICtrl>("EnvWaterFogSlider")->setValue(param_mgr->mFogDensity.mExp);
+ childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp);
param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp);
- // turn off Use Estate Time button if it's already being used
- if(LLWLParamManager::instance()->mAnimator.mUseLindenTime)
- {
- getChildView("EnvUseEstateTimeButton")->setEnabled(FALSE);
- } else {
- getChildView("EnvUseEstateTimeButton")->setEnabled(TRUE);
- }
+ // turn off Use Estate/Local Time buttons if already being used
+
+ LLWLAnimator& anim = LLWLParamManager::getInstance()->mAnimator;
+ childSetEnabled("EnvUseEstateTimeButton", !anim.getIsRunning() || !anim.getUseLindenTime());
+ childSetEnabled("EnvUseLocalTimeButton", !anim.getIsRunning() || !anim.getUseLocalTime());
if(!gPipeline.canUseVertexShaders())
{
- getChildView("EnvWaterColor")->setEnabled(FALSE);
- getChildView("EnvWaterColorText")->setEnabled(FALSE);
- //getChildView("EnvAdvancedWaterButton")->setEnabled(FALSE);
+ childDisable("EnvWaterColor");
+ childDisable("EnvWaterColorText");
+ //childDisable("EnvAdvancedWaterButton");
}
else
{
- getChildView("EnvWaterColor")->setEnabled(TRUE);
- getChildView("EnvWaterColorText")->setEnabled(TRUE);
- //getChildView("EnvAdvancedWaterButton")->setEnabled(TRUE);
+ childEnable("EnvWaterColor");
+ childEnable("EnvWaterColorText");
+ //childEnable("EnvAdvancedWaterButton");
}
// only allow access to these if they are using windlight
if(!gPipeline.canUseWindLightShaders())
{
- getChildView("EnvCloudSlider")->setEnabled(FALSE);
- getChildView("EnvCloudText")->setEnabled(FALSE);
- //getChildView("EnvAdvancedSkyButton")->setEnabled(FALSE);
+ childDisable("EnvCloudSlider");
+ childDisable("EnvCloudText");
+ //childDisable("EnvAdvancedSkyButton");
}
else
{
- getChildView("EnvCloudSlider")->setEnabled(TRUE);
- getChildView("EnvCloudText")->setEnabled(TRUE);
- //getChildView("EnvAdvancedSkyButton")->setEnabled(TRUE);
+ childEnable("EnvCloudSlider");
+ childEnable("EnvCloudText");
+ //childEnable("EnvAdvancedSkyButton");
}
}
-void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl)
+void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
{
LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
// deactivate animator
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
+ LLWLParamManager::instance().mAnimator.deactivate();
F32 val = sldr->getValueF32() + 0.25f;
if(val > 1.0)
@@ -169,12 +181,12 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl)
val--;
}
- LLWLParamManager::instance()->mAnimator.setDayTime((F64)val);
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLWLParamManager::instance().mAnimator.setDayTime((F64)val);
+ LLWLParamManager::instance().mAnimator.update(
+ LLWLParamManager::instance().mCurParams);
}
-void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl)
+void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData)
{
LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
@@ -183,44 +195,46 @@ void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl)
//LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
F32 val = sldr->getValueF32();
- LLWLParamManager::instance()->mCurParams.set("cloud_shadow", val);
+ LLWLParamManager::instance().mCurParams.set("cloud_shadow", val);
}
-void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
+void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData)
{
- LLSliderCtrl* sldr;
- sldr = getChild<LLSliderCtrl>("EnvWaterFogSlider");
-
+ LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
F32 val = sldr->getValueF32();
+
+ WaterExpFloatControl* expFloatControl = static_cast<WaterExpFloatControl*>(userData);
expFloatControl->mExp = val;
- LLWaterParamManager::instance()->setDensitySliderValue(val);
+ LLWaterParamManager::instance().setDensitySliderValue(val);
- expFloatControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ expFloatControl->update(LLWaterParamManager::instance().mCurParams);
+ LLWaterParamManager::instance().propagateParameters();
}
-void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl)
+void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
+ WaterColorControl* colorControl = static_cast<WaterColorControl*>(userData);
*colorControl = swatch->get();
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ colorControl->update(LLWaterParamManager::instance().mCurParams);
+ LLWaterParamManager::instance().propagateParameters();
}
-
-void LLFloaterEnvSettings::onOpenAdvancedSky()
+void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData1, void* userData2)
{
+ // *TODO: make sure title is displayed correctly.
LLFloaterReg::showInstance("env_windlight");
}
-void LLFloaterEnvSettings::onOpenAdvancedWater()
+void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData1, void* userData2)
{
+ // *TODO: make sure title is displayed correctly.
LLFloaterReg::showInstance("env_water");
}
-void LLFloaterEnvSettings::onUseEstateTime()
+void LLFloaterEnvSettings::onUseEstateTime(void* userData1, void* userData2)
{
LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance<LLFloaterWindLight>("env_windlight");
if(wl)
@@ -229,40 +243,12 @@ void LLFloaterEnvSettings::onUseEstateTime()
box->selectByValue("");
}
- LLWLParamManager::instance()->mAnimator.mIsRunning = true;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
+ LLWLParamManager::instance().mAnimator.activate(LLWLAnimator::TIME_LINDEN);
}
-std::string LLFloaterEnvSettings::timeToString(F32 curTime)
+// static
+void LLFloaterEnvSettings::onUseLocalTime()
{
- S32 hours;
- S32 min;
-
- // get hours and minutes
- hours = (S32) (24.0 * curTime);
- curTime -= ((F32) hours / 24.0f);
- min = llround(24.0f * 60.0f * curTime);
-
- // handle case where it's 60
- if(min == 60)
- {
- hours++;
- min = 0;
- }
-
- std::string newTime = getString("timeStr");
- struct tm * timeT;
- time_t secT = time(0);
- timeT = gmtime (&secT);
-
- timeT->tm_hour = hours;
- timeT->tm_min = min;
- secT = mktime (timeT);
- secT -= LLStringOps::getLocalTimeOffset ();
-
- LLSD substitution;
- substitution["datetime"] = (S32) secT;
-
- LLStringUtil::format (newTime, substitution);
- return newTime;
+ LLWLParamManager::getInstance()->mAnimator.setDayTime(LLWLAnimator::getLocalTime());
+ LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LOCAL);
}
diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h
index a6280cfb97..b93bf07395 100644
--- a/indra/newview/llfloaterenvsettings.h
+++ b/indra/newview/llfloaterenvsettings.h
@@ -33,50 +33,56 @@
#include "llfloater.h"
-struct WaterColorControl;
-struct WaterExpFloatControl;
/// Menuing system for all of windlight's functionality
class LLFloaterEnvSettings : public LLFloater
{
+ LOG_CLASS(LLFloaterEnvSettings);
public:
- LLFloaterEnvSettings(const LLSD& key);
+ LLFloaterEnvSettings(const LLSD &key);
/*virtual*/ ~LLFloaterEnvSettings();
/*virtual*/ BOOL postBuild();
+
/// initialize all the callbacks for the menu
void initCallbacks(void);
+ /// one and one instance only
+ LLFloaterEnvSettings* instance();
+
/// handle if time of day is changed
- void onChangeDayTime(LLUICtrl* ctrl);
+ static void onChangeDayTime(LLUICtrl* ctrl, void* userData);
/// handle if cloud coverage is changed
- void onChangeCloudCoverage(LLUICtrl* ctrl);
+ static void onChangeCloudCoverage(LLUICtrl* ctrl, void* userData);
/// handle change in water fog density
- void onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl);
+ static void onChangeWaterFogDensity(LLUICtrl* ctrl, void* expFloatControl);
/// handle change in water fog color
- void onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl);
+ static void onChangeWaterColor(LLUICtrl* ctrl, void* colorControl);
/// open the advanced sky settings menu
- void onOpenAdvancedSky();
+ static void onOpenAdvancedSky(void* userData1, void* userData2);
/// open the advanced water settings menu
- void onOpenAdvancedWater();
+ static void onOpenAdvancedWater(void* userData1, void* userData2);
/// sync time with the server
- void onUseEstateTime();
+ static void onUseEstateTime(void* userData1, void* userData2);
+
+ /// sync time with local clock
+ static void onUseLocalTime();
+
//// menu management
/// sync up sliders with parameters
void syncMenu();
- /// convert the present time to a digital clock time
- std::string timeToString(F32 curTime);
-
private:
+ // one instance on the inside
+
};
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 6b3e3088d5..b13233d684 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -40,6 +40,10 @@
#include "llxfermanager.h"
#include "indra_constants.h"
#include "message.h"
+#include "llloadingindicator.h"
+#include "llradiogroup.h"
+#include "llsd.h"
+#include "llsdserialize.h"
#include "llagent.h"
#include "llappviewer.h"
@@ -48,7 +52,10 @@
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
+#include "lldaycyclemanager.h"
+#include "llenvmanager.h"
#include "llfilepicker.h"
+#include "llfloaterdaycycle.h"
#include "llfloatergodtools.h" // for send_sim_wide_deletes()
#include "llfloatertopobjects.h" // added to fix SL-32336
#include "llfloatergroups.h"
@@ -80,13 +87,19 @@
#include "llviewertexteditor.h"
#include "llviewerwindow.h"
#include "llvlcomposition.h"
+#include "llwaterparammanager.h"
#include "lltrans.h"
#include "llagentui.h"
#include "llmeshrepository.h"
+// contains includes needed for WL estate settings
+#include "llfloaterwater.h"
+
const S32 TERRAIN_TEXTURE_COUNT = 4;
const S32 CORNER_COUNT = 4;
+#define TMP_DISABLE_WLES // STORM-1180
+
///----------------------------------------------------------------------------
/// Local class declaration
///----------------------------------------------------------------------------
@@ -190,24 +203,24 @@ LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
BOOL LLFloaterRegionInfo::postBuild()
{
mTab = getChild<LLTabContainer>("region_panels");
+ mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2));
// contruct the panels
LLPanelRegionInfo* panel;
- panel = new LLPanelRegionGeneralInfo;
+ panel = new LLPanelEstateInfo;
mInfoPanels.push_back(panel);
- panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel));
-
- panel->buildFromFile("panel_region_general.xml");
+ panel->buildFromFile("panel_region_estate.xml");
mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true));
- panel = new LLPanelRegionDebugInfo;
+ panel = new LLPanelEstateCovenant;
mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_debug.xml");
+ panel->buildFromFile("panel_region_covenant.xml");
mTab->addTabPanel(panel);
- panel = new LLPanelRegionTextureInfo;
+ panel = new LLPanelRegionGeneralInfo;
mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_texture.xml");
+ panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel));
+ panel->buildFromFile("panel_region_general.xml");
mTab->addTabPanel(panel);
panel = new LLPanelRegionTerrainInfo;
@@ -215,20 +228,23 @@ BOOL LLFloaterRegionInfo::postBuild()
panel->buildFromFile("panel_region_terrain.xml");
mTab->addTabPanel(panel);
- panel = new LLPanelEstateInfo;
+ panel = new LLPanelEnvironmentInfo;
mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_estate.xml");
+ panel->buildFromFile("panel_region_environment.xml");
mTab->addTabPanel(panel);
- panel = new LLPanelEstateCovenant;
+ panel = new LLPanelRegionDebugInfo;
mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_covenant.xml");
+ panel->buildFromFile("panel_region_debug.xml");
mTab->addTabPanel(panel);
gMessageSystem->setHandlerFunc(
"EstateOwnerMessage",
&processEstateOwnerRequest);
+ // Request region info when agent region changes.
+ LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this));
+
return TRUE;
}
@@ -305,6 +321,8 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
// static
void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
{
+ LL_DEBUGS("Windlight") << "Processing region info" << LL_ENDL;
+
LLPanel* panel;
LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl;
@@ -312,6 +330,11 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
{
return;
}
+
+ // We need to re-request environment setting here,
+ // otherwise after we apply (send) updated region settings we won't get them back,
+ // so our environment won't be updated.
+ LLEnvManagerNew::instance().requestRegionSettings();
LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
@@ -392,12 +415,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->getChild<LLUICtrl>("water_height_spin")->setValue(LLSD(water_height));
panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(LLSD(terrain_raise_limit));
panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(LLSD(terrain_lower_limit));
- panel->getChild<LLUICtrl>("use_estate_sun_check")->setValue(LLSD(use_estate_sun));
- panel->getChild<LLUICtrl>("fixed_sun_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED)));
- panel->getChildView("fixed_sun_check")->setEnabled(allow_modify && !use_estate_sun);
- panel->getChild<LLUICtrl>("sun_hour_slider")->setValue(LLSD(sun_hour));
- panel->getChildView("sun_hour_slider")->setEnabled(allow_modify && !use_estate_sun);
panel->setCtrlsEnabled(allow_modify);
floater->refreshFromRegion( gAgent.getRegion() );
@@ -423,6 +441,29 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant()
return panel;
}
+// static
+LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain()
+{
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater)
+ {
+ llassert(floater);
+ return NULL;
+ }
+
+ LLTabContainer* tab_container = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelRegionTerrainInfo* panel =
+ dynamic_cast<LLPanelRegionTerrainInfo*>(tab_container->getChild<LLPanel>("Terrain"));
+ llassert(panel);
+ return panel;
+}
+
+void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
+{
+ LLPanel* active_panel = getChild<LLPanel>(param.asString());
+ active_panel->onOpen(LLSD());
+}
+
void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
{
if (!region)
@@ -1052,131 +1093,7 @@ void LLPanelRegionDebugInfo::onClickCancelRestart(void* data)
}
-/////////////////////////////////////////////////////////////////////////////
-// LLPanelRegionTextureInfo
-//
-LLPanelRegionTextureInfo::LLPanelRegionTextureInfo() : LLPanelRegionInfo()
-{
- // nothing.
-}
-
-bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region)
-{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
- setCtrlsEnabled(allow_modify);
- getChildView("apply_btn")->setEnabled(FALSE);
-
- if (region)
- {
- getChild<LLUICtrl>("region_text")->setValue(LLSD(region->getName()));
- }
- else
- {
- getChild<LLUICtrl>("region_text")->setValue(LLSD(""));
- }
-
- if (!region) return LLPanelRegionInfo::refreshFromRegion(region);
-
- LLVLComposition* compp = region->getComposition();
- LLTextureCtrl* texture_ctrl;
- std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- texture_ctrl = getChild<LLTextureCtrl>(buffer);
- if(texture_ctrl)
- {
- lldebugs << "Detail Texture " << i << ": "
- << compp->getDetailTextureID(i) << llendl;
- LLUUID tmp_id(compp->getDetailTextureID(i));
- texture_ctrl->setImageAssetID(tmp_id);
- }
- }
-
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getStartHeight(i)));
- buffer = llformat("height_range_spin_%d", i);
- getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getHeightRange(i)));
- }
-
- // Call the parent for common book-keeping
- return LLPanelRegionInfo::refreshFromRegion(region);
-}
-
-
-BOOL LLPanelRegionTextureInfo::postBuild()
-{
- LLPanelRegionInfo::postBuild();
- std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- initCtrl(buffer);
- }
-
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- initCtrl(buffer);
- buffer = llformat("height_range_spin_%d", i);
- initCtrl(buffer);
- }
-
-// LLButton* btn = ("dump", LLRect(0, 20, 100, 0), "", onClickDump, this);
-// btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT);
-// addChild(btn);
-
- return LLPanelRegionInfo::postBuild();
-}
-
-BOOL LLPanelRegionTextureInfo::sendUpdate()
-{
- llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl;
-
- // Make sure user hasn't chosen wacky textures.
- if (!validateTextureSizes())
- {
- return FALSE;
- }
-
- LLTextureCtrl* texture_ctrl;
- std::string buffer;
- std::string id_str;
- LLMessageSystem* msg = gMessageSystem;
- strings_t strings;
-
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
-
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- texture_ctrl = getChild<LLTextureCtrl>(buffer);
- if(texture_ctrl)
- {
- LLUUID tmp_id(texture_ctrl->getImageAssetID());
- tmp_id.toString(id_str);
- buffer = llformat("%d %s", i, id_str.c_str());
- strings.push_back(buffer);
- }
- }
- sendEstateOwnerMessage(msg, "texturedetail", invoice, strings);
- strings.clear();
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- std::string buffer2 = llformat("height_range_spin_%d", i);
- std::string buffer3 = llformat("%d %f %f", i, (F32)getChild<LLUICtrl>(buffer)->getValue().asReal(), (F32)getChild<LLUICtrl>(buffer2)->getValue().asReal());
- strings.push_back(buffer3);
- }
- sendEstateOwnerMessage(msg, "textureheights", invoice, strings);
- strings.clear();
- sendEstateOwnerMessage(msg, "texturecommit", invoice, strings);
- return TRUE;
-}
-
-BOOL LLPanelRegionTextureInfo::validateTextureSizes()
+BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
{
for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
{
@@ -1219,49 +1136,122 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes()
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////
+// LLPanelRegionTerrainInfo
+/////////////////////////////////////////////////////////////////////////////
+// Initialize statics
+LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::sPanelRegionTerrainInfo = NULL;
// static
-void LLPanelRegionTextureInfo::onClickDump(void* data)
+LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance()
{
- llinfos << "LLPanelRegionTextureInfo::onClickDump()" << llendl;
+ if (!sPanelRegionTerrainInfo)
+ {
+ sPanelRegionTerrainInfo = LLFloaterRegionInfo::getPanelRegionTerrain();
+ lldebugs << llformat("Instantiating sPanelRegionTerrainInfo: %p", sPanelRegionTerrainInfo) << llendl;
+ }
+ return sPanelRegionTerrainInfo;
}
+// static
+void LLPanelRegionTerrainInfo::onFloaterClose(bool app_quitting)
+{
+ if (sPanelRegionTerrainInfo)
+ {
+ lldebugs << "Setting LLPanelRegionTerrainInfo to NULL" << llendl;
+ sPanelRegionTerrainInfo = NULL;
+ }
+}
-/////////////////////////////////////////////////////////////////////////////
-// LLPanelRegionTerrainInfo
-/////////////////////////////////////////////////////////////////////////////
BOOL LLPanelRegionTerrainInfo::postBuild()
{
LLPanelRegionInfo::postBuild();
+
+ sPanelRegionTerrainInfo = this; // singleton instance pointer
+ lldebugs << llformat("Setting sPanelRegionTerrainInfo to: %p", sPanelRegionTerrainInfo) << llendl;
initCtrl("water_height_spin");
initCtrl("terrain_raise_spin");
initCtrl("terrain_lower_spin");
- initCtrl("fixed_sun_check");
- getChild<LLUICtrl>("fixed_sun_check")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeFixedSun, this));
- getChild<LLUICtrl>("use_estate_sun_check")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeUseEstateTime, this));
- getChild<LLUICtrl>("sun_hour_slider")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeSunHour, this));
+ std::string buffer;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ initCtrl(buffer);
+ }
+
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ initCtrl(buffer);
+ buffer = llformat("height_range_spin_%d", i);
+ initCtrl(buffer);
+ }
childSetAction("download_raw_btn", onClickDownloadRaw, this);
childSetAction("upload_raw_btn", onClickUploadRaw, this);
childSetAction("bake_terrain_btn", onClickBakeTerrain, this);
- return TRUE;
+ return LLPanelRegionInfo::postBuild();
+}
+
+F32 LLPanelRegionTerrainInfo::getSunHour()
+{
+ if (childIsEnabled("sun_hour_slider"))
+ {
+ return (F32)childGetValue("sun_hour_slider").asReal();
+ }
+ return 0.f;
}
// virtual
bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
- llinfos << "LLPanelRegionTerrainInfo::refreshFromRegion" << llendl;
+ //LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false);
BOOL owner_or_god = gAgent.isGodlike()
|| (region && (region->getOwner() == gAgent.getID()));
BOOL owner_or_god_or_manager = owner_or_god
|| (region && region->isEstateManager());
setCtrlsEnabled(owner_or_god_or_manager);
+
getChildView("apply_btn")->setEnabled(FALSE);
+ if (region)
+ {
+ getChild<LLUICtrl>("region_text")->setValue(LLSD(region->getName()));
+
+ LLVLComposition* compp = region->getComposition();
+ LLTextureCtrl* texture_ctrl;
+ std::string buffer;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(texture_ctrl)
+ {
+ lldebugs << "Detail Texture " << i << ": "
+ << compp->getDetailTextureID(i) << llendl;
+ LLUUID tmp_id(compp->getDetailTextureID(i));
+ texture_ctrl->setImageAssetID(tmp_id);
+ }
+ }
+
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getStartHeight(i)));
+ buffer = llformat("height_range_spin_%d", i);
+ getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getHeightRange(i)));
+ }
+ }
+ else
+ {
+ lldebugs << "no region set" << llendl;
+ getChild<LLUICtrl>("region_text")->setValue(LLSD(""));
+ }
+
getChildView("download_raw_btn")->setEnabled(owner_or_god);
getChildView("upload_raw_btn")->setEnabled(owner_or_god);
getChildView("bake_terrain_btn")->setEnabled(owner_or_god);
@@ -1269,6 +1259,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
return LLPanelRegionInfo::refreshFromRegion(region);
}
+
// virtual
BOOL LLPanelRegionTerrainInfo::sendUpdate()
{
@@ -1277,12 +1268,31 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
strings_t strings;
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ // ==========================================
+ // Assemble and send setregionterrain message
+ // "setregionterrain"
+ // strings[0] = float water height
+ // strings[1] = float terrain raise
+ // strings[2] = float terrain lower
+ // strings[3] = 'Y' use estate time
+ // strings[4] = 'Y' fixed sun
+ // strings[5] = float sun_hour
+ // strings[6] = from estate, 'Y' use global time
+ // strings[7] = from estate, 'Y' fixed sun
+ // strings[8] = from estate, float sun_hour
+
buffer = llformat("%f", (F32)getChild<LLUICtrl>("water_height_spin")->getValue().asReal());
strings.push_back(buffer);
buffer = llformat("%f", (F32)getChild<LLUICtrl>("terrain_raise_spin")->getValue().asReal());
strings.push_back(buffer);
buffer = llformat("%f", (F32)getChild<LLUICtrl>("terrain_lower_spin")->getValue().asReal());
strings.push_back(buffer);
+
+#ifndef TMP_DISABLE_WLES
+ /*
+ * This message is failing
+ * We need to fix how the following values are obtained
+ */
buffer = llformat("%s", (getChild<LLUICtrl>("use_estate_sun_check")->getValue().asBoolean() ? "Y" : "N"));
strings.push_back(buffer);
buffer = llformat("%s", (getChild<LLUICtrl>("fixed_sun_check")->getValue().asBoolean() ? "Y" : "N"));
@@ -1291,7 +1301,7 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
strings.push_back(buffer);
// Grab estate information in case the user decided to set the
- // region back to estate time. JC
+ // region back to estate time.
LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
if (!floater) return true;
@@ -1319,34 +1329,58 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
strings.push_back(buffer);
buffer = llformat("%f", estate_sun_hour);
strings.push_back(buffer);
+#endif // TMP_DISABLE_WLES
sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
- return TRUE;
-}
+ strings.clear();
+
+ // =======================================
+ // Assemble and send texturedetail message
-void LLPanelRegionTerrainInfo::onChangeUseEstateTime()
-{
- BOOL use_estate_sun = getChild<LLUICtrl>("use_estate_sun_check")->getValue().asBoolean();
- getChildView("fixed_sun_check")->setEnabled(!use_estate_sun);
- getChildView("sun_hour_slider")->setEnabled(!use_estate_sun);
- if (use_estate_sun)
+ // Make sure user hasn't chosen wacky textures.
+ if (!validateTextureSizes())
{
- getChild<LLUICtrl>("fixed_sun_check")->setValue(LLSD(FALSE));
- getChild<LLUICtrl>("sun_hour_slider")->setValue(LLSD(0.f));
+ return FALSE;
}
- getChildView("apply_btn")->setEnabled(TRUE);
-}
-void LLPanelRegionTerrainInfo::onChangeFixedSun()
-{
- // Just enable the apply button. We let the sun-hour slider be enabled
- // for both fixed-sun and non-fixed-sun. JC
- getChildView("apply_btn")->setEnabled(TRUE);
-}
+ LLTextureCtrl* texture_ctrl;
+ std::string id_str;
+ LLMessageSystem* msg = gMessageSystem;
-void LLPanelRegionTerrainInfo::onChangeSunHour()
-{
- getChildView("apply_btn")->setEnabled(TRUE);
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(texture_ctrl)
+ {
+ LLUUID tmp_id(texture_ctrl->getImageAssetID());
+ tmp_id.toString(id_str);
+ buffer = llformat("%d %s", i, id_str.c_str());
+ strings.push_back(buffer);
+ }
+ }
+ sendEstateOwnerMessage(msg, "texturedetail", invoice, strings);
+ strings.clear();
+
+ // ========================================
+ // Assemble and send textureheights message
+
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ std::string buffer2 = llformat("height_range_spin_%d", i);
+ std::string buffer3 = llformat("%d %f %f", i, (F32)getChild<LLUICtrl>(buffer)->getValue().asReal(), (F32)getChild<LLUICtrl>(buffer2)->getValue().asReal());
+ strings.push_back(buffer3);
+ }
+ sendEstateOwnerMessage(msg, "textureheights", invoice, strings);
+ strings.clear();
+
+ // ========================================
+ // Send texturecommit message
+
+ sendEstateOwnerMessage(msg, "texturecommit", invoice, strings);
+
+ return TRUE;
}
// static
@@ -1406,9 +1440,69 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con
strings.push_back("bake");
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
+
return false;
}
+#ifndef TMP_DISABLE_WLES
+///////////////////////////////////////////////////////////////
+// Callbacks for Environment tab of Region panel
+
+void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData)
+{
+ LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION);
+}
+
+void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData)
+{
+ LLFloaterWater::show(LLEnvKey::SCOPE_REGION);
+}
+
+
+void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData)
+{
+ if(LLFloaterWindLight::isOpen())
+ {
+ // select the blank value in
+ LLFloaterWindLight* wl = LLFloaterWindLight::instance();
+ LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo");
+ box->selectByValue("");
+ }
+
+ LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN);
+}
+
+///////////////////////////////////////////////////////
+// Advanced handling for WL region estate integration
+
+// Handle commit of WL settings to region
+void LLPanelRegionTerrainInfo::onCommitRegionWL(void* userData)
+{
+ LLEnvManager::getInstance()->commitSettings(LLEnvKey::SCOPE_REGION);
+ LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false);
+}
+
+// Handle cancel of WL settings for region
+void LLPanelRegionTerrainInfo::onCancelRegionWL(void* userData)
+{
+ LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false);
+}
+
+// Handle reversion of region WL settings to default
+void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData)
+{
+ LLEnvManager::instance().resetInternalsToDefault(LLEnvKey::SCOPE_REGION);
+ LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION);
+}
+
+// static
+void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData)
+{
+ // Immediately apply current environment settings to region.
+ LLEnvManager::instance().applyLocalSettingsToRegion();
+}
+#endif // TMP_DISABLE_WLES
+
/////////////////////////////////////////////////////////////////////////////
// LLPanelEstateInfo
//
@@ -1439,6 +1533,7 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch)
estate_dispatch_initialized = true;
}
+#ifndef TMP_DISABLE_WLES
// Disables the sun-hour slider and the use fixed time check if the use global time is check
void LLPanelEstateInfo::onChangeUseGlobalTime()
{
@@ -1457,23 +1552,13 @@ void LLPanelEstateInfo::onChangeFixedSun()
getChild<LLUICtrl>("use_global_time_check")->setValue(LLSD(FALSE));
enableButton("apply_btn");
}
-
+#endif // TMP_DISABLE_WLES
//---------------------------------------------------------------------------
// Add/Remove estate access button callbacks
//---------------------------------------------------------------------------
-void LLPanelEstateInfo::onClickEditSky()
-{
- LLFloaterReg::showInstance("env_windlight");
-}
-
-void LLPanelEstateInfo::onClickEditDayCycle()
-{
- LLFloaterReg::showInstance("env_day_cycle");
-}
-
void LLPanelEstateInfo::onClickAddAllowedAgent()
{
LLCtrlListInterface *list = childGetListInterface("allowed_avatar_name_list");
@@ -2082,13 +2167,19 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region)
return rv;
}
-void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl)
+// virtual
+void LLFloaterRegionInfo::onClose(bool app_quitting)
{
- if (checkRemovalButton(child_ctrl->getName()))
+ if(!app_quitting)
{
- // do nothing
+ //LLEnvManager::getInstance()->maybeClearEditingScope(true, false);
+ LLPanelRegionTerrainInfo::onFloaterClose(app_quitting);
}
- else if (checkSunHourSlider(child_ctrl))
+}
+
+void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl)
+{
+ if (checkRemovalButton(child_ctrl->getName()))
{
// do nothing
}
@@ -2105,18 +2196,11 @@ BOOL LLPanelEstateInfo::postBuild()
{
// set up the callbacks for the generic controls
initCtrl("externally_visible_check");
- initCtrl("use_global_time_check");
- initCtrl("fixed_sun_check");
initCtrl("allow_direct_teleport");
initCtrl("limit_payment");
initCtrl("limit_age_verified");
initCtrl("voice_chat_check");
- // set up the use global time checkbox
- getChild<LLUICtrl>("use_global_time_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeUseGlobalTime, this));
- getChild<LLUICtrl>("fixed_sun_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeFixedSun, this));
- getChild<LLUICtrl>("sun_hour_slider")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
-
getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
if (avatar_name_list)
@@ -2163,9 +2247,6 @@ BOOL LLPanelEstateInfo::postBuild()
childSetAction("message_estate_btn", boost::bind(&LLPanelEstateInfo::onClickMessageEstate, this));
childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this));
- childSetAction("WLEditSky", boost::bind(&LLPanelEstateInfo::onClickEditSky, this));
- childSetAction("WLEditDayCycle", boost::bind(&LLPanelEstateInfo::onClickEditDayCycle, this));
-
return LLPanelRegionInfo::postBuild();
}
@@ -2304,7 +2385,6 @@ bool LLPanelEstateInfo::commitEstateInfoCaps()
body["is_externally_visible"] = getChild<LLUICtrl>("externally_visible_check")->getValue().asBoolean();
body["allow_direct_teleport"] = getChild<LLUICtrl>("allow_direct_teleport")->getValue().asBoolean();
- body["is_sun_fixed" ] = getChild<LLUICtrl>("fixed_sun_check")->getValue().asBoolean();
body["deny_anonymous" ] = getChild<LLUICtrl>("limit_payment")->getValue().asBoolean();
body["deny_age_unverified" ] = getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean();
body["allow_voice_chat" ] = getChild<LLUICtrl>("voice_chat_check")->getValue().asBoolean();
@@ -2369,7 +2449,6 @@ void LLPanelEstateInfo::commitEstateInfoDataserver()
void LLPanelEstateInfo::setEstateFlags(U32 flags)
{
getChild<LLUICtrl>("externally_visible_check")->setValue(LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) );
- getChild<LLUICtrl>("fixed_sun_check")->setValue(LLSD(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE) );
getChild<LLUICtrl>("voice_chat_check")->setValue(
LLSD(flags & REGION_FLAGS_ALLOW_VOICE ? TRUE : FALSE));
getChild<LLUICtrl>("allow_direct_teleport")->setValue(LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) );
@@ -2398,11 +2477,6 @@ U32 LLPanelEstateInfo::computeEstateFlags()
flags |= REGION_FLAGS_ALLOW_DIRECT_TELEPORT;
}
- if (getChild<LLUICtrl>("fixed_sun_check")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SUN_FIXED;
- }
-
if (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean())
{
flags |= REGION_FLAGS_DENY_ANONYMOUS;
@@ -2566,17 +2640,6 @@ BOOL LLPanelEstateInfo::checkRemovalButton(std::string name)
return (btn_name != "");
}
-BOOL LLPanelEstateInfo::checkSunHourSlider(LLUICtrl* child_ctrl)
-{
- BOOL found_child_ctrl = FALSE;
- if (child_ctrl->getName() == "sun_hour_slider")
- {
- enableButton("apply_btn");
- found_child_ctrl = TRUE;
- }
- return found_child_ctrl;
-}
-
// static
void LLPanelEstateInfo::onClickMessageEstate(void* userdata)
{
@@ -3198,3 +3261,537 @@ bool LLDispatchSetEstateAccess::operator()(
return true;
}
+
+LLPanelEnvironmentInfo::LLPanelEnvironmentInfo()
+: mEnableEditing(false),
+ mRegionSettingsRadioGroup(NULL),
+ mDayCycleSettingsRadioGroup(NULL),
+ mWaterPresetCombo(NULL),
+ mSkyPresetCombo(NULL),
+ mDayCyclePresetCombo(NULL)
+{
+}
+
+// virtual
+BOOL LLPanelEnvironmentInfo::postBuild()
+{
+ mRegionSettingsRadioGroup = getChild<LLRadioGroup>("region_settings_radio_group");
+ mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchRegionSettings, this));
+
+ mDayCycleSettingsRadioGroup = getChild<LLRadioGroup>("sky_dayc_settings_radio_group");
+ mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDayCycle, this));
+
+ mWaterPresetCombo = getChild<LLComboBox>("water_settings_preset_combo");
+ mWaterPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectWaterPreset, this));
+
+ mSkyPresetCombo = getChild<LLComboBox>("sky_settings_preset_combo");
+ mSkyPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectSkyPreset, this));
+
+ mDayCyclePresetCombo = getChild<LLComboBox>("dayc_settings_preset_combo");
+ mDayCyclePresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectDayCycle, this));
+
+ childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL);
+ getChild<LLButton>("apply_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, LLEnvManagerNew::getInstance()));
+ childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL);
+ getChild<LLButton>("cancel_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpPresets, LLEnvManagerNew::getInstance()));
+
+ LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this));
+ LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1));
+
+ LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLPanelEnvironmentInfo::populateDayCyclesList, this));
+ LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelEnvironmentInfo::populateSkyPresetsList, this));
+ LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelEnvironmentInfo::populateWaterPresetsList, this));
+
+ return TRUE;
+}
+
+// virtual
+void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
+{
+ LL_DEBUGS("Windlight") << "Panel opened, refreshing" << LL_ENDL;
+ refresh();
+}
+
+// virtual
+void LLPanelEnvironmentInfo::handleVisibilityChange(BOOL new_visibility)
+{
+ // If hiding (user switched to another tab or closed the floater),
+ // display user's preferred environment.
+ if (!new_visibility)
+ {
+ LLEnvManagerNew::instance().usePrefs();
+ }
+}
+
+// virtual
+bool LLPanelEnvironmentInfo::refreshFromRegion(LLViewerRegion* region)
+{
+ LL_DEBUGS("Windlight") << "Region updated, enabling/disabling controls" << LL_ENDL;
+ BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID()));
+ BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager());
+
+ // Don't refresh from region settings to avoid flicker after applying new region settings.
+ mEnableEditing = owner_or_god_or_manager;
+ setControlsEnabled(mEnableEditing);
+
+ return LLPanelRegionInfo::refreshFromRegion(region);
+}
+
+void LLPanelEnvironmentInfo::refresh()
+{
+ populateWaterPresetsList();
+ populateSkyPresetsList();
+ populateDayCyclesList();
+
+ // Init radio groups.
+ const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings();
+ const LLSD& dc = settings.getWLDayCycle();
+ LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f;
+ const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0;
+ mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1);
+ mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1);
+
+ setControlsEnabled(mEnableEditing);
+
+ setDirty(false);
+}
+
+void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
+{
+ mRegionSettingsRadioGroup->setEnabled(enabled);
+ mDayCycleSettingsRadioGroup->setEnabled(enabled);
+
+ mWaterPresetCombo->setEnabled(enabled);
+ mSkyPresetCombo->setEnabled(enabled);
+ mDayCyclePresetCombo->setEnabled(enabled);
+
+ getChildView("apply_btn")->setEnabled(enabled);
+ getChildView("cancel_btn")->setEnabled(enabled);
+
+ if (enabled)
+ {
+ // Enable/disable some controls based on currently selected radio buttons.
+ bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ getChild<LLView>("user_environment_settings")->setEnabled(!use_defaults);
+
+ bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+ mSkyPresetCombo->setEnabled(is_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
+ }
+}
+
+void LLPanelEnvironmentInfo::setApplyProgress(bool started)
+{
+ LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("progress_indicator");
+
+ indicator->setVisible(started);
+
+ if (started)
+ {
+ indicator->start();
+ }
+ else
+ {
+ indicator->stop();
+ }
+}
+
+void LLPanelEnvironmentInfo::setDirty(bool dirty)
+{
+ getChildView("apply_btn")->setEnabled(dirty);
+ getChildView("cancel_btn")->setEnabled(dirty);
+}
+
+void LLPanelEnvironmentInfo::populateWaterPresetsList()
+{
+ mWaterPresetCombo->removeall();
+
+ // If the region already has water params, add them to the list.
+ const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ if (region_settings.getWaterParams().size() != 0)
+ {
+ const std::string& region_name = gAgent.getRegion()->getName();
+ mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD());
+ mWaterPresetCombo->addSeparator();
+ }
+
+ std::list<std::string> user_presets, system_presets;
+ LLWaterParamManager::instance().getPresetNames(user_presets, system_presets);
+
+ // Add local user presets first.
+ for (std::list<std::string>::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ if (user_presets.size() > 0)
+ {
+ mWaterPresetCombo->addSeparator();
+ }
+
+ // Add local system presets.
+ for (std::list<std::string>::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it)
+ {
+ mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ // There's no way to select current preset because its name is not stored on server.
+}
+
+void LLPanelEnvironmentInfo::populateSkyPresetsList()
+{
+ mSkyPresetCombo->removeall();
+
+ LLWLParamManager::preset_name_list_t region_presets;
+ LLWLParamManager::preset_name_list_t user_presets, sys_presets;
+ LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets);
+
+ // Add region presets.
+ std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown");
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it)
+ {
+ std::string preset_name = *it;
+ std::string item_title = preset_name + " (" + region_name + ")";
+ mSkyPresetCombo->add(item_title, LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal());
+ }
+
+ if (!region_presets.empty())
+ {
+ mSkyPresetCombo->addSeparator();
+ }
+
+ // Add user presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ if (!user_presets.empty())
+ {
+ mSkyPresetCombo->addSeparator();
+ }
+
+ // Add system presets.
+ for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it)
+ {
+ mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ // Select current preset.
+ LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap();
+ if (sky_map.size() == 1) // if the region is set to fixed sky
+ {
+ std::string preset_name = sky_map.beginMap()->first;
+ mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal());
+ }
+}
+
+void LLPanelEnvironmentInfo::populateDayCyclesList()
+{
+ mDayCyclePresetCombo->removeall();
+
+ // If the region already has env. settings, add its day cycle to the list.
+ const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle();
+ if (cur_region_dc.size() != 0)
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ llassert(region != NULL);
+
+ LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION);
+ mDayCyclePresetCombo->add(region->getName(), key.toStringVal());
+ mDayCyclePresetCombo->addSeparator();
+ }
+
+ // Add local user day cycles.
+ LLDayCycleManager::preset_name_list_t user_days, sys_days;
+ LLDayCycleManager::instance().getPresetNames(user_days, sys_days);
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it)
+ {
+ mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ if (user_days.size() > 0)
+ {
+ mDayCyclePresetCombo->addSeparator();
+ }
+
+ // Add local system day cycles.
+ for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it)
+ {
+ mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
+ }
+
+ // Current day cycle is already selected.
+}
+
+bool LLPanelEnvironmentInfo::getSelectedWaterParams(LLSD& water_params)
+{
+ LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue());
+
+ if (water_key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams();
+ }
+ else
+ {
+ LLWaterParamSet param_set;
+ if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set))
+ {
+ llwarns << "Error getting water preset: " << water_key.name << llendl;
+ return false;
+ }
+
+ water_params = param_set.getAll();
+ }
+
+ return true;
+}
+
+bool LLPanelEnvironmentInfo::getSelectedSkyParams(LLSD& sky_params, std::string& preset_name)
+{
+ std::string preset_key(mSkyPresetCombo->getValue().asString());
+ LLWLParamKey preset(preset_key);
+
+ // Get the preset sky params.
+ LLWLParamSet param_set;
+ if (!LLWLParamManager::instance().getParamSet(preset, param_set))
+ {
+ llwarns << "Error getting sky params: " << preset.toLLSD() << llendl;
+ return false;
+ }
+
+ sky_params = param_set.getAll();
+ preset_name = preset.name;
+ return true;
+}
+
+bool LLPanelEnvironmentInfo::getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope)
+{
+ std::string preset_key(mDayCyclePresetCombo->getValue().asString());
+ LLWLParamKey dc(preset_key);
+ LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL;
+
+ if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle
+ {
+ const LLEnvironmentSettings& cur_region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ day_cycle = cur_region_settings.getWLDayCycle();
+ sky_map = cur_region_settings.getSkyMap();
+ }
+ else // a local day cycle
+ {
+ if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle))
+ {
+ llwarns << "Error getting day cycle " << dc.name << llendl;
+ return false;
+ }
+
+ // Create sky map from the day cycle.
+ {
+ LLWLDayCycle tmp_day;
+ tmp_day.loadDayCycle(day_cycle, dc.scope);
+ tmp_day.getSkyMap(sky_map);
+ }
+ }
+
+ scope = dc.scope;
+
+ return true;
+}
+void LLPanelEnvironmentInfo::onSwitchRegionSettings()
+{
+ bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ getChild<LLView>("user_environment_settings")->setEnabled(!use_defaults);
+
+ if (use_defaults)
+ {
+ LLEnvManagerNew::instance().useDefaults();
+ }
+ else
+ {
+ onSelectWaterPreset();
+ onSwitchDayCycle();
+ }
+
+ setDirty(true);
+}
+
+void LLPanelEnvironmentInfo::onSwitchDayCycle()
+{
+ bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+
+ mSkyPresetCombo->setEnabled(is_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
+
+ if (is_fixed_sky)
+ {
+ onSelectSkyPreset();
+ }
+ else
+ {
+ onSelectDayCycle();
+ }
+
+ setDirty(true);
+}
+
+void LLPanelEnvironmentInfo::onSelectWaterPreset()
+{
+ LLSD water_params;
+
+ if (getSelectedWaterParams(water_params))
+ {
+ LLEnvManagerNew::instance().useWaterParams(water_params);
+ }
+
+ setDirty(true);
+}
+
+void LLPanelEnvironmentInfo::onSelectSkyPreset()
+{
+ LLSD params;
+ std::string dummy;
+
+ if (getSelectedSkyParams(params, dummy))
+ {
+ LLEnvManagerNew::instance().useSkyParams(params);
+ }
+
+ setDirty(true);
+}
+
+void LLPanelEnvironmentInfo::onSelectDayCycle()
+{
+ LLSD day_cycle;
+ LLSD sky_map; // unused
+ short scope;
+
+ if (getSelectedDayCycleParams(day_cycle, sky_map, scope))
+ {
+ LLEnvManagerNew::instance().useDayCycleParams(day_cycle, (LLEnvKey::EScope) scope);
+ }
+
+ setDirty(true);
+}
+
+void LLPanelEnvironmentInfo::onBtnApply()
+{
+ const bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ const bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+
+ LLSD day_cycle;
+ LLSD sky_map;
+ LLSD water_params;
+
+ if (use_defaults)
+ {
+ // settings will be empty
+ LL_DEBUGS("Windlight") << "Defaults" << LL_ENDL;
+ }
+ else // use custom region settings
+ {
+ if (use_fixed_sky)
+ {
+ LL_DEBUGS("Windlight") << "Use fixed sky" << LL_ENDL;
+
+ // Get selected sky params.
+ LLSD params;
+ std::string preset_name;
+ if (!getSelectedSkyParams(params, preset_name))
+ {
+ return;
+ }
+
+ // Create a day cycle consisting of a single sky preset.
+ LLSD key(LLSD::emptyArray());
+ key.append(-1.0f); // indicate that user preference is actually fixed sky, not a day cycle
+ key.append(preset_name);
+ day_cycle.append(key);
+
+ // Create a sky map consisting of only the sky preset.
+ std::map<LLWLParamKey, LLWLParamSet> refs;
+ LLWLParamSet param_set;
+ param_set.setAll(params);
+ refs[LLWLParamKey(preset_name, LLEnvKey::SCOPE_LOCAL)] = param_set; // scope doesn't matter here
+ sky_map = LLWLParamManager::createSkyMap(refs);
+ }
+ else // use day cycle
+ {
+ LL_DEBUGS("Windlight") << "Use day cycle" << LL_ENDL;
+
+ short scope; // unused
+ if (!getSelectedDayCycleParams(day_cycle, sky_map, scope))
+ {
+ return;
+ }
+
+ // If it's a special single-preset day cycle meaning using a fixed sky,
+ // reset the frame time to a non-negative value,
+ // so that the region setting is displayed in the floater as
+ // a day cycle, not a preset. (STORM-1289)
+ if (day_cycle.size() == 1 && day_cycle[0][0].asReal() < 0.0f)
+ {
+ LL_DEBUGS("Windlight") << "Fixing negative time" << LL_ENDL;
+ day_cycle[0][0] = 0.0f;
+ }
+ }
+
+ // Get water params.
+ if (!getSelectedWaterParams(water_params))
+ {
+ // *TODO: show a notification?
+ return;
+ }
+ }
+
+ // Send settings apply request.
+ LLEnvironmentSettings new_region_settings;
+ new_region_settings.saveParams(day_cycle, sky_map, water_params, 0.0f);
+ if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings))
+ {
+ llwarns << "Error applying region environment settings" << llendl;
+ return;
+ }
+
+ setApplyProgress(true);
+}
+
+void LLPanelEnvironmentInfo::onBtnCancel()
+{
+ // Reload last saved region settings.
+ refresh();
+
+ // Apply them.
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ const LLEnvironmentSettings& cur_settings = env_mgr.getRegionSettings();
+ const LLSD& region_day_cycle = cur_settings.getWLDayCycle();
+ const LLSD& region_water = cur_settings.getWaterParams();
+ env_mgr.useWaterParams(region_water);
+ env_mgr.useDayCycleParams(region_day_cycle, LLEnvKey::SCOPE_REGION);
+}
+
+void LLPanelEnvironmentInfo::onRegionSettingschange()
+{
+ LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL;
+ refresh();
+
+ // Stop applying progress indicator (it may be running if it's us who initiated settings update).
+ setApplyProgress(false);
+}
+
+void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok)
+{
+ LL_DEBUGS("Windlight") << "Applying region settings finished, stopping indicator" << LL_ENDL;
+ // If applying new settings has failed, stop the indicator right away.
+ // Otherwise it will be stopped when we receive the updated settings from server.
+ if (!ok)
+ {
+ setApplyProgress(false);
+
+ // We need to re-request environment setting here,
+ // otherwise our subsequent attempts to change region settings will fail with the following error:
+ // "Unable to update environment settings because the last update your viewer saw was not the same
+ // as the last update sent from the simulator. Try sending your update again, and if this
+ // does not work, try leaving and returning to the region."
+ LLEnvManagerNew::instance().requestRegionSettings();
+ }
+}
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 2b87c27fcf..6075842e76 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -46,6 +46,7 @@ class LLInventoryItem;
class LLCheckBoxCtrl;
class LLComboBox;
class LLNameListCtrl;
+class LLRadioGroup;
class LLSliderCtrl;
class LLSpinCtrl;
class LLTextBox;
@@ -53,11 +54,17 @@ class LLVFS;
class LLPanelRegionGeneralInfo;
class LLPanelRegionDebugInfo;
-class LLPanelRegionTextureInfo;
class LLPanelRegionTerrainInfo;
class LLPanelEstateInfo;
class LLPanelEstateCovenant;
+class LLEventTimer;
+class LLEnvironmentSettings;
+class LLWLParamManager;
+class LLWaterParamManager;
+class LLWLParamSet;
+class LLWaterParamSet;
+
class LLFloaterRegionInfo : public LLFloater
{
friend class LLFloaterReg;
@@ -67,6 +74,8 @@ public:
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+
static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
// get and process region info if necessary.
@@ -79,6 +88,7 @@ public:
static LLPanelEstateInfo* getPanelEstate();
static LLPanelEstateCovenant* getPanelCovenant();
+ static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
// from LLPanel
virtual void refresh();
@@ -96,6 +106,7 @@ private:
boost::signals2::connection mConsoleReplySignalConnection;;
protected:
+ void onTabSelected(const LLSD& param);
void refreshFromRegion(LLViewerRegion* region);
// member data
@@ -208,38 +219,28 @@ private:
/////////////////////////////////////////////////////////////////////////////
-class LLPanelRegionTextureInfo : public LLPanelRegionInfo
+class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
{
+ LOG_CLASS(LLPanelRegionTerrainInfo);
+
public:
- LLPanelRegionTextureInfo();
- ~LLPanelRegionTextureInfo() {}
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
-
- // LLPanel && LLView
- virtual BOOL postBuild();
+ LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
+ ~LLPanelRegionTerrainInfo() {}
-protected:
- virtual BOOL sendUpdate();
+ static LLPanelRegionTerrainInfo* instance();
+ virtual BOOL postBuild(); // LLPanel
+ static void onFloaterClose(bool app_quitting);
- static void onClickDump(void* data);
- BOOL validateTextureSizes();
-};
+ F32 getSunHour();
+ virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator
+ void setEnvControls(bool available); // Whether environment settings are available for this region
-/////////////////////////////////////////////////////////////////////////////
+ BOOL validateTextureSizes();
-class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
-{
-public:
- LLPanelRegionTerrainInfo()
- : LLPanelRegionInfo() {}
- ~LLPanelRegionTerrainInfo() {}
- // LLPanel
- virtual BOOL postBuild();
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
+ //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
-protected:
+ static LLPanelRegionTerrainInfo* sPanelRegionTerrainInfo; // static instance pointer for singleton
+
virtual BOOL sendUpdate();
void onChangeUseEstateTime();
@@ -250,6 +251,14 @@ protected:
static void onClickUploadRaw(void*);
static void onClickBakeTerrain(void*);
bool callbackBakeTerrain(const LLSD& notification, const LLSD& response);
+
+ static void onOpenAdvancedSky(void* userData); // open the advanced sky settings menu
+ static void onOpenAdvancedWater(void* userData); // open the advanced water settings menu
+ static void onUseEstateTime(void* userData); // sync time with the server
+ static void onCommitRegionWL(void* userData); // commit region information to server
+ static void onCancelRegionWL(void* userData); // cancel changes to region
+ static void onSetRegionToDefaultWL(void* userData); // revert region WL settings to default
+ static void onApplyCurrentWL(void* userData); // apply current settings to region
};
/////////////////////////////////////////////////////////////////////////////
@@ -337,7 +346,6 @@ public:
// If visible from mainland, allowed agent and allowed groups
// are ignored, so must disable UI.
void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban);
-
protected:
virtual BOOL sendUpdate();
// confirmation dialog callback
@@ -417,4 +425,60 @@ protected:
EAssetStatus mAssetStatus;
};
+/////////////////////////////////////////////////////////////////////////////
+
+class LLPanelEnvironmentInfo : public LLPanelRegionInfo
+{
+ LOG_CLASS(LLPanelEnvironmentInfo);
+
+public:
+ LLPanelEnvironmentInfo();
+
+ // LLPanel
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ // LLView
+ /*virtual*/ void handleVisibilityChange(BOOL new_visibility);
+
+ // LLPanelRegionInfo
+ /*virtual*/ bool refreshFromRegion(LLViewerRegion* region);
+
+private:
+ void refresh();
+ void setControlsEnabled(bool enabled);
+ void setApplyProgress(bool started);
+ void setDirty(bool dirty);
+
+ void populateWaterPresetsList();
+ void populateSkyPresetsList();
+ void populateDayCyclesList();
+
+ bool getSelectedWaterParams(LLSD& water_params);
+ bool getSelectedSkyParams(LLSD& sky_params, std::string& preset_name);
+ bool getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope);
+
+ void onSwitchRegionSettings();
+ void onSwitchDayCycle();
+
+ void onSelectWaterPreset();
+ void onSelectSkyPreset();
+ void onSelectDayCycle();
+
+ void onBtnApply();
+ void onBtnCancel();
+
+ void onRegionSettingschange();
+ void onRegionSettingsApplied(bool ok);
+
+ bool mEnableEditing;
+
+ LLRadioGroup* mRegionSettingsRadioGroup;
+ LLRadioGroup* mDayCycleSettingsRadioGroup;
+
+ LLComboBox* mWaterPresetCombo;
+ LLComboBox* mSkyPresetCombo;
+ LLComboBox* mDayCyclePresetCombo;
+};
+
#endif
diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp
index be4b144f41..4d647f30f5 100644
--- a/indra/newview/llfloaterwater.cpp
+++ b/indra/newview/llfloaterwater.cpp
@@ -45,6 +45,7 @@
#include "llfloaterdaycycle.h"
#include "llboost.h"
#include "llmultisliderctrl.h"
+#include "llnotifications.h"
#include "v4math.h"
#include "llviewerdisplay.h"
@@ -59,6 +60,8 @@
#undef max
std::set<std::string> LLFloaterWater::sDefaultPresets;
+LLEnvKey::EScope LLFloaterWater::sScope;
+std::string LLFloaterWater::sOriginalTitle;
LLFloaterWater::LLFloaterWater(const LLSD& key)
: LLFloater(key)
@@ -70,7 +73,7 @@ LLFloaterWater::~LLFloaterWater()
}
BOOL LLFloaterWater::postBuild()
{
-
+ sOriginalTitle=getTitle();
std::string def_water = getString("WLDefaultWaterNames");
// no editing or deleting of the blank string
@@ -87,24 +90,57 @@ BOOL LLFloaterWater::postBuild()
if(comboBox != NULL) {
- std::map<std::string, LLWaterParamSet>::iterator mIt =
- LLWaterParamManager::instance()->mParamList.begin();
- for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++)
+ LLWaterParamManager::preset_name_list_t presets;
+ LLWaterParamManager::instance().getPresetNames(presets);
+ for (LLWaterParamManager::preset_name_list_t::const_iterator it = presets.begin(); it != presets.end(); ++it)
{
- comboBox->add(mIt->first);
+ comboBox->add(*it);
}
// set defaults on combo boxes
- comboBox->selectByValue(LLSD("Default"));
+ comboBox->selectByValue(LLEnvManagerNew::instance().getWaterPresetName());
}
// load it up
initCallbacks();
syncMenu();
return TRUE;
}
+
+// static
+void LLFloaterWater::show(LLEnvKey::EScope scope)
+{
+ LLFloaterWater* water = LLFloaterReg::getTypedInstance<LLFloaterWater>("env_water");
+ llassert(water);
+
+ if(scope != sScope && ((LLView*)water)->getVisible())
+ {
+ LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD());
+ return;
+ }
+ sScope = scope;
+ std::string scope_str = "";
+ switch(sScope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ scope_str = LLTrans::getString("LocalSettings");
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ scope_str = LLTrans::getString("RegionSettings");
+ break;
+ }
+ std::string title = sOriginalTitle + " (" + scope_str + ")";
+ water->setTitle(title);
+ water->syncMenu();
+
+ LLEnvManager::instance().startEditingScope(scope);
+
+ water->openFloater();
+
+}
+
void LLFloaterWater::initCallbacks(void) {
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance();
getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, &param_mgr->mFogColor));
@@ -163,15 +199,12 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res
if(option == 0) {
LLComboBox* comboBox = getChild<LLComboBox>( "WaterPresetsCombo");
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance();
// add the current parameters to the list
// see if it's there first
- std::map<std::string, LLWaterParamSet>::iterator mIt =
- param_mgr->mParamList.find(text);
-
// if not there, add a new one
- if(mIt == param_mgr->mParamList.end())
+ if (!param_mgr->hasParamSet(text))
{
param_mgr->addParamSet(text, param_mgr->mCurParams);
comboBox->add(text);
@@ -195,7 +228,7 @@ void LLFloaterWater::syncMenu()
{
bool err;
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance();
LLWaterParamSet & current_params = param_mgr->mCurParams;
@@ -262,9 +295,9 @@ void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control*
vectorControl->mX = sldrCtrl->getValueF32();
- vectorControl->update(LLWaterParamManager::instance()->mCurParams);
+ vectorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
// vector control callbacks
@@ -274,9 +307,9 @@ void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control*
vectorControl->mY = sldrCtrl->getValueF32();
- vectorControl->update(LLWaterParamManager::instance()->mCurParams);
+ vectorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
// vector control callbacks
@@ -286,9 +319,9 @@ void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control*
vectorControl->mZ = sldrCtrl->getValueF32();
- vectorControl->update(LLWaterParamManager::instance()->mCurParams);
+ vectorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
@@ -299,9 +332,9 @@ void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control*
vectorControl->mX = sldrCtrl->getValueF32();
- vectorControl->update(LLWaterParamManager::instance()->mCurParams);
+ vectorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
// vector control callbacks
@@ -311,9 +344,9 @@ void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control*
vectorControl->mY = sldrCtrl->getValueF32();
- vectorControl->update(LLWaterParamManager::instance()->mCurParams);
+ vectorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
// color control callbacks
@@ -335,9 +368,9 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* col
getChild<LLUICtrl>(name)->setValue(colorControl->mR);
}
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
@@ -359,9 +392,9 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* col
}
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
@@ -382,9 +415,9 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* col
getChild<LLUICtrl>(name)->setValue(colorControl->mB);
}
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
@@ -393,9 +426,9 @@ void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* col
colorControl->mA = sldrCtrl->getValueF32();
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ LLWaterParamManager::getInstance()->propagateParameters();
}
@@ -454,8 +487,8 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* col
}
// now update the current parameters and send them to shaders
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
@@ -464,10 +497,10 @@ void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl
F32 val = sldrCtrl->getValueF32();
expFloatControl->mExp = val;
- LLWaterParamManager::instance()->setDensitySliderValue(val);
+ LLWaterParamManager::getInstance()->setDensitySliderValue(val);
- expFloatControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl)
@@ -476,23 +509,23 @@ void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floa
floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult;
- floatControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ floatControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
*colorControl = swatch->get();
- colorControl->update(LLWaterParamManager::instance()->mCurParams);
- LLWaterParamManager::instance()->propagateParameters();
+ colorControl->update(LLWaterParamManager::getInstance()->mCurParams);
+ LLWaterParamManager::getInstance()->propagateParameters();
}
void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl)
{
LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
LLUUID textID = textCtrl->getImageAssetID();
- LLWaterParamManager::instance()->setNormalMapID(textID);
+ LLWaterParamManager::getInstance()->setNormalMapID(textID);
}
void LLFloaterWater::onNewPreset()
@@ -511,7 +544,7 @@ void LLFloaterWater::onSavePreset()
return;
}
- LLWaterParamManager::instance()->mCurParams.mName =
+ LLWaterParamManager::getInstance()->mCurParams.mName =
comboBox->getSelectedItemLabel();
// check to see if it's a default and shouldn't be overwritten
@@ -532,7 +565,7 @@ bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& res
// if they choose save, do it. Otherwise, don't do anything
if(option == 0)
{
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
+ LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance();
param_mgr->setParamSet(
param_mgr->mCurParams.mName,
@@ -583,7 +616,7 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r
return false;
}
- LLWaterParamManager::instance()->removeParamSet(name, true);
+ LLWaterParamManager::getInstance()->removeParamSet(name, true);
// remove and choose another
S32 new_index = combo_box->getCurrentIndex();
@@ -594,8 +627,8 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r
{
key_combo->remove(name);
- // remove from slider, as well
- day_cycle->deletePreset(name);
+ // water is not part of day cycles, yet
+ //day_cycle->deletePreset(name);
}
// pick the previously selected index after delete
@@ -618,7 +651,11 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl)
std::string data = ctrl->getValue().asString();
if(!data.empty())
{
- LLWaterParamManager::instance()->loadPreset(data);
+#if 0
+ LLWaterParamManager::instance().loadPreset(data);
+#else
+ LLEnvManagerNew::instance().setUseWaterPreset(data);
+#endif
syncMenu();
}
}
diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h
index e3db91e80d..25858fba01 100644
--- a/indra/newview/llfloaterwater.h
+++ b/indra/newview/llfloaterwater.h
@@ -33,8 +33,7 @@
#include "llfloater.h"
-#include <vector>
-#include "llwlparamset.h"
+#include "llenvmanager.h"
struct WaterVector2Control;
struct WaterVector3Control;
@@ -53,6 +52,8 @@ public:
/// initialize all
void initCallbacks(void);
+ static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL);
+
bool newPromptCallback(const LLSD& notification, const LLSD& response);
/// general purpose callbacks for dealing with color controllers
@@ -101,6 +102,8 @@ public:
private:
static std::set<std::string> sDefaultPresets;
+ static LLEnvKey::EScope sScope;
+ static std::string sOriginalTitle;
};
diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp
index ae98b2cf99..43c61f2994 100644
--- a/indra/newview/llfloaterwindlight.cpp
+++ b/indra/newview/llfloaterwindlight.cpp
@@ -35,7 +35,6 @@
#include "llsliderctrl.h"
#include "llmultislider.h"
#include "llmultisliderctrl.h"
-#include "llnotificationsutil.h"
#include "llspinctrl.h"
#include "llcheckboxctrl.h"
#include "lluictrlfactory.h"
@@ -44,6 +43,7 @@
#include "lllineeditor.h"
#include "llfloaterdaycycle.h"
#include "llboost.h"
+#include "llnotifications.h"
#include "v4math.h"
#include "llviewerdisplay.h"
@@ -54,157 +54,172 @@
#include "llwlparamset.h"
#include "llwlparammanager.h"
#include "llpostprocess.h"
-#include "lltabcontainer.h"
-
#undef max
-std::set<std::string> LLFloaterWindLight::sDefaultPresets;
+// *TODO: Remove this class in favor of LLFloaterEditSky
-static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
+LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL;
+std::set<LLWLParamKey> LLFloaterWindLight::sDefaultPresets;
+LLEnvKey::EScope LLFloaterWindLight::sScope;
+std::string LLFloaterWindLight::sOriginalTitle;
-LLFloaterWindLight::LLFloaterWindLight(const LLSD& key)
- : LLFloater(key)
-{
-}
+static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
-LLFloaterWindLight::~LLFloaterWindLight()
+LLFloaterWindLight::LLFloaterWindLight(const LLSD &key) : LLFloater(key)
{
}
BOOL LLFloaterWindLight::postBuild()
{
- // add the list of presets
- std::string def_days = getString("WLDefaultSkyNames");
-
- // no editing or deleting of the blank string
- sDefaultPresets.insert("");
- boost_tokenizer tokens(def_days, boost::char_separator<char>(":"));
- for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
- {
- std::string tok(*token_iter);
- sDefaultPresets.insert(tok);
- }
-
+ sWindLight = this;
+ sOriginalTitle = getTitle();
+
// add the combo boxes
LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo");
if(comboBox != NULL) {
-
- std::map<std::string, LLWLParamSet>::iterator mIt =
- LLWLParamManager::instance()->mParamList.begin();
- for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++)
+
+ LLWLParamManager::preset_key_list_t preset_keys;
+ LLWLParamManager::instance().getPresetKeys(preset_keys);
+ for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it)
{
- comboBox->add(mIt->first);
+ const LLWLParamKey& key = *it;
+ std::string item_title = key.name;
+ if (key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ item_title += std::string(" (") + LLTrans::getString("Region") + std::string(")");
+ }
+
+ comboBox->add(item_title, key.toLLSD());
}
// entry for when we're in estate time
comboBox->add(LLStringUtil::null);
// set defaults on combo boxes
- comboBox->selectByValue(LLSD("Default"));
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ comboBox->selectByValue(env_mgr.getUseFixedSky() ? env_mgr.getSkyPresetName() : LLStringUtil::null);
}
+
+ // add the list of presets
+ std::string def_days = getString("WLDefaultSkyNames");
+
+ // no editing or deleting of the blank string
+ LLWLParamKey blank("", LLEnvKey::SCOPE_LOCAL);
+ sDefaultPresets.insert(blank);
+ boost_tokenizer tokens(def_days, boost::char_separator<char>(":"));
+ for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+ {
+ std::string tok(*token_iter);
+ LLWLParamKey key(tok, LLEnvKey::SCOPE_LOCAL);
+ sDefaultPresets.insert(key);
+ }
+
// load it up
initCallbacks();
- syncMenu();
-
return TRUE;
}
-void LLFloaterWindLight::initCallbacks(void) {
- LLWLParamManager * param_mgr = LLWLParamManager::instance();
+LLFloaterWindLight::~LLFloaterWindLight()
+{
+}
+
+void LLFloaterWindLight::initCallbacks(void)
+{
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
// blue horizon
- getChild<LLUICtrl>("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mBlueHorizon));
- getChild<LLUICtrl>("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mBlueHorizon));
- getChild<LLUICtrl>("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mBlueHorizon));
- getChild<LLUICtrl>("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr->mBlueHorizon));
+ childSetCommitCallback("WLBlueHorizonR", onColorControlRMoved, &param_mgr->mBlueHorizon);
+ childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, &param_mgr->mBlueHorizon);
+ childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, &param_mgr->mBlueHorizon);
+ childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, &param_mgr->mBlueHorizon);
// haze density, horizon, mult, and altitude
- getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mHazeDensity));
- getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mHazeHorizon));
- getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mDensityMult));
- getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mMaxAlt));
+ childSetCommitCallback("WLHazeDensity", onColorControlRMoved, &param_mgr->mHazeDensity);
+ childSetCommitCallback("WLHazeHorizon", onColorControlRMoved, &param_mgr->mHazeHorizon);
+ childSetCommitCallback("WLDensityMult", onFloatControlMoved, &param_mgr->mDensityMult);
+ childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, &param_mgr->mMaxAlt);
// blue density
- getChild<LLUICtrl>("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mBlueDensity));
- getChild<LLUICtrl>("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mBlueDensity));
- getChild<LLUICtrl>("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mBlueDensity));
- getChild<LLUICtrl>("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr->mBlueDensity));
+ childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, &param_mgr->mBlueDensity);
+ childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, &param_mgr->mBlueDensity);
+ childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, &param_mgr->mBlueDensity);
+ childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, &param_mgr->mBlueDensity);
// Lighting
// sunlight
- getChild<LLUICtrl>("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mSunlight));
- getChild<LLUICtrl>("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mSunlight));
- getChild<LLUICtrl>("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mSunlight));
- getChild<LLUICtrl>("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr->mSunlight));
+ childSetCommitCallback("WLSunlightR", onColorControlRMoved, &param_mgr->mSunlight);
+ childSetCommitCallback("WLSunlightG", onColorControlGMoved, &param_mgr->mSunlight);
+ childSetCommitCallback("WLSunlightB", onColorControlBMoved, &param_mgr->mSunlight);
+ childSetCommitCallback("WLSunlightI", onColorControlIMoved, &param_mgr->mSunlight);
// glow
- getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowRMoved, this, _1, &param_mgr->mGlow));
- getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowBMoved, this, _1, &param_mgr->mGlow));
+ childSetCommitCallback("WLGlowR", onGlowRMoved, &param_mgr->mGlow);
+ childSetCommitCallback("WLGlowB", onGlowBMoved, &param_mgr->mGlow);
// ambient
- getChild<LLUICtrl>("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mAmbient));
- getChild<LLUICtrl>("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mAmbient));
- getChild<LLUICtrl>("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mAmbient));
- getChild<LLUICtrl>("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr->mAmbient));
+ childSetCommitCallback("WLAmbientR", onColorControlRMoved, &param_mgr->mAmbient);
+ childSetCommitCallback("WLAmbientG", onColorControlGMoved, &param_mgr->mAmbient);
+ childSetCommitCallback("WLAmbientB", onColorControlBMoved, &param_mgr->mAmbient);
+ childSetCommitCallback("WLAmbientI", onColorControlIMoved, &param_mgr->mAmbient);
// time of day
- getChild<LLUICtrl>("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, &param_mgr->mLightnorm));
- getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, &param_mgr->mLightnorm));
+ childSetCommitCallback("WLSunAngle", onSunMoved, &param_mgr->mLightnorm);
+ childSetCommitCallback("WLEastAngle", onSunMoved, &param_mgr->mLightnorm);
// Clouds
// Cloud Color
- getChild<LLUICtrl>("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mCloudColor));
- getChild<LLUICtrl>("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mCloudColor));
- getChild<LLUICtrl>("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mCloudColor));
- getChild<LLUICtrl>("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr->mCloudColor));
+ childSetCommitCallback("WLCloudColorR", onColorControlRMoved, &param_mgr->mCloudColor);
+ childSetCommitCallback("WLCloudColorG", onColorControlGMoved, &param_mgr->mCloudColor);
+ childSetCommitCallback("WLCloudColorB", onColorControlBMoved, &param_mgr->mCloudColor);
+ childSetCommitCallback("WLCloudColorI", onColorControlIMoved, &param_mgr->mCloudColor);
// Cloud
- getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mCloudMain));
- getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mCloudMain));
- getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mCloudMain));
+ childSetCommitCallback("WLCloudX", onColorControlRMoved, &param_mgr->mCloudMain);
+ childSetCommitCallback("WLCloudY", onColorControlGMoved, &param_mgr->mCloudMain);
+ childSetCommitCallback("WLCloudDensity", onColorControlBMoved, &param_mgr->mCloudMain);
// Cloud Detail
- getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr->mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr->mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr->mCloudDetail));
+ childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, &param_mgr->mCloudDetail);
+ childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, &param_mgr->mCloudDetail);
+ childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, &param_mgr->mCloudDetail);
// Cloud extras
- getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mCloudCoverage));
- getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mCloudScale));
- getChild<LLUICtrl>("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXToggled, this, _1));
- getChild<LLUICtrl>("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYToggled, this, _1));
- getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXMoved, this, _1));
- getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYMoved, this, _1));
- getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mDistanceMult));
- getChild<LLUICtrl>("DrawClassicClouds")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "SkyUseClassicClouds"));
-
+ childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, &param_mgr->mCloudCoverage);
+ childSetCommitCallback("WLCloudScale", onFloatControlMoved, &param_mgr->mCloudScale);
+ childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL);
+ childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL);
+ childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL);
+ childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL);
+ childSetCommitCallback("WLDistanceMult", onFloatControlMoved, &param_mgr->mDistanceMult);
+
// WL Top
- getChild<LLUICtrl>("WLDayCycleMenuButton")->setCommitCallback(boost::bind(&LLFloaterWindLight::onOpenDayCycle, this));
+ childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL);
// Load/save
LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo");
//childSetAction("WLLoadPreset", onLoadPreset, comboBox);
- getChild<LLUICtrl>("WLNewPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onNewPreset, this));
- getChild<LLUICtrl>("WLSavePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSavePreset, this));
- getChild<LLUICtrl>("WLDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onDeletePreset, this));
-
- comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, this, _1));
+ childSetAction("WLNewPreset", onNewPreset, comboBox);
+ childSetAction("WLSavePreset", onSavePreset, comboBox);
+ childSetAction("WLDeletePreset", onDeletePreset, comboBox);
+ comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, _1));
// Dome
- getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr->mWLGamma));
- getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterWindLight::onStarAlphaMoved, this, _1));
+ childSetCommitCallback("WLGamma", onFloatControlMoved, &param_mgr->mWLGamma);
+ childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL);
}
bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response)
{
+ llassert(sWindLight);
std::string text = response["message"].asString();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLWLParamKey newKey(text, LLEnvKey::SCOPE_LOCAL);
+ S32 option = LLNotification::getSelectedOption(notification, response);
if(text == "")
{
@@ -212,26 +227,26 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD&
}
if(option == 0) {
- LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo");
+ LLComboBox* comboBox = sWindLight->getChild<LLComboBox>(
+ "WLPresetsCombo");
- LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle");
+ LLFloaterDayCycle* sDayCycle = NULL;
LLComboBox* keyCombo = NULL;
- if(day_cycle)
+ if(LLFloaterDayCycle::isOpen())
{
- keyCombo = day_cycle->getChild<LLComboBox>("WLKeyPresets");
+ sDayCycle = LLFloaterDayCycle::instance();
+ keyCombo = sDayCycle->getChild<LLComboBox>(
+ "WLKeyPresets");
}
// add the current parameters to the list
// see if it's there first
- std::map<std::string, LLWLParamSet>::iterator mIt =
- LLWLParamManager::instance()->mParamList.find(text);
-
// if not there, add a new one
- if(mIt == LLWLParamManager::instance()->mParamList.end())
+ if (!LLWLParamManager::instance().hasParamSet(newKey))
{
- LLWLParamManager::instance()->addParamSet(text,
- LLWLParamManager::instance()->mCurParams);
- comboBox->add(text);
+ LLWLParamManager::getInstance()->addParamSet(newKey,
+ LLWLParamManager::getInstance()->mCurParams);
+ comboBox->add(newKey.toString(), newKey.toLLSD());
comboBox->sortByName();
// add a blank to the bottom
@@ -243,18 +258,18 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD&
comboBox->add(LLStringUtil::null);
comboBox->setSelectedByValue(text, true);
- if(keyCombo)
+ if(LLFloaterDayCycle::isOpen())
{
keyCombo->add(text);
keyCombo->sortByName();
}
- LLWLParamManager::instance()->savePreset(text);
+ LLWLParamManager::getInstance()->savePreset(newKey);
// otherwise, send a message to the user
}
else
{
- LLNotificationsUtil::add("ExistsSkyPresetAlert");
+ LLNotifications::instance().add("ExistsSkyPresetAlert", LLSD(), LLSD());
}
}
return false;
@@ -264,38 +279,38 @@ void LLFloaterWindLight::syncMenu()
{
bool err;
- LLWLParamManager * param_mgr = LLWLParamManager::instance();
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
LLWLParamSet& currentParams = param_mgr->mCurParams;
//std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues;
// blue horizon
param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err);
- getChild<LLUICtrl>("WLBlueHorizonR")->setValue(param_mgr->mBlueHorizon.r / 2.0);
- getChild<LLUICtrl>("WLBlueHorizonG")->setValue(param_mgr->mBlueHorizon.g / 2.0);
- getChild<LLUICtrl>("WLBlueHorizonB")->setValue(param_mgr->mBlueHorizon.b / 2.0);
- getChild<LLUICtrl>("WLBlueHorizonI")->setValue(
+ childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0);
+ childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0);
+ childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0);
+ childSetValue("WLBlueHorizonI",
std::max(param_mgr->mBlueHorizon.r / 2.0,
std::max(param_mgr->mBlueHorizon.g / 2.0,
param_mgr->mBlueHorizon.b / 2.0)));
// haze density, horizon, mult, and altitude
param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err);
- getChild<LLUICtrl>("WLHazeDensity")->setValue(param_mgr->mHazeDensity.r);
+ childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r);
param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err);
- getChild<LLUICtrl>("WLHazeHorizon")->setValue(param_mgr->mHazeHorizon.r);
+ childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r);
param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err);
- getChild<LLUICtrl>("WLDensityMult")->setValue(param_mgr->mDensityMult.x *
+ childSetValue("WLDensityMult", param_mgr->mDensityMult.x *
param_mgr->mDensityMult.mult);
param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err);
- getChild<LLUICtrl>("WLMaxAltitude")->setValue(param_mgr->mMaxAlt.x);
+ childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x);
// blue density
param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err);
- getChild<LLUICtrl>("WLBlueDensityR")->setValue(param_mgr->mBlueDensity.r / 2.0);
- getChild<LLUICtrl>("WLBlueDensityG")->setValue(param_mgr->mBlueDensity.g / 2.0);
- getChild<LLUICtrl>("WLBlueDensityB")->setValue(param_mgr->mBlueDensity.b / 2.0);
- getChild<LLUICtrl>("WLBlueDensityI")->setValue(
+ childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0);
+ childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0);
+ childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0);
+ childSetValue("WLBlueDensityI",
std::max(param_mgr->mBlueDensity.r / 2.0,
std::max(param_mgr->mBlueDensity.g / 2.0, param_mgr->mBlueDensity.b / 2.0)));
@@ -303,107 +318,160 @@ void LLFloaterWindLight::syncMenu()
// sunlight
param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err);
- getChild<LLUICtrl>("WLSunlightR")->setValue(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLSunlightG")->setValue(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLSunlightB")->setValue(param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLSunlightI")->setValue(
+ childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLSunlightI",
std::max(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE,
std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE)));
// glow
param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err);
- getChild<LLUICtrl>("WLGlowR")->setValue(2 - param_mgr->mGlow.r / 20.0f);
- getChild<LLUICtrl>("WLGlowB")->setValue(-param_mgr->mGlow.b / 5.0f);
+ childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f);
+ childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f);
// ambient
param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err);
- getChild<LLUICtrl>("WLAmbientR")->setValue(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLAmbientG")->setValue(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLAmbientB")->setValue(param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE);
- getChild<LLUICtrl>("WLAmbientI")->setValue(
+ childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE);
+ childSetValue("WLAmbientI",
std::max(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE,
std::max(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE)));
- getChild<LLUICtrl>("WLSunAngle")->setValue(param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI);
- getChild<LLUICtrl>("WLEastAngle")->setValue(param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI);
+ childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI);
+ childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI);
// Clouds
// Cloud Color
param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err);
- getChild<LLUICtrl>("WLCloudColorR")->setValue(param_mgr->mCloudColor.r);
- getChild<LLUICtrl>("WLCloudColorG")->setValue(param_mgr->mCloudColor.g);
- getChild<LLUICtrl>("WLCloudColorB")->setValue(param_mgr->mCloudColor.b);
- getChild<LLUICtrl>("WLCloudColorI")->setValue(
+ childSetValue("WLCloudColorR", param_mgr->mCloudColor.r);
+ childSetValue("WLCloudColorG", param_mgr->mCloudColor.g);
+ childSetValue("WLCloudColorB", param_mgr->mCloudColor.b);
+ childSetValue("WLCloudColorI",
std::max(param_mgr->mCloudColor.r,
std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b)));
// Cloud
param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err);
- getChild<LLUICtrl>("WLCloudX")->setValue(param_mgr->mCloudMain.r);
- getChild<LLUICtrl>("WLCloudY")->setValue(param_mgr->mCloudMain.g);
- getChild<LLUICtrl>("WLCloudDensity")->setValue(param_mgr->mCloudMain.b);
+ childSetValue("WLCloudX", param_mgr->mCloudMain.r);
+ childSetValue("WLCloudY", param_mgr->mCloudMain.g);
+ childSetValue("WLCloudDensity", param_mgr->mCloudMain.b);
// Cloud Detail
param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err);
- getChild<LLUICtrl>("WLCloudDetailX")->setValue(param_mgr->mCloudDetail.r);
- getChild<LLUICtrl>("WLCloudDetailY")->setValue(param_mgr->mCloudDetail.g);
- getChild<LLUICtrl>("WLCloudDetailDensity")->setValue(param_mgr->mCloudDetail.b);
+ childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r);
+ childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g);
+ childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
// Cloud extras
param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err);
param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err);
- getChild<LLUICtrl>("WLCloudCoverage")->setValue(param_mgr->mCloudCoverage.x);
- getChild<LLUICtrl>("WLCloudScale")->setValue(param_mgr->mCloudScale.x);
+ childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x);
+ childSetValue("WLCloudScale", param_mgr->mCloudScale.x);
// cloud scrolling
bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX();
bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY();
- getChild<LLUICtrl>("WLCloudLockX")->setValue(lockX);
- getChild<LLUICtrl>("WLCloudLockY")->setValue(lockY);
- getChild<LLUICtrl>("DrawClassicClouds")->setValue(gSavedSettings.getBOOL("SkyUseClassicClouds"));
+ childSetValue("WLCloudLockX", lockX);
+ childSetValue("WLCloudLockY", lockY);
// disable if locked, enable if not
if(lockX)
{
- getChildView("WLCloudScrollX")->setEnabled(FALSE);
+ childDisable("WLCloudScrollX");
} else {
- getChildView("WLCloudScrollX")->setEnabled(TRUE);
+ childEnable("WLCloudScrollX");
}
if(lockY)
{
- getChildView("WLCloudScrollY")->setEnabled(FALSE);
+ childDisable("WLCloudScrollY");
} else {
- getChildView("WLCloudScrollY")->setEnabled(TRUE);
+ childEnable("WLCloudScrollY");
}
// *HACK cloud scrolling is off my an additive of 10
- getChild<LLUICtrl>("WLCloudScrollX")->setValue(param_mgr->mCurParams.getCloudScrollX() - 10.0f);
- getChild<LLUICtrl>("WLCloudScrollY")->setValue(param_mgr->mCurParams.getCloudScrollY() - 10.0f);
+ childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
+ childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err);
- getChild<LLUICtrl>("WLDistanceMult")->setValue(param_mgr->mDistanceMult.x);
+ childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x);
// Tweak extras
param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err);
- getChild<LLUICtrl>("WLGamma")->setValue(param_mgr->mWLGamma.x);
+ childSetValue("WLGamma", param_mgr->mWLGamma.x);
- getChild<LLUICtrl>("WLStarAlpha")->setValue(param_mgr->mCurParams.getStarBrightness());
+ childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
+}
- LLTabContainer* tab = getChild<LLTabContainer>("WindLight Tabs");
- LLPanel* panel = getChild<LLPanel>("Scattering");
- tab->enableTabButton(tab->getIndexForPanel(panel), gSavedSettings.getBOOL("RenderDeferredGI"));
+// static
+LLFloaterWindLight* LLFloaterWindLight::instance()
+{
+ if (!sWindLight)
+ {
+ lldebugs << "Creating WL floater" << llendl;
+ sWindLight = LLFloaterReg::getTypedInstance<LLFloaterWindLight>("env_windlight");
+ llassert(sWindLight);
+ }
+ return sWindLight;
+}
+
+// static
+void LLFloaterWindLight::show(LLEnvKey::EScope scope)
+{
+ LLFloaterWindLight* windLight = instance();
+ if(scope != sScope && ((LLView*)windLight)->getVisible())
+ {
+ LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD());
+ return;
+ }
+ sScope = scope;
+ std::string scope_str = "";
+ switch(sScope)
+ {
+ case LLEnvKey::SCOPE_LOCAL:
+ scope_str = LLTrans::getString("LocalSettings");
+ break;
+ case LLEnvKey::SCOPE_REGION:
+ scope_str = LLTrans::getString("RegionSettings");
+ break;
+ }
+ std::string title = sOriginalTitle + " (" + scope_str + ")";
+ windLight->setTitle(title);
+ windLight->syncMenu();
+
+ LLEnvManager::instance().startEditingScope(scope);
+
+ // comment in if you want the menu to rebuild each time
+ //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml");
+ //windLight->initCallbacks();
+
+ windLight->openFloater();
}
+bool LLFloaterWindLight::isOpen()
+{
+ return LLFloater::isShown(sWindLight);
+}
+
+// virtual
+void LLFloaterWindLight::onClose(bool app_quitting)
+{
+ lldebugs << "Destroying WL floater" << llendl;
+ sWindLight = NULL;
+}
// color control callbacks
-void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
colorControl->r = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
@@ -421,24 +489,26 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* co
name.append("I");
if(colorControl->isSunOrAmbientColor) {
- getChild<LLUICtrl>(name)->setValue(colorControl->r / 3);
+ sWindLight->childSetValue(name, colorControl->r / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
- getChild<LLUICtrl>(name)->setValue(colorControl->r / 2);
+ sWindLight->childSetValue(name, colorControl->r / 2);
} else {
- getChild<LLUICtrl>(name)->setValue(colorControl->r);
+ sWindLight->childSetValue(name, colorControl->r);
}
}
- colorControl->update(LLWLParamManager::instance()->mCurParams);
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ LLWLParamManager::getInstance()->propagateParameters();
}
-void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
colorControl->g = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
@@ -456,24 +526,25 @@ void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* co
name.append("I");
if(colorControl->isSunOrAmbientColor) {
- getChild<LLUICtrl>(name)->setValue(colorControl->g / 3);
+ sWindLight->childSetValue(name, colorControl->g / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
- getChild<LLUICtrl>(name)->setValue(colorControl->g / 2);
+ sWindLight->childSetValue(name, colorControl->g / 2);
} else {
- getChild<LLUICtrl>(name)->setValue(colorControl->g);
+ sWindLight->childSetValue(name, colorControl->g);
}
}
- colorControl->update(LLWLParamManager::instance()->mCurParams);
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ LLWLParamManager::getInstance()->propagateParameters();
}
-void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
colorControl->b = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
@@ -491,24 +562,26 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* co
name.append("I");
if(colorControl->isSunOrAmbientColor) {
- getChild<LLUICtrl>(name)->setValue(colorControl->b / 3);
+ sWindLight->childSetValue(name, colorControl->b / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
- getChild<LLUICtrl>(name)->setValue(colorControl->b / 2);
+ sWindLight->childSetValue(name, colorControl->b / 2);
} else {
- getChild<LLUICtrl>(name)->setValue(colorControl->b);
+ sWindLight->childSetValue(name, colorControl->b);
}
}
- colorControl->update(LLWLParamManager::instance()->mCurParams);
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ LLWLParamManager::getInstance()->propagateParameters();
}
-void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
colorControl->i = sldrCtrl->getValueF32();
@@ -565,84 +638,101 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* co
// divide sun color vals by three
if(colorControl->isSunOrAmbientColor)
{
- getChild<LLUICtrl>(rName)->setValue(colorControl->r/3);
- getChild<LLUICtrl>(gName)->setValue(colorControl->g/3);
- getChild<LLUICtrl>(bName)->setValue(colorControl->b/3);
+ sWindLight->childSetValue(rName, colorControl->r/3);
+ sWindLight->childSetValue(gName, colorControl->g/3);
+ sWindLight->childSetValue(bName, colorControl->b/3);
}
else if(colorControl->isBlueHorizonOrDensity)
{
- getChild<LLUICtrl>(rName)->setValue(colorControl->r/2);
- getChild<LLUICtrl>(gName)->setValue(colorControl->g/2);
- getChild<LLUICtrl>(bName)->setValue(colorControl->b/2);
+ sWindLight->childSetValue(rName, colorControl->r/2);
+ sWindLight->childSetValue(gName, colorControl->g/2);
+ sWindLight->childSetValue(bName, colorControl->b/2);
}
else
{
// set the sliders to the new vals
- getChild<LLUICtrl>(rName)->setValue(colorControl->r);
- getChild<LLUICtrl>(gName)->setValue(colorControl->g);
- getChild<LLUICtrl>(bName)->setValue(colorControl->b);
+ sWindLight->childSetValue(rName, colorControl->r);
+ sWindLight->childSetValue(gName, colorControl->g);
+ sWindLight->childSetValue(bName, colorControl->b);
}
}
// now update the current parameters and send them to shaders
- colorControl->update(LLWLParamManager::instance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
}
/// GLOW SPECIFIC CODE
-void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
// scaled by 20
colorControl->r = (2 - sldrCtrl->getValueF32()) * 20;
- colorControl->update(LLWLParamManager::instance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
}
/// \NOTE that we want NEGATIVE (-) B
-void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
/// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
colorControl->b = -sldrCtrl->getValueF32() * 5;
- colorControl->update(LLWLParamManager::instance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ colorControl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
}
-void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl)
+void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLFloatControl * floatControl = static_cast<WLFloatControl *>(userData);
floatControl->x = sldrCtrl->getValueF32() / floatControl->mult;
- floatControl->update(LLWLParamManager::instance()->mCurParams);
- LLWLParamManager::instance()->propagateParameters();
+ floatControl->update(LLWLParamManager::getInstance()->mCurParams);
+ LLWLParamManager::getInstance()->propagateParameters();
}
+void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData)
+{
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
+
+ bool value = cbCtrl->get();
+ (*(static_cast<BOOL *>(userData))) = value;
+}
+
+
// Lighting callbacks
// time of day
-void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, WLColorControl* colorControl)
+void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
- LLSliderCtrl* sunSldr = getChild<LLSliderCtrl>("WLSunAngle");
- LLSliderCtrl* eastSldr = getChild<LLSliderCtrl>("WLEastAngle");
+ LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle");
+ LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle");
+ WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
+
// get the two angles
- LLWLParamManager * param_mgr = LLWLParamManager::instance();
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
param_mgr->mCurParams.setSunAngle(F_TWO_PI * sunSldr->getValueF32());
param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32());
@@ -659,24 +749,36 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, WLColorControl* colorControl
param_mgr->propagateParameters();
}
-void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl)
+void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ F32 * tweak = static_cast<F32 *>(userData);
- LLWLParamManager::instance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32());
+ (*tweak) = sldrCtrl->getValueF32();
+ LLWLParamManager::getInstance()->propagateParameters();
}
-void LLFloaterWindLight::onNewPreset()
+void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData)
{
- LLNotificationsUtil::add("NewSkyPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::newPromptCallback, this, _1, _2));
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
+
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+
+ LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32());
}
-void LLFloaterWindLight::onSavePreset()
+void LLFloaterWindLight::onNewPreset(void* userData)
{
+ LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback);
+}
+
+void LLFloaterWindLight::onSavePreset(void* userData)
+{
+ llassert(sWindLight);
// get the name
- LLComboBox* comboBox = getChild<LLComboBox>(
+ LLComboBox* comboBox = sWindLight->getChild<LLComboBox>(
"WLPresetsCombo");
// don't save the empty name
@@ -685,91 +787,113 @@ void LLFloaterWindLight::onSavePreset()
return;
}
+ // If region scope, save immediately.
+ // We don't actually save to file in this case, but just update the preset
+ // so that the changes can be uploaded to server.
+ LLWLParamKey key(comboBox->getSelectedValue());
+ if (key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ // *TODO: Eliminate code duplication.
+ LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl;
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
+ param_mgr->mCurParams.mName = key.name;
+ param_mgr->setParamSet(key, param_mgr->mCurParams);
+ return;
+ }
+
// check to see if it's a default and shouldn't be overwritten
- std::set<std::string>::iterator sIt = sDefaultPresets.find(
- comboBox->getSelectedItemLabel());
+ std::set<LLWLParamKey>::iterator sIt = sDefaultPresets.find(LLWLParamKey(key));
if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets"))
{
- LLNotificationsUtil::add("WLNoEditDefault");
+ LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD());
return;
}
- LLWLParamManager::instance()->mCurParams.mName =
+ LLWLParamManager::getInstance()->mCurParams.mName =
comboBox->getSelectedItemLabel();
- LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::saveAlertCallback, this, _1, _2));
+ LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback);
}
bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotification::getSelectedOption(notification, response);
// if they choose save, do it. Otherwise, don't do anything
if(option == 0)
{
- LLWLParamManager * param_mgr = LLWLParamManager::instance();
+ LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
- param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams);
+ // we should only "save" local presets; those with other scopes should be "save as"
+ LLWLParamKey key(param_mgr->mCurParams.mName, LLEnvKey::SCOPE_LOCAL);
+
+ param_mgr->setParamSet(key, param_mgr->mCurParams);
// comment this back in to save to file
- param_mgr->savePreset(param_mgr->mCurParams.mName);
+ param_mgr->savePreset(key);
}
return false;
}
-void LLFloaterWindLight::onDeletePreset()
+void LLFloaterWindLight::onDeletePreset(void* userData)
{
- LLComboBox* combo_box = getChild<LLComboBox>(
+ llassert(sWindLight);
+ LLComboBox* combo_box = sWindLight->getChild<LLComboBox>(
"WLPresetsCombo");
- if(combo_box->getSelectedValue().asString() == "")
+ if(combo_box->getSelectedValue().isUndefined())
{
return;
}
LLSD args;
- args["SKY"] = combo_box->getSelectedValue().asString();
- LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(),
- boost::bind(&LLFloaterWindLight::deleteAlertCallback, this, _1, _2));
+ args["SKY"] = combo_box->getSelectedValue()[0].asString();
+ LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(),
+ boost::bind(&LLFloaterWindLight::deleteAlertCallback, sWindLight, _1, _2));
}
bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotification::getSelectedOption(notification, response);
// if they choose delete, do it. Otherwise, don't do anything
if(option == 0)
{
- LLComboBox* combo_box = getChild<LLComboBox>("WLPresetsCombo");
- LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle");
+ LLComboBox* combo_box = getChild<LLComboBox>(
+ "WLPresetsCombo");
+ LLFloaterDayCycle* day_cycle = NULL;
LLComboBox* key_combo = NULL;
+ LLMultiSliderCtrl* mult_sldr = NULL;
- if (day_cycle)
+ if(LLFloaterDayCycle::isOpen())
{
- key_combo = day_cycle->getChild<LLComboBox>("WLKeyPresets");
+ day_cycle = LLFloaterDayCycle::instance();
+ key_combo = day_cycle->getChild<LLComboBox>(
+ "WLKeyPresets");
+ mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
}
- std::string name(combo_box->getSelectedValue().asString());
+ LLWLParamKey key(combo_box->getSelectedValue());
// check to see if it's a default and shouldn't be deleted
- std::set<std::string>::iterator sIt = sDefaultPresets.find(name);
+ std::set<LLWLParamKey>::iterator sIt = sDefaultPresets.find(key);
if(sIt != sDefaultPresets.end())
{
- LLNotificationsUtil::add("WLNoEditDefault");
+ LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD());
return false;
}
- LLWLParamManager::instance()->removeParamSet(name, true);
+ LLWLParamManager::getInstance()->removeParamSet(key, true);
// remove and choose another
S32 new_index = combo_box->getCurrentIndex();
- combo_box->remove(name);
+ combo_box->remove(key.toString());
if(key_combo != NULL)
{
- key_combo->remove(name);
+ key_combo->remove(key.toString());
// remove from slider, as well
- day_cycle->deletePreset(name);
+ day_cycle->deletePreset(key);
}
// pick the previously selected index after delete
@@ -789,51 +913,60 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS
void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
- std::string data = ctrl->getValue().asString();
- if(!data.empty())
+ LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
+
+ if(combo_box->getSimple() == "")
{
- LLWLParamManager::instance()->loadPreset( data);
- syncMenu();
+ return;
}
+
+#if 0
+ LLWLParamManager::getInstance()->loadPreset(LLWLParamKey(combo_box->getSelectedValue()));
+#else
+ LLEnvManagerNew::instance().setUseSkyPreset(LLWLParamKey(combo_box->getSelectedValue()).name);
+#endif
+ sWindLight->syncMenu();
}
-void LLFloaterWindLight::onOpenDayCycle()
+void LLFloaterWindLight::onOpenDayCycle(void* userData)
{
- LLFloaterReg::showInstance("env_day_cycle");
+ LLFloaterDayCycle::show(sScope);
}
// Clouds
-void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl)
+void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
- LLWLParamManager::instance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f);
+ LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f);
}
-void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl)
+void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
- LLWLParamManager::instance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f);
+ LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f);
}
-void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl)
+void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
bool lock = cbCtrl->get();
- LLWLParamManager::instance()->mCurParams.setEnableCloudScrollX(!lock);
+ LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock);
- LLSliderCtrl* sldr = getChild<LLSliderCtrl>(
+ LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>(
"WLCloudScrollX");
if(cbCtrl->get())
@@ -847,15 +980,16 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl)
}
-void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl)
+void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData)
{
- deactivateAnimator();
+ llassert(sWindLight);
+ LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
bool lock = cbCtrl->get();
- LLWLParamManager::instance()->mCurParams.setEnableCloudScrollY(!lock);
+ LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
- LLSliderCtrl* sldr = getChild<LLSliderCtrl>(
+ LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>(
"WLCloudScrollY");
if(cbCtrl->get())
@@ -867,9 +1001,3 @@ void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl)
sldr->setEnabled(true);
}
}
-
-void LLFloaterWindLight::deactivateAnimator()
-{
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-}
diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h
index b43edc2c11..c2607816e5 100644
--- a/indra/newview/llfloaterwindlight.h
+++ b/indra/newview/llfloaterwindlight.h
@@ -35,77 +35,96 @@
#include <vector>
#include "llwlparamset.h"
+#include "llwlparammanager.h"
struct WLColorControl;
struct WLFloatControl;
-
/// Menuing system for all of windlight's functionality
class LLFloaterWindLight : public LLFloater
{
+ LOG_CLASS(LLFloaterWindLight);
public:
-
- LLFloaterWindLight(const LLSD& key);
+ LLFloaterWindLight(const LLSD &key);
virtual ~LLFloaterWindLight();
- /*virtual*/ BOOL postBuild();
+ BOOL postBuild();
+
/// initialize all
void initCallbacks(void);
- bool newPromptCallback(const LLSD& notification, const LLSD& response);
+ /// one and one instance only
+ static LLFloaterWindLight* instance();
+
+ static bool newPromptCallback(const LLSD& notification, const LLSD& response);
/// general purpose callbacks for dealing with color controllers
- void onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* userData);
- void onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* userData);
- void onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* userData);
- void onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* userData);
- void onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* userData);
+ static void onColorControlRMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlGMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlBMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlIMoved(LLUICtrl* ctrl, void* userData);
+ static void onFloatControlMoved(LLUICtrl* ctrl, void* userData);
+ static void onBoolToggle(LLUICtrl* ctrl, void* userData);
/// lighting callbacks for glow
- void onGlowRMoved(LLUICtrl* ctrl, WLColorControl* userData);
+ static void onGlowRMoved(LLUICtrl* ctrl, void* userData);
//static void onGlowGMoved(LLUICtrl* ctrl, void* userData);
- void onGlowBMoved(LLUICtrl* ctrl, WLColorControl* userData);
+ static void onGlowBMoved(LLUICtrl* ctrl, void* userData);
/// lighting callbacks for sun
- void onSunMoved(LLUICtrl* ctrl, WLColorControl* userData);
+ static void onSunMoved(LLUICtrl* ctrl, void* userData);
+
+ /// handle if float is changed
+ static void onFloatTweakMoved(LLUICtrl* ctrl, void* userData);
/// for handling when the star slider is moved to adjust the alpha
- void onStarAlphaMoved(LLUICtrl* ctrl);
+ static void onStarAlphaMoved(LLUICtrl* ctrl, void* userData);
/// when user hits the load preset button
- void onNewPreset();
+ static void onNewPreset(void* userData);
/// when user hits the save preset button
- void onSavePreset();
+ static void onSavePreset(void* userData);
/// prompts a user when overwriting a preset
- bool saveAlertCallback(const LLSD& notification, const LLSD& response);
+ static bool saveAlertCallback(const LLSD& notification, const LLSD& response);
/// when user hits the save preset button
- void onDeletePreset();
+ static void onDeletePreset(void* userData);
/// prompts a user when overwriting a preset
bool deleteAlertCallback(const LLSD& notification, const LLSD& response);
/// what to do when you change the preset name
- void onChangePresetName(LLUICtrl* ctrl);
+ static void onChangePresetName(LLUICtrl* ctrl);
/// when user hits the save preset button
- void onOpenDayCycle();
+ static void onOpenDayCycle(void* userData);
/// handle cloud scrolling
- void onCloudScrollXMoved(LLUICtrl* ctrl);
- void onCloudScrollYMoved(LLUICtrl* ctrl);
- void onCloudScrollXToggled(LLUICtrl* ctrl);
- void onCloudScrollYToggled(LLUICtrl* ctrl);
+ static void onCloudScrollXMoved(LLUICtrl* ctrl, void* userData);
+ static void onCloudScrollYMoved(LLUICtrl* ctrl, void* userData);
+ static void onCloudScrollXToggled(LLUICtrl* ctrl, void* userData);
+ static void onCloudScrollYToggled(LLUICtrl* ctrl, void* userData);
+
+ //// menu management
+
+ /// show off our menu
+ static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL);
+
+ /// return if the menu exists or not
+ static bool isOpen();
+
+ /// stuff to do on exit
+ virtual void onClose(bool app_quitting);
/// sync up sliders with parameters
void syncMenu();
- /// turn off animated skies
- static void deactivateAnimator();
-
private:
- static std::set<std::string> sDefaultPresets;
+ static LLFloaterWindLight* sWindLight; // one instance on the inside
+ static std::set<LLWLParamKey> sDefaultPresets;
+ static LLEnvKey::EScope sScope;
+ static std::string sOriginalTitle;
};
diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp
new file mode 100644
index 0000000000..a74fb81355
--- /dev/null
+++ b/indra/newview/llregioninfomodel.cpp
@@ -0,0 +1,106 @@
+/**
+ * @file llregioninfomodel.cpp
+ * @brief Region info model
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llregioninfomodel.h"
+
+// libs
+#include "message.h"
+
+// viewers
+
+void LLRegionInfoModel::reset()
+{
+ mSimAccess = 0;
+ mAgentLimit = 0;
+
+ mRegionFlags = 0;
+ mEstateID = 0;
+ mParentEstateID = 0;
+
+ mPricePerMeter = 0;
+ mRedirectGridX = 0;
+ mRedirectGridY = 0;
+
+ mBillableFactor = 0.0f;
+ mObjectBonusFactor = 0.0f;
+ mWaterHeight = 0.0f;
+ mTerrainRaiseLimit = 0.0f;
+ mTerrainLowerLimit = 0.0f;
+ mSunHour = 0.0f;
+
+ mUseEstateSun = false;
+
+ mSimType.clear();
+ mSimName.clear();
+}
+
+LLRegionInfoModel::LLRegionInfoModel()
+{
+ reset();
+}
+
+boost::signals2::connection LLRegionInfoModel::setUpdateCallback(const update_signal_t::slot_type& cb)
+{
+ return mUpdateSignal.connect(cb);
+}
+
+void LLRegionInfoModel::update(LLMessageSystem* msg)
+{
+ reset();
+
+ msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, mBillableFactor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, mWaterHeight);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, mTerrainRaiseLimit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, mTerrainLowerLimit);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, mPricePerMeter);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, mRedirectGridX);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, mRedirectGridY);
+
+ msg->getBOOL(_PREHASH_RegionInfo, _PREHASH_UseEstateSun, mUseEstateSun);
+
+ // actually the "last set" sun hour, not the current sun hour. JC
+ msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour);
+
+ // the only reasonable way to decide if we actually have any data is to
+ // check to see if any of these fields have nonzero sizes
+ if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 ||
+ msg->getSize(_PREHASH_RegionInfo2, "ProductName") > 0)
+ {
+ msg->getString(_PREHASH_RegionInfo2, "ProductName", mSimType);
+ }
+
+ // Let interested parties know that region info has been updated.
+ mUpdateSignal();
+}
diff --git a/indra/newview/llregioninfomodel.h b/indra/newview/llregioninfomodel.h
new file mode 100644
index 0000000000..87e1b35ff8
--- /dev/null
+++ b/indra/newview/llregioninfomodel.h
@@ -0,0 +1,82 @@
+/**
+ * @file llregioninfomodel.h
+ * @brief Region info model
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLREGIONINFOMODEL_H
+#define LL_LLREGIONINFOMODEL_H
+
+class LLMessageSystem;
+
+#include "llsingleton.h"
+
+/**
+ * Contains region info, notifies interested parties of its changes.
+ */
+class LLRegionInfoModel : public LLSingleton<LLRegionInfoModel>
+{
+ LOG_CLASS(LLRegionInfoModel);
+
+public:
+ typedef boost::signals2::signal<void()> update_signal_t;
+ boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb);
+
+ // *TODO: Add getters and make the data private.
+ U8 mSimAccess;
+ U8 mAgentLimit;
+
+ U32 mRegionFlags;
+ U32 mEstateID;
+ U32 mParentEstateID;
+
+ S32 mPricePerMeter;
+ S32 mRedirectGridX;
+ S32 mRedirectGridY;
+
+ F32 mBillableFactor;
+ F32 mObjectBonusFactor;
+ F32 mWaterHeight;
+ F32 mTerrainRaiseLimit;
+ F32 mTerrainLowerLimit;
+ F32 mSunHour;
+
+ BOOL mUseEstateSun;
+
+ std::string mSimName;
+ std::string mSimType;
+
+protected:
+ friend class LLSingleton<LLRegionInfoModel>;
+ friend class LLViewerRegion;
+
+ LLRegionInfoModel();
+ void update(LLMessageSystem* msg);
+
+private:
+ void reset();
+
+ update_signal_t mUpdateSignal;
+};
+
+#endif // LL_LLREGIONINFOMODEL_H
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index a5b91729e8..f99afa923b 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2785,7 +2785,7 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
gGL.color4f(0,1,1,1);
break;
case LLViewerObject::LL_VO_CLOUDS:
- gGL.color4f(0.5f,0.5f,0.5f,1.0f);
+ // no longer used
break;
case LLViewerObject::LL_VO_PART_GROUP:
case LLViewerObject::LL_VO_HUD_PART_GROUP:
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index db8a0c2992..54d5d36f6e 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -664,13 +664,6 @@ public:
LLGrassPartition();
};
-//spatial partition for clouds (implemented in LLVOClouds.cpp)
-class LLCloudPartition : public LLParticlePartition
-{
-public:
- LLCloudPartition();
-};
-
//class for wrangling geometry out of volumes (implemented in LLVOVolume.cpp)
class LLVolumeGeometryManager: public LLGeometryManager
{
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 86b09473ab..3c2ef37bb8 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -163,7 +163,6 @@
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
-#include "llvoclouds.h"
#include "llweb.h"
#include "llworld.h"
#include "llworldmapmessage.h"
@@ -1171,8 +1170,6 @@ bool idle_startup()
// init the shader managers
LLPostProcess::initClass();
- LLWLParamManager::initClass();
- LLWaterParamManager::initClass();
LLViewerObject::initVOClasses();
@@ -3150,11 +3147,6 @@ bool process_login_success_response()
gMoonTextureID = id;
}
- id = global_textures["cloud_texture_id"];
- if(id.notNull())
- {
- gCloudTextureID = id;
- }
}
// Set the location of the snapshot sharing config endpoint
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 1023a4339b..5b76537804 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -1093,7 +1093,7 @@ public:
BOOL LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask)
{
- getWindow()->setCursor(UI_CURSOR_HAND);
+ getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW);
return TRUE;
}
@@ -1102,7 +1102,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLUICtrl::handleMouseDown( x, y , mask );
- if( !handled )
+ if (!handled && mBorder->parentPointInView(x, y))
{
showPicker(FALSE);
//grab textures first...
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f725f0fe86..911fc8e1ed 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -178,8 +178,8 @@ void display_update_camera()
gViewerWindow->setup3DRender();
// update all the sky/atmospheric/water settings
- LLWLParamManager::instance()->update(LLViewerCamera::getInstance());
- LLWaterParamManager::instance()->update(LLViewerCamera::getInstance());
+ LLWLParamManager::getInstance()->update(LLViewerCamera::getInstance());
+ LLWaterParamManager::getInstance()->update(LLViewerCamera::getInstance());
// Update land visibility too
LLWorld::getInstance()->setLandFarClip(final_far);
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index a1c2c926af..670b35aa71 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -49,7 +49,12 @@
#include "llfloaterbump.h"
#include "llfloatercamera.h"
#include "llfloaterdaycycle.h"
+#include "llfloaterdeleteenvpreset.h"
#include "llfloaterdisplayname.h"
+#include "llfloatereditdaycycle.h"
+#include "llfloatereditsky.h"
+#include "llfloatereditwater.h"
+#include "llfloaterenvironmentsettings.h"
#include "llfloaterevent.h"
#include "llfloatersearch.h"
#include "llfloaterenvsettings.h"
@@ -181,9 +186,14 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("env_day_cycle", "floater_day_cycle_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDayCycle>);
LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostProcess>);
- LLFloaterReg::add("env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvSettings>);
+ LLFloaterReg::add("old_env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvSettings>);
+ LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvironmentSettings>);
LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWater>);
LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWindLight>);
+ LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteEnvPreset>);
+ LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditSky>);
+ LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditWater>);
+ LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditDayCycle>);
LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 41d8b57f36..e8c91cd0f0 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -45,6 +45,7 @@
#include "llcompilequeue.h"
#include "llconsole.h"
#include "lldebugview.h"
+#include "llenvmanager.h"
#include "llfilepicker.h"
#include "llfirstuse.h"
#include "llfloaterbuy.h"
@@ -7584,72 +7585,92 @@ class LLWorldEnvSettings : public view_listener_t
std::string tod = userdata.asString();
LLVector3 sun_direction;
- if (tod == "editor")
+ if (tod == "old_editor")
{
// if not there or is hidden, show it
+ // *TODO replace with LLFloaterWindLight::show(LLEnvKey::SCOPE_LOCAL) to make sure we're using the right scope?
+ LLFloaterReg::toggleInstance("old_env_settings");
+ return true;
+ }
+
+ if (tod == "editor")
+ {
LLFloaterReg::toggleInstance("env_settings");
return true;
}
-
+
if (tod == "sunrise")
{
- // set the value, turn off animation
- LLWLParamManager::instance()->mAnimator.setDayTime(0.25);
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-
- // then call update once
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLEnvManagerNew::instance().setUseSkyPreset("Sunrise");
}
else if (tod == "noon")
{
- // set the value, turn off animation
- LLWLParamManager::instance()->mAnimator.setDayTime(0.567);
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-
- // then call update once
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLEnvManagerNew::instance().setUseSkyPreset("Midday");
}
else if (tod == "sunset")
{
- // set the value, turn off animation
- LLWLParamManager::instance()->mAnimator.setDayTime(0.75);
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-
- // then call update once
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLEnvManagerNew::instance().setUseSkyPreset("Sunset");
}
else if (tod == "midnight")
{
- // set the value, turn off animation
- LLWLParamManager::instance()->mAnimator.setDayTime(0.0);
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
-
- // then call update once
- LLWLParamManager::instance()->mAnimator.update(
- LLWLParamManager::instance()->mCurParams);
+ LLEnvManagerNew::instance().setUseSkyPreset("Midnight");
}
else
{
- LLWLParamManager::instance()->mAnimator.mIsRunning = true;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
+ LLEnvManagerNew::instance().setUseDayCycle(LLEnvManagerNew::instance().getDayCycleName());
}
+
return true;
}
};
-/// Water Menu callbacks
-class LLWorldWaterSettings : public view_listener_t
-{
+class LLWorldEnvPreset : public view_listener_t
+{
bool handleEvent(const LLSD& userdata)
{
- LLFloaterReg::toggleInstance("env_water");
+ std::string item = userdata.asString();
+
+ if (item == "new_water")
+ {
+ LLFloaterReg::showInstance("env_edit_water", "new");
+ }
+ else if (item == "edit_water")
+ {
+ LLFloaterReg::showInstance("env_edit_water", "edit");
+ }
+ else if (item == "delete_water")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "water");
+ }
+ else if (item == "new_sky")
+ {
+ LLFloaterReg::showInstance("env_edit_sky", "new");
+ }
+ else if (item == "edit_sky")
+ {
+ LLFloaterReg::showInstance("env_edit_sky", "edit");
+ }
+ else if (item == "delete_sky")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "sky");
+ }
+ else if (item == "new_day_cycle")
+ {
+ LLFloaterReg::showInstance("env_edit_day_cycle", "new");
+ }
+ else if (item == "edit_day_cycle")
+ {
+ LLFloaterReg::showInstance("env_edit_day_cycle", "edit");
+ }
+ else if (item == "delete_day_cycle")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "day_cycle");
+ }
+ else
+ {
+ llwarns << "Unknown item selected" << llendl;
+ }
+
return true;
}
};
@@ -7902,7 +7923,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun");
view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings");
- view_listener_t::addMenu(new LLWorldWaterSettings(), "World.WaterSettings");
+ view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset");
view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle");
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index be9ff872c0..972993202a 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -81,7 +81,6 @@
#include "llviewerwindow.h" // For getSpinAxis
#include "llvoavatar.h"
#include "llvoavatarself.h"
-#include "llvoclouds.h"
#include "llvograss.h"
#include "llvoground.h"
#include "llvolume.h"
@@ -167,8 +166,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
// llwarns << "Creating new tree!" << llendl;
// res = new LLVOTree(id, pcode, regionp); break;
res = NULL; break;
- case LL_VO_CLOUDS:
- res = new LLVOClouds(id, pcode, regionp); break;
case LL_VO_SURFACE_PATCH:
res = new LLVOSurfacePatch(id, pcode, regionp); break;
case LL_VO_SKY:
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index a0ad52df6b..7ebcee7b74 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -547,7 +547,7 @@ public:
//
typedef enum e_vo_types
{
- LL_VO_CLOUDS = LL_PCODE_APP | 0x20,
+ LL_VO_CLOUDS = LL_PCODE_APP | 0x20, // no longer used
LL_VO_SURFACE_PATCH = LL_PCODE_APP | 0x30,
LL_VO_WL_SKY = LL_PCODE_APP | 0x40,
LL_VO_SQUARE_TORUS = LL_PCODE_APP | 0x50,
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 45c6777ae8..9f882ee732 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -957,8 +957,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
iter != idle_list.end(); iter++)
{
objectp = *iter;
- if (objectp->getPCode() == LLViewerObject::LL_VO_CLOUDS ||
- objectp->isAvatar())
+ if (objectp->isAvatar())
{
objectp->idleUpdate(agent, world, frame_time);
}
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 002e0567e4..d03f6aa7c0 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -54,6 +54,7 @@
#include "llfloaterreporter.h"
#include "llfloaterregioninfo.h"
#include "llhttpnode.h"
+#include "llregioninfomodel.h"
#include "llsdutil.h"
#include "llstartup.h"
#include "lltrans.h"
@@ -64,7 +65,6 @@
#include "llvlmanager.h"
#include "llvlcomposition.h"
#include "llvocache.h"
-#include "llvoclouds.h"
#include "llworld.h"
#include "llspatialpartition.h"
#include "stringize.h"
@@ -315,7 +315,6 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mImpl->mObjectPartition.push_back(new LLWaterPartition()); //PARTITION_WATER
mImpl->mObjectPartition.push_back(new LLTreePartition()); //PARTITION_TREE
mImpl->mObjectPartition.push_back(new LLParticlePartition()); //PARTITION_PARTICLE
- mImpl->mObjectPartition.push_back(new LLCloudPartition()); //PARTITION_CLOUD
mImpl->mObjectPartition.push_back(new LLGrassPartition()); //PARTITION_GRASS
mImpl->mObjectPartition.push_back(new LLVolumePartition()); //PARTITION_VOLUME
mImpl->mObjectPartition.push_back(new LLBridgePartition()); //PARTITION_BRIDGE
@@ -350,7 +349,6 @@ LLViewerRegion::~LLViewerRegion()
// Can't do this on destruction, because the neighbor pointers might be invalid.
// This should be reference counted...
disconnectAllNeighbors();
- mCloudLayer.destroy();
LLViewerPartSim::getInstance()->cleanupRegion(this);
gObjectList.killObjects(this);
@@ -486,7 +484,6 @@ void LLViewerRegion::setOriginGlobal(const LLVector3d &origin_global)
updateRenderMatrix();
mImpl->mLandp->setOriginGlobal(origin_global);
mWind.setOriginGlobal(origin_global);
- mCloudLayer.setOriginGlobal(origin_global);
calculateCenterGlobal();
}
@@ -647,9 +644,11 @@ std::string LLViewerRegion::accessToShortString(U8 sim_access)
void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**)
{
// send it to 'observers'
+ // *TODO: switch the floaters to using LLRegionInfoModel
LLFloaterGodTools::processRegionInfo(msg);
LLFloaterRegionInfo::processRegionInfo(msg);
LLFloaterReporter::processRegionInfo(msg);
+ LLRegionInfoModel::instance().update(msg);
}
void LLViewerRegion::setCacheID(const LLUUID& id)
@@ -709,14 +708,12 @@ void LLViewerRegion::forceUpdate()
void LLViewerRegion::connectNeighbor(LLViewerRegion *neighborp, U32 direction)
{
mImpl->mLandp->connectNeighbor(neighborp->mImpl->mLandp, direction);
- mCloudLayer.connectNeighbor(&(neighborp->mCloudLayer), direction);
}
void LLViewerRegion::disconnectAllNeighbors()
{
mImpl->mLandp->disconnectAllNeighbors();
- mCloudLayer.disconnectAllNeighbors();
}
LLVLComposition * LLViewerRegion::getComposition() const
@@ -1504,6 +1501,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
capabilityNames.append("DispatchRegionInfo");
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
+ capabilityNames.append("EnvironmentSettings");
capabilityNames.append("ObjectMedia");
capabilityNames.append("ObjectMediaNavigate");
@@ -1660,6 +1658,21 @@ bool LLViewerRegion::capabilitiesReceived() const
void LLViewerRegion::setCapabilitiesReceived(bool received)
{
mCapabilitiesReceived = received;
+
+ // Tell interested parties that we've received capabilities,
+ // so that they can safely use getCapability().
+ if (received)
+ {
+ mCapabilitiesReceivedSignal(getRegionID());
+
+ // This is a single-shot signal. Forget callbacks to save resources.
+ mCapabilitiesReceivedSignal.disconnect_all_slots();
+ }
+}
+
+boost::signals2::connection LLViewerRegion::setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb)
+{
+ return mCapabilitiesReceivedSignal.connect(cb);
}
void LLViewerRegion::logActiveCapabilities() const
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 3811b989e7..f68b51ea65 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -30,10 +30,10 @@
// A ViewerRegion is a class that contains a bunch of objects and surfaces
// that are in to a particular region.
#include <string>
+#include <boost/signals2.hpp>
#include "lldarray.h"
#include "llwind.h"
-#include "llcloud.h"
#include "llstat.h"
#include "v3dmath.h"
#include "llstring.h"
@@ -81,7 +81,6 @@ public:
PARTITION_WATER,
PARTITION_TREE,
PARTITION_PARTICLE,
- PARTITION_CLOUD,
PARTITION_GRASS,
PARTITION_VOLUME,
PARTITION_BRIDGE,
@@ -90,6 +89,8 @@ public:
NUM_PARTITIONS
} eObjectPartitions;
+ typedef boost::signals2::signal<void(const LLUUID& region_id)> caps_received_signal_t;
+
LLViewerRegion(const U64 &handle,
const LLHost &host,
const U32 surface_grid_width,
@@ -237,6 +238,7 @@ public:
// has region received its final (not seed) capability list?
bool capabilitiesReceived() const;
void setCapabilitiesReceived(bool received);
+ boost::signals2::connection setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb);
static bool isSpecialCapabilityName(const std::string &name);
void logActiveCapabilities() const;
@@ -336,7 +338,6 @@ protected:
public:
LLWind mWind;
- LLCloudLayer mCloudLayer;
LLViewerParcelOverlay *mParcelOverlay;
LLStat mBitStat;
@@ -404,6 +405,7 @@ private:
bool mAlive; // can become false if circuit disconnects
bool mCapabilitiesReceived;
+ caps_received_signal_t mCapabilitiesReceivedSignal;
BOOL mReleaseNotesRequested;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 592923ee07..e473901609 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2189,6 +2189,16 @@ std::string LLViewerShaderMgr::getShaderDirPrefix(void)
void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
{
- LLWLParamManager::instance()->updateShaderUniforms(shader);
- LLWaterParamManager::instance()->updateShaderUniforms(shader);
+ LLWLParamManager::getInstance()->updateShaderUniforms(shader);
+ LLWaterParamManager::getInstance()->updateShaderUniforms(shader);
+}
+
+LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const
+{
+ return mShaderList.begin();
+}
+
+LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const
+{
+ return mShaderList.end();
}
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 6ecba65470..efef9ec5b2 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -241,20 +241,12 @@ public:
base_iter_t mIter;
};
- shader_iter beginShaders() const
- {
- return mShaderList.begin();
- }
-
- shader_iter endShaders() const
- {
- return mShaderList.end();
- }
-
+ shader_iter beginShaders() const;
+ shader_iter endShaders() const;
- /* virtual */ std::string getShaderDirPrefix(void); // Virtual
+ /* virtual */ std::string getShaderDirPrefix(void);
- /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); // Virtual
+ /* virtual */ void updateShaderUniforms(LLGLSLShader * shader);
private:
diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp
index 25f2687fe2..d8de979f56 100644
--- a/indra/newview/llvlmanager.cpp
+++ b/indra/newview/llvlmanager.cpp
@@ -94,7 +94,7 @@ void LLVLManager::unpackData(const S32 num_packets)
}
else if (CLOUD_LAYER_CODE == datap->mType)
{
- datap->mRegionp->mCloudLayer.decompress(bit_pack, &goph);
+
}
}
diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp
deleted file mode 100644
index 478708cd78..0000000000
--- a/indra/newview/llvoclouds.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * @file llvoclouds.cpp
- * @brief Implementation of LLVOClouds class which is a derivation fo LLViewerObject
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llvoclouds.h"
-
-#include "lldrawpoolalpha.h"
-
-#include "llviewercontrol.h"
-
-#include "llagent.h" // to get camera position
-#include "lldrawable.h"
-#include "llface.h"
-#include "llprimitive.h"
-#include "llsky.h"
-#include "llviewercamera.h"
-#include "llviewertexturelist.h"
-#include "llviewerobjectlist.h"
-#include "llviewerregion.h"
-#include "llvosky.h"
-#include "llworld.h"
-#include "pipeline.h"
-#include "llspatialpartition.h"
-
-LLUUID gCloudTextureID = IMG_CLOUD_POOF;
-
-
-LLVOClouds::LLVOClouds(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-: LLAlphaObject(id, LL_VO_CLOUDS, regionp)
-{
- mCloudGroupp = NULL;
- mbCanSelect = FALSE;
- setNumTEs(1);
- LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(gCloudTextureID);
- image->setBoostLevel(LLViewerTexture::BOOST_CLOUDS);
- setTEImage(0, image);
-}
-
-
-LLVOClouds::~LLVOClouds()
-{
-}
-
-
-BOOL LLVOClouds::isActive() const
-{
- return TRUE;
-}
-
-BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
-{
- static LLFastTimer::DeclareTimer ftm("Idle Clouds");
- LLFastTimer t(ftm);
-
- if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
- {
- return TRUE;
- }
-
- // Set dirty flag (so renderer will rebuild primitive)
- if (mDrawable)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
- }
-
- return TRUE;
-}
-
-
-void LLVOClouds::setPixelAreaAndAngle(LLAgent &agent)
-{
- mAppAngle = 50;
- mPixelArea = 1500*100;
-}
-
-void LLVOClouds::updateTextures()
-{
- getTEImage(0)->addTextureStats(mPixelArea);
-}
-
-LLDrawable* LLVOClouds::createDrawable(LLPipeline *pipeline)
-{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
-
- return mDrawable;
-}
-
-static LLFastTimer::DeclareTimer FTM_UPDATE_CLOUDS("Update Clouds");
-
-BOOL LLVOClouds::updateGeometry(LLDrawable *drawable)
-{
- LLFastTimer ftm(FTM_UPDATE_CLOUDS);
- if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
- {
- return TRUE;
- }
-
- if (drawable->isVisible())
- {
- dirtySpatialGroup(TRUE);
- }
-
- LLFace *facep;
-
- S32 num_faces = mCloudGroupp->getNumPuffs();
-
- if (num_faces > drawable->getNumFaces())
- {
- drawable->setNumFacesFast(num_faces, NULL, getTEImage(0));
- }
-
- mDepth = (getPositionAgent()-LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis();
-
- S32 face_indx = 0;
- for ( ; face_indx < num_faces; face_indx++)
- {
- facep = drawable->getFace(face_indx);
- if (!facep)
- {
- llwarns << "No facep for index " << face_indx << llendl;
- continue;
- }
-
- facep->setSize(4, 6);
-
- facep->setTEOffset(face_indx);
- facep->setTexture(getTEImage(0));
- const LLCloudPuff &puff = mCloudGroupp->getPuff(face_indx);
- const LLVector3 puff_pos_agent = gAgent.getPosAgentFromGlobal(puff.getPositionGlobal());
- facep->mCenterLocal = puff_pos_agent;
- /// Update cloud color based on sun color.
- LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
- facep->setFaceColor(float_color);
- }
- for ( ; face_indx < drawable->getNumFaces(); face_indx++)
- {
- facep = drawable->getFace(face_indx);
- if (!facep)
- {
- llwarns << "No facep for index " << face_indx << llendl;
- continue;
- }
-
- facep->setTEOffset(face_indx);
- facep->setSize(0,0);
- }
-
- drawable->movePartition();
-
- return TRUE;
-}
-
-F32 LLVOClouds::getPartSize(S32 idx)
-{
- return (CLOUD_PUFF_HEIGHT+CLOUD_PUFF_WIDTH)*0.5f;
-}
-
-void LLVOClouds::getGeometry(S32 te,
- LLStrider<LLVector3>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<U16>& indicesp)
-{
-
- if (te >= mCloudGroupp->getNumPuffs())
- {
- return;
- }
-
- LLDrawable* drawable = mDrawable;
- LLFace *facep = drawable->getFace(te);
-
- if (!facep->hasGeometry())
- {
- return;
- }
-
- LLVector3 normal(0.f,0.f,-1.f);
-
- const LLCloudPuff &puff = mCloudGroupp->getPuff(te);
- S32 index_offset = facep->getGeomIndex();
- LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
- LLColor4U color;
- color.setVec(float_color);
- facep->setFaceColor(float_color);
-
-
- LLVector3 up;
- LLVector3 right;
- LLVector3 at;
-
- const LLVector3& puff_pos_agent = facep->mCenterLocal;
- LLVector2 uvs[4];
-
- uvs[0].setVec(0.f, 1.f);
- uvs[1].setVec(0.f, 0.f);
- uvs[2].setVec(1.f, 1.f);
- uvs[3].setVec(1.f, 0.f);
-
- LLVector3 vtx[4];
-
- at = LLViewerCamera::getInstance()->getAtAxis();
- right = at % LLVector3(0.f, 0.f, 1.f);
- right.normVec();
- up = right % at;
- up.normVec();
- right *= 0.5f*CLOUD_PUFF_WIDTH;
- up *= 0.5f*CLOUD_PUFF_HEIGHT;;
-
- *colorsp++ = color;
- *colorsp++ = color;
- *colorsp++ = color;
- *colorsp++ = color;
-
- vtx[0] = puff_pos_agent - right + up;
- vtx[1] = puff_pos_agent - right - up;
- vtx[2] = puff_pos_agent + right + up;
- vtx[3] = puff_pos_agent + right - up;
-
- verticesp->mV[3] = 0.f;
- *verticesp++ = vtx[0];
- verticesp->mV[3] = 0.f;
- *verticesp++ = vtx[1];
- verticesp->mV[3] = 0.f;
- *verticesp++ = vtx[2];
- verticesp->mV[3] = 0.f;
- *verticesp++ = vtx[3];
-
- *texcoordsp++ = uvs[0];
- *texcoordsp++ = uvs[1];
- *texcoordsp++ = uvs[2];
- *texcoordsp++ = uvs[3];
-
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
-
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 2;
-
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 3;
- *indicesp++ = index_offset + 2;
-}
-
-U32 LLVOClouds::getPartitionType() const
-{
- return LLViewerRegion::PARTITION_CLOUD;
-}
-
-// virtual
-void LLVOClouds::updateDrawable(BOOL force_damped)
-{
- // Force an immediate rebuild on any update
- if (mDrawable.notNull())
- {
- mDrawable->updateXform(TRUE);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
- }
- clearChanged(SHIFTED);
-}
-
-LLCloudPartition::LLCloudPartition()
-{
- mDrawableType = LLPipeline::RENDER_TYPE_CLOUDS;
- mPartitionType = LLViewerRegion::PARTITION_CLOUD;
-}
-
diff --git a/indra/newview/llvoclouds.h b/indra/newview/llvoclouds.h
deleted file mode 100644
index 430923a108..0000000000
--- a/indra/newview/llvoclouds.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * @file llvoclouds.h
- * @brief Description of LLVOClouds class
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLVOCLOUDS_H
-#define LL_LLVOCLOUDS_H
-
-#include "llviewerobject.h"
-#include "lltable.h"
-#include "v4coloru.h"
-
-class LLViewerTexture;
-class LLViewerCloudGroup;
-
-class LLCloudGroup;
-
-
-class LLVOClouds : public LLAlphaObject
-{
-public:
- LLVOClouds(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp );
-
- // Initialize data that's only inited once per class.
- static void initClass();
-
- void updateDrawable(BOOL force_damped);
-
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ void getGeometry(S32 te,
- LLStrider<LLVector3>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<U16>& indicesp);
-
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- F32 getPartSize(S32 idx);
-
- /*virtual*/ void updateTextures();
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
-
- void updateFaceSize(S32 idx) { }
- BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
-
- virtual U32 getPartitionType() const;
-
- void setCloudGroup(LLCloudGroup *cgp) { mCloudGroupp = cgp; }
-protected:
- virtual ~LLVOClouds();
-
- LLCloudGroup *mCloudGroupp;
-};
-
-extern LLUUID gCloudTextureID;
-
-#endif // LL_VO_CLOUDS_H
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 800af26b69..66ba6249d3 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -370,7 +370,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mAtmHeight = ATM_HEIGHT;
mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS);
- mSunDefaultPosition = LLVector3(LLWLParamManager::instance()->mCurParams.getVector("lightnorm", error));
+ mSunDefaultPosition = LLVector3(LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error));
if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition"))
{
initSunDirection(mSunDefaultPosition, LLVector3(0, 0, 0));
@@ -646,24 +646,24 @@ void LLVOSky::initAtmospherics(void)
bool error;
// uniform parameters for convenience
- dome_radius = LLWLParamManager::instance()->getDomeRadius();
- dome_offset_ratio = LLWLParamManager::instance()->getDomeOffset();
- sunlight_color = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("sunlight_color", error));
- ambient = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("ambient", error));
- //lightnorm = LLWLParamManager::instance()->mCurParams.getVector("lightnorm", error);
- gamma = LLWLParamManager::instance()->mCurParams.getVector("gamma", error)[0];
- blue_density = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("blue_density", error));
- blue_horizon = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("blue_horizon", error));
- haze_density = LLWLParamManager::instance()->mCurParams.getVector("haze_density", error)[0];
- haze_horizon = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("haze_horizon", error));
- density_multiplier = LLWLParamManager::instance()->mCurParams.getVector("density_multiplier", error)[0];
- max_y = LLWLParamManager::instance()->mCurParams.getVector("max_y", error)[0];
- glow = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("glow", error));
- cloud_shadow = LLWLParamManager::instance()->mCurParams.getVector("cloud_shadow", error)[0];
- cloud_color = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_color", error));
- cloud_scale = LLWLParamManager::instance()->mCurParams.getVector("cloud_scale", error)[0];
- cloud_pos_density1 = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_pos_density1", error));
- cloud_pos_density2 = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_pos_density2", error));
+ dome_radius = LLWLParamManager::getInstance()->getDomeRadius();
+ dome_offset_ratio = LLWLParamManager::getInstance()->getDomeOffset();
+ sunlight_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("sunlight_color", error));
+ ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("ambient", error));
+ //lightnorm = LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error);
+ gamma = LLWLParamManager::getInstance()->mCurParams.getVector("gamma", error)[0];
+ blue_density = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_density", error));
+ blue_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_horizon", error));
+ haze_density = LLWLParamManager::getInstance()->mCurParams.getVector("haze_density", error)[0];
+ haze_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("haze_horizon", error));
+ density_multiplier = LLWLParamManager::getInstance()->mCurParams.getVector("density_multiplier", error)[0];
+ max_y = LLWLParamManager::getInstance()->mCurParams.getVector("max_y", error)[0];
+ glow = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("glow", error));
+ cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_shadow", error)[0];
+ cloud_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_color", error));
+ cloud_scale = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_scale", error)[0];
+ cloud_pos_density1 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density1", error));
+ cloud_pos_density2 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density2", error));
// light norm is different. We need the sun's direction, not the light direction
// which could be from the moon. And we need to clamp it
@@ -1033,7 +1033,7 @@ void LLVOSky::calcAtmospherics(void)
// Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio
// between sunlight and point lights in windlight to normalize point lights.
F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
- LLWLParamManager::instance()->mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp);
+ LLWLParamManager::getInstance()->mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp);
mSunDiffuse = vary_SunlightColor;
mSunAmbient = vary_AmbientColor;
@@ -2129,7 +2129,7 @@ void LLVOSky::updateFog(const F32 distance)
F32 depth = water_height - camera_height;
// get the water param manager variables
- float water_fog_density = LLWaterParamManager::instance()->getFogDensity();
+ float water_fog_density = LLWaterParamManager::getInstance()->getFogDensity();
LLColor4 water_fog_color = LLDrawPoolWater::sWaterFogColor.mV;
// adjust the color based on depth. We're doing linear approximations
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 51664cb31d..7b1c725483 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -568,7 +568,7 @@ void LLVOWLSky::buildFanBuffer(LLStrider<LLVector3> & vertices,
LLStrider<LLVector2> & texCoords,
LLStrider<U16> & indices)
{
- const F32 RADIUS = LLWLParamManager::instance()->getDomeRadius();
+ const F32 RADIUS = LLWLParamManager::getInstance()->getDomeRadius();
U32 i, num_slices;
F32 phi0, theta, x0, y0, z0;
@@ -629,7 +629,7 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack, U32 end_stack,
LLStrider<LLVector2> & texCoords,
LLStrider<U16> & indices)
{
- const F32 RADIUS = LLWLParamManager::instance()->getDomeRadius();
+ const F32 RADIUS = LLWLParamManager::getInstance()->getDomeRadius();
U32 i, j, num_slices, num_stacks;
F32 phi0, theta, x0, y0, z0;
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 67bb965f99..475f57cdd4 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -58,8 +58,6 @@
#include "curl/curl.h"
-LLWaterParamManager * LLWaterParamManager::sInstance = NULL;
-
LLWaterParamManager::LLWaterParamManager() :
mFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f, 0.0f, "waterFogColor", "WaterFogColor"),
mFogDensity(4, "waterFogDensity", 2),
@@ -73,8 +71,6 @@ LLWaterParamManager::LLWaterParamManager() :
mWave1Dir(.5f, .5f, "wave1Dir"),
mWave2Dir(.5f, .5f, "wave2Dir"),
mDensitySliderValue(1.0f),
- mPrevFogDensity(16.0f), // 2^4
- mPrevFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f),
mWaterFogKS(1.0f)
{
}
@@ -83,131 +79,73 @@ LLWaterParamManager::~LLWaterParamManager()
{
}
-void LLWaterParamManager::loadAllPresets(const std::string& file_name)
+void LLWaterParamManager::loadAllPresets()
{
- std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading Default water settings from " << path_name << LL_ENDL;
-
- bool found = true;
- LLDirIterator app_settings_iter(path_name, "*.xml");
- while(found)
- {
- std::string name;
- found = app_settings_iter.next(name);
- if(found)
- {
-
- name=name.erase(name.length()-4);
+ // First, load system (coming out of the box) water presets.
+ loadPresetsFromDir(getSysDir());
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_unescape(name.c_str(), name.size());
- std::string unescaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
-
- LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
- loadPreset(unescaped_name,FALSE);
- }
- }
+ // Then load user presets. Note that user day presets will modify any system ones already loaded.
+ loadPresetsFromDir(getUserDir());
+}
- // And repeat for user presets, note the user presets will modify any system presets already loaded
+void LLWaterParamManager::loadPresetsFromDir(const std::string& dir)
+{
+ LL_INFOS2("AppInit", "Shaders") << "Loading water presets from " << dir << LL_ENDL;
- std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", ""));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading User water settings from " << path_name2 << LL_ENDL;
-
- found = true;
- LLDirIterator user_settings_iter(path_name2, "*.xml");
- while(found)
+ LLDirIterator dir_iter(dir, "*.xml");
+ while (1)
{
- std::string name;
- found = user_settings_iter.next(name);
- if(found)
+ std::string file;
+ if (!dir_iter.next(file))
{
- name=name.erase(name.length()-4);
-
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_unescape(name.c_str(), name.size());
- std::string unescaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
+ break; // no more files
+ }
- LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
- loadPreset(unescaped_name,FALSE);
+ std::string path = dir + file;
+ if (!loadPreset(path))
+ {
+ llwarns << "Error loading water preset from " << path << llendl;
}
}
-
}
-void LLWaterParamManager::loadPreset(const std::string & name,bool propagate)
+bool LLWaterParamManager::loadPreset(const std::string& path)
{
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_filename(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
-
- escaped_filename += ".xml";
+ llifstream xml_file;
+ std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
- std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading water settings from " << pathName << LL_ENDL;
-
- llifstream presetsXML;
- presetsXML.open(pathName.c_str());
-
- // That failed, try loading from the users area instead.
- if(!presetsXML)
+ xml_file.open(path.c_str());
+ if (!xml_file)
{
- pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename);
- LL_DEBUGS2("AppInit", "Shaders") << "Loading User water setting from " << pathName << LL_ENDL;
- presetsXML.clear();
- presetsXML.open(pathName.c_str());
+ return false;
}
- if (presetsXML)
- {
- LLSD paramsData(LLSD::emptyMap());
+ LL_DEBUGS2("AppInit", "Shaders") << "Loading water " << name << LL_ENDL;
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ LLSD params_data;
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED);
+ xml_file.close();
- parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED);
-
- std::map<std::string, LLWaterParamSet>::iterator mIt = mParamList.find(name);
- if(mIt == mParamList.end())
- {
- addParamSet(name, paramsData);
- }
- else
- {
- setParamSet(name, paramsData);
- }
- presetsXML.close();
- }
- else
+ if (hasParamSet(name))
{
- llwarns << "Can't find " << name << llendl;
- return;
+ setParamSet(name, params_data);
}
-
- if(propagate)
+ else
{
- getParamSet(name, mCurParams);
- propagateParameters();
+ addParamSet(name, params_data);
}
-}
+
+ return true;
+}
void LLWaterParamManager::savePreset(const std::string & name)
{
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_filename(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
-
- escaped_filename += ".xml";
+ llassert(!name.empty());
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
- std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename));
+ std::string pathName(getUserDir() + LLURI::escape(name) + ".xml");
// fill it with LLSD windlight params
paramsData = mParamList[name].getAll();
@@ -221,7 +159,6 @@ void LLWaterParamManager::savePreset(const std::string & name)
propagateParameters();
}
-
void LLWaterParamManager::propagateParameters(void)
{
// bind the variables only if we're using shaders
@@ -251,7 +188,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
{
if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
{
- shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::instance()->getRotatedLightDir().mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV);
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV);
shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
@@ -261,28 +198,32 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
}
}
-static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params");
-
-void LLWaterParamManager::update(LLViewerCamera * cam)
+void LLWaterParamManager::applyParams(const LLSD& params, bool interpolate)
{
- LLFastTimer ftm(FTM_UPDATE_WLPARAM);
-
- // update the shaders and the menu
- propagateParameters();
-
- // If water fog color has been changed, save it.
- if (mPrevFogColor != mFogColor)
+ if (params.size() == 0)
{
- gSavedSettings.setColor4("WaterFogColor", mFogColor);
- mPrevFogColor = mFogColor;
+ llwarns << "Undefined water params" << llendl;
+ return;
}
- // If water fog density has been changed, save it.
- if (mPrevFogDensity != mFogDensity)
+ if (interpolate)
+ {
+ LLWLParamManager::getInstance()->mAnimator.startInterpolation(params);
+ }
+ else
{
- gSavedSettings.setF32("WaterFogDensity", mFogDensity);
- mPrevFogDensity = mFogDensity;
+ mCurParams.setAll(params);
}
+}
+
+static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params");
+
+void LLWaterParamManager::update(LLViewerCamera * cam)
+{
+ LLFastTimer ftm(FTM_UPDATE_WATERPARAM);
+
+ // update the shaders and the menu
+ propagateParameters();
// sync menus if they exist
LLFloaterWater* waterfloater = LLFloaterReg::findTypedInstance<LLFloaterWater>("env_water");
@@ -339,26 +280,14 @@ void LLWaterParamManager::update(LLViewerCamera * cam)
}
}
-// static
-void LLWaterParamManager::initClass(void)
-{
- instance();
-}
-
-// static
-void LLWaterParamManager::cleanupClass(void)
-{
- delete sInstance;
- sInstance = NULL;
-}
-
bool LLWaterParamManager::addParamSet(const std::string& name, LLWaterParamSet& param)
{
// add a new one if not one there already
- std::map<std::string, LLWaterParamSet>::iterator mIt = mParamList.find(name);
+ preset_map_t::iterator mIt = mParamList.find(name);
if(mIt == mParamList.end())
{
mParamList[name] = param;
+ mPresetListChangeSignal();
return true;
}
@@ -367,23 +296,15 @@ bool LLWaterParamManager::addParamSet(const std::string& name, LLWaterParamSet&
BOOL LLWaterParamManager::addParamSet(const std::string& name, LLSD const & param)
{
- // add a new one if not one there already
- std::map<std::string, LLWaterParamSet>::const_iterator finder = mParamList.find(name);
- if(finder == mParamList.end())
- {
- mParamList[name].setAll(param);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ LLWaterParamSet param_set;
+ param_set.setAll(param);
+ return addParamSet(name, param_set);
}
bool LLWaterParamManager::getParamSet(const std::string& name, LLWaterParamSet& param)
{
// find it and set it
- std::map<std::string, LLWaterParamSet>::iterator mIt = mParamList.find(name);
+ preset_map_t::iterator mIt = mParamList.find(name);
if(mIt != mParamList.end())
{
param = mParamList[name];
@@ -394,6 +315,12 @@ bool LLWaterParamManager::getParamSet(const std::string& name, LLWaterParamSet&
return false;
}
+bool LLWaterParamManager::hasParamSet(const std::string& name)
+{
+ LLWaterParamSet dummy;
+ return getParamSet(name, dummy);
+}
+
bool LLWaterParamManager::setParamSet(const std::string& name, LLWaterParamSet& param)
{
mParamList[name] = param;
@@ -417,29 +344,74 @@ bool LLWaterParamManager::setParamSet(const std::string& name, const LLSD & para
bool LLWaterParamManager::removeParamSet(const std::string& name, bool delete_from_disk)
{
// remove from param list
- std::map<std::string, LLWaterParamSet>::iterator mIt = mParamList.find(name);
- if(mIt != mParamList.end())
+ preset_map_t::iterator it = mParamList.find(name);
+ if (it == mParamList.end())
{
- mParamList.erase(mIt);
+ LL_WARNS("WindLight") << "No water preset named " << name << LL_ENDL;
+ return false;
}
- if(delete_from_disk)
- {
+ mParamList.erase(it);
- std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", ""));
-
- // use full curl escaped name
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
-
- gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml");
+ // remove from file system if requested
+ if (delete_from_disk)
+ {
+ if (gDirUtilp->deleteFilesInDir(getUserDir(), LLURI::escape(name) + ".xml") < 1)
+ {
+ LL_WARNS("WindLight") << "Error removing water preset " << name << " from disk" << LL_ENDL;
+ }
}
+ // signal interested parties
+ mPresetListChangeSignal();
return true;
}
+bool LLWaterParamManager::isSystemPreset(const std::string& preset_name) const
+{
+ // *TODO: file system access is excessive here.
+ return gDirUtilp->fileExists(getSysDir() + LLURI::escape(preset_name) + ".xml");
+}
+
+void LLWaterParamManager::getPresetNames(preset_name_list_t& presets) const
+{
+ presets.clear();
+
+ for (preset_map_t::const_iterator it = mParamList.begin(); it != mParamList.end(); ++it)
+ {
+ presets.push_back(it->first);
+ }
+}
+
+void LLWaterParamManager::getPresetNames(preset_name_list_t& user_presets, preset_name_list_t& system_presets) const
+{
+ user_presets.clear();
+ system_presets.clear();
+
+ for (preset_map_t::const_iterator it = mParamList.begin(); it != mParamList.end(); ++it)
+ {
+ if (isSystemPreset(it->first))
+ {
+ system_presets.push_back(it->first);
+ }
+ else
+ {
+ user_presets.push_back(it->first);
+ }
+ }
+}
+
+void LLWaterParamManager::getUserPresetNames(preset_name_list_t& user_presets) const
+{
+ preset_name_list_t dummy;
+ getPresetNames(user_presets, dummy);
+}
+
+boost::signals2::connection LLWaterParamManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb)
+{
+ return mPresetListChangeSignal.connect(cb);
+}
+
F32 LLWaterParamManager::getFogDensity(void)
{
bool err;
@@ -458,34 +430,22 @@ F32 LLWaterParamManager::getFogDensity(void)
return fogDensity;
}
-// static
-LLWaterParamManager * LLWaterParamManager::instance()
+// virtual static
+void LLWaterParamManager::initSingleton()
{
- if(NULL == sInstance)
- {
- sInstance = new LLWaterParamManager();
-
- sInstance->loadAllPresets(LLStringUtil::null);
-
- sInstance->getParamSet("Default", sInstance->mCurParams);
- sInstance->initOverrides();
- }
+ LL_DEBUGS("Windlight") << "Initializing water" << LL_ENDL;
+ loadAllPresets();
+ LLEnvManagerNew::instance().usePrefs();
+}
- return sInstance;
+// static
+std::string LLWaterParamManager::getSysDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "");
}
-void LLWaterParamManager::initOverrides()
+// static
+std::string LLWaterParamManager::getUserDir()
{
- // Override fog color from the current preset with the saved setting.
- LLColor4 fog_color_override = gSavedSettings.getColor4("WaterFogColor");
- mFogColor = fog_color_override;
- mPrevFogColor = fog_color_override;
- mCurParams.set("waterFogColor", fog_color_override);
-
- // Do the same with fog density.
- F32 fog_density = gSavedSettings.getF32("WaterFogDensity");
- mPrevFogDensity = fog_density;
- mFogDensity = fog_density;
- mCurParams.set("waterFogDensity", fog_density);
- setDensitySliderValue(mFogDensity.mExp);
+ return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/water", "");
}
diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h
index f465034c39..dc7d41be2a 100644
--- a/indra/newview/llwaterparammanager.h
+++ b/indra/newview/llwaterparammanager.h
@@ -27,7 +27,7 @@
#ifndef LL_WATER_PARAMMANAGER_H
#define LL_WATER_PARAMMANAGER_H
-#include <vector>
+#include <list>
#include <map>
#include "llwaterparamset.h"
#include "llviewercamera.h"
@@ -212,19 +212,13 @@ struct WaterExpFloatControl
/// WindLight parameter manager class - what controls all the wind light shaders
-class LLWaterParamManager
+class LLWaterParamManager : public LLSingleton<LLWaterParamManager>
{
+ LOG_CLASS(LLWaterParamManager);
public:
-
- LLWaterParamManager();
- ~LLWaterParamManager();
-
- /// load a preset file
- void loadAllPresets(const std::string & fileName);
-
- /// load an individual preset into the sky
-
- void loadPreset(const std::string & name,bool propagate=true);
+ typedef std::list<std::string> preset_name_list_t;
+ typedef std::map<std::string, LLWaterParamSet> preset_map_t;
+ typedef boost::signals2::signal<void()> preset_list_signal_t;
/// save the parameter presets to file
void savePreset(const std::string & name);
@@ -232,18 +226,15 @@ public:
/// send the parameters to the shaders
void propagateParameters(void);
+ // display specified water
+ void applyParams(const LLSD& params, bool interpolate);
+
/// update information for the shader
void update(LLViewerCamera * cam);
/// Update shader uniforms that have changed.
void updateShaderUniforms(LLGLSLShader * shader);
- /// Perform global initialization for this class.
- static void initClass(void);
-
- // Cleanup of global data that's only inited once per class.
- static void cleanupClass();
-
/// add a param to the list
bool addParamSet(const std::string& name, LLWaterParamSet& param);
@@ -253,6 +244,9 @@ public:
/// get a param from the list
bool getParamSet(const std::string& name, LLWaterParamSet& param);
+ /// check whether the preset is in the list
+ bool hasParamSet(const std::string& name);
+
/// set the param in the list with a new param
bool setParamSet(const std::string& name, LLWaterParamSet& param);
@@ -263,6 +257,24 @@ public:
/// returns true if successful
bool removeParamSet(const std::string& name, bool delete_from_disk);
+ /// @return true if the preset comes out of the box
+ bool isSystemPreset(const std::string& preset_name) const;
+
+ /// @return all named water presets.
+ const preset_map_t& getPresets() const { return mParamList; }
+
+ /// @return user and system preset names as a single list
+ void getPresetNames(preset_name_list_t& presets) const;
+
+ /// @return user and system preset names separately
+ void getPresetNames(preset_name_list_t& user_presets, preset_name_list_t& system_presets) const;
+
+ /// @return list of user presets names
+ void getUserPresetNames(preset_name_list_t& user_presets) const;
+
+ /// Emitted when a preset gets added or deleted.
+ boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb);
+
/// set the normap map we want for water
bool setNormalMapID(const LLUUID& img);
@@ -281,12 +293,6 @@ public:
F32 getFogDensity(void);
LLColor4 getFogColor(void);
- // singleton pattern implementation
- static LLWaterParamManager * instance();
-
-private:
- void initOverrides();
-
public:
LLWaterParamSet mCurParams;
@@ -308,20 +314,28 @@ public:
WaterFloatControl mScaleBelow;
WaterFloatControl mBlurMultiplier;
- // list of all the parameters, listed by name
- std::map<std::string, LLWaterParamSet> mParamList;
-
F32 mDensitySliderValue;
private:
+ friend class LLSingleton<LLWaterParamManager>;
+ /*virtual*/ void initSingleton();
+ LLWaterParamManager();
+ ~LLWaterParamManager();
+
+ void loadAllPresets();
+ void loadPresetsFromDir(const std::string& dir);
+ bool loadPreset(const std::string& path);
+
+ static std::string getSysDir();
+ static std::string getUserDir();
+
LLVector4 mWaterPlane;
F32 mWaterFogKS;
- LLColor4 mPrevFogColor;
- F32 mPrevFogDensity;
+ // list of all the parameters, listed by name
+ preset_map_t mParamList;
- // our parameter manager singleton instance
- static LLWaterParamManager * sInstance;
+ preset_list_signal_t mPresetListChangeSignal;
};
inline void LLWaterParamManager::setDensitySliderValue(F32 val)
diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp
index 9457d631be..488b189e94 100644
--- a/indra/newview/llwaterparamset.cpp
+++ b/indra/newview/llwaterparamset.cpp
@@ -224,3 +224,46 @@ F32 LLWaterParamSet::getFloat(const std::string& paramName, bool& error)
return 0;
}
+// Added for interpolation effect in DEV-33645
+// Based on LLWLParamSet::mix, but written by Jacob without an intimate knowledge of how WindLight works.
+// The function definition existed in the header but was never implemented. If you think there is something
+// wrong with this, you're probably right. Ask Jacob, Q, or a member of the original WindLight team.
+void LLWaterParamSet::mix(LLWaterParamSet& src, LLWaterParamSet& dest, F32 weight)
+{
+ // Setup
+ LLSD srcVal, destVal; // LLSD holders for get/set calls, reusable
+
+ // Iterate through values
+ for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter)
+ {
+ // If param exists in both src and dest, set the holder variables, otherwise skip
+ if(src.mParamValues.has(iter->first) && dest.mParamValues.has(iter->first))
+ {
+ srcVal = src.mParamValues[iter->first];
+ destVal = dest.mParamValues[iter->first];
+ }
+ else
+ {
+ continue;
+ }
+
+ if(iter->second.isReal()) // If it's a real, interpolate directly
+ {
+ iter->second = srcVal.asReal() + ((destVal.asReal() - srcVal.asReal()) * weight);
+ }
+ else if(iter->second.isArray() && iter->second[0].isReal() // If it's an array of reals, loop through the reals and interpolate on those
+ && iter->second.size() == srcVal.size() && iter->second.size() == destVal.size())
+ {
+ // Actually do interpolation: old value + (difference in values * factor)
+ for(int i=0; i < iter->second.size(); ++i)
+ {
+ // iter->second[i] = (1.f-weight)*(F32)srcVal[i].asReal() + weight*(F32)destVal[i].asReal(); // old way of doing it -- equivalent but one more operation
+ iter->second[i] = srcVal[i].asReal() + ((destVal[i].asReal() - srcVal[i].asReal()) * weight);
+ }
+ }
+ else // Else, skip
+ {
+ continue;
+ }
+ }
+}
diff --git a/indra/newview/llwlanimator.cpp b/indra/newview/llwlanimator.cpp
index a94a2e41aa..e568638cf6 100644
--- a/indra/newview/llwlanimator.cpp
+++ b/indra/newview/llwlanimator.cpp
@@ -30,20 +30,31 @@
#include "llsky.h"
#include "pipeline.h"
#include "llwlparammanager.h"
+#include "llwaterparammanager.h"
-LLWLAnimator::LLWLAnimator() : mStartTime(0), mDayRate(1), mDayTime(0),
- mIsRunning(FALSE), mUseLindenTime(false)
+extern LLControlGroup gSavedSettings;
+
+F64 LLWLAnimator::INTERP_TOTAL_SECONDS = 3.f;
+
+LLWLAnimator::LLWLAnimator() : mStartTime(0.f), mDayRate(1.f), mDayTime(0.f),
+ mIsRunning(FALSE), mIsInterpolating(FALSE), mTimeType(TIME_LINDEN),
+ mInterpStartTime(), mInterpEndTime()
{
- mDayTime = 0;
+ mInterpBeginWL = new LLWLParamSet();
+ mInterpBeginWater = new LLWaterParamSet();
+ mInterpEndWater = new LLWaterParamSet();
}
void LLWLAnimator::update(LLWLParamSet& curParams)
{
+ //llassert(mUseLindenTime != mUseLocalTime);
+
F64 curTime;
curTime = getDayTime();
// don't do anything if empty
- if(mTimeTrack.size() == 0) {
+ if(mTimeTrack.size() == 0)
+ {
return;
}
@@ -53,13 +64,15 @@ void LLWLAnimator::update(LLWLParamSet& curParams)
mSecondIt++;
// grab the two tween iterators
- while(mSecondIt != mTimeTrack.end() && curTime > mSecondIt->first) {
+ while(mSecondIt != mTimeTrack.end() && curTime > mSecondIt->first)
+ {
mFirstIt++;
mSecondIt++;
}
// scroll it around when you get to the end
- if(mSecondIt == mTimeTrack.end() || mFirstIt->first > curTime) {
+ if(mSecondIt == mTimeTrack.end() || mFirstIt->first > curTime)
+ {
mSecondIt = mTimeTrack.begin();
mFirstIt = mTimeTrack.end();
mFirstIt--;
@@ -67,70 +80,111 @@ void LLWLAnimator::update(LLWLParamSet& curParams)
F32 weight = 0;
- if(mFirstIt->first < mSecondIt->first) {
+ if(mFirstIt->first < mSecondIt->first)
+ {
// get the delta time and the proper weight
weight = F32 (curTime - mFirstIt->first) /
(mSecondIt->first - mFirstIt->first);
// handle the ends
- } else if(mFirstIt->first > mSecondIt->first) {
+ }
+ else if(mFirstIt->first > mSecondIt->first)
+ {
// right edge of time line
- if(curTime >= mFirstIt->first) {
+ if(curTime >= mFirstIt->first)
+ {
weight = F32 (curTime - mFirstIt->first) /
((1 + mSecondIt->first) - mFirstIt->first);
-
// left edge of time line
- } else {
+ }
+ else
+ {
weight = F32 ((1 + curTime) - mFirstIt->first) /
((1 + mSecondIt->first) - mFirstIt->first);
}
-
// handle same as whatever the last one is
- } else {
+ }
+ else
+ {
weight = 1;
}
+ if(mIsInterpolating)
+ {
+ // *TODO_JACOB: this is kind of laggy. Not sure why. The part that lags is the curParams.mix call, and none of the other mixes. It works, though.
+ clock_t current = clock();
+ if(current >= mInterpEndTime)
+ {
+ mIsInterpolating = false;
+ return;
+ }
+
+ // determine moving target for final interpolation value
+ // *TODO: this will not work with lazy loading of sky presets.
+ LLWLParamSet buf = LLWLParamSet();
+ buf.setAll(LLWLParamManager::getInstance()->mParamList[mFirstIt->second].getAll()); // just give it some values, otherwise it has no params to begin with (see comment in constructor)
+ buf.mix(LLWLParamManager::getInstance()->mParamList[mFirstIt->second], LLWLParamManager::getInstance()->mParamList[mSecondIt->second], weight); // mix to determine moving target for interpolation finish (as below)
+
+ // mix from previous value to moving target
+ weight = (current - mInterpStartTime) / (INTERP_TOTAL_SECONDS * CLOCKS_PER_SEC);
+ curParams.mix(*mInterpBeginWL, buf, weight);
+
+ // mix water
+ LLWaterParamManager::getInstance()->mCurParams.mix(*mInterpBeginWater, *mInterpEndWater, weight);
+ }
+ else
+ {
// do the interpolation and set the parameters
- curParams.mix(LLWLParamManager::instance()->mParamList[mFirstIt->second],
- LLWLParamManager::instance()->mParamList[mSecondIt->second], weight);
+ // *TODO: this will not work with lazy loading of sky presets.
+ curParams.mix(LLWLParamManager::getInstance()->mParamList[mFirstIt->second], LLWLParamManager::getInstance()->mParamList[mSecondIt->second], weight);
+ }
}
F64 LLWLAnimator::getDayTime()
{
- if(!mIsRunning) {
+ if(!mIsRunning)
+ {
return mDayTime;
}
-
- if(mUseLindenTime) {
-
+ else if(mTimeType == TIME_LINDEN)
+ {
F32 phase = gSky.getSunPhase() / F_PI;
// we're not solving the non-linear equation that determines sun phase
// we're just linearly interpolating between the major points
if (phase <= 5.0 / 4.0) {
mDayTime = (1.0 / 3.0) * phase + (1.0 / 3.0);
- } else {
+ }
+ else
+ {
mDayTime = phase - (1.0 / 2.0);
}
- if(mDayTime > 1) {
+ if(mDayTime > 1)
+ {
mDayTime--;
}
return mDayTime;
}
+ else if(mTimeType == TIME_LOCAL)
+ {
+ return getLocalTime();
+ }
// get the time;
mDayTime = (LLTimer::getElapsedSeconds() - mStartTime) / mDayRate;
// clamp it
- if(mDayTime < 0) {
+ if(mDayTime < 0)
+ {
mDayTime = 0;
}
- while(mDayTime > 1) {
+ while(mDayTime > 1)
+ {
mDayTime--;
}
@@ -144,15 +198,18 @@ void LLWLAnimator::setDayTime(F64 dayTime)
mDayTime = dayTime;
// clamp it
- if(mDayTime < 0) {
+ if(mDayTime < 0)
+ {
mDayTime = 0;
- } else if(mDayTime > 1) {
+ }
+ else if(mDayTime > 1)
+ {
mDayTime = 1;
}
}
-void LLWLAnimator::setTrack(std::map<F32, std::string>& curTrack,
+void LLWLAnimator::setTrack(std::map<F32, LLWLParamKey>& curTrack,
F32 dayRate, F64 dayTime, bool run)
{
mTimeTrack = curTrack;
@@ -161,3 +218,96 @@ void LLWLAnimator::setTrack(std::map<F32, std::string>& curTrack,
mIsRunning = run;
}
+
+void LLWLAnimator::startInterpolation(const LLSD& targetWater)
+{
+ mInterpBeginWL->setAll(LLWLParamManager::getInstance()->mCurParams.getAll());
+ mInterpBeginWater->setAll(LLWaterParamManager::getInstance()->mCurParams.getAll());
+
+ mInterpStartTime = clock();
+ mInterpEndTime = mInterpStartTime + clock_t(INTERP_TOTAL_SECONDS) * CLOCKS_PER_SEC;
+
+ // Don't set any ending WL -- this is continuously calculated as the animator updates since it's a moving target
+ mInterpEndWater->setAll(targetWater);
+
+ mIsInterpolating = true;
+}
+
+std::string LLWLAnimator::timeToString(F32 curTime)
+{
+ S32 hours;
+ S32 min;
+ bool isPM = false;
+
+ // get hours and minutes
+ hours = (S32) (24.0 * curTime);
+ curTime -= ((F32) hours / 24.0f);
+ min = llround(24.0f * 60.0f * curTime);
+
+ // handle case where it's 60
+ if(min == 60)
+ {
+ hours++;
+ min = 0;
+ }
+
+ // set for PM
+ if(hours >= 12 && hours < 24)
+ {
+ isPM = true;
+ }
+
+ // convert to non-military notation
+ if(hours >= 24)
+ {
+ hours = 12;
+ }
+ else if(hours > 12)
+ {
+ hours -= 12;
+ }
+ else if(hours == 0)
+ {
+ hours = 12;
+ }
+
+ // make the string
+ std::stringstream newTime;
+ newTime << hours << ":";
+
+ // double 0
+ if(min < 10)
+ {
+ newTime << 0;
+ }
+
+ // finish it
+ newTime << min << " ";
+ if(isPM)
+ {
+ newTime << "PM";
+ }
+ else
+ {
+ newTime << "AM";
+ }
+
+ return newTime.str();
+}
+
+F64 LLWLAnimator::getLocalTime()
+{
+ char buffer[9];
+ time_t rawtime;
+ struct tm* timeinfo;
+
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ strftime(buffer, 9, "%H:%M:%S", timeinfo);
+ std::string timeStr(buffer);
+
+ F64 tod = ((F64)atoi(timeStr.substr(0,2).c_str())) / 24.f +
+ ((F64)atoi(timeStr.substr(3,2).c_str())) / 1440.f +
+ ((F64)atoi(timeStr.substr(6,2).c_str())) / 86400.f;
+ return tod;
+}
diff --git a/indra/newview/llwlanimator.h b/indra/newview/llwlanimator.h
index 5677290213..5223b45343 100644
--- a/indra/newview/llwlanimator.h
+++ b/indra/newview/llwlanimator.h
@@ -28,28 +28,39 @@
#define LL_WL_ANIMATOR_H
#include "llwlparamset.h"
+#include "llwaterparamset.h"
#include <string>
#include <map>
+struct LLWLParamKey;
+
class LLWLAnimator {
public:
+ typedef enum e_time
+ {
+ TIME_LINDEN,
+ TIME_LOCAL,
+ TIME_CUSTOM
+ } ETime;
+
F64 mStartTime;
F32 mDayRate;
F64 mDayTime;
// track to play
- std::map<F32, std::string> mTimeTrack;
- std::map<F32, std::string>::iterator mFirstIt, mSecondIt;
-
- // params to use
- //std::map<std::string, LLWLParamSet> mParamList;
-
- bool mIsRunning;
- bool mUseLindenTime;
+ std::map<F32, LLWLParamKey> mTimeTrack;
+ std::map<F32, LLWLParamKey>::iterator mFirstIt, mSecondIt;
// simple constructor
LLWLAnimator();
+ ~LLWLAnimator()
+ {
+ delete mInterpBeginWL;
+ delete mInterpBeginWater;
+ delete mInterpEndWater;
+ }
+
// update the parameters
void update(LLWLParamSet& curParams);
@@ -63,9 +74,66 @@ public:
void setDayTime(F64 dayTime);
// set an animation track
- void setTrack(std::map<F32, std::string>& track,
+ void setTrack(std::map<F32, LLWLParamKey>& track,
F32 dayRate, F64 dayTime = 0, bool run = true);
+ void deactivate()
+ {
+ mIsRunning = false;
+ }
+
+ void activate(ETime time)
+ {
+ mIsRunning = true;
+ mTimeType = time;
+ }
+
+ void startInterpolation(const LLSD& targetWater);
+
+ bool getIsRunning()
+ {
+ return mIsRunning;
+ }
+
+ bool getUseCustomTime()
+ {
+ return mTimeType == TIME_CUSTOM;
+ }
+
+ bool getUseLocalTime()
+ {
+ return mTimeType == TIME_LOCAL;
+ }
+
+ bool getUseLindenTime()
+ {
+ return mTimeType == TIME_LINDEN;
+ }
+
+ void setTimeType(ETime time)
+ {
+ mTimeType = time;
+ }
+
+ ETime getTimeType()
+ {
+ return mTimeType;
+ }
+
+ /// convert the present time to a digital clock time
+ static std::string timeToString(F32 curTime);
+
+ /// get local time between 0 and 1
+ static F64 getLocalTime();
+
+private:
+ ETime mTimeType;
+ bool mIsRunning, mIsInterpolating;
+ LLWLParamSet *mInterpBeginWL;
+ LLWaterParamSet *mInterpBeginWater, *mInterpEndWater;
+ clock_t mInterpStartTime, mInterpEndTime;
+
+ static F64 INTERP_TOTAL_SECONDS;
};
#endif // LL_WL_ANIMATOR_H
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index 85b3d62a49..e646b605a9 100644
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -27,12 +27,12 @@
#include "llviewerprecompiledheaders.h"
#include "llwldaycycle.h"
-
-#include "llnotificationsutil.h"
#include "llsdserialize.h"
-#include "llxmlnode.h"
-
#include "llwlparammanager.h"
+#include "llfloaterdaycycle.h"
+#include "llnotifications.h"
+
+#include "llviewerwindow.h"
#include <map>
@@ -45,85 +45,160 @@ LLWLDayCycle::~LLWLDayCycle()
{
}
-void LLWLDayCycle::loadDayCycle(const std::string & fileName)
+void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope)
{
- // clear the first few things
+ lldebugs << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << llendl;
mTimeMap.clear();
- // now load the file
- std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
- "windlight/days", fileName));
- llinfos << "Loading DayCycle settings from " << pathName << llendl;
-
- llifstream day_cycle_xml(pathName);
- if (day_cycle_xml.is_open())
+ // add each key frame
+ for(S32 i = 0; i < day_data.size(); ++i)
{
- // load and parse it
- LLSD day_data(LLSD::emptyArray());
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED);
-
- // add each key
- for(S32 i = 0; i < day_data.size(); ++i)
+ // make sure it's a two array
+ if(day_data[i].size() != 2)
+ {
+ continue;
+ }
+
+ // check each param key exists in param manager
+ bool success;
+ LLWLParamSet pset;
+ LLWLParamKey frame = LLWLParamKey(day_data[i][1].asString(), scope);
+ success =
+ LLWLParamManager::getInstance()->getParamSet(frame, pset);
+ if(!success)
{
- // make sure it's a two array
- if(day_data[i].size() != 2)
+ // *HACK: If loading region day cycle, try local sky presets as well.
+ // Local presets may be referenced by a region day cycle after
+ // it has been edited but the changes have not been uploaded.
+ if (scope == LLEnvKey::SCOPE_REGION)
{
- continue;
+ frame.scope = LLEnvKey::SCOPE_LOCAL;
+ success = LLWLParamManager::getInstance()->getParamSet(frame, pset);
}
-
- // check each param name exists in param manager
- bool success;
- LLWLParamSet pset;
- success = LLWLParamManager::instance()->getParamSet(day_data[i][1].asString(), pset);
- if(!success)
+
+ if (!success)
{
// alert the user
LLSD args;
args["SKY"] = day_data[i][1].asString();
- LLNotificationsUtil::add("WLMissingSky", args);
+ LLNotifications::instance().add("WLMissingSky", args, LLSD());
continue;
}
-
- // then add the key
- addKey((F32)day_data[i][0].asReal(), day_data[i][1].asString());
}
+
+ // then add the keyframe
+ addKeyframe((F32)day_data[i][0].asReal(), frame);
+ }
+}
+
+void LLWLDayCycle::loadDayCycleFromFile(const std::string & fileName)
+{
+ loadDayCycle(loadCycleDataFromFile(fileName), LLWLParamKey::SCOPE_LOCAL);
+}
+/*static*/ LLSD LLWLDayCycle::loadCycleDataFromFile(const std::string & fileName)
+{
+ // *FIX: Cannot load user day cycles.
+ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
+ "windlight/days", fileName));
+
+ return loadDayCycleFromPath(pathName);
+}
+
+// static
+LLSD LLWLDayCycle::loadDayCycleFromPath(const std::string& file_path)
+{
+ LL_INFOS("Windlight") << "Loading DayCycle settings from " << file_path << LL_ENDL;
+
+ llifstream day_cycle_xml(file_path);
+ if (day_cycle_xml.is_open())
+ {
+ // load and parse it
+ LLSD day_data(LLSD::emptyArray());
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED);
day_cycle_xml.close();
+ return day_data;
+ }
+ else
+ {
+ return LLSD();
}
}
void LLWLDayCycle::saveDayCycle(const std::string & fileName)
{
- LLSD day_data(LLSD::emptyArray());
-
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName));
//llinfos << "Saving WindLight settings to " << pathName << llendl;
- for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin();
- mIt != mTimeMap.end();
- ++mIt)
+ save(pathName);
+}
+
+void LLWLDayCycle::save(const std::string& file_path)
+{
+ LLSD day_data = asLLSD();
+
+ llofstream day_cycle_xml(file_path);
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
+ day_cycle_xml.close();
+}
+
+LLSD LLWLDayCycle::asLLSD()
+{
+ LLSD day_data(LLSD::emptyArray());
+ for(std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin(); mIt != mTimeMap.end(); ++mIt)
{
LLSD key(LLSD::emptyArray());
key.append(mIt->first);
- key.append(mIt->second);
+ key.append(mIt->second.name);
day_data.append(key);
}
- llofstream day_cycle_xml(pathName);
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
- day_cycle_xml.close();
+ lldebugs << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << llendl;
+ return day_data;
}
+bool LLWLDayCycle::getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const
+{
+ bool result = true;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+
+ refs.clear();
+ for (std::map<F32, LLWLParamKey>::const_iterator iter = mTimeMap.begin(); iter != mTimeMap.end(); ++iter)
+ {
+ const LLWLParamKey& key = iter->second;
+ if (!wl_mgr.getParamSet(key, refs[key]))
+ {
+ llwarns << "Cannot find sky [" << key.name << "] referenced by a day cycle" << llendl;
+ result = false;
+ }
+ }
+
+ return result;
+}
-void LLWLDayCycle::clearKeys()
+bool LLWLDayCycle::getSkyMap(LLSD& sky_map) const
{
+ std::map<LLWLParamKey, LLWLParamSet> refs;
+
+ if (!getSkyRefs(refs))
+ {
+ return false;
+ }
+
+ sky_map = LLWLParamManager::createSkyMap(refs);
+ return true;
+}
+
+void LLWLDayCycle::clearKeyframes()
+{
+ lldebugs << "Clearing key frames" << llendl;
mTimeMap.clear();
}
-bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName)
+bool LLWLDayCycle::addKeyframe(F32 newTime, LLWLParamKey frame)
{
// no adding negative time
if(newTime < 0)
@@ -134,48 +209,58 @@ bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName)
// if time not being used, add it and return true
if(mTimeMap.find(newTime) == mTimeMap.end())
{
- mTimeMap.insert(std::pair<F32, std::string>(newTime, paramName));
+ mTimeMap.insert(std::pair<F32, LLWLParamKey>(newTime, frame));
+ lldebugs << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl;
return true;
}
// otherwise, don't add, and return error
+ llwarns << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl;
return false;
}
-bool LLWLDayCycle::changeKeyTime(F32 oldTime, F32 newTime)
+bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime)
{
+ lldebugs << "Changing key frame time (" << oldTime << " => " << newTime << ")" << llendl;
+
// just remove and add back
- std::string name = mTimeMap[oldTime];
+ LLWLParamKey frame = mTimeMap[oldTime];
- bool stat = removeKey(oldTime);
+ bool stat = removeKeyframe(oldTime);
if(stat == false)
{
+ lldebugs << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << llendl;
return stat;
}
- return addKey(newTime, name);
+ return addKeyframe(newTime, frame);
}
-bool LLWLDayCycle::changeKeyParam(F32 time, const std::string & name)
+bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key)
{
+ lldebugs << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << llendl;
+
// just remove and add back
// make sure param exists
LLWLParamSet tmp;
- bool stat = LLWLParamManager::instance()->getParamSet(name, tmp);
+ bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp);
if(stat == false)
{
+ lldebugs << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << llendl;
return stat;
}
- mTimeMap[time] = name;
+ mTimeMap[time] = key;
return true;
}
-bool LLWLDayCycle::removeKey(F32 time)
+bool LLWLDayCycle::removeKeyframe(F32 time)
{
+ lldebugs << "Removing key frame (" << time << ")" << llendl;
+
// look for the time. If there, erase it
- std::map<F32, std::string>::iterator mIt = mTimeMap.find(time);
+ std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
if(mIt != mTimeMap.end())
{
mTimeMap.erase(mIt);
@@ -185,15 +270,15 @@ bool LLWLDayCycle::removeKey(F32 time)
return false;
}
-bool LLWLDayCycle::getKey(const std::string & name, F32& key)
+bool LLWLDayCycle::getKeytime(LLWLParamKey frame, F32& key_time) const
{
- // scroll through till we find the
- std::map<F32, std::string>::iterator mIt = mTimeMap.begin();
+ // scroll through till we find the correct value in the map
+ std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin();
for(; mIt != mTimeMap.end(); ++mIt)
{
- if(name == mIt->second)
+ if(frame == mIt->second)
{
- key = mIt->first;
+ key_time = mIt->first;
return true;
}
}
@@ -204,26 +289,52 @@ bool LLWLDayCycle::getKey(const std::string & name, F32& key)
bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param)
{
// just scroll on through till you find it
- std::map<F32, std::string>::iterator mIt = mTimeMap.find(time);
- if(mIt != mTimeMap.end())
+ std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
+ if(mIt != mTimeMap.end())
{
- return LLWLParamManager::instance()->getParamSet(mIt->second, param);
+ return LLWLParamManager::getInstance()->getParamSet(mIt->second, param);
}
// return error if not found
+ lldebugs << "Key " << time << " not found" << llendl;
return false;
}
bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name)
{
// just scroll on through till you find it
- std::map<F32, std::string>::iterator mIt = mTimeMap.find(time);
+ std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
if(mIt != mTimeMap.end())
{
- name = mTimeMap[time];
+ name = mTimeMap[time].name;
return true;
}
// return error if not found
+ lldebugs << "Key " << time << " not found" << llendl;
return false;
}
+
+bool LLWLDayCycle::hasReferencesTo(const LLWLParamKey& keyframe) const
+{
+ F32 dummy;
+ return getKeytime(keyframe, dummy);
+}
+
+void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe)
+{
+ lldebugs << "Removing references to key frame " << keyframe.toLLSD() << llendl;
+ F32 keytime;
+ bool might_exist;
+ do
+ {
+ // look for it
+ might_exist = getKeytime(keyframe, keytime);
+ if(!might_exist)
+ {
+ return;
+ }
+ might_exist = removeKeyframe(keytime);
+
+ } while(might_exist); // might be another one
+}
diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h
index 5cbf72191d..c8585564ed 100644
--- a/indra/newview/llwldaycycle.h
+++ b/indra/newview/llwldaycycle.h
@@ -34,13 +34,16 @@ class LLWLDayCycle;
#include <string>
#include "llwlparamset.h"
#include "llwlanimator.h"
+struct LLWLParamKey;
+#include "llenvmanager.h" // for LLEnvKey::EScope
class LLWLDayCycle
{
+ LOG_CLASS(LLWLDayCycle);
public:
// lists what param sets are used when during the day
- std::map<F32, std::string> mTimeMap;
+ std::map<F32, LLWLParamKey> mTimeMap;
// how long is my day
F32 mDayRate;
@@ -54,35 +57,56 @@ public:
~LLWLDayCycle();
/// load a day cycle
- void loadDayCycle(const std::string & fileName);
+ void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope);
/// load a day cycle
+ void loadDayCycleFromFile(const std::string & fileName);
+
+ /// save a day cycle
void saveDayCycle(const std::string & fileName);
- /// clear keys
- void clearKeys();
+ /// save a day cycle
+ void save(const std::string& file_path);
+
+ /// load the LLSD data from a file (returns the undefined LLSD if not found)
+ static LLSD loadCycleDataFromFile(const std::string & fileName);
+
+ /// load the LLSD data from a file specified by full path
+ static LLSD loadDayCycleFromPath(const std::string& file_path);
+
+ /// get the LLSD data for this day cycle
+ LLSD asLLSD();
+
+ // get skies referenced by this day cycle
+ bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const;
+
+ // get referenced skies as LLSD
+ bool getSkyMap(LLSD& sky_map) const;
+
+ /// clear keyframes
+ void clearKeyframes();
/// Getters and Setters
/// add a new key frame to the day cycle
/// returns true if successful
/// no negative time
- bool addKey(F32 newTime, const std::string & paramName);
+ bool addKeyframe(F32 newTime, LLWLParamKey key);
- /// adjust a key's placement in the day cycle
+ /// adjust a keyframe's placement in the day cycle
/// returns true if successful
- bool changeKeyTime(F32 oldTime, F32 newTime);
+ bool changeKeyframeTime(F32 oldTime, F32 newTime);
- /// adjust a key's parameter used
+ /// adjust a keyframe's parameter used
/// returns true if successful
- bool changeKeyParam(F32 time, const std::string & paramName);
+ bool changeKeyframeParam(F32 time, LLWLParamKey key);
- /// remove a key from the day cycle
+ /// remove a key frame from the day cycle
/// returns true if successful
- bool removeKey(F32 time);
+ bool removeKeyframe(F32 time);
/// get the first key time for a parameter
/// returns false if not there
- bool getKey(const std::string & name, F32& key);
+ bool getKeytime(LLWLParamKey keyFrame, F32& keyTime) const;
/// get the param set at a given time
/// returns true if found one
@@ -92,6 +116,12 @@ public:
/// returns true if it found one
bool getKeyedParamName(F32 time, std::string & name);
+ /// @return true if there are references to the given sky
+ bool hasReferencesTo(const LLWLParamKey& keyframe) const;
+
+ /// removes all references to the sky (paramkey)
+ /// does nothing if the sky doesn't exist in the day
+ void removeReferencesTo(const LLWLParamKey& keyframe);
};
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
new file mode 100644
index 0000000000..b5f53232cc
--- /dev/null
+++ b/indra/newview/llwlhandlers.cpp
@@ -0,0 +1,203 @@
+/**
+ * @file llwlhandlers.cpp
+ * @brief Various classes which handle Windlight-related messaging
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llwlhandlers.h"
+
+#include "llagent.h"
+#include "llviewerregion.h"
+#include "llenvmanager.h"
+#include "llnotificationsutil.h"
+
+/****
+ * LLEnvironmentRequest
+ ****/
+// static
+bool LLEnvironmentRequest::initiate()
+{
+ LLViewerRegion* cur_region = gAgent.getRegion();
+
+ if (!cur_region)
+ {
+ LL_WARNS("WindlightCaps") << "Viewer region not set yet, skipping env. settings request" << LL_ENDL;
+ return false;
+ }
+
+ if (!cur_region->capabilitiesReceived())
+ {
+ LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
+ cur_region->setCapabilitiesReceivedCallback(boost::bind(&LLEnvironmentRequest::onRegionCapsReceived, _1));
+ return false;
+ }
+
+ return doRequest();
+}
+
+// static
+void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id)
+{
+ if (region_id != gAgent.getRegion()->getRegionID())
+ {
+ LL_INFOS("WindlightCaps") << "Got caps for a non-current region" << LL_ENDL;
+ return;
+ }
+
+ LL_DEBUGS("WindlightCaps") << "Received region capabilities" << LL_ENDL;
+ doRequest();
+}
+
+// static
+bool LLEnvironmentRequest::doRequest()
+{
+ std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings");
+ if (url.empty())
+ {
+ LL_INFOS("WindlightCaps") << "Skipping windlight setting request - we don't have this capability" << LL_ENDL;
+ // region is apparently not capable of this; don't respond at all
+ return false;
+ }
+
+ LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL;
+ LLHTTPClient::get(url, new LLEnvironmentRequestResponder());
+ return true;
+}
+
+/****
+ * LLEnvironmentRequestResponder
+ ****/
+int LLEnvironmentRequestResponder::sCount = 0; // init to 0
+
+LLEnvironmentRequestResponder::LLEnvironmentRequestResponder()
+{
+ mID = ++sCount;
+}
+/*virtual*/ void LLEnvironmentRequestResponder::result(const LLSD& unvalidated_content)
+{
+ LL_INFOS("WindlightCaps") << "Received region windlight settings" << LL_ENDL;
+
+ if (mID != sCount)
+ {
+ LL_INFOS("WindlightCaps") << "Got superseded by another responder; ignoring..." << LL_ENDL;
+ return;
+ }
+
+ if (unvalidated_content[0]["regionID"].asUUID() != gAgent.getRegion()->getRegionID())
+ {
+ LL_WARNS("WindlightCaps") << "Not in the region from where this data was received (wanting "
+ << gAgent.getRegion()->getRegionID() << " but got " << unvalidated_content[0]["regionID"].asUUID()
+ << ") - ignoring..." << LL_ENDL;
+ return;
+ }
+
+ LLEnvManagerNew::getInstance()->onRegionSettingsResponse(unvalidated_content);
+}
+/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason)
+{
+ LL_INFOS("WindlightCaps") << "Got an error, not using region windlight..." << LL_ENDL;
+ LLEnvManagerNew::getInstance()->onRegionSettingsResponse(LLSD());
+}
+
+/****
+ * LLEnvironmentApply
+ ****/
+
+clock_t LLEnvironmentApply::UPDATE_WAIT_SECONDS = clock_t(3.f);
+clock_t LLEnvironmentApply::sLastUpdate = clock_t(0.f);
+
+// static
+bool LLEnvironmentApply::initiateRequest(const LLSD& content)
+{
+ clock_t current = clock();
+
+ // Make sure we don't update too frequently.
+ if (current < sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC))
+ {
+ LLSD args(LLSD::emptyMap());
+ args["WAIT"] = (F64)UPDATE_WAIT_SECONDS;
+ LLNotificationsUtil::add("EnvUpdateRate", args);
+ return false;
+ }
+
+ sLastUpdate = current;
+
+ // Send update request.
+ std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings");
+ if (url.empty())
+ {
+ LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
+ return false;
+ }
+
+ LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
+ LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
+ LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder());
+ return true;
+}
+
+/****
+ * LLEnvironmentApplyResponder
+ ****/
+/*virtual*/ void LLEnvironmentApplyResponder::result(const LLSD& content)
+{
+ if (content["regionID"].asUUID() != gAgent.getRegion()->getRegionID())
+ {
+ LL_WARNS("WindlightCaps") << "No longer in the region where data was sent (currently "
+ << gAgent.getRegion()->getRegionID() << ", reply is from " << content["regionID"].asUUID()
+ << "); ignoring..." << LL_ENDL;
+ return;
+ }
+ else if (content["success"].asBoolean())
+ {
+ LL_DEBUGS("WindlightCaps") << "Success in applying windlight settings to region " << content["regionID"].asUUID() << LL_ENDL;
+ LLEnvManagerNew::instance().onRegionSettingsApplyResponse(true);
+ }
+ else
+ {
+ LL_WARNS("WindlightCaps") << "Region couldn't apply windlight settings! Reason from sim: " << content["fail_reason"].asString() << LL_ENDL;
+ LLSD args(LLSD::emptyMap());
+ args["FAIL_REASON"] = content["fail_reason"].asString();
+ LLNotificationsUtil::add("WLRegionApplyFail", args);
+ LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+ }
+}
+/*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason)
+{
+ std::stringstream msg;
+ msg << reason << " (Code " << status << ")";
+
+ LL_WARNS("WindlightCaps") << "Couldn't apply windlight settings to region! Reason: " << msg << LL_ENDL;
+
+ LLSD args(LLSD::emptyMap());
+ args["FAIL_REASON"] = msg.str();
+ LLNotificationsUtil::add("WLRegionApplyFail", args);
+}
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
new file mode 100644
index 0000000000..b5eb62b0b0
--- /dev/null
+++ b/indra/newview/llwlhandlers.h
@@ -0,0 +1,109 @@
+/**
+ * @file llwlhandlers.h
+ * @brief Headers for classes in llwlhandlers.cpp
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLWLHANDLERS_H
+#define LL_LLWLHANDLERS_H
+
+#include "llviewerprecompiledheaders.h"
+#include "llhttpclient.h"
+
+class LLEnvManager;
+
+class LLEnvironmentRequest
+{
+ LOG_CLASS(LLEnvironmentRequest);
+public:
+ /// @return true if request was successfully sent
+ static bool initiate();
+
+private:
+ static void onRegionCapsReceived(const LLUUID& region_id);
+ static bool doRequest();
+};
+
+class LLEnvironmentRequestResponder: public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLEnvironmentRequestResponder);
+public:
+ virtual void result(const LLSD& content);
+ virtual void error(U32 status, const std::string& reason);
+
+private:
+ friend class LLEnvironmentRequest;
+ friend class LLEnvManager;
+
+ LLEnvironmentRequestResponder();
+ static int sCount;
+ int mID;
+};
+
+class LLEnvironmentApply
+{
+ LOG_CLASS(LLEnvironmentApply);
+public:
+ /// @return true if request was successfully sent
+ static bool initiateRequest(const LLSD& content);
+
+private:
+ static clock_t sLastUpdate;
+ static clock_t UPDATE_WAIT_SECONDS;
+};
+
+class LLEnvironmentApplyResponder: public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLEnvironmentApplyResponder);
+public:
+ /*
+ * Expecting reply from sim in form of:
+ * {
+ * regionID : uuid,
+ * messageID: uuid,
+ * success : true
+ * }
+ * or
+ * {
+ * regionID : uuid,
+ * success : false,
+ * fail_reason : string
+ * }
+ */
+ virtual void result(const LLSD& content);
+
+ virtual void error(U32 status, const std::string& reason); // non-200 errors only
+
+private:
+ friend class LLEnvironmentApply;
+
+ LLEnvironmentApplyResponder() {}
+};
+
+#endif // LL_LLWLHANDLERS_H
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 848efcbb49..f475b3da01 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -37,23 +37,32 @@
#include "llspinctrl.h"
#include "llcheckboxctrl.h"
#include "lluictrlfactory.h"
+#include "llviewercamera.h"
#include "llcombobox.h"
#include "lllineeditor.h"
#include "llsdserialize.h"
#include "v4math.h"
+#include "llviewerdisplay.h"
#include "llviewercontrol.h"
+#include "llviewerwindow.h"
+#include "lldrawpoolwater.h"
+#include "llagent.h"
+#include "llviewerregion.h"
+#include "lldaycyclemanager.h"
+#include "llenvmanager.h"
#include "llwlparamset.h"
#include "llpostprocess.h"
+
#include "llfloaterwindlight.h"
#include "llfloaterdaycycle.h"
#include "llfloaterenvsettings.h"
+#include "llviewershadermgr.h"
+#include "llglslshader.h"
#include "curl/curl.h"
-
-LLWLParamManager * LLWLParamManager::sInstance = NULL;
-static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params");
+#include "llstreamtools.h"
LLWLParamManager::LLWLParamManager() :
@@ -96,161 +105,237 @@ LLWLParamManager::~LLWLParamManager()
{
}
-void LLWLParamManager::loadPresets(const std::string& file_name)
+void LLWLParamManager::clearParamSetsOfScope(LLWLParamKey::EScope scope)
{
- std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL;
-
- bool found = true;
- LLDirIterator app_settings_iter(path_name, "*.xml");
- while(found)
+ if (LLWLParamKey::SCOPE_LOCAL == scope)
{
- std::string name;
- found = app_settings_iter.next(name);
- if(found)
- {
-
- name=name.erase(name.length()-4);
-
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_unescape(name.c_str(), name.size());
- std::string unescaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
+ LL_WARNS("Windlight") << "Tried to clear windlight sky presets from local system! This shouldn't be called..." << LL_ENDL;
+ return;
+ }
- LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
- loadPreset(unescaped_name,FALSE);
+ std::set<LLWLParamKey> to_remove;
+ for(std::map<LLWLParamKey, LLWLParamSet>::iterator iter = mParamList.begin(); iter != mParamList.end(); ++iter)
+ {
+ if(iter->first.scope == scope)
+ {
+ to_remove.insert(iter->first);
}
}
- // And repeat for user presets, note the user presets will modify any system presets already loaded
+ for(std::set<LLWLParamKey>::iterator iter = to_remove.begin(); iter != to_remove.end(); ++iter)
+ {
+ mParamList.erase(*iter);
+ }
+}
- std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL;
-
- found = true;
- LLDirIterator user_settings_iter(path_name2, "*.xml");
- while(found)
+// returns all skies referenced by the day cycle, with their final names
+// side effect: applies changes to all internal structures!
+std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWLParamKey::EScope scope)
+{
+ lldebugs << "mDay before finalizing:" << llendl;
{
- std::string name;
- found = user_settings_iter.next(name);
- if(found)
+ for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter)
{
- name=name.erase(name.length()-4);
+ LLWLParamKey& key = iter->second;
+ lldebugs << iter->first << "->" << key.name << llendl;
+ }
+ }
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_unescape(name.c_str(), name.size());
- std::string unescaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
+ std::map<LLWLParamKey, LLWLParamSet> final_references;
- LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
- loadPreset(unescaped_name,FALSE);
+ // Move all referenced to desired scope, renaming if necessary
+ // First, save skies referenced
+ std::map<LLWLParamKey, LLWLParamSet> current_references; // all skies referenced by the day cycle, with their current names
+ // guard against skies with same name and different scopes
+ std::set<std::string> inserted_names;
+ std::map<std::string, unsigned int> conflicted_names; // integer later used as a count, for uniquely renaming conflicts
+
+ LLWLDayCycle& cycle = mDay;
+ for(std::map<F32, LLWLParamKey>::iterator iter = cycle.mTimeMap.begin();
+ iter != cycle.mTimeMap.end();
+ ++iter)
+ {
+ LLWLParamKey& key = iter->second;
+ std::string desired_name = key.name;
+ replace_newlines_with_whitespace(desired_name); // already shouldn't have newlines, but just in case
+ if(inserted_names.find(desired_name) == inserted_names.end())
+ {
+ inserted_names.insert(desired_name);
+ }
+ else
+ {
+ // make exist in map
+ conflicted_names[desired_name] = 0;
}
+ current_references[key] = mParamList[key];
}
-}
+ // forget all old skies in target scope, and rebuild, renaming as needed
+ clearParamSetsOfScope(scope);
+ for(std::map<LLWLParamKey, LLWLParamSet>::iterator iter = current_references.begin(); iter != current_references.end(); ++iter)
+ {
+ const LLWLParamKey& old_key = iter->first;
-void LLWLParamManager::savePresets(const std::string & fileName)
-{
- //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder
- //and not over the RO system wide version.
+ std::string desired_name(old_key.name);
+ replace_newlines_with_whitespace(desired_name);
- LLSD paramsData(LLSD::emptyMap());
-
- std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName));
+ LLWLParamKey new_key(desired_name, scope); // name will be replaced later if necessary
- for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin();
- mIt != mParamList.end();
- ++mIt)
- {
- paramsData[mIt->first] = mIt->second.getAll();
- }
+ // if this sky is one with a non-unique name, rename via appending a number
+ // an existing preset of the target scope gets to keep its name
+ if (scope != old_key.scope && conflicted_names.find(desired_name) != conflicted_names.end())
+ {
+ std::string& new_name = new_key.name;
- llofstream presetsXML(pathName);
+ do
+ {
+ // if this executes more than once, this is an absurdly pathological case
+ // (e.g. "x" repeated twice, but "x 1" already exists, so need to use "x 2")
+ std::stringstream temp;
+ temp << desired_name << " " << (++conflicted_names[desired_name]);
+ new_name = temp.str();
+ } while (inserted_names.find(new_name) != inserted_names.end());
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ // yay, found one that works
+ inserted_names.insert(new_name); // track names we consume here; shouldn't be necessary due to ++int? but just in case
- formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
+ // *TODO factor out below into a rename()?
- presetsXML.close();
-}
+ LL_INFOS("Windlight") << "Renamed " << old_key.name << " (scope" << old_key.scope << ") to "
+ << new_key.name << " (scope " << new_key.scope << ")" << LL_ENDL;
-void LLWLParamManager::loadPreset(const std::string & name,bool propagate)
-{
-
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_filename(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
+ // update name in sky
+ iter->second.mName = new_name;
+
+ // update keys in day cycle
+ for(std::map<F32, LLWLParamKey>::iterator frame = cycle.mTimeMap.begin(); frame != cycle.mTimeMap.end(); ++frame)
+ {
+ if (frame->second == old_key)
+ {
+ frame->second = new_key;
+ }
+ }
- escaped_filename += ".xml";
+ // add to master sky map
+ mParamList[new_key] = iter->second;
+ }
- std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename));
- LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL;
+ final_references[new_key] = iter->second;
+ }
- llifstream presetsXML;
- presetsXML.open(pathName.c_str());
+ lldebugs << "mDay after finalizing:" << llendl;
+ {
+ for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter)
+ {
+ LLWLParamKey& key = iter->second;
+ lldebugs << iter->first << "->" << key.name << llendl;
+ }
+ }
- // That failed, try loading from the users area instead.
- if(!presetsXML)
+ return final_references;
+}
+
+// static
+LLSD LLWLParamManager::createSkyMap(std::map<LLWLParamKey, LLWLParamSet> refs)
+{
+ LLSD skies = LLSD::emptyMap();
+ for(std::map<LLWLParamKey, LLWLParamSet>::iterator iter = refs.begin(); iter != refs.end(); ++iter)
{
- pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename);
- LL_DEBUGS2("AppInit", "Shaders") << "Loading User WindLight sky setting from " << pathName << LL_ENDL;
- presetsXML.clear();
- presetsXML.open(pathName.c_str());
+ skies.insert(iter->first.name, iter->second.getAll());
}
+ return skies;
+}
- if (presetsXML)
+void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD& sky_presets)
+{
+ for(LLSD::map_const_iterator iter = sky_presets.beginMap(); iter != sky_presets.endMap(); ++iter)
{
- LLSD paramsData(LLSD::emptyMap());
+ LLWLParamSet set;
+ set.setAll(iter->second);
+ mParamList[LLWLParamKey(iter->first, scope)] = set;
+ }
+}
+
+void LLWLParamManager::refreshRegionPresets()
+{
+ // Remove all region sky presets because they may belong to a previously visited region.
+ clearParamSetsOfScope(LLEnvKey::SCOPE_REGION);
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ // Add all sky presets belonging to the current region.
+ addAllSkies(LLEnvKey::SCOPE_REGION, LLEnvManagerNew::instance().getRegionSettings().getSkyMap());
+}
- parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED);
+void LLWLParamManager::loadAllPresets()
+{
+ // First, load system (coming out of the box) sky presets.
+ loadPresetsFromDir(getSysDir());
- std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name);
- if(mIt == mParamList.end())
+ // Then load user presets. Note that user day presets will modify any system ones already loaded.
+ loadPresetsFromDir(getUserDir());
+}
+
+void LLWLParamManager::loadPresetsFromDir(const std::string& dir)
+{
+ LL_INFOS2("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL;
+
+ LLDirIterator dir_iter(dir, "*.xml");
+ while (1)
+ {
+ std::string file;
+ if (!dir_iter.next(file))
{
- addParamSet(name, paramsData);
+ break; // no more files
}
- else
+
+ std::string path = dir + file;
+ if (!loadPreset(path))
{
- setParamSet(name, paramsData);
+ llwarns << "Error loading sky preset from " << path << llendl;
}
- presetsXML.close();
- }
- else
+ }
+}
+
+bool LLWLParamManager::loadPreset(const std::string& path)
+{
+ llifstream xml_file;
+ std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
+
+ xml_file.open(path.c_str());
+ if (!xml_file)
{
- llwarns << "Can't find " << name << llendl;
- return;
+ return false;
}
-
- if(propagate)
+ LL_DEBUGS2("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL;
+
+ LLSD params_data;
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED);
+ xml_file.close();
+
+ LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL);
+ if (hasParamSet(key))
+ {
+ setParamSet(key, params_data);
+ }
+ else
{
- getParamSet(name, mCurParams);
- propagateParameters();
+ addParamSet(key, params_data);
}
-}
-void LLWLParamManager::savePreset(const std::string & name)
-{
- // bugfix for SL-46920: preventing filenames that break stuff.
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_filename(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
+ return true;
+}
- escaped_filename += ".xml";
+void LLWLParamManager::savePreset(LLWLParamKey key)
+{
+ llassert(key.scope == LLEnvKey::SCOPE_LOCAL && !key.name.empty());
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
- std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename));
+ std::string pathName(getUserDir() + escapeString(key.name) + ".xml");
// fill it with LLSD windlight params
- paramsData = mParamList[name].getAll();
+ paramsData = mParamList[key].getAll();
// write to file
llofstream presetsXML(pathName);
@@ -283,6 +368,8 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader)
}
+static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params");
+
void LLWLParamManager::propagateParameters(void)
{
LLFastTimer ftm(FTM_UPDATE_WLPARAM);
@@ -362,7 +449,7 @@ void LLWLParamManager::update(LLViewerCamera * cam)
mCurParams.updateCloudScrolling();
// update only if running
- if(mAnimator.mIsRunning)
+ if(mAnimator.getIsRunning())
{
mAnimator.update(mCurParams);
}
@@ -381,7 +468,7 @@ void LLWLParamManager::update(LLViewerCamera * cam)
{
dlfloater->syncMenu();
}
- LLFloaterEnvSettings* envfloater = LLFloaterReg::findTypedInstance<LLFloaterEnvSettings>("env_settings");
+ LLFloaterEnvSettings* envfloater = LLFloaterReg::findTypedInstance<LLFloaterEnvSettings>("old_env_settings");
if (envfloater)
{
envfloater->syncMenu();
@@ -389,12 +476,14 @@ void LLWLParamManager::update(LLViewerCamera * cam)
F32 camYaw = cam->getYaw();
+ stop_glerror();
+
// *TODO: potential optimization - this block may only need to be
// executed some of the time. For example for water shaders only.
{
F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD;
- LLVector3 lightNorm3(mLightDir);
+ LLVector3 lightNorm3(mLightDir);
lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f));
mRotatedLightDir = LLVector4(lightNorm3, 0.f);
@@ -412,17 +501,18 @@ void LLWLParamManager::update(LLViewerCamera * cam)
}
}
-// static
-void LLWLParamManager::initClass(void)
+bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time)
{
- instance();
+ mDay.loadDayCycle(params, scope);
+ resetAnimator(time, true); // set to specified time and start animator
+ return true;
}
-// static
-void LLWLParamManager::cleanupClass()
+bool LLWLParamManager::applySkyParams(const LLSD& params)
{
- delete sInstance;
- sInstance = NULL;
+ mAnimator.deactivate();
+ mCurParams.setAll(params);
+ return true;
}
void LLWLParamManager::resetAnimator(F32 curTime, bool run)
@@ -432,133 +522,227 @@ void LLWLParamManager::resetAnimator(F32 curTime, bool run)
return;
}
-bool LLWLParamManager::addParamSet(const std::string& name, LLWLParamSet& param)
+
+bool LLWLParamManager::addParamSet(const LLWLParamKey& key, LLWLParamSet& param)
{
// add a new one if not one there already
- std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name);
+ std::map<LLWLParamKey, LLWLParamSet>::iterator mIt = mParamList.find(key);
if(mIt == mParamList.end())
{
- mParamList[name] = param;
+ llassert(!key.name.empty());
+ // *TODO: validate params
+ mParamList[key] = param;
+ mPresetListChangeSignal();
return true;
}
return false;
}
-BOOL LLWLParamManager::addParamSet(const std::string& name, LLSD const & param)
+BOOL LLWLParamManager::addParamSet(const LLWLParamKey& key, LLSD const & param)
{
- // add a new one if not one there already
- std::map<std::string, LLWLParamSet>::const_iterator finder = mParamList.find(name);
- if(finder == mParamList.end())
- {
- mParamList[name].setAll(param);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ LLWLParamSet param_set;
+ param_set.setAll(param);
+ return addParamSet(key, param_set);
}
-bool LLWLParamManager::getParamSet(const std::string& name, LLWLParamSet& param)
+bool LLWLParamManager::getParamSet(const LLWLParamKey& key, LLWLParamSet& param)
{
// find it and set it
- std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name);
+ std::map<LLWLParamKey, LLWLParamSet>::iterator mIt = mParamList.find(key);
if(mIt != mParamList.end())
{
- param = mParamList[name];
- param.mName = name;
+ param = mParamList[key];
+ param.mName = key.name;
return true;
}
return false;
}
-bool LLWLParamManager::setParamSet(const std::string& name, LLWLParamSet& param)
+bool LLWLParamManager::hasParamSet(const LLWLParamKey& key)
{
- mParamList[name] = param;
+ LLWLParamSet dummy;
+ return getParamSet(key, dummy);
+}
+
+bool LLWLParamManager::setParamSet(const LLWLParamKey& key, LLWLParamSet& param)
+{
+ llassert(!key.name.empty());
+ // *TODO: validate params
+ mParamList[key] = param;
return true;
}
-bool LLWLParamManager::setParamSet(const std::string& name, const LLSD & param)
+bool LLWLParamManager::setParamSet(const LLWLParamKey& key, const LLSD & param)
{
+ llassert(!key.name.empty());
+ // *TODO: validate params
+
// quick, non robust (we won't be working with files, but assets) check
+ // this might not actually be true anymore....
if(!param.isMap())
{
return false;
}
- mParamList[name].setAll(param);
-
- return true;
+ LLWLParamSet param_set;
+ param_set.setAll(param);
+ return setParamSet(key, param_set);
}
-bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_disk)
+void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_disk)
{
+ // *NOTE: Removing a sky preset invalidates day cycles that refer to it.
+
+ if (key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ llwarns << "Removing region skies not supported" << llendl;
+ llassert(key.scope == LLEnvKey::SCOPE_LOCAL);
+ return;
+ }
+
// remove from param list
- std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name);
- if(mIt != mParamList.end())
+ std::map<LLWLParamKey, LLWLParamSet>::iterator it = mParamList.find(key);
+ if (it == mParamList.end())
{
- mParamList.erase(mIt);
+ LL_WARNS("WindLight") << "No sky preset named " << key.name << LL_ENDL;
+ return;
}
- F32 key;
+ mParamList.erase(it);
+ mDay.removeReferencesTo(key);
- // remove all references
- bool stat = true;
- do
+ // remove from file system if requested
+ if (delete_from_disk)
{
- // get it
- stat = mDay.getKey(name, key);
- if(stat == false)
+ std::string path_name(getUserDir());
+ std::string escaped_name = escapeString(key.name);
+
+ if(gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml") < 1)
{
- break;
+ LL_WARNS("WindLight") << "Error removing sky preset " << key.name << " from disk" << LL_ENDL;
}
+ }
- // and remove
- stat = mDay.removeKey(key);
+ // signal interested parties
+ mPresetListChangeSignal();
+}
- } while(stat == true);
-
- if(delete_from_disk)
+bool LLWLParamManager::isSystemPreset(const std::string& preset_name) const
+{
+ // *TODO: file system access is excessive here.
+ return gDirUtilp->fileExists(getSysDir() + escapeString(preset_name) + ".xml");
+}
+
+void LLWLParamManager::getPresetNames(preset_name_list_t& region, preset_name_list_t& user, preset_name_list_t& sys) const
+{
+ region.clear();
+ user.clear();
+ sys.clear();
+
+ for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = mParamList.begin(); it != mParamList.end(); it++)
{
- std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
-
- // use full curl escaped name
- char * curl_str = curl_escape(name.c_str(), name.size());
- std::string escaped_name(curl_str);
- curl_free(curl_str);
- curl_str = NULL;
-
- gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml");
- }
+ const LLWLParamKey& key = it->first;
+ const std::string& name = key.name;
- return true;
+ if (key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ region.push_back(name);
+ }
+ else
+ {
+ if (isSystemPreset(name))
+ {
+ sys.push_back(name);
+ }
+ else
+ {
+ user.push_back(name);
+ }
+ }
+ }
}
+void LLWLParamManager::getUserPresetNames(preset_name_list_t& user) const
+{
+ preset_name_list_t region, sys; // unused
+ getPresetNames(region, user, sys);
+}
-// static
-LLWLParamManager * LLWLParamManager::instance()
+void LLWLParamManager::getPresetKeys(preset_key_list_t& keys) const
{
- if(NULL == sInstance)
+ keys.clear();
+
+ for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = mParamList.begin(); it != mParamList.end(); it++)
{
- sInstance = new LLWLParamManager();
+ keys.push_back(it->first);
+ }
+}
+
+boost::signals2::connection LLWLParamManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb)
+{
+ return mPresetListChangeSignal.connect(cb);
+}
+
+// virtual static
+void LLWLParamManager::initSingleton()
+{
+ LL_DEBUGS("Windlight") << "Initializing sky" << LL_ENDL;
- sInstance->loadPresets(LLStringUtil::null);
+ loadAllPresets();
- // load the day
- sInstance->mDay.loadDayCycle(std::string("Default.xml"));
+ // load the day
+ std::string preferred_day = LLEnvManagerNew::instance().getDayCycleName();
+ if (!LLDayCycleManager::instance().getPreset(preferred_day, mDay))
+ {
+ // Fall back to default.
+ llwarns << "No day cycle named " << preferred_day << ", falling back to defaults" << llendl;
+ mDay.loadDayCycleFromFile("Default.xml");
- // *HACK - sets cloud scrolling to what we want... fix this better in the future
- sInstance->getParamSet("Default", sInstance->mCurParams);
+ // *TODO: Fix user preferences accordingly.
+ }
- // set it to noon
- sInstance->resetAnimator(0.5, true);
+ // *HACK - sets cloud scrolling to what we want... fix this better in the future
+ std::string sky = LLEnvManagerNew::instance().getSkyPresetName();
+ if (!getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams))
+ {
+ llwarns << "No sky preset named " << sky << ", falling back to defaults" << llendl;
+ getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams);
- // but use linden time sets it to what the estate is
- sInstance->mAnimator.mUseLindenTime = true;
+ // *TODO: Fix user preferences accordingly.
}
- return sInstance;
+ // set it to noon
+ resetAnimator(0.5, LLEnvManagerNew::instance().getUseDayCycle());
+
+ // but use linden time sets it to what the estate is
+ mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN);
+
+ LLEnvManagerNew::instance().usePrefs();
+}
+
+// static
+std::string LLWLParamManager::getSysDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "");
+}
+
+// static
+std::string LLWLParamManager::getUserDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/skies", "");
+}
+
+// static
+std::string LLWLParamManager::escapeString(const std::string& str)
+{
+ // Don't use LLURI::escape() because it doesn't encode '-' characters
+ // which may break handling of some system presets like "A-12AM".
+ char* curl_str = curl_escape(str.c_str(), str.size());
+ std::string escaped_str(curl_str);
+ curl_free(curl_str);
+
+ return escaped_str;
}
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index 8c6329e769..bc984b9126 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -27,12 +27,14 @@
#ifndef LL_WLPARAMMANAGER_H
#define LL_WLPARAMMANAGER_H
-#include <vector>
+#include <list>
#include <map>
+#include "llenvmanager.h"
#include "llwlparamset.h"
#include "llwlanimator.h"
#include "llwldaycycle.h"
#include "llviewercamera.h"
+#include "lltrans.h"
class LLGLSLShader;
@@ -72,7 +74,7 @@ struct WLColorControl {
r = val.mV[0];
g = val.mV[1];
b = val.mV[2];
- i = val.mV[3];
+ i = val.mV[3];
return *this;
}
@@ -115,25 +117,112 @@ struct WLFloatControl {
}
};
-/// WindLight parameter manager class - what controls all the wind light shaders
-class LLWLParamManager
+struct LLWLParamKey : LLEnvKey
{
public:
+ // scope and source of a param set (WL sky preset)
+ std::string name;
+ EScope scope;
- LLWLParamManager();
- ~LLWLParamManager();
+ // for conversion from LLSD
+ static const int NAME_IDX = 0;
+ static const int SCOPE_IDX = 1;
+
+ inline LLWLParamKey(const std::string& n, EScope s)
+ : name(n), scope(s)
+ {
+ }
+
+ inline LLWLParamKey(LLSD llsd)
+ : name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
+ {
+ }
+
+ inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
+ : name(""), scope(SCOPE_LOCAL)
+ {
+ }
+
+ inline LLWLParamKey(std::string& stringVal)
+ {
+ size_t len = stringVal.length();
+ if (len > 0)
+ {
+ name = stringVal.substr(0, len - 1);
+ scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
+ }
+ }
+
+ inline std::string toStringVal() const
+ {
+ std::stringstream str;
+ str << name << scope;
+ return str.str();
+ }
+
+ inline LLSD toLLSD() const
+ {
+ LLSD llsd = LLSD::emptyArray();
+ llsd.append(LLSD(name));
+ llsd.append(LLSD(scope));
+ return llsd;
+ }
+
+ inline void fromLLSD(const LLSD& llsd)
+ {
+ name = llsd[NAME_IDX].asString();
+ scope = EScope(llsd[SCOPE_IDX].asInteger());
+ }
+
+ inline bool operator <(const LLWLParamKey other) const
+ {
+ if (name < other.name)
+ {
+ return true;
+ }
+ else if (name > other.name)
+ {
+ return false;
+ }
+ else
+ {
+ return scope < other.scope;
+ }
+ }
+
+ inline bool operator ==(const LLWLParamKey other) const
+ {
+ return (name == other.name) && (scope == other.scope);
+ }
- /// load a preset file
- void loadPresets(const std::string & fileName);
+ inline std::string toString() const
+ {
+ switch (scope)
+ {
+ case SCOPE_LOCAL:
+ return name + std::string(" (") + LLTrans::getString("Local") + std::string(")");
+ break;
+ case SCOPE_REGION:
+ return name + std::string(" (") + LLTrans::getString("Region") + std::string(")");
+ break;
+ default:
+ return name + " (?)";
+ }
+ }
+};
- /// save the preset file
- void savePresets(const std::string & fileName);
+/// WindLight parameter manager class - what controls all the wind light shaders
+class LLWLParamManager : public LLSingleton<LLWLParamManager>
+{
+ LOG_CLASS(LLWLParamManager);
- /// load an individual preset into the sky
- void loadPreset(const std::string & name,bool propogate=true);
+public:
+ typedef std::list<std::string> preset_name_list_t;
+ typedef std::list<LLWLParamKey> preset_key_list_t;
+ typedef boost::signals2::signal<void()> preset_list_signal_t;
/// save the parameter presets to file
- void savePreset(const std::string & name);
+ void savePreset(const LLWLParamKey key);
/// Set shader uniforms dirty, so they'll update automatically.
void propagateParameters(void);
@@ -147,6 +236,12 @@ public:
/// update information camera dependent parameters
void update(LLViewerCamera * cam);
+ /// apply specified day cycle, setting time to noon by default
+ bool applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5);
+
+ /// apply specified fixed sky params
+ bool applySkyParams(const LLSD& params);
+
// get where the light is pointing
inline LLVector4 getLightDir(void) const;
@@ -161,36 +256,62 @@ public:
/// get the radius of the dome
inline F32 getDomeRadius(void) const;
-
- /// Perform global initialization for this class.
- static void initClass(void);
-
- // Cleanup of global data that's only inited once per class.
- static void cleanupClass();
- /// add a param to the list
- bool addParamSet(const std::string& name, LLWLParamSet& param);
+ /// add a param set (preset) to the list
+ bool addParamSet(const LLWLParamKey& key, LLWLParamSet& param);
- /// add a param to the list
- BOOL addParamSet(const std::string& name, LLSD const & param);
+ /// add a param set (preset) to the list
+ BOOL addParamSet(const LLWLParamKey& key, LLSD const & param);
- /// get a param from the list
- bool getParamSet(const std::string& name, LLWLParamSet& param);
+ /// get a param set (preset) from the list
+ bool getParamSet(const LLWLParamKey& key, LLWLParamSet& param);
+
+ /// check whether the preset is in the list
+ bool hasParamSet(const LLWLParamKey& key);
/// set the param in the list with a new param
- bool setParamSet(const std::string& name, LLWLParamSet& param);
+ bool setParamSet(const LLWLParamKey& key, LLWLParamSet& param);
/// set the param in the list with a new param
- bool setParamSet(const std::string& name, LLSD const & param);
+ bool setParamSet(const LLWLParamKey& key, LLSD const & param);
/// gets rid of a parameter and any references to it
- /// returns true if successful
- bool removeParamSet(const std::string& name, bool delete_from_disk);
+ /// ignores "delete_from_disk" if the scope is not local
+ void removeParamSet(const LLWLParamKey& key, bool delete_from_disk);
- // singleton pattern implementation
- static LLWLParamManager * instance();
+ /// clear parameter mapping of a given scope
+ void clearParamSetsOfScope(LLEnvKey::EScope scope);
-public:
+ /// @return true if the preset comes out of the box
+ bool isSystemPreset(const std::string& preset_name) const;
+
+ /// @return user and system preset names as a single list
+ void getPresetNames(preset_name_list_t& region, preset_name_list_t& user, preset_name_list_t& sys) const;
+
+ /// @return user preset names
+ void getUserPresetNames(preset_name_list_t& user) const;
+
+ /// @return keys of all known presets
+ void getPresetKeys(preset_key_list_t& keys) const;
+
+ /// Emitted when a preset gets added or deleted.
+ boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb);
+
+ /// add all skies in LLSD using the given scope
+ void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map);
+
+ /// refresh region-scope presets
+ void refreshRegionPresets();
+
+ // returns all skies referenced by the current day cycle (in mDay), with their final names
+ // side effect: applies changes to all internal structures! (trashes all unreferenced skies in scope, keys in day cycle rescoped to scope, etc.)
+ std::map<LLWLParamKey, LLWLParamSet> finalizeFromDayCycle(LLWLParamKey::EScope scope);
+
+ // returns all skies in map (intended to be called with output from a finalize)
+ static LLSD createSkyMap(std::map<LLWLParamKey, LLWLParamSet> map);
+
+ /// escape string in a way different from LLURI::escape()
+ static std::string escapeString(const std::string& str);
// helper variables
LLWLAnimator mAnimator;
@@ -243,14 +364,27 @@ public:
F32 mDomeOffset;
F32 mDomeRadius;
- // list of all the parameters, listed by name
- std::map<std::string, LLWLParamSet> mParamList;
-
-
+
private:
- // our parameter manager singleton instance
- static LLWLParamManager * sInstance;
+ friend class LLWLAnimator;
+
+ void loadAllPresets();
+ void loadPresetsFromDir(const std::string& dir);
+ bool loadPreset(const std::string& path);
+
+ static std::string getSysDir();
+ static std::string getUserDir();
+
+ friend class LLSingleton<LLWLParamManager>;
+ /*virtual*/ void initSingleton();
+ LLWLParamManager();
+ ~LLWLParamManager();
+
+ // list of all the parameters, listed by name
+ std::map<LLWLParamKey, LLWLParamSet> mParamList;
+
+ preset_list_signal_t mPresetListChangeSignal;
};
inline F32 LLWLParamManager::getDomeOffset(void) const
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index cf06766d73..a027d635e6 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -31,6 +31,7 @@
#include "llfloaterwindlight.h"
#include "llwlparammanager.h"
+#include "llglslshader.h"
#include "lluictrlfactory.h"
#include "llsliderctrl.h"
@@ -94,7 +95,7 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
shader->uniform4fv(param, 1, val.mV);
}
- else
+ else // param is the uniform name
{
LLVector4 val;
@@ -119,7 +120,6 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
val.mV[0] = i->second.asBoolean();
}
-
shader->uniform4fv(param, 1, val.mV);
}
}
@@ -260,7 +260,6 @@ void LLWLParamSet::setEastAngle(float val)
void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
{
// set up the iterators
- LLSD::map_iterator cIt = mParamValues.beginMap();
// keep cloud positions and coverage the same
/// TODO masking will do this later
@@ -273,55 +272,39 @@ void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
LLSD srcVal;
LLSD destVal;
- // do the interpolation for all the ones saved as vectors
- // skip the weird ones
- for(; cIt != mParamValues.endMap(); cIt++) {
+ // Iterate through values
+ for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter)
+ {
- // check params to make sure they're actually there
- if(src.mParamValues.has(cIt->first))
+ // If param exists in both src and dest, set the holder variables, otherwise skip
+ if(src.mParamValues.has(iter->first) && dest.mParamValues.has(iter->first))
{
- srcVal = src.mParamValues[cIt->first];
+ srcVal = src.mParamValues[iter->first];
+ destVal = dest.mParamValues[iter->first];
}
else
{
continue;
}
- if(dest.mParamValues.has(cIt->first))
+ if(iter->second.isReal()) // If it's a real, interpolate directly
{
- destVal = dest.mParamValues[cIt->first];
+ iter->second = srcVal.asReal() + ((destVal.asReal() - srcVal.asReal()) * weight);
}
- else
- {
- continue;
- }
-
- // skip if not a vector
- if(!cIt->second.isArray())
- {
- continue;
- }
-
- // only Real vectors allowed
- if(!cIt->second[0].isReal())
+ else if(iter->second.isArray() && iter->second[0].isReal() // If it's an array of reals, loop through the reals and interpolate on those
+ && iter->second.size() == srcVal.size() && iter->second.size() == destVal.size())
{
- continue;
+ // Actually do interpolation: old value + (difference in values * factor)
+ for(int i=0; i < iter->second.size(); ++i)
+ {
+ // iter->second[i] = (1.f-weight)*(F32)srcVal[i].asReal() + weight*(F32)destVal[i].asReal(); // old way of doing it -- equivalent but one more operation
+ iter->second[i] = srcVal[i].asReal() + ((destVal[i].asReal() - srcVal[i].asReal()) * weight);
+ }
}
-
- // make sure all the same size
- if( cIt->second.size() != srcVal.size() ||
- cIt->second.size() != destVal.size())
+ else // Else, skip
{
continue;
- }
-
- // more error checking might be necessary;
-
- for(int i=0; i < cIt->second.size(); ++i)
- {
- cIt->second[i] = (1.0f - weight) * (F32) srcVal[i].asReal() +
- weight * (F32) destVal[i].asReal();
- }
+ }
}
// now mix the extra parameters
diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h
index 487e2bf922..1358502032 100644
--- a/indra/newview/llwlparamset.h
+++ b/indra/newview/llwlparamset.h
@@ -32,10 +32,10 @@
#include "v4math.h"
#include "v4color.h"
-#include "llviewershadermgr.h"
class LLFloaterWindLight;
class LLWLParamSet;
+class LLGLSLShader;
/// A class representing a set of parameter values for the WindLight shaders.
class LLWLParamSet {
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index ec24b02934..4a6ec7fdbb 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -61,6 +61,7 @@
#include <map>
#include <cstring>
+
//
// Globals
//
@@ -91,8 +92,7 @@ LLWorld::LLWorld() :
mLastPacketsIn(0),
mLastPacketsOut(0),
mLastPacketsLost(0),
- mSpaceTimeUSec(0),
- mClassicCloudsEnabled(TRUE)
+ mSpaceTimeUSec(0)
{
for (S32 i = 0; i < 8; i++)
{
@@ -183,10 +183,6 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
llerrs << "Unable to create new region!" << llendl;
}
- regionp->mCloudLayer.create(regionp);
- regionp->mCloudLayer.setWidth((F32)mWidth);
- regionp->mCloudLayer.setWindPointer(&regionp->mWind);
-
mRegionList.push_back(regionp);
mActiveRegionList.push_back(regionp);
mCulledRegionList.push_back(regionp);
@@ -661,92 +657,6 @@ void LLWorld::updateParticles()
LLViewerPartSim::getInstance()->updateSimulation();
}
-void LLWorld::updateClouds(const F32 dt)
-{
- static LLFastTimer::DeclareTimer ftm("World Clouds");
- LLFastTimer t(ftm);
-
- if ( gSavedSettings.getBOOL("FreezeTime") )
- {
- // don't move clouds in snapshot mode
- return;
- }
-
- if (
- mClassicCloudsEnabled !=
- gSavedSettings.getBOOL("SkyUseClassicClouds") )
- {
- // The classic cloud toggle has been flipped
- // gotta update all of the cloud layers
- mClassicCloudsEnabled =
- gSavedSettings.getBOOL("SkyUseClassicClouds");
-
- if ( !mClassicCloudsEnabled && mActiveRegionList.size() )
- {
- // We've transitioned to having classic clouds disabled
- // reset all cloud layers.
- for (
- region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end();
- ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->mCloudLayer.reset();
- }
-
- return;
- }
- }
- else if ( !mClassicCloudsEnabled ) return;
-
- if (mActiveRegionList.size())
- {
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->mCloudLayer.updatePuffs(dt);
- }
-
- // Reshuffle who owns which puffs
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->mCloudLayer.updatePuffOwnership();
- }
-
- // Add new puffs
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->mCloudLayer.updatePuffCount();
- }
- }
-}
-
-LLCloudGroup* LLWorld::findCloudGroup(const LLCloudPuff &puff)
-{
- if (mActiveRegionList.size())
- {
- // Update all the cloud puff positions, and timer based stuff
- // such as death decay
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- LLCloudGroup *groupp = regionp->mCloudLayer.findCloudGroup(puff);
- if (groupp)
- {
- return groupp;
- }
- }
- }
- return NULL;
-}
-
-
void LLWorld::renderPropertyLines()
{
S32 region_count = 0;
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 973df6998a..b0628dfe67 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -500,22 +500,22 @@
reference="DkGray2" />
<color
name="MultiSliderDisabledThumbColor"
- reference="Unused?" />
+ reference="Black" />
<color
name="MultiSliderThumbCenterColor"
- reference="Unused?" />
+ reference="White" />
<color
name="MultiSliderThumbCenterSelectedColor"
- reference="Unused?" />
+ reference="Green" />
<color
name="MultiSliderThumbOutlineColor"
reference="Unused?" />
<color
name="MultiSliderTrackColor"
- reference="Unused?" />
+ reference="LtGray" />
<color
name="MultiSliderTriangleColor"
- reference="Unused?" />
+ reference="Yellow" />
<!--
<color
name="NameTagBackground"
diff --git a/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml
index 65e2462ef8..59cdb295ef 100644
--- a/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml
@@ -362,7 +362,7 @@
label_width="35"
layout="topleft"
left_delta="20"
- max_val="100"
+ max_val="23"
name="WLCurKeyHour"
top_pad="4"
width="74" />
@@ -411,148 +411,6 @@
left="12"
top="101"
width="240" />
- <text
- type="string"
- length="1"
- border_visible="true"
- follows="left|top|right"
- font="SansSerif"
- height="16"
- layout="topleft"
- left_pad="15"
- name="DayCycleText"
- top="114"
- width="120">
- Snap:
- </text>
- <combo_box
- enabled="false"
- height="18"
- label="5 min"
- layout="topleft"
- left_delta="0"
- name="WLSnapOptions"
- top_pad="7"
- width="70" />
- <text
- type="string"
- length="1"
- border_visible="true"
- follows="left|top|right"
- font="SansSerif"
- height="16"
- layout="topleft"
- left_delta="0"
- name="DayCycleText2"
- top_pad="17"
- width="120">
- Length of Cycle:
- </text>
- <spinner
- control_name="WLLengthOfDayHour"
- decimal_digits="0"
- follows="left|top"
- height="16"
- increment="1"
- initial_value="0"
- label="Hour"
- label_width="33"
- layout="topleft"
- left_delta="-3"
- max_val="100"
- name="WLLengthOfDayHour"
- top_pad="4"
- width="74" />
- <spinner
- control_name="WLLengthOfDayMin"
- decimal_digits="0"
- follows="left|top"
- height="16"
- increment="1"
- initial_value="0"
- label="Min"
- label_width="25"
- layout="topleft"
- left_pad="2"
- max_val="59"
- name="WLLengthOfDayMin"
- top_delta="0"
- width="65" />
- <spinner
- control_name="WLLengthOfDaySec"
- decimal_digits="0"
- follows="left|top"
- height="16"
- increment="1"
- initial_value="24"
- label="Sec"
- label_width="25"
- layout="topleft"
- left_pad="2"
- max_val="59"
- name="WLLengthOfDaySec"
- top_delta="0"
- width="65"/>
- <text
- type="string"
- halign="right"
- length="1"
- border_visible="true"
- follows="left|top|right"
- font="SansSerif"
- height="16"
- layout="topleft"
- left_delta="-23"
- name="DayCycleText3"
- top="114"
- width="85">
- Preview :
- </text>
- <button
- height="20"
- label="Play"
- label_selected="Play"
- layout="topleft"
- left="480"
- name="WLAnimSky"
- top_pad="5"
- width="83" />
- <button
- height="20"
- label="Stop!"
- label_selected="Stop"
- layout="topleft"
- left_pad="4"
- name="WLStopAnimSky"
- top_delta="0"
- width="83" />
- <button
- height="20"
- label="Use Estate Time"
- label_selected="Go to Estate Time"
- layout="topleft"
- left="480"
- name="WLUseLindenTime"
- top_pad="9"
- width="170" />
- <button
- height="20"
- label="Save Test Day"
- label_selected="Save Test Day"
- layout="topleft"
- left_delta="0"
- name="WLSaveDayCycle"
- top_pad="9"
- width="170" />
- <button
- height="20"
- label="Load Test Day"
- label_selected="Load Test Day"
- layout="topleft"
- left_delta="0"
- name="WLLoadDayCycle"
- top_pad="3"
- width="170" />
</panel>
</tab_container>
</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml b/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml
new file mode 100644
index 0000000000..b5de4166f6
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<floater
+ legacy_header_height="18"
+ height="130"
+ help_topic=""
+ layout="topleft"
+ name="Delete Env Preset"
+ save_rect="true"
+ title="DELETE ENV PRESET"
+ width="550">
+
+ <string name="title_water">Delete Water Preset</string>
+ <string name="title_sky">Delete Sky Preset</string>
+ <string name="title_day_cycle">Delete Day Cycle</string>
+
+ <string name="label_water">Preset:</string>
+ <string name="label_sky">Preset:</string>
+ <string name="label_day_cycle">Day cycle:</string>
+
+ <string name="msg_confirm_deletion">Are you sure you want to delete the selected preset?</string>
+ <string name="msg_sky_is_referenced">Cannot remove a preset that is referenced by some day cycle(s).</string>
+
+ <string name="combo_label">-Select a preset-</string>
+
+ <text
+ follows="top|left|right"
+ font="SansSerif"
+ height="10"
+ layout="topleft"
+ left="50"
+ name="label"
+ top="60"
+ width="60">
+ Preset:
+ </text>
+ <combo_box
+ follows="top|left"
+ layout="topleft"
+ left_pad="10"
+ name="preset_combo"
+ top_delta="-5"
+ width="200"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Delete"
+ layout="topleft"
+ left_pad="15"
+ name="delete"
+ width="70"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="5"
+ name="cancel"
+ width="70"/>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml
new file mode 100644
index 0000000000..7aae966879
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml
@@ -0,0 +1,485 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ height="381"
+ layout="topleft"
+ name="Edit Day cycle"
+ help_topic="day_presets"
+ save_rect="true"
+ title="Edit Day Cycle"
+ width="705">
+
+ <string name="title_new">Create a New Day Cycle</string>
+ <string name="title_edit">Edit Day Cycle</string>
+ <string name="hint_new">Name your day cycle, adjust the controls to create it, and click "Save".</string>
+ <string name="hint_edit">To edit your day cycle, adjust the controls below and click "Save".</string>
+ <string name="combo_label">-Select a preset-</string>
+
+ <text
+ follows="top|left|right"
+ height="10"
+ layout="topleft"
+ left="10"
+ name="hint"
+ top="25"
+ width="685" />
+ <text
+ follows="top|left|right"
+ font="SansSerif"
+ height="10"
+ layout="topleft"
+ left="10"
+ name="label"
+ top_pad="25"
+ width="120">
+ Preset Name:
+ </text>
+ <combo_box
+ allow_text_entry="true"
+ follows="top|left"
+ layout="topleft"
+ left_pad="10"
+ max_chars="100"
+ name="day_cycle_combo"
+ top_delta="-5"
+ width="200" />
+ <line_editor
+ height="20"
+ left_delta="0"
+ name="day_cycle_name"
+ top_delta="0"
+ visible="true"
+ width="200" />
+ <text
+ follows="top|left|right"
+ height="95"
+ layout="topleft"
+ left_pad="10"
+ name="note"
+ top_delta="0"
+ width="345"
+ wrap="true">
+ Note: if you change the name of your preset, you will be creating a new preset and the existing preset will not be changed.
+ </text>
+ <!--======== Controls panel ========-->
+ <text
+ follows="left|top|right"
+ height="10"
+ layout="topleft"
+ left="10"
+ name="water_color_label"
+ top="100"
+ width="300">
+ - Click on a tab to edit the specific sky settings and time.
+ </text>
+ <text
+ follows="left|top|right"
+ height="10"
+ layout="topleft"
+ name="water_color_label"
+ top_pad="10"
+ width="300">
+ - Click and drag the tabs to set the transition times.
+ </text>
+ <text
+ follows="left|top|right"
+ height="10"
+ layout="topleft"
+ name="water_color_label"
+ top_pad="10"
+ width="300">
+ - Use the scrubber to preview your day cycle.
+ </text>
+ <panel
+ follows="top|left"
+ height="100"
+ name="day_cycle_slider_panel"
+ layout="topleft"
+ left_delta="25"
+ top_pad="15"
+ width="660">
+ <multi_slider
+ can_edit_text="true"
+ control_name="WLTimeSlider"
+ decimal_digits="0"
+ draw_track="false"
+ follows="bottom"
+ height="10"
+ increment="0.0833333"
+ initial_value="0"
+ layout="topleft"
+ left="20"
+ max_sliders="20"
+ max_val="24"
+ name="WLTimeSlider"
+ show_text="false"
+ top_pad="0"
+ use_triangle="true"
+ width="525" />
+ <multi_slider
+ can_edit_text="true"
+ control_name="WLDayCycleKeys"
+ decimal_digits="0"
+ follows="bottom"
+ height="10"
+ increment="0.0833333"
+ initial_value="0"
+ layout="topleft"
+ left_delta="0"
+ max_sliders="20"
+ max_val="24"
+ name="WLDayCycleKeys"
+ show_text="false"
+ top_pad="15"
+ width="525" />
+ <button
+ height="20"
+ label="Add Key"
+ label_selected="Add Key"
+ layout="topleft"
+ left_pad="20"
+ name="WLAddKey"
+ top_delta="-18"
+ width="96" />
+ <button
+ height="20"
+ label="Delete Key"
+ label_selected="Delete Key"
+ layout="topleft"
+ name="WLDeleteKey"
+ top_pad="5"
+ width="96" />
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left="8"
+ name="WL12am"
+ top="74"
+ width="55">
+ 12am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL3am"
+ top_delta="0"
+ width="55">
+ 3am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL6am"
+ top_delta="0"
+ width="55">
+ 6am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL9amHash"
+ top_delta="0"
+ width="55">
+ 9am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL12pmHash"
+ top_delta="0"
+ width="55">
+ 12pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL3pm"
+ top_delta="0"
+ width="55">
+ 3pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL6pm"
+ top_delta="0"
+ width="55">
+ 6pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL9pm"
+ top_delta="0"
+ width="55">
+ 9pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="WL12am2"
+ top_delta="0"
+ width="55">
+ 12am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left="20"
+ name="WL12amHash"
+ top="54"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="11"
+ layout="topleft"
+ left_pad="59"
+ name="WL3amHash"
+ top_delta="3"
+ width="6">
+ I
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="59"
+ name="WL6amHash"
+ top_delta="-3"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="11"
+ layout="topleft"
+ left_pad="59"
+ name="WL9amHash2"
+ top_delta="3"
+ width="6">
+ I
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="59"
+ name="WL12pmHash2"
+ top_delta="-3"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="11"
+ layout="topleft"
+ left_pad="59"
+ name="WL3pmHash"
+ top_delta="3"
+ width="6">
+ I
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="59"
+ name="WL6pmHash"
+ top_delta="-3"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="11"
+ layout="topleft"
+ left_pad="59"
+ name="WL9pmHash"
+ top_delta="3"
+ width="6">
+ I
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="59"
+ name="WL12amHash2"
+ top_delta="-3"
+ width="6">
+ |
+ </text>
+ </panel>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="192"
+ name="WLCurKeyTimeText2"
+ top_pad="10"
+ width="80">
+ Sky Setting:
+ </text>
+ <combo_box
+ height="18"
+ label="Preset"
+ layout="topleft"
+ left_pad="5"
+ name="WLSkyPresets"
+ width="205" />
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-40"
+ name="WLCurKeyTimeText2"
+ top_pad="15"
+ width="35">
+ Time:
+ </text>
+ <time
+ follows="left|top"
+ height="16"
+ label_width="0"
+ layout="topleft"
+ left_pad="3"
+ name="time"
+ top_delta="-1"
+ value="6:00 AM"
+ width="75"/>
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ left="10"
+ name="horiz_separator"
+ top_pad="20"
+ width="685"/>
+ <loading_indicator
+ height="23"
+ layout="topleft"
+ left="25"
+ name="progress_indicator"
+ top="350"
+ visible="false"
+ width="23" />
+ <check_box
+ follows="top|left"
+ height="10"
+ label="Make this my new day cycle"
+ layout="topleft"
+ left="310"
+ name="make_default_cb"
+ top_delta="13"
+ width="230"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Save"
+ layout="topleft"
+ left_pad="0"
+ name="save"
+ top_delta="-13"
+ width="70"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="15"
+ name="cancel"
+ top_delta="0"
+ width="70"/>
+ </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml
new file mode 100644
index 0000000000..56233d91ee
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml
@@ -0,0 +1,953 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ height="375"
+ layout="topleft"
+ name="Edit Sky Preset"
+ help_topic="sky_preset"
+ save_rect="true"
+ title="Edit Sky Preset"
+ width="840">
+
+ <string name="title_new">Create a New Sky Preset</string>
+ <string name="title_edit">Edit Sky Preset</string>
+ <string name="hint_new">Name your preset, adjust the controls to create it, and click "Save".</string>
+ <string name="hint_edit">To edit your sky preset, adjust the controls and click "Save".</string>
+ <string name="combo_label">-Select a preset-</string>
+
+ <text
+ follows="top|left|right"
+ height="10"
+ layout="topleft"
+ left="30"
+ name="hint"
+ top="25"
+ width="700">
+ To edit your preset, adjust the controls then click "Save"
+ </text>
+ <text
+ follows="top|left|right"
+ font="SansSerif"
+ height="10"
+ layout="topleft"
+ left="30"
+ name="label"
+ top_pad="25"
+ width="120">
+ Preset Name:
+ </text>
+ <combo_box
+ allow_text_entry="true"
+ follows="top|left"
+ layout="topleft"
+ left_pad="10"
+ max_chars="100"
+ name="sky_preset_combo"
+ top_delta="-5"
+ width="200"/>
+ <line_editor
+ height="20"
+ left_delta="0"
+ name="sky_preset_name"
+ top_delta="0"
+ width="200" />
+ <text
+ follows="top|left|right"
+ height="40"
+ layout="topleft"
+ left_pad="10"
+ name="note"
+ top_delta="0"
+ width="405"
+ wrap="true">
+ Note: if you change the name of your preset, you will be creating a new preset and the existing preset will not be changed.
+ </text>
+ <!--======== Controls panel ========-->
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="203"
+ layout="topleft"
+ left="25"
+ name="panel_water_preset"
+ top="122"
+ visible="true"
+ width="790"/>
+ <tab_container
+ follows="left|top"
+ height="225"
+ halign="center"
+ layout="topleft"
+ left="22"
+ name="WindLight Tabs"
+ tab_position="top"
+ top="101"
+ width="794">
+ <panel
+ border="true"
+ bevel_style="none"
+ follows="left|top|right|bottom"
+ height="196"
+ label="ATMOSPHERE"
+ layout="topleft"
+ left="1"
+ help_topic="sky_preset_atmosphere"
+ mouse_opaque="false"
+ name="Atmosphere"
+ top="60"
+ width="698">
+
+ <!--======== Tab Panel I. I conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left="40"
+ name="BHText"
+ top="25"
+ width="200">
+ Blue Horizon
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="0"
+ name="WLBlueHorizon"
+ top_pad="6"
+ width="60" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="0"
+ top_pad="20"
+ name="BDensText"
+ width="200">
+ Haze Horizon
+ </text>
+ <slider
+ control_name="WLHazeHorizon"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.25"
+ layout="topleft"
+ left_delta="0"
+ top_pad="6"
+ name="WLHazeHorizon"
+ width="200" />
+
+ <!--======== Tab Panel I. II conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="55"
+ name="BDensText2"
+ top="25"
+ width="200">
+ Blue Density
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="0"
+ name="WLBlueDensity"
+ top_pad="6"
+ width="60" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="0"
+ name="HDText"
+ top_pad="20"
+ width="200">
+ Haze Density
+ </text>
+ <slider
+ control_name="WLHazeDensity"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.7"
+ layout="topleft"
+ left_delta="0"
+ max_val="4"
+ name="WLHazeDensity"
+ top_pad="6"
+ width="200" />
+
+ <!--======== Tab Panel I. III conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="55"
+ name="DensMultText"
+ top="25"
+ width="200">
+ Density Multiplier
+ </text>
+ <slider
+ control_name="WLDensityMult"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.1"
+ layout="topleft"
+ left_delta="15"
+ max_val="0.9"
+ name="WLDensityMult"
+ top_pad="6"
+ width="200" />
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="WLDistanceMultText"
+ top_pad="20"
+ width="200">
+ Distance Multiplier
+ </text>
+ <slider
+ control_name="WLDistancMult"
+ decimal_digits="1"
+ follows="left|top"
+ height="10"
+ initial_value="1.0"
+ layout="topleft"
+ left_delta="15"
+ max_val="100"
+ name="WLDistanceMult"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="MaxAltText"
+ top_pad="20"
+ width="200">
+ Max Altitude
+ </text>
+ <slider
+ control_name="WLMaxAltitude"
+ decimal_digits="0"
+ follows="left|top"
+ height="10"
+ increment="1"
+ initial_value="500"
+ layout="topleft"
+ left_delta="15"
+ max_val="4000"
+ name="WLMaxAltitude"
+ top_pad="6"
+ width="200" />
+ </panel>
+ <panel
+ border="true"
+ bevel_style="none"
+ follows="left|top|right|bottom"
+ height="196"
+ label="LIGHTING"
+ layout="topleft"
+ left_delta="0"
+ help_topic="sky_preset_lighting"
+ name="Lighting"
+ top_delta="4"
+ width="698">
+
+ <!--======== Tab Panel II. I conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left="20"
+ name="SLCText"
+ top="25"
+ width="150">
+ Sun/Moon Color
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="10"
+ name="WLSunlight"
+ top_pad="6"
+ width="60" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-10"
+ name="WLAmbientText"
+ top_pad="20"
+ width="150">
+ Ambient
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="10"
+ name="WLAmbient"
+ top_pad="6"
+ width="60" />
+
+ <!--======== Tab Panel II. II conlumn of controls ========-->
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="100"
+ name="SunGlowText"
+ top="25"
+ width="200">
+ Sun Glow
+ </text>
+ <slider
+ control_name="WLGlowB"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.1"
+ label="Focus "
+ layout="topleft"
+ left_delta="10"
+ max_val="0.5"
+ name="WLGlowB"
+ top_pad="6"
+ width="200" />
+ <slider
+ control_name="WLGlowR"
+ decimal_digits="2"
+ follows="top|left"
+ height="10"
+ increment="0.01"
+ initial_value="0.25"
+ label="Size "
+ layout="topleft"
+ left_delta="0"
+ max_val="1.99"
+ min_val="1"
+ name="WLGlowR"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-10"
+ name="WLStarText"
+ top_pad="20"
+ width="200">
+ Star Brightness
+ </text>
+ <slider
+ control_name="WLStarAlpha"
+ decimal_digits="2"
+ follows="top|left"
+ height="10"
+ increment="0.01"
+ initial_value="0"
+ layout="topleft"
+ left_delta="10"
+ max_val="2"
+ name="WLStarAlpha"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-10"
+ name="SceneGammaText"
+ top_pad="20"
+ width="200">
+ Scene Gamma
+ </text>
+ <slider
+ control_name="WLGamma"
+ decimal_digits="2"
+ follows="top|left"
+ height="10"
+ increment="0.01"
+ initial_value="2.0"
+ layout="topleft"
+ left_delta="10"
+ max_val="10"
+ name="WLGamma"
+ top_pad="6"
+ width="200" />
+
+ <!--======== Tab Panel II. III conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="60"
+ name="TODText"
+ top="25"
+ width="200">
+ Sun/Moon Position
+ </text>
+ <multi_slider
+ can_edit_text="true"
+ control_name="WLSunPos"
+ decimal_digits="0"
+ follows="bottom"
+ height="10"
+ increment="0.0833333"
+ initial_value="0"
+ layout="topleft"
+ left_delta="0"
+ max_sliders="1"
+ max_val="24"
+ name="WLSunPos"
+ show_text="false"
+ top_pad="0"
+ width="300" />
+
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_delta="2"
+ name="WL12amHash"
+ top_pad="6"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="66"
+ name="WL6amHash"
+ top_delta="0"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="67"
+ name="WL12pmHash2"
+ top_delta="0"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="67"
+ name="WL6pmHash"
+ top_delta="0"
+ width="6">
+ |
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ font="SansSerif"
+ height="14"
+ layout="topleft"
+ left_pad="67"
+ name="WL12amHash2"
+ top_delta="0"
+ width="6">
+ |
+ </text>
+
+
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_delta="-300"
+ name="WL12am"
+ top="74"
+ width="55">
+ 12am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="20"
+ name="WL6am"
+ top_delta="0"
+ width="55">
+ 6am
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="15"
+ name="WL12pmHash"
+ top_delta="0"
+ width="55">
+ 12pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="18"
+ name="WL6pm"
+ top_delta="0"
+ width="55">
+ 6pm
+ </text>
+ <text
+ type="string"
+ length="1"
+ border_visible="true"
+ follows="left|top|right"
+ height="16"
+ layout="topleft"
+ left_pad="15"
+ name="WL12am2"
+ top_delta="0"
+ width="55">
+ 12am
+ </text>
+
+ <time
+ follows="left|top"
+ height="16"
+ label_width="0"
+ layout="topleft"
+ left_delta="-175"
+ name="WLDayTime"
+ top_pad="15"
+ value="6:00 AM"
+ width="75"/>
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-106"
+ name="WLEastAngleText"
+ top_pad="24"
+ width="200">
+ East Angle
+ </text>
+ <slider
+ control_name="WLEastAngle"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.0"
+ layout="topleft"
+ left_delta="10"
+ name="WLEastAngle"
+ top_pad="6"
+ width="200" />
+
+ </panel>
+ <panel
+ border="true"
+ bevel_style="none"
+ follows="left|top|right|bottom"
+ height="196"
+ label="CLOUDS"
+ layout="topleft"
+ left_delta="0"
+ mouse_opaque="false"
+ help_topic="sky_preset_clouds"
+ name="Clouds"
+ top_delta="4"
+ width="698">
+
+ <!--======== Tab Panel III. I conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left="40"
+ name="WLCloudColorText"
+ top="25"
+ width="200">
+ Cloud Color
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="0"
+ name="WLCloudColor"
+ top_pad="6"
+ width="60" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="0"
+ name="WLCloudColorText2"
+ top_pad="20"
+ width="200">
+ Cloud XY/Density
+ </text>
+ <slider
+ control_name="WLCloudX"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ label="X"
+ layout="topleft"
+ left_delta="0"
+ top_pad="6"
+ name="WLCloudX"
+ width="200" />
+ <slider
+ control_name="WLCloudY"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ label="Y"
+ layout="topleft"
+ left_delta="0"
+ top_pad="6"
+ name="WLCloudY"
+ width="200" />
+ <slider
+ control_name="WLCloudDensity"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="1.0"
+ label="D"
+ layout="topleft"
+ left_delta="0"
+ name="WLCloudDensity"
+ top_pad="6"
+ width="200" />
+
+ <!--======== Tab Panel III. II conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="55"
+ name="WLCloudCoverageText"
+ top="15"
+ width="200">
+ Cloud Coverage
+ </text>
+ <slider
+ control_name="WLCloudCoverage"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ layout="topleft"
+ left_delta="15"
+ name="WLCloudCoverage"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="WLCloudScaleText"
+ top_pad="20"
+ width="200">
+ Cloud Scale
+ </text>
+ <slider
+ control_name="WLCloudScale"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="1.0"
+ layout="topleft"
+ left_delta="15"
+ min_val="0.01"
+ name="WLCloudScale"
+ top_pad="6"
+ width="200" />
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-13"
+ name="WLCloudDetailText"
+ top_pad="20"
+ width="200">
+ Cloud Detail (XY/Density)
+ </text>
+ <slider
+ control_name="WLCloudDetailX"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ label="X"
+ layout="topleft"
+ left_delta="0"
+ top_pad="6"
+ name="WLCloudDetailX"
+ width="200" />
+ <slider
+ control_name="WLCloudDetailY"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ label="Y"
+ layout="topleft"
+ left_delta="0"
+ name="WLCloudDetailY"
+ top_pad="6"
+ width="200" />
+ <slider
+ control_name="WLCloudDetailDensity"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="1.0"
+ label="D"
+ layout="topleft"
+ left_delta="0"
+ name="WLCloudDetailDensity"
+ top_pad="6"
+ width="200" />
+
+ <!--======== Tab Panel III. III conlumn of controls ========-->
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="55"
+ name="WLCloudScrollXText"
+ top="15"
+ width="150">
+ Cloud Scroll X
+ </text>
+ <check_box
+ control_name="WLCloudLockX"
+ follows="left|top"
+ height="16"
+ label="Lock"
+ layout="topleft"
+ left_delta="150"
+ name="WLCloudLockX"
+ top_delta="0"
+ width="200" />
+ <slider
+ control_name="WLCloudScrollX"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ layout="topleft"
+ left_delta="-135"
+ max_val="10"
+ min_val="-10"
+ name="WLCloudScrollX"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="WLCloudScrollYText"
+ top_pad="20"
+ width="150">
+ Cloud Scroll Y
+ </text>
+ <check_box
+ control_name="WLCloudLockY"
+ follows="left|top"
+ height="16"
+ label="Lock"
+ layout="topleft"
+ left_delta="150"
+ name="WLCloudLockY"
+ width="200" />
+ <slider
+ control_name="WLCloudScrollY"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.5"
+ layout="topleft"
+ left_delta="-135"
+ max_val="10"
+ min_val="-10"
+ name="WLCloudScrollY"
+ top_pad="6"
+ width="200" />
+ </panel>
+ </tab_container>
+<!--======== End of Controls panel ========-->
+
+ <check_box
+ follows="top|left"
+ height="10"
+ label="Make this preset my new sky setting"
+ layout="topleft"
+ left="380"
+ name="make_default_cb"
+ top_pad="30"
+ width="280"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Save"
+ layout="topleft"
+ left_pad="0"
+ name="save"
+ width="70"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="15"
+ name="cancel"
+ width="70"/>
+ </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml
new file mode 100644
index 0000000000..905983e7fa
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ height="375"
+ layout="topleft"
+ name="Edit Water Preset"
+ help_topic="water_preset"
+ save_rect="true"
+ title="Edit Water Preset"
+ width="725">
+
+ <string name="title_new">Create a New Water Preset</string>
+ <string name="title_edit">Edit a Water Preset</string>
+ <string name="hint_new">Name your preset, adjust the controls to create it, and click "Save".</string>
+ <string name="hint_edit">To edit your water preset, adjust the controls and click "Save".</string>
+ <string name="combo_label">-Select a preset-</string>
+
+ <text
+ follows="top|left|right"
+ height="10"
+ layout="topleft"
+ left="30"
+ name="hint"
+ top="25"
+ width="680">
+ To edit your preset, adjust the controls then click "Save"
+ </text>
+
+ <text
+ follows="top|left|right"
+ font="SansSerif"
+ height="10"
+ layout="topleft"
+ left="30"
+ name="label"
+ top_pad="25"
+ width="120">
+ Preset Name:
+ </text>
+
+ <combo_box
+ allow_text_entry="true"
+ follows="top|left"
+ layout="topleft"
+ left_pad="10"
+ max_chars="100"
+ name="water_preset_combo"
+ top_delta="-5"
+ width="200"/>
+
+ <line_editor
+ height="20"
+ left_delta="0"
+ name="water_preset_name"
+ top_delta="0"
+ width="200" />
+
+ <text
+ follows="top|left|right"
+ height="40"
+ layout="topleft"
+ left_pad="10"
+ name="note"
+ top_delta="0"
+ width="340"
+ wrap="true">
+ Note: if you change the name of your preset, you will be creating a new preset and the existing preset will not be changed.
+ </text>
+
+ <!--======== Controls panel ========-->
+ <panel
+ border="false"
+ bevel_style="none"
+ follows="top|left"
+ height="230"
+ layout="topleft"
+ left="10"
+ name="panel_water_preset"
+ top="100"
+ width="700">
+
+<!--======== I conlumn of controls ========-->
+ <text
+ follows="left|top|right"
+ height="10"
+ font="SansSerif"
+ layout="topleft"
+ left="10"
+ name="water_color_label"
+ top="5"
+ width="215">
+ Water Fog Color
+ </text>
+ <color_swatch
+ can_apply_immediately="true"
+ follows="left|top"
+ height="37"
+ label_height="0"
+ layout="topleft"
+ left_delta="15"
+ name="WaterFogColor"
+ top_pad="8"
+ width="60" />
+
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ top_pad="10"
+ name="water_fog_density_label"
+ width="215">
+ Fog Density Exponent
+ </text>
+ <slider
+ decimal_digits="1"
+ follows="left|top"
+ height="10"
+ initial_value="0"
+ layout="topleft"
+ left_delta="15"
+ max_val="10"
+ name="WaterFogDensity"
+ top_pad="10"
+ width="200"/>
+
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ top_pad="15"
+ name="underwater_fog_modifier_label"
+ width="215">
+ Underwater Fog Modifier
+ </text>
+ <slider
+ decimal_digits="1"
+ follows="left|top"
+ height="10"
+ initial_value="0"
+ layout="topleft"
+ left_delta="15"
+ max_val="10"
+ name="WaterUnderWaterFogMod"
+ top_pad="10"
+ width="200"/>
+
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ name="BHText"
+ top_pad="15"
+ width="215">
+ Big Wave Direction
+ </text>
+ <slider
+ control_name="WaterWave1DirX"
+ decimal_digits="2"
+ follows="left|top"
+ increment="0.01"
+ initial_value="0.7"
+ label="X"
+ layout="topleft"
+ max_val="4"
+ min_val="-4"
+ name="WaterWave1DirX"
+ top_pad="10"
+ width="216"/>
+ <slider
+ control_name="WaterWave1DirY"
+ decimal_digits="2"
+ follows="left|top"
+ increment="0.01"
+ initial_value="0.7"
+ label="Y"
+ layout="topleft"
+ max_val="4"
+ min_val="-4"
+ name="WaterWave1DirY"
+ top_pad="5"
+ width="216"/>
+
+<!--======== II conlumn of controls ========-->
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ height="10"
+ layout="topleft"
+ left_pad="20"
+ name="BDensText"
+ top="5"
+ width="215">
+ Reflection Wavelet Scale
+ </text>
+ <slider
+ control_name="WaterNormalScaleX"
+ decimal_digits="1"
+ follows="left|top"
+ initial_value="0.7"
+ layout="topleft"
+ left_delta="15"
+ max_val="10"
+ name="WaterNormalScaleX"
+ top_pad="10"
+ width="200"/>
+ <slider
+ control_name="WaterNormalScaleY"
+ decimal_digits="1"
+ follows="left|top"
+ initial_value="0.7"
+ layout="topleft"
+ max_val="10"
+ name="WaterNormalScaleY"
+ top_pad="6"
+ width="200"/>
+ <slider
+ control_name="WaterNormalScaleZ"
+ decimal_digits="1"
+ follows="left|top"
+ initial_value="0.7"
+ layout="topleft"
+ max_val="10"
+ name="WaterNormalScaleZ"
+ top_pad="6"
+ width="200"/>
+
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ name="HDText"
+ top_pad="16"
+ width="215">
+ Fresnel Scale
+ </text>
+ <slider
+ control_name="WaterFresnelScale"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0.7"
+ layout="topleft"
+ left_delta="15"
+ name="WaterFresnelScale"
+ top_pad="10"
+ width="200"/>
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ name="FresnelOffsetText"
+ top_pad="15"
+ width="215">
+ Fresnel Offset
+ </text>
+ <slider
+ control_name="WaterFresnelOffset"
+ decimal_digits="2"
+ follows="left"
+ increment="0.01"
+ initial_value="0.7"
+ layout="topleft"
+ left_delta="15"
+ name="WaterFresnelOffset"
+ top_pad="10"
+ width="200"/>
+
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ layout="topleft"
+ left_delta="-15"
+ name="BHText2"
+ top_pad="15"
+ width="215">
+ Little Wave Direction
+ </text>
+ <slider
+ control_name="WaterWave2DirX"
+ decimal_digits="2"
+ follows="left|top"
+ increment="0.01"
+ initial_value="0.7"
+ label="X"
+ layout="topleft"
+ max_val="4"
+ min_val="-4"
+ name="WaterWave2DirX"
+ top_pad="10"
+ width="216" />
+ <slider
+ control_name="WaterWave2DirY"
+ decimal_digits="2"
+ follows="left|top"
+ increment="0.01"
+ initial_value="0.7"
+ label="Y"
+ layout="topleft"
+ max_val="4"
+ min_val="-4"
+ name="WaterWave2DirY"
+ top_pad="6"
+ width="216" />
+
+<!--======== III conlumn of contorls ========-->
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_pad="20"
+ name="DensMultText"
+ top="5"
+ width="215">
+ Refract Scale Above
+ </text>
+ <slider
+ control_name="WaterScaleAbove"
+ decimal_digits="2"
+ follows="left|top"
+ increment="0.01"
+ initial_value="0.1"
+ layout="topleft"
+ left_delta="15"
+ name="WaterScaleAbove"
+ top_pad="5"
+ width="200" />
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="WaterScaleBelowText"
+ top_pad="15"
+ width="215">
+ Refract Scale Below
+ </text>
+ <slider
+ control_name="WaterScaleBelow"
+ decimal_digits="2"
+ follows="left|top"
+ height="10"
+ increment="0.01"
+ initial_value="0"
+ layout="topleft"
+ left_delta="15"
+ name="WaterScaleBelow"
+ top_pad="5"
+ width="200"/>
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="MaxAltText"
+ top_pad="15"
+ width="215">
+ Blur Multiplier
+ </text>
+ <slider
+ control_name="WaterBlurMult"
+ follows="left|top"
+ height="10"
+ increment="0.001"
+ initial_value="0"
+ layout="topleft"
+ left_delta="15"
+ max_val="0.16"
+ name="WaterBlurMult"
+ top_pad="5"
+ width="200"/>
+
+ <text
+ follows="left|top|right"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-15"
+ name="BHText3"
+ top_pad="15"
+ width="215">
+ Normal Map
+ </text>
+ <texture_picker
+ height="80"
+ layout="topleft"
+ left_delta="15"
+ name="WaterNormalMap"
+ top_pad="5"
+ width="100" />
+ </panel>
+<!--======== End of Controls panel ========-->
+
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ left="10"
+ name="horiz_separator"
+ top_pad="5"
+ width="700"/>
+ <check_box
+ follows="top|left"
+ height="10"
+ label="Make this preset my new water setting"
+ layout="topleft"
+ left="275"
+ name="make_default_cb"
+ top_pad="20"
+ width="280"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Save"
+ layout="topleft"
+ left_pad="0"
+ name="save"
+ width="70"/>
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="15"
+ name="cancel"
+ width="70"/>
+
+ </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_env_settings.xml b/indra/newview/skins/default/xui/en/floater_env_settings.xml
index 8df5e232d9..e6cf433c8d 100644
--- a/indra/newview/skins/default/xui/en/floater_env_settings.xml
+++ b/indra/newview/skins/default/xui/en/floater_env_settings.xml
@@ -141,7 +141,15 @@
layout="topleft"
left="10"
name="EnvUseEstateTimeButton"
- top="120"
+ top_pad="20"
+ width="137" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Use Local Time"
+ left_pad="5"
+ name="EnvUseLocalTimeButton"
+ top_delta="0"
width="137" />
<button
follows="left|top"
diff --git a/indra/newview/skins/default/xui/en/floater_environment_settings.xml b/indra/newview/skins/default/xui/en/floater_environment_settings.xml
new file mode 100644
index 0000000000..1b1cafaca6
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_environment_settings.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ height="328"
+ layout="topleft"
+ name="Environment Editor Floater"
+ help_topic="environment_editor_floater"
+ save_rect="true"
+ title="ENVIRONMENT SETTINGS"
+ width="540">
+
+ <text
+ follows="top|left|right"
+ height="15"
+ layout="topleft"
+ left="20"
+ name="note"
+ top="25"
+ width="510"
+ wrap="true">
+ Use the options below to customize the environment settings for your viewer.
+ </text>
+
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="237"
+ layout="topleft"
+ left="20"
+ name="border"
+ top_pad="8"
+ width="500"/>
+ <radio_group
+ follows="top|left"
+ height="45"
+ layout="topleft"
+ left_delta="10"
+ name="region_settings_radio_group"
+ top_delta="20"
+ width="200">
+ <radio_item
+ label="Use region settings"
+ layout="topleft"
+ name="use_region_settings"/>
+ <radio_item
+ label="Customize my environment"
+ layout="topleft"
+ name="use_my_settings"
+ top_pad="20"/>
+ </radio_group>
+
+ <panel
+ height="170"
+ layout="topleft"
+ left="50"
+ name="user_environment_settings"
+ top_pad="0"
+ width="470">
+
+ <text
+ follows="top|left|right"
+ font="SansSerifItalic"
+ height="15"
+ layout="topleft"
+ left_delta="0"
+ name="note"
+ top_pad="0"
+ width="470"
+ wrap="true">
+ Note: your custom settings will not be visible to other users.
+ </text>
+
+ <!-- Water Setting -->
+ <text
+ name="water_settings_title"
+ follows="top|left"
+ height="16"
+ layout="topleft"
+ left="50"
+ top="40"
+ width="200">
+ Water Setting
+ </text>
+ <combo_box
+ follows="top|left"
+ left_pad="2"
+ name="water_settings_preset_combo"
+ top_delta="-5"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+
+
+ <!-- Sky/Day Cycle Settings -->
+ <text
+ name="sky_dayc_settings_title"
+ follows="top|left"
+ height="16"
+ layout="topleft"
+ left="50"
+ top_pad="20"
+ width="100">
+ Sky / Day Cycle
+ </text>
+ <radio_group
+ layout="topleft"
+ left_delta="50"
+ name="sky_dayc_settings_radio_group"
+ top_pad="10"
+ height="50"
+ width="150">
+ <radio_item
+ layout="topleft"
+ label="Fixed sky"
+ name="my_sky_settings"/>
+ <radio_item
+ layout="topleft"
+ label="Day cycle"
+ name="my_dayc_settings"
+ top_pad="25"/>
+ </radio_group>
+ <combo_box
+ follows="top|left"
+ left_pad="2"
+ name="sky_settings_preset_combo"
+ top_delta="-7"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+ <combo_box
+ follows="top|left"
+ name="dayc_settings_preset_combo"
+ top_delta="36"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+ </panel>
+
+ <button
+ follows="left|top"
+ height="23"
+ label="OK"
+ layout="topleft"
+ right="-130"
+ name="ok_btn"
+ top_pad="10"
+ width="100" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="10"
+ name="cancel_btn"
+ width="100" />
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_region_info.xml b/indra/newview/skins/default/xui/en/floater_region_info.xml
index 32fb6f97e7..3b58cd08f6 100644
--- a/indra/newview/skins/default/xui/en/floater_region_info.xml
+++ b/indra/newview/skins/default/xui/en/floater_region_info.xml
@@ -16,5 +16,5 @@
name="region_panels"
right="-1"
tab_position="top"
- top="20" />
+ top="20"/>
</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_windlight_options.xml b/indra/newview/skins/default/xui/en/floater_windlight_options.xml
index 7923dd87fa..9fbb784c76 100644
--- a/indra/newview/skins/default/xui/en/floater_windlight_options.xml
+++ b/indra/newview/skins/default/xui/en/floater_windlight_options.xml
@@ -1273,16 +1273,6 @@
name="WLCloudScrollY"
top="85"
width="200" />
- <check_box
- control_name="DrawClassicClouds"
- follows="left"
- height="16"
- label="Draw Classic Clouds"
- layout="topleft"
- left="480"
- name="DrawClassicClouds"
- top="104"
- width="200" />
</panel>
</tab_container>
</floater>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index a0d0c8625e..317c6fe9ac 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -480,7 +480,7 @@
<menu_item_separator/>
- <menu
+ <menu
create_jump_keys="true"
label="Sun"
name="Environment Settings"
@@ -515,24 +515,105 @@
function="World.EnvSettings"
parameter="midnight" />
</menu_item_call>
- <menu_item_call
- label="Estate Time"
- name="Revert to Region Default">
- <menu_item_call.on_click
- function="World.EnvSettings"
- parameter="default" />
- </menu_item_call>
-
- <menu_item_separator/>
-
- <menu_item_call
- label="Environment Editor"
- name="Environment Editor">
- <menu_item_call.on_click
- function="World.EnvSettings"
- parameter="editor" />
- </menu_item_call>
</menu>
+
+
+ <menu
+ create_jump_keys="true"
+ label="Enviroment Editor"
+ name="Enviroment Editor"
+ tear_off="true">
+
+ <menu_item_call
+ label="Enviroment Settings..."
+ name="Enviroment Settings">
+ <menu_item_call.on_click
+ function="World.EnvSettings"
+ parameter="editor"/>
+ </menu_item_call>
+
+ <menu_item_separator/>
+
+ <menu
+ name="Water Presets"
+ label="Water Presets">
+ <menu_item_call
+ label="New preset..."
+ name="new_water_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="new_water"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Edit preset..."
+ name="edit_water_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="edit_water"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Delete preset..."
+ name="delete_water_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="delete_water"/>
+ </menu_item_call>
+ </menu>
+
+ <menu
+ name="Sky Presets"
+ label="Sky Presets">
+ <menu_item_call
+ label="New preset..."
+ name="new_sky_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="new_sky"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Edit preset..."
+ name="edit_sky_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="edit_sky"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Delete preset..."
+ name="delete_sky_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="delete_sky"/>
+ </menu_item_call>
+ </menu>
+
+ <menu
+ name="Day Presets"
+ label="Day Presets">
+ <menu_item_call
+ label="New preset..."
+ name="new_day_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="new_day_cycle"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Edit preset..."
+ name="edit_day_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="edit_day_cycle"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Delete preset..."
+ name="delete_day_preset">
+ <menu_item_call.on_click
+ function="World.EnvPreset"
+ parameter="delete_day_cycle"/>
+ </menu_item_call>
+ </menu>
+ </menu>
+
+
</menu>
<menu
create_jump_keys="true"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index db1cee5d08..60ab4d2bc5 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4882,6 +4882,80 @@ This day cycle file references a missing sky file: [SKY].
<notification
icon="alertmodal.tga"
+ name="WLRegionApplyFail"
+ type="alertmodal">
+Sorry, the settings couldn't be applied to the region. Leaving the region and then returning may help rectify the problem. The reason given was: [FAIL_REASON]
+ </notification>
+
+ <notification
+ functor="GenericAcknowledge"
+ icon="alertmodal.tga"
+ name="EnvEditExternalCancel"
+ type="alertmodal">
+Warning: an update to the environment settings you were just editing was received, either because settings you recently committed have just been applied or because someone else with editing permissions updated the region's environment settings. In order to avoid overwriting this update, your changes have been cancelled; concurrent edits are not permitted. Please try again.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ functor="GenericAlertYesCancel"
+ icon="alertmodal.tga"
+ name="EnvEditUnsavedChangesCancel"
+ type="alertmodal">
+Warning: you have un-applied changes to the following environment settings: [SCOPE]. Are you sure you want to cancel them?
+ <usetemplate
+ name="okcancelbuttons"
+ yestext="Cancel Changes"
+ notext="Resume Editing"/>
+ </notification>
+
+ <notification
+ functor="GenericAcknowledge"
+ icon="alertmodal.tga"
+ name="EnvOtherScopeAlreadyOpen"
+ type="alertmodal">
+You cannot modify your local environment settings and region environment settings at the same time. Close the environment settings windows currently open and try again.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ functor="GenericAcknowledge"
+ icon="alertmodal.tga"
+ name="EnvCannotDeleteLastDayCycleKey"
+ type="alertmodal">
+Unable to delete the last key in this day cycle because you cannot have an empty day cycle. You should modify the last remaining key instead of attempting to delete it and then to create a new one.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ functor="GenericAcknowledge"
+ icon="alertmodal.tga"
+ name="DayCycleTooManyKeyframes"
+ type="alertmodal">
+You cannot add any more keyframes to this day cycle. The maximum number of keyframes for day cycles of [SCOPE] scope is [MAX].
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ functor="GenericAcknowledge"
+ icon="alertmodal.tga"
+ name="EnvUpdateRate"
+ type="alertmodal">
+ You may only update region environmental settings every [WAIT] seconds. Wait at least that long and then try again.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="PPSaveEffectAlert"
type="alertmodal">
PostProcess Effect exists. Do you still wish overwrite it?
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
new file mode 100644
index 0000000000..aa38c49fae
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+
+<panel
+ border="true"
+ follows="top|left"
+ height="300"
+ label="Environment"
+ layout="topleft"
+ help_topic="panel_region_environment_tab"
+ name="panel_env_info"
+ width="530">
+ <text
+ name="water_settings_title"
+ follows="top|left"
+ height="30"
+ layout="topleft"
+ left="50"
+ top_pad="20"
+ width="430"
+ wrap="true">
+ Select the Water and Sky/Day Cycle Settings you would like all visitors to your region to see. More info
+ </text>
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="237"
+ layout="topleft"
+ left="50"
+ name="border"
+ top="60"
+ width="430"/>
+ <radio_group
+ follows="top|left"
+ height="45"
+ layout="topleft"
+ left_delta="10"
+ name="region_settings_radio_group"
+ top_delta="20"
+ width="200">
+ <radio_item
+ label="Use Second Life default"
+ layout="topleft"
+ name="use_sl_default_settings"/>
+ <radio_item
+ label="Use the following settings"
+ layout="topleft"
+ name="use_my_settings"
+ top_pad="20"/>
+ </radio_group>
+ <panel
+ follows="top|left"
+ height="150"
+ layout="topleft"
+ left="50"
+ name="user_environment_settings"
+ top_pad="20"
+ width="430">
+ <text
+ name="water_settings_title"
+ follows="top|left"
+ height="16"
+ layout="topleft"
+ left="50"
+ top_pad="0"
+ width="160">
+ Water Setting
+ </text>
+ <combo_box
+ follows="top|left"
+ left_pad="2"
+ name="water_settings_preset_combo"
+ top_delta="-7"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+ <text
+ name="sky_dayc_settings_title"
+ follows="top|left"
+ height="16"
+ layout="topleft"
+ left="50"
+ top_pad="30"
+ width="100">
+ Sky / Day Cycle
+ </text>
+ <radio_group
+ layout="topleft"
+ left_delta="50"
+ name="sky_dayc_settings_radio_group"
+ top_pad="10"
+ height="50"
+ width="110">
+ <radio_item
+ layout="topleft"
+ label="Fixed sky"
+ name="my_sky_settings"/>
+ <radio_item
+ layout="topleft"
+ label="Day cycle"
+ name="my_dayc_settings"
+ top_pad="25"/>
+ </radio_group>
+ <combo_box
+ follows="top|left"
+ left_pad="2"
+ name="sky_settings_preset_combo"
+ top_delta="-7"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+ <combo_box
+ follows="top|left"
+ name="dayc_settings_preset_combo"
+ top_delta="36"
+ width="200">
+ <combo_box.item
+ label="-Select a preset-"
+ name="item0"/>
+ </combo_box>
+ </panel>
+ <button
+ follows="left|top"
+ height="23"
+ label="Apply"
+ layout="topleft"
+ right="-160"
+ name="apply_btn"
+ top_pad="10"
+ width="100" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="10"
+ name="cancel_btn"
+ width="100" />
+ <loading_indicator
+ height="23"
+ left="50"
+ name="progress_indicator"
+ top_delta="0"
+ visible="false"
+ width="23" />
+</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_region_estate.xml b/indra/newview/skins/default/xui/en/panel_region_estate.xml
index 1307d807e2..450853993a 100644
--- a/indra/newview/skins/default/xui/en/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_estate.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
- border="false"
+ border="true"
follows="top|left"
height="510"
help_topic="panel_region_estate_tab"
@@ -20,7 +20,7 @@
name="estate_help_text"
top="14"
word_wrap="true"
- width="300">
+ >
Changes to settings on this tab will affect all regions in the estate.
</text>
<text
@@ -30,9 +30,10 @@
font="SansSerif"
height="20"
layout="topleft"
- left_delta="0"
+ right="160"
name="estate_text"
top_pad="2"
+ halign="right"
width="140">
Estate:
</text>
@@ -43,9 +44,9 @@
font="SansSerif"
height="20"
layout="topleft"
- left_delta="0"
+ top_delta="0"
name="estate_name"
- top_delta="16"
+ left_pad="6"
width="150">
(unknown)
</text>
@@ -56,9 +57,10 @@
font="SansSerif"
height="20"
layout="topleft"
- left_delta="0"
+ right="160"
name="owner_text"
- top_pad="2"
+ top_pad="6"
+ halign="right"
width="150">
Estate owner:
</text>
@@ -69,66 +71,40 @@
font="SansSerif"
height="20"
layout="topleft"
- left_delta="0"
+ top_delta="0"
name="estate_owner"
- top_delta="16"
+ left_pad="6"
use_ellipses="true"
width="290">
(unknown)
</text>
- <view_border
- bevel_style="in"
- follows="top|left"
- height="270"
- layout="topleft"
- left_delta="-4"
- top_pad="5"
- width="300" />
+
<check_box
height="20"
- label="Use Global Time"
+ label="Allow Public Access"
layout="topleft"
- left="12"
- name="use_global_time_check"
- top="132"
+ left="10"
+ name="externally_visible_check"
+ top_pad="6"
width="200" />
+
<check_box
height="20"
- label="Fixed Sun"
- layout="topleft"
- left="12"
- name="fixed_sun_check"
- top="152"
- width="100" />
- <icon
- height="20"
- image_name="icon_day_cycle.tga"
+ label="Allow Voice Chat"
layout="topleft"
- left="47"
- name="daycycle"
- top="177"
- width="165" />
- <slider
- follows="left|top"
- height="20"
- increment="0.001"
- label="Phase"
- layout="topleft"
- left="12"
- max_val="30"
- min_val="6"
- name="sun_hour_slider"
- show_text="false"
- top="202"
+ left="280"
+ name="voice_chat_check"
+ top_delta="0"
width="200" />
<check_box
height="20"
- label="Allow Public Access"
+ label="Allow Direct Teleport"
layout="topleft"
left_delta="0"
- name="externally_visible_check"
- top_pad="6"
- width="200" />
+ name="allow_direct_teleport"
+ top_pad="4"
+ width="80" />
+
<text
type="string"
length="1"
@@ -137,7 +113,7 @@
layout="topleft"
left="32"
name="Only Allow"
- top="250"
+ top_delta="0"
width="278">
Restrict Access to accounts verified by:
</text>
@@ -161,50 +137,6 @@
tool_tip="Ban Residents who have not verified their age. See the [SUPPORT_SITE] for more information."
top_pad="2"
width="278" />
- <check_box
- height="20"
- label="Allow Voice Chat"
- layout="topleft"
- left="12"
- name="voice_chat_check"
- top="304"
- width="200" />
- <check_box
- height="20"
- label="Allow Direct Teleport"
- layout="topleft"
- left="12"
- name="allow_direct_teleport"
- top_pad="4"
- width="80" />
- <button
- enabled="false"
- follows="left|top"
- height="23"
- label="Apply"
- layout="topleft"
- name="apply_btn"
- top_pad="10"
- left="110"
- width="97" />
- <button
- follows="left|top"
- height="23"
- label="Send Message To Estate..."
- layout="topleft"
- left="45"
- name="message_estate_btn"
- top_pad="20"
- width="220" />
- <button
- follows="left|top"
- height="23"
- label="Kick Resident from Estate..."
- layout="topleft"
- left="45"
- name="kick_user_from_estate_btn"
- top_pad="5"
- width="220" />
<text
type="string"
@@ -214,16 +146,31 @@
height="20"
layout="topleft"
name="estate_manager_label"
- right="520"
+ top_pad="10"
+ left="10"
width="200">
Estate Managers:
</text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="280"
+ name="allow_resident_label"
+ top_delta="0"
+ width="200">
+ Allowed Residents:
+ </text>
+
+ <!-- Estate Managers box -->
<view_border
bevel_style="none"
follows="top|left"
height="71"
layout="topleft"
- right="520"
+ left="10"
top_pad="-5"
width="200" />
<name_list
@@ -235,43 +182,15 @@
name="estate_manager_name_list"
top_delta="0"
width="200" />
- <button
- follows="left|top"
- height="23"
- label="Remove..."
- layout="topleft"
- name="remove_estate_manager_btn"
- right="520"
- top_pad="5"
- width="97" />
- <button
- follows="left|top"
- height="23"
- label="Add..."
- layout="topleft"
- left_delta="-103"
- name="add_estate_manager_btn"
- top_delta="0"
- width="97" />
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left_delta="0"
- name="allow_resident_label"
- top_pad="10"
- width="200">
- Allowed Residents:
- </text>
+
+ <!-- Allowed Residents box -->
<view_border
bevel_style="none"
follows="top|left"
height="71"
layout="topleft"
- right="520"
- top_pad="-5"
+ left="280"
+ top_delta="0"
width="200" />
<name_list
follows="left|top"
@@ -282,42 +201,78 @@
name="allowed_avatar_name_list"
top_delta="0"
width="200" />
+
+ <!-- Estate Managers buttons -->
+ <button
+ follows="left|top"
+ height="23"
+ label="Add..."
+ layout="topleft"
+ left="10"
+ name="add_estate_manager_btn"
+ top_pad="6"
+ width="97" />
<button
follows="left|top"
height="23"
label="Remove..."
layout="topleft"
- name="remove_allowed_avatar_btn"
- right="520"
- top_pad="5"
+ name="remove_estate_manager_btn"
+ left_pad="6"
width="97" />
+
+ <!-- Allowed Residents buttons -->
<button
follows="left|top"
height="23"
+ left="280"
label="Add..."
layout="topleft"
- left_delta="-103"
name="add_allowed_avatar_btn"
top_delta="0"
width="97" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Remove..."
+ layout="topleft"
+ name="remove_allowed_avatar_btn"
+ left_pad="6"
+ top_delta="0"
+ width="97" />
+
<text
type="string"
length="1"
follows="left|top"
height="20"
layout="topleft"
- left_delta="0"
+ left="10"
name="allow_group_label"
top_pad="10"
width="200">
Allowed Groups:
</text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="280"
+ name="ban_resident_label"
+ top_delta="0"
+ width="200">
+ Banned Residents:
+ </text>
+
+ <!-- Allowed Groups box -->
<view_border
bevel_style="none"
follows="top|left"
height="71"
layout="topleft"
- right="520"
+ left="10"
top_pad="-5"
width="200" />
<name_list
@@ -329,43 +284,15 @@
name="allowed_group_name_list"
top_delta="0"
width="200" />
- <button
- follows="left|top"
- height="23"
- label="Remove..."
- layout="topleft"
- name="remove_allowed_group_btn"
- right="520"
- top_pad="5"
- width="97" />
- <button
- follows="left|top"
- height="23"
- label="Add..."
- layout="topleft"
- left_delta="-103"
- name="add_allowed_group_btn"
- top_delta="0"
- width="97" />
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left_delta="0"
- name="ban_resident_label"
- top_pad="10"
- width="200">
- Banned Residents:
- </text>
+
+ <!-- Banned Residents box -->
<view_border
bevel_style="none"
follows="top|left"
height="71"
layout="topleft"
- right="520"
- top_pad="-5"
+ left="280"
+ top_delta="0"
width="200" />
<name_list
follows="left|top"
@@ -376,22 +303,64 @@
name="banned_avatar_name_list"
top_delta="0"
width="200" />
+
+ <!-- Allowed Groups buttons -->
+ <button
+ follows="left|top"
+ height="23"
+ label="Add..."
+ layout="topleft"
+ left="10"
+ name="add_allowed_group_btn"
+ top_pad="6"
+ width="97" />
<button
follows="left|top"
height="23"
label="Remove..."
layout="topleft"
- name="remove_banned_avatar_btn"
- right="520"
- top_pad="5"
+ name="remove_allowed_group_btn"
+ left_pad="6"
+ top_delta="0"
width="97" />
+
+ <!-- Banned Residents buttons -->
<button
follows="left|top"
height="23"
label="Add..."
layout="topleft"
- left_delta="-103"
+ left="280"
name="add_banned_avatar_btn"
top_delta="0"
width="97" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Remove..."
+ layout="topleft"
+ name="remove_banned_avatar_btn"
+ top_delta="0"
+ left_pad="6"
+ width="97" />
+
+ <button
+ follows="left|top"
+ height="23"
+ label="Send Message To Estate..."
+ layout="topleft"
+ left="10"
+ name="message_estate_btn"
+ top_pad="20"
+ width="220" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Kick Resident from Estate..."
+ layout="topleft"
+ left="280"
+ name="kick_user_from_estate_btn"
+ top_delta="0"
+ width="220" />
+
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain.xml b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
index 5093c52129..bbb8b40594 100644
--- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
@@ -2,7 +2,7 @@
<panel
border="true"
follows="top|left"
- height="320"
+ height="460"
help_topic="panel_region_terrain_tab"
label="Terrain"
layout="topleft"
@@ -50,10 +50,10 @@
label="Terrain Raise Limit"
label_width="120"
layout="topleft"
- left="15"
+ left="240"
max_val="100"
name="terrain_raise_spin"
- top="60"
+ top="40"
width="180" />
<spinner
follows="left|top"
@@ -62,95 +62,336 @@
label="Terrain Lower Limit"
label_width="120"
layout="topleft"
- left="15"
+ left="240"
max_val="0"
min_val="-100"
name="terrain_lower_spin"
- top="80"
+ top="60"
width="180" />
- <check_box
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="60"
+ layout="topleft"
+ left="8"
+ top="30"
+ width="460" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
height="20"
- label="Use Estate Sun"
layout="topleft"
- left="250"
- name="use_estate_sun_check"
- top="35"
+ left="10"
+ name="detail_texture_text"
+ top="110"
+ width="300">
+ Terrain Textures (requires 512x512, 24 bit .tga files)
+ </text>
+ <texture_picker
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_delta="0"
+ name="texture_detail_0"
+ top_delta="20"
width="100" />
- <check_box
- height="20"
- label="Fixed Sun"
+ <texture_picker
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_pad="10"
+ name="texture_detail_1"
+ top_delta="0"
+ width="100" />
+ <texture_picker
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_pad="10"
+ name="texture_detail_2"
+ top_delta="0"
+ width="100" />
+ <texture_picker
+ follows="left|top"
+ height="100"
layout="topleft"
- left="250"
- name="fixed_sun_check"
- top="55"
+ left_pad="10"
+ name="texture_detail_3"
+ top_delta="0"
width="100" />
- <icon
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
height="20"
- image_name="icon_day_cycle.tga"
layout="topleft"
- left="285"
- name="daycycle"
- top="80"
- width="165" />
- <slider
+ left="10"
+ name="height_text_lbl"
+ top_delta="90"
+ width="65">
+ 1 (Low)
+ </text>
+ <text
+ type="string"
+ length="1"
follows="left|top"
height="20"
- increment="0.001"
- label="Phase"
layout="topleft"
- left="250"
- max_val="30"
- min_val="6"
- name="sun_hour_slider"
- show_text="false"
- top="105"
- width="200" />
- <button
- enabled="false"
+ left_pad="45"
+ name="height_text_lbl2"
+ top_delta="0"
+ width="100">
+ 2
+ </text>
+ <text
+ type="string"
+ length="1"
follows="left|top"
height="20"
- label="Apply"
layout="topleft"
- left="350"
- name="apply_btn"
- top="135"
- width="90" />
- <view_border
- bevel_style="none"
- follows="top|left"
- height="130"
+ left_pad="10"
+ name="height_text_lbl3"
+ top_delta="0"
+ width="100">
+ 3
+ </text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="20"
layout="topleft"
- left="8"
- top="30"
- width="460" />
+ left_pad="10"
+ name="height_text_lbl4"
+ top_delta="0"
+ width="100">
+ 4 (High)
+ </text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="10"
+ name="height_text_lbl5"
+ top_delta="30"
+ width="300">
+ Texture Elevation Ranges
+ </text>
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="10"
+ name="height_text_lbl10"
+ top_delta="30"
+ width="200"
+ word_wrap="true">
+ These values represent the blend range for the textures above.
+ </text>
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left_delta="0"
+ name="height_text_lbl11"
+ top_delta="32"
+ width="200"
+ word_wrap="true">
+ Measured in meters, the LOW value is the MAXIMUM height of Texture #1, and the HIGH value is the MINIMUM height of Texture #4.
+ </text>
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="270"
+ name="height_text_lbl6"
+ top="250"
+ width="100">
+ Northwest
+ </text>
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left_pad="10"
+ name="height_text_lbl7"
+ top_delta="0"
+ width="100">
+ Northeast
+ </text>
+<!-- northwest low-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="Low"
+ label_width="37"
+ layout="topleft"
+ left="230"
+ max_val="500"
+ min_val="-500"
+ name="height_start_spin_1"
+ top_delta="15"
+ width="100" />
+<!-- northeast low-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="Low"
+ label_width="37"
+ layout="topleft"
+ left_pad="10"
+ max_val="500"
+ min_val="-500"
+ name="height_start_spin_3"
+ top_delta="0"
+ width="100" />
+<!-- northwest high-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="High"
+ label_width="37"
+ layout="topleft"
+ left="230"
+ max_val="500"
+ min_val="-500"
+ name="height_range_spin_1"
+ top_delta="20"
+ width="100" />
+<!-- northeast high-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="High"
+ label_width="37"
+ layout="topleft"
+ left_pad="10"
+ max_val="500"
+ min_val="-500"
+ name="height_range_spin_3"
+ top_delta="0"
+ width="100" />
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left="270"
+ name="height_text_lbl8"
+ top_pad="10"
+ width="100">
+ Southwest
+ </text>
+ <text
+ follows="left|top"
+ height="20"
+ layout="topleft"
+ left_pad="10"
+ name="height_text_lbl9"
+ top_delta="0"
+ width="100">
+ Southeast
+ </text>
+<!-- southwest low-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="Low"
+ label_width="37"
+ layout="topleft"
+ left="230"
+ max_val="500"
+ min_val="-500"
+ name="height_start_spin_0"
+ top_delta="15"
+ width="100" />
+<!-- southeast low-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="Low"
+ label_width="37"
+ layout="topleft"
+ left_pad="10"
+ max_val="500"
+ min_val="-500"
+ name="height_start_spin_2"
+ top_delta="0"
+ width="100" />
+<!--southwest high-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="High"
+ label_width="37"
+ layout="topleft"
+ left="230"
+ max_val="500"
+ min_val="-500"
+ name="height_range_spin_0"
+ top_delta="20"
+ width="100" />
+<!-- southeast high-->
+ <spinner
+ follows="left|top"
+ height="20"
+ increment="0.5"
+ label="High"
+ label_width="37"
+ layout="topleft"
+ left_pad="10"
+ max_val="500"
+ min_val="-500"
+ name="height_range_spin_2"
+ top_delta="0"
+ width="100" />
+<!-- Terrain Download/Upload/Bake buttons -->
<button
follows="left|top"
height="20"
label="Download RAW terrain..."
layout="topleft"
- left_delta="2"
+ left="10"
name="download_raw_btn"
tool_tip="Available only to estate owners, not managers"
- top_pad="60"
- width="170" />
+ top="390"
+ width="160" />
<button
follows="left|top"
height="20"
label="Upload RAW terrain..."
layout="topleft"
- left="10"
+ left_pad="10"
+ top_delta="0"
name="upload_raw_btn"
tool_tip="Available only to estate owners, not managers"
- top="243"
- width="170" />
+ width="160" />
<button
follows="left|top"
height="20"
label="Bake Terrain"
layout="topleft"
- left="10"
+ left_pad="10"
name="bake_terrain_btn"
tool_tip="Set current terrain as mid-point for raise/lower limits"
- top="283"
+ width="100" />
+ <button
+ enabled="true"
+ follows="left|top"
+ height="20"
+ label="Apply"
+ layout="topleft"
+ left_delta="0"
+ name="apply_btn"
+ top="430"
width="100" />
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_region_texture.xml b/indra/newview/skins/default/xui/en/panel_region_texture.xml
deleted file mode 100644
index 5d910ea659..0000000000
--- a/indra/newview/skins/default/xui/en/panel_region_texture.xml
+++ /dev/null
@@ -1,327 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- border="true"
- follows="top|left"
- height="320"
- help_topic="panel_region_texture_tab"
- label="Ground Textures"
- layout="topleft"
- left="0"
- name="Textures"
- top="320"
- width="480">
- <text
- type="string"
- length="1"
- follows="left|top"
- font="SansSerif"
- height="20"
- layout="topleft"
- left="10"
- name="region_text_lbl"
- top="10"
- width="100">
- Region:
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- font="SansSerif"
- height="20"
- layout="topleft"
- left_delta="50"
- name="region_text"
- top_delta="0"
- width="400">
- unknown
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left="10"
- name="detail_texture_text"
- top="36"
- width="300">
- Terrain Textures (requires 512x512, 24 bit .tga files)
- </text>
- <texture_picker
- follows="left|top"
- height="100"
- layout="topleft"
- left_delta="0"
- name="texture_detail_0"
- top_delta="20"
- width="100" />
- <texture_picker
- follows="left|top"
- height="100"
- layout="topleft"
- left_pad="10"
- name="texture_detail_1"
- top_delta="0"
- width="100" />
- <texture_picker
- follows="left|top"
- height="100"
- layout="topleft"
- left_pad="10"
- name="texture_detail_2"
- top_delta="0"
- width="100" />
- <texture_picker
- follows="left|top"
- height="100"
- layout="topleft"
- left_pad="10"
- name="texture_detail_3"
- top_delta="0"
- width="100" />
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left="10"
- name="height_text_lbl"
- top="146"
- width="65">
- 1 (Low)
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left_pad="45"
- name="height_text_lbl2"
- top_delta="0"
- width="100">
- 2
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left_pad="10"
- name="height_text_lbl3"
- top_delta="0"
- width="100">
- 3
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left_pad="10"
- name="height_text_lbl4"
- top_delta="0"
- width="100">
- 4 (High)
- </text>
- <text
- type="string"
- length="1"
- follows="left|top"
- height="20"
- layout="topleft"
- left="10"
- name="height_text_lbl5"
- top="170"
- width="300">
- Texture Elevation Ranges
- </text>
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left="51"
- name="height_text_lbl6"
- top="185"
- width="100">
- Northwest
- </text>
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left_pad="10"
- name="height_text_lbl7"
- top_delta="0"
- width="100">
- Northeast
- </text>
-<!-- northwest low-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="Low"
- label_width="37"
- layout="topleft"
- left="10"
- max_val="500"
- min_val="-500"
- name="height_start_spin_1"
- top_delta="15"
- width="100" />
-<!-- northeast low-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="Low"
- label_width="37"
- layout="topleft"
- left_pad="10"
- max_val="500"
- min_val="-500"
- name="height_start_spin_3"
- top_delta="0"
- width="100" />
-<!-- northwest high-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="High"
- label_width="37"
- layout="topleft"
- left="10"
- max_val="500"
- min_val="-500"
- name="height_range_spin_1"
- top_delta="20"
- width="100" />
-<!-- northeast high-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="High"
- label_width="37"
- layout="topleft"
- left_pad="10"
- max_val="500"
- min_val="-500"
- name="height_range_spin_3"
- top_delta="0"
- width="100" />
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left="51"
- name="height_text_lbl8"
- top_pad="10"
- width="100">
- Southwest
- </text>
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left_pad="10"
- name="height_text_lbl9"
- top_delta="0"
- width="100">
- Southeast
- </text>
-<!-- southwest low-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="Low"
- label_width="37"
- layout="topleft"
- left="10"
- max_val="500"
- min_val="-500"
- name="height_start_spin_0"
- top_delta="15"
- width="100" />
-<!-- southeast low-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="Low"
- label_width="37"
- layout="topleft"
- left_pad="10"
- max_val="500"
- min_val="-500"
- name="height_start_spin_2"
- top_delta="0"
- width="100" />
-<!--southwest high-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="High"
- label_width="37"
- layout="topleft"
- left="10"
- max_val="500"
- min_val="-500"
- name="height_range_spin_0"
- top_delta="20"
- width="100" />
-<!-- southeast high-->
- <spinner
- follows="left|top"
- height="20"
- increment="0.5"
- label="High"
- label_width="37"
- layout="topleft"
- left_pad="10"
- max_val="500"
- min_val="-500"
- name="height_range_spin_2"
- top_delta="0"
- width="100" />
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left="10"
- name="height_text_lbl10"
- top_delta="30"
- width="400"
- word_wrap="true">
- These values represent the blend range for the textures above.
- </text>
- <text
- follows="left|top"
- height="20"
- layout="topleft"
- left_delta="0"
- name="height_text_lbl11"
- top_delta="32"
- width="400"
- word_wrap="true">
- Measured in meters, the LOW value is the MAXIMUM height of Texture #1, and the HIGH value is the MINIMUM height of Texture #4.
- </text>
- <button
- enabled="false"
- follows="left|bottom"
- height="20"
- label="Apply"
- layout="topleft"
- left="350"
- name="apply_btn"
- top="290"
- width="100" />
-</panel>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 143a989d32..f1468797c1 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2355,6 +2355,12 @@ Returns a string with the requested data about the region
<string name="GroupOwned">Group Owned</string>
<string name="Public">Public</string>
+ <!-- Environment settings -->
+ <string name="LocalSettings">Local Settings</string>
+ <string name="RegionSettings">Region Settings</string>
+ <string name="Local">Local</string>
+ <string name="Region">Region</string>
+
<!-- panel classified -->
<string name="ClassifiedClicksTxt">Clicks: [TELEPORT] teleport, [MAP] map, [PROFILE] profile</string>
<string name="ClassifiedUpdateAfterPublish">(will update after publish)</string>
diff --git a/indra/newview/skins/default/xui/en/widgets/time.xml b/indra/newview/skins/default/xui/en/widgets/time.xml
new file mode 100644
index 0000000000..b5bdd564a6
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/time.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<time text_enabled_color="LabelTextColor"
+ text_disabled_color="LabelDisabledColor"
+ font="SansSerifSmall"
+ label_width="40" >
+ <time.up_button name="SpinCtrl Up"
+ image_unselected="Stepper_Up_Off"
+ image_selected="Stepper_Up_Press"
+ tab_stop="false"
+ follows="left|bottom" />
+ <time.down_button name="SpinCtrl Down"
+ image_unselected="Stepper_Down_Off"
+ image_selected="Stepper_Down_Press"
+ tab_stop="false"
+ follows="left|bottom" />
+</time>
diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp
new file mode 100644
index 0000000000..6646860b5e
--- /dev/null
+++ b/indra/newview/tests/lldir_stub.cpp
@@ -0,0 +1,45 @@
+/**
+ * @file lldir_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Use me only if you need to stub out some helper functions, not if you e.g. need sane numbers from countFilesInDir
+
+LLDir::LLDir() {}
+LLDir::~LLDir() {}
+BOOL LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { return true; }
+void LLDir::setChatLogsDir(const std::string &path) {}
+void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last) {}
+void LLDir::setLindenUserDir(const std::string &first, const std::string &last) {}
+void LLDir::setSkinFolder(const std::string &skin_folder) {}
+bool LLDir::setCacheDir(const std::string &path) { return true; }
+void LLDir::dumpCurrentDirectories() {}
+
+class LLDir_stub : public LLDir
+{
+public:
+ LLDir_stub() {}
+ ~LLDir_stub() {}
+
+ /*virtual*/ void initAppDirs(const std::string &app_name) {}
+
+ /*virtual*/ std::string getCurPath() { return "CUR_PATH_FROM_LLDIR"; }
+ /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; }
+ /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; }
+ /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; }
+ /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; }
+};
+
+LLDir_stub gDirUtil;
+
+LLDir* gDirUtilp = &gDirUtil;
+
+std::string LLDir::getExpandedFilename(ELLPath loc, const std::string& subdir, const std::string& filename) const
+{
+ return subdir + " --- " + filename + " --- expanded!";
+}
+
diff --git a/indra/newview/tests/llfloaterdaycycle_stub.cpp b/indra/newview/tests/llfloaterdaycycle_stub.cpp
new file mode 100644
index 0000000000..e6b145bcfc
--- /dev/null
+++ b/indra/newview/tests/llfloaterdaycycle_stub.cpp
@@ -0,0 +1,20 @@
+/**
+ * @file llfloaterdaycycle_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+class LLFloaterDayCycle
+{
+public:
+ static bool isOpen(void);
+ static LLFloaterDayCycle* instance(void);
+ static void syncMenu(void);
+};
+
+bool LLFloaterDayCycle::isOpen() { return true; }
+LLFloaterDayCycle* LLFloaterDayCycle::instance() { return NULL; }
+void LLFloaterDayCycle::syncMenu(void) {}
diff --git a/indra/newview/tests/llfloaterenvsettings_stub.cpp b/indra/newview/tests/llfloaterenvsettings_stub.cpp
new file mode 100644
index 0000000000..e9e792521f
--- /dev/null
+++ b/indra/newview/tests/llfloaterenvsettings_stub.cpp
@@ -0,0 +1,20 @@
+/**
+ * @file llfloaterenvsettings_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+class LLFloaterEnvSettings
+{
+public:
+ static bool isOpen(void);
+ static LLFloaterEnvSettings* instance(void);
+ void syncMenu(void);
+};
+
+bool LLFloaterEnvSettings::isOpen() { return true; }
+LLFloaterEnvSettings* LLFloaterEnvSettings::instance() { return NULL; }
+void LLFloaterEnvSettings::syncMenu(void) {}
diff --git a/indra/newview/tests/llfloaterwindlight_stub.cpp b/indra/newview/tests/llfloaterwindlight_stub.cpp
new file mode 100644
index 0000000000..f1891eaf21
--- /dev/null
+++ b/indra/newview/tests/llfloaterwindlight_stub.cpp
@@ -0,0 +1,20 @@
+/**
+ * @file llfloaterwindlight_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+class LLFloaterWindLight
+{
+public:
+ static bool isOpen(void);
+ static LLFloaterWindLight* instance(void);
+ void syncMenu(void);
+};
+
+bool LLFloaterWindLight::isOpen() { return true; }
+LLFloaterWindLight* LLFloaterWindLight::instance() { return NULL; }
+void LLFloaterWindLight::syncMenu(void) {}
diff --git a/indra/newview/tests/llglslshader_stub.cpp b/indra/newview/tests/llglslshader_stub.cpp
new file mode 100644
index 0000000000..5333c8a361
--- /dev/null
+++ b/indra/newview/tests/llglslshader_stub.cpp
@@ -0,0 +1,22 @@
+/**
+ * @file llglslshader_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#include "llglslshader.h"
+
+void LLGLSLShader::uniform1f(const std::string& uniform, F32 num)
+{
+}
+
+void LLGLSLShader::uniform3fv(const std::string& uniform, U32 count, const GLfloat *v)
+{
+}
+
+void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v)
+{
+}
diff --git a/indra/newview/tests/llpipeline_stub.cpp b/indra/newview/tests/llpipeline_stub.cpp
new file mode 100644
index 0000000000..85bf0ae3fb
--- /dev/null
+++ b/indra/newview/tests/llpipeline_stub.cpp
@@ -0,0 +1,15 @@
+/**
+ * @file llpipeline_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+class LLPipeline
+{
+public: BOOL canUseWindLightShaders() const;
+};
+BOOL LLPipeline::canUseWindLightShaders() const {return TRUE;}
+LLPipeline gPipeline;
diff --git a/indra/newview/tests/llsky_stub.cpp b/indra/newview/tests/llsky_stub.cpp
new file mode 100644
index 0000000000..35f4944a95
--- /dev/null
+++ b/indra/newview/tests/llsky_stub.cpp
@@ -0,0 +1,20 @@
+/**
+ * @file llsky_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+class LLSky
+{
+public:
+ void setOverrideSun(BOOL override);
+ void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
+};
+
+void LLSky::setOverrideSun(BOOL override) {}
+void LLSky::setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity) {}
+
+LLSky gSky;
diff --git a/indra/newview/tests/llviewershadermgr_stub.cpp b/indra/newview/tests/llviewershadermgr_stub.cpp
new file mode 100644
index 0000000000..0dae527035
--- /dev/null
+++ b/indra/newview/tests/llviewershadermgr_stub.cpp
@@ -0,0 +1,33 @@
+/**
+ * @file llglslshader_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#include "../llviewershadermgr.h"
+
+LLShaderMgr::LLShaderMgr() {}
+LLShaderMgr::~LLShaderMgr() {}
+
+LLViewerShaderMgr::LLViewerShaderMgr() {}
+LLViewerShaderMgr::~LLViewerShaderMgr() {}
+
+LLViewerShaderMgr* stub_instance = NULL;
+
+LLViewerShaderMgr* LLViewerShaderMgr::instance() {
+ if(NULL == stub_instance)
+ {
+ stub_instance = new LLViewerShaderMgr();
+ }
+
+ return stub_instance;
+}
+LLViewerShaderMgr::shader_iter fake_iter;
+LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const {return fake_iter;}
+LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const {return fake_iter;}
+
+void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader* shader) {return;}
+std::string LLViewerShaderMgr::getShaderDirPrefix() {return "SHADER_DIR_PREFIX-";}
diff --git a/indra/newview/tests/llwlanimator_stub.cpp b/indra/newview/tests/llwlanimator_stub.cpp
new file mode 100644
index 0000000000..4d1bb85544
--- /dev/null
+++ b/indra/newview/tests/llwlanimator_stub.cpp
@@ -0,0 +1,12 @@
+/**
+ * @file llwlanimator_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+LLWLAnimator::LLWLAnimator(void) {}
+void LLWLAnimator::update(LLWLParamSet& set) {}
+void LLWLAnimator::setTrack(std::map<F32, LLWLParamKey>& track, F32 dayRate, F64 dayTime, bool run) {}
diff --git a/indra/newview/tests/llwldaycycle_stub.cpp b/indra/newview/tests/llwldaycycle_stub.cpp
new file mode 100644
index 0000000000..d98c9614b4
--- /dev/null
+++ b/indra/newview/tests/llwldaycycle_stub.cpp
@@ -0,0 +1,35 @@
+/**
+ * @file llwldaycycle_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+LLWLDayCycle::LLWLDayCycle(void)
+{
+}
+
+LLWLDayCycle::~LLWLDayCycle(void)
+{
+}
+
+bool LLWLDayCycle::getKeytime(LLWLParamKey keyFrame, F32& keyTime)
+{
+ keyTime = 0.5;
+ return true;
+}
+
+bool LLWLDayCycle::removeKeyframe(F32 time)
+{
+ return true;
+}
+
+void LLWLDayCycle::loadDayCycleFromFile(const std::string& fileName)
+{
+}
+
+void LLWLDayCycle::removeReferencesTo(const LLWLParamKey &keyframe)
+{
+}
diff --git a/indra/newview/tests/llwlparammanager_test.cpp b/indra/newview/tests/llwlparammanager_test.cpp
new file mode 100644
index 0000000000..3d31567335
--- /dev/null
+++ b/indra/newview/tests/llwlparammanager_test.cpp
@@ -0,0 +1,257 @@
+/**
+ * @file llwlparammanager_test.cpp
+ * @brief LLWLParamManager tests
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled headers
+#include "../llviewerprecompiledheaders.h"
+
+// Class to test
+#include "../llwlparammanager.h"
+
+// Dependencies
+#include "linden_common.h"
+
+// TUT header
+#include "lltut.h"
+
+// Stubs
+#include "llwldaycycle_stub.cpp"
+#include "llwlparamset_stub.cpp"
+#include "llwlanimator_stub.cpp"
+#include "llglslshader_stub.cpp"
+#include "lldir_stub.cpp"
+#include "llsky_stub.cpp"
+#include "llfloaterdaycycle_stub.cpp"
+#include "llfloaterenvsettings_stub.cpp"
+#include "llfloaterwindlight_stub.cpp"
+#include "llpipeline_stub.cpp"
+#include "llviewershadermgr_stub.cpp"
+
+void assert_glerror(void) {}
+LLViewerCamera::LLViewerCamera() {}
+void LLViewerCamera::setView(F32 vertical_fov_rads) {}
+std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args) { return std::string(""); }
+
+char* curl_unescape(const char* c_str, int length)
+{
+ char* copy = new char[length+4];
+ memcpy(copy, c_str, length);
+ copy[length+0] = 'E';
+ copy[length+1] = 'S';
+ copy[length+2] = 'C';
+ copy[length+3] = '\0';
+ return copy;
+}
+void curl_free(void* p) {delete[] ((char*)p);}
+char* curl_escape(const char* c_str, int length) {
+ char* copy = new char[length+6];
+ memcpy(copy, c_str, length);
+ copy[length+0] = 'U';
+ copy[length+1] = 'N';
+ copy[length+2] = 'E';
+ copy[length+3] = 'S';
+ copy[length+4] = 'C';
+ copy[length+5] = '\0';
+ return copy;
+}
+
+namespace tut
+{
+ // Main Setup
+ struct LLWLParamManagerFixture
+ {
+ class LLWLParamManagerTest
+ {
+ };
+
+ LLWLParamManager* mTestManager;
+
+ LLWLParamManagerFixture()
+ : mTestManager(LLWLParamManager::getInstance())
+ {
+ }
+
+ ~LLWLParamManagerFixture()
+ {
+ }
+ };
+ typedef test_group<LLWLParamManagerFixture> factory;
+ typedef factory::object object;
+ factory tf("LLWLParamManager test");
+
+ // Tests
+ template<> template<>
+ void object::test<1>()
+ {
+ try
+ {
+ std::string preset =
+ "<llsd>\
+ <map>\
+ <key>ambient</key>\
+ <array>\
+ <real>1.0499999523162842</real>\
+ <real>1.0499999523162842</real>\
+ <real>1.0499999523162842</real>\
+ <real>0.34999999403953552</real>\
+ </array>\
+ <key>blue_density</key>\
+ <array>\
+ <real>0.2447581488182351</real>\
+ <real>0.44872328639030457</real>\
+ <real>0.75999999046325684</real>\
+ <real>0.38000004053115788</real>\
+ </array>\
+ <key>blue_horizon</key>\
+ <array>\
+ <real>0.49548382097675159</real>\
+ <real>0.49548381382419748</real>\
+ <real>0.63999999284744291</real>\
+ <real>0.31999999642372146</real>\
+ </array>\
+ <key>cloud_color</key>\
+ <array>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ </array>\
+ <key>cloud_pos_density1</key>\
+ <array>\
+ <real>1.6884100437164307</real>\
+ <real>0.52609699964523315</real>\
+ <real>0.99999999999999289</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_pos_density2</key>\
+ <array>\
+ <real>1.6884100437164307</real>\
+ <real>0.52609699964523315</real>\
+ <real>0.125</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_scale</key>\
+ <array>\
+ <real>0.4199999868869746</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_scroll_rate</key>\
+ <array>\
+ <real>10.199999809265137</real>\
+ <real>10.01099967956543</real>\
+ </array>\
+ <key>cloud_shadow</key>\
+ <array>\
+ <real>0.26999998092651367</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>density_multiplier</key>\
+ <array>\
+ <real>0.00017999998817685818</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>distance_multiplier</key>\
+ <array>\
+ <real>0.80000001192093606</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>east_angle</key>\
+ <real>0</real>\
+ <key>enable_cloud_scroll</key>\
+ <array>\
+ <boolean>1</boolean>\
+ <boolean>1</boolean>\
+ </array>\
+ <key>gamma</key>\
+ <array>\
+ <real>1</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>glow</key>\
+ <array>\
+ <real>5</real>\
+ <real>0.0010000000474974513</real>\
+ <real>-0.47999998927116394</real>\
+ <real>1</real>\
+ </array>\
+ <key>haze_density</key>\
+ <array>\
+ <real>0.69999998807907104</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>haze_horizon</key>\
+ <array>\
+ <real>0.18999999761581243</real>\
+ <real>0.19915600121021271</real>\
+ <real>0.19915600121021271</real>\
+ <real>1</real>\
+ </array>\
+ <key>lightnorm</key>\
+ <array>\
+ <real>0</real>\
+ <real>0.70710659027099609</real>\
+ <real>-0.70710694789886475</real>\
+ <real>0</real>\
+ </array>\
+ <key>max_y</key>\
+ <array>\
+ <real>1605</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>preset_num</key>\
+ <integer>22</integer>\
+ <key>star_brightness</key>\
+ <real>0</real>\
+ <key>sun_angle</key>\
+ <real>2.3561947345733643</real>\
+ <key>sunlight_color</key>\
+ <array>\
+ <real>0.73421055078505759</real>\
+ <real>0.78157895803450828</real>\
+ <real>0.89999997615813498</real>\
+ <real>0.29999998211860301</real>\
+ </array>\
+ </map>\
+ </llsd>";
+
+ std::stringstream preset_stream(preset);
+ mTestManager->loadPresetFromXML(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), preset_stream);
+ LLWLParamSet dummy;
+ ensure("Couldn't get ParamSet after loading it", mTestManager->getParamSet(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), dummy));
+ }
+ catch (...)
+ {
+ fail("loadPresetFromXML test crashed!");
+ }
+ }
+
+ template<> template<>
+ void object::test<2>()
+ {
+ mTestManager->propagateParameters();
+ ensure_equals("Wrong value from getDomeOffset()", mTestManager->getDomeOffset(), 0.96f);
+ ensure_equals("Wrong value from getDomeRadius()", mTestManager->getDomeRadius(), 15000.f);
+ ensure_equals("Wrong value from getLightDir()", mTestManager->getLightDir(), LLVector4(-0,0,1,0));
+ ensure_equals("Wrong value from getClampedLightDir()", mTestManager->getClampedLightDir(), LLVector4(-0,0,1,0));
+ ensure_equals("Wrong value from getRotatedLightDir()", mTestManager->getRotatedLightDir(), LLVector4(0,0,0,1));
+ }
+}
diff --git a/indra/newview/tests/llwlparamset_stub.cpp b/indra/newview/tests/llwlparamset_stub.cpp
new file mode 100644
index 0000000000..6ce4b5827d
--- /dev/null
+++ b/indra/newview/tests/llwlparamset_stub.cpp
@@ -0,0 +1,24 @@
+/**
+ * @file llwlparamset_stub.cpp
+ * @brief stub class to allow unit testing
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+LLWLParamSet::LLWLParamSet(void)
+{
+}
+
+void LLWLParamSet::updateCloudScrolling()
+{
+}
+
+void LLWLParamSet::set(const std::string& name, const LLVector4& val)
+{
+}
+
+void LLWLParamSet::update(LLGLSLShader *shader) const
+{
+}