Merge branch 'DRTVWR-600-maint-A' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llxml/llcontrol.cpp
#	indra/llxml/llxmlnode.cpp
#	indra/llxml/llxmltree.h
#	indra/newview/CMakeLists.txt
#	indra/newview/llbreadcrumbview.cpp
#	indra/newview/llbreastmotion.cpp
#	indra/newview/llfloaterauction.cpp
#	indra/newview/llfloatereditsky.cpp
#	indra/newview/llfloatereditwater.cpp
master
Ansariel 2024-03-08 16:56:01 +01:00
commit 85ae4ed95b
50 changed files with 198 additions and 3940 deletions

View File

@ -73,6 +73,7 @@ LLDir *gDirUtilp = (LLDir *)&gDirUtil;
/// Values for findSkinnedFilenames(subdir) parameter
const char
*LLDir::XUI = "xui",
*LLDir::HTML = "html",
*LLDir::TEXTURES = "textures",
*LLDir::SKINBASE = "";
@ -826,14 +827,13 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
else
{
// We do not recognize this subdir. Investigate.
std::string subdir_path(add(getDefaultSkinDir(), subdir));
if (fileExists(add(subdir_path, "en")))
if (skinExists(subdir, "en"))
{
// defaultSkinDir/subdir contains subdir "en". That's our
// default language; this subdir is localized.
found = sLocalized.insert(StringMap::value_type(subdir, "en")).first;
}
else if (fileExists(add(subdir_path, "en-us")))
else if (skinExists(subdir, "en-us"))
{
// defaultSkinDir/subdir contains subdir "en-us" but not "en".
// Set as default language; this subdir is localized.
@ -930,6 +930,33 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
return results;
}
// virtual
bool LLDir::skinExists(const std::string& subdir, const std::string& skin) const
{
std::string skin_path(add(getDefaultSkinDir(), subdir, skin));
return fileExists(skin_path);
}
// virtual
std::string LLDir::getFileContents(const std::string& filename) const
{
LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp)
{
fseek(fp, 0, SEEK_END);
U32 length = ftell(fp);
fseek(fp, 0, SEEK_SET);
std::vector<char> buffer(length);
size_t nread = fread(buffer.data(), 1, length, fp);
fclose(fp);
return std::string(buffer.data(), nread);
}
return LLStringUtil::null;
}
std::string LLDir::getTempFilename() const
{
LLUUID random_uuid;

View File

@ -110,6 +110,8 @@ class LLDir
virtual std::string getCurPath() = 0;
virtual bool fileExists(const std::string &filename) const = 0;
virtual bool skinExists(const std::string& subdir, const std::string &skin) const;
virtual std::string getFileContents(const std::string& filename) const;
const std::string findFile(const std::string& filename, const std::vector<std::string> filenames) const;
const std::string findFile(const std::string& filename, const std::string& searchPath1 = "", const std::string& searchPath2 = "", const std::string& searchPath3 = "") const;
@ -194,7 +196,7 @@ class LLDir
const std::string& filename,
ESkinConstraint constraint=CURRENT_SKIN) const;
/// Values for findSkinnedFilenames(subdir) parameter
static const char *XUI, *TEXTURES, *SKINBASE;
static const char *XUI, *HTML, *TEXTURES, *SKINBASE;
/**
* Return the base-language pathname from findSkinnedFilenames(), or
* the empty string if no such file exists. Parameters are identical to

View File

@ -3767,12 +3767,16 @@ bool LLFloater::isVisible(const LLFloater* floater)
return floater && floater->getVisible();
}
bool LLFloater::buildFromFile(const std::string& filename)
bool LLFloater::buildFromFile(const std::string& filename, bool cacheable)
{
LL_PROFILE_ZONE_SCOPED;
llassert_msg(!cacheable || !mSingleInstance || !mReuseInstance,
"No needs to cache XML for floater with mSingleInstance AND mReuseInstance flags set");
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable))
{
LL_WARNS() << "Couldn't find (or parse) floater from: " << filename << LL_ENDL;
return false;

View File

@ -219,7 +219,7 @@ public:
// Don't export top/left for rect, only height/width
static void setupParamsForExport(Params& p, LLView* parent);
bool buildFromFile(const std::string &filename);
bool buildFromFile(const std::string &filename, bool cacheable = false);
boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setOpenCallback( const commit_signal_t::slot_type& cb );

View File

@ -95,7 +95,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit
}
llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance(), true);
if (!menu)
{
LL_WARNS() << "Error loading menu_button menu" << LL_ENDL;

View File

@ -803,13 +803,13 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::
//-----------------------------------------------------------------------------
// buildPanel()
//-----------------------------------------------------------------------------
bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params, bool cacheable)
{
LL_PROFILE_ZONE_SCOPED;
bool didPost = false;
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable))
{
LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL;
return didPost;

View File

@ -107,7 +107,8 @@ protected:
public:
typedef std::vector<class LLUICtrl *> ctrl_list_t;
bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams());
bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params, bool cacheable = false);
bool buildFromFile(const std::string &filename, bool cacheable = false) { return buildFromFile(filename, getDefaultParams(), cacheable); }
static LLPanel* createFactoryPanel(const std::string& name);

View File

@ -167,7 +167,7 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid
// getLayeredXMLNode()
//-----------------------------------------------------------------------------
bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root,
LLDir::ESkinConstraint constraint)
LLDir::ESkinConstraint constraint, bool cacheable)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
std::vector<std::string> paths =
@ -179,7 +179,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNo
paths.push_back(xui_filename);
}
return LLXMLNode::getLayeredXMLNode(root, paths);
return LLXMLNode::getLayeredXMLNode(root, paths, cacheable);
}

View File

@ -148,7 +148,7 @@ public:
LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node );
template<typename T>
static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry)
static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry, bool cacheable = false)
{
T* widget = NULL;
@ -156,7 +156,7 @@ public:
{
LLXMLNodePtr root_node;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node))
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node, LLDir::CURRENT_SKIN, cacheable))
{
LL_WARNS() << "Couldn't parse XUI from path: " << instance().getCurFileName() << ", from filename: " << filename << LL_ENDL;
goto fail;
@ -192,7 +192,7 @@ fail:
static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL);
static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root,
LLDir::ESkinConstraint constraint=LLDir::CURRENT_SKIN);
LLDir::ESkinConstraint constraint = LLDir::CURRENT_SKIN, bool cacheable = false);
private:
//NOTE: both friend declarations are necessary to keep both gcc and msvc happy

View File

@ -28,6 +28,7 @@
#include "llxuiparser.h"
#include "lldir.h"
#include "llxmlnode.h"
#include "llfasttimer.h"
#ifdef LL_USESYSTEMLIBS
@ -44,6 +45,7 @@
#include "lluicolor.h"
#include "v3math.h"
using namespace BOOST_SPIRIT_CLASSIC_NS;
const S32 MAX_STRING_ATTRIBUTE_SIZE = 40;
@ -1397,36 +1399,17 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl
mCurReadDepth = 0;
setParseSilently(silent);
ScopedFile file(filename, "rb");
if( !file.isOpen() )
std::string xml = gDirUtilp->getFileContents(filename);
if (xml.empty())
{
LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL;
XML_ParserFree( mParser );
return false;
}
S32 bytes_read = 0;
S32 buffer_size = file.getRemainingBytes();
void* buffer = XML_GetBuffer(mParser, buffer_size);
if( !buffer )
{
LL_WARNS("ReadXUI") << "Unable to allocate XML buffer while reading file " << filename << LL_ENDL;
XML_ParserFree( mParser );
return false;
}
bytes_read = (S32)fread(buffer, 1, buffer_size, file.mFile);
if( bytes_read <= 0 )
{
LL_WARNS("ReadXUI") << "Error while reading file " << filename << LL_ENDL;
XML_ParserFree( mParser );
return false;
}
mEmptyLeafNode.push_back(false);
if( !XML_ParseBuffer(mParser, bytes_read, true ) )
if (!XML_Parse(mParser, xml.data(), (int)xml.size(), true))
{
LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL;
XML_ParserFree( mParser );

View File

@ -855,13 +855,13 @@ void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val)
//---------------------------------------------------------------
// Returns number of controls loaded, so 0 if failure
U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as)
U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration, eControlType declare_as)
{
std::string name;
LLXmlTree xml_controls;
if (!xml_controls.parseFile(filename))
if (!xml_controls.parseString(xml))
{
LL_WARNS("Settings") << "Unable to open control file " << filename << LL_ENDL;
return 0;
@ -874,7 +874,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require
return 0;
}
U32 validitems = 0;
U32 validitems = 0;
S32 version;
rootp->getAttributeS32("version", version);
@ -1093,24 +1093,24 @@ U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only
U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values)
{
LLSD settings;
llifstream infile;
infile.open(filename.c_str());
if(!infile.is_open())
std::string xml = gDirUtilp->getFileContents(filename);
if (xml.empty())
{
LL_WARNS("Settings") << "Cannot find file " << filename << " to load." << LL_ENDL;
return 0;
}
if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, infile))
std::stringstream stream(xml);
if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, stream))
{
infile.close();
LL_WARNS("Settings") << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << LL_ENDL;
return loadFromFileLegacy(filename, true, TYPE_STRING);
return loadFromFileLegacy(filename, xml, true, TYPE_STRING);
}
U32 validitems = 0;
bool hidefromsettingseditor = false;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT;
@ -1142,7 +1142,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
{
hidefromsettingseditor = false;
}
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)

View File

@ -344,7 +344,7 @@ public:
// Returns number of controls loaded, 0 if failed
// If require_declaration is false, will auto-declare controls it finds
// as the given type.
U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING);
U32 loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration = true, eControlType declare_as = TYPE_STRING);
U32 saveToFile(const std::string& filename, bool nondefault_only);
U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true);
void resetToDefaults();

View File

@ -650,40 +650,56 @@ bool LLXMLNode::updateNode(
return true;
}
// static
bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree)
static std::map<std::string, LLXMLNodePtr> sXMLCache;
static LLSharedMutex sXMLCacheMutex;
static void saveToCache(const std::string& filename, LLXMLNodePtr& node)
{
// Read file
#ifdef LL_RELEASE_WITH_DEBUG_INFO
LL_INFOS("XMLNode") << "parsing XML file: " << filename << LL_ENDL;
#elif defined LL_DEBUG
LL_INFOS("XMLNode") << "parsing XML file: " << filename << LL_ENDL;
#else
LL_DEBUGS("XMLNode") << "parsing XML file: " << filename << LL_ENDL;
#endif //LL_RELEASE_WITH_DEBUG_INFO
LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp == NULL)
{
node = NULL ;
return false;
}
fseek(fp, 0, SEEK_END);
U32 length = ftell(fp);
fseek(fp, 0, SEEK_SET);
LLExclusiveMutexLock lock(&sXMLCacheMutex);
sXMLCache.emplace(filename, node.notNull() ? node->deepCopy() : nullptr);
}
U8* buffer = new U8[length+1];
size_t nread = fread(buffer, 1, length, fp);
buffer[nread] = 0;
fclose(fp);
static bool loadFromCache(const std::string& filename, LLXMLNodePtr& node)
{
LLSharedMutexLock lock(&sXMLCacheMutex);
auto it = sXMLCache.find(filename);
if (it == sXMLCache.end())
return false;
node = it->second.notNull() ? it->second->deepCopy() : nullptr;
return node.notNull();
}
bool rv = parseBuffer(buffer, nread, node, defaults_tree);
delete [] buffer;
return rv;
// static
bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree, bool cacheable)
{
// Try to read from cache
if (cacheable)
{
if (loadFromCache(filename, node))
return true;
}
std::string xml = gDirUtilp->getFileContents(filename);
if (xml.empty())
{
LL_WARNS("XMLNode") << "no XML file: " << filename << LL_ENDL;
}
else if (parseBuffer(xml.data(), xml.size(), node, defaults_tree))
{
if (cacheable)
{
saveToCache(filename, node);
}
return true;
}
node = nullptr;
return false;
}
// static
bool LLXMLNode::parseBuffer(
U8* buffer,
const char* buffer,
U32 length,
LLXMLNodePtr& node,
LLXMLNode* defaults)
@ -702,7 +718,7 @@ bool LLXMLNode::parseBuffer(
XML_SetUserData(my_parser, (void *)file_node_ptr);
// Do the parsing
if (XML_Parse(my_parser, (const char *)buffer, length, true) != XML_STATUS_OK)
if (XML_Parse(my_parser, buffer, length, true) != XML_STATUS_OK)
{
#ifdef LL_RELEASE_WITH_DEBUG_INFO
LL_ERRS() << "";
@ -846,18 +862,20 @@ bool LLXMLNode::isFullyDefault()
}
// static
bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root,
const std::vector<std::string>& paths)
bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths, bool cacheable)
{
if (paths.empty()) return false;
if (paths.empty())
{
return false;
}
std::string filename = paths.front();
if (filename.empty())
{
return false;
}
if (!LLXMLNode::parseFile(filename, root, NULL))
if (!LLXMLNode::parseFile(filename, root, nullptr, cacheable))
{
LL_WARNS() << "Problem reading UI description file: " << filename << LL_ENDL;
return false;

View File

@ -126,34 +126,34 @@ public:
bool isNull();
bool deleteChild(LLXMLNode* child);
void addChild(LLXMLNodePtr& new_child);
void addChild(LLXMLNodePtr& new_child);
void setParent(LLXMLNodePtr& new_parent); // reparent if necessary
// Serialization
// Deserialization
static bool parseFile(
const std::string& filename,
LLXMLNodePtr& node,
LLXMLNode* defaults_tree);
LLXMLNodePtr& node,
LLXMLNode* defaults_tree,
bool cacheable = false);
static bool parseBuffer(
U8* buffer,
const char* buffer,
U32 length,
LLXMLNodePtr& node,
LLXMLNodePtr& node,
LLXMLNode* defaults);
static bool parseStream(
std::istream& str,
LLXMLNodePtr& node,
LLXMLNodePtr& node,
LLXMLNode* defaults);
static bool updateNode(
LLXMLNodePtr& node,
LLXMLNodePtr& update_node);
static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths);
static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths, bool cacheable = false);
// Write standard XML file header:
// <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
static void writeHeaderToFile(LLFILE *out_file);
// Write XML to file with one attribute per line.
// XML escapes values as they are written.
void writeToFile(LLFILE *out_file, const std::string& indent = std::string(), bool use_type_decorations=true);
@ -237,7 +237,7 @@ public:
// Setters
bool setAttributeString(const char* attr, const std::string& value);
void setBoolValue(const bool value) { setBoolValue(1, &value); }
void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); }
void setIntValue(const S32 value, Encoding encoding = ENCODING_DEFAULT) { setIntValue(1, &value, encoding); }

View File

@ -35,6 +35,7 @@
#include "v4math.h"
#include "llquaternion.h"
#include "lluuid.h"
#include "lldir.h"
//////////////////////////////////////////////////////////////
// LLXmlTree
@ -60,37 +61,37 @@ void LLXmlTree::cleanup()
mNodeNames.cleanup();
}
bool LLXmlTree::parseFile(const std::string &path, bool keep_contents)
bool LLXmlTree::parseFile(const std::string & filename, bool keep_contents)
{
delete mRoot;
mRoot = NULL;
LLXmlTreeParser parser(this);
bool success = parser.parseFile( path, &mRoot, keep_contents );
if( !success )
std::string xml = gDirUtilp->getFileContents(filename);
if (xml.empty())
{
S32 line_number = parser.getCurrentLineNumber();
const char* error = parser.getErrorString();
LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL;
LL_WARNS() << "LLXmlTree parse failed. No XML file: " << filename << LL_ENDL;
return false;
}
bool success = parseString(xml, keep_contents);
return success;
}
bool LLXmlTree::parseString(const std::string &string, bool keep_contents)
bool LLXmlTree::parseString(const std::string &xml, bool keep_contents)
{
delete mRoot;
mRoot = NULL;
LLXmlTreeParser parser(this);
bool success = parser.parseString( string, &mRoot, keep_contents );
if( !success )
bool success = parser.parseString(xml, &mRoot, keep_contents);
if (!success)
{
S32 line_number = parser.getCurrentLineNumber();
const char* error = parser.getErrorString();
LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL;
}
return success;
}
@ -553,28 +554,28 @@ bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, b
return success;
}
bool LLXmlTreeParser::parseString(const std::string &string, LLXmlTreeNode** root, bool keep_contents)
bool LLXmlTreeParser::parseString(const std::string& xml, LLXmlTreeNode** root, bool keep_contents)
{
llassert( !mRoot );
llassert( !mCurrent );
mKeepContents = keep_contents;
bool success = LLXmlParser::parse(string.c_str(), string.length(), true);
bool success = LLXmlParser::parse(xml.data(), (int)xml.size(), true);
*root = mRoot;
mRoot = NULL;
if( success )
if (success)
{
llassert( !mCurrent );
llassert(!mCurrent);
}
mCurrent = NULL;
return success;
}
const std::string& LLXmlTreeParser::tabs()
{
static std::string s;

View File

@ -56,7 +56,7 @@ public:
void cleanup();
virtual bool parseFile(const std::string &path, bool keep_contents = true);
virtual bool parseString(const std::string &string, bool keep_contents = true);
virtual bool parseString(const std::string &xml, bool keep_contents = true);
LLXmlTreeNode* getRoot() { return mRoot; }
@ -200,8 +200,8 @@ public:
LLXmlTreeParser(LLXmlTree* tree);
virtual ~LLXmlTreeParser();
bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents );
bool parseString(const std::string &string, LLXmlTreeNode** root, bool keep_contents);
bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents);
bool parseString(const std::string &xml, LLXmlTreeNode** root, bool keep_contents);
protected:
const std::string& tabs();

View File

@ -214,7 +214,6 @@ set(viewer_SOURCE_FILES
llblockedlistitem.cpp
llblocklist.cpp
llbox.cpp
#llbreadcrumbview.cpp #<FS:Ansariel> Unused
llbrowsernotification.cpp
llbuycurrencyhtml.cpp
llcallingcard.cpp
@ -471,7 +470,6 @@ set(viewer_SOURCE_FILES
lllandmarkactions.cpp
lllandmarklist.cpp
lllegacyatmospherics.cpp
#lllistbrowser.cpp #<FS:Ansariel> Unused
lllistcontextmenu.cpp
lllistview.cpp
lllocalbitmaps.cpp
@ -635,7 +633,7 @@ set(viewer_SOURCE_FILES
llregioninfomodel.cpp
llregionposition.cpp
llremoteparcelrequest.cpp
#llsavedsettingsglue.cpp #<FS:Ansariel> Unused
llsaveoutfitcombobtn.cpp
#llsaveoutfitcombobtn.cpp #<FS:Ansariel> Unused
llscenemonitor.cpp
llsceneview.cpp
@ -732,7 +730,6 @@ set(viewer_SOURCE_FILES
llurlhistory.cpp
llurllineeditorctrl.cpp
llurlwhitelist.cpp
#llvectorperfoptions.cpp #<FS:Ansariel> Unused
llversioninfo.cpp
llviewchildren.cpp
llviewerassetstats.cpp
@ -1005,7 +1002,6 @@ set(viewer_HEADER_FILES
llblockedlistitem.h
llblocklist.h
llbox.h
#llbreadcrumbview.h #<FS:Ansariel> Unused
llbuycurrencyhtml.h
llcallingcard.h
llcapabilityprovider.h
@ -1263,7 +1259,6 @@ set(viewer_HEADER_FILES
lllandmarkactions.h
lllandmarklist.h
lllightconstants.h
#lllistbrowser.h #<FS:Ansariel> Unused
lllistcontextmenu.h
lllistview.h
lllocalbitmaps.h
@ -1417,7 +1412,6 @@ set(viewer_HEADER_FILES
llresourcedata.h
llrootview.h
#llsavedsettingsglue.h #<FS:Ansariel> Unused
#llsaveoutfitcombobtn.h #<FS:Ansariel> Unused
llscenemonitor.h
llsceneview.h
llscreenchannel.h
@ -1517,7 +1511,6 @@ set(viewer_HEADER_FILES
llurlhistory.h
llurllineeditorctrl.h
llurlwhitelist.h
#llvectorperfoptions.h #<FS:Ansariel> Unused
llversioninfo.h
llviewchildren.h
llviewerassetstats.h

View File

@ -236,7 +236,8 @@ void downloadComplete(LLSD const &aData, std::string const &aURL, bool success)
FSData::getInstance()->processResponder(data, aURL, success, lastModified);
}
void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::string const &aFilename)
#ifdef OPENSIM
static void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::string const &aFilename)
{
LL_DEBUGS("fsdata") << aURL << ": " << aData << LL_ENDL;
LLSD header = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS][LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
@ -258,7 +259,7 @@ void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::str
LLXMLNodePtr xml_root;
std::string stringData;
stringData.assign( rawData.begin(), rawData.end() ); // LLXMLNode::parseBuffer wants a U8*, not a const U8*, so need to copy here just to be safe
if ( (!LLXMLNode::parseBuffer( reinterpret_cast< U8*> ( &stringData[0] ), stringData.size(), xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library")) )
if ( (!LLXMLNode::parseBuffer(stringData.c_str(), stringData.size(), xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library")))
{
LL_WARNS("fsdata") << "Could not read the script library data from "<< aURL << LL_ENDL;
return;
@ -278,7 +279,7 @@ void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::str
}
}
void downloadError(LLSD const &aData, std::string const &aURL)
static void downloadError(LLSD const &aData, std::string const &aURL)
{
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(aData);
@ -291,6 +292,7 @@ void downloadError(LLSD const &aData, std::string const &aURL)
LL_WARNS("fsdata") << "Failed to download " << aURL << ": " << aData << LL_ENDL;
}
}
#endif
// call this just before the login screen and after the LLProxy has been setup.
void FSData::startDownload()
@ -330,7 +332,7 @@ void FSData::startDownload()
FSCoreHttpUtil::callbackHttpGetRaw(mFSdataDefaultsUrl, boost::bind(downloadComplete, _1, mFSdataDefaultsUrl, true), boost::bind(downloadComplete, _1, mFSdataDefaultsUrl, false), LLCore::HttpHeaders::ptr_t(), httpOpts);
}
#if OPENSIM
#ifdef OPENSIM
std::string filenames[] = { "scriptlibrary_ossl.xml", "scriptlibrary_aa.xml" };
for (auto const& script_name : filenames)
{

View File

@ -54,9 +54,9 @@
#include "lfsimfeaturehandler.h" // <COLOSI opensim multi-currency support />
#include "llmaterialtable.h" // <FS:Beq> FIRE-31628 for access to static var
void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState )
static void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState )
{
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData );
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData );
if (HTTP_GATEWAY_TIME_OUT == status.getType() )// gateway timeout ... well ... retry once >_>
{
@ -101,13 +101,13 @@ void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mDa
}
}
void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState )
static void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState )
{
//mOwner->decResponderCount();
LLSD header = aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ][ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ] );
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ] );
const LLSD::Binary &rawData = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
const LLSD::Binary &rawData = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
// LL_DEBUGS("GridManager") << mData->grid[GRID_VALUE] << " status: " << getStatus() << " reason: " << getReason() << LL_ENDL;
if(LLGridManager::TRYLEGACY == mState && HTTP_OK == status.getType() )
@ -121,7 +121,7 @@ void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry*
std::string stringData;
stringData.assign( rawData.begin(), rawData.end() ); // LLXMLNode::parseBuffer wants a U8*, not a const U8*, so need to copy here just to be safe
if(LLXMLNode::parseBuffer( reinterpret_cast< U8*> ( &stringData[0] ), stringData.size(), mData->info_root, NULL))
if(LLXMLNode::parseBuffer(stringData.c_str(), stringData.size(), mData->info_root, NULL))
{
mOwner->gridInfoResponderCB(mData);
}

View File

@ -782,11 +782,6 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person)
return mHUDTargetZoom;
}
if (isDisableCameraConstraints())
{
return mCameraZoomFraction;
}
if (get_third_person || (mFocusOnAvatar && cameraThirdPerson()))
{
return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f);
@ -800,6 +795,10 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person)
F32 min_zoom;
F32 max_zoom = getCameraMaxZoomDistance();
if (isDisableCameraConstraints())
{
max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT;
}
F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
if (mFocusObject.notNull())
@ -831,10 +830,6 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction)
{
mHUDTargetZoom = fraction;
}
else if (isDisableCameraConstraints())
{
mCameraZoomFraction = fraction;
}
else if (mFocusOnAvatar && cameraThirdPerson())
{
mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION);
@ -849,6 +844,10 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction)
{
F32 min_zoom = LAND_MIN_ZOOM;
F32 max_zoom = getCameraMaxZoomDistance();
if (isDisableCameraConstraints())
{
max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT;
}
if (mFocusObject.notNull())
{

View File

@ -210,7 +210,6 @@
#include "llworld.h"
#include "llhudeffecttrail.h"
#include "llvectorperfoptions.h"
#include "llslurl.h"
#include "llurlregistry.h"
#include "llwatchdog.h"
@ -3523,7 +3522,7 @@ void LLAppViewer::initStrings()
{
std::string strings_file = "strings.xml";
std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
if (strings_path_full.empty() || !gDirUtilp->fileExists(strings_path_full))
{
if (strings_path_full.empty())
{

View File

@ -61,8 +61,9 @@ LLBlockList::LLBlockList(const Params& p)
LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_people_blocked_gear.xml",
gMenuHolder,
LLViewerMenuHolderGL::child_registry_t::instance());
if(context_menu)
LLViewerMenuHolderGL::child_registry_t::instance(),
true);
if (context_menu)
{
mContextMenu = context_menu->getHandle();
}

View File

@ -1,41 +0,0 @@
/**
* @file llbreadcrumbview.cpp
* @brief UI widget for displaying position in a folder hierarchy and allowing
* the user to click on a location in the hierarchy.
*
* $LicenseInfo:firstyear=2009&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 "llbreadcrumbview.h"
// TODO - Add more dragons
// .-. .-
// \_//| /_(
// _/(o)/ .'_(
// /o_.-. \/__( .
// \-\--' |`
// 3\-3\ \ .|
// /--\ '.'/
// __//_//__.-'
// '-'-'-'-' AoS

View File

@ -1,30 +0,0 @@
/**
* @file llbreadcrumbview.h
* @brief UI widget for displaying position in a folder hierarchy and allowing
* the user to click on a location in the hierarchy.
*
* $LicenseInfo:firstyear=2009&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 LLBREADCRUMBVIEW_H
#define LLBREADCRUMBVIEW_H
#endif // LLBREADCRUMBVIEW_H

View File

@ -1,405 +0,0 @@
/**
* @file llbreastmotion.cpp
* @brief Implementation of LLBreastMotion 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$
*/
//-----------------------------------------------------------------------------
// Header Files
//-----------------------------------------------------------------------------
#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "m3math.h"
#include "v3dmath.h"
#include "llbreastmotion.h"
#include "llcharacter.h"
#include "llviewercontrol.h"
#include "llviewervisualparam.h"
#include "llvoavatarself.h"
#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 0.f;
#define N_PARAMS 2
// User-set params
static const std::string breast_param_names_user[N_PARAMS] =
{
"Breast_Female_Cleavage_Driver",
"Breast_Gravity_Driver"
};
// Params driven by this algorithm
static const std::string breast_param_names_driven[N_PARAMS] =
{
"Breast_Female_Cleavage",
"Breast_Gravity"
};
LLBreastMotion::LLBreastMotion(const LLUUID &id) :
LLMotion(id),
mCharacter(NULL)
{
mName = "breast_motion";
mChestState = new LLJointState;
mBreastMassParam = (F32)1.0;
mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
mBreastSmoothingParam = (U32)2;
mBreastGravityParam = (F32)0.0;
mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
mCharLastPosition_world_pt = LLVector3(0,0,0);
mCharLastVelocity_local_vec = LLVector3(0,0,0);
mCharLastAcceleration_local_vec = LLVector3(0,0,0);
mBreastLastPosition_local_pt = LLVector3(0,0,0);
mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0);
mBreastVelocity_local_vec = LLVector3(0,0,0);
}
LLBreastMotion::~LLBreastMotion()
{
}
BOOL LLBreastMotion::onActivate()
{
return TRUE;
}
void LLBreastMotion::onDeactivate()
{
}
LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character)
{
mCharacter = character;
if (!mChestState->setJoint(character->getJoint("mChest")))
{
return STATUS_FAILURE;
}
mChestState->setUsage(LLJointState::ROT);
addJointState( mChestState );
for (U32 i=0; i < N_PARAMS; i++)
{
mBreastParamsUser[i] = NULL;
mBreastParamsDriven[i] = NULL;
mBreastParamsMin[i] = 0;
mBreastParamsMax[i] = 0;
if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
{
mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
if (mBreastParamsDriven[i])
{
mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
}
}
}
mTimer.reset();
return STATUS_SUCCESS;
}
F32 LLBreastMotion::getMinPixelArea()
{
return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
}
F32 LLBreastMotion::calculateTimeDelta()
{
const F32 time = mTimer.getElapsedTimeF32();
const F32 time_delta = time - mLastTime;
mLastTime = time;
return time_delta;
}
// Local space means "parameter space".
LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector)
{
LLVector3 local_vec(0,0,0);
LLJoint *chest_joint = mChestState->getJoint();
const LLQuaternion world_rot = chest_joint->getWorldRotation();
// Cleavage
LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction
breast_dir_world_vec.normalize();
local_vec[0] = world_vector * breast_dir_world_vec;
// Up-Down Bounce
LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
breast_up_dir_world_vec.normalize();
local_vec[1] = world_vector * breast_up_dir_world_vec;
return local_vec;
}
LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta)
{
LLJoint *chest_joint = mChestState->getJoint();
const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
const LLQuaternion world_rot = chest_joint->getWorldRotation();
const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
return char_velocity_local_vec;
}
LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
const F32 time_delta)
{
LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
char_acceleration_local_vec =
char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
mCharLastAcceleration_local_vec = char_acceleration_local_vec;
return char_acceleration_local_vec;
}
BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask)
{
// Skip if disabled globally.
// <FS:PP> Attempt to speed up things a little
// if (!gSavedSettings.getBOOL("AvatarPhysics"))
static LLCachedControl<bool> AvatarPhysics(gSavedSettings, "AvatarPhysics");
if (!AvatarPhysics)
// </FS:PP>
{
return TRUE;
}
// Higher LOD is better. This controls the granularity
// and frequency of updates for the motions.
const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
if (lod_factor == 0)
{
return TRUE;
}
if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
const F32 time_delta = calculateTimeDelta();
if (time_delta < .01 || time_delta > 10.0) return TRUE;
////////////////////////////////////////////////////////////////////////////////
// Get all parameters and settings
//
mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing"));
mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
// Get the current morph parameters.
LLVector3 breast_user_local_pt(0,0,0);
for (U32 i=0; i < N_PARAMS; i++)
{
if (mBreastParamsUser[i] != NULL)
{
breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
}
}
LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
//
// End parameters and settings
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Calculate velocity and acceleration in parameter space.
//
const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
mCharLastVelocity_local_vec = char_velocity_local_vec;
LLJoint *chest_joint = mChestState->getJoint();
mCharLastPosition_world_pt = chest_joint->getWorldPosition();
//
// End velocity and acceleration
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Calculate the total force
//
// Spring force is a restoring force towards the original user-set breast position.
// F = kx
const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
// Acceleration is the force that comes from the change in velocity of the torso.
// F = ma + mg
LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
force_accel_local_vec += force_gravity_local_vec;
force_accel_local_vec *= mBreastGainParam;
// Damping is a restoring force that opposes the current velocity.
// F = -kv
LLVector3 force_damping_local_vec = -mBreastDampingParam;
force_damping_local_vec *= mBreastVelocity_local_vec;
// Drag is a force imparted by velocity, intuitively it is similar to wind resistance.
// F = .5v*v
LLVector3 force_drag_local_vec = .5*char_velocity_local_vec;
force_drag_local_vec *= char_velocity_local_vec;
force_drag_local_vec *= mBreastDragParam[0];
LLVector3 force_net_local_vec =
force_accel_local_vec +
force_gravity_local_vec +
force_spring_local_vec +
force_damping_local_vec +
force_drag_local_vec;
//
// End total force
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Calculate new params
//
// Calculate the new acceleration based on the net force.
// a = F/m
LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
mBreastVelocity_local_vec += acceleration_local_vec;
mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0);
// Temporary debugging setting to cause all avatars to move, for profiling purposes.
// <FS:PP> Attempt to speed up things a little
// if (gSavedSettings.getBOOL("AvatarPhysicsTest"))
static LLCachedControl<bool> AvatarPhysicsTest(gSavedSettings, "AvatarPhysicsTest");
if (AvatarPhysicsTest)
// </FS:PP>
{
mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0;
mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0;
}
// Calculate the new parameters and clamp them to the min/max ranges.
LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
// Set the new parameters.
for (U32 i=0; i < 3; i++)
{
// If the param is disabled, just set the param to the user value.
if (mBreastMaxVelocityParam[i] == 0)
{
new_local_pt[i] = breast_user_local_pt[i];
}
if (mBreastParamsDriven[i])
{
mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
// <FS:Ansariel> [Legacy Bake]
//new_local_pt[i]);
new_local_pt[i], FALSE);
}
}
mBreastLastPosition_local_pt = new_local_pt;
//
// End calculate new params
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Conditionally update the visual params
//
// Updating the visual params (i.e. what the user sees) is fairly expensive.
// So only update if the params have changed enough, and also take into account
// the graphics LOD settings.
// For non-self, if the avatar is small enough visually, then don't update.
const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(this) != NULL);
if (!is_self)
{
const F32 area_for_max_settings = 0.0;
const F32 area_for_min_settings = 1400.0;
const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
if (pixel_area < area_for_this_setting)
{
return TRUE;
}
}
// If the parameter hasn't changed enough, then don't update.
LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt;
for (U32 i=0; i < 3; i++)
{
const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0;
if (llabs(position_diff[i]) > min_delta)
{
mCharacter->updateVisualParams();
mBreastLastUpdatePosition_local_pt = new_local_pt;
return TRUE;
}
}
//
// End update visual params
////////////////////////////////////////////////////////////////////////////////
return TRUE;
}

