aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-24 20:53:25 +0100
committerJustin Clark-Casey (justincc)2010-08-24 20:53:25 +0100
commit07d5a0779a8330a56fd6ca6d30918de7c8161f98 (patch)
treeecc6af1fa6625c5676adc9afc1e835dcf1e8db1e /OpenSim/Region/Framework
parentadd test to check move of task item to user inventory when a target folder is... (diff)
downloadopensim-SC_OLD-07d5a0779a8330a56fd6ca6d30918de7c8161f98.zip
opensim-SC_OLD-07d5a0779a8330a56fd6ca6d30918de7c8161f98.tar.gz
opensim-SC_OLD-07d5a0779a8330a56fd6ca6d30918de7c8161f98.tar.bz2
opensim-SC_OLD-07d5a0779a8330a56fd6ca6d30918de7c8161f98.tar.xz
refactor: make RezObject() more readable
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs137
1 files changed, 68 insertions, 69 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index fa9653f..9c62ad3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1951,7 +1951,7 @@ namespace OpenSim.Region.Framework.Scenes
1951 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 1951 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
1952 RezSelected, RemoveItem, fromTaskID, false); 1952 RezSelected, RemoveItem, fromTaskID, false);
1953 } 1953 }
1954 1954
1955 /// <summary> 1955 /// <summary>
1956 /// Rez an object into the scene from a prim's inventory. 1956 /// Rez an object into the scene from a prim's inventory.
1957 /// </summary> 1957 /// </summary>
@@ -1966,95 +1966,94 @@ namespace OpenSim.Region.Framework.Scenes
1966 SceneObjectPart sourcePart, TaskInventoryItem item, 1966 SceneObjectPart sourcePart, TaskInventoryItem item,
1967 Vector3 pos, Quaternion rot, Vector3 vel, int param) 1967 Vector3 pos, Quaternion rot, Vector3 vel, int param)
1968 { 1968 {
1969 // Rez object 1969 if (null == item)
1970 if (item != null) 1970 return null;
1971 { 1971
1972 UUID ownerID = item.OwnerID; 1972 UUID ownerID = item.OwnerID;
1973 AssetBase rezAsset = AssetService.Get(item.AssetID.ToString());
1973 1974
1974 AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); 1975 if (null == rezAsset)
1976 return null;
1975 1977
1976 if (rezAsset != null) 1978 string xmlData = Utils.BytesToString(rezAsset.Data);
1977 { 1979 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
1978 string xmlData = Utils.BytesToString(rezAsset.Data);
1979 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
1980 1980
1981 if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos)) 1981 if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos))
1982 { 1982 return null;
1983 return null;
1984 }
1985 group.ResetIDs();
1986 1983
1987 AddNewSceneObject(group, true); 1984 group.ResetIDs();
1988 1985
1989 // we set it's position in world. 1986 AddNewSceneObject(group, true);
1990 group.AbsolutePosition = pos;
1991 1987
1992 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1988 // we set it's position in world.
1989 group.AbsolutePosition = pos;
1993 1990
1994 // Since renaming the item in the inventory does not affect the name stored 1991 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1995 // in the serialization, transfer the correct name from the inventory to the
1996 // object itself before we rez.
1997 rootPart.Name = item.Name;
1998 rootPart.Description = item.Description;
1999 1992
2000 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 1993 // Since renaming the item in the inventory does not affect the name stored
1994 // in the serialization, transfer the correct name from the inventory to the
1995 // object itself before we rez.
1996 rootPart.Name = item.Name;
1997 rootPart.Description = item.Description;
2001 1998
2002 group.SetGroup(sourcePart.GroupID, null); 1999 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
2003 2000
2004 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 2001 group.SetGroup(sourcePart.GroupID, null);
2005 {
2006 if (Permissions.PropagatePermissions())
2007 {
2008 foreach (SceneObjectPart part in partList)
2009 {
2010 part.EveryoneMask = item.EveryonePermissions;
2011 part.NextOwnerMask = item.NextPermissions;
2012 }
2013 group.ApplyNextOwnerPermissions();
2014 }
2015 }
2016 2002
2003 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2004 {
2005 if (Permissions.PropagatePermissions())
2006 {
2017 foreach (SceneObjectPart part in partList) 2007 foreach (SceneObjectPart part in partList)
2018 { 2008 {
2019 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2020 {
2021 part.LastOwnerID = part.OwnerID;
2022 part.OwnerID = item.OwnerID;
2023 part.Inventory.ChangeInventoryOwner(item.OwnerID);
2024 }
2025 part.EveryoneMask = item.EveryonePermissions; 2009 part.EveryoneMask = item.EveryonePermissions;
2026 part.NextOwnerMask = item.NextPermissions; 2010 part.NextOwnerMask = item.NextPermissions;
2027 } 2011 }
2028 2012
2029 rootPart.TrimPermissions(); 2013 group.ApplyNextOwnerPermissions();
2030 2014 }
2031 if (group.RootPart.Shape.PCode == (byte)PCode.Prim) 2015 }
2032 {
2033 group.ClearPartAttachmentData();
2034 }
2035
2036 group.UpdateGroupRotationR(rot);
2037
2038 //group.ApplyPhysics(m_physicalPrim);
2039 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2040 {
2041 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2042 group.Velocity = vel;
2043 rootPart.ScheduleFullUpdate();
2044 }
2045 group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
2046 rootPart.ScheduleFullUpdate();
2047 2016
2048 if (!Permissions.BypassPermissions()) 2017 foreach (SceneObjectPart part in partList)
2049 { 2018 {
2050 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 2019 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2051 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2020 {
2052 } 2021 part.LastOwnerID = part.OwnerID;
2053 return rootPart.ParentGroup; 2022 part.OwnerID = item.OwnerID;
2023 part.Inventory.ChangeInventoryOwner(item.OwnerID);
2054 } 2024 }
2025
2026 part.EveryoneMask = item.EveryonePermissions;
2027 part.NextOwnerMask = item.NextPermissions;
2028 }
2029
2030 rootPart.TrimPermissions();
2031
2032 if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
2033 {
2034 group.ClearPartAttachmentData();
2035 }
2036
2037 group.UpdateGroupRotationR(rot);
2038
2039 //group.ApplyPhysics(m_physicalPrim);
2040 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2041 {
2042 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2043 group.Velocity = vel;
2044 rootPart.ScheduleFullUpdate();
2055 } 2045 }
2046
2047 group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
2048 rootPart.ScheduleFullUpdate();
2056 2049
2057 return null; 2050 if (!Permissions.BypassPermissions())
2051 {
2052 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
2053 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2054 }
2055
2056 return rootPart.ParentGroup;
2058 } 2057 }
2059 2058
2060 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) 2059 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)