diff options
author | Justin Clark-Casey (justincc) | 2010-08-24 23:25:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-24 23:25:19 +0100 |
commit | d69e992665495b98fac4ae8c74266294e85804e6 (patch) | |
tree | df7607ffc030aba10a5fba671248541d4bb29005 /OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.zip opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.gz opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.bz2 opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.xz |
Split out actual scene object insertion code from Scene.Inventory.RezObject and move into SceneGraph.AddNewSceneObject()
The new SceneGraph method is more consumable by region modules that want to extract objects from inventory and add them to the scene in separate stages.
This change also reduces the number of redundant client updates scheduled when an object is rezzed directly by a script or region module
This code does not touch direct rez by a user
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9c62ad3..01be491 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1983,11 +1983,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1983 | 1983 | ||
1984 | group.ResetIDs(); | 1984 | group.ResetIDs(); |
1985 | 1985 | ||
1986 | AddNewSceneObject(group, true); | ||
1987 | |||
1988 | // we set it's position in world. | ||
1989 | group.AbsolutePosition = pos; | ||
1990 | |||
1991 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1986 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1992 | 1987 | ||
1993 | // Since renaming the item in the inventory does not affect the name stored | 1988 | // Since renaming the item in the inventory does not affect the name stored |
@@ -2027,31 +2022,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2027 | part.NextOwnerMask = item.NextPermissions; | 2022 | part.NextOwnerMask = item.NextPermissions; |
2028 | } | 2023 | } |
2029 | 2024 | ||
2030 | rootPart.TrimPermissions(); | 2025 | 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(); | ||
2045 | } | ||
2046 | |||
2047 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); | ||
2048 | rootPart.ScheduleFullUpdate(); | ||
2049 | 2026 | ||
2050 | if (!Permissions.BypassPermissions()) | 2027 | if (!Permissions.BypassPermissions()) |
2051 | { | 2028 | { |
2052 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 2029 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
2053 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); | 2030 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); |
2054 | } | 2031 | } |
2032 | |||
2033 | AddNewSceneObject(group, true, pos, rot, vel); | ||
2034 | |||
2035 | // We can only call this after adding the scene object, since the scene object references the scene | ||
2036 | // to find out if scripts should be activated at all. | ||
2037 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); | ||
2038 | |||
2039 | group.ScheduleGroupForFullUpdate(); | ||
2055 | 2040 | ||
2056 | return rootPart.ParentGroup; | 2041 | return rootPart.ParentGroup; |
2057 | } | 2042 | } |