From 7f57dd24d8ec7e5c543fe328a880ced942fb753c Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 19 Jul 2013 08:45:30 -0400 Subject: [PATCH] Satisfy Issue 852: Implement way to stop\start single non-fullperm script in modiable objects --- indra/newview/llpanelobjectinventory.cpp | 35 +++++++++++++++++++ .../default/xui/en-us/menu_inventory.xml | 6 ++++ 2 files changed, 41 insertions(+) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 53ca90be4..5b4957507 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -671,6 +671,21 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop, // llwarns << "LLTaskInvFVBridge::dropped() - not implemented" << llendl; //} +void set_script_running(bool running, const LLInventoryItem* item, const LLViewerObject* obj) +{ + if (!item || !obj) return; + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SetScriptRunning); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); + msg->nextBlockFast(_PREHASH_Script); + msg->addUUIDFast(_PREHASH_ObjectID, obj->getID()); + msg->addUUIDFast(_PREHASH_ItemID, item->getUUID()); + msg->addBOOLFast(_PREHASH_Running, running); + msg->sendReliable(obj->getRegion()->getHost()); +} + // virtual void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string action) { @@ -704,6 +719,14 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio { showProperties(); } + else if (action == "start_script") + { + set_script_running(true, findItem(), gObjectList.findObject(mPanel->getTaskUUID())); + } + else if (action == "stop_script") + { + set_script_running(false, findItem(), gObjectList.findObject(mPanel->getTaskUUID())); + } } void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) @@ -752,6 +775,18 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else if (canOpenItem()) { + if (LLAssetType::AT_LSL_TEXT == item->getType()) + { + items.push_back(std::string("Task Set Running")); + items.push_back(std::string("Task Set Not Running")); + const LLViewerObject* obj = gObjectList.findObject(mPanel->getTaskUUID()); + if (!obj || !(obj->permModify() || obj->permYouOwner())) + { + disabled_items.push_back(std::string("Task Set Running")); + disabled_items.push_back(std::string("Task Set Not Running")); + } + } + items.push_back(std::string("Task Open")); if (!isItemCopyable()) { diff --git a/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/indra/newview/skins/default/xui/en-us/menu_inventory.xml index 53a1dfcad..406b99357 100644 --- a/indra/newview/skins/default/xui/en-us/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/menu_inventory.xml @@ -25,6 +25,12 @@ name="Task Remove" width="128"> + + + + + +