* Implement 'Save Object Back to My Inventory'. On the Linden client this is in the Tools menu available when editing an object

* This facility allows you to save changes to an object that you've rezzed into a region back into their original inventory item without having to take a copy of the rezzed 
object.
0.6.1-post-fixes
Justin Clarke Casey 2008-12-17 16:11:03 +00:00
parent ca0de93d9a
commit b4680f653d
12 changed files with 191 additions and 89 deletions

View File

@ -213,7 +213,7 @@ namespace OpenSim.Data.Tests
// The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
UUID creator,uuid = new UUID(); UUID creator,uuid = new UUID();
creator = UUID.Random(); creator = UUID.Random();
uint iserial = (uint) random.Next(); uint iserial = (uint)random.Next();
TaskInventoryDictionary dic = new TaskInventoryDictionary(); TaskInventoryDictionary dic = new TaskInventoryDictionary();
uint objf = (uint) random.Next(); uint objf = (uint) random.Next();
uuid = prim4; uuid = prim4;

View File

@ -109,7 +109,8 @@ namespace OpenSim.Framework.Communications
void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz); void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz);
/// <summary> /// <summary>
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship
/// for UUID friendslistowner
/// </summary> /// </summary>
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
List<FriendListItem> GetUserFriendList(UUID friendlistowner); List<FriendListItem> GetUserFriendList(UUID friendlistowner);

View File

@ -767,7 +767,7 @@ namespace OpenSim.Framework
void SendWindData(Vector2[] windSpeeds); void SendWindData(Vector2[] windSpeeds);
void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look); void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look);
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
AgentCircuitData RequestClientInfo(); AgentCircuitData RequestClientInfo();
void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint,

View File

@ -48,6 +48,7 @@ namespace OpenSim.Framework
/// </value> /// </value>
public enum DeRezAction : byte public enum DeRezAction : byte
{ {
SaveToExistingUserInventoryItem = 0,
TakeCopy = 1, TakeCopy = 1,
Take = 4, Take = 4,
GodTakeCopy = 5, GodTakeCopy = 5,

View File

@ -7286,7 +7286,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
public void SendAgentOnline(UUID[] agentIDs) public void SendAgentOnline(UUID[] agentIDs)
{ {
OnlineNotificationPacket onp = new OnlineNotificationPacket(); OnlineNotificationPacket onp = new OnlineNotificationPacket();
OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length]; OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length];
for (int i = 0; i < agentIDs.Length; i++) for (int i = 0; i < agentIDs.Length; i++)

View File

@ -124,6 +124,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
m_scenes[scene.RegionInfo.RegionHandle] = scene; m_scenes[scene.RegionInfo.RegionHandle] = scene;
} }
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@ -157,6 +158,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
#endregion #endregion
/// <summary>
/// Receive presence information changes about clients in other regions.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public XmlRpcResponse processPresenceUpdateBulk(XmlRpcRequest req) public XmlRpcResponse processPresenceUpdateBulk(XmlRpcRequest req)
{ {
Hashtable requestData = (Hashtable)req.Params[0]; Hashtable requestData = (Hashtable)req.Params[0];
@ -171,6 +177,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
lock (m_rootAgents) lock (m_rootAgents)
{ {
List<ScenePresence> friendsHere = new List<ScenePresence>(); List<ScenePresence> friendsHere = new List<ScenePresence>();
try try
{ {
UUID agentID = new UUID((string)requestData["agentID"]); UUID agentID = new UUID((string)requestData["agentID"]);
@ -728,6 +735,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
if (destAgent != null) destAgent.ControllingClient.SendDeclineCallingCard(transactionID); if (destAgent != null) destAgent.ControllingClient.SendDeclineCallingCard(transactionID);
} }
/// <summary>
/// Send presence information about a client to other clients in both this region and others.
/// </summary>
/// <param name="client"></param>
/// <param name="friendList"></param>
/// <param name="iAmOnline"></param>
private void SendPresenceState(IClientAPI client, List<FriendListItem> friendList, bool iAmOnline) private void SendPresenceState(IClientAPI client, List<FriendListItem> friendList, bool iAmOnline)
{ {
m_log.DebugFormat("[FRIEND]: {0} logged {1}; sending presence updates", client.Name, iAmOnline ? "in" : "out"); m_log.DebugFormat("[FRIEND]: {0} logged {1}; sending presence updates", client.Name, iAmOnline ? "in" : "out");
@ -756,8 +769,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
} }
} }
// we now have a list of "interesting" friends (which we have to find out on-/offline state for), // we now have a list of "interesting" friends (which we have to find out on-/offline state for),
// friends we want to send our online state to (if *they* are online, too), and // friends we want to send our online state to (if *they* are online, too), and
// friends we want to receive online state for (currently unknown whether online or not) // friends we want to receive online state for (currently unknown whether online or not)
@ -799,8 +810,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
friendIDsToReceiveFromOnline.Add(uuid); friendIDsToReceiveFromOnline.Add(uuid);
} }
} }
m_log.DebugFormat("[FRIEND]: Sending {0} offline and {1} online friends to {2}", m_log.DebugFormat("[FRIEND]: Sending {0} offline and {1} online friends to {2}",
friendIDsToReceiveFromOffline.Count, friendIDsToReceiveFromOnline.Count, client.Name); friendIDsToReceiveFromOffline.Count, friendIDsToReceiveFromOnline.Count, client.Name);
if (friendIDsToReceiveFromOffline.Count > 0) client.SendAgentOffline(friendIDsToReceiveFromOffline.ToArray()); if (friendIDsToReceiveFromOffline.Count > 0) client.SendAgentOffline(friendIDsToReceiveFromOffline.ToArray());
if (friendIDsToReceiveFromOnline.Count > 0) client.SendAgentOnline(friendIDsToReceiveFromOnline.ToArray()); if (friendIDsToReceiveFromOnline.Count > 0) client.SendAgentOnline(friendIDsToReceiveFromOnline.ToArray());

