diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 59 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 66 |
2 files changed, 70 insertions, 55 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 01be491..9fef8f4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1969,60 +1969,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | if (null == item) | 1969 | if (null == item) |
1970 | return null; | 1970 | return null; |
1971 | 1971 | ||
1972 | UUID ownerID = item.OwnerID; | 1972 | SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item); |
1973 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); | 1973 | |
1974 | 1974 | if (null == group) | |
1975 | if (null == rezAsset) | ||
1976 | return null; | ||
1977 | |||
1978 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
1979 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
1980 | |||
1981 | if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos)) | ||
1982 | return null; | 1975 | return null; |
1983 | |||
1984 | group.ResetIDs(); | ||
1985 | |||
1986 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
1987 | |||
1988 | // Since renaming the item in the inventory does not affect the name stored | ||
1989 | // in the serialization, transfer the correct name from the inventory to the | ||
1990 | // object itself before we rez. | ||
1991 | rootPart.Name = item.Name; | ||
1992 | rootPart.Description = item.Description; | ||
1993 | |||
1994 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
1995 | |||
1996 | group.SetGroup(sourcePart.GroupID, null); | ||
1997 | |||
1998 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
1999 | { | ||
2000 | if (Permissions.PropagatePermissions()) | ||
2001 | { | ||
2002 | foreach (SceneObjectPart part in partList) | ||
2003 | { | ||
2004 | part.EveryoneMask = item.EveryonePermissions; | ||
2005 | part.NextOwnerMask = item.NextPermissions; | ||
2006 | } | ||
2007 | |||
2008 | group.ApplyNextOwnerPermissions(); | ||
2009 | } | ||
2010 | } | ||
2011 | |||
2012 | foreach (SceneObjectPart part in partList) | ||
2013 | { | ||
2014 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
2015 | { | ||
2016 | part.LastOwnerID = part.OwnerID; | ||
2017 | part.OwnerID = item.OwnerID; | ||
2018 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
2019 | } | ||
2020 | |||
2021 | part.EveryoneMask = item.EveryonePermissions; | ||
2022 | part.NextOwnerMask = item.NextPermissions; | ||
2023 | } | ||
2024 | 1976 | ||
2025 | rootPart.TrimPermissions(); | 1977 | if (!Permissions.CanRezObject(group.Children.Count, item.OwnerID, pos)) |
1978 | return null; | ||
2026 | 1979 | ||
2027 | if (!Permissions.BypassPermissions()) | 1980 | if (!Permissions.BypassPermissions()) |
2028 | { | 1981 | { |
@@ -2038,7 +1991,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2038 | 1991 | ||
2039 | group.ScheduleGroupForFullUpdate(); | 1992 | group.ScheduleGroupForFullUpdate(); |
2040 | 1993 | ||
2041 | return rootPart.ParentGroup; | 1994 | return group; |
2042 | } | 1995 | } |
2043 | 1996 | ||
2044 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) | 1997 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 4ae53a2..84b7365 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -37,6 +37,7 @@ using log4net; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes.Scripting; | 39 | using OpenSim.Region.Framework.Scenes.Scripting; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.Framework.Scenes | 42 | namespace OpenSim.Region.Framework.Scenes |
42 | { | 43 | { |
@@ -574,6 +575,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
574 | return items; | 575 | return items; |
575 | } | 576 | } |
576 | 577 | ||
578 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | ||
579 | { | ||
580 | UUID ownerID = item.OwnerID; | ||
581 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | ||
582 | |||
583 | if (null == rezAsset) | ||
584 | { | ||
585 | m_log.WarnFormat( | ||
586 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", | ||
587 | item.AssetID, item.Name, m_part.Name); | ||
588 | return null; | ||
589 | } | ||
590 | |||
591 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
592 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
593 | |||
594 | group.ResetIDs(); | ||
595 | |||
596 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
597 | |||
598 | // Since renaming the item in the inventory does not affect the name stored | ||
599 | // in the serialization, transfer the correct name from the inventory to the | ||
600 | // object itself before we rez. | ||
601 | rootPart.Name = item.Name; | ||
602 | rootPart.Description = item.Description; | ||
603 | |||
604 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
605 | |||
606 | group.SetGroup(m_part.GroupID, null); | ||
607 | |||
608 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
609 | { | ||
610 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | ||
611 | { | ||
612 | foreach (SceneObjectPart part in partList) | ||
613 | { | ||
614 | part.EveryoneMask = item.EveryonePermissions; | ||
615 | part.NextOwnerMask = item.NextPermissions; | ||
616 | } | ||
617 | |||
618 | group.ApplyNextOwnerPermissions(); | ||
619 | } | ||
620 | } | ||
621 | |||
622 | foreach (SceneObjectPart part in partList) | ||
623 | { | ||
624 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
625 | { | ||
626 | part.LastOwnerID = part.OwnerID; | ||
627 | part.OwnerID = item.OwnerID; | ||
628 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
629 | } | ||
630 | |||
631 | part.EveryoneMask = item.EveryonePermissions; | ||
632 | part.NextOwnerMask = item.NextPermissions; | ||
633 | } | ||
634 | |||
635 | rootPart.TrimPermissions(); | ||
636 | |||
637 | return group; | ||
638 | } | ||
639 | |||
577 | /// <summary> | 640 | /// <summary> |
578 | /// Update an existing inventory item. | 641 | /// Update an existing inventory item. |
579 | /// </summary> | 642 | /// </summary> |
@@ -1029,6 +1092,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
1029 | } | 1092 | } |
1030 | } | 1093 | } |
1031 | } | 1094 | } |
1032 | |||
1033 | } | 1095 | } |
1034 | } | 1096 | } \ No newline at end of file |