Fix Script Count not being enabled when AllowSelectAvatar is true

This commit is contained in:
Lirusaito
2019-01-24 18:00:36 -05:00
parent a30119706d
commit 748a952e81
2 changed files with 6 additions and 6 deletions

View File

@@ -3005,9 +3005,9 @@ class LLAvatarFreeze : public view_listener_t
}
};
void do_script_count(bool del)
void do_script_count(bool del, LLViewerObject* object = nullptr)
{
if (LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
if (object || (object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
{
if (ScriptCounter::getInstance(object->getID())) return;
ScriptCounter* sc = new ScriptCounter(del, object);
@@ -3020,7 +3020,7 @@ class LLScriptCount : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
do_script_count(false);
do_script_count(false, userdata["data"].asString() == "agent" ? gAgentAvatarp : nullptr);
return true;
}
};
@@ -3038,7 +3038,7 @@ class LLObjectVisibleScriptCount : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
LLViewerObject* object = userdata["data"].asString() == "agent" ? gAgentAvatarp : LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL);
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);

View File

@@ -100,8 +100,8 @@
<on_click function="ShowFloater" userdata="anims_explorer" />
</menu_item_call>
<menu_item_call enabled="false" hidden="false" label="S. Count" mouse_opaque="true" name="ScriptCount">
<on_click function="Object.ScriptCount" />
<on_visible function="Object.VisibleScriptCount" />
<on_click function="Object.ScriptCount" userdata="agent"/>
<on_visible function="Object.VisibleScriptCount" userdata="agent"/>
</menu_item_call>
<menu_item_call label="Script Info" mouse_opaque="true" name="Script Info">
<on_click function="ShowFloater" userdata="script info" />