aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2017-05-31 07:21:21 +0100
committerUbitUmarov2017-05-31 07:21:21 +0100
commit55babdc16090397499081f0428500babe383ff3a (patch)
treeefb2f7ec13abba489d6318ebace8a86c6cde66c6 /OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
parentdisable llhttprequests secure con, since it still collides with main ssl sett... (diff)
parentwe don't need to keep refs to baked textures assets (diff)
downloadopensim-SC-55babdc16090397499081f0428500babe383ff3a.zip
opensim-SC-55babdc16090397499081f0428500babe383ff3a.tar.gz
opensim-SC-55babdc16090397499081f0428500babe383ff3a.tar.bz2
opensim-SC-55babdc16090397499081f0428500babe383ff3a.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs155
1 files changed, 2 insertions, 153 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index dfe097e..b406b37 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -63,9 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
63 private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. 63 private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
64 64
65 private Scene m_scene; 65 private Scene m_scene;
66 private bool m_persistBakedTextures;
67 66
68 private IBakedTextureModule m_BakedTextureModule;
69 private string m_URL; 67 private string m_URL;
70 68
71 public void Initialise(IConfigSource source) 69 public void Initialise(IConfigSource source)
@@ -76,15 +74,12 @@ namespace OpenSim.Region.ClientStack.Linden
76 74
77 m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); 75 m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
78 76
79 IConfig appearanceConfig = source.Configs["Appearance"]; 77// IConfig appearanceConfig = source.Configs["Appearance"];
80 if (appearanceConfig != null)
81 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
82 } 78 }
83 79
84 public void AddRegion(Scene s) 80 public void AddRegion(Scene s)
85 { 81 {
86 m_scene = s; 82 m_scene = s;
87
88 } 83 }
89 84
90 public void RemoveRegion(Scene s) 85 public void RemoveRegion(Scene s)
@@ -92,7 +87,6 @@ namespace OpenSim.Region.ClientStack.Linden
92 s.EventManager.OnRegisterCaps -= RegisterCaps; 87 s.EventManager.OnRegisterCaps -= RegisterCaps;
93 s.EventManager.OnNewPresence -= RegisterNewPresence; 88 s.EventManager.OnNewPresence -= RegisterNewPresence;
94 s.EventManager.OnRemovePresence -= DeRegisterPresence; 89 s.EventManager.OnRemovePresence -= DeRegisterPresence;
95 m_BakedTextureModule = null;
96 m_scene = null; 90 m_scene = null;
97 } 91 }
98 92
@@ -101,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden
101 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 95 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
102 m_scene.EventManager.OnNewPresence += RegisterNewPresence; 96 m_scene.EventManager.OnNewPresence += RegisterNewPresence;
103 m_scene.EventManager.OnRemovePresence += DeRegisterPresence; 97 m_scene.EventManager.OnRemovePresence += DeRegisterPresence;
104
105 } 98 }
106 99
107 private void DeRegisterPresence(UUID agentId) 100 private void DeRegisterPresence(UUID agentId)
@@ -110,156 +103,12 @@ namespace OpenSim.Region.ClientStack.Linden
110 103
111 private void RegisterNewPresence(ScenePresence presence) 104 private void RegisterNewPresence(ScenePresence presence)
112 { 105 {
113// presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
114 } 106 }
115 107
116/* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache()
117 private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
118 {
119 // if cacheItems.Length > 0 viewer is giving us current textures information.
120 // baked ones should had been uploaded and in assets cache as local itens
121
122
123 if (cacheItems.Length == 0)
124 return; // no textures information, nothing to do
125
126 ScenePresence p = null;
127 if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
128 return; // what are we doing if there is no presence to cache for?
129
130 if (p.IsDeleted)
131 return; // does this really work?
132
133 int maxCacheitemsLoop = cacheItems.Length;
134 if (maxCacheitemsLoop > 20)
135 {
136 maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
137 m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
138 }
139
140 m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
141
142
143 // some nice debug
144 m_log.Debug("[Cacheitems]: " + cacheItems.Length);
145 for (int iter = 0; iter < maxCacheitemsLoop; iter++)
146 {
147 m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
148 cacheItems[iter].TextureID);
149 }
150
151 // p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper
152
153 WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
154
155 if (existingitems == null)
156 {
157 if (m_BakedTextureModule != null)
158 {
159 WearableCacheItem[] savedcache = null;
160 try
161 {
162 if (p.Appearance.WearableCacheItemsDirty)
163 {
164 savedcache = m_BakedTextureModule.Get(p.UUID);
165 p.Appearance.WearableCacheItems = savedcache;
166 p.Appearance.WearableCacheItemsDirty = false;
167 }
168 }
169
170 catch (Exception)
171 {
172 // The service logs a sufficient error message.
173 }
174
175
176 if (savedcache != null)
177 existingitems = savedcache;
178 }
179 }
180
181 // Existing items null means it's a fully new appearance
182 if (existingitems == null)
183 {
184 for (int i = 0; i < maxCacheitemsLoop; i++)
185 {
186 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
187 {
188 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
189 if (face == null)
190 {
191 textureEntry.CreateFace(cacheItems[i].TextureIndex);
192 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
193 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
194 continue;
195 }
196 cacheItems[i].TextureID = face.TextureID;
197 if (m_scene.AssetService != null)
198 cacheItems[i].TextureAsset =
199 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
200 }
201 else
202 {
203 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
204 }
205 }
206 }
207 else
208 {
209 for (int i = 0; i < maxCacheitemsLoop; i++)
210 {
211 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
212 {
213 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
214 if (face == null)
215 {
216 textureEntry.CreateFace(cacheItems[i].TextureIndex);
217 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
218 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
219 continue;
220 }
221 cacheItems[i].TextureID =
222 face.TextureID;
223 }
224 else
225 {
226 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
227 }
228 }
229
230 for (int i = 0; i < maxCacheitemsLoop; i++)
231 {
232 if (cacheItems[i].TextureAsset == null)
233 {
234 cacheItems[i].TextureAsset =
235 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
236 }
237 }
238 }
239 p.Appearance.WearableCacheItems = cacheItems;
240
241 if (m_BakedTextureModule != null)
242 {
243 m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
244 p.Appearance.WearableCacheItemsDirty = true;
245
246 }
247 else
248 p.Appearance.WearableCacheItemsDirty = false;
249
250 for (int iter = 0; iter < maxCacheitemsLoop; iter++)
251 {
252 m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
253 cacheItems[iter].TextureID);
254 }
255 }
256 */
257 public void PostInitialise() 108 public void PostInitialise()
258 { 109 {
259 } 110 }
260 111
261
262
263 public void Close() { } 112 public void Close() { }
264 113
265 public string Name { get { return "UploadBakedTextureModule"; } } 114 public string Name { get { return "UploadBakedTextureModule"; } }
@@ -275,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
275 if (m_URL == "localhost") 124 if (m_URL == "localhost")
276 { 125 {
277 UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( 126 UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
278 caps, m_scene.AssetService, m_persistBakedTextures); 127 caps, m_scene.AssetService);
279 128
280 caps.RegisterHandler( 129 caps.RegisterHandler(
281 "UploadBakedTexture", 130 "UploadBakedTexture",