aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSean Dague2008-05-17 12:45:43 +0000
committerSean Dague2008-05-17 12:45:43 +0000
commit06b1535ec5054068e65a085fabd25680d145594c (patch)
tree96f364dc52f998d90592276ee0b93b8f80665a4b /OpenSim/Region
parent0001303: [PATCH] Make prim owner and data show for prims not owned. From Mel... (diff)
downloadopensim-SC-06b1535ec5054068e65a085fabd25680d145594c.zip
opensim-SC-06b1535ec5054068e65a085fabd25680d145594c.tar.gz
opensim-SC-06b1535ec5054068e65a085fabd25680d145594c.tar.bz2
opensim-SC-06b1535ec5054068e65a085fabd25680d145594c.tar.xz
while this doesn't fix the initial no pants issue in grid (which still baffles me)
it does make setting appearance in grid stick.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs22
-rw-r--r--OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs69
3 files changed, 73 insertions, 51 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bc80915..a798f40 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1779,29 +1779,28 @@ namespace OpenSim.Region.Environment.Scenes
1779 1779
1780 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 1780 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
1781 { 1781 {
1782 AvatarAppearance appearance; 1782 AvatarAppearance appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
1783 GetAvatarAppearance(client, out appearance);
1784 1783
1785 ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance); 1784 ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
1786 1785
1787 return avatar; 1786 return avatar;
1788 } 1787 }
1789 1788
1790 protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) 1789 // protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
1791 { 1790 // {
1792 appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); 1791 // appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
1793 1792
1794 // if (m_AvatarFactory == null || 1793 // // if (m_AvatarFactory == null ||
1795 // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) 1794 // // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
1796 // { 1795 // // {
1797 // //not found Appearance 1796 // // //not found Appearance
1798 // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); 1797 // // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
1799 // byte[] visualParams; 1798 // // byte[] visualParams;
1800 // AvatarWearable[] wearables; 1799 // // AvatarWearable[] wearables;
1801 // GetDefaultAvatarAppearance(out wearables, out visualParams); 1800 // // GetDefaultAvatarAppearance(out wearables, out visualParams);
1802 // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams); 1801 // // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams);
1803 // } 1802 // // }
1804 } 1803 // }
1805 1804
1806 /// <summary> 1805 /// <summary>
1807 /// Remove the given client from the scene. 1806 /// Remove the given client from the scene.
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 6977083..5221914 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1452,13 +1452,8 @@ namespace OpenSim.Region.Environment.Scenes
1452 /// </summary> 1452 /// </summary>
1453 public void SendInitialData() 1453 public void SendInitialData()
1454 { 1454 {
1455 // justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode
1456 LLObject.TextureEntry texture = AvatarAppearance.GetDefaultTexture();
1457 if (null != m_appearance)
1458 texture = m_appearance.Texture;
1459
1460 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, 1455 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
1461 m_pos, texture.ToBytes(), m_parentID); 1456 m_pos, m_appearance.Texture.ToBytes(), m_parentID);
1462 1457
1463 if (!m_isChildAgent) 1458 if (!m_isChildAgent)
1464 { 1459 {
@@ -1467,11 +1462,14 @@ namespace OpenSim.Region.Environment.Scenes
1467 1462
1468 SendFullUpdateToAllClients(); 1463 SendFullUpdateToAllClients();
1469 SendAppearanceToAllOtherAgents(); 1464 SendAppearanceToAllOtherAgents();
1465 // This is probably egregious
1466 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
1470 } 1467 }
1471 1468
1472 1469
1473 public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) 1470 public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
1474 { 1471 {
1472 m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable");
1475 m_appearance.SetWearable(wearableId, wearable); 1473 m_appearance.SetWearable(wearableId, wearable);
1476 m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); 1474 m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance);
1477 client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 1475 client.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
@@ -1483,6 +1481,7 @@ namespace OpenSim.Region.Environment.Scenes
1483 /// <param name="client"></param> 1481 /// <param name="client"></param>
1484 public void SendOwnAppearance() 1482 public void SendOwnAppearance()
1485 { 1483 {
1484 m_log.Info("[APPEARANCE] Sending Own Appearace");
1486 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 1485 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
1487 } 1486 }
1488 1487
@@ -1514,19 +1513,30 @@ namespace OpenSim.Region.Environment.Scenes
1514 1513
1515 public void SetAppearance(byte[] texture, List<byte> visualParam) 1514 public void SetAppearance(byte[] texture, List<byte> visualParam)
1516 { 1515 {
1516 m_log.Warn("[APPEARANCE] Setting Appearance");
1517 m_appearance.SetAppearance(texture, visualParam); 1517 m_appearance.SetAppearance(texture, visualParam);
1518 SetHeight(m_appearance.AvatarHeight); 1518 SetHeight(m_appearance.AvatarHeight);
1519 m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 1519 m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
1520 1520
1521 SendAppearanceToAllOtherAgents(); 1521 SendAppearanceToAllOtherAgents();
1522 SendOwnAppearance();
1522 } 1523 }
1523 1524
1524 public void SetWearable(int wearableId, AvatarWearable wearable) 1525 public void SetWearable(int wearableId, AvatarWearable wearable)
1525 { 1526 {
1527 m_log.Warn("[APPEARANCE] Setting Wearable");
1526 m_appearance.SetWearable(wearableId, wearable); 1528 m_appearance.SetWearable(wearableId, wearable);
1527 m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 1529 m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
1528 } 1530 }
1529 1531
1532 // Because appearance setting is in a module, we actually need
1533 // to give it access to our appearance directly, otherwise we
1534 // get a synchronization issue.
1535 public AvatarAppearance Appearance {
1536 get { return m_appearance; }
1537 set { m_appearance = value; }
1538 }
1539
1530 /// <summary> 1540 /// <summary>
1531 /// 1541 ///
1532 /// </summary> 1542 /// </summary>
diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
index bac2252..f5e0ca2 100644
--- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
@@ -27,8 +27,11 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31
30using System.Threading; 32using System.Threading;
31using libsecondlife; 33using libsecondlife;
34using log4net;
32using Nini.Config; 35using Nini.Config;
33using OpenSim.Data.Base; 36using OpenSim.Data.Base;
34using OpenSim.Data.MapperFactory; 37using OpenSim.Data.MapperFactory;
@@ -41,6 +44,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
41{ 44{
42 public class AvatarFactoryModule : IAvatarFactory, IRegionModule 45 public class AvatarFactoryModule : IAvatarFactory, IRegionModule
43 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private Scene m_scene = null; 48 private Scene m_scene = null;
45 private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>(); 49 private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
46 50
@@ -215,31 +219,31 @@ namespace OpenSim.Region.Modules.AvatarFactory
215 m_scene = scene; 219 m_scene = scene;
216 } 220 }
217 221
218 if (!m_configured) 222 // if (!m_configured)
219 { 223 // {
220 m_configured = true; 224 // m_configured = true;
221 try 225 // try
222 { 226 // {
223 m_enablePersist = source.Configs["Startup"].GetBoolean("appearance_persist", false); 227 // m_enablePersist = source.Configs["Startup"].GetBoolean("appearance_persist", false);
224 } 228 // }
225 catch (Exception) 229 // catch (Exception)
226 { 230 // {
227 } 231 // }
228 if (m_enablePersist) 232 // if (m_enablePersist)
229 { 233 // {
230 m_connectionString = source.Configs["Startup"].GetString("appearance_connection_string", ""); 234 // m_connectionString = source.Configs["Startup"].GetString("appearance_connection_string", "");
231 235
232 string mapperTypeStr = source.Configs["Startup"].GetString("appearance_database", "MySQL"); 236 // string mapperTypeStr = source.Configs["Startup"].GetString("appearance_database", "MySQL");
233 237
234 DataMapperFactory.MAPPER_TYPE mapperType = 238 // DataMapperFactory.MAPPER_TYPE mapperType =
235 (DataMapperFactory.MAPPER_TYPE) 239 // (DataMapperFactory.MAPPER_TYPE)
236 Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr); 240 // Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr);
237 241
238 m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectionString); 242 // m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectionString);
239 243
240 m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance"); 244 // m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
241 } 245 // }
242 } 246 // }
243 } 247 }
244 248
245 public void PostInitialise() 249 public void PostInitialise()
@@ -273,13 +277,14 @@ namespace OpenSim.Region.Modules.AvatarFactory
273 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 277 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
274 { 278 {
275 IClientAPI clientView = (IClientAPI)sender; 279 IClientAPI clientView = (IClientAPI)sender;
280 ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId);
276 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); 281 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
277 AvatarAppearance avatAppearance = m_scene.CommsManager.UserService.GetUserAppearance(clientView.AgentId); 282 AvatarAppearance avatAppearance = avatar.Appearance;
283 m_log.Info("Calling Avatar is Wearing");
278 if (profile != null) 284 if (profile != null)
279 { 285 {
280 if (profile.RootFolder != null) 286 if (profile.RootFolder != null)
281 { 287 {
282
283 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 288 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
284 { 289 {
285 if (wear.Type < 13) 290 if (wear.Type < 13)
@@ -292,7 +297,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
292 else 297 else
293 { 298 {
294 LLUUID assetId; 299 LLUUID assetId;
295 300
296 InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID); 301 InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID);
297 302
298 if (baseItem != null) 303 if (baseItem != null)
@@ -301,10 +306,18 @@ namespace OpenSim.Region.Modules.AvatarFactory
301 avatAppearance.Wearables[wear.Type].AssetID = assetId; 306 avatAppearance.Wearables[wear.Type].AssetID = assetId;
302 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; 307 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
303 } 308 }
309 else
310 {
311 m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID);
312 }
304 } 313 }
305 } 314 }
306 } 315 }
307 m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); 316 m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
317 }
318 else
319 {
320 m_log.Error("Root Profile is null, we can't set the appearance");
308 } 321 }
309 } 322 }
310 } 323 }