diff options
author | Justin Clark-Casey (justincc) | 2011-05-07 01:06:55 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-05-07 01:06:55 +0100 |
commit | d4fcba08af080bcc60da490155cc88d3f20e7dda (patch) | |
tree | 2a08f4460ed264a24c36232603ae8e079510f704 /OpenSim/Region/OptionalModules/Avatar | |
parent | Removed SimpleRegionInfo, which was obsolete and not used anywhere. (diff) | |
download | opensim-SC_OLD-d4fcba08af080bcc60da490155cc88d3f20e7dda.zip opensim-SC_OLD-d4fcba08af080bcc60da490155cc88d3f20e7dda.tar.gz opensim-SC_OLD-d4fcba08af080bcc60da490155cc88d3f20e7dda.tar.bz2 opensim-SC_OLD-d4fcba08af080bcc60da490155cc88d3f20e7dda.tar.xz |
Add module with "appearance show" command.
At the moment, this command just asks the AvatarFactory to perform the existing baked texture check for each avatar in the simulator and returns "OK" or "corrupt".
This is for debugging purposes
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs new file mode 100644 index 0000000..8589901 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |||
@@ -0,0 +1,122 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using log4net; | ||
33 | using Mono.Addins; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Framework.Statistics; | ||
39 | using OpenSim.Region.ClientStack.LindenUDP; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | |||
43 | namespace OpenSim.Region.OptionalModules.Avatar.Appearance | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// A module that just holds commands for inspecting avatar appearance. | ||
47 | /// </summary> | ||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AppearanceInfoModule")] | ||
49 | public class AppearanceInfoModule : ISharedRegionModule | ||
50 | { | ||
51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | ||
54 | protected IAvatarFactory m_avatarFactory; | ||
55 | |||
56 | public string Name { get { return "Appearance Information Module"; } } | ||
57 | |||
58 | public Type ReplaceableInterface { get { return null; } } | ||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: INITIALIZED MODULE"); | ||
63 | } | ||
64 | |||
65 | public void PostInitialise() | ||
66 | { | ||
67 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: POST INITIALIZED MODULE"); | ||
68 | } | ||
69 | |||
70 | public void Close() | ||
71 | { | ||
72 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: CLOSED MODULE"); | ||
73 | } | ||
74 | |||
75 | public void AddRegion(Scene scene) | ||
76 | { | ||
77 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
78 | } | ||
79 | |||
80 | public void RemoveRegion(Scene scene) | ||
81 | { | ||
82 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
83 | |||
84 | lock (m_scenes) | ||
85 | m_scenes.Remove(scene.RegionInfo.RegionID); | ||
86 | } | ||
87 | |||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | // m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
91 | |||
92 | lock (m_scenes) | ||
93 | m_scenes[scene.RegionInfo.RegionID] = scene; | ||
94 | |||
95 | scene.AddCommand( | ||
96 | this, "appearance show", | ||
97 | "appearance show", | ||
98 | "Show appearance information for each avatar in the simulator. At the moment, ", | ||
99 | ShowAppearanceInfo); | ||
100 | } | ||
101 | |||
102 | protected void ShowAppearanceInfo(string module, string[] cmd) | ||
103 | { | ||
104 | lock (m_scenes) | ||
105 | { | ||
106 | foreach (Scene scene in m_scenes.Values) | ||
107 | { | ||
108 | scene.ForEachClient( | ||
109 | delegate(IClientAPI client) | ||
110 | { | ||
111 | if (client is LLClientView && !((LLClientView)client).ChildAgentStatus()) | ||
112 | { | ||
113 | bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client); | ||
114 | MainConsole.Instance.OutputFormat( | ||
115 | "{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); | ||
116 | } | ||
117 | }); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | } \ No newline at end of file | ||