View File

@ -1106,7 +1106,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
// the administrator object permissions to take effect. // the administrator object permissions to take effect.
// UUID objectOwner = task.OwnerID; // UUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true; permission = true;
@ -1120,6 +1119,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
if ((task.GetEffectivePermissions() & PERM_COPY) == 0) if ((task.GetEffectivePermissions() & PERM_COPY) == 0)
permission = false; permission = false;
} }
return permission; return permission;
} }

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Scenes
while (InventoryDeQueueAndDelete()) while (InventoryDeQueueAndDelete())
{ {
m_log.Debug("[SCENE]: Returned item successfully to inventory, continuing..."); m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing...");
} }
} }
@ -130,7 +130,7 @@ namespace OpenSim.Region.Environment.Scenes
if (left > 0) if (left > 0)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[SCENE]: Sending deleted object to user's inventory, {0} item(s) remaining.", left); "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
x = m_inventoryDeletes.Dequeue(); x = m_inventoryDeletes.Dequeue();
@ -142,7 +142,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("Exception background deleting object: " + e); m_log.DebugFormat("Exception background sending object: " + e);
} }
return true; return true;
@ -154,11 +154,11 @@ namespace OpenSim.Region.Environment.Scenes
// We can't put the object group details in here since the root part may have disappeared (which is where these sit). // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
// FIXME: This needs to be fixed. // FIXME: This needs to be fixed.
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCENE]: Queued deletion of scene object to agent {0} {1} failed: {2}", "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
(x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
} }
m_log.Debug("[SCENE]: No objects left in inventory delete queue."); m_log.Debug("[SCENE]: No objects left in inventory send queue.");
return false; return false;
} }
} }

View File

