Feature Request: Show how many scripts are actually running when doing a script count (also shows mono!)
This commit is contained in:
@@ -222,6 +222,7 @@
|
||||
#include "wlfPanel_AdvSettings.h" //Lower right Windlight and Rendering options
|
||||
#include "lldaycyclemanager.h"
|
||||
#include "llfloaterblacklist.h"
|
||||
#include "scriptcounter.h"
|
||||
#include "shfloatermediaticker.h"
|
||||
#include "llpacketring.h"
|
||||
// </edit>
|
||||
@@ -2961,6 +2962,22 @@ void pass_processObjectPropertiesFamily(LLMessageSystem *msg, void**)
|
||||
JCFloaterAreaSearch::processObjectPropertiesFamily(msg, NULL);
|
||||
}
|
||||
|
||||
void process_script_running_reply(LLMessageSystem* msg, void** v)
|
||||
{
|
||||
LLLiveLSLEditor::processScriptRunningReply(msg, v);
|
||||
if (ScriptCounter::sCheckMap.size())
|
||||
{
|
||||
LLUUID item_id;
|
||||
msg->getUUIDFast(_PREHASH_Script, _PREHASH_ItemID, item_id);
|
||||
std::map<LLUUID,ScriptCounter*>::iterator it = ScriptCounter::sCheckMap.find(item_id);
|
||||
if (it != ScriptCounter::sCheckMap.end())
|
||||
{
|
||||
it->second->processRunningReply(msg);
|
||||
ScriptCounter::sCheckMap.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void register_viewer_callbacks(LLMessageSystem* msg)
|
||||
{
|
||||
msg->setHandlerFuncFast(_PREHASH_LayerData, process_layer_data );
|
||||
@@ -3011,8 +3028,7 @@ void register_viewer_callbacks(LLMessageSystem* msg)
|
||||
msg->setHandlerFuncFast(_PREHASH_CoarseLocationUpdate, LLWorld::processCoarseUpdate, NULL);
|
||||
msg->setHandlerFuncFast(_PREHASH_ReplyTaskInventory, LLViewerObject::processTaskInv, NULL);
|
||||
msg->setHandlerFuncFast(_PREHASH_DerezContainer, process_derez_container, NULL);
|
||||
msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply,
|
||||
&LLLiveLSLEditor::processScriptRunningReply);
|
||||
msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply, process_script_running_reply);
|
||||
|
||||
msg->setHandlerFuncFast(_PREHASH_DeRezAck, process_derez_ack);
|
||||
|
||||
|
||||
@@ -3008,6 +3008,7 @@ class LLScriptCount : public view_listener_t
|
||||
{
|
||||
if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
|
||||
{
|
||||
if (ScriptCounter::getInstance(object->getID())) return true;
|
||||
ScriptCounter* sc = new ScriptCounter(false, object);
|
||||
sc->requestInventories();
|
||||
// sc will destroy itself
|
||||
@@ -3022,6 +3023,7 @@ class LLScriptDelete : public view_listener_t
|
||||
{
|
||||
if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
|
||||
{
|
||||
if (ScriptCounter::getInstance(object->getID())) return true;
|
||||
ScriptCounter* sc = new ScriptCounter(true, object);
|
||||
sc->requestInventories();
|
||||
// sc will destroy itself
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "scriptcounter.h"
|
||||
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "lltrans.h"
|
||||
#include "llvoavatar.h"
|
||||
@@ -54,13 +55,19 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::map<LLUUID, ScriptCounter*> ScriptCounter::sCheckMap;
|
||||
|
||||
ScriptCounter::ScriptCounter(bool do_delete, LLViewerObject* object)
|
||||
: doDelete(do_delete)
|
||||
: LLInstanceTracker<ScriptCounter, LLUUID>(object->getID())
|
||||
, doDelete(do_delete)
|
||||
, foo(object)
|
||||
, inventories()
|
||||
, objectCount()
|
||||
, requesting(true)
|
||||
, scriptcount()
|
||||
, checking()
|
||||
, mRunningCount()
|
||||
, mMonoCount()
|
||||
{
|
||||
llassert(foo); // Object to ScriptCount must not be null
|
||||
}
|
||||
@@ -152,15 +159,47 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::obj
|
||||
end = inv->end();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLUUID& id = asset->getUUID();
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_GetScriptRunning);
|
||||
msg->nextBlockFast(_PREHASH_Script);
|
||||
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
|
||||
msg->addUUIDFast(_PREHASH_ItemID, id);
|
||||
msg->sendReliable(obj->getRegion()->getHost());
|
||||
sCheckMap[id] = this;
|
||||
++checking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summarize();
|
||||
}
|
||||
|
||||
void ScriptCounter::processRunningReply(LLMessageSystem* msg)
|
||||
{
|
||||
BOOL is;
|
||||
msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, is);
|
||||
if (is) ++mRunningCount;
|
||||
msg->getBOOLFast(_PREHASH_Script, "Mono", is);
|
||||
if (is) ++mMonoCount;
|
||||
--checking;
|
||||
|
||||
summarize();
|
||||
}
|
||||
|
||||
void ScriptCounter::summarize()
|
||||
{
|
||||
// Done requesting and there are no more inventories to receive
|
||||
if (!requesting && !inventories)
|
||||
// And we're not checking any scripts for running/mono properties
|
||||
if (!requesting && !inventories && !checking)
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
args["SCRIPTS"] = stringize(scriptcount);
|
||||
args["OBJECTS"] = stringize(objectCount);
|
||||
args["RUNNING"] = stringize(mRunningCount);
|
||||
args["MONO"] = stringize(mMonoCount);
|
||||
if (foo->isAvatar())
|
||||
LLAvatarNameCache::get(foo->getID(), boost::bind(countedScriptsOnAvatar, args, _2));
|
||||
else
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "llvoinventorylistener.h"
|
||||
|
||||
class ScriptCounter : public LLVOInventoryListener
|
||||
class ScriptCounter : public LLInstanceTracker<ScriptCounter, LLUUID>, public LLVOInventoryListener
|
||||
{
|
||||
public:
|
||||
ScriptCounter(bool do_delete, LLViewerObject* object);
|
||||
@@ -45,6 +45,9 @@ public:
|
||||
private:
|
||||
void requestInventoriesFor(LLViewerObject* object);
|
||||
void requestInventoryFor(LLViewerObject* object);
|
||||
friend void process_script_running_reply(LLMessageSystem* msg, void**);
|
||||
void processRunningReply(LLMessageSystem* msg);
|
||||
void summarize(); // Check if finished, if so, output and destroy.
|
||||
|
||||
bool doDelete;
|
||||
LLViewerObject* foo;
|
||||
@@ -52,6 +55,10 @@ private:
|
||||
int objectCount;
|
||||
bool requesting;
|
||||
int scriptcount;
|
||||
static std::map<LLUUID, ScriptCounter*> sCheckMap; // Map of scripts being checked running/mono and by which instance
|
||||
int checking; // Number of scripts being counter by this instance
|
||||
int mRunningCount;
|
||||
int mMonoCount;
|
||||
};
|
||||
|
||||
#endif //SCRIPTCOUNTER_H
|
||||
|
||||
@@ -3075,8 +3075,8 @@ Where tag = tag string to match. Removes bot's matching the tag.
|
||||
|
||||
<!-- 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="ScriptCountAvatar">Counted [SCRIPTS] scripts in [OBJECTS] attachments on [NAME]. ([RUNNING] running, [MONO] mono.)</string>
|
||||
<string name="ScriptCountObject">Counted [SCRIPTS] scripts in [OBJECTS] objects. ([RUNNING] running, [MONO] mono.)</string>
|
||||
<string name="ScriptDeleteObject">Deleted [SCRIPTS] scripts in [OBJECTS] objects.</string>
|
||||
<string name="took_a_snapshot">took a snapshot</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user