aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/ViewerSupport
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/OptionalModules/ViewerSupport
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/OptionalModules/ViewerSupport')
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs7
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs11
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs102
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs5
6 files changed, 17 insertions, 114 deletions
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
index 7ae4223..54f3ab6 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
@@ -108,8 +108,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
108 { 108 {
109 if (m_Enabled) 109 if (m_Enabled)
110 { 110 {
111 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 111 m_Helper = new SimulatorFeaturesHelper(scene);
112 m_Helper = new SimulatorFeaturesHelper(scene, et);
113 112
114 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 113 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
115 if (featuresModule != null) 114 if (featuresModule != null)
@@ -124,7 +123,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
124 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 123 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
125 { 124 {
126 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 125 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
127 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 126 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
128 { 127 {
129 OSDMap extrasMap; 128 OSDMap extrasMap;
130 if (features.ContainsKey("OpenSimExtras")) 129 if (features.ContainsKey("OpenSimExtras"))
@@ -162,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
162 { 161 {
163 foreach (SceneObjectGroup sog in attachs) 162 foreach (SceneObjectGroup sog in attachs)
164 { 163 {
165 m_log.DebugFormat("[CAMERA-ONLY MODE]: Forcibly detaching attach {0} from {1} in {2}", 164 m_log.DebugFormat("[CAMERA-ONLY MODE]: Forcibly detaching attach {0} from {1} in {2}",
166 sog.Name, sp.Name, m_scene.RegionInfo.RegionName); 165 sog.Name, sp.Name, m_scene.RegionInfo.RegionName);
167 166
168 m_scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, sog); 167 m_scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, sog);
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs
index e76e8f2..ed44a5a 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs
@@ -134,7 +134,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
134 } 134 }
135 else 135 else
136 { 136 {
137 using (FileStream fs = File.Open(dialogData.XmlName + ".xml", FileMode.Open)) 137 using (FileStream fs = File.Open(dialogData.XmlName + ".xml", FileMode.Open, FileAccess.Read))
138 { 138 {
139 using (StreamReader sr = new StreamReader(fs)) 139 using (StreamReader sr = new StreamReader(fs))
140 xml = sr.ReadToEnd().Replace("\n", ""); 140 xml = sr.ReadToEnd().Replace("\n", "");
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
index d37369c..9833086 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
@@ -131,8 +131,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
131 { 131 {
132 foreach (MenuItemData d in m_menuItems[UUID.Zero]) 132 foreach (MenuItemData d in m_menuItems[UUID.Zero])
133 { 133 {
134 if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID))) 134 if (!m_scene.Permissions.IsGod(agentID))
135 continue; 135 {
136 if (d.Mode == UserMode.RegionManager && (!m_scene.Permissions.IsAdministrator(agentID)))
137 continue;
138 }
136 139
137 OSDMap loc = null; 140 OSDMap loc = null;
138 switch (d.Location) 141 switch (d.Location)
@@ -156,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
156 159
157 if (loc == null) 160 if (loc == null)
158 continue; 161 continue;
159 162
160 loc[d.Title] = OSD.FromString(d.Title); 163 loc[d.Title] = OSD.FromString(d.Title);
161 } 164 }
162 } 165 }
@@ -190,7 +193,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
190 193
191 if (loc == null) 194 if (loc == null)
192 continue; 195 continue;
193 196
194 loc[d.Title] = OSD.FromString(d.Title); 197 loc[d.Title] = OSD.FromString(d.Title);
195 } 198 }
196 } 199 }
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs
index e0537a4..8ed0bb3 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
50 private static List<String> m_lastNames = new List<String>(); 50 private static List<String> m_lastNames = new List<String>();
51 private static List<String> m_fullNames = new List<String>(); 51 private static List<String> m_fullNames = new List<String>();
52 52
53 public void Initialise(IConfigSource config) 53 public void Initialise(IConfigSource config)
54 { 54 {
55 IConfig moduleConfig = config.Configs["GodNames"]; 55 IConfig moduleConfig = config.Configs["GodNames"];
56 56
@@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
133 fnames.Add(name); 133 fnames.Add(name);
134 } 134 }
135 ((OSDMap)namesmap)["full_names"] = fnames; 135 ((OSDMap)namesmap)["full_names"] = fnames;
136 136
137 OSDArray lnames = new OSDArray(); 137 OSDArray lnames = new OSDArray();
138 foreach (string name in m_lastNames) { 138 foreach (string name in m_lastNames) {
139 lnames.Add(name); 139 lnames.Add(name);
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
index 2661522..2c2042d 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
@@ -49,90 +49,15 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
49 49
50namespace OpenSim.Region.OptionalModules.ViewerSupport 50namespace OpenSim.Region.OptionalModules.ViewerSupport
51{ 51{
52 public class SimulatorFeaturesHelper 52 public class SimulatorFeaturesHelper
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private IEntityTransferModule m_TransferModule;
57 private Scene m_scene; 56 private Scene m_scene;
58 57
59 private struct RegionSend { 58 public SimulatorFeaturesHelper(Scene scene)
60 public UUID region;
61 public bool send;
62 };
63 // Using a static cache so that we don't have to perform the time-consuming tests
64 // in ShouldSend on Extra SimFeatures that go on the same response but come from
65 // different modules.
66 // This cached is indexed on the agentID and maps to a list of regions
67 private static ExpiringCache<UUID, List<RegionSend>> m_Cache = new ExpiringCache<UUID, List<RegionSend>>();
68 private const double TIMEOUT = 1.0; // time in cache
69
70 public SimulatorFeaturesHelper(Scene scene, IEntityTransferModule et)
71 { 59 {
72 m_scene = scene; 60 m_scene = scene;
73 m_TransferModule = et;
74 }
75
76 public bool ShouldSend(UUID agentID)
77 {
78 List<RegionSend> rsendlist;
79 RegionSend rsend;
80 if (m_Cache.TryGetValue(agentID, out rsendlist))
81 {
82 rsend = rsendlist.Find(r => r.region == m_scene.RegionInfo.RegionID);
83 if (rsend.region != UUID.Zero) // Found it
84 {
85 return rsend.send;
86 }
87 }
88
89 // Relatively complex logic for deciding whether to send the extra SimFeature or not.
90 // This is because the viewer calls this cap to all sims that it knows about,
91 // including the departing sims and non-neighbors (those that are cached).
92 rsend.region = m_scene.RegionInfo.RegionID;
93 rsend.send = false;
94 IClientAPI client = null;
95 int counter = 200;
96
97 // Let's wait a little to see if we get a client here
98 while (!m_scene.TryGetClient(agentID, out client) && counter-- > 0)
99 Thread.Sleep(50);
100
101 if (client != null)
102 {
103 ScenePresence sp = WaitGetScenePresence(agentID);
104
105 if (sp != null)
106 {
107 // On the receiving region, the call to this cap may arrive before
108 // the agent is root. Make sure we only proceed from here when the agent
109 // has been made root
110 counter = 200;
111 while ((sp.IsInTransit || sp.IsChildAgent) && counter-- > 0)
112 {
113 Thread.Sleep(50);
114 }
115
116 // The viewer calls this cap on the departing sims too. Make sure
117 // that we only proceed after the agent is not in transit anymore.
118 // The agent must be root and not going anywhere
119 if (!sp.IsChildAgent && !m_TransferModule.IsInTransit(agentID))
120 rsend.send = true;
121
122 }
123 }
124 //else
125 // m_log.DebugFormat("[XXX]: client is null");
126
127
128 if (rsendlist == null)
129 {
130 rsendlist = new List<RegionSend>();
131 m_Cache.AddOrUpdate(agentID, rsendlist, TIMEOUT);
132 }
133 rsendlist.Add(rsend);
134
135 return rsend.send;
136 } 61 }
137 62
138 public int UserLevel(UUID agentID) 63 public int UserLevel(UUID agentID)
@@ -144,28 +69,5 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
144 69
145 return level; 70 return level;
146 } 71 }
147
148 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
149 {
150 int ntimes = 20;
151 ScenePresence sp = null;
152 while ((sp = m_scene.GetScenePresence(agentID)) == null && (ntimes-- > 0))
153 Thread.Sleep(1000);
154
155 if (sp == null)
156 m_log.WarnFormat(
157 "[XXX]: Did not find presence with id {0} in {1} before timeout",
158 agentID, m_scene.RegionInfo.RegionName);
159 else
160 {
161 ntimes = 10;
162 while (sp.IsInTransit && (ntimes-- > 0))
163 Thread.Sleep(1000);
164 }
165
166 return sp;
167 }
168
169 } 72 }
170
171} 73}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
index 3fe922d..fa8fc66 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
@@ -102,8 +102,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
102 { 102 {
103 if (m_Enabled) 103 if (m_Enabled)
104 { 104 {
105 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 105 m_Helper = new SimulatorFeaturesHelper(scene);
106 m_Helper = new SimulatorFeaturesHelper(scene, et);
107 106
108 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 107 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
109 if (featuresModule != null) 108 if (featuresModule != null)
@@ -118,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
118 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 117 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
119 { 118 {
120 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 119 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
121 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 120 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
122 { 121 {
123 OSDMap extrasMap; 122 OSDMap extrasMap;
124 OSDMap specialUI = new OSDMap(); 123 OSDMap specialUI = new OSDMap();