diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | 16 |
2 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 67256ee..0826a08 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
75 | m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); | 75 | m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); |
76 | m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); | 76 | m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); |
77 | m_reusetextures = appearanceConfig.GetBoolean("ReuseTextures",m_reusetextures); | 77 | m_reusetextures = appearanceConfig.GetBoolean("ReuseTextures",m_reusetextures); |
78 | 78 | ||
79 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); | 79 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); |
80 | } | 80 | } |
81 | 81 | ||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Set appearance data (texture asset IDs and slider settings) | 169 | /// Set appearance data (texture asset IDs and slider settings) |
170 | /// </summary> | 170 | /// </summary> |
171 | /// <param name="sp"></param> | 171 | /// <param name="sp"></param> |
172 | /// <param name="texture"></param> | 172 | /// <param name="texture"></param> |
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
190 | { | 190 | { |
191 | changed = sp.Appearance.SetVisualParams(visualParams); | 191 | changed = sp.Appearance.SetVisualParams(visualParams); |
192 | } | 192 | } |
193 | 193 | ||
194 | // Process the baked texture array | 194 | // Process the baked texture array |
195 | if (textureEntry != null) | 195 | if (textureEntry != null) |
196 | { | 196 | { |
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
267 | WearableCacheItem[] items = sp.Appearance.WearableCacheItems; | 267 | WearableCacheItem[] items = sp.Appearance.WearableCacheItems; |
268 | //foreach (WearableCacheItem item in items) | 268 | //foreach (WearableCacheItem item in items) |
269 | //{ | 269 | //{ |
270 | 270 | ||
271 | //} | 271 | //} |
272 | return items; | 272 | return items; |
273 | } | 273 | } |
@@ -468,7 +468,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
468 | } | 468 | } |
469 | 469 | ||
470 | sp.Appearance.WearableCacheItems = wearableCache; | 470 | sp.Appearance.WearableCacheItems = wearableCache; |
471 | 471 | ||
472 | if (missing.Count > 0) | 472 | if (missing.Count > 0) |
473 | { | 473 | { |
474 | foreach (UUID id in missing) | 474 | foreach (UUID id in missing) |
@@ -493,7 +493,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
493 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) | 493 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) |
494 | { | 494 | { |
495 | int j = AvatarAppearance.BAKE_INDICES[iter]; | 495 | int j = AvatarAppearance.BAKE_INDICES[iter]; |
496 | m_log.Debug("[UpdateBCache] {" + iter + "/" + | 496 | m_log.Debug("[UpdateBCache] {" + iter + "/" + |
497 | sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + | 497 | sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + |
498 | sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + | 498 | sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + |
499 | sp.Appearance.WearableCacheItems[j].TextureID); | 499 | sp.Appearance.WearableCacheItems[j].TextureID); |
@@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
588 | wearableCacheValid = false; | 588 | wearableCacheValid = false; |
589 | } | 589 | } |
590 | } | 590 | } |
591 | 591 | ||
592 | wearableCacheValid = (wearableCacheValid && (hits >= AvatarAppearance.BAKE_INDICES.Length - 1)); | 592 | wearableCacheValid = (wearableCacheValid && (hits >= AvatarAppearance.BAKE_INDICES.Length - 1)); |
593 | if (wearableCacheValid) | 593 | if (wearableCacheValid) |
594 | m_log.Debug("[ValidateBakedCache] have valid local cache"); | 594 | m_log.Debug("[ValidateBakedCache] have valid local cache"); |
@@ -601,7 +601,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
601 | if (!wearableCacheValid) | 601 | if (!wearableCacheValid) |
602 | { | 602 | { |
603 | hits = 0; | 603 | hits = 0; |
604 | // only use external bake module on login condition check | 604 | // only use external bake module on login condition check |
605 | // ScenePresence ssp = null; | 605 | // ScenePresence ssp = null; |
606 | // if (sp is ScenePresence) | 606 | // if (sp is ScenePresence) |
607 | { | 607 | { |
@@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
816 | foreach (KeyValuePair<UUID, long> kvp in saves) | 816 | foreach (KeyValuePair<UUID, long> kvp in saves) |
817 | { | 817 | { |
818 | // We have to load the key and value into local parameters to avoid a race condition if we loop | 818 | // We have to load the key and value into local parameters to avoid a race condition if we loop |
819 | // around and load kvp with a different value before FireAndForget has launched its thread. | 819 | // around and load kvp with a different value before FireAndForget has launched its thread. |
820 | UUID avatarID = kvp.Key; | 820 | UUID avatarID = kvp.Key; |
821 | long sendTime = kvp.Value; | 821 | long sendTime = kvp.Value; |
822 | 822 | ||
@@ -869,13 +869,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
869 | 869 | ||
870 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); | 870 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); |
871 | 871 | ||
872 | // Trigger this here because it's the final step in the set/queue/save process for appearance setting. | 872 | // Trigger this here because it's the final step in the set/queue/save process for appearance setting. |
873 | // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes). | 873 | // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes). |
874 | m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); | 874 | m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); |
875 | } | 875 | } |
876 | 876 | ||
877 | /// <summary> | 877 | /// <summary> |
878 | /// For a given set of appearance items, check whether the items are valid and add their asset IDs to | 878 | /// For a given set of appearance items, check whether the items are valid and add their asset IDs to |
879 | /// appearance data. | 879 | /// appearance data. |
880 | /// </summary> | 880 | /// </summary> |
881 | /// <param name='userID'></param> | 881 | /// <param name='userID'></param> |
@@ -893,7 +893,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
893 | if (appearance.Wearables[i][j].ItemID == UUID.Zero) | 893 | if (appearance.Wearables[i][j].ItemID == UUID.Zero) |
894 | { | 894 | { |
895 | m_log.WarnFormat( | 895 | m_log.WarnFormat( |
896 | "[AVFACTORY]: Wearable item {0}:{1} for user {2} unexpectedly UUID.Zero. Ignoring.", | 896 | "[AVFACTORY]: Wearable item {0}:{1} for user {2} unexpectedly UUID.Zero. Ignoring.", |
897 | i, j, userID); | 897 | i, j, userID); |
898 | 898 | ||
899 | continue; | 899 | continue; |
@@ -967,7 +967,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
967 | // case WearableType.Skin: | 967 | // case WearableType.Skin: |
968 | // //case WearableType.Underpants: | 968 | // //case WearableType.Underpants: |
969 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | 969 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); |
970 | // | 970 | // |
971 | // m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); | 971 | // m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); |
972 | // resetwearable = true; | 972 | // resetwearable = true; |
973 | // break; | 973 | // break; |
@@ -975,7 +975,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
975 | // } | 975 | // } |
976 | // continue; | 976 | // continue; |
977 | // } | 977 | // } |
978 | // | 978 | // |
979 | // InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); | 979 | // InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); |
980 | // baseItem = invService.GetItem(baseItem); | 980 | // baseItem = invService.GetItem(baseItem); |
981 | // | 981 | // |
@@ -1002,7 +1002,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1002 | // | 1002 | // |
1003 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | 1003 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); |
1004 | // resetwearable = true; | 1004 | // resetwearable = true; |
1005 | // | 1005 | // |
1006 | // } | 1006 | // } |
1007 | // } | 1007 | // } |
1008 | // } | 1008 | // } |
@@ -1011,7 +1011,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1011 | // if (appearance.Wearables[(int) WearableType.Eyes] == null) | 1011 | // if (appearance.Wearables[(int) WearableType.Eyes] == null) |
1012 | // { | 1012 | // { |
1013 | // m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); | 1013 | // m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); |
1014 | // | 1014 | // |
1015 | // TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); | 1015 | // TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); |
1016 | // resetwearable = true; | 1016 | // resetwearable = true; |
1017 | // } | 1017 | // } |
@@ -1213,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1213 | m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); | 1213 | m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); |
1214 | }, null, "AvatarFactoryModule.OnClientRequestWearables"); | 1214 | }, null, "AvatarFactoryModule.OnClientRequestWearables"); |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | /// <summary> | 1217 | /// <summary> |
1218 | /// Set appearance data (texture asset IDs and slider settings) received from a client | 1218 | /// Set appearance data (texture asset IDs and slider settings) received from a client |
1219 | /// </summary> | 1219 | /// </summary> |
@@ -1299,12 +1299,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1299 | { | 1299 | { |
1300 | UUID texture = UUID.Zero; | 1300 | UUID texture = UUID.Zero; |
1301 | int index = request.BakedTextureIndex; | 1301 | int index = request.BakedTextureIndex; |
1302 | 1302 | ||
1303 | if (m_reusetextures) | 1303 | if (m_reusetextures) |
1304 | { | 1304 | { |
1305 | // this is the most insanely dumb way to do this... however it seems to | 1305 | // this is the most insanely dumb way to do this... however it seems to |
1306 | // actually work. if the appearance has been reset because wearables have | 1306 | // actually work. if the appearance has been reset because wearables have |
1307 | // changed then the texture entries are zero'd out until the bakes are | 1307 | // changed then the texture entries are zero'd out until the bakes are |
1308 | // uploaded. on login, if the textures exist in the cache (eg if you logged | 1308 | // uploaded. on login, if the textures exist in the cache (eg if you logged |
1309 | // into the simulator recently, then the appearance will pull those and send | 1309 | // into the simulator recently, then the appearance will pull those and send |
1310 | // them back in the packet and you won't have to rebake. if the textures aren't | 1310 | // them back in the packet and you won't have to rebake. if the textures aren't |
@@ -1320,7 +1320,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1320 | 1320 | ||
1321 | // m_log.WarnFormat("[AVFACTORY]: reuse texture {0} for index {1}",texture,index); | 1321 | // m_log.WarnFormat("[AVFACTORY]: reuse texture {0} for index {1}",texture,index); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | CachedTextureResponseArg response = new CachedTextureResponseArg(); | 1324 | CachedTextureResponseArg response = new CachedTextureResponseArg(); |
1325 | response.BakedTextureIndex = index; | 1325 | response.BakedTextureIndex = index; |
1326 | response.BakedTextureID = texture; | 1326 | response.BakedTextureID = texture; |
@@ -1328,7 +1328,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
1328 | 1328 | ||
1329 | cachedTextureResponse.Add(response); | 1329 | cachedTextureResponse.Add(response); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | // m_log.WarnFormat("[AVFACTORY]: serial is {0}",serial); | 1332 | // m_log.WarnFormat("[AVFACTORY]: serial is {0}",serial); |
1333 | // The serial number appears to be used to match requests and responses | 1333 | // The serial number appears to be used to match requests and responses |
1334 | // in the texture transaction. We just send back the serial number | 1334 | // in the texture transaction. We just send back the serial number |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index dd93449..33489d1 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
55 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly | 55 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly |
56 | // to the AssetService, which will then store temporary and local assets permanently | 56 | // to the AssetService, which will then store temporary and local assets permanently |
57 | CoreAssetCache assetCache = new CoreAssetCache(); | 57 | CoreAssetCache assetCache = new CoreAssetCache(); |
58 | 58 | ||
59 | AvatarFactoryModule afm = new AvatarFactoryModule(); | 59 | AvatarFactoryModule afm = new AvatarFactoryModule(); |
60 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); | 60 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); |
61 | SceneHelpers.SetupSceneModules(scene, afm); | 61 | SceneHelpers.SetupSceneModules(scene, afm); |
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
63 | 63 | ||
64 | // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules | 64 | // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules |
65 | AssetBase bakedTextureAsset; | 65 | AssetBase bakedTextureAsset; |
66 | bakedTextureAsset | 66 | bakedTextureAsset |
67 | = new AssetBase( | 67 | = new AssetBase( |
68 | bakedTextureID, "Test Baked Texture", (sbyte)AssetType.Texture, userId.ToString()); | 68 | bakedTextureID, "Test Baked Texture", (sbyte)AssetType.Texture, userId.ToString()); |
69 | bakedTextureAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet | 69 | bakedTextureAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
85 | // This is the alpha texture | 85 | // This is the alpha texture |
86 | eyesFace.TextureID = bakedTextureID; | 86 | eyesFace.TextureID = bakedTextureID; |
87 | afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); | 87 | afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); |
88 | 88 | ||
89 | Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); | 89 | Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); |
90 | 90 | ||
91 | AssetBase eyesBake = scene.AssetService.Get(bakedTextureID.ToString()); | 91 | AssetBase eyesBake = scene.AssetService.Get(bakedTextureID.ToString()); |
@@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
98 | /// Test appearance setting where the baked texture UUID are library alpha textures. | 98 | /// Test appearance setting where the baked texture UUID are library alpha textures. |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <remarks> | 100 | /// <remarks> |
101 | /// For a mesh avatar, it appears these 'baked textures' are used. So these should not trigger a request to | 101 | /// For a mesh avatar, it appears these 'baked textures' are used. So these should not trigger a request to |
102 | /// rebake. | 102 | /// rebake. |
103 | /// </remarks> | 103 | /// </remarks> |
104 | [Test] | 104 | [Test] |
@@ -113,14 +113,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
113 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly | 113 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly |
114 | // to the AssetService, which will then store temporary and local assets permanently | 114 | // to the AssetService, which will then store temporary and local assets permanently |
115 | CoreAssetCache assetCache = new CoreAssetCache(); | 115 | CoreAssetCache assetCache = new CoreAssetCache(); |
116 | 116 | ||
117 | AvatarFactoryModule afm = new AvatarFactoryModule(); | 117 | AvatarFactoryModule afm = new AvatarFactoryModule(); |
118 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); | 118 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); |
119 | SceneHelpers.SetupSceneModules(scene, afm); | 119 | SceneHelpers.SetupSceneModules(scene, afm); |
120 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 120 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); |
121 | 121 | ||
122 | AssetBase libraryAsset; | 122 | AssetBase libraryAsset; |
123 | libraryAsset | 123 | libraryAsset |
124 | = new AssetBase( | 124 | = new AssetBase( |
125 | alphaTextureID, "Default Alpha Layer Texture", (sbyte)AssetType.Texture, userId.ToString()); | 125 | alphaTextureID, "Default Alpha Layer Texture", (sbyte)AssetType.Texture, userId.ToString()); |
126 | libraryAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet | 126 | libraryAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet |
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
142 | // This is the alpha texture | 142 | // This is the alpha texture |
143 | eyesFace.TextureID = alphaTextureID; | 143 | eyesFace.TextureID = alphaTextureID; |
144 | afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); | 144 | afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); |
145 | 145 | ||
146 | Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); | 146 | Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); |
147 | } | 147 | } |
148 | 148 | ||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
158 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly | 158 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly |
159 | // to the AssetService, which will then store temporary and local assets permanently | 159 | // to the AssetService, which will then store temporary and local assets permanently |
160 | CoreAssetCache assetCache = new CoreAssetCache(); | 160 | CoreAssetCache assetCache = new CoreAssetCache(); |
161 | 161 | ||
162 | AvatarFactoryModule afm = new AvatarFactoryModule(); | 162 | AvatarFactoryModule afm = new AvatarFactoryModule(); |
163 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); | 163 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); |
164 | SceneHelpers.SetupSceneModules(scene, afm); | 164 | SceneHelpers.SetupSceneModules(scene, afm); |