From d69e992665495b98fac4ae8c74266294e85804e6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Aug 2010 23:25:19 +0100 Subject: 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 --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 33 ++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs') 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 group.ResetIDs(); - AddNewSceneObject(group, true); - - // we set it's position in world. - group.AbsolutePosition = pos; - SceneObjectPart rootPart = group.GetChildPart(group.UUID); // Since renaming the item in the inventory does not affect the name stored @@ -2027,31 +2022,21 @@ namespace OpenSim.Region.Framework.Scenes part.NextOwnerMask = item.NextPermissions; } - rootPart.TrimPermissions(); - - if (group.RootPart.Shape.PCode == (byte)PCode.Prim) - { - group.ClearPartAttachmentData(); - } - - group.UpdateGroupRotationR(rot); - - //group.ApplyPhysics(m_physicalPrim); - if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) - { - group.RootPart.ApplyImpulse((vel * group.GetMass()), false); - group.Velocity = vel; - rootPart.ScheduleFullUpdate(); - } - - group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); - rootPart.ScheduleFullUpdate(); + rootPart.TrimPermissions(); if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) sourcePart.Inventory.RemoveInventoryItem(item.ItemID); } + + AddNewSceneObject(group, true, pos, rot, vel); + + // We can only call this after adding the scene object, since the scene object references the scene + // to find out if scripts should be activated at all. + group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); + + group.ScheduleGroupForFullUpdate(); return rootPart.ParentGroup; } -- cgit v1.1