Merge remote-tracking branch 'lirusaito/master'
This commit is contained in:
@@ -221,7 +221,6 @@
|
|||||||
#include "wlfPanel_AdvSettings.h" //Lower right Windlight and Rendering options
|
#include "wlfPanel_AdvSettings.h" //Lower right Windlight and Rendering options
|
||||||
#include "lldaycyclemanager.h"
|
#include "lldaycyclemanager.h"
|
||||||
#include "llfloaterblacklist.h"
|
#include "llfloaterblacklist.h"
|
||||||
#include "scriptcounter.h"
|
|
||||||
#include "shfloatermediaticker.h"
|
#include "shfloatermediaticker.h"
|
||||||
#include "llpacketring.h"
|
#include "llpacketring.h"
|
||||||
// </edit>
|
// </edit>
|
||||||
@@ -3225,7 +3224,6 @@ void pass_processObjectPropertiesFamily(LLMessageSystem *msg, void**)
|
|||||||
// Send the result to the corresponding requesters.
|
// Send the result to the corresponding requesters.
|
||||||
LLSelectMgr::processObjectPropertiesFamily(msg, NULL);
|
LLSelectMgr::processObjectPropertiesFamily(msg, NULL);
|
||||||
JCFloaterAreaSearch::processObjectPropertiesFamily(msg, NULL);
|
JCFloaterAreaSearch::processObjectPropertiesFamily(msg, NULL);
|
||||||
ScriptCounter::processObjectPropertiesFamily(msg,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_viewer_callbacks(LLMessageSystem* msg)
|
void register_viewer_callbacks(LLMessageSystem* msg)
|
||||||
|
|||||||
@@ -505,9 +505,9 @@ void LLStatusBar::refresh()
|
|||||||
if (region)
|
if (region)
|
||||||
{
|
{
|
||||||
bool pf_disabled = !region->dynamicPathfindingEnabled();
|
bool pf_disabled = !region->dynamicPathfindingEnabled();
|
||||||
getChild<LLUICtrl>("pf_dirty")->setVisible(mIsNavMeshDirty);
|
getChild<LLUICtrl>("pf_dirty")->setVisible(!pf_disabled && mIsNavMeshDirty);
|
||||||
getChild<LLUICtrl>("pf_disabled")->setVisible(pf_disabled);
|
getChild<LLUICtrl>("pf_disabled")->setVisible(pf_disabled);
|
||||||
const std::string pf_icon = mIsNavMeshDirty ? "pf_dirty" : pf_disabled ? "pf_disabled" : "";
|
const std::string pf_icon = pf_disabled ? "pf_disabled" : mIsNavMeshDirty ? "pf_dirty" : "";
|
||||||
if (!pf_icon.empty())
|
if (!pf_icon.empty())
|
||||||
{
|
{
|
||||||
x += 6;
|
x += 6;
|
||||||
|
|||||||
@@ -3009,7 +3009,12 @@ class LLScriptCount : public view_listener_t
|
|||||||
{
|
{
|
||||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
{
|
{
|
||||||
ScriptCounter::serializeSelection(false);
|
if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
|
||||||
|
{
|
||||||
|
ScriptCounter* sc = new ScriptCounter(false, object);
|
||||||
|
sc->requestInventories();
|
||||||
|
// sc will destroy itself
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3018,7 +3023,12 @@ class LLScriptDelete : public view_listener_t
|
|||||||
{
|
{
|
||||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
{
|
{
|
||||||
ScriptCounter::serializeSelection(true);
|
if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
|
||||||
|
{
|
||||||
|
ScriptCounter* sc = new ScriptCounter(true, object);
|
||||||
|
sc->requestInventories();
|
||||||
|
// sc will destroy itself
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -9552,6 +9562,7 @@ void initialize_menus()
|
|||||||
addMenu(new LLObjectMeasure(), "Object.Measure");
|
addMenu(new LLObjectMeasure(), "Object.Measure");
|
||||||
addMenu(new LLObjectData(), "Object.Data");
|
addMenu(new LLObjectData(), "Object.Data");
|
||||||
addMenu(new LLScriptCount(), "Object.ScriptCount");
|
addMenu(new LLScriptCount(), "Object.ScriptCount");
|
||||||
|
addMenu(new LLObjectVisibleScriptCount(), "Object.VisibleScriptCount");
|
||||||
addMenu(new LLKillEmAll(), "Object.Destroy");
|
addMenu(new LLKillEmAll(), "Object.Destroy");
|
||||||
addMenu(new LLPowerfulWizard(), "Object.Explode");
|
addMenu(new LLPowerfulWizard(), "Object.Explode");
|
||||||
addMenu(new LLCanIHasKillEmAll(), "Object.EnableDestroy");
|
addMenu(new LLCanIHasKillEmAll(), "Object.EnableDestroy");
|
||||||
|
|||||||
@@ -31,378 +31,135 @@
|
|||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
#include "llchat.h"
|
|
||||||
#include "llfloaterchat.h"
|
|
||||||
#include "scriptcounter.h"
|
#include "scriptcounter.h"
|
||||||
|
|
||||||
|
#include "llavatarnamecache.h"
|
||||||
#include "llselectmgr.h"
|
#include "llselectmgr.h"
|
||||||
#include "llviewerobjectlist.h"
|
#include "lltrans.h"
|
||||||
#include "llvoavatar.h"
|
#include "llvoavatar.h"
|
||||||
#include "llviewerregion.h"
|
#include "stringize.h"
|
||||||
#include "llwindow.h"
|
|
||||||
#include "lltransfersourceasset.h"
|
|
||||||
#include "llviewercontrol.h"
|
|
||||||
#include "llviewernetwork.h"
|
|
||||||
#include "llviewerobject.h"
|
|
||||||
#include "llpacketring.h"
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
ScriptCounter* ScriptCounter::sInstance;
|
|
||||||
U32 ScriptCounter::invqueries;
|
|
||||||
U32 ScriptCounter::status;
|
|
||||||
U32 ScriptCounter::scriptcount;
|
|
||||||
LLUUID ScriptCounter::reqObjectID;
|
|
||||||
LLDynamicArray<LLUUID> ScriptCounter::delUUIDS;
|
|
||||||
bool ScriptCounter::doDelete;
|
|
||||||
std::set<std::string> ScriptCounter::objIDS;
|
|
||||||
int ScriptCounter::objectCount;
|
|
||||||
LLViewerObject* ScriptCounter::foo;
|
|
||||||
void cmdline_printchat(std::string chat);
|
void cmdline_printchat(std::string chat);
|
||||||
std::stringstream ScriptCounter::sstr;
|
|
||||||
int ScriptCounter::countingDone;
|
|
||||||
|
|
||||||
ScriptCounter::ScriptCounter()
|
|
||||||
{
|
|
||||||
llassert_always(sInstance == NULL);
|
|
||||||
sInstance = this;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ScriptCounter::~ScriptCounter()
|
|
||||||
{
|
|
||||||
sInstance = NULL;
|
|
||||||
}
|
|
||||||
void ScriptCounter::init()
|
|
||||||
{
|
|
||||||
if(!sInstance)
|
|
||||||
sInstance = new ScriptCounter();
|
|
||||||
status = IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLVOAvatar* find_avatar_from_object( LLViewerObject* object );
|
LLVOAvatar* find_avatar_from_object( LLViewerObject* object );
|
||||||
|
|
||||||
LLVOAvatar* find_avatar_from_object( const LLUUID& object_id );
|
namespace
|
||||||
|
|
||||||
void ScriptCounter::showResult(std::string output)
|
|
||||||
{
|
{
|
||||||
LLChat chat;
|
void countedScriptsOnAvatar(LLStringUtil::format_map_t args, const LLAvatarName& av_name)
|
||||||
chat.mSourceType = CHAT_SOURCE_SYSTEM;
|
|
||||||
chat.mText = output;
|
|
||||||
LLFloaterChat::addChat(chat);
|
|
||||||
//sstr << scriptcount;
|
|
||||||
//cmdline_printchat(sstr.str());
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptCounter::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data)
|
|
||||||
{
|
|
||||||
LLUUID object_id;
|
|
||||||
msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID,object_id );
|
|
||||||
std::string name;
|
|
||||||
std::string user_msg;
|
|
||||||
msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name);
|
|
||||||
if(reqObjectID.notNull())
|
|
||||||
if(object_id == reqObjectID)
|
|
||||||
{
|
{
|
||||||
if(doDelete)
|
std::string name;
|
||||||
{
|
LLAvatarNameCache::getPNSName(av_name, name);
|
||||||
user_msg = llformat("Deleted %u scripts from object %s.", scriptcount, name.c_str());
|
args["NAME"] = name;
|
||||||
}
|
cmdline_printchat(LLTrans::getString("ScriptCountAvatar", args));
|
||||||
else
|
|
||||||
{
|
|
||||||
user_msg = llformat("Counted %u scripts in object %s.", scriptcount, name.c_str());
|
|
||||||
}
|
|
||||||
reqObjectID.setNull();
|
|
||||||
if(countingDone)
|
|
||||||
{
|
|
||||||
showResult(user_msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCounter::processObjectProperties(LLMessageSystem* msg, void** user_data)
|
ScriptCounter::ScriptCounter(bool do_delete, LLViewerObject* object)
|
||||||
|
: doDelete(do_delete)
|
||||||
|
, foo(object)
|
||||||
|
, inventories()
|
||||||
|
, objectCount()
|
||||||
|
, requesting(true)
|
||||||
|
, scriptcount()
|
||||||
{
|
{
|
||||||
std::string user_msg;
|
llassert(foo); // Object to ScriptCount must not be null
|
||||||
LLUUID object_id;
|
|
||||||
msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID,object_id );
|
|
||||||
std::string name;
|
|
||||||
msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name);
|
|
||||||
if(reqObjectID.notNull())
|
|
||||||
if(object_id == reqObjectID)
|
|
||||||
{
|
|
||||||
if(doDelete)
|
|
||||||
{
|
|
||||||
user_msg = llformat("Deleted %u scripts from object %s.", scriptcount, name.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user_msg = llformat("Counted %u scripts in object %s.", scriptcount, name.c_str());
|
|
||||||
}
|
|
||||||
reqObjectID.setNull();
|
|
||||||
if(countingDone)
|
|
||||||
{
|
|
||||||
showResult(user_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCounter::serializeSelection(bool delScript)
|
ScriptCounter::~ScriptCounter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// Request the inventory for all parts
|
||||||
|
void ScriptCounter::requestInventories()
|
||||||
{
|
{
|
||||||
LLDynamicArray<LLViewerObject*> objectArray;
|
if (foo->isAvatar()) // If it's an avatar, iterate through all the attachments
|
||||||
foo=LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
|
||||||
sstr.str("");
|
|
||||||
doDelete=false;
|
|
||||||
scriptcount=0;
|
|
||||||
objIDS.clear();
|
|
||||||
delUUIDS.clear();
|
|
||||||
objectCount=0;
|
|
||||||
countingDone=false;
|
|
||||||
reqObjectID.setNull();
|
|
||||||
if(foo)
|
|
||||||
{
|
{
|
||||||
if(foo->isAvatar())
|
doDelete = false; // We don't support deleting all scripts in all attachments, such a feature could be dangerous.
|
||||||
|
LLVOAvatar* av = static_cast<LLVOAvatar*>(foo);
|
||||||
|
|
||||||
|
// Iterate through all the attachment points
|
||||||
|
for (LLVOAvatar::attachment_map_t::iterator i = av->mAttachmentPoints.begin(); i != av->mAttachmentPoints.end(); ++i)
|
||||||
{
|
{
|
||||||
LLVOAvatar* av=find_avatar_from_object(foo);
|
if (LLViewerJointAttachment* attachment = i->second)
|
||||||
if(av)
|
|
||||||
{
|
{
|
||||||
for (LLVOAvatar::attachment_map_t::iterator iter = av->mAttachmentPoints.begin();
|
if (!attachment->getValid()) continue;
|
||||||
iter != av->mAttachmentPoints.end();
|
|
||||||
++iter)
|
// Iterate through all the attachments on this point
|
||||||
{
|
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator j = attachment->mAttachedObjects.begin(); j != attachment->mAttachedObjects.end(); ++j)
|
||||||
LLViewerJointAttachment* attachment = iter->second;
|
if (LLViewerObject* object = *j)
|
||||||
if (!attachment->getValid())
|
requestInventoriesFor(object);
|
||||||
continue ;
|
|
||||||
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itObj = attachment->mAttachedObjects.begin();
|
|
||||||
itObj != attachment->mAttachedObjects.end(); ++itObj)
|
|
||||||
{
|
|
||||||
LLViewerObject* object = *itObj;
|
|
||||||
if(object)
|
|
||||||
{
|
|
||||||
objectArray.put(object);
|
|
||||||
objectCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
|
|
||||||
iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
|
|
||||||
{
|
|
||||||
LLSelectNode* selectNode = *iter;
|
|
||||||
LLViewerObject* object = selectNode->getObject();
|
|
||||||
if(object)
|
|
||||||
{
|
|
||||||
objectArray.put(object);
|
|
||||||
objectCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doDelete=delScript;
|
|
||||||
}
|
|
||||||
F32 throttle = gSavedSettings.getF32("OutBandwidth");
|
|
||||||
if((throttle == 0.f) || (throttle > 128000.f))
|
|
||||||
{
|
|
||||||
gMessageSystem->mPacketRing->setOutBandwidth(128000);
|
|
||||||
gMessageSystem->mPacketRing->setUseOutThrottle(TRUE);
|
|
||||||
}
|
|
||||||
showResult(llformat("Counting scripts, please wait..."));
|
|
||||||
if((objectCount == 1) && !(foo->isAvatar()))
|
|
||||||
{
|
|
||||||
LLViewerObject *reqObject=((LLViewerObject*)foo->getRoot());
|
|
||||||
if(reqObject->isAvatar())
|
|
||||||
{
|
|
||||||
for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
|
|
||||||
iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++ )
|
|
||||||
{
|
|
||||||
LLSelectNode *nodep = *iter;
|
|
||||||
LLViewerObject* objectp = nodep->getObject();
|
|
||||||
if (objectp->isRootEdit())
|
|
||||||
{
|
|
||||||
reqObjectID=objectp->getID();
|
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
|
||||||
msg->newMessageFast(_PREHASH_ObjectSelect);
|
|
||||||
msg->nextBlockFast(_PREHASH_AgentData);
|
|
||||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
|
||||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
|
||||||
msg->nextBlockFast(_PREHASH_ObjectData);
|
|
||||||
msg->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID());
|
|
||||||
msg->sendReliable(gAgent.getRegionHost());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reqObjectID=reqObject->getID();
|
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
|
||||||
msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
|
|
||||||
msg->nextBlockFast(_PREHASH_AgentData);
|
|
||||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
|
||||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
|
||||||
msg->nextBlockFast(_PREHASH_ObjectData);
|
|
||||||
msg->addU32Fast(_PREHASH_RequestFlags, 0 );
|
|
||||||
msg->addUUIDFast(_PREHASH_ObjectID, reqObjectID);
|
|
||||||
gAgent.sendReliableMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
serialize(objectArray);
|
|
||||||
}
|
}
|
||||||
|
else // Iterate through all the selected objects
|
||||||
|
{
|
||||||
|
for (LLObjectSelection::valid_root_iterator i = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); i != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); ++i)
|
||||||
|
if (LLSelectNode* selectNode = *i)
|
||||||
|
if (LLViewerObject* object = selectNode->getObject())
|
||||||
|
requestInventoriesFor(object);
|
||||||
|
}
|
||||||
|
cmdline_printchat(LLTrans::getString("ScriptCounting"));
|
||||||
|
requesting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCounter::serialize(LLDynamicArray<LLViewerObject*> objects)
|
// Request the inventories of each object and its child prims
|
||||||
|
void ScriptCounter::requestInventoriesFor(LLViewerObject* object)
|
||||||
{
|
{
|
||||||
init();
|
++objectCount;
|
||||||
status = COUNTING;
|
requestInventoryFor(object);
|
||||||
for(LLDynamicArray<LLViewerObject*>::iterator itr = objects.begin(); itr != objects.end(); ++itr)
|
|
||||||
{
|
|
||||||
LLViewerObject* object = *itr;
|
|
||||||
if (object)
|
|
||||||
subserialize(object);
|
|
||||||
}
|
|
||||||
if(invqueries == 0)
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptCounter::subserialize(LLViewerObject* linkset)
|
|
||||||
{
|
|
||||||
LLViewerObject* object = linkset;
|
|
||||||
LLDynamicArray<LLViewerObject*> count_objects;
|
|
||||||
count_objects.put(object);
|
|
||||||
LLViewerObject::child_list_t child_list = object->getChildren();
|
LLViewerObject::child_list_t child_list = object->getChildren();
|
||||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||||
{
|
{
|
||||||
LLViewerObject* child = *i;
|
LLViewerObject* child = *i;
|
||||||
if(!child->isAvatar())
|
if (child->isAvatar()) continue;
|
||||||
count_objects.put(child);
|
requestInventoryFor(child);
|
||||||
}
|
|
||||||
S32 object_index = 0;
|
|
||||||
while ((object_index < count_objects.count()))
|
|
||||||
{
|
|
||||||
object = count_objects.get(object_index++);
|
|
||||||
LLUUID id = object->getID();
|
|
||||||
objIDS.insert(id.asString());
|
|
||||||
llinfos << "Counting scripts in prim " << object->getID().asString() << llendl;
|
|
||||||
object->registerInventoryListener(sInstance,NULL);
|
|
||||||
object->dirtyInventory();
|
|
||||||
object->requestInventory();
|
|
||||||
invqueries += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCounter::completechk()
|
// Request inventory for each individual prim
|
||||||
|
void ScriptCounter::requestInventoryFor(LLViewerObject* object)
|
||||||
{
|
{
|
||||||
std::string user_msg;
|
//llinfos << "Requesting inventory of " << object->getID() << llendl;
|
||||||
llinfos << "Completechk called." << llendl;
|
++inventories;
|
||||||
if(invqueries == 0)
|
object->registerInventoryListener(this, NULL);
|
||||||
{
|
object->dirtyInventory();
|
||||||
llinfos << "InvQueries = 0..." << llendl;
|
object->requestInventory();
|
||||||
if(reqObjectID.isNull())
|
|
||||||
{
|
|
||||||
llinfos << "reqObjectId is null..." << llendl;
|
|
||||||
if(foo->isAvatar())
|
|
||||||
{
|
|
||||||
int valid=1;
|
|
||||||
LLVOAvatar *av=find_avatar_from_object(foo);
|
|
||||||
LLNameValue *firstname;
|
|
||||||
LLNameValue *lastname;
|
|
||||||
if(!av)
|
|
||||||
valid=0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
firstname = av->getNVPair("FirstName");
|
|
||||||
lastname = av->getNVPair("LastName");
|
|
||||||
if(!firstname || !lastname)
|
|
||||||
valid=0;
|
|
||||||
if(valid)
|
|
||||||
{
|
|
||||||
user_msg = llformat("Counted %u scripts in %u attachments on %s %s.", scriptcount, objectCount, firstname->getString() , lastname->getString());
|
|
||||||
//sstr << "Counted scripts from " << << " attachments on " << firstname->getString() << " " << lastname->getString() << ": ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!valid)
|
|
||||||
{
|
|
||||||
user_msg = llformat("Counted %u scripts in %u attachments on selected avatar.", scriptcount, objectCount);
|
|
||||||
//sstr << "Counted scripts from " << objectCount << " attachments on avatar: ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(doDelete)
|
|
||||||
{
|
|
||||||
user_msg = llformat("Deleted %u scripts in %u objects.", scriptcount, objectCount);
|
|
||||||
//sstr << "Deleted scripts in " << objectCount << " objects: ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user_msg = llformat("Counted %u scripts in %u objects.", scriptcount, objectCount);
|
|
||||||
//sstr << "Counted scripts in " << objectCount << " objects: ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
F32 throttle = gSavedSettings.getF32("OutBandwidth");
|
|
||||||
if(throttle != 0.f)
|
|
||||||
{
|
|
||||||
gMessageSystem->mPacketRing->setOutBandwidth(throttle);
|
|
||||||
gMessageSystem->mPacketRing->setUseOutThrottle(TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gMessageSystem->mPacketRing->setOutBandwidth(0.0);
|
|
||||||
gMessageSystem->mPacketRing->setUseOutThrottle(FALSE);
|
|
||||||
}
|
|
||||||
llinfos << "Sending readout to chat..." << llendl;
|
|
||||||
showResult(user_msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
countingDone=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCounter::inventoryChanged(LLViewerObject* obj,
|
// An inventory has been received, count/delete the scripts in it
|
||||||
LLInventoryObject::object_list_t* inv,
|
void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::object_list_t* inv, S32, void*)
|
||||||
S32 serial_num,
|
|
||||||
void* user_data)
|
|
||||||
{
|
{
|
||||||
llinfos << "InventoryChanged called..." << llendl;
|
obj->removeInventoryListener(this);
|
||||||
if(status == IDLE)
|
--inventories;
|
||||||
|
//llinfos << "Counting scripts in " << obj->getID() << llendl;
|
||||||
|
|
||||||
|
if (inv)
|
||||||
{
|
{
|
||||||
obj->removeInventoryListener(sInstance);
|
LLInventoryObject::object_list_t::const_iterator end = inv->end();
|
||||||
return;
|
for (LLInventoryObject::object_list_t::const_iterator i = inv->begin(); i != end; ++i)
|
||||||
}
|
if (LLInventoryObject* asset = (*i))
|
||||||
if(objIDS.find(obj->getID().asString()) != objIDS.end())
|
if (asset->getType() == LLAssetType::AT_LSL_TEXT)
|
||||||
{
|
|
||||||
if(inv)
|
|
||||||
{
|
|
||||||
LLInventoryObject::object_list_t::const_iterator it = inv->begin();
|
|
||||||
LLInventoryObject::object_list_t::const_iterator end = inv->end();
|
|
||||||
for( ; it != end; ++it)
|
|
||||||
{
|
|
||||||
LLInventoryObject* asset = (*it);
|
|
||||||
if(asset)
|
|
||||||
{
|
{
|
||||||
if(asset->getType() == LLAssetType::AT_LSL_TEXT)
|
++scriptcount;
|
||||||
|
if (doDelete)
|
||||||
{
|
{
|
||||||
scriptcount+=1;
|
const LLUUID& id = asset->getUUID();
|
||||||
if(doDelete==true)
|
if (id.notNull())
|
||||||
delUUIDS.push_back(asset->getUUID());
|
obj->removeInventory(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(doDelete==true)
|
|
||||||
{
|
// Done requesting and there are no more inventories to receive
|
||||||
while (delUUIDS.count() > 0)
|
if (!requesting && !inventories)
|
||||||
{
|
{
|
||||||
const LLUUID toDelete=delUUIDS[0];
|
LLStringUtil::format_map_t args;
|
||||||
delUUIDS.remove(0);
|
args["SCRIPTS"] = stringize(scriptcount);
|
||||||
if(toDelete.notNull())
|
args["OBJECTS"] = stringize(objectCount);
|
||||||
obj->removeInventory(toDelete);
|
if (foo->isAvatar())
|
||||||
}
|
LLAvatarNameCache::get(foo->getID(), boost::bind(countedScriptsOnAvatar, args, _2));
|
||||||
}
|
else
|
||||||
}
|
cmdline_printchat(LLTrans::getString(doDelete ? "ScriptDeleteObject" : "ScriptCountObject", args));
|
||||||
llinfos << "Attempting completechk..." << llendl;
|
|
||||||
invqueries -= 1;
|
delete this;
|
||||||
objIDS.erase(obj->getID().asString());
|
|
||||||
reqObjectID.setNull();
|
|
||||||
obj->removeInventoryListener(sInstance);
|
|
||||||
completechk();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,51 +28,31 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
#ifndef SCRIPTCOUNTER_H
|
||||||
|
#define SCRIPTCOUNTER_H
|
||||||
|
|
||||||
|
|
||||||
#include "llagent.h"
|
|
||||||
#include "llvoinventorylistener.h"
|
#include "llvoinventorylistener.h"
|
||||||
|
|
||||||
class ScriptCounter : public LLVOInventoryListener
|
class ScriptCounter : public LLVOInventoryListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScriptCounter();
|
ScriptCounter(bool do_delete, LLViewerObject* object);
|
||||||
~ScriptCounter();
|
~ScriptCounter();
|
||||||
|
|
||||||
private:
|
/*virtual*/ void inventoryChanged(LLViewerObject* obj, LLInventoryObject::object_list_t* inv, S32, void*);
|
||||||
static ScriptCounter* sInstance;
|
void requestInventories();
|
||||||
static void init();
|
|
||||||
static LLSD* getprim(LLUUID id);
|
|
||||||
static void completechk();
|
|
||||||
public:
|
|
||||||
static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data);
|
|
||||||
static void processObjectProperties(LLMessageSystem* msg, void** user_data);
|
|
||||||
void inventoryChanged(LLViewerObject* obj,
|
|
||||||
LLInventoryObject::object_list_t* inv,
|
|
||||||
S32 serial_num,
|
|
||||||
void* data);
|
|
||||||
|
|
||||||
static ScriptCounter* getInstance(){ init(); return sInstance; }
|
|
||||||
|
|
||||||
static void serialize(LLDynamicArray<LLViewerObject*> objects);
|
|
||||||
static void serializeSelection(bool delScript);
|
|
||||||
static void finalize(LLSD data);
|
|
||||||
static void showResult(std::string output);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void subserialize(LLViewerObject* linkset);
|
void requestInventoriesFor(LLViewerObject* object);
|
||||||
|
void requestInventoryFor(LLViewerObject* object);
|
||||||
|
|
||||||
enum ExportState { IDLE, COUNTING };
|
bool doDelete;
|
||||||
|
LLViewerObject* foo;
|
||||||
static U32 status;
|
int inventories;
|
||||||
static U32 invqueries;
|
int objectCount;
|
||||||
static U32 scriptcount;
|
bool requesting;
|
||||||
static LLUUID reqObjectID;
|
int scriptcount;
|
||||||
static std::set<std::string> objIDS;
|
|
||||||
static LLDynamicArray<LLUUID> delUUIDS;
|
|
||||||
static int objectCount;
|
|
||||||
static LLViewerObject* foo;
|
|
||||||
static bool doDelete;
|
|
||||||
static std::stringstream sstr;
|
|
||||||
static int countingDone;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //SCRIPTCOUNTER_H
|
||||||
|
|
||||||
|
|||||||
@@ -861,6 +861,10 @@
|
|||||||
width="250">
|
width="250">
|
||||||
<on_click function="Tools.ScriptDelete" />
|
<on_click function="Tools.ScriptDelete" />
|
||||||
<on_enable function="Tools.EnableScriptDelete" />
|
<on_enable function="Tools.EnableScriptDelete" />
|
||||||
|
</menu_item_call>
|
||||||
|
<menu_item_call mouse_opaque="true" label="Count Scripts in Selection" name="Count Scripts in Selection">
|
||||||
|
<on_click function="Object.ScriptCount" />
|
||||||
|
<on_enable function="Object.VisibleScriptCount" />
|
||||||
</menu_item_call>
|
</menu_item_call>
|
||||||
<menu create_jump_keys="true" label="Pathfinding" name="Pathfinding" opaque="true" tear_off="true">
|
<menu create_jump_keys="true" label="Pathfinding" name="Pathfinding" opaque="true" tear_off="true">
|
||||||
<menu_item_check label="Linksets..." name="pathfinding_linksets_menu_item">
|
<menu_item_check label="Linksets..." name="pathfinding_linksets_menu_item">
|
||||||
|
|||||||
@@ -2966,6 +2966,10 @@ Where tag = tag string to match. Removes bot's matching the tag.
|
|||||||
<string name="NotLoggedIn">Not logged in</string>
|
<string name="NotLoggedIn">Not logged in</string>
|
||||||
|
|
||||||
<!-- Non-standard LLChat strings -->
|
<!-- Non-standard LLChat strings -->
|
||||||
|
<string name="ScriptCounting">Counting scripts, please wait...</string>
|
||||||
|
<string name="ScriptCountAvatar">Counted [SCRIPTS] scripts in [OBJECTS] attachments on [NAME].</string>
|
||||||
|
<string name="ScriptCountObject">Counted [SCRIPTS] scripts in [OBJECTS] objects.</string>
|
||||||
|
<string name="ScriptDeleteObject">Deleted [SCRIPTS] scripts in [OBJECTS] objects.</string>
|
||||||
<string name="took_a_snapshot">took a snapshot</string>
|
<string name="took_a_snapshot">took a snapshot</string>
|
||||||
|
|
||||||
<!-- Avatar busy/away mode -->
|
<!-- Avatar busy/away mode -->
|
||||||
|
|||||||
Reference in New Issue
Block a user