From 401af6ad4a16a39e1460abaf30df1a1170069087 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 13 Jul 2007 19:01:09 +0000 Subject: Prim Copying (both CTRL+D and shift-drag) should now work. --- .../Environment/Scenes/Scene.PacketHandlers.cs | 84 ++++++++++++---------- 1 file changed, 46 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 14bf87c..b86e5c8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - // Console.WriteLine("Chat message"); + // Console.WriteLine("Chat message"); ScenePresence avatar = null; m_clientManager.ForEachClient(delegate(IClientAPI client) @@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes { avatar = this.Avatars[client.AgentId]; // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); - dis = (int) avatar.Pos.GetDistanceTo(fromPos); + dis = (int)avatar.Pos.GetDistanceTo(fromPos); //Console.WriteLine("found avatar at " +dis); } @@ -194,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void RezObject(AssetBase primAsset, LLVector3 pos) { - + } /// @@ -204,7 +204,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void DeRezObject(Packet packet, IClientAPI simClient) { - + } /// @@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAvatarsToClient(IClientAPI remoteClient) { - + } /// @@ -239,7 +239,15 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - //SceneObject copy = originPrim.Copy(); + SceneObject copy = originPrim.Copy(); + copy.Pos = copy.Pos + offset; + this.Entities.Add(copy.rootUUID, copy); + + List avatars = this.RequestAvatarList(); + for (int i = 0; i < avatars.Count; i++) + { + copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); + } } else @@ -256,7 +264,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void LinkObjects(uint parentPrim, List childPrims) { - SceneObject parenPrim = null; + SceneObject parenPrim = null; foreach (EntityBase ent in Entities.Values) { if (ent is SceneObject) @@ -328,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObject)ent).rootLocalID == primLocalID) { - ((SceneObject)ent).GetProperites(remoteClient); + ((SceneObject)ent).GetProperites(remoteClient); break; } } @@ -342,7 +350,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void PrimDescription(uint primLocalID, string description) { - Primitive prim = null; + Primitive prim = null; foreach (EntityBase ent in Entities.Values) { if (ent is SceneObject) @@ -350,7 +358,7 @@ namespace OpenSim.Region.Environment.Scenes prim = ((SceneObject)ent).HasChildPrim(primLocalID); if (prim != null) { - prim.Description = description; + prim.Description = description; break; } } @@ -381,19 +389,19 @@ namespace OpenSim.Region.Environment.Scenes public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - Primitive prim = null; - foreach (EntityBase ent in Entities.Values) - { - if (ent is SceneObject) - { - prim = ((SceneObject)ent).HasChildPrim(objectID); - if (prim != null) - { - ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); - break; - } - } - } + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(objectID); + if (prim != null) + { + ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); + break; + } + } + } /* if (this.Entities.ContainsKey(objectID)) { @@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) { - + } /// @@ -423,18 +431,18 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) { - Primitive prim = null; - foreach (EntityBase ent in Entities.Values) - { - if (ent is SceneObject) - { - prim = ((SceneObject)ent).HasChildPrim(localID); - if (prim != null) - { - prim.UpdateTextureEntry(texture); - } - } - } + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(localID); + if (prim != null) + { + prim.UpdateTextureEntry(texture); + } + } + } } /// @@ -494,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes prim = ((SceneObject)ent).HasChildPrim(localID); if (prim != null) { - prim.UpdateGroupMouseRotation( pos, rot); + prim.UpdateGroupMouseRotation(pos, rot); break; } } @@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) { - //Console.WriteLine("trying to update single prim rotation"); + //Console.WriteLine("trying to update single prim rotation"); Primitive prim = null; foreach (EntityBase ent in Entities.Values) { -- cgit v1.1