aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorteravus2012-12-21 19:12:30 -0500
committerteravus2012-12-21 19:12:30 -0500
commit77cc7ce399d1b1a710f3b3f4337932febdef66c8 (patch)
treef121911c3679fea2065d519c879737200481616d /OpenSim/Region
parent* Send an Unsolicited AgentDataUpdate packet upon Root Agent Status to synchr... (diff)
downloadopensim-SC-77cc7ce399d1b1a710f3b3f4337932febdef66c8.zip
opensim-SC-77cc7ce399d1b1a710f3b3f4337932febdef66c8.tar.gz
opensim-SC-77cc7ce399d1b1a710f3b3f4337932febdef66c8.tar.bz2
opensim-SC-77cc7ce399d1b1a710f3b3f4337932febdef66c8.tar.xz
* Partial Commit for Avatar Appearance to include the functionality of Cached Bakes.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs27
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs2
7 files changed, 71 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 363ee54..d18b026 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -6298,12 +6298,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6298 byte[] visualparams = new byte[appear.VisualParam.Length]; 6298 byte[] visualparams = new byte[appear.VisualParam.Length];
6299 for (int i = 0; i < appear.VisualParam.Length; i++) 6299 for (int i = 0; i < appear.VisualParam.Length; i++)
6300 visualparams[i] = appear.VisualParam[i].ParamValue; 6300 visualparams[i] = appear.VisualParam[i].ParamValue;
6301 6301 //var b = appear.WearableData[0];
6302
6302 Primitive.TextureEntry te = null; 6303 Primitive.TextureEntry te = null;
6303 if (appear.ObjectData.TextureEntry.Length > 1) 6304 if (appear.ObjectData.TextureEntry.Length > 1)
6304 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 6305 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
6306
6307 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
6308 for (int i=0; i<appear.WearableData.Length;i++)
6309 cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)};
6305 6310
6306 handlerSetAppearance(sender, te, visualparams,avSize); 6311
6312
6313 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
6307 } 6314 }
6308 catch (Exception e) 6315 catch (Exception e)
6309 { 6316 {
@@ -11704,6 +11711,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11704 11711
11705 if (cachedtex.AgentData.SessionID != SessionId) 11712 if (cachedtex.AgentData.SessionID != SessionId)
11706 return false; 11713 return false;
11714
11707 11715
11708 // TODO: don't create new blocks if recycling an old packet 11716 // TODO: don't create new blocks if recycling an old packet
11709 cachedresp.AgentData.AgentID = AgentId; 11717 cachedresp.AgentData.AgentID = AgentId;
@@ -11713,6 +11721,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11713 cachedresp.WearableData = 11721 cachedresp.WearableData =
11714 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; 11722 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11715 11723
11724 //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
11725 // var item = fac.GetBakedTextureFaces(AgentId);
11726 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
11727
11716 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); 11728 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
11717 if (cache == null) 11729 if (cache == null)
11718 { 11730 {
@@ -11720,7 +11732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11720 { 11732 {
11721 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 11733 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11722 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 11734 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11723 cachedresp.WearableData[i].TextureID = UUID.Zero; 11735 cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11724 cachedresp.WearableData[i].HostName = new byte[0]; 11736 cachedresp.WearableData[i].HostName = new byte[0];
11725 } 11737 }
11726 } 11738 }
@@ -11730,10 +11742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11730 { 11742 {
11731 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 11743 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11732 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 11744 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11733 if(cache.Check(cachedtex.WearableData[i].ID.ToString())) 11745
11746
11747
11748 if (cache.Check(cachedtex.WearableData[i].ID.ToString()))
11734 cachedresp.WearableData[i].TextureID = UUID.Zero; 11749 cachedresp.WearableData[i].TextureID = UUID.Zero;
11750 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11735 else 11751 else
11736 cachedresp.WearableData[i].TextureID = UUID.Zero; 11752 cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11737 cachedresp.WearableData[i].HostName = new byte[0]; 11753 cachedresp.WearableData[i].HostName = new byte[0];
11738 } 11754 }
11739 } 11755 }
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 3532b1d..3080023 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -140,18 +140,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
140 /// <param name="sp"></param> 140 /// <param name="sp"></param>
141 /// <param name="texture"></param> 141 /// <param name="texture"></param>
142 /// <param name="visualParam"></param> 142 /// <param name="visualParam"></param>
143 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance) 143 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems)
144 { 144 {
145 SetAppearance(sp, appearance.Texture, appearance.VisualParams); 145 SetAppearance(sp, appearance.Texture, appearance.VisualParams, cacheItems);
146 } 146 }
147 147
148 148
149 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) 149 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
150 { 150 {
151 float oldoff = sp.Appearance.AvatarFeetOffset; 151 float oldoff = sp.Appearance.AvatarFeetOffset;
152 Vector3 oldbox = sp.Appearance.AvatarBoxSize; 152 Vector3 oldbox = sp.Appearance.AvatarBoxSize;
153 153
154 SetAppearance(sp, textureEntry, visualParams); 154 SetAppearance(sp, textureEntry, visualParams, cacheItems);
155 sp.Appearance.SetSize(avSize); 155 sp.Appearance.SetSize(avSize);
156 156
157 float off = sp.Appearance.AvatarFeetOffset; 157 float off = sp.Appearance.AvatarFeetOffset;
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
166 /// <param name="sp"></param> 166 /// <param name="sp"></param>
167 /// <param name="texture"></param> 167 /// <param name="texture"></param>
168 /// <param name="visualParam"></param> 168 /// <param name="visualParam"></param>
169 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams) 169 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems)
170 { 170 {
171// m_log.DebugFormat( 171// m_log.DebugFormat(
172// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}", 172// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}",
@@ -205,11 +205,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
205// ((ScenePresence)sp).SetSize(box,off); 205// ((ScenePresence)sp).SetSize(box,off);
206 206
207 } 207 }
208 208 //if (cacheItems.Length > 0)
209 //{
210 sp.Appearance.WearableCacheItems = cacheItems;
211 //}
209 // Process the baked texture array 212 // Process the baked texture array
210 if (textureEntry != null) 213 if (textureEntry != null)
211 { 214 {
212// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); 215 m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
213 216
214// WriteBakedTexturesReport(sp, m_log.DebugFormat); 217// WriteBakedTexturesReport(sp, m_log.DebugFormat);
215 218
@@ -278,6 +281,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
278 return GetBakedTextureFaces(sp); 281 return GetBakedTextureFaces(sp);
279 } 282 }
280 283
284 public WearableCacheItem[] GetCachedItems(UUID agentId)
285 {
286 ScenePresence sp = m_scene.GetScenePresence(agentId);
287 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp);
288
289 WearableCacheItem[] items = sp.Appearance.WearableCacheItems;
290 //foreach (WearableCacheItem item in items)
291 //{
292
293 //}
294 return items;
295 }
296
281 public bool SaveBakedTextures(UUID agentId) 297 public bool SaveBakedTextures(UUID agentId)
282 { 298 {
283 ScenePresence sp = m_scene.GetScenePresence(agentId); 299 ScenePresence sp = m_scene.GetScenePresence(agentId);
@@ -660,12 +676,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
660 /// <param name="client"></param> 676 /// <param name="client"></param>
661 /// <param name="texture"></param> 677 /// <param name="texture"></param>
662 /// <param name="visualParam"></param> 678 /// <param name="visualParam"></param>
663 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) 679 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
664 { 680 {
665 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); 681 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
666 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 682 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
667 if (sp != null) 683 if (sp != null)
668 SetAppearance(sp, textureEntry, visualParams,avSize); 684 SetAppearance(sp, textureEntry, visualParams,avSize, cacheItems);
669 else 685 else
670 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); 686 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
671 } 687 }
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index 848b3bf..e21547c 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
61 for (byte i = 0; i < visualParams.Length; i++) 61 for (byte i = 0; i < visualParams.Length; i++)
62 visualParams[i] = i; 62 visualParams[i] = i;
63 63
64 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); 64 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]);
65 65
66 // TODO: Check baked texture 66 // TODO: Check baked texture
67 Assert.AreEqual(visualParams, sp.Appearance.VisualParams); 67 Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
102 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); 102 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
103 eyesFace.TextureID = eyesTextureId; 103 eyesFace.TextureID = eyesTextureId;
104 104
105 afm.SetAppearance(sp, bakedTextureEntry, visualParams); 105 afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]);
106 afm.SaveBakedTextures(userId); 106 afm.SaveBakedTextures(userId);
107// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId); 107// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);
108 108
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 34aca33..d25c930 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IAvatarFactoryModule 36 public interface IAvatarFactoryModule
37 { 37 {
38 void SetAppearance(IScenePresence sp, AvatarAppearance appearance); 38 void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems);
39 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 39 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems);
40 40
41 /// <summary> 41 /// <summary>
42 /// Send the appearance of an avatar to others in the scene. 42 /// Send the appearance of an avatar to others in the scene.
@@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Interfaces
52 /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns> 52 /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns>
53 Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId); 53 Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId);
54 54
55
56 WearableCacheItem[] GetCachedItems(UUID agentId);
55 /// <summary> 57 /// <summary>
56 /// Save the baked textures for the given agent permanently in the asset database. 58 /// Save the baked textures for the given agent permanently in the asset database.
57 /// </summary> 59 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 70e7af5..ff9df37 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -931,18 +931,25 @@ namespace OpenSim.Region.Framework.Scenes
931 931
932 // ---------------------------------- 932 // ----------------------------------
933 // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status 933 // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
934 if (gm != null) 934 try
935 {
936 if (gm != null)
937 {
938 groupUUID = ControllingClient.ActiveGroupId;
939 GroupRecord record = gm.GetGroupRecord(groupUUID);
940 if (record != null)
941 GroupName = record.GroupName;
942 GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
943 if (groupMembershipData != null)
944 groupPowers = groupMembershipData.GroupPowers;
945 }
946 ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName,
947 Grouptitle);
948 }
949 catch (Exception e)
935 { 950 {
936 groupUUID = ControllingClient.ActiveGroupId; 951 m_log.Debug("[AGENTUPDATE]: " + e.ToString());
937 GroupRecord record = gm.GetGroupRecord(groupUUID);
938 if (record != null)
939 GroupName = record.GroupName;
940 GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
941 if (groupMembershipData != null)
942 groupPowers = groupMembershipData.GroupPowers;
943 } 952 }
944 ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName,
945 Grouptitle);
946 // ------------------------------------ 953 // ------------------------------------
947 954
948 if (ParentID == 0) 955 if (ParentID == 0)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 1b4ed1e..5ac4e27 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -911,7 +911,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
911 // Mimicking LLClientView which gets always set appearance from client. 911 // Mimicking LLClientView which gets always set appearance from client.
912 AvatarAppearance appearance; 912 AvatarAppearance appearance;
913 m_scene.GetAvatarAppearance(this, out appearance); 913 m_scene.GetAvatarAppearance(this, out appearance);
914 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize); 914 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize, new WearableCacheItem[0]);
915 } 915 }
916 916
917 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) 917 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 52ed846..ef4005b 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
108 // ScenePresence.SendInitialData() to reset our entire appearance. 108 // ScenePresence.SendInitialData() to reset our entire appearance.
109 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); 109 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
110 110
111 m_afMod.SetAppearance(sp, originalTe, null); 111 m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] );
112 112
113 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); 113 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
114 114