diff options
author | Melanie | 2013-04-25 20:47:55 +0100 |
---|---|---|
committer | Melanie | 2013-04-25 20:47:55 +0100 |
commit | c6628b1c769f957d4ac6c0aa71b2e671a34d5ed8 (patch) | |
tree | 7d7326fa9f7b894e5d6f846d477d97693644dc07 /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Recover a lost "virtual". Downstream projects need this. (diff) | |
download | opensim-SC-c6628b1c769f957d4ac6c0aa71b2e671a34d5ed8.zip opensim-SC-c6628b1c769f957d4ac6c0aa71b2e671a34d5ed8.tar.gz opensim-SC-c6628b1c769f957d4ac6c0aa71b2e671a34d5ed8.tar.bz2 opensim-SC-c6628b1c769f957d4ac6c0aa71b2e671a34d5ed8.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 66 |
2 files changed, 123 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs b/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs new file mode 100644 index 0000000..08b71e4 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public enum InsertLocation : int | ||
35 | { | ||
36 | Agent = 1, | ||
37 | World = 2, | ||
38 | Tools = 3, | ||
39 | Advanced = 4, | ||
40 | Admin = 5 | ||
41 | } | ||
42 | |||
43 | public enum UserMode : int | ||
44 | { | ||
45 | Normal = 0, | ||
46 | God = 3 | ||
47 | } | ||
48 | |||
49 | public delegate void CustomMenuHandler(string action, UUID agentID, List<uint> selection); | ||
50 | |||
51 | public interface IDynamicMenuModule | ||
52 | { | ||
53 | void AddMenuItem(UUID agentID, string title, InsertLocation location, UserMode mode, CustomMenuHandler handler); | ||
54 | void AddMenuItem(string title, InsertLocation location, UserMode mode, CustomMenuHandler handler); | ||
55 | void RemoveMenuItem(string action); | ||
56 | } | ||
57 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index b09ae39..7b47275 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -34,6 +34,7 @@ using System.Threading; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.Assets; | 36 | using OpenMetaverse.Assets; |
37 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Scenes.Serialization; | 39 | using OpenSim.Region.Framework.Scenes.Serialization; |
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
@@ -180,6 +181,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
180 | if (!assetUuids.ContainsKey(tii.AssetID)) | 181 | if (!assetUuids.ContainsKey(tii.AssetID)) |
181 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); | 182 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); |
182 | } | 183 | } |
184 | |||
185 | // get any texture UUIDs used for materials such as normal and specular maps | ||
186 | GatherMaterialsUuids(part, assetUuids); | ||
183 | } | 187 | } |
184 | catch (Exception e) | 188 | catch (Exception e) |
185 | { | 189 | { |
@@ -204,6 +208,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
204 | // } | 208 | // } |
205 | // } | 209 | // } |
206 | 210 | ||
211 | |||
212 | /// <summary> | ||
213 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps | ||
214 | /// </summary> | ||
215 | /// <param name="part"></param> | ||
216 | /// <param name="assetUuids"></param> | ||
217 | public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) | ||
218 | { | ||
219 | // scan thru the dynAttrs map of this part for any textures used as materials | ||
220 | OSDMap OSMaterials = null; | ||
221 | |||
222 | lock (part.DynAttrs) | ||
223 | { | ||
224 | if (part.DynAttrs.ContainsKey("OS:Materials")) | ||
225 | OSMaterials = part.DynAttrs["OS:Materials"]; | ||
226 | if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) | ||
227 | { | ||
228 | OSD osd = OSMaterials["Materials"]; | ||
229 | //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); | ||
230 | |||
231 | if (osd is OSDArray) | ||
232 | { | ||
233 | OSDArray matsArr = osd as OSDArray; | ||
234 | foreach (OSDMap matMap in matsArr) | ||
235 | { | ||
236 | try | ||
237 | { | ||
238 | if (matMap.ContainsKey("Material")) | ||
239 | { | ||
240 | OSDMap mat = matMap["Material"] as OSDMap; | ||
241 | if (mat.ContainsKey("NormMap")) | ||
242 | { | ||
243 | UUID normalMapId = mat["NormMap"].AsUUID(); | ||
244 | if (normalMapId != UUID.Zero) | ||
245 | { | ||
246 | assetUuids[normalMapId] = AssetType.Texture; | ||
247 | //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); | ||
248 | } | ||
249 | } | ||
250 | if (mat.ContainsKey("SpecMap")) | ||
251 | { | ||
252 | UUID specularMapId = mat["SpecMap"].AsUUID(); | ||
253 | if (specularMapId != UUID.Zero) | ||
254 | { | ||
255 | assetUuids[specularMapId] = AssetType.Texture; | ||
256 | //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | } | ||
262 | catch (Exception e) | ||
263 | { | ||
264 | m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message); | ||
265 | } | ||
266 | } | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | |||
272 | |||
207 | /// <summary> | 273 | /// <summary> |
208 | /// Get an asset synchronously, potentially using an asynchronous callback. If the | 274 | /// Get an asset synchronously, potentially using an asynchronous callback. If the |
209 | /// asynchronous callback is used, we will wait for it to complete. | 275 | /// asynchronous callback is used, we will wait for it to complete. |