From ff71d2d4cd82a3a6ded4b5a5246f98ba6db8773a Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 26 Mar 2007 19:05:50 +0000 Subject: preparing to add full clothes/body part support. Currently you can: now create new body parts and clothes. edit those clothes and wear them. But currently you will not see most of the edited effects on your own avatar, although often other clients will see those changes on your avatar. --- .../OpenGridServices.ServerConsole.csproj | 41 +++--- OpenSim.RegionServer/CAPS/SimHttp.cs | 143 +++++++++++---------- OpenSim.RegionServer/SimClient.cs | 14 +- OpenSim.RegionServer/world/Avatar.cs | 61 +++++++-- OpenSim/RegionServer.cs | 10 +- 5 files changed, 162 insertions(+), 107 deletions(-) diff --git a/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.csproj b/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.csproj index 49e3306..0cabeb0 100644 --- a/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.csproj +++ b/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {7DC4E7C8-89A4-4A8D-9617-3DF262990663} Debug AnyCPU - + + OpenGridServices.ServerConsole @@ -15,9 +16,11 @@ IE50 false Library - + + OpenGridServices.ServerConsole - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,25 +61,22 @@ False False 4 - + + - + System.dll False - + System.Data.dll False - + System.Xml.dll False - - ..\bin\OpenSim.Framework.dll - False - @@ -85,6 +88,12 @@ Code + + + {26E437F6-BA50-44CD-BB44-E911E25CA88C} + OpenSim.Framework + + @@ -92,4 +101,4 @@ - + \ No newline at end of file diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs index 77c6bb8..c3f4801 100644 --- a/OpenSim.RegionServer/CAPS/SimHttp.cs +++ b/OpenSim.RegionServer/CAPS/SimHttp.cs @@ -119,84 +119,89 @@ namespace OpenSim.CAPS private string ParseREST(string requestBody, string requestURL, string requestMethod) { string responseString = ""; - switch (requestURL) + try { - case "/Admin/Accounts": - if (requestMethod == "GET") - { - responseString = "

Account management

"; - responseString += "
"; - responseString += "

Create New Account

"; - responseString += NewAccountForm; - } - break; - case "/Admin/Clients": - if (requestMethod == "GET") - { - responseString = "

Listing connected Clients

" ; - OpenSim.world.Avatar TempAv; - foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) + switch (requestURL) + { + case "/Admin/Accounts": + if (requestMethod == "GET") { - if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") - { - TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; - responseString += "

"; - responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); - responseString += "

"; - } + responseString = "

Account management

"; + responseString += "
"; + responseString += "

Create New Account

"; + responseString += NewAccountForm; } - } - break; - case "/Admin/NewAccount": - if (requestMethod == "POST") - { - string[] comp = new string[10]; - string[] passw = new string[3]; - string delimStr = "&"; - char[] delimiter = delimStr.ToCharArray(); - string delimStr2 = "="; - char[] delimiter2 = delimStr2.ToCharArray(); - - //Console.WriteLine(requestBody); - comp = requestBody.Split(delimiter); - passw = comp[3].Split(delimiter2); - if (passw[1] == passWord) + break; + case "/Admin/Clients": + if (requestMethod == "GET") { - responseString = "

New Account created

"; + responseString = "

Listing connected Clients

"; + OpenSim.world.Avatar TempAv; + foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) + { + if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") + { + TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; + responseString += "

"; + responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); + responseString += "

"; + } + } } - else + break; + case "/Admin/NewAccount": + if (requestMethod == "POST") { - responseString = "

Admin password is incorrect, please login with the correct password

"; - responseString += "

" + LoginForm; + string[] comp = new string[10]; + string[] passw = new string[3]; + string delimStr = "&"; + char[] delimiter = delimStr.ToCharArray(); + string delimStr2 = "="; + char[] delimiter2 = delimStr2.ToCharArray(); + + //Console.WriteLine(requestBody); + comp = requestBody.Split(delimiter); + passw = comp[3].Split(delimiter2); + if (passw[1] == passWord) + { + responseString = "

New Account created

"; + } + else + { + responseString = "

Admin password is incorrect, please login with the correct password

"; + responseString += "

" + LoginForm; + } } - - - } - break; - case "/Admin/Login": - if (requestMethod == "POST") - { - Console.WriteLine(requestBody); - if (requestBody == passWord) + break; + case "/Admin/Login": + if (requestMethod == "POST") { - responseString = "

Login Successful

"; + // Console.WriteLine(requestBody); + if (requestBody == passWord) + { + responseString = "

Login Successful

"; + } + else + { + responseString = "

Password Error

"; + responseString += "

Please Login with the correct password

"; + responseString += "

" + LoginForm; + } } - else + break; + case "/Admin/Welcome": + if (requestMethod == "GET") { - responseString = "

PassWord Error

"; - responseString += "

Please Login with the correct password

"; - responseString += "

" + LoginForm; - } - } - break; - case "/Admin/Welcome": - if (requestMethod == "GET") - { - responseString = "Welcome to the OpenSim Admin Page"; - responseString += "


" + LoginForm; + responseString = "Welcome to the OpenSim Admin Page"; + responseString += "


" + LoginForm; - } - break; + } + break; + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); } return responseString; @@ -210,7 +215,7 @@ namespace OpenSim.CAPS public void HandleRequest(Object stateinfo) { - // Console.WriteLine("new http incoming"); + // Console.WriteLine("new http incoming"); HttpListenerContext context = (HttpListenerContext)stateinfo; HttpListenerRequest request = context.Request; @@ -265,7 +270,7 @@ namespace OpenSim.CAPS response.AddHeader("Content-type", "text/html"); } break; - + } byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 811e8b8..ef82d98 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -124,6 +124,15 @@ namespace OpenSim } OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this); break; + case PacketType.AgentIsNowWearing: + AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; + //Console.WriteLine(Pack.ToString()); + break; + case PacketType.AgentSetAppearance: + AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; + // Console.WriteLine(appear.ToString()); + this.ClientAvatar.SetAppearance(appear); + break; case PacketType.ObjectAdd: OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this); break; @@ -279,7 +288,7 @@ namespace OpenSim break; case PacketType.AssetUploadRequest: - //this.debug = true; + this.debug = true; AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; // Console.WriteLine(Pack.ToString()); // if (request.AssetBlock.Type == 0) @@ -318,7 +327,6 @@ namespace OpenSim OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); break; case PacketType.UpdateInventoryItem: - /* UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; for (int i = 0; i < update.InventoryData.Length; i++) { @@ -338,7 +346,7 @@ namespace OpenSim } } } - }*/ + } break; case PacketType.ViewerEffect: ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index c8a4539..75f2cff 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs @@ -5,6 +5,7 @@ using System.Text; using libsecondlife; using libsecondlife.Packets; using OpenSim.Physics.Manager; +using OpenSim.Framework.Inventory; using Axiom.MathLib; namespace OpenSim.world @@ -25,6 +26,9 @@ namespace OpenSim.world private List forcesList = new List(); private short _updateCount = 0; private Axiom.MathLib.Quaternion bodyRot; + private LLObject.TextureEntry avatarAppearanceTexture = null; + private byte[] visualParams; + private AvatarWearable[] Wearables; private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); public Avatar(SimClient TheClient) @@ -34,6 +38,21 @@ namespace OpenSim.world localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); position = new LLVector3(100.0f, 100.0f, 30.0f); position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; + visualParams = new byte[218]; + for (int i = 0; i < 218; i++) + { + visualParams[i] = 100; + } + Wearables = new AvatarWearable[13]; //should be 13 of these + for (int i = 0; i < 13; i++) + { + Wearables[i] = new AvatarWearable(); + } + this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + this.Wearables[0].ItemID = LLUUID.Random(); + + this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + } public PhysicsActor PhysActor @@ -97,7 +116,6 @@ namespace OpenSim.world _updateCount++; if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) { - //Console.WriteLine("been a while since update so have one"); //It has been a while since last update was sent so lets send one. ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); @@ -119,6 +137,7 @@ namespace OpenSim.world } } + this.positionLastFrame = pos2; } public static void SetupTemplate(string name) @@ -204,18 +223,13 @@ namespace OpenSim.world aw.AgentData.SessionID = ControllingClient.SessionID; aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; - AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)0; - awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - awb.ItemID = LLUUID.Random(); - aw.WearableData[0] = awb; - - for (int i = 1; i < 13; i++) + AgentWearablesUpdatePacket.WearableDataBlock awb; + for (int i = 0; i < 13; i++) { awb = new AgentWearablesUpdatePacket.WearableDataBlock(); awb.WearableType = (byte)i; - awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); + awb.AssetID = this.Wearables[i].AssetID; + awb.ItemID = this.Wearables[i].ItemID; aw.WearableData[i] = awb; } @@ -253,14 +267,15 @@ namespace OpenSim.world avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); - LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); - avp.ObjectData.TextureEntry = ntex.ToBytes(); + //LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); + //avp.ObjectData.TextureEntry = ntex.ToBytes(); + avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); AvatarAppearancePacket.VisualParamBlock avblock = null; for (int i = 0; i < 218; i++) { avblock = new AvatarAppearancePacket.VisualParamBlock(); - avblock.ParamValue = (byte)100; + avblock.ParamValue = visualParams[i]; avp.VisualParam[i] = avblock; } @@ -269,6 +284,24 @@ namespace OpenSim.world userInfo.OutPacket(avp); } + public void SetAppearance(AgentSetAppearancePacket appear) + { + LLObject.TextureEntry tex = new LLObject.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); + this.avatarAppearanceTexture = tex; + for (int i = 0; i < appear.VisualParam.Length; i++) + { + this.visualParams[i] = appear.VisualParam[i].ParamValue; + } + + foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + { + if (client.AgentID != ControllingClient.AgentID) + { + SendAppearanceToOtherAgent(client); + } + } + } + public void HandleUpdate(AgentUpdatePacket pack) { @@ -479,7 +512,7 @@ namespace OpenSim.world int i = 0; ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - dat.TextureEntry = AvatarTemplate.TextureEntry; + dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); uint ID = this.localid; diff --git a/OpenSim/RegionServer.cs b/OpenSim/RegionServer.cs index 725a7cf..d6d0af9 100644 --- a/OpenSim/RegionServer.cs +++ b/OpenSim/RegionServer.cs @@ -40,11 +40,11 @@ namespace OpenSim OpenSim.world.Avatar.PhysicsEngineFlying = true; } if (args[i] == "-ode") - { - sim._physicsEngine = "OpenDynamicsEngine"; - OpenSim.world.Avatar.PhysicsEngineFlying = true; - } - } + { + sim._physicsEngine = "OpenDynamicsEngine"; + OpenSim.world.Avatar.PhysicsEngineFlying = true; + } + } OpenSimRoot.Instance.GridServers = new Grid(); -- cgit v1.1