Plumb a data path to initialize an attachment from an alternate source

avinationmerge
Melanie Thielker 2010-04-24 16:45:25 +02:00
parent 56f60a04d9
commit 71f42f185a
5 changed files with 57 additions and 4 deletions

View File

@ -27,6 +27,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using log4net;
using Nini.Config;
using OpenMetaverse;
@ -191,8 +192,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
{
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
}
public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
{
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt);
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
if (updateInventoryStatus)
{
@ -211,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
{
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
@ -237,6 +244,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (tainted)
objatt.HasGroupChanged = true;
if (doc != null)
objatt.LoadScriptState(doc);
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
@ -318,6 +328,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
// XXYY!!
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
if (item == null)
m_log.Error("[ATTACHMENT]: item == null");
if (m_scene == null)
m_log.Error("[ATTACHMENT]: m_scene == null");
if (m_scene.InventoryService == null)
m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
item = m_scene.InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);

View File

@ -524,6 +524,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
else
{
throw new Exception("AttachTracer");
group.SetFromItemID(itemID);
}

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Xml;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
@ -82,6 +83,10 @@ namespace OpenSim.Region.Framework.Interfaces
UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
// Same as above, but also load script states from a separate doc
UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc);
/// <summary>
/// Rez multiple attachments from a user's inventory
/// </summary>
@ -132,4 +137,4 @@ namespace OpenSim.Region.Framework.Interfaces
/// </param>
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
}
}
}

View File

@ -3984,7 +3984,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
{
// Rez from inventory
UUID asset
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p);
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null);
m_log.InfoFormat(
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",

View File

@ -0,0 +1,31 @@
////////////////////////////////////////////////////////////////
//
// (c) 2009, 2010 Careminster Limited and Melanie Thielker
//
// All rights reserved
//
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Server.Base;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using Nini.Config;
using log4net;
using Careminster;
using OpenMetaverse;
namespace Careminster
{
public interface IAttachmentsService
{
string Get(string id);
void Store(string id, string data);
}
}