From da9eeffc9ecda89439c79627173204b76b6fbe43 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 7 Apr 2008 21:33:25 +0000 Subject: * Objects which have their name or description changed while within inventory will now retain those details when rezzed to a scene --- .../Region/Environment/Scenes/Scene.Inventory.cs | 99 +++++++++++++--------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index c61afda..7ef3285 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -894,11 +894,29 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// Rez an object into a scene + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart, LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, bool RezSelected, bool RemoveItem, LLUUID fromTaskID) { + // Work out position details byte bRayEndIsIntersection = (byte)0; if (RayEndIsIntersection) @@ -910,12 +928,12 @@ namespace OpenSim.Region.Environment.Scenes bRayEndIsIntersection = (byte)0; } - LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), BypassRayCast, bRayEndIsIntersection); - RezObject(remoteClient, itemID, pos); - } - - public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) - { + LLVector3 pos + = GetNewRezLocation( + RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), + BypassRayCast, bRayEndIsIntersection); + + // Rez object CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); if (userInfo != null) { @@ -928,9 +946,41 @@ namespace OpenSim.Region.Environment.Scenes if (rezAsset != null) { - AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos); - //userInfo.DeleteItem(remoteClient.AgentId, item); - //remoteClient.SendRemoveInventoryItem(itemID); + string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); + SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); + group.ResetIDs(); + AddEntity(group); + group.AbsolutePosition = pos; + SceneObjectPart rootPart = group.GetChildPart(group.UUID); + + // Since renaming the item in the inventory does not affect the name stored + // in the serialization, transfer the correct name from the inventory to the + // object itself before we rez. + rootPart.Name = item.inventoryName; + rootPart.Description = item.inventoryDescription; + + rootPart.TrimPermissions(); + group.ApplyPhysics(m_physicalPrim); + group.StartScripts(); + + //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); + //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) + //{ + //PrimitiveBaseShape pbs = rootPart.Shape; + //rootPart.PhysActor = PhysicsScene.AddPrimShape( + //rootPart.Name, + //pbs, + //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, + // rootPart.AbsolutePosition.Z), + //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), + //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, + // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); + + // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + + // } + // + rootPart.ScheduleFullUpdate(); } } } @@ -942,36 +992,5 @@ namespace OpenSim.Region.Environment.Scenes { System.Console.WriteLine("RezSingleAttachment: unimplemented yet"); } - - private void AddRezObject(string xmlData, LLVector3 pos) - { - SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); - group.ResetIDs(); - AddEntity(group); - group.AbsolutePosition = pos; - SceneObjectPart rootPart = group.GetChildPart(group.UUID); - rootPart.TrimPermissions(); - group.ApplyPhysics(m_physicalPrim); - group.StartScripts(); - - //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); - //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) - //{ - //PrimitiveBaseShape pbs = rootPart.Shape; - //rootPart.PhysActor = PhysicsScene.AddPrimShape( - //rootPart.Name, - //pbs, - //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, - // rootPart.AbsolutePosition.Z), - //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), - //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, - // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); - - // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); - - // } - // - rootPart.ScheduleFullUpdate(); - } } } -- cgit v1.1