Merge branch 'master' of git://github.com/siana/SingularityViewer into V2MultiWear

This commit is contained in:
Lirusaito
2012-07-12 12:40:41 -04:00
4 changed files with 260 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
/**
/**
* @file llfloaterdaycycle.cpp
* @brief LLFloaterDayCycle class definition
*
@@ -40,6 +40,7 @@
#include "llsliderctrl.h"
#include "llmultislider.h"
#include "llmultisliderctrl.h"
#include "llnotificationsutil.h"
#include "llspinctrl.h"
#include "llcheckboxctrl.h"
#include "lluictrlfactory.h"
@@ -53,6 +54,7 @@
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "lldaycyclemanager.h"
#include "llwlparamset.h"
#include "llwlparammanager.h"
#include "llpostprocess.h"
@@ -89,6 +91,26 @@ LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floate
sldr->addSlider();
// add the combo boxes
LLComboBox* comboBox = getChild<LLComboBox>("DayCyclePresetsCombo");
if(comboBox != NULL) {
LLDayCycleManager::preset_name_list_t day_presets;
LLDayCycleManager::getInstance()->getPresetNames(day_presets);
LLDayCycleManager::preset_name_list_t::const_iterator it;
for(it = day_presets.begin(); it != day_presets.end(); ++it)
{
comboBox->add(*it);
}
// entry for when we're in estate time
comboBox->add(LLStringUtil::null);
// set defaults on combo boxes
//comboBox->selectByValue(LLSD("Default"));
}
// load it up
initCallbacks();
}
@@ -128,8 +150,15 @@ void LLFloaterDayCycle::initCallbacks(void)
childSetAction("WLAnimSky", onRunAnimSky, NULL);
childSetAction("WLStopAnimSky", onStopAnimSky, NULL);
childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL);
childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL);
LLComboBox* comboBox = getChild<LLComboBox>("DayCyclePresetsCombo");
//childSetAction("WLLoadPreset", onLoadPreset, comboBox);
childSetAction("DayCycleNewPreset", onNewPreset, comboBox);
childSetAction("DayCycleSavePreset", onSavePreset, comboBox);
childSetAction("DayCycleDeletePreset", onDeletePreset, comboBox);
comboBox->setCommitCallback(onChangePresetName);
childSetAction("WLAddKey", onAddKey, NULL);
childSetAction("WLDeleteKey", onDeleteKey, NULL);
@@ -269,10 +298,217 @@ void LLFloaterDayCycle::onClose(bool app_quitting)
}
}
void LLFloaterDayCycle::onNewPreset(void* userData)
{
LLNotificationsUtil::add("NewDaycyclePreset", LLSD(), LLSD(), newPromptCallback);
}
void LLFloaterDayCycle::onSavePreset(void* userData)
{
// get the name
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"DayCyclePresetsCombo");
std::string name = comboBox->getSelectedItemLabel();
// don't save the empty name
if(name == "")
{
return;
}
// check to see if it's a default and shouldn't be overwritten
if(LLDayCycleManager::getInstance()->isSystemPreset(name))
{
LLNotificationsUtil::add("WLNoEditDefault");
return;
}
LLWLParamManager::getInstance()->mCurParams.mName = name;
LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback);
}
bool LLFloaterDayCycle::saveAlertCallback(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
// if they choose save, do it. Otherwise, don't do anything
if(option == 0)
{
LLComboBox* combo_box = sDayCycle->getChild<LLComboBox>("DayCyclePresetsCombo");
// comment this back in to save to file
LLWLParamManager::getInstance()->mDay.saveDayCycle(combo_box->getSelectedValue().asString());
}
return false;
}
void LLFloaterDayCycle::onDeletePreset(void* userData)
{
LLComboBox* combo_box = sDayCycle->getChild<LLComboBox>(
"DayCyclePresetsCombo");
if(combo_box->getSelectedValue().asString() == "")
{
return;
}
LLSD args;
args["SKY"] = combo_box->getSelectedValue().asString();
LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(),
boost::bind(&LLFloaterDayCycle::deleteAlertCallback, sDayCycle, _1, _2));
}
bool LLFloaterDayCycle::deleteAlertCallback(const LLSD& notification, const LLSD& 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>(
"DayCyclePresetsCombo");
LLFloaterDayCycle* day_cycle = NULL;
LLComboBox* key_combo = NULL;
LLMultiSliderCtrl* mult_sldr = NULL;
if(LLFloaterDayCycle::isOpen())
{
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());
// check to see if it's a default and shouldn't be deleted
if(LLDayCycleManager::getInstance()->isSystemPreset(name))
{
LLNotificationsUtil::add("WLNoEditDefault");
return false;
}
LLDayCycleManager::getInstance()->deletePreset(name);
// remove and choose another
S32 new_index = combo_box->getCurrentIndex();
combo_box->remove(name);
if(key_combo != NULL)
{
key_combo->remove(name);
// remove from slider, as well
day_cycle->deletePreset(name);
}
// pick the previously selected index after delete
if(new_index > 0)
{
new_index--;
}
if(combo_box->getItemCount() > 0)
{
combo_box->setCurrentByIndex(new_index);
}
}
return false;
}
bool LLFloaterDayCycle::newPromptCallback(const LLSD& notification, const LLSD& response)
{
std::string text = response["message"].asString();
S32 option = LLNotification::getSelectedOption(notification, response);
if(text == "")
{
return false;
}
if(option == 0) {
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("DayCyclePresetsCombo");
LLFloaterDayCycle* sDayCycle = NULL;
LLComboBox* keyCombo = NULL;
if(LLFloaterDayCycle::isOpen())
{
sDayCycle = LLFloaterDayCycle::instance();
keyCombo = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
}
// add the current parameters to the list
// see if it's there first
// if not there, add a new one
if(LLDayCycleManager::getInstance()->findPreset(text).empty())
{
//AscentDayCycleManager::instance()->addParamSet(text,
// AscentDayCycleManager::instance()->mCurParams);
LLDayCycleManager::getInstance()->savePreset(text,
LLWLParamManager::getInstance()->mDay.asLLSD());
comboBox->add(text);
comboBox->sortByName();
// add a blank to the bottom
comboBox->selectFirstItem();
if(comboBox->getSimple() == "")
{
comboBox->remove(0);
}
comboBox->add(LLStringUtil::null);
comboBox->setSelectedByValue(text, true);
if(LLFloaterDayCycle::isOpen())
{
keyCombo->add(text);
keyCombo->sortByName();
}
}
else // otherwise, send a message to the user
{
LLNotificationsUtil::add("ExistsSkyPresetAlert");
}
}
return false;
}
void LLFloaterDayCycle::onChangePresetName(LLUICtrl* ctrl, void * userData)
{
LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
if(combo_box->getSimple() == "")
{
return;
}
LLEnvManagerNew::getInstance()->useDayCycle(combo_box->getSelectedValue().asString(), LLEnvKey::SCOPE_LOCAL);
gSavedSettings.setString("AscentActiveDayCycle", combo_box->getSelectedValue().asString());
// sync it all up
syncSliderTrack();
syncMenu();
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, false);
// and draw it
LLWLParamManager::getInstance()->mAnimator.update(LLWLParamManager::getInstance()->mCurParams);
}
void LLFloaterDayCycle::onRunAnimSky(void* userData)
{
// if no keys, do nothing
if(sSliderToKey.size() == 0)
if(sSliderToKey.size() == 0)
{
return;
}
@@ -315,32 +551,6 @@ void LLFloaterDayCycle::onUseLindenTime(void* userData)
LLEnvManagerNew::instance().setUseDayCycle(LLEnvManagerNew::instance().getDayCycleName());
}
void LLFloaterDayCycle::onLoadDayCycle(void* userData)
{
LLWLParamManager::getInstance()->mDay.loadDayCycleFromFile("Default.xml");
// sync it all up
syncSliderTrack();
syncMenu();
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
LLWLParamManager::getInstance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
// and draw it
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
void LLFloaterDayCycle::onSaveDayCycle(void* userData)
{
LLWLParamManager::getInstance()->mDay.saveDayCycle("Default.xml");
}
void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(

View File

@@ -99,11 +99,25 @@ public:
/// delete a key frame
static void onDeleteKey(void* userData);
/// button to load day
static void onLoadDayCycle(void* userData);
/// when user hits the load preset button
static void onNewPreset(void* userData);
/// button to save day
static void onSaveDayCycle(void* userData);
/// when user hits the save preset button
static void onSavePreset(void* userData);
/// prompts a user when overwriting a preset
static bool saveAlertCallback(const LLSD& notification, const LLSD& response);
/// when user hits the save preset button
static void onDeletePreset(void* userData);
/// prompts a user when overwriting a preset
bool deleteAlertCallback(const LLSD& notification, const LLSD& response);
static bool newPromptCallback(const LLSD& notification, const LLSD& response);
/// what to do when you change the preset name
static void onChangePresetName(LLUICtrl* ctrl, void* userData);
/// toggle for Linden time
static void onUseLindenTime(void* userData);

View File

@@ -11,7 +11,7 @@
<panel border="false" label="Credits" height="386" name="credits_panel">
<text_editor enabled="false" follows="left|top" bg_readonly_color="transparent" left="3" max_length="65536" name="credits_editor" top="-1" bottom="0" width="443" word_wrap="true">
Singularity Viewer is developed and maintained by Siana Gearz, Shyotl Kuhr, Aleric Inglewood, Narv Czervik, Tigh MacFanatic, Inusaito Kanya, Sovereign Engineer and Latif Khalifa, with contributions by Fractured Crystal, Fritigern Gothly, Henri Beauchamp, McCabe Maxsted, Kadah Coba, Kitty Barnett, Laika Tungsten, Nomade Zhao, Revolution Smythe, Selvone Franizzi, Thickbrick Sleaford, Zauber Parecelsus, Wolfspirit Magic and others. Singularity is based upon Ascent source code. Credits for Ascent include Hg Beeks, Charley Levenque, Hazim Gazov, Zwagoth Klaar, Qarl Fizz, and others. Ascent is based upon the Inertia source code.
Singularity Viewer is developed and maintained by Siana Gearz, Shyotl Kuhr, Aleric Inglewood, Narv Czervik, Tigh MacFanatic, Inusaito Kanya, Sovereign Engineer and Latif Khalifa, with contributions by Fractured Crystal, Fritigern Gothly, Henri Beauchamp, McCabe Maxsted, Kadah Coba, Kitty Barnett, nhede Core, Nomade Zhao, Revolution Smythe, Selvone Franizzi, Thickbrick Sleaford, Zauber Parecelsus, Wolfspirit Magic and others. Singularity is based upon Ascent source code. Credits for Ascent include Hg Beeks, Charley Levenque, Hazim Gazov, Zwagoth Klaar, Qarl Fizz, and others. Ascent is based upon the Inertia source code.
Singularity Viewer includes source code contributions of the following residents: Able Whitman, Adam Marker, Agathos Frascati, Aimee Trescothick, Alejandro Rosenthal, Aleric Inglewood, Alissa Sabre, Angus Boyd, Ann Congrejo, Argent Stonecutter, Asuka Neely, Balp Allen, Benja Kepler, Biancaluce Robbiani, Blakar Ogre, blino Nakamura, Boroondas Gupte, Bulli Schumann, bushing Spatula, Carjay McGinnis, Catherine Pfeffer, Celierra Darling, Cron Stardust, Dale Glass, Drewan Keats, Dylan Haskell, Dzonatas Sol, Eddy Stryker, EponymousDylan Ra, Eva Nowicka, Farallon Greyskin, Feep Larsson, Flemming Congrejo, Fluf Fredriksson, Fractured Crystal, Fremont Cunningham, Geneko Nemeth, Gigs Taggart, Ginko Bayliss, Grazer Kline, Gudmund Shepherd, Hamncheese Omlet, HappySmurf Papp, Henri Beauchamp, Hikkoshi Sakai, Hiro Sommambulist, Hoze Menges, Ian Kas, Irene Muni, Iskar Ariantho, Jacek Antonelli, JB Kraft, Joghert LeSabre, Kage Pixel, Ken March, Kerutsen Sellery, Khyota Wulluf, Kunnis Basiat, Lisa Lowe, Lockhart Cordoso,
maciek marksman, Magnus Balczo, Malwina Dollinger, march Korda, Matthew Dowd, McCabe Maxsted, Michelle2 Zenovka, Mm Alder, Mr Greggan, Nicholaz Beresford, Nounouch Hapmouche, Patric Mills, Paul Churchill, Paula Innis, Peekay Semyorka, Peter Lameth, Pf Shan, princess niven, Renault Clio, Ringo Tuxing, Robin Cornelius, Ryozu Kojima, Salahzar Stenvaag, Sammy Frederix, Scrippy Scofield, Seg Baphomet, Sergen Davies, SignpostMarv Martin, Simon Nolan, SpacedOut Frye, Sporked Friis, Stevex Janus, Still Defiant, Strife Onizuka, Tayra Dagostino, TBBle Kurosawa, Teardrops Fall, tenebrous pau, Tharax Ferraris, Thickbrick Sleaford, Thraxis Epsilon, tiamat bingyi, TraductoresAnonimos Alter, Tue Torok, Vadim Bigbear, Vixen Heron, Whoops Babii, Wilton Lundquist, Zarkonnen Decosta, Zi Ree, Zipherius Turas

View File

@@ -15,7 +15,7 @@
<button bottom_delta="0" height="18" label="&lt;" left="158" image_overlay="arrow_left.tga" name="WWprev" width="18"/>
<button bottom_delta="0" height="18" label="&gt;" left_delta="18" image_overlay="arrow_right.tga" name="WWnext" width="18"/>
<check_box left="5" label="Region Environment" control_name="UseEnvironmentFromRegion" height="16" name="use_estate_wl" tool_tip="Use the region/parcel's windlight settings when available."/>
<check_box bottom_delta="0" left_delta="125" label="Always?" control_name="UseEnvironmentFromRegionAlways" height="16" name="Always" tool_tip="Always use region/parcel settings when they exist, automatically."/>
<!--check_box bottom_delta="0" left_delta="125" label="Always?" control_name="UseEnvironmentFromRegionAlways" height="16" name="Always" tool_tip="Always use region/parcel settings when they exist, automatically."/-->
<icon bottom_delta="-18" height="14" image_name="icon_day_cycle.tga" left="10" width="150"/>
<slider bottom_delta="-8" control_name="EnvTimeSlider" left="5" height="10" increment="0.00000001" label="" max_val="1" min_val="0" name="EnvTimeSlider" show_text="false" width="160"/>
<button bottom="1" height="22" label="" left="172" name="expand" scale_image="true" toggle="true" tool_tip="Hide the Settings Panel" width="22"/>