Group chat seems to want script reset from object inventory, so here you go.
This commit is contained in:
@@ -671,19 +671,34 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,
|
|||||||
// llwarns << "LLTaskInvFVBridge::dropped() - not implemented" << llendl;
|
// llwarns << "LLTaskInvFVBridge::dropped() - not implemented" << llendl;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
void pack_script_message(LLMessageSystem*, const LLInventoryItem*, const LLViewerObject*);
|
||||||
|
|
||||||
|
void reset_script(const LLInventoryItem* item, const LLViewerObject* obj)
|
||||||
|
{
|
||||||
|
if (!item || !obj) return;
|
||||||
|
gMessageSystem->newMessageFast(_PREHASH_ScriptReset);
|
||||||
|
pack_script_message(gMessageSystem, item, obj);
|
||||||
|
gMessageSystem->sendReliable(obj->getRegion()->getHost());
|
||||||
|
}
|
||||||
|
|
||||||
void set_script_running(bool running, const LLInventoryItem* item, const LLViewerObject* obj)
|
void set_script_running(bool running, const LLInventoryItem* item, const LLViewerObject* obj)
|
||||||
{
|
{
|
||||||
if (!item || !obj) return;
|
if (!item || !obj) return;
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
LLMessageSystem* msg = gMessageSystem;
|
||||||
msg->newMessageFast(_PREHASH_SetScriptRunning);
|
msg->newMessageFast(_PREHASH_SetScriptRunning);
|
||||||
|
pack_script_message(msg, item, obj);
|
||||||
|
msg->addBOOLFast(_PREHASH_Running, running);
|
||||||
|
msg->sendReliable(obj->getRegion()->getHost());
|
||||||
|
}
|
||||||
|
|
||||||
|
void pack_script_message(LLMessageSystem* msg, const LLInventoryItem* item, const LLViewerObject* obj)
|
||||||
|
{
|
||||||
msg->nextBlockFast(_PREHASH_AgentData);
|
msg->nextBlockFast(_PREHASH_AgentData);
|
||||||
msg->addUUIDFast(_PREHASH_AgentID, gAgentID);
|
msg->addUUIDFast(_PREHASH_AgentID, gAgentID);
|
||||||
msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
|
msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
|
||||||
msg->nextBlockFast(_PREHASH_Script);
|
msg->nextBlockFast(_PREHASH_Script);
|
||||||
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
|
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
|
||||||
msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
|
msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
|
||||||
msg->addBOOLFast(_PREHASH_Running, running);
|
|
||||||
msg->sendReliable(obj->getRegion()->getHost());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
@@ -719,6 +734,10 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio
|
|||||||
{
|
{
|
||||||
showProperties();
|
showProperties();
|
||||||
}
|
}
|
||||||
|
else if (action == "reset_script")
|
||||||
|
{
|
||||||
|
reset_script(findItem(), gObjectList.findObject(mPanel->getTaskUUID()));
|
||||||
|
}
|
||||||
else if (action == "start_script")
|
else if (action == "start_script")
|
||||||
{
|
{
|
||||||
set_script_running(true, findItem(), gObjectList.findObject(mPanel->getTaskUUID()));
|
set_script_running(true, findItem(), gObjectList.findObject(mPanel->getTaskUUID()));
|
||||||
@@ -777,11 +796,13 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
|||||||
{
|
{
|
||||||
if (LLAssetType::AT_LSL_TEXT == item->getType())
|
if (LLAssetType::AT_LSL_TEXT == item->getType())
|
||||||
{
|
{
|
||||||
|
items.push_back(std::string("Task Reset"));
|
||||||
items.push_back(std::string("Task Set Running"));
|
items.push_back(std::string("Task Set Running"));
|
||||||
items.push_back(std::string("Task Set Not Running"));
|
items.push_back(std::string("Task Set Not Running"));
|
||||||
const LLViewerObject* obj = gObjectList.findObject(mPanel->getTaskUUID());
|
const LLViewerObject* obj = gObjectList.findObject(mPanel->getTaskUUID());
|
||||||
if (!obj || !(obj->permModify() || obj->permYouOwner()))
|
if (!obj || !(obj->permModify() || obj->permYouOwner()))
|
||||||
{
|
{
|
||||||
|
disabled_items.push_back(std::string("Task Reset"));
|
||||||
disabled_items.push_back(std::string("Task Set Running"));
|
disabled_items.push_back(std::string("Task Set Running"));
|
||||||
disabled_items.push_back(std::string("Task Set Not Running"));
|
disabled_items.push_back(std::string("Task Set Not Running"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
name="Task Remove" width="128">
|
name="Task Remove" width="128">
|
||||||
<on_click filter="" function="Inventory.DoToSelected" userdata="delete" />
|
<on_click filter="" function="Inventory.DoToSelected" userdata="delete" />
|
||||||
</menu_item_call>
|
</menu_item_call>
|
||||||
|
<menu_item_call label="Reset" name="Task Reset">
|
||||||
|
<on_click filter="" function="Inventory.DoToSelected" userdata="reset_script" />
|
||||||
|
</menu_item_call>
|
||||||
<menu_item_call label="Set Not Running" name="Task Set Not Running">
|
<menu_item_call label="Set Not Running" name="Task Set Not Running">
|
||||||
<on_click filter="" function="Inventory.DoToSelected" userdata="stop_script" />
|
<on_click filter="" function="Inventory.DoToSelected" userdata="stop_script" />
|
||||||
</menu_item_call>
|
</menu_item_call>
|
||||||
|
|||||||
Reference in New Issue
Block a user