Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 1 addition & 69 deletions indra/llui/llview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,32 +253,6 @@ const std::string& LLView::getName() const
return mName.empty() ? no_name : mName;
}

void LLView::setName(const std::string& name)
{
if (name == mName)
{
return;
}

LLView* parent = mParentView;

if (parent && !mName.empty())
{
auto it = parent->mChildNameCache.find(mName);
if (it != parent->mChildNameCache.end() && it->second == this)
{
parent->mChildNameCache.erase(it);
}
}

mName = name;

if (parent && !mName.empty())
{
parent->mChildNameCache[mName] = this;
}
}

void LLView::sendChildToFront(LLView* child)
{
// llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
Expand Down Expand Up @@ -331,12 +305,6 @@ bool LLView::addChild(LLView* child, S32 tab_group)
// add to front of child list, as normal
mChildList.push_front(child);

// Add to name cache for fast lookup
if (child->hasName())
{
mChildNameCache[child->getName()] = child;
}

// add to tab order list
if (tab_group != 0)
{
Expand Down Expand Up @@ -376,17 +344,6 @@ void LLView::removeChild(LLView* child)
// if we are removing an item we are currently iterating over, that would be bad
llassert(!child->mInDraw);
mChildList.remove( child );

// Remove from name cache - verify pointer to handle duplicate names
if (child->hasName())
{
auto it = mChildNameCache.find(child->getName());
if (it != mChildNameCache.end() && it->second == child)
{
mChildNameCache.erase(it);
}
}

child->mParentView = NULL;
child_tab_order_t::iterator found = mTabOrder.find(child);
if (found != mTabOrder.end())
Expand Down Expand Up @@ -1692,40 +1649,15 @@ LLView* LLView::findChildView(std::string_view name, bool recurse) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;

// Check cache first for direct children - O(1) lookup instead of O(n)
if (!mChildNameCache.empty())
{
std::string lookup_key(name);
auto cache_it = mChildNameCache.find(lookup_key);
if (cache_it != mChildNameCache.end())
{
return cache_it->second;
}
}

// Look for direct children *first*
for (LLView* childp : mChildList)
{
llassert(childp);
const std::string& child_name = childp->getName();

if (child_name.empty())
if (childp->getName() == name)
{
if (name.empty())
{
return childp;
}
continue;
}

if (child_name == name)
{
// Cache the result for next lookup
mChildNameCache[child_name] = childp;
return childp;
}
}

if (recurse)
{
// Look inside each child as well.
Expand Down
7 changes: 1 addition & 6 deletions indra/llui/llview.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

#include <functional>
#include <list>
#include <unordered_map>

class LLSD;

Expand Down Expand Up @@ -237,8 +236,7 @@ class LLView
void setFollowsAll() { mReshapeFlags |= FOLLOWS_ALL; }

void setSoundFlags(U8 flags) { mSoundFlags = flags; }
void setName(const std::string& name);
bool hasName() const { return !mName.empty(); }
void setName(std::string name) { mName = name; }
void setUseBoundingRect( bool use_bounding_rect );
bool getUseBoundingRect() const;

Expand Down Expand Up @@ -590,9 +588,6 @@ class LLView
LLView* mParentView;
child_list_t mChildList;

// Cache for fast child lookup by name - O(1) instead of O(n)
mutable std::unordered_map<std::string, LLView*> mChildNameCache;

// location in pixels, relative to surrounding structure, bottom,left=0,0
bool mVisible;
LLRect mRect;
Expand Down
45 changes: 45 additions & 0 deletions indra/llxml/llcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "llstring.h"
#include "v3math.h"
#include "v3dmath.h"
#include "v4math.h"
#include "v4coloru.h"
#include "v4color.h"
#include "v3color.h"
Expand All @@ -63,6 +64,7 @@ template <> eControlType get_control_type<std::string>();

template <> eControlType get_control_type<LLVector3>();
template <> eControlType get_control_type<LLVector3d>();
template <> eControlType get_control_type<LLVector4>();
template <> eControlType get_control_type<LLRect>();
template <> eControlType get_control_type<LLColor4>();
template <> eControlType get_control_type<LLColor3>();
Expand All @@ -72,6 +74,7 @@ template <> eControlType get_control_type<LLSD>();
template <> LLSD convert_to_llsd<U32>(const U32& in);
template <> LLSD convert_to_llsd<LLVector3>(const LLVector3& in);
template <> LLSD convert_to_llsd<LLVector3d>(const LLVector3d& in);
template <> LLSD convert_to_llsd<LLVector4>(const LLVector4& in);
template <> LLSD convert_to_llsd<LLRect>(const LLRect& in);
template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in);
template <> LLSD convert_to_llsd<LLColor3>(const LLColor3& in);
Expand All @@ -85,6 +88,7 @@ template <> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlT
template <> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name);
template <> LLColor4U convert_from_llsd<LLColor4U>(const LLSD& sd, eControlType type, std::string_view control_name);
Expand Down Expand Up @@ -124,6 +128,9 @@ bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
case TYPE_VEC3D:
result = LLVector3d(a) == LLVector3d(b);
break;
case TYPE_VEC4:
result = LLVector4(a) == LLVector4(b);
break;
case TYPE_QUAT:
result = LLQuaternion(a) == LLQuaternion(b);
break;
Expand Down Expand Up @@ -373,6 +380,7 @@ const std::string LLControlGroup::mTypeString[TYPE_COUNT] = { "U32"
,"Rect"
,"Color4"
,"Color3"
,"Vector4"
,"LLSD"
};

Expand Down Expand Up @@ -532,6 +540,11 @@ LLControlVariable* LLControlGroup::declareVec3d(const std::string& name, const L
return declareControl(name, TYPE_VEC3D, initial_val.getValue(), comment, persist);
}

LLControlVariable* LLControlGroup::declareVec4(const std::string& name, const LLVector4 &initial_val, const std::string& comment, LLControlVariable::ePersist persist)
{
return declareControl(name, TYPE_VEC4, initial_val.getValue(), comment, persist);
}

LLControlVariable* LLControlGroup::declareQuat(const std::string& name, const LLQuaternion &initial_val, const std::string& comment, LLControlVariable::ePersist persist)
{
return declareControl(name, TYPE_QUAT, initial_val.getValue(), comment, persist);
Expand Down Expand Up @@ -614,6 +627,11 @@ LLVector3d LLControlGroup::getVector3d(std::string_view name)
return get<LLVector3d>(name);
}

LLVector4 LLControlGroup::getVector4(std::string_view name)
{
return get<LLVector4>(name);
}

LLQuaternion LLControlGroup::getQuaternion(std::string_view name)
{
return get<LLQuaternion>(name);
Expand Down Expand Up @@ -714,6 +732,11 @@ void LLControlGroup::setVector3d(std::string_view name, const LLVector3d &val)
set(name, val);
}

void LLControlGroup::setVector4(std::string_view name, const LLVector4 &val)
{
set(name, val);
}

void LLControlGroup::setQuaternion(std::string_view name, const LLQuaternion &val)
{
set(name, val);
Expand Down Expand Up @@ -1262,6 +1285,11 @@ template <> eControlType get_control_type<LLVector3d>()
return TYPE_VEC3D;
}

template <> eControlType get_control_type<LLVector4>()
{
return TYPE_VEC4;
}

template <> eControlType get_control_type<LLQuaternion>()
{
return TYPE_QUAT;
Expand Down Expand Up @@ -1302,6 +1330,11 @@ template <> LLSD convert_to_llsd<LLVector3d>(const LLVector3d& in)
{
return in.getValue();
}
template <> LLSD convert_to_llsd<LLVector4>(const LLVector4& in)
{
return in.getValue();
}

template <> LLSD convert_to_llsd<LLQuaternion>(const LLQuaternion& in)
{
return in.getValue();
Expand Down Expand Up @@ -1418,6 +1451,18 @@ LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std:
}
}

template<>
LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name)
{
if (type == TYPE_VEC4)
return LLVector4(sd);
else
{
CONTROL_ERRS << "Invalid LLVector4 value for " << control_name << ": " << LLControlGroup::typeEnumToString(type) << " " << sd << LL_ENDL;
return LLVector4();
}
}

