Fixed and optimized sending keys to the sim on avatar enter, and started
working on region exporter.
This commit is contained in:
@@ -174,20 +174,6 @@ bool LLAvatarListEntry::getAlive()
|
||||
{
|
||||
mInSimFrame = U32_MAX;
|
||||
chat_avatar_status(mName, mID, ALERT_TYPE_SIM, false);
|
||||
if(gSavedSettings.getBOOL("RadarChatKeys"))
|
||||
{
|
||||
gMessageSystem->newMessage("ScriptDialogReply");
|
||||
gMessageSystem->nextBlock("AgentData");
|
||||
gMessageSystem->addUUID("AgentID", gAgent.getID());
|
||||
gMessageSystem->addUUID("SessionID", gAgent.getSessionID());
|
||||
gMessageSystem->nextBlock("Data");
|
||||
gMessageSystem->addUUID("ObjectID", gAgent.getID());
|
||||
gMessageSystem->addS32("ChatChannel", -777777777);
|
||||
gMessageSystem->addS32("ButtonIndex", 1);
|
||||
gMessageSystem->addString("ButtonLabel",llformat("%d,%d,", gFrameCount, 0) + mID.asString());
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
}
|
||||
if (mInDrawFrame != U32_MAX && (current - mInDrawFrame) >= 2)
|
||||
{
|
||||
@@ -405,6 +391,9 @@ void LLFloaterAvatarList::updateAvatarList()
|
||||
|
||||
size_t i;
|
||||
size_t count = avatar_ids.size();
|
||||
|
||||
bool announce = gSavedSettings.getBOOL("RadarChatKeys");
|
||||
std::queue<LLUUID> announce_keys;
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
@@ -475,6 +464,8 @@ void LLFloaterAvatarList::updateAvatarList()
|
||||
{
|
||||
// Avatar not there yet, add it
|
||||
LLAvatarListEntry entry(avid, name, position);
|
||||
if(announce && avatarp->getRegion() == gAgent.getRegion())
|
||||
announce_keys.push(avid);
|
||||
mAvatars[avid] = entry;
|
||||
}
|
||||
}
|
||||
@@ -514,10 +505,58 @@ void LLFloaterAvatarList::updateAvatarList()
|
||||
else
|
||||
{
|
||||
LLAvatarListEntry entry(avid, name, position);
|
||||
if(announce && gAgent.getRegion()->pointInRegionGlobal(position))
|
||||
announce_keys.push(avid);
|
||||
mAvatars[avid] = entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
//let us send the keys in a more timely fashion
|
||||
if(announce && !announce_keys.empty())
|
||||
{
|
||||
std::ostringstream ids;
|
||||
int transact_num = (int)gFrameCount;
|
||||
int num_ids = 0;
|
||||
while(!announce_keys.empty())
|
||||
{
|
||||
LLUUID id = announce_keys.front();
|
||||
announce_keys.pop();
|
||||
|
||||
ids << "," << id.asString();
|
||||
++num_ids;
|
||||
|
||||
if(ids.tellp() > 200)
|
||||
{
|
||||
gMessageSystem->newMessage("ScriptDialogReply");
|
||||
gMessageSystem->nextBlock("AgentData");
|
||||
gMessageSystem->addUUID("AgentID", gAgent.getID());
|
||||
gMessageSystem->addUUID("SessionID", gAgent.getSessionID());
|
||||
gMessageSystem->nextBlock("Data");
|
||||
gMessageSystem->addUUID("ObjectID", gAgent.getID());
|
||||
gMessageSystem->addS32("ChatChannel", -777777777);
|
||||
gMessageSystem->addS32("ButtonIndex", 1);
|
||||
gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str());
|
||||
gAgent.sendReliableMessage();
|
||||
|
||||
num_ids = 0;
|
||||
ids.seekp(0);
|
||||
ids.str("");
|
||||
}
|
||||
}
|
||||
if(num_ids > 0)
|
||||
{
|
||||
gMessageSystem->newMessage("ScriptDialogReply");
|
||||
gMessageSystem->nextBlock("AgentData");
|
||||
gMessageSystem->addUUID("AgentID", gAgent.getID());
|
||||
gMessageSystem->addUUID("SessionID", gAgent.getSessionID());
|
||||
gMessageSystem->nextBlock("Data");
|
||||
gMessageSystem->addUUID("ObjectID", gAgent.getID());
|
||||
gMessageSystem->addS32("ChatChannel", -777777777);
|
||||
gMessageSystem->addS32("ButtonIndex", 1);
|
||||
gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str());
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// llinfos << "radar refresh: done" << llendl;
|
||||
|
||||
@@ -23,10 +23,6 @@ LLFloaterExportRegion::LLFloaterExportRegion(const LLSD& unused)
|
||||
{
|
||||
sInstance = this;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_export.xml");
|
||||
|
||||
//populate the list of objects to export
|
||||
//int numOfObjects = gObjectList.getNumObjects();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +33,177 @@ LLFloaterExportRegion::~LLFloaterExportRegion()
|
||||
|
||||
BOOL LLFloaterExportRegion::postBuild(void)
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
|
||||
|
||||
LLViewerRegion* objregion = NULL;
|
||||
LLViewerRegion* agentregion = gAgent.getRegion();
|
||||
|
||||
if(!agentregion) return TRUE;
|
||||
|
||||
for (LLDynamicArrayPtr<LLPointer<LLViewerObject> >::iterator iter = gObjectList.getObjectMap().begin();
|
||||
iter != gObjectList.getObjectMap().end(); iter++)
|
||||
{
|
||||
LLViewerObject* objectp = (*iter);
|
||||
if(!objectp || objectp->isDead()) continue;
|
||||
|
||||
objregion = objectp->getRegion();
|
||||
|
||||
//if(!objregion || objregion->getHandle() != agentregion->getHandle()) continue;
|
||||
|
||||
if(objectp->isAvatar() || objectp->isAttachment()) continue; //we dont want avatars right now...
|
||||
|
||||
if(objectp->isRoot())
|
||||
{
|
||||
std::string objectp_id = llformat("%d", objectp->getLocalID());
|
||||
|
||||
if(list->getItemIndex(objectp->getID()) == -1)
|
||||
{
|
||||
bool is_attachment = false;
|
||||
bool is_root = true;
|
||||
LLViewerObject* parentp = objectp->getSubParent();
|
||||
if(parentp)
|
||||
{
|
||||
if(!parentp->isAvatar())
|
||||
{
|
||||
// parent is a prim I guess
|
||||
is_root = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// parent is an avatar
|
||||
is_attachment = true;
|
||||
//if(!avatars[parentp]) avatars[parentp] = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_prim = true;
|
||||
if(objectp->getPCode() >= LL_PCODE_APP)
|
||||
{
|
||||
is_prim = false;
|
||||
}
|
||||
|
||||
//bool is_avatar = objectp->isAvatar();
|
||||
|
||||
|
||||
if(is_root && is_prim)
|
||||
{
|
||||
LLSD element;
|
||||
element["id"] = objectp->getID();
|
||||
|
||||
LLSD& check_column = element["columns"][LIST_CHECKED];
|
||||
check_column["column"] = "checked";
|
||||
check_column["type"] = "checkbox";
|
||||
check_column["value"] = true;
|
||||
|
||||
LLSD& type_column = element["columns"][LIST_TYPE];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
type_column["value"] = "inv_item_object.tga";
|
||||
|
||||
LLSD& name_column = element["columns"][LIST_NAME];
|
||||
name_column["column"] = "name";
|
||||
/*if(is_attachment)
|
||||
name_column["value"] = nodep->mName + " (worn on " + utf8str_tolower(objectp->getAttachmentPointName()) + ")";
|
||||
else*/
|
||||
name_column["value"] = "Object";
|
||||
|
||||
LLSD& avatarid_column = element["columns"][LIST_AVATARID];
|
||||
avatarid_column["column"] = "avatarid";
|
||||
if(is_attachment)
|
||||
avatarid_column["value"] = parentp->getID();
|
||||
else
|
||||
avatarid_column["value"] = LLUUID::null;
|
||||
|
||||
LLExportable* exportable = new LLExportable(objectp, "Object", mPrimNameMap);
|
||||
mExportables[objectp->getID()] = exportable->asLLSD();
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
|
||||
addToPrimList(objectp);
|
||||
}//Do we really want avatars in the region exporter?
|
||||
/*
|
||||
else if(is_avatar)
|
||||
{
|
||||
if(!avatars[objectp])
|
||||
{
|
||||
avatars[objectp] = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
U32 localid = objectp->getLocalID();
|
||||
std::string name = "Object";
|
||||
mPrimNameMap[localid] = name;
|
||||
//Let's get names...
|
||||
LLViewerObject::child_list_t child_list = objectp->getChildren();
|
||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||
{
|
||||
LLViewerObject* childp = *i;
|
||||
|
||||
LLViewerObject::child_list_t select_list = childp->getChildren();
|
||||
LLViewerObject::child_list_t::iterator select_iter;
|
||||
int block_counter;
|
||||
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, childp->getLocalID());
|
||||
block_counter = 0;
|
||||
for (select_iter = select_list.begin(); select_iter != select_list.end(); ++select_iter)
|
||||
{
|
||||
block_counter++;
|
||||
if(block_counter >= 254)
|
||||
{
|
||||
// start a new message
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
}
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*select_iter)->getLocalID());
|
||||
}
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, childp->getLocalID());
|
||||
block_counter = 0;
|
||||
for (select_iter = select_list.begin(); select_iter != select_list.end(); ++select_iter)
|
||||
{
|
||||
block_counter++;
|
||||
if(block_counter >= 254)
|
||||
{
|
||||
// start a new message
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
}
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*select_iter)->getLocalID());
|
||||
}
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
}
|
||||
}
|
||||
//Do we really want avatars in the region exporter?
|
||||
/*std::map<LLViewerObject*, bool>::iterator avatar_iter = avatars.begin();
|
||||
std::map<LLViewerObject*, bool>::iterator avatars_end = avatars.end();
|
||||
for( ; avatar_iter != avatars_end; avatar_iter++)
|
||||
{
|
||||
LLViewerObject* avatar = (*avatar_iter).first;
|
||||
addAvatarStuff((LLVOAvatar*)avatar);
|
||||
}*/
|
||||
|
||||
updateNamesProgress();
|
||||
|
||||
childSetAction("select_all_btn", onClickSelectAll, this);
|
||||
|
||||
@@ -117,6 +117,8 @@ public:
|
||||
|
||||
inline S32 getNumObjects() { return mObjects.count(); }
|
||||
|
||||
LLDynamicArrayPtr<LLPointer<LLViewerObject> > getObjectMap(){ return mMapObjects; }
|
||||
|
||||
void addToMap(LLViewerObject *objectp);
|
||||
void removeFromMap(LLViewerObject *objectp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user