View File

@ -1,154 +0,0 @@
/**
* @file llbreastmotion.h
* @brief Implementation of LLBreastMotion 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_LLBREASTMOTION_H
#define LL_LLBREASTMOTION_H
//-----------------------------------------------------------------------------
// Header files
//-----------------------------------------------------------------------------
#include "llmotion.h"
#include "llframetimer.h"
#define BREAST_MOTION_FADEIN_TIME 1.0f
#define BREAST_MOTION_FADEOUT_TIME 1.0f
class LLViewerVisualParam;
//-----------------------------------------------------------------------------
// class LLBreastMotion
//-----------------------------------------------------------------------------
class LLBreastMotion :
public LLMotion
{
public:
// Constructor
LLBreastMotion(const LLUUID &id);
// Destructor
virtual ~LLBreastMotion();
public:
//-------------------------------------------------------------------------
// functions to support MotionController and MotionRegistry
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
public:
//-------------------------------------------------------------------------
// animation callbacks to be implemented by subclasses
//-------------------------------------------------------------------------
// motions must specify whether or not they loop
virtual bool getLoop() { return true; }
// motions must report their total duration
virtual F32 getDuration() { return 0.0; }
// motions must report their "ease in" duration
virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
// motions must report their "ease out" duration.
virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
// called to determine when a motion should be activated/deactivated based on avatar pixel coverage
virtual F32 getMinPixelArea();
// motions must report their priority
virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
// run-time (post constructor) initialization,
// called after parameters have been set
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
// called when a motion is activated
// must return TRUE to indicate success, or else
// it will be deactivated
virtual bool onActivate();
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
virtual bool onUpdate(F32 time, U8* joint_mask);
// called when a motion is deactivated
virtual void onDeactivate();
protected:
LLVector3 toLocal(const LLVector3 &world_vector);
LLVector3 calculateVelocity_local(const F32 time_delta);
LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
const F32 time_delta);
F32 calculateTimeDelta();
private:
//-------------------------------------------------------------------------
// joint states to be animated
//-------------------------------------------------------------------------
LLPointer<LLJointState> mChestState;
LLCharacter* mCharacter;
//-------------------------------------------------------------------------
// miscellaneous parameters
//-------------------------------------------------------------------------
LLViewerVisualParam *mBreastParamsUser[3];
LLViewerVisualParam *mBreastParamsDriven[3];
LLVector3 mBreastParamsMin;
LLVector3 mBreastParamsMax;
LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent
F32 mBreastMassParam;
F32 mBreastGravityParam;
U32 mBreastSmoothingParam;
LLVector3 mBreastSpringParam;
LLVector3 mBreastDampingParam;
LLVector3 mBreastGainParam;
LLVector3 mBreastMaxVelocityParam;
LLVector3 mBreastDragParam;
LLFrameTimer mTimer;
F32 mLastTime;
U32 mFileTicks;
};
#endif // LL_LLBREASTMOTION_H

View File

@ -145,7 +145,7 @@ public:
static LLChatHistoryHeader* createInstance(const std::string& file_name)
{
LLChatHistoryHeader* pInstance = new LLChatHistoryHeader;
pInstance->buildFromFile(file_name);
pInstance->buildFromFile(file_name, true);
return pInstance;
}
@ -607,7 +607,7 @@ public:
mUserNameTextBox = getChild<LLTextBox>("user_name");
mTimeBoxTextBox = getChild<LLTextBox>("time_box");
mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance(), true);
if (mInfoCtrl)
{
mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
@ -1239,7 +1239,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
LLView* LLChatHistory::getSeparator()
{
LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance(), true);
return separator;
}

View File

@ -657,12 +657,11 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG
// This method reads the llsd based config file, and uses it to set
// members of a control group.
LLSD clpConfigLLSD;
llifstream input_stream;
input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary);
if(input_stream.is_open())
std::string xml = gDirUtilp->getFileContents(config_filename);
if (!xml.empty())
{
std::stringstream input_stream(xml);
LLSDSerialize::fromXML(clpConfigLLSD, input_stream);
for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap();
option_itr != clpConfigLLSD.endMap();

View File

@ -1,225 +0,0 @@
/**
* @file lldensityctrl.cpp
* @brief Control for specifying density over a height range for sky settings.
*
* $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 "lldensityctrl.h"
#include "llslider.h"
#include "llsliderctrl.h"
#include "llsettingssky.h"
static LLDefaultChildRegistry::Register<LLDensityCtrl> register_density_control("densityctrl");
const std::string LLDensityCtrl::DENSITY_RAYLEIGH("density_rayleigh");
const std::string LLDensityCtrl::DENSITY_MIE("density_mie");
const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption");
namespace
{
const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential");
const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale");
const std::string FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear");
const std::string FIELD_SKY_DENSITY_PROFILE_CONSTANT("level_constant");
const std::string FIELD_SKY_DENSITY_MAX_ALTITUDE("max_altitude");
const std::string FIELD_SKY_DENSITY_ANISO_FACTOR("aniso_factor");
const std::string FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL("aniso_factor_label");
}
const std::string& LLDensityCtrl::NameForDensityProfileType(DensityProfileType t)
{
switch (t)
{
case Rayleigh: return DENSITY_RAYLEIGH;
case Mie: return DENSITY_MIE;
case Absorption: return DENSITY_ABSORPTION;
default:
break;
}
llassert(false);
return DENSITY_RAYLEIGH;
}
LLDensityCtrl::Params::Params()
: image_density_feedback("image_density_feedback")
, lbl_exponential("label_exponential")
, lbl_exponential_scale("label_exponential_scale")
, lbl_linear("label_linear")
, lbl_constant("label_constant")
, lbl_max_altitude("label_max_altitude")
, lbl_aniso_factor("label_aniso_factor")
, profile_type(LLDensityCtrl::Rayleigh)
{
}
LLDensityCtrl::LLDensityCtrl(const Params& params)
: mProfileType(params.profile_type)
, mImgDensityFeedback(params.image_density_feedback)
{
}
LLSD LLDensityCtrl::getProfileConfig()
{
LLSD config;
switch (mProfileType)
{
case Rayleigh: return mSkySettings->getRayleighConfigs();
case Mie: return mSkySettings->getMieConfigs();
case Absorption: return mSkySettings->getAbsorptionConfigs();
default:
break;
}
llassert(false);
return config;
}
BOOL LLDensityCtrl::postBuild()
{
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialChanged(); });
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialScaleFactorChanged(); });
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLinearChanged(); });
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onConstantChanged(); });
getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltitudeChanged(); });
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAnisoFactorChanged(); });
if (mProfileType != Mie)
{
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL)->setValue(false);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setVisible(false);
}
return TRUE;
}
void LLDensityCtrl::setEnabled(BOOL enabled)
{
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setEnabled(enabled);
if (mProfileType == Mie)
{
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setEnabled(enabled);
}
}
void LLDensityCtrl::refresh()
{
if (!mSkySettings)
{
setAllChildrenEnabled(FALSE);
setEnabled(FALSE);
return;
}
setEnabled(TRUE);
setAllChildrenEnabled(TRUE);
LLSD config = getProfileConfig();
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM]);
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR]);
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM]);
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM]);
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]);
if (mProfileType == Mie)
{
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]);
}
}
void LLDensityCtrl::updateProfile()
{
F32 exponential_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->getValueF32();
F32 exponential_scale = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->getValueF32();
F32 linear_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->getValueF32();
F32 constant_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->getValueF32();
F32 max_alt = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->getValueF32();
F32 aniso_factor = 0.0f;
if (mProfileType == Mie)
{
aniso_factor = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->getValueF32();
}
LLSD profile = LLSettingsSky::createSingleLayerDensityProfile(max_alt, exponential_term, exponential_scale, linear_term, constant_term, aniso_factor);
switch (mProfileType)
{
case Rayleigh: mSkySettings->setRayleighConfigs(profile); break;
case Mie: mSkySettings->setMieConfigs(profile); break;
case Absorption: mSkySettings->setAbsorptionConfigs(profile); break;
default:
break;
}
}
void LLDensityCtrl::onExponentialChanged()
{
updateProfile();
updatePreview();
}
void LLDensityCtrl::onExponentialScaleFactorChanged()
{
updateProfile();
updatePreview();
}
void LLDensityCtrl::onLinearChanged()
{
updateProfile();
updatePreview();
}
void LLDensityCtrl::onConstantChanged()
{
updateProfile();
updatePreview();
}
void LLDensityCtrl::onMaxAltitudeChanged()
{
updateProfile();
updatePreview();
}
void LLDensityCtrl::onAnisoFactorChanged()
{
updateProfile();
}
void LLDensityCtrl::updatePreview()
{
// AdvancedAtmospherics TODO
// Generate image according to current density profile
}

View File

@ -1,104 +0,0 @@
/**
* @file lldensityctrl.h
* @brief Control for specifying density over a height range for sky settings.
*
* $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 LLDENSITY_CTRL_H
#define LLDENSITY_CTRL_H
#include "lluictrl.h"
#include "llsettingssky.h"
#include "lltextbox.h"
#include "llsliderctrl.h"
class LLDensityCtrl : public LLUICtrl
{
public:
static const std::string DENSITY_RAYLEIGH;
static const std::string DENSITY_MIE;
static const std::string DENSITY_ABSORPTION;
// Type of density profile this tab is updating
enum DensityProfileType
{
Rayleigh,
Mie,
Absorption
};
static const std::string& NameForDensityProfileType(DensityProfileType t);
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLTextBox::Params> lbl_exponential,
lbl_exponential_scale,
lbl_linear,
lbl_constant,
lbl_max_altitude,
lbl_aniso_factor;
Optional<LLSliderCtrl::Params> exponential_slider,
exponential_scale_slider,
linear_slider,
constant_slider,
aniso_factor_slider;
Optional<LLUIImage*> image_density_feedback;
DensityProfileType profile_type;
Params();
};
virtual BOOL postBuild() override;
virtual void setEnabled(BOOL enabled) override;
void setProfileType(DensityProfileType t) { mProfileType = t; }
void refresh();
void updateProfile();
LLSettingsSky::ptr_t getSky() const { return mSkySettings; }
void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); }
protected:
friend class LLUICtrlFactory;
LLDensityCtrl(const Params&);
LLSD getProfileConfig();
void updatePreview();
private:
void onExponentialChanged();
void onExponentialScaleFactorChanged();
void onLinearChanged();
void onConstantChanged();
void onMaxAltitudeChanged();
void onAnisoFactorChanged();
DensityProfileType mProfileType = Rayleigh;
LLUIImage* mImgDensityFeedback = nullptr;
LLSettingsSky::ptr_t mSkySettings;
};
#endif LLDENSITY_CTRL_H

View File

@ -1,160 +0,0 @@
/**
* @file llface.inl
* @brief Inline functions for LLFace
*
* $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_LLFACE_INL
#define LL_LLFACE_INL
#include "llglheaders.h"
#include "llrender.h"
inline BOOL LLFace::getDirty() const
{
return (mGeneration != mDrawPoolp->mGeneration);
}
inline void LLFace::clearDirty()
{
mGeneration = mDrawPoolp->mGeneration;
}
inline const LLTextureEntry* LLFace::getTextureEntry() const
{
return mVObjp->getTE(mTEOffset);
}
inline LLDrawPool* LLFace::getPool() const
{
return mDrawPoolp;
}
inline S32 LLFace::getStride() const
{
return mDrawPoolp->getStride();
}
inline LLDrawable* LLFace::getDrawable() const
{
return mDrawablep;
}
inline LLViewerObject* LLFace::getViewerObject() const
{
return mVObjp;
}
inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors)
{
if (!mGeomCount)
{
return -1;
}
LLColor4U *colorp = NULL;
if (isState(BACKLIST))
{
if (!mBackupMem)
{
printDebugInfo();
LL_ERRS() << "No backup memory for face" << LL_ENDL;
}
colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
colors = colorp;
return 0;
}
else
{
llassert(mGeomIndex >= 0);
if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
{
printDebugInfo();
LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL;
}
mDrawPoolp->setDirtyColors();
return mGeomIndex;
}
}
inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass )
{
if (!mGeomCount)
{
return -1;
}
if (isState(BACKLIST))
{
if (!mBackupMem)
{
printDebugInfo();
LL_ERRS() << "No backup memory for face" << LL_ENDL;
}
texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
texCoords.setStride( mDrawPoolp->getStride());
return 0;
}
else
{
llassert(mGeomIndex >= 0);
mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
mDrawPoolp->setDirty();
return mGeomIndex;
}
}
inline S32 LLFace::getIndices (U32* &indicesp)
{
if (isState(BACKLIST))
{
indicesp = (U32*)mBackupMem;
return 0;
}
else
{
indicesp = mDrawPoolp->getIndices(mIndicesIndex);
llassert(mGeomIndex >= 0);
return mGeomIndex;
}
}
inline const U32* LLFace::getRawIndices() const
{
llassert(!isState(BACKLIST));
return &mDrawPoolp->mIndices[mIndicesIndex];
}
inline void LLFace::bindTexture(S32 stage) const
{
if (mTexture)
{
mTexture->bindTexture(stage);
}
else
{
LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
}
}
#endif

View File

@ -1007,10 +1007,11 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams()
if (!params_initialized)
{
LLXMLNodePtr button_xml_node;
if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node))
static const std::string filename("favorites_bar_button.xml");
if (LLUICtrlFactory::getLayeredXMLNode(filename, button_xml_node, LLDir::CURRENT_SKIN, true))
{
LLXUIParser parser;
parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml");
parser.readXUI(button_xml_node, button_params, filename);
}
params_initialized = true;
}

View File

@ -43,7 +43,6 @@
#include "llmimetypes.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
// #include "llsavedsettingsglue.h" #<FS:Ansariel> Unused
#include "llviewertexturelist.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"

View File

@ -1,718 +0,0 @@
/**
* @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"
#include <boost/make_shared.hpp>
// 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"
#include "lljoystickbutton.h"
// newview
#include "llagent.h"
#include "llcolorswatch.h"
#include "llregioninfomodel.h"
#include "llviewerregion.h"
#include "v3colorutil.h"
#include "llenvironment.h"
#include "llenvadapters.h"
namespace
{
const F32 WL_SUN_AMBIENT_SLIDER_SCALE(3.0f);
const F32 WL_BLUE_HORIZON_DENSITY_SCALE(2.0f);
const F32 WL_CLOUD_SLIDER_SCALE(1.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),
mSkyAdapter()
{
}
// 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");
mSkyAdapter = boost::make_shared<LLSkySettingsAdapter>();
LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
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.
// <FS:Ansariel> FS-modified floater might not have this
//getChildView("note")->setVisible(!new_preset);
LLView* note = findChildView("note");
if (note)
{
note->setVisible(!new_preset);
}
// </FS:Ansariel>
// 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
{
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
}
// 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));
// Connect to region info updates.
LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
// sunlight
getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight));
// glow
getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow));
getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow));
// time of day
// getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider
// getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
// getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm));
getChild<LLJoystickQuaternion>("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this));
getChild<LLJoystickQuaternion>("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this));
// Clouds
// Cloud Color
getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor));
// Cloud
getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain));
getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain));
getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain));
// Cloud Detail
getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail));
// Cloud extras
getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage));
getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale));
getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
// Dome
getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma));
getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
}
//=================================================================================================
void LLFloaterEditSky::syncControls()
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
mEditSettings = psky;
std::string name = psky->getName();
mSkyPresetNameEditor->setText(name);
mSkyPresetCombo->setValue(name);
// Lighting
// sunlight
mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() );
setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
// glow
mSkyAdapter->mGlow.setColor3( psky->getGlow() );
childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f);
childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f);
// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl();
//
// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI);
// getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
// getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24);
// childSetValue("WLEastAngle", azal.first / F_TWO_PI);
getChild<LLJoystickQuaternion>("WLSunRotation")->setRotation(psky->getSunRotation());
getChild<LLJoystickQuaternion>("WLMoonRotation")->setRotation(psky->getMoonRotation());
// Clouds
// Cloud Color
mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() );
setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE);
// Cloud
mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() );
childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed());
childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen());
childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue());
// Cloud Detail
mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() );
childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed());
childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen());
childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue());
// Cloud extras
mSkyAdapter->mCloudCoverage = psky->getCloudShadow();
mSkyAdapter->mCloudScale = psky->getCloudScale();
childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage);
childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale);
// cloud scrolling
LLVector2 scroll_rate = psky->getCloudScrollRate();
// LAPRAS: These should go away...
childDisable("WLCloudLockX");
childDisable("WLCloudLockY");
// disable if locked, enable if not
childEnable("WLCloudScrollX");
childEnable("WLCloudScrollY");
// *HACK cloud scrolling is off my an additive of 10
childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f);
childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f);
// Tweak extras
mSkyAdapter->mWLGamma = psky->getGamma();
childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma);
childSetValue("WLStarAlpha", psky->getStarBrightness());
}
void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
{
// Set the value, dividing it by <k> first.
LLColor4 color = from_ctrl.getColor4();
getChild<LLColorSwatchCtrl>(name)->set(color / k);
}
// color control callbacks
void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
LLColor4 color_vec(swatch->get().mV);
// Multiply RGB values by the appropriate factor.
F32 k = WL_CLOUD_SLIDER_SCALE;
if (color_ctrl->getIsSunOrAmbientColor())
{
k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
else if (color_ctrl->getIsBlueHorizonOrDensity())
{
k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
color_vec *= k; // intensity isn't affected by the multiplication
// Set intensity to maximum of the RGB values.
color_vec.mV[3] = color_max(color_vec);
// Apply the new RGBI value.
color_ctrl->setColor4(color_vec);
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
F32 red_value = sldr_ctrl->getValueF32();
F32 k = 1.0f;
if (color_ctrl->getIsSunOrAmbientColor())
{
k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->getIsBlueHorizonOrDensity())
{
k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
color_ctrl->setRed(red_value * k);
adjustIntensity(color_ctrl, red_value, k);
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
F32 green_value = sldr_ctrl->getValueF32();
F32 k = 1.0f;
if (color_ctrl->getIsSunOrAmbientColor())
{
k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->getIsBlueHorizonOrDensity())
{
k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
color_ctrl->setGreen(green_value * k);
adjustIntensity(color_ctrl, green_value, k);
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
F32 blue_value = sldr_ctrl->getValueF32();
F32 k = 1.0f;
if (color_ctrl->getIsSunOrAmbientColor())
{
k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->getIsBlueHorizonOrDensity())
{
k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
color_ctrl->setBlue(blue_value * k);
adjustIntensity(color_ctrl, blue_value, k);
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale)
{
if (ctrl->getHasSliderName())
{
LLColor4 color = ctrl->getColor4();
F32 i = color_max(color) / scale;
ctrl->setIntensity(i);
std::string name = ctrl->getSliderName();
name.append("I");
childSetValue(name, i);
}
}
/// GLOW SPECIFIC CODE
void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
// scaled by 20
color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20);
color_ctrl->update(mEditSettings);
}
/// \NOTE that we want NEGATIVE (-) B
void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
{
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->setBlue(-sldr_ctrl->getValueF32() * 5);
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult());
floatControl->update(mEditSettings);
}
// Lighting callbacks
// time of day
void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
{
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
F32 azimuth = F_TWO_PI * east_sldr->getValueF32();
F32 altitude = F_TWO_PI * time24_to_sun_pos(time24);
mEditSettings->setSunRotation(azimuth, altitude);
mEditSettings->setMoonRotation(azimuth + F_PI, -altitude);
LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f );
color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onTimeChanged()
{
F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
onSunMoved(getChild<LLUICtrl>("WLSunPos"), &(mSkyAdapter->mLightnorm));
}
void LLFloaterEditSky::onSunRotationChanged()
{
LLJoystickQuaternion* sun_spinner = getChild<LLJoystickQuaternion>("WLSunRotation");
LLQuaternion sunrot(sun_spinner->getRotation());
mEditSettings->setSunRotation(sunrot);
}
void LLFloaterEditSky::onMoonRotationChanged()
{
LLJoystickQuaternion* moon_spinner = getChild<LLJoystickQuaternion>("WLMoonRotation");
LLQuaternion moonrot(moon_spinner->getRotation());
mEditSettings->setMoonRotation(moonrot);
}
void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
mEditSettings->setStarBrightness(sldr_ctrl->getValueF32());
}
// Clouds
void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f);
}
void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f);
}
//=================================================================================================
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();
LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList();
for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
{
mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
mSkyPresetCombo->setLabel(getString("combo_label"));
}
void LLFloaterEditSky::enableEditing(bool enable)
{
// Enable/disable the tab and their contents.
// <FS:Ansariel> FS-modified floater might not have this
//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);
//}
LLTabContainer* tab_container = findChild<LLTabContainer>("WindLight Tabs");
if (tab_container)
{
tab_container->setEnabled(enable);
for (S32 i = 0; i < tab_container->getTabCount(); ++i)
{
tab_container->enableTabButton(i, enable);
tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable);
}
}
// </FS:Ansariel>
// Enable/disable saving.
mSaveButton->setEnabled(enable);
mMakeDefaultCheckBox->setEnabled(enable);
}
void LLFloaterEditSky::saveRegionSky()
{
#if 0
LLWLParamKey key(getSelectedSkyPreset());
llassert(key.scope == LLEnvKey::SCOPE_REGION);
LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL;
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;
#endif
}
std::string LLFloaterEditSky::getSelectedPresetName() const
{
std::string name;
if (mSkyPresetNameEditor->getVisible())
{
name = mSkyPresetNameEditor->getText();
}
else
{
LLSD combo_val = mSkyPresetCombo->getValue();
name = combo_val[0].asString();
}
return name;
}
void LLFloaterEditSky::onSkyPresetNameEdited()
{
std::string name = mSkyPresetNameEditor->getText();
LLSettingsWater::ptr_t psky = LLEnvironment::instance().getCurrentWater();
psky->setName(name);
}
void LLFloaterEditSky::onSkyPresetSelected()
{
std::string name;
name = getSelectedPresetName();
LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(name);
if (!psky)
{
LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL;
enableEditing(false);
return;
}
psky = psky->buildClone();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky);
mEditSettings = psky;
syncControls();
enableEditing(true);
}
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 currently displayed water params to the selected preset.
std::string name = mEditSettings->getName();
LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
LLEnvironment::instance().addSky(mEditSettings);
// Change preference if requested.
if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
{
LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL;
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
}
closeFloater();
}
void LLFloaterEditSky::onBtnSave()
{
LLEnvironment::instance().addSky(mEditSettings);
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
closeFloater();
}
void LLFloaterEditSky::onBtnCancel()
{
closeFloater();
}
void LLFloaterEditSky::onSkyPresetListChange()
{
refreshSkyPresetsList();
}
void LLFloaterEditSky::onRegionSettingsChange()
{
#if 0
// 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();
}
#endif
}
void LLFloaterEditSky::onRegionInfoUpdate()
{
#if 0
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);
#endif
}

View File

@ -1,533 +0,0 @@
/**
* @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"
#include <boost/make_shared.hpp>
// 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 "llenvironment.h"
#include "llsettingswater.h"
#include "llenvadapters.h"
#include "v3colorutil.h"
#undef max // Fixes a Windows compiler error
LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
LLFloater(key),
mWaterPresetNameEditor(NULL),
mWaterPresetCombo(NULL),
mMakeDefaultCheckBox(NULL),
mSaveButton(NULL),
mWaterAdapter()
{
}
// 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");
mWaterAdapter = boost::make_shared<LLWatterSettingsAdapter>();
LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this));
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
{
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
}
// 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));
// Connect to region info updates.
LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this));
//-------------------------------------------------------------------------
getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor));
// fog density
getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity));
getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod));
// blue density
getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale));
// fresnel
getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale));
getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset));
// scale above/below
getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove));
getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow));
// blur mult
getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier));
// wave direction
getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir));
getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir));
getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir));
getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->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.
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mEditSettings = pwater;
std::string name = pwater->getName();
mWaterPresetNameEditor->setText(name);
mWaterPresetCombo->setValue(name);
//getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor()));
// fog and wavelets
mWaterAdapter->mFogDensity = pwater->getWaterFogDensity();
getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp());
mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod();
getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod));
mWaterAdapter->mNormalScale = pwater->getNormalScale();
getChild<LLUICtrl>("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX());
getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY());
getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ());
// Fresnel
mWaterAdapter->mFresnelScale = pwater->getFresnelScale();
getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale));
mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset();
getChild<LLUICtrl>("WaterFresnelOffset")->setValue(static_cast<F32>(mWaterAdapter->mFresnelOffset));
// Scale Above/Below
mWaterAdapter->mScaleAbove = pwater->getScaleAbove();
getChild<LLUICtrl>("WaterScaleAbove")->setValue(static_cast<F32>(mWaterAdapter->mScaleAbove));
mWaterAdapter->mScaleBelow = pwater->getScaleBelow();
getChild<LLUICtrl>("WaterScaleBelow")->setValue(static_cast<F32>(mWaterAdapter->mScaleBelow));
// blur mult
mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier();
getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier));
// wave directions
mWaterAdapter->mWave1Dir = pwater->getWave1Dir();
getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU());
getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV());
mWaterAdapter->mWave2Dir = pwater->getWave2Dir();
getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU());
getChild<LLUICtrl>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV());
LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
textCtrl->setImageAssetID(pwater->getNormalMapID());
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setX( sldr_ctrl->getValueF32() );
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setY(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setZ(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setU(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setV(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
floatControl->setValue(sldr_ctrl->getValueF32());
floatControl->update(mEditSettings);
}
void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
expFloatControl->setExp(sldr_ctrl->getValueF32());
expFloatControl->update(mEditSettings);
}
void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
color_ctrl->setColor4( swatch->get() );
color_ctrl->update(mEditSettings);
}
void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl)
{
LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
LLUUID textID = textCtrl->getImageAssetID();
mEditSettings->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();
LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList();
for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
{
mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
mWaterPresetCombo->setLabel(getString("combo_label"));
}
void LLFloaterEditWater::enableEditing(bool enable)
{
// Enable/disable water controls.
// <FS:Ansariel> FS-modified floater might have this
//getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable);
LLPanel* panel_water_preset = findChild<LLPanel>("panel_water_preset");
if (panel_water_preset)
{
panel_water_preset->setCtrlsEnabled(enable);
}
// </FS:Ansariel>
// Enable/disable saving.
mSaveButton->setEnabled(enable);
mMakeDefaultCheckBox->setEnabled(enable);
}
void LLFloaterEditWater::saveRegionWater()
{
#if 0
llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water
LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL;
//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;
#endif
}
#if 0
std::string LLFloaterEditWater::getCurrentPresetName() const
{
std::string name;
LLEnvKey::EScope scope;
getSelectedPreset(name, scope);
return name;
}
#endif
#if 0
LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const
{
std::string name;
LLEnvKey::EScope scope;
getSelectedPreset(name, scope);
return scope;
}
#endif
std::string LLFloaterEditWater::getSelectedPresetName() const
{
std::string name;
if (mWaterPresetNameEditor->getVisible())
{
name = mWaterPresetNameEditor->getText();
}
else
{
LLSD combo_val = mWaterPresetCombo->getValue();
name = combo_val[0].asString();
}
return name;
}
void LLFloaterEditWater::onWaterPresetNameEdited()
{
std::string name = mWaterPresetNameEditor->getText();
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
pwater->setName(name);
#if 0
// Disable saving a water preset having empty name.
mSaveButton->setEnabled(!getCurrentPresetName().empty());
#endif
}
void LLFloaterEditWater::onWaterPresetSelected()
{
std::string name;
name = getSelectedPresetName();
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name);
if (!pwater)
{
LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL;
enableEditing(false);
return;
}
pwater = pwater->buildClone();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater);
mEditSettings = pwater;
syncControls();
enableEditing(true);
}
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 = mEditSettings->getName();
LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
LLEnvironment::instance().addWater(mEditSettings);
// Change preference if requested.
if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
{
LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL;
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
}
closeFloater();
}
void LLFloaterEditWater::onBtnSave()
{
LLEnvironment::instance().addWater(mEditSettings);
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
closeFloater();
}
void LLFloaterEditWater::onBtnCancel()
{
closeFloater();
}
void LLFloaterEditWater::onWaterPresetListChange()
{
refreshWaterPresetsList();
}
void LLFloaterEditWater::onRegionSettingsChange()
{
#if 0
// 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();
}
#endif
}
void LLFloaterEditWater::onRegionInfoUpdate()
{
#if 0
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);
#endif
}

View File

@ -1,978 +0,0 @@
/**
* @file llimpanel.cpp
* @brief LLIMPanel class definition
*
* $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 "llimpanel.h"
#include "indra_constants.h"
#include "llfloaterreg.h"
#include "llfocusmgr.h"
#include "llfontgl.h"
#include "llrect.h"
#include "llerror.h"
#include "llmultifloater.h"
#include "llstring.h"
#include "message.h"
#include "lltextbox.h"
#include "llagent.h"
#include "llbutton.h"
#include "llcallingcard.h"
#include "llchannelmanager.h"
#include "llchat.h"
#include "llchiclet.h"
#include "llconsole.h"
#include "llgroupactions.h"
#include "llfloater.h"
#include "llfloateractivespeakers.h"
#include "llavataractions.h"
#include "llinventory.h"
#include "llinventorymodel.h"
#include "llfloaterinventory.h"
#include "lliconctrl.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llpanelimcontrolpanel.h"
#include "llrecentpeople.h"
#include "llresmgr.h"
#include "lltooldraganddrop.h"
#include "lltrans.h"
#include "lltabcontainer.h"
#include "llviewertexteditor.h"
#include "llviewermessage.h"
#include "llviewerstats.h"
#include "llviewercontrol.h"
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include "llvoicechannel.h"
#include "lllogchat.h"
#include "llweb.h"
#include "llhttpclient.h"
#include "llmutelist.h"
#include "llstylemap.h"
#include "llappviewer.h"
//
// Constants
//
const S32 LINE_HEIGHT = 16;
const S32 MIN_WIDTH = 200;
const S32 MIN_HEIGHT = 130;
//
// Statics
//
//
static std::string sTitleString = "Instant Message with [NAME]";
static std::string sTypingStartString = "[NAME]: ...";
static std::string sSessionStartString = "Starting session with [NAME] please wait.";
//
// LLFloaterIMPanel
//
LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label,
const LLUUID& session_id,
const LLUUID& other_participant_id,
const std::vector<LLUUID>& ids,
EInstantMessage dialog)
: LLFloater(session_id),
mInputEditor(NULL),
mHistoryEditor(NULL),
mSessionUUID(session_id),
mSessionLabel(session_label),
mSessionInitialized(FALSE),
mSessionStartMsgPos(0),
mOtherParticipantUUID(other_participant_id),
mDialog(dialog),
mSessionInitialTargetIDs(ids),
mTyping(FALSE),
mOtherTyping(FALSE),
mTypingLineStartIndex(0),
mSentTypingState(TRUE),
mNumUnreadMessages(0),
mShowSpeakersOnConnect(TRUE),
mTextIMPossible(TRUE),
mProfileButtonEnabled(TRUE),
mCallBackEnabled(TRUE),
mSpeakerPanel(NULL),
mFirstKeystrokeTimer(),
mLastKeystrokeTimer()
{
std::string xml_filename;
switch(mDialog)
{
case IM_SESSION_GROUP_START:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
xml_filename = "floater_instant_message_group.xml";
break;
case IM_SESSION_INVITE:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
if (gAgent.isInGroup(mSessionUUID))
{
xml_filename = "floater_instant_message_group.xml";
}
else // must be invite to ad hoc IM
{
xml_filename = "floater_instant_message_ad_hoc.xml";
}
break;
case IM_SESSION_P2P_INVITE:
xml_filename = "floater_instant_message.xml";
break;
case IM_SESSION_CONFERENCE_START:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
xml_filename = "floater_instant_message_ad_hoc.xml";
break;
// just received text from another user
case IM_NOTHING_SPECIAL:
xml_filename = "floater_instant_message.xml";
mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID);
mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID);
mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
break;
default:
LL_WARNS() << "Unknown session type" << LL_ENDL;
xml_filename = "floater_instant_message.xml";
break;
}
LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL);
setTitle(mSessionLabel);
mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
// enable line history support for instant message bar
mInputEditor->setEnableLineHistory(TRUE);
//*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID);
if (!im_session)
{
llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0);
return;
}
mSessionInitialized = im_session->mSessionInitialized;
if (!mSessionInitialized)
{
//locally echo a little "starting session" message
LLUIString session_start = sSessionStartString;
session_start.setArg("[NAME]", getTitle());
mSessionStartMsgPos =
mHistoryEditor->getWText().length();
addHistoryLine(
session_start,
LLUIColorTable::instance().getColor("SystemChatColor"),
false);
}
}
LLFloaterIMPanel::~LLFloaterIMPanel()
{
//delete focus lost callback
mFocusCallbackConnection.disconnect();
}
BOOL LLFloaterIMPanel::postBuild()
{
setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
mInputEditor = getChild<LLLineEditor>("chat_editor");
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this));
mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
mInputEditor->setCommitCallback( onCommitChat, this );
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setRevertOnEsc( FALSE );
mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
childSetAction("profile_callee_btn", onClickProfile, this);
childSetAction("group_info_btn", onClickGroupInfo, this);
childSetAction("start_call_btn", onClickStartCall, this);
childSetAction("end_call_btn", onClickEndCall, this);
childSetAction("send_btn", onClickSend, this);
childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
childSetAction("moderator_kick_speaker", onKickSpeaker, this);
//LLButton* close_btn = getChild<LLButton>("close_btn");
//close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this);
mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
if ( IM_SESSION_GROUP_START == mDialog )
{
childSetEnabled("profile_btn", FALSE);
}
if(!mProfileButtonEnabled)
{
childSetEnabled("profile_callee_btn", FALSE);
}
sTitleString = getString("title_string");
sTypingStartString = getString("typing_start_string");
sSessionStartString = getString("session_start_string");
if (mSpeakerPanel)
{
mSpeakerPanel->refreshSpeakers();
}
if (mDialog == IM_NOTHING_SPECIAL)
{
childSetAction("mute_btn", onClickMuteVoice, this);
childSetCommitCallback("speaker_volume", onVolumeChange, this);
}
setDefaultBtn("send_btn");
return TRUE;
}
void* LLFloaterIMPanel::createSpeakersPanel(void* data)
{
LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data;
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID);
floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE);
return floaterp->mSpeakerPanel;
}
//static
void LLFloaterIMPanel::onClickMuteVoice(void* user_data)
{
LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
if (floaterp)
{
BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat);
LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT);
if (!is_muted)
{
LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat);
}
else
{
LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat);
}
}
}
//static
void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
{
LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
if (floaterp)
{
LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
}
}
// virtual
void LLFloaterIMPanel::draw()
{
LLViewerRegion* region = gAgent.getRegion();
BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
&& mSessionInitialized
&& LLVoiceClient::getInstance()->voiceEnabled()
&& mCallBackEnabled;
// hide/show start call and end call buttons
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
if (!voice_channel)
return;
childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
childSetEnabled("start_call_btn", enable_connect);
childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
LLPointer<LLSpeaker> self_speaker;
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
if (speaker_mgr)
{
self_speaker = speaker_mgr->findSpeaker(gAgent.getID());
}
if(!mTextIMPossible)
{
mInputEditor->setEnabled(FALSE);
mInputEditor->setLabel(getString("unavailable_text_label"));
}
else if (self_speaker.notNull() && self_speaker->mModeratorMutedText)
{
mInputEditor->setEnabled(FALSE);
mInputEditor->setLabel(getString("muted_text_label"));
}
else
{
mInputEditor->setEnabled(TRUE);
mInputEditor->setLabel(getString("default_text_label"));
}
// show speakers window when voice first connects
if (mShowSpeakersOnConnect && voice_channel->isActive())
{
childSetVisible("active_speakers_panel", TRUE);
mShowSpeakersOnConnect = FALSE;
}
childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
if (mTyping)
{
// Time out if user hasn't typed for a while.
if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
{
setTyping(FALSE);
}
// If we are typing, and it's been a little while, send the
// typing indicator
if (!mSentTypingState
&& mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f)
{
sendTypingState(TRUE);
mSentTypingState = TRUE;
}
}
// use embedded panel if available
if (mSpeakerPanel)
{
if (mSpeakerPanel->getVisible())
{
mSpeakerPanel->refreshSpeakers();
}
}
else
{
// refresh volume and mute checkbox
childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
}
LLFloater::draw();
}
class LLSessionInviteResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLSessionInviteResponder);
public:
LLSessionInviteResponder(const LLUUID& session_id)
{
mSessionID = session_id;
}
protected:
void httpFailure()
{
LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL;
//throw something back to the viewer here?
}
private:
LLUUID mSessionID;
};
BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region)
{
return FALSE;
}
S32 count = ids.size();
if( isInviteAllowed() && (count > 0) )
{
LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL;
std::string url = region->getCapability("ChatSessionRequest");
LLSD data;
data["params"] = LLSD::emptyArray();
for (int i = 0; i < count; i++)
{
data["params"].append(ids[i]);
}
data["method"] = "invite";
data["session-id"] = mSessionUUID;
LLHTTPClient::post(
url,
data,
new LLSessionInviteResponder(
mSessionUUID));
}
else
{
LL_INFOS() << "LLFloaterIMPanel::inviteToSession -"
<< " no need to invite agents for "
<< mDialog << LL_ENDL;
// successful add, because everyone that needed to get added
// was added.
}
return TRUE;
}
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name)
{
// start tab flashing when receiving im for background session from user
if (source != LLUUID::null)
{
LLMultiFloater* hostp = getHost();
if( !isInVisibleChain()
&& hostp
&& source != gAgent.getID())
{
hostp->setFloaterFlashing(this, TRUE);
}
}
// Now we're adding the actual line of text, so erase the
// "Foo is typing..." text segment, and the optional timestamp
// if it was present. JC
removeTypingIndicator(NULL);
// Actually add the line
std::string timestring;
bool prepend_newline = true;
if (gSavedSettings.getBOOL("IMShowTimestamps"))
{
timestring = mHistoryEditor->appendTime(prepend_newline);
prepend_newline = false;
}
std::string separator_string(": ");
// 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
if (!name.empty()) // If name exists, then add it to the front of the message.
{
// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
if (name == SYSTEM_FROM)
{
mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color));
}
else
{
// Convert the name to a hotlink and add to message.
mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source));
}
prepend_newline = false;
}
mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color));
mHistoryEditor->blockUndo();
if (!isInVisibleChain())
{
mNumUnreadMessages++;
}
}
void LLFloaterIMPanel::setInputFocus( BOOL b )
{
mInputEditor->setFocus( b );
}
void LLFloaterIMPanel::selectAll()
{
mInputEditor->selectAll();
}
void LLFloaterIMPanel::selectNone()
{
mInputEditor->deselect();
}
BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
if( KEY_RETURN == key && mask == MASK_NONE)
{
sendMsg();
handled = TRUE;
}
else if ( KEY_ESCAPE == key )
{
handled = TRUE;
gFocusMgr.setKeyboardFocus(NULL);
}
// May need to call base class LLPanel::handleKeyHere if not handled
// in order to tab between buttons. JNC 1.2.2002
return handled;
}
BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
if (mDialog == IM_NOTHING_SPECIAL)
{
LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop,
cargo_type, cargo_data, accept);
}
// handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites
else if (isInviteAllowed())
{
*accept = ACCEPT_NO;
if (cargo_type == DAD_CALLINGCARD)
{
if (dropCallingCard((LLInventoryItem*)cargo_data, drop))
{
*accept = ACCEPT_YES_MULTI;
}
}
else if (cargo_type == DAD_CATEGORY)
{
if (dropCategory((LLInventoryCategory*)cargo_data, drop))
{
*accept = ACCEPT_YES_MULTI;
}
}
}
return TRUE;
}
BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop)
{
BOOL rv = isInviteAllowed();
if(rv && item && item->getCreatorUUID().notNull())
{
if(drop)
{
std::vector<LLUUID> ids;
ids.push_back(item->getCreatorUUID());
inviteToSession(ids);
}
}
else
{
// set to false if creator uuid is null.
rv = FALSE;
}
return rv;
}
BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop)
{
BOOL rv = isInviteAllowed();
if(rv && category)
{
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLUniqueBuddyCollector buddies;
gInventory.collectDescendentsIf(category->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
buddies);
S32 count = items.count();
if(count == 0)
{
rv = FALSE;
}
else if(drop)
{
std::vector<LLUUID> ids;
ids.reserve(count);
for(S32 i = 0; i < count; ++i)
{
ids.push_back(items.get(i)->getCreatorUUID());
}
inviteToSession(ids);
}
}
return rv;
}
BOOL LLFloaterIMPanel::isInviteAllowed() const
{
return ( (IM_SESSION_CONFERENCE_START == mDialog)
|| (IM_SESSION_INVITE == mDialog) );
}
// static
void LLFloaterIMPanel::onTabClick(void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
self->setInputFocus(TRUE);
}
// static
void LLFloaterIMPanel::onClickProfile( void* userdata )
{
// Bring up the Profile window
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
if (self->getOtherParticipantID().notNull())
{
LLAvatarActions::showProfile(self->getOtherParticipantID());
}
}
// static
void LLFloaterIMPanel::onClickGroupInfo( void* userdata )
{
// Bring up the Profile window
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
LLGroupActions::show(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickClose( void* userdata )
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
if(self)
{
self->closeFloater();
}
}
// static
void LLFloaterIMPanel::onClickStartCall(void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
gIMMgr->startCall(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickEndCall(void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
gIMMgr->endCall(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickSend(void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
self->sendMsg();
}
// static
void LLFloaterIMPanel::onClickToggleActiveSpeakers(void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
}
// static
void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata)
{
LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
self->sendMsg();
}
// static
void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
{
LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
self->mHistoryEditor->setCursorAndScrollToEnd();
}
// static
void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
self->setTyping(FALSE);
}
// static
void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
std::string text = self->mInputEditor->getText();
if (!text.empty())
{
self->setTyping(TRUE);
}
else
{
// Deleting all text counts as stopping typing.
self->setTyping(FALSE);
}
}
// virtual
void LLFloaterIMPanel::onClose(bool app_quitting)
{
setTyping(FALSE);
gIMMgr->leaveSession(mSessionUUID);
// *HACK hide the voice floater
LLFloaterReg::hideInstance("voice_call", mSessionUUID);
}
void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility)
{
if (new_visibility.asBoolean())
{
mNumUnreadMessages = 0;
}
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
{
if (new_visibility.asBoolean())
LLFloaterReg::showInstance("voice_call", mSessionUUID);
else
LLFloaterReg::hideInstance("voice_call", mSessionUUID);
}
}
void LLFloaterIMPanel::sendMsg()
{
if (!gAgent.isGodlike()
&& (mDialog == IM_NOTHING_SPECIAL)
&& mOtherParticipantUUID.isNull())
{
LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
return;
}
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if(!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Truncate and convert to UTF8 for transport
std::string utf8_text = wstring_to_utf8str(text);
utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
if ( mSessionInitialized )
{
LLIMModel::sendMessage(utf8_text,
mSessionUUID,
mOtherParticipantUUID,
mDialog);
}
else
{
//queue up the message to send once the session is
//initialized
mQueuedMsgsForInit.append(utf8_text);
}
}
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);
mInputEditor->setText(LLStringUtil::null);
}
// Don't need to actually send the typing stop message, the other
// client will infer it from receiving the message.
mTyping = FALSE;
mSentTypingState = TRUE;
}
void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update)
{
if (
session_update.has("moderated_mode") &&
session_update["moderated_mode"].has("voice") )
{
BOOL voice_moderated = session_update["moderated_mode"]["voice"];
if (voice_moderated)
{
setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label"));
}
else
{
setTitle(mSessionLabel);
}
//update the speakers dropdown too, if it's available
if (mSpeakerPanel)
{
mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
}
}
}
void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id)
{
mSessionUUID = session_id;
mSessionInitialized = TRUE;
//we assume the history editor hasn't moved at all since
//we added the starting session message
//so, we count how many characters to remove
S32 chars_to_remove = mHistoryEditor->getWText().length() -
mSessionStartMsgPos;
mHistoryEditor->removeTextFromEnd(chars_to_remove);
//and now, send the queued msg
LLSD::array_iterator iter;
for ( iter = mQueuedMsgsForInit.beginArray();
iter != mQueuedMsgsForInit.endArray();
++iter)
{
LLIMModel::sendMessage(
iter->asString(),
mSessionUUID,
mOtherParticipantUUID,
mDialog);
}
}
void LLFloaterIMPanel::setTyping(BOOL typing)
{
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
if (typing)
{
// Every time you type something, reset this timer
mLastKeystrokeTimer.reset();
if (!mTyping)
{
// You just started typing.
mFirstKeystrokeTimer.reset();
// Will send typing state after a short delay.
mSentTypingState = FALSE;
}
if (speaker_mgr)
speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE);
}
else
{
if (mTyping)
{
// you just stopped typing, send state immediately
sendTypingState(FALSE);
mSentTypingState = TRUE;
}
if (speaker_mgr)
speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
}
mTyping = typing;
}
void LLFloaterIMPanel::sendTypingState(BOOL typing)
{
// Don't want to send typing indicators to multiple people, potentially too
// much network traffic. Only send in person-to-person IMs.
if (mDialog != IM_NOTHING_SPECIAL) return;
LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing);
}
void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, BOOL typing)
{
if (typing)
{
// other user started typing
addTypingIndicator(im_info->mName);
}
else
{
// other user stopped typing
removeTypingIndicator(im_info);
}
}
void LLFloaterIMPanel::addTypingIndicator(const std::string &name)
{
// we may have lost a "stop-typing" packet, don't add it twice
if (!mOtherTyping)
{
mTypingLineStartIndex = mHistoryEditor->getWText().length();
LLUIString typing_start = sTypingStartString;
typing_start.setArg("[NAME]", name);
addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false);
mOtherTypingName = name;
mOtherTyping = TRUE;
}
// MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name)
// Richard will fix.
// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE);
}
void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info)
{
if (mOtherTyping)
{
// Must do this first, otherwise addHistoryLine calls us again.
mOtherTyping = FALSE;
S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex;
mHistoryEditor->removeTextFromEnd(chars_to_remove);
if (im_info)
{
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
if (speaker_mgr)
{
speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE);
}
}
}
}
//static
void LLFloaterIMPanel::onKickSpeaker(void* user_data)
{
}

View File

@ -1,110 +0,0 @@
/**
* @file llinventoryclipboard.cpp
* @brief LLInventoryClipboard class implementation
*
* $LicenseInfo:firstyear=2002&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 "llinventoryclipboard.h"
LLInventoryClipboard LLInventoryClipboard::sInstance;
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
///----------------------------------------------------------------------------
/// Class LLInventoryClipboard
///----------------------------------------------------------------------------
LLInventoryClipboard::LLInventoryClipboard()
: mCutMode(false)
{
}
LLInventoryClipboard::~LLInventoryClipboard()
{
reset();
}
void LLInventoryClipboard::add(const LLUUID& object)
{
mObjects.put(object);
}
// this stores a single inventory object
void LLInventoryClipboard::store(const LLUUID& object)
{
reset();
mObjects.put(object);
}
void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects)
{
reset();
S32 count = inv_objects.count();
for(S32 i = 0; i < count; i++)
{
mObjects.put(inv_objects[i]);
}
}
void LLInventoryClipboard::cut(const LLUUID& object)
{
if(!mCutMode && !mObjects.empty())
{
//looks like there are some stored items, reset clipboard state
reset();
}
mCutMode = true;
add(object);
}
void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const
{
inv_objects.reset();
S32 count = mObjects.count();
for(S32 i = 0; i < count; i++)
{
inv_objects.put(mObjects[i]);
}
}
void LLInventoryClipboard::reset()
{
mObjects.reset();
mCutMode = false;
}
// returns true if the clipboard has something pasteable in it.
BOOL LLInventoryClipboard::hasContents() const
{
return (mObjects.count() > 0);
}
///----------------------------------------------------------------------------
/// Local function definitions
///----------------------------------------------------------------------------

View File

@ -1,86 +0,0 @@
/**
* @file llinventoryclipboard.h
* @brief LLInventoryClipboard class header file
*
* $LicenseInfo:firstyear=2002&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_LLINVENTORYCLIPBOARD_H
#define LL_LLINVENTORYCLIPBOARD_H
#include "lldarray.h"
#include "lluuid.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryClipboard
//
// This class is used to cut/copy/paste inventory items around the
// world. This class is accessed through a singleton (only one
// inventory clipboard for now) which can be referenced using the
// instance() method.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryClipboard
{
public:
// calling this before main() is undefined
static LLInventoryClipboard& instance() { return sInstance; }
// this method adds to the current list.
void add(const LLUUID& object);
// this stores a single inventory object
void store(const LLUUID& object);
// this method stores an array of objects
void store(const LLDynamicArray<LLUUID>& inventory_objects);
void cut(const LLUUID& object);
// this method gets the objects in the clipboard by copying them
// into the array provided.
void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
// this method empties out the clipboard
void reset();
// returns true if the clipboard has something pasteable in it.
BOOL hasContents() const;
bool isCutMode() const { return mCutMode; }
protected:
static LLInventoryClipboard sInstance;
LLDynamicArray<LLUUID> mObjects;
bool mCutMode;
public:
// please don't actually call these
LLInventoryClipboard();
~LLInventoryClipboard();
private:
// please don't implement these
LLInventoryClipboard(const LLInventoryClipboard&);
LLInventoryClipboard& operator=(const LLInventoryClipboard&);
};
#endif // LL_LLINVENTORYCLIPBOARD_H

View File

@ -1,31 +0,0 @@
/**
* @file lllistbrowser.cpp
* @brief UI widget showing a search filter, list view, icon action buttons,
* and verb action buttons, as usually embedded in the side tray.
*
* $LicenseInfo:firstyear=2009&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 "lllistbrowser.h"
// TODO

View File

@ -1,30 +0,0 @@
/**
* @file lllistbrowser.h
* @brief UI widget showing a search filter, list view, icon action buttons,
* and verb action buttons, as usually embedded in the side tray.
*
* $LicenseInfo:firstyear=2009&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 LLLISTBROWSER_H
#define LLLISTBROWSER_H
#endif // LLLISTBROWSER_H

View File

@ -684,7 +684,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool cl
void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::string& filename_in )
{
std::string filename(gDirUtilp->add(subdir, filename_in));
std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename);
std::string expanded_filename = gDirUtilp->findSkinnedFilename(LLDir::HTML, filename);
if (expanded_filename.empty())
{

View File

@ -673,7 +673,7 @@ LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p)
mSystemNotificationIcon(NULL),
mIsCaution(false)
{
buildFromFile("panel_notification_list_item.xml");
buildFromFile("panel_notification_list_item.xml", true);
mIsCaution = p.notification_priority >= NOTIFICATION_PRIORITY_HIGH;
if (mIsCaution)
{

View File

@ -1,59 +0,0 @@
/**
* @file llsavedsettingsglue.cpp
* @author James Cook
* @brief LLSavedSettingsGlue 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 "llsavedsettingsglue.h"
#include "lluictrl.h"
#include "llviewercontrol.h"
void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, const std::string& name)
{
gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean());
}
void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, const std::string& name)
{
gSavedSettings.setS32(name, ctrl->getValue().asInteger());
}
void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, const std::string& name)
{
gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal());
}
void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, const std::string& name)
{
gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger());
}
void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, const std::string& name)
{
gSavedSettings.setString(name, ctrl->getValue().asString());
}

View File

@ -1,46 +0,0 @@
/**
* @file llsavedsettingsglue.h
* @author James Cook
* @brief LLSavedSettingsGlue 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_LLSAVEDSETTINGSGLUE_H
#define LL_LLSAVEDSETTINGSGLUE_H
class LLUICtrl;
// Helper to change gSavedSettings from UI widget commit callbacks.
// Set the widget callback to be one of the setFoo() calls below,
// and assign the control name as a const char* to the userdata.
class LLSavedSettingsGlue
{
public:
static void setBOOL(LLUICtrl* ctrl, const std::string& name);
static void setS32(LLUICtrl* ctrl, const std::string& name);
static void setF32(LLUICtrl* ctrl, const std::string& name);
static void setU32(LLUICtrl* ctrl, const std::string& name);
static void setString(LLUICtrl* ctrl, const std::string& name);
};
#endif

View File

@ -122,7 +122,7 @@ LLToast::LLToast(const LLToast::Params& p)
{
mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
buildFromFile("panel_toast.xml");
buildFromFile("panel_toast.xml", true);
setCanDrag(false);

View File

@ -273,9 +273,9 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
LLRect current_rect = getRect();
setXMLFilename("");
buildFromFile("panel_notification.xml");
buildFromFile("panel_notification.xml", true);
if(rect != LLRect::null)
if (rect != LLRect::null)
{
this->setShape(rect);
}

View File

@ -38,7 +38,7 @@ LLToastScriptQuestion::LLToastScriptQuestion(const LLNotificationPtr& notificati
:
LLToastPanel(notification)
{
buildFromFile("panel_script_question_toast.xml");
buildFromFile("panel_script_question_toast.xml", true);
}
bool LLToastScriptQuestion::postBuild()

View File

@ -1,29 +0,0 @@
/**
* @file llvectorperfoptions.h
* @brief SSE/SSE2 vector math performance options.
*
* $LicenseInfo:firstyear=2007&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"
// Deprecated - moved into llviewerjointmesh

View File

@ -1,32 +0,0 @@
/**
* @file llvectorperfoptions.h
* @brief SSE/SSE2 vector math performance options.
*
* $LicenseInfo:firstyear=2007&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_VECTORPERFOPTIONS_H
#define LL_VECTORPERFOPTIONS_H
// Deprecated - moved into llviewerjointmesh
#endif

View File

@ -415,7 +415,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
return NULL ;
}
std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
std::string full_path = gDirUtilp->findSkinnedFilename(LLDir::TEXTURES, filename);
if (full_path.empty())
{
LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;