template<>
LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name)
{
Expand Down
8 changes: 8 additions & 0 deletions indra/llxml/llcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

class LLVector3;
class LLVector3d;
class LLVector4;
class LLQuaternion;
class LLColor4;
class LLColor3;
Expand All @@ -61,6 +62,7 @@ typedef enum e_control_type
TYPE_RECT,
TYPE_COL4,
TYPE_COL3,
TYPE_VEC4,
TYPE_LLSD,
TYPE_COUNT
} eControlType;
Expand Down Expand Up @@ -196,6 +198,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
LLControlVariable* declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareVec4(const std::string& name, const LLVector4 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareQuat(const std::string& name, const LLQuaternion &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
LLControlVariable* declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT);
Expand All @@ -212,6 +215,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
LLWString getWString(std::string_view name);
LLVector3 getVector3(std::string_view name);
LLVector3d getVector3d(std::string_view name);
LLVector4 getVector4(std::string_view name);
LLRect getRect(std::string_view name);
LLSD getLLSD(std::string_view name);
LLQuaternion getQuaternion(std::string_view name);
Expand Down Expand Up @@ -250,6 +254,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
void setString(std::string_view name, const std::string& val);
void setVector3(std::string_view name, const LLVector3 &val);
void setVector3d(std::string_view name, const LLVector3d &val);
void setVector4(std::string_view name, const LLVector4 &val);
void setQuaternion(std::string_view name, const LLQuaternion &val);
void setRect(std::string_view name, const LLRect &val);
void setColor4(std::string_view name, const LLColor4 &val);
Expand Down Expand Up @@ -416,6 +421,7 @@ template <> eControlType get_control_type<bool>();
template <> eControlType get_control_type<std::string>();
template <> eControlType get_control_type<LLVector3>();
template <> eControlType get_control_type<LLVector3d>();
template <> eControlType get_control_type<LLVector4>();
template <> eControlType get_control_type<LLQuaternion>();
template <> eControlType get_control_type<LLRect>();
template <> eControlType get_control_type<LLColor4>();
Expand All @@ -425,6 +431,7 @@ template <> eControlType get_control_type<LLSD>();
template <> LLSD convert_to_llsd<U32>(const U32& in);
template <> LLSD convert_to_llsd<LLVector3>(const LLVector3& in);
template <> LLSD convert_to_llsd<LLVector3d>(const LLVector3d& in);
template <> LLSD convert_to_llsd<LLVector4>(const LLVector4& in);
template <> LLSD convert_to_llsd<LLQuaternion>(const LLQuaternion& in);
template <> LLSD convert_to_llsd<LLRect>(const LLRect& in);
template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in);
Expand All @@ -434,6 +441,7 @@ template<> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlTy
template<> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name);
template<> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name);
Expand Down
16 changes: 16 additions & 0 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11871,6 +11871,22 @@
<key>Value</key>
<real>20.0</real>
</map>
<key>TextureChannelPriority</key>
<map>
<key>Comment</key>
<string>Per-channel texture streaming aggressiveness. X=normals, Y=diffuse, Z=specular/metallic, W=emissive. 1.0=baseline, higher=more aggressive downrez.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Vector4</string>
<key>Value</key>
<array>
<real>5</real>
<real>7.5</real>
<real>20</real>
<real>7.5</real>
</array>
</map>
<key>TextureCameraBoost</key>
<map>
<key>Comment</key>
Expand Down
Loading
Loading