DRTVWR-418: Untangle LLWLParamKey, LLWLAnimator circularity.
LLWLAnimator stores a std::map<F32, LLWLParamKey>. But llwlanimator.h only forward-declared LLWLParamKey, begging the question of how this ever compiled on any previous platform. LLWLParamKey was declared for real in llwlparammanager.h, so the obvious fix is to #include "llwlparammanager.h" in llwlanimator.h. Unfortunately this doesn't work because llwlparammanager.h already #includes "llwlanimator.h". As the dependency is specifically on LLWLParamKey, which isa LLEnvKey, which is declared in llenvmanager.h, move LLWLParamKey to llenvmanager.h. Then we can #include "llenvmanager.h" in llwlanimator.h instead of merely forward- declaring LLWLParamKey. This migration compiles LLWLParamKey in a context in which LLTrans isn't visible. It's not really clear why all LLWLParamKey's methods are inline, but toString() -- the method that requires LLTrans -- isn't going to be fast in any case. Break toString() out to llenvmanager.cpp, and #include "lltrans.h" there.meow-7.2.2
parent
c992a6df9f
commit
42b8895c54
|
|
@ -35,6 +35,22 @@
|
|||
#include "llwaterparammanager.h"
|
||||
#include "llwlhandlers.h"
|
||||
#include "llwlparammanager.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
std::string LLWLParamKey::toString() const
|
||||
{
|
||||
switch (scope)
|
||||
{
|
||||
case SCOPE_LOCAL:
|
||||
return name + std::string(" (") + LLTrans::getString("Local") + std::string(")");
|
||||
break;
|
||||
case SCOPE_REGION:
|
||||
return name + std::string(" (") + LLTrans::getString("Region") + std::string(")");
|
||||
break;
|
||||
default:
|
||||
return name + " (?)";
|
||||
}
|
||||
}
|
||||
|
||||
std::string LLEnvPrefs::getWaterPresetName() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,6 +48,87 @@ public:
|
|||
} EScope;
|
||||
};
|
||||
|
||||
struct LLWLParamKey : LLEnvKey
|
||||
{
|
||||
public:
|
||||
// scope and source of a param set (WL sky preset)
|
||||
std::string name;
|
||||
EScope scope;
|
||||
|
||||
// for conversion from LLSD
|
||||
static const int NAME_IDX = 0;
|
||||
static const int SCOPE_IDX = 1;
|
||||
|
||||
inline LLWLParamKey(const std::string& n, EScope s)
|
||||
: name(n), scope(s)
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey(LLSD llsd)
|
||||
: name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
|
||||
: name(""), scope(SCOPE_LOCAL)
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey(std::string& stringVal)
|
||||
{
|
||||
size_t len = stringVal.length();
|
||||
if (len > 0)
|
||||
{
|
||||
name = stringVal.substr(0, len - 1);
|
||||
scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string toStringVal() const
|
||||
{
|
||||
std::stringstream str;
|
||||
str << name << scope;
|
||||
return str.str();
|
||||
}
|
||||
|
||||
inline LLSD toLLSD() const
|
||||
{
|
||||
LLSD llsd = LLSD::emptyArray();
|
||||
llsd.append(LLSD(name));
|
||||
llsd.append(LLSD(scope));
|
||||
return llsd;
|
||||
}
|
||||
|
||||
inline void fromLLSD(const LLSD& llsd)
|
||||
{
|
||||
name = llsd[NAME_IDX].asString();
|
||||
scope = EScope(llsd[SCOPE_IDX].asInteger());
|
||||
}
|
||||
|
||||
inline bool operator <(const LLWLParamKey other) const
|
||||
{
|
||||
if (name < other.name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (name > other.name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return scope < other.scope;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator ==(const LLWLParamKey other) const
|
||||
{
|
||||
return (name == other.name) && (scope == other.scope);
|
||||
}
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
class LLEnvironmentSettings
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
#define LL_WL_ANIMATOR_H
|
||||
|
||||
#include "llwlparamset.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llwaterparamset.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
struct LLWLParamKey;
|
||||
|
||||
class LLWLAnimator {
|
||||
public:
|
||||
typedef enum e_time
|
||||
|
|
|
|||
|
|
@ -116,100 +116,6 @@ struct WLFloatControl {
|
|||
}
|
||||
};
|
||||
|
||||
struct LLWLParamKey : LLEnvKey
|
||||
{
|
||||
public:
|
||||
// scope and source of a param set (WL sky preset)
|
||||
std::string name;
|
||||
EScope scope;
|
||||
|
||||
// for conversion from LLSD
|
||||
static const int NAME_IDX = 0;
|
||||
static const int SCOPE_IDX = 1;
|
||||
|
||||
inline LLWLParamKey(const std::string& n, EScope s)
|
||||
: name(n), scope(s)
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey(LLSD llsd)
|
||||
: name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
|
||||
: name(""), scope(SCOPE_LOCAL)
|
||||
{
|
||||
}
|
||||
|
||||
inline LLWLParamKey(std::string& stringVal)
|
||||
{
|
||||
size_t len = stringVal.length();
|
||||
if (len > 0)
|
||||
{
|
||||
name = stringVal.substr(0, len - 1);
|
||||
scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string toStringVal() const
|
||||
{
|
||||
std::stringstream str;
|
||||
str << name << scope;
|
||||
return str.str();
|
||||
}
|
||||
|
||||
inline LLSD toLLSD() const
|
||||
{
|
||||
LLSD llsd = LLSD::emptyArray();
|
||||
llsd.append(LLSD(name));
|
||||
llsd.append(LLSD(scope));
|
||||
return llsd;
|
||||
}
|
||||
|
||||
inline void fromLLSD(const LLSD& llsd)
|
||||
{
|
||||
name = llsd[NAME_IDX].asString();
|
||||
scope = EScope(llsd[SCOPE_IDX].asInteger());
|
||||
}
|
||||
|
||||
inline bool operator <(const LLWLParamKey other) const
|
||||
{
|
||||
if (name < other.name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (name > other.name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return scope < other.scope;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator ==(const LLWLParamKey other) const
|
||||
{
|
||||
return (name == other.name) && (scope == other.scope);
|
||||
}
|
||||
|
||||
inline std::string toString() const
|
||||
{
|
||||
switch (scope)
|
||||
{
|
||||
case SCOPE_LOCAL:
|
||||
return name + std::string(" (") + LLTrans::getString("Local") + std::string(")");
|
||||
break;
|
||||
case SCOPE_REGION:
|
||||
return name + std::string(" (") + LLTrans::getString("Region") + std::string(")");
|
||||
break;
|
||||
default:
|
||||
return name + " (?)";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// WindLight parameter manager class - what controls all the wind light shaders
|
||||
class LLWLParamManager : public LLSingleton<LLWLParamManager>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue