Redid ScriptCounter entirely, should fix 182, if not just prevent the permanent failure condition.

Script Counter now shows the names of avatars in the user's desired format.
Adds "Count Scripts in Selection" to the Tools menu. (Can count for multiple objects, quite useful for land owners, no?)
Makes the Script Counting strings translatable. (ScriptCounting, ScriptCountAvatar, ScriptCountObject, and ScriptDeleteObject)

ScriptCounter is no longer a giant pile of static, it goes away when it has run its course and multiple instances can exist simultaneously.
Removes the silly unneeded parts of ScriptCounter, and thus removes it from llstartup.cpp
Adds some nice documentation in comments, and moves some log output to proper places (although I commented it out, it proved quite spammy for high primcount objects, initial loop runs super fast)
Trying to view this diff with no space changes is the best course of action, but even that will be tough...
Adds a header guard to scriptcounter.h
Hooks up menu function LLObjectVisibleScriptCount to Object.VisibleScriptCount, apparently this was never hooked up.... strange
This commit is contained in:
Lirusaito
2013-05-22 11:01:43 -04:00
parent ea52583510
commit e3bd635510
6 changed files with 125 additions and 371 deletions

View File

@@ -3009,7 +3009,12 @@ class LLScriptCount : public view_listener_t
{
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;
}
};
@@ -3018,7 +3023,12 @@ class LLScriptDelete : public view_listener_t
{
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;
}
};
@@ -9552,6 +9562,7 @@ void initialize_menus()
addMenu(new LLObjectMeasure(), "Object.Measure");
addMenu(new LLObjectData(), "Object.Data");
addMenu(new LLScriptCount(), "Object.ScriptCount");
addMenu(new LLObjectVisibleScriptCount(), "Object.VisibleScriptCount");
addMenu(new LLKillEmAll(), "Object.Destroy");
addMenu(new LLPowerfulWizard(), "Object.Explode");
addMenu(new LLCanIHasKillEmAll(), "Object.EnableDestroy");