Refactor code for rezzing under land group and concentrate it into FSCommon::getGroupForRezzing()

master
Ansariel 2016-10-26 17:42:22 +02:00
parent 6a689ca306
commit b721494405
6 changed files with 34 additions and 72 deletions

View File

@ -37,11 +37,13 @@
#include "lllogchat.h"
#include "llmutelist.h"
#include "llnotificationmanager.h"
#include "llparcel.h"
#include "lltooldraganddrop.h"
#include "lltrans.h"
#include "llviewerinventory.h"
#include "llviewernetwork.h"
#include "llviewerobject.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "rlvactions.h"
#include "rlvhandler.h"
@ -426,3 +428,23 @@ bool FSCommon::isFilterEditorKeyCombo(KEY key, MASK mask)
{
return (mask == MASK_CONTROL && key == 'F' && gSavedSettings.getBOOL("FSSelectLocalSearchEditorOnShortcut"));
}
LLUUID FSCommon::getGroupForRezzing()
{
LLUUID group_id = gAgent.getGroupID();
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel && gSavedSettings.getBOOL("RezUnderLandGroup"))
{
// In both cases, group-owned or not, the group ID is the same;
// No need to query the parcel owner ID as it will be either
// the group ID if the parcel is group-owned or the ID of an
// avatar.
if (parcel->getGroupID().notNull() && gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
}
return group_id;
}

View File

@ -32,6 +32,7 @@
class LLAvatarName;
class LLViewerObject;
class LLViewerParcelMgr;
const F64 AVATAR_UNKNOWN_Z_OFFSET = -1.0; // Const value for avatars at unknown height
const F32 AVATAR_UNKNOWN_RANGE = -1.f;
@ -86,6 +87,8 @@ namespace FSCommon
bool isLegacySkin();
bool isFilterEditorKeyCombo(KEY key, MASK mask);
LLUUID getGroupForRezzing();
};
#endif // FS_COMMON_H

View File

@ -28,6 +28,7 @@
#include "llviewerprecompiledheaders.h"
#include "fsfloaterimport.h"
#include "fscommon.h"
#include "llagent.h"
#include "llappviewer.h"
#include "llbuycurrencyhtml.h"
@ -656,23 +657,9 @@ void FSFloaterImport::createPrim()
gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLUUID group_id = gAgent.getGroupID();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (gSavedSettings.getBOOL("RezUnderLandGroup"))
{
if (gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
else if (gAgent.isInGroup(parcel->getOwnerID()))
{
group_id = parcel->getOwnerID();
}
}
gMessageSystem->addUUIDFast(_PREHASH_GroupID, group_id);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID);
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
gMessageSystem->addUUIDFast(_PREHASH_GroupID, FSCommon::getGroupForRezzing());
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU8Fast(_PREHASH_Material, (U8)prim["material"].asInteger());

View File

@ -107,6 +107,7 @@
// </FS:CR> Aurora Sim
#include "fsareasearch.h"
#include "llglheaders.h"
#include "fscommon.h"
LLViewerObject* getSelectedParentObject(LLViewerObject *object) ;
//
@ -4088,20 +4089,7 @@ void LLSelectMgr::packDuplicateOnRayHead(void *user_data)
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
LLUUID group_id = gAgent.getGroupID();
if (gSavedSettings.getBOOL("RezUnderLandGroup"))
{
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
else if (gAgent.isInGroup(parcel->getOwnerID()))
{
group_id = parcel->getOwnerID();
}
}
msg->addUUIDFast(_PREHASH_GroupID, group_id);
msg->addUUIDFast(_PREHASH_GroupID, FSCommon::getGroupForRezzing());
msg->addVector3Fast(_PREHASH_RayStart, data->mRayStartRegion );
msg->addVector3Fast(_PREHASH_RayEnd, data->mRayEndRegion );
msg->addBOOLFast(_PREHASH_BypassRaycast, data->mBypassRaycast );
@ -4970,19 +4958,7 @@ void LLSelectMgr::packAgentAndSessionAndGroupID(void* user_data)
// static
void LLSelectMgr::packDuplicateHeader(void* data)
{
LLUUID group_id(gAgent.getGroupID());
if (gSavedSettings.getBOOL("RezUnderLandGroup"))
{
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
else if (gAgent.isInGroup(parcel->getOwnerID()))
{
group_id = parcel->getOwnerID();
}
}
LLUUID group_id(FSCommon::getGroupForRezzing());
packAgentAndSessionAndGroupID(&group_id);
LLDuplicateData* dup_data = (LLDuplicateData*) data;

View File

@ -1329,20 +1329,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLUUID group_id = gAgent.getGroupID();
if (gSavedSettings.getBOOL("RezUnderLandGroup"))
{
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
else if (gAgent.isInGroup(parcel->getOwnerID()))
{
group_id = parcel->getOwnerID();
}
}
msg->addUUIDFast(_PREHASH_GroupID, group_id);
msg->addUUIDFast(_PREHASH_GroupID, FSCommon::getGroupForRezzing());
msg->nextBlock("RezData");
// if it's being rezzed from task inventory, we need to enable

View File

@ -305,20 +305,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLUUID group_id = gAgent.getGroupID();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (gSavedSettings.getBOOL("RezUnderLandGroup"))
{
if (gAgent.isInGroup(parcel->getGroupID()))
{
group_id = parcel->getGroupID();
}
else if (gAgent.isInGroup(parcel->getOwnerID()))
{
group_id = parcel->getOwnerID();
}
}
gMessageSystem->addUUIDFast(_PREHASH_GroupID, group_id);
gMessageSystem->addUUIDFast(_PREHASH_GroupID, FSCommon::getGroupForRezzing());
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU8Fast(_PREHASH_Material, material);