aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-12-02 14:56:23 +0000
committerMW2007-12-02 14:56:23 +0000
commitcac98171e5143dbcd37acca00a9e4ed87ec4e477 (patch)
tree5df6b0bc82d928f318b5c988765b5fadf7b2998f
parentFixes a bug that my last commit introduced. (diff)
downloadopensim-SC-cac98171e5143dbcd37acca00a9e4ed87ec4e477.zip
opensim-SC-cac98171e5143dbcd37acca00a9e4ed87ec4e477.tar.gz
opensim-SC-cac98171e5143dbcd37acca00a9e4ed87ec4e477.tar.bz2
opensim-SC-cac98171e5143dbcd37acca00a9e4ed87ec4e477.tar.xz
Very partial Avatar Appearance (ie, clothes/body parts) "storage". In standalone mode it will mean that when you log off and log back on ,as long as the region server hasn't been restarted , your avatar will start with wearing the clothes that it wore on log off. In grid mode its even more limited in that wearing/removing clothes/body parts are only stored in the region server instance you are one. so if you are in a different region to your login region (which are on different region server instances), and then change clothes, those changes won't be remembered. So as said, its very limited but is a small step towards having proper appearance persist.
Just need to store this data out to a database.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactions.cs2
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs99
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
5 files changed, 104 insertions, 41 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
index acd57b6..f7e80c9 100644
--- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
@@ -333,7 +333,7 @@ namespace OpenSim.Framework.Communications.Cache
333 //really need to fix this call, if lbsa71 saw this he would die. 333 //really need to fix this call, if lbsa71 saw this he would die.
334 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset); 334 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
335 CachedUserInfo userInfo = 335 CachedUserInfo userInfo =
336 m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); 336 m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
337 if (userInfo != null) 337 if (userInfo != null)
338 { 338 {
339 InventoryItemBase item = new InventoryItemBase(); 339 InventoryItemBase item = new InventoryItemBase();
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index d4ddead..bfdd118 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -64,11 +64,11 @@ namespace OpenSim.Framework.Communications
64 get { return m_interRegion; } 64 get { return m_interRegion; }
65 } 65 }
66 66
67 protected UserProfileCacheService m_userProfileCache; 67 protected UserProfileCacheService m_userProfileCacheService;
68 68
69 public UserProfileCacheService UserProfileCache 69 public UserProfileCacheService UserProfileCacheService
70 { 70 {
71 get { return m_userProfileCache; } 71 get { return m_userProfileCacheService; }
72 } 72 }
73 73
74 protected AssetTransactionManager m_transactionsManager; 74 protected AssetTransactionManager m_transactionsManager;
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications
97 { 97 {
98 m_networkServersInfo = serversInfo; 98 m_networkServersInfo = serversInfo;
99 m_assetCache = assetCache; 99 m_assetCache = assetCache;
100 m_userProfileCache = new UserProfileCacheService(this); 100 m_userProfileCacheService = new UserProfileCacheService(this);
101 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile); 101 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
102 } 102 }
103 103
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Communications
156 156
157 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) 157 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
158 { 158 {
159 if (uuid == m_userProfileCache.libraryRoot.agentID) 159 if (uuid == m_userProfileCacheService.libraryRoot.agentID)
160 { 160 {
161 remote_client.SendNameReply(uuid, "Mr", "OpenSim"); 161 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
162 } 162 }
@@ -175,11 +175,7 @@ namespace OpenSim.Framework.Communications
175 } 175 }
176 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) 176 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
177 { 177 {
178 178 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
179
180 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
181
182
183 return pickerlist; 179 return pickerlist;
184 } 180 }
185 181
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 820a26b..b6c373c 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -1,5 +1,6 @@
1using System; 1using System;
2using libsecondlife; 2using libsecondlife;
3using System.Collections.Generic;
3using Nini.Config; 4using Nini.Config;
4using OpenSim.Framework; 5using OpenSim.Framework;
5using OpenSim.Framework.Communications.Cache; 6using OpenSim.Framework.Communications.Cache;
@@ -11,18 +12,30 @@ namespace OpenSim.Region.Environment.Modules
11 public class AvatarFactoryModule : IAvatarFactory 12 public class AvatarFactoryModule : IAvatarFactory
12 { 13 {
13 private Scene m_scene = null; 14 private Scene m_scene = null;
15 private Dictionary<LLUUID, AvatarWearing> m_avatarsClothes = new Dictionary<LLUUID, AvatarWearing>();
14 16
15 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, 17 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
16 out byte[] visualParams) 18 out byte[] visualParams)
17 { 19 {
18 GetDefaultAvatarAppearance(out wearables, out visualParams); 20 if (!m_avatarsClothes.ContainsKey(avatarId))
19 return true; 21 {
22 GetDefaultAvatarAppearance(out wearables, out visualParams);
23 AvatarWearing wearing = new AvatarWearing(wearables);
24 m_avatarsClothes[avatarId] = wearing;
25 return true;
26 }
27 else
28 {
29 visualParams = SetDefaultVisualParams();
30 wearables = m_avatarsClothes[avatarId].IsWearing;
31 return true;
32 }
20 } 33 }
21 34
22 public void Initialise(Scene scene, IConfigSource source) 35 public void Initialise(Scene scene, IConfigSource source)
23 { 36 {
24 scene.RegisterModuleInterface<IAvatarFactory>(this); 37 scene.RegisterModuleInterface<IAvatarFactory>(this);
25 // scene.EventManager.OnNewClient += NewClient; 38 scene.EventManager.OnNewClient += NewClient;
26 39
27 if (m_scene == null) 40 if (m_scene == null)
28 { 41 {
@@ -50,43 +63,97 @@ namespace OpenSim.Region.Environment.Modules
50 63
51 public void NewClient(IClientAPI client) 64 public void NewClient(IClientAPI client)
52 { 65 {
53 // client.OnAvatarNowWearing += AvatarIsWearing; 66 client.OnAvatarNowWearing += AvatarIsWearing;
54 } 67 }
55 68
56 public void RemoveClient(IClientAPI client) 69 public void RemoveClient(IClientAPI client)
57 { 70 {
58 // client.OnAvatarNowWearing -= AvatarIsWearing; 71 // client.OnAvatarNowWearing -= AvatarIsWearing;
59 } 72 }
60 73
61 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 74 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
62 { 75 {
63 IClientAPI clientView = (IClientAPI) sender; 76 IClientAPI clientView = (IClientAPI)sender;
64 //Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs 77 //Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
65 // then store assetid and itemId and wearable type in a database 78 // then store assetid and itemId and wearable type in a database
66 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 79 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
67 {
68 LLUUID assetId;
69 CachedUserInfo profile = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId);
70 if (profile != null)
71 { 80 {
72 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); 81 if (wear.Type < 13)
73 if (baseItem != null)
74 { 82 {
75 assetId = baseItem.assetID; 83 LLUUID assetId;
84 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
85 if (profile != null)
86 {
87 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID);
88 if (baseItem != null)
89 {
90 assetId = baseItem.assetID;
91 //Tempoaray dictionary storage. This is be storing to a database
92 if (m_avatarsClothes.ContainsKey(clientView.AgentId))
93 {
94 AvatarWearing avWearing = m_avatarsClothes[clientView.AgentId];
95 avWearing.IsWearing[wear.Type].AssetID = assetId;
96 avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
97 }
98 }
99 }
76 } 100 }
77 } 101 }
78 }
79 } 102 }
80 103
81 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 104 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
82 { 105 {
106 visualParams = SetDefaultVisualParams();
107
108 wearables = AvatarWearable.DefaultWearables;
109 }
110
111 private static byte[] SetDefaultVisualParams()
112 {
113 byte[] visualParams;
83 visualParams = new byte[218]; 114 visualParams = new byte[218];
84 for (int i = 0; i < 218; i++) 115 for (int i = 0; i < 218; i++)
85 { 116 {
86 visualParams[i] = 100; 117 visualParams[i] = 100;
87 } 118 }
119 return visualParams;
120 }
88 121
89 wearables = AvatarWearable.DefaultWearables; 122 public class AvatarWearing
123 {
124 public AvatarWearable[] IsWearing;
125
126 public AvatarWearing()
127 {
128 IsWearing = new AvatarWearable[13];
129 for (int i = 0; i < 13; i++)
130 {
131 IsWearing[i] = new AvatarWearable();
132 }
133 }
134
135 public AvatarWearing(AvatarWearable[] wearing)
136 {
137 if (wearing.Length == 13)
138 {
139 IsWearing = new AvatarWearable[13];
140 for (int i = 0; i < 13; i++)
141 {
142 IsWearing[i] = new AvatarWearable();
143 IsWearing[i].AssetID = wearing[i].AssetID;
144 IsWearing[i].ItemID = wearing[i].ItemID;
145 }
146 }
147 else
148 {
149 IsWearing = new AvatarWearable[13];
150 for (int i = 0; i < 13; i++)
151 {
152 IsWearing[i] = new AvatarWearable();
153 }
154 }
155 }
90 } 156 }
91 } 157 }
158
92} \ No newline at end of file 159} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 759d070..6370bcb 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
53 53
54 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 54 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
55 { 55 {
56 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 56 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
57 if (userInfo != null) 57 if (userInfo != null)
58 { 58 {
59 userInfo.AddItem(remoteClient.AgentId, item); 59 userInfo.AddItem(remoteClient.AgentId, item);
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
75 75
76 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) 76 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
77 { 77 {
78 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 78 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
79 if (userInfo != null) 79 if (userInfo != null)
80 { 80 {
81 if (userInfo.RootFolder != null) 81 if (userInfo.RootFolder != null)
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Scenes
109 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, 109 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
110 LLUUID itemID) 110 LLUUID itemID)
111 { 111 {
112 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 112 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
113 if (userInfo != null) 113 if (userInfo != null)
114 { 114 {
115 if (userInfo.RootFolder != null) 115 if (userInfo.RootFolder != null)
@@ -157,10 +157,10 @@ namespace OpenSim.Region.Environment.Scenes
157 157
158 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName) 158 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName)
159 { 159 {
160 InventoryItemBase item = CommsManager.UserProfileCache.libraryRoot.HasItem(oldItemID); 160 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID);
161 if (item == null) 161 if (item == null)
162 { 162 {
163 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(oldAgentID); 163 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
164 if (userInfo == null) 164 if (userInfo == null)
165 { 165 {
166 MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString()); 166 MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString());
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
212 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, 212 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
213 AssetBase asset, uint nextOwnerMask) 213 AssetBase asset, uint nextOwnerMask)
214 { 214 {
215 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 215 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
216 if (userInfo != null) 216 if (userInfo != null)
217 { 217 {
218 InventoryItemBase item = new InventoryItemBase(); 218 InventoryItemBase item = new InventoryItemBase();
@@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes
252 { 252 {
253 if (transActionID == LLUUID.Zero) 253 if (transActionID == LLUUID.Zero)
254 { 254 {
255 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 255 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
256 if (userInfo != null) 256 if (userInfo != null)
257 { 257 {
258 AssetBase asset = CreateAsset(name, description, invType, assetType, null); 258 AssetBase asset = CreateAsset(name, description, invType, assetType, null);
@@ -320,7 +320,7 @@ namespace OpenSim.Region.Environment.Scenes
320 320
321 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) 321 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
322 { 322 {
323 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 323 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
324 LLUUID copyID = LLUUID.Random(); 324 LLUUID copyID = LLUUID.Random();
325 if (userInfo != null) 325 if (userInfo != null)
326 { 326 {
@@ -398,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
398 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) 398 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
399 { 399 {
400 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); 400 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
401 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 401 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
402 if (userInfo != null) 402 if (userInfo != null)
403 { 403 {
404 AssetBase asset = CreateAsset( 404 AssetBase asset = CreateAsset(
@@ -454,7 +454,7 @@ namespace OpenSim.Region.Environment.Scenes
454 454
455 public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 455 public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
456 { 456 {
457 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 457 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
458 if (userInfo != null) 458 if (userInfo != null)
459 { 459 {
460 if (userInfo.RootFolder != null) 460 if (userInfo.RootFolder != null)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ade0e35..19e0064 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -949,7 +949,7 @@ namespace OpenSim.Region.Environment.Scenes
949 CreateAndAddScenePresence(client, child); 949 CreateAndAddScenePresence(client, child);
950 950
951 m_LandManager.sendParcelOverlay(client); 951 m_LandManager.sendParcelOverlay(client);
952 CommsManager.UserProfileCache.AddNewUser(client.AgentId); 952 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
953 CommsManager.TransactionsManager.AddUser(client.AgentId); 953 CommsManager.TransactionsManager.AddUser(client.AgentId);
954 } 954 }
955 955
@@ -999,10 +999,10 @@ namespace OpenSim.Region.Environment.Scenes
999 client.OnGodKickUser += handleGodlikeKickUser; 999 client.OnGodKickUser += handleGodlikeKickUser;
1000 1000
1001 client.OnCreateNewInventoryItem += CreateNewInventoryItem; 1001 client.OnCreateNewInventoryItem += CreateNewInventoryItem;
1002 client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder; 1002 client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder;
1003 client.OnFetchInventoryDescendents += CommsManager.UserProfileCache.HandleFecthInventoryDescendents; 1003 client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFecthInventoryDescendents;
1004 client.OnRequestTaskInventory += RequestTaskInventory; 1004 client.OnRequestTaskInventory += RequestTaskInventory;
1005 client.OnFetchInventory += CommsManager.UserProfileCache.HandleFetchInventory; 1005 client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory;
1006 client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset; 1006 client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset;
1007 client.OnCopyInventoryItem += CopyInventoryItem; 1007 client.OnCopyInventoryItem += CopyInventoryItem;
1008 client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; 1008 client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;