Update RLVa to 1.4.0-compatible

This commit is contained in:
Siana Gearz
2012-01-25 21:11:33 +01:00
parent d385de9139
commit 7fec659979
31 changed files with 1637 additions and 322 deletions

View File

@@ -1,6 +1,6 @@
/**
*
* Copyright (c) 2009-2010, Kitty Barnett
* Copyright (c) 2009-2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* GNU General Public License, version 2.0, but WITHOUT ANY WARRANTY;
@@ -99,84 +99,81 @@ typedef std::list<RlvCommand> rlv_command_list_t;
// RlvCommandOption (and derived classed)
//
class RlvCommandOption
struct RlvCommandOption
{
protected:
RlvCommandOption() {}
RlvCommandOption() : m_fValid(false) {}
public:
virtual ~RlvCommandOption() {}
public:
virtual bool isAttachmentPoint() const { return false; }
virtual bool isAttachmentPointGroup() const { return false; }
virtual bool isEmpty() const = 0;
virtual bool isSharedFolder() const { return false; }
virtual bool isString() const { return false; }
virtual bool isUUID() const { return false; }
virtual bool isValid() const = 0;
virtual bool isWearableType() const { return false; }
virtual LLViewerJointAttachment* getAttachmentPoint() const { return NULL; }
virtual ERlvAttachGroupType getAttachmentPointGroup() const { return RLV_ATTACHGROUP_INVALID; }
virtual LLViewerInventoryCategory* getSharedFolder() const { return NULL; }
virtual const std::string& getString() const { return LLStringUtil::null; }
virtual const LLUUID& getUUID() const { return LLUUID::null; }
virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_INVALID; }
virtual bool isEmpty() const { return false; }
virtual bool isValid() const { return m_fValid; }
protected:
bool m_fValid;
};
class RlvCommandOptionGeneric : public RlvCommandOption
struct RlvCommandOptionGeneric : public RlvCommandOption
{
public:
explicit RlvCommandOptionGeneric(const std::string& strOption);
RlvCommandOptionGeneric(LLViewerJointAttachment* pAttachPt) : m_fEmpty(false) { m_varOption = pAttachPt; }
RlvCommandOptionGeneric(LLViewerInventoryCategory* pFolder) : m_fEmpty(false) { m_varOption = pFolder; }
RlvCommandOptionGeneric(const LLUUID& idOption) : m_fEmpty(false) { m_varOption = idOption; }
RlvCommandOptionGeneric(LLWearableType::EType wtType) : m_fEmpty(false) { m_varOption = wtType; }
/*virtual*/ ~RlvCommandOptionGeneric() {}
public:
/*virtual*/ bool isAttachmentPoint() const { return (!isEmpty()) && (typeid(LLViewerJointAttachment*) == m_varOption.type()); }
/*virtual*/ bool isAttachmentPointGroup() const { return (!isEmpty()) && (typeid(ERlvAttachGroupType) == m_varOption.type()); }
/*virtual*/ bool isEmpty() const { return m_fEmpty; }
/*virtual*/ bool isSharedFolder() const { return (!isEmpty()) && (typeid(LLViewerInventoryCategory*) == m_varOption.type()); }
/*virtual*/ bool isString() const { return (!isEmpty()) && (typeid(std::string) == m_varOption.type()); }
/*virtual*/ bool isUUID() const { return (!isEmpty()) && (typeid(LLUUID) == m_varOption.type()); }
/*virtual*/ bool isValid() const { return true; } // This doesn't really have any significance for the generic class
/*virtual*/ bool isWearableType() const { return (!isEmpty()) && (typeid(LLWearableType::EType) == m_varOption.type()); }
bool isAttachmentPoint() const { return (!isEmpty()) && (typeid(LLViewerJointAttachment*) == m_varOption.type()); }
bool isAttachmentPointGroup() const { return (!isEmpty()) && (typeid(ERlvAttachGroupType) == m_varOption.type()); }
bool isEmpty() const { return m_fEmpty; }
bool isSharedFolder() const { return (!isEmpty()) && (typeid(LLViewerInventoryCategory*) == m_varOption.type()); }
bool isString() const { return (!isEmpty()) && (typeid(std::string) == m_varOption.type()); }
bool isUUID() const { return (!isEmpty()) && (typeid(LLUUID) == m_varOption.type()); }
bool isWearableType() const { return (!isEmpty()) && (typeid(LLWearableType::EType) == m_varOption.type()); }
/*virtual*/ LLViewerJointAttachment* getAttachmentPoint() const
{ return (isAttachmentPoint()) ? boost::get<LLViewerJointAttachment*>(m_varOption) : RlvCommandOption::getAttachmentPoint(); }
/*virtual*/ ERlvAttachGroupType getAttachmentPointGroup() const
{ return (isAttachmentPointGroup()) ? boost::get<ERlvAttachGroupType>(m_varOption) : RlvCommandOption::getAttachmentPointGroup(); }
/*virtual*/ LLViewerInventoryCategory* getSharedFolder() const
{ return (isSharedFolder()) ? boost::get<LLViewerInventoryCategory*>(m_varOption) : RlvCommandOption::getSharedFolder(); }
/*virtual*/ const std::string& getString() const
{ return (isString()) ? boost::get<std::string>(m_varOption) : RlvCommandOption::getString(); }
/*virtual*/ const LLUUID& getUUID() const
{ return (isUUID()) ? boost::get<LLUUID>(m_varOption) : RlvCommandOption::getUUID(); }
/*virtual*/ LLWearableType::EType getWearableType() const
{ return (isWearableType()) ? boost::get<LLWearableType::EType>(m_varOption) : RlvCommandOption::getWearableType(); }
LLViewerJointAttachment* getAttachmentPoint() const
{ return (isAttachmentPoint()) ? boost::get<LLViewerJointAttachment*>(m_varOption) : NULL; }
ERlvAttachGroupType getAttachmentPointGroup() const
{ return (isAttachmentPointGroup()) ? boost::get<ERlvAttachGroupType>(m_varOption) : RLV_ATTACHGROUP_INVALID; }
LLViewerInventoryCategory* getSharedFolder() const
{ return (isSharedFolder()) ? boost::get<LLViewerInventoryCategory*>(m_varOption) : NULL; }
const std::string& getString() const
{ return (isString()) ? boost::get<std::string>(m_varOption) : LLStringUtil::null; }
const LLUUID& getUUID() const
{ return (isUUID()) ? boost::get<LLUUID>(m_varOption) : LLUUID::null; }
LLWearableType::EType getWearableType() const
{ return (isWearableType()) ? boost::get<LLWearableType::EType>(m_varOption) : LLWearableType::WT_INVALID; }
protected:
bool m_fEmpty;
boost::variant<LLViewerJointAttachment*, ERlvAttachGroupType, LLViewerInventoryCategory*, std::string, LLUUID, LLWearableType::EType> m_varOption;
};
class RlvCommandOptionGetPath : public RlvCommandOption
struct RlvCommandOptionGetPath : public RlvCommandOption
{
public:
RlvCommandOptionGetPath(const RlvCommand& rlvCmd);
/*virtual*/ ~RlvCommandOptionGetPath() {}
/*virtual*/ bool isEmpty() const { return m_idItems.empty(); }
/*virtual*/ bool isValid() const { return m_fValid; }
const uuid_vec_t& getItemIDs() const { return m_idItems; }
static bool getItemIDs(const LLViewerJointAttachment* pAttachPt, uuid_vec_t& idItems, bool fClear = true);
static bool getItemIDs(LLWearableType::EType wtType, uuid_vec_t& idItems, bool fClear = true);
protected:
bool m_fValid;
uuid_vec_t m_idItems;
};
struct RlvCommandOptionAdjustHeight : public RlvCommandOption
{
RlvCommandOptionAdjustHeight(const RlvCommand& rlvCmd);
F32 m_nPelvisToFoot;
F32 m_nPelvisToFootDeltaMult;
F32 m_nPelvisToFootOffset;
};
struct RlvCommandOptionTpTo : public RlvCommandOption
{
RlvCommandOptionTpTo(const RlvCommand& rlvCmd);
LLVector3d m_posGlobal;
};
// ============================================================================
// RlvObject
//
@@ -199,13 +196,16 @@ public:
const rlv_command_list_t* getCommandList() const { return &m_Commands; }
const LLUUID& getObjectID() const { return m_idObj; }
const LLUUID& getRootID() const { return m_idRoot; }
/*
* Member variables
*/
protected:
LLUUID m_UUID; // The object's UUID
S32 m_idxAttachPt; // The object's attachment point (or 0 if it's not an attachment)
LLUUID m_idRoot; // The UUID of the object's root (may or may not be different from m_UUID)
LLUUID m_idObj; // The object's UUID
LLUUID m_idRoot; // The UUID of the object's root (may or may not be different from m_idObj)
bool m_fLookup; // TRUE if the object existed in gObjectList at one point in time
S16 m_nLookupMisses; // Count of unsuccessful lookups in gObjectList by the GC
rlv_command_list_t m_Commands; // List of behaviours held by this object (in the order they were received)
@@ -396,6 +396,27 @@ public:
virtual BOOL tick();
};
class RlvCallbackTimerOnce : public LLEventTimer
{
public:
typedef boost::function<void ()> nullary_func_t;
public:
RlvCallbackTimerOnce(F32 nPeriod, nullary_func_t cb) : LLEventTimer(nPeriod), m_Callback(cb) {}
/*virtual*/ BOOL tick()
{
m_Callback();
return TRUE;
}
protected:
nullary_func_t m_Callback;
};
inline void rlvCallbackTimerOnce(F32 nPeriod, RlvCallbackTimerOnce::nullary_func_t cb)
{
// Timer will automatically delete itself after the callback
new RlvCallbackTimerOnce(nPeriod, cb);
}
// ============================================================================
// Various helper functions
//