@ -1686,7 +1686,15 @@ namespace OpenSim.Region.Environment.Scenes
bool permissionToTake = false; bool permissionToTake = false;
bool permissionToDelete = false; bool permissionToDelete = false;
if (action == DeRezAction.TakeCopy) if (action == DeRezAction.SaveToExistingUserInventoryItem)
{
if (grp.OwnerID == remoteClient.AgentId && grp.RootPart.FromUserInventoryItemID != UUID.Zero)
{
permissionToTake = true;
permissionToDelete = false;
}
}
else if (action == DeRezAction.TakeCopy)
{ {
permissionToTake = permissionToTake =
Permissions.CanTakeCopyObject( Permissions.CanTakeCopyObject(
@ -1726,6 +1734,7 @@ namespace OpenSim.Region.Environment.Scenes
grp.UUID, grp.UUID,
remoteClient.AgentId); remoteClient.AgentId);
permissionToDelete = permissionToTake; permissionToDelete = permissionToTake;
if (permissionToDelete) if (permissionToDelete)
{ {
AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
@ -1737,6 +1746,12 @@ namespace OpenSim.Region.Environment.Scenes
permissionToDelete = true; permissionToDelete = true;
} }
} }
else
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Ignoring unexpected derez action {0} for {1}", action, remoteClient.Name);
return;
}
if (permissionToTake) if (permissionToTake)
{ {
@ -1769,13 +1784,11 @@ namespace OpenSim.Region.Environment.Scenes
if (remoteClient == null) if (remoteClient == null)
{ {
userInfo = CommsManager.UserProfileCacheService.GetUserDetails( userInfo = CommsManager.UserProfileCacheService.GetUserDetails(objectGroup.RootPart.OwnerID);
objectGroup.RootPart.OwnerID);
} }
else else
{ {
userInfo = CommsManager.UserProfileCacheService.GetUserDetails( userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
remoteClient.AgentId);
} }
if (userInfo != null) if (userInfo != null)
@ -1785,8 +1798,8 @@ namespace OpenSim.Region.Environment.Scenes
// If we're returning someone's item, it goes back to the // If we're returning someone's item, it goes back to the
// owner's Lost And Found folder. // owner's Lost And Found folder.
if (folderID == UUID.Zero || (action == DeRezAction.Delete && if (folderID == UUID.Zero
objectGroup.OwnerID != remoteClient.AgentId)) || (action == DeRezAction.Delete && objectGroup.OwnerID != remoteClient.AgentId))
{ {
InventoryFolderBase folder = InventoryFolderBase folder =
userInfo.FindFolderForType( userInfo.FindFolderForType(
@ -1811,6 +1824,21 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
InventoryItemBase item = null;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item = userInfo.RootFolder.FindItem(objectGroup.RootPart.FromUserInventoryItemID);
if (null == item)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
objectGroup.Name, objectGroup.UUID);
return UUID.Zero;
}
}
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.RootPart.LocalId), objectGroup.GetPartName(objectGroup.RootPart.LocalId),
objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), objectGroup.GetPartDescription(objectGroup.RootPart.LocalId),
@ -1818,65 +1846,74 @@ namespace OpenSim.Region.Environment.Scenes
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
assetID = asset.FullID; assetID = asset.FullID;
InventoryItemBase item = new InventoryItemBase();
item.Creator = objectGroup.RootPart.CreatorID;
if (action == DeRezAction.TakeCopy || action == DeRezAction.Take)
item.Owner = remoteClient.AgentId;
else // Delete / Return
item.Owner = objectGroup.OwnerID;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
item.Folder = folderID;
if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
uint perms=objectGroup.GetEffectivePermissions(); item.AssetID = asset.FullID;
uint nextPerms=(perms & 7) << 13; userInfo.UpdateItem(item);
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions |= 8; // Slam!
} }
else else
{ {
item.BasePermissions = objectGroup.GetEffectivePermissions(); item = new InventoryItemBase();
item.CurrentPermissions = objectGroup.GetEffectivePermissions(); item.Creator = objectGroup.RootPart.CreatorID;
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
item.GroupPermissions = objectGroup.RootPart.GroupMask;
}
// TODO: add the new fields (Flags, Sale info, etc) if (action == DeRezAction.TakeCopy || action == DeRezAction.Take)
item.CreationDate = Util.UnixTimeSinceEpoch(); item.Owner = remoteClient.AgentId;
else // Delete / Return
item.Owner = objectGroup.OwnerID;
userInfo.AddItem(item); item.ID = UUID.Random();
if (remoteClient != null && item.Owner == remoteClient.AgentId) item.AssetID = asset.FullID;
{ item.Description = asset.Description;
remoteClient.SendInventoryItemCreateUpdate(item); item.Name = asset.Name;
} item.AssetType = asset.Type;
else item.InvType = (int)InventoryType.Object;
{ item.Folder = folderID;
ScenePresence notifyUser = GetScenePresence(item.Owner);
if (notifyUser != null) if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions())
{ {
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); uint perms=objectGroup.GetEffectivePermissions();
uint nextPerms=(perms & 7) << 13;
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions |= 8; // Slam!
} }
else
{
item.BasePermissions = objectGroup.GetEffectivePermissions();
item.CurrentPermissions = objectGroup.GetEffectivePermissions();
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
item.GroupPermissions = objectGroup.RootPart.GroupMask;
}
// TODO: add the new fields (Flags, Sale info, etc)
item.CreationDate = Util.UnixTimeSinceEpoch();
userInfo.AddItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId)
{
remoteClient.SendInventoryItemCreateUpdate(item);
}
else
{
ScenePresence notifyUser = GetScenePresence(item.Owner);
if (notifyUser != null)
{
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
}
}
} }
} }
@ -2093,7 +2130,7 @@ namespace OpenSim.Region.Environment.Scenes
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.HasReceivedInventory)
{ {
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
@ -2103,8 +2140,21 @@ namespace OpenSim.Region.Environment.Scenes
if (rezAsset != null) if (rezAsset != null)
{ {
UUID itemId = UUID.Zero;
// If we have permission to copy then link the rezzed object back to the user inventory
// item that it came from. This allows us to enable 'save object to inventory'
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy)
{
itemId = item.ID;
}
}
string xmlData = Utils.BytesToString(rezAsset.Data); string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = new SceneObjectGroup(xmlData, true); SceneObjectGroup group = new SceneObjectGroup(itemId, xmlData, true);
if (!Permissions.CanRezObject( if (!Permissions.CanRezObject(
group.Children.Count, remoteClient.AgentId, pos) group.Children.Count, remoteClient.AgentId, pos)
&& !attachment) && !attachment)

View File

@ -3480,28 +3480,19 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
{ {
// TODO: m_sceneGridService.DoStuff;
m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
} }
public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms) public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms)
{ {
// TODO: m_sceneGridService.DoStuff;
m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms); m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms);
} }
public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID) public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID)
{ {
// TODO: m_sceneGridService.DoStuff;
m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
} }
public virtual List<FriendListItem> StoreGetFriendsForUser(UUID ownerID)
{
// TODO: m_sceneGridService.DoStuff;
return m_sceneGridService.GetUserFriendList(ownerID);
}
public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes) public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes)
{ {
m_statsReporter.AddInPackets(inPackets); m_statsReporter.AddInPackets(inPackets);

View File

@ -401,16 +401,25 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SetRootPart(part); SetRootPart(part);
} }
public SceneObjectGroup(string xmlData, bool isOriginalXmlFormat)
: this(UUID.Zero, xmlData, isOriginalXmlFormat)
{
}
/// <summary> /// <summary>
/// Create an object using serialized data in OpenSim's original xml format. /// Create an object using serialized data in OpenSim's original xml format.
/// </summary> /// </summary>
/// <param name="fromUserInventoryItemID">
/// If applicable, the user inventory item id from which this object was rezzed. If not applicable then this
/// should be UUID.Zero
/// </param>
/// <param name="xmlData"></param> /// <param name="xmlData"></param>
/// <param name="isOriginalXmlFormat"> /// <param name="isOriginalXmlFormat">
/// This parameter only exists to separate the two different xml constructors. In the future, versions should /// This parameter only exists to separate the two different xml constructors. In the future, versions should
/// be specified within the xml itself. /// be specified within the xml itself.
/// </param> /// </param>
public SceneObjectGroup(string xmlData, bool isOriginalXmlFormat) public SceneObjectGroup(UUID fromUserInventoryItemID, string xmlData, bool isOriginalXmlFormat)
{ {
if (!isOriginalXmlFormat) if (!isOriginalXmlFormat)
throw new Exception("This constructor must specify the xml is in OpenSim's original format"); throw new Exception("This constructor must specify the xml is in OpenSim's original format");
@ -430,7 +439,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Read(); reader.Read();
reader.ReadStartElement("SceneObjectGroup"); reader.ReadStartElement("SceneObjectGroup");
reader.ReadStartElement("RootPart"); reader.ReadStartElement("RootPart");
SetRootPart(SceneObjectPart.FromXml(reader)); SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
reader.ReadEndElement(); reader.ReadEndElement();

View File

@ -116,30 +116,55 @@ namespace OpenSim.Region.Environment.Scenes
// for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script)
[XmlIgnore] [XmlIgnore]
public UUID Sound; public UUID Sound;
[XmlIgnore] [XmlIgnore]
public byte SoundFlags; public byte SoundFlags;
[XmlIgnore] [XmlIgnore]
public double SoundGain; public double SoundGain;
[XmlIgnore] [XmlIgnore]
public double SoundRadius; public double SoundRadius;
[XmlIgnore] [XmlIgnore]
public uint TimeStampFull = 0; public uint TimeStampFull = 0;
[XmlIgnore] [XmlIgnore]
public uint TimeStampLastActivity = 0; // Will be used for AutoReturn public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
[XmlIgnore] [XmlIgnore]
public uint TimeStampTerse = 0; public uint TimeStampTerse = 0;
[XmlIgnore] [XmlIgnore]
public UUID FromAssetID = UUID.Zero; public UUID FromAssetID = UUID.Zero;
/// <value>
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
/// </value>
private UUID m_fromUserInventoryItemID = UUID.Zero;
[XmlIgnore]
public UUID FromUserInventoryItemID
{
get { return m_fromUserInventoryItemID; }
}
[XmlIgnore] [XmlIgnore]
public bool IsAttachment = false; public bool IsAttachment = false;
[XmlIgnore] [XmlIgnore]
public scriptEvents AggregateScriptEvents = 0; public scriptEvents AggregateScriptEvents = 0;
[XmlIgnore] [XmlIgnore]
public UUID AttachedAvatar = UUID.Zero; public UUID AttachedAvatar = UUID.Zero;
[XmlIgnore] [XmlIgnore]
public Vector3 AttachedPos = Vector3.Zero; public Vector3 AttachedPos = Vector3.Zero;
[XmlIgnore] [XmlIgnore]
public uint AttachmentPoint = (byte)0; public uint AttachmentPoint = (byte)0;
[XmlIgnore] [XmlIgnore]
public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f); public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f);
@ -1428,15 +1453,27 @@ if (m_shape != null) {
/// <summary> /// <summary>
/// Restore this part from the serialized xml representation. /// Restore this part from the serialized xml representation.
/// </summary> /// </summary>
/// <param name="xmlReader"></param>
/// <returns></returns> /// <returns></returns>
public static SceneObjectPart FromXml(XmlReader xmlReader) public static SceneObjectPart FromXml(XmlReader xmlReader)
{ {
// It's not necessary to persist this return FromXml(UUID.Zero, xmlReader);
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
return newobject;
} }
/// <summary>
/// Restore this part from the serialized xml representation.
/// </summary>
/// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param>
/// <param name="xmlReader"></param>
/// <returns></returns>
public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader)
{
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader);
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
return part;
}
public UUID GetAvatarOnSitTarget() public UUID GetAvatarOnSitTarget()
{ {
@ -1603,7 +1640,7 @@ if (m_shape != null) {
public void GetProperties(IClientAPI client) public void GetProperties(IClientAPI client)
{ {
client.SendObjectPropertiesReply( client.SendObjectPropertiesReply(
UUID.Zero, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero,
_groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID,
ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description,
ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask,