diff options
author | diva | 2009-02-09 22:27:27 +0000 |
---|---|---|
committer | diva | 2009-02-09 22:27:27 +0000 |
commit | 2c685bff1493451849580cfb6bf44b88322bf0a4 (patch) | |
tree | 4179700c2b1fcbcc7a5ab07f7bc65b3bf97a79d9 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Thank you kindly, TLaukkan (Timmil) for a patch that: (diff) | |
download | opensim-SC_OLD-2c685bff1493451849580cfb6bf44b88322bf0a4.zip opensim-SC_OLD-2c685bff1493451849580cfb6bf44b88322bf0a4.tar.gz opensim-SC_OLD-2c685bff1493451849580cfb6bf44b88322bf0a4.tar.bz2 opensim-SC_OLD-2c685bff1493451849580cfb6bf44b88322bf0a4.tar.xz |
Moved prim crossing out of OGS1 and into RESTComms and LocalInterregionComms. This breaks interregion comms with older versions in what concerns prim crossing. In the process of moving the comms, a few things seem to be working better, namely this may address mantis #3011, mantis #1698. Hopefully, this doesn't break anything else. But I'm still seeing weirdnesses with attchments jumping out of place after a cross/TP.
The two most notable changes in the crossing process were:
* Object gets passed in only one message, not two as done before.
* Local object crossings do not get serialized, as done before.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 232 |
1 files changed, 135 insertions, 97 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2fae8ac..b10acc7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2011,22 +2011,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | /// </returns> | 2011 | /// </returns> |
2012 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) | 2012 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) |
2013 | { | 2013 | { |
2014 | //Console.WriteLine(" >>> CrossPrimGroupIntoNewRegion <<<"); | ||
2015 | |||
2014 | bool successYN = false; | 2016 | bool successYN = false; |
2015 | grp.RootPart.UpdateFlag = 0; | 2017 | grp.RootPart.UpdateFlag = 0; |
2016 | int primcrossingXMLmethod = 0; | 2018 | //int primcrossingXMLmethod = 0; |
2017 | 2019 | ||
2018 | if (newRegionHandle != 0) | 2020 | if (newRegionHandle != 0) |
2019 | { | 2021 | { |
2020 | string objectState = grp.GetStateSnapshot(); | 2022 | //string objectState = grp.GetStateSnapshot(); |
2021 | 2023 | ||
2022 | successYN | 2024 | //successYN |
2023 | = m_sceneGridService.PrimCrossToNeighboringRegion( | 2025 | // = m_sceneGridService.PrimCrossToNeighboringRegion( |
2024 | newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | 2026 | // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); |
2025 | if (successYN && (objectState != "") && m_allowScriptCrossings) | 2027 | //if (successYN && (objectState != "") && m_allowScriptCrossings) |
2026 | { | 2028 | //{ |
2027 | successYN = m_sceneGridService.PrimCrossToNeighboringRegion( | 2029 | // successYN = m_sceneGridService.PrimCrossToNeighboringRegion( |
2028 | newRegionHandle, grp.UUID, objectState, 100); | 2030 | // newRegionHandle, grp.UUID, objectState, 100); |
2029 | } | 2031 | //} |
2032 | |||
2033 | // And the new channel... | ||
2034 | successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp); | ||
2030 | 2035 | ||
2031 | if (successYN) | 2036 | if (successYN) |
2032 | { | 2037 | { |
@@ -2065,6 +2070,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2065 | 2070 | ||
2066 | /// <summary> | 2071 | /// <summary> |
2067 | /// Handle a scene object that is crossing into this region from another. | 2072 | /// Handle a scene object that is crossing into this region from another. |
2073 | /// NOTE: Unused as of 2009-02-09. Soon to be deleted. | ||
2068 | /// </summary> | 2074 | /// </summary> |
2069 | /// <param name="regionHandle"></param> | 2075 | /// <param name="regionHandle"></param> |
2070 | /// <param name="primID"></param> | 2076 | /// <param name="primID"></param> |
@@ -2079,98 +2085,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2079 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); | 2085 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); |
2080 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); | 2086 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); |
2081 | 2087 | ||
2082 | // If the user is banned, we won't let any of their objects | 2088 | return AddSceneObject(primID, sceneObject); |
2083 | // enter. Period. | ||
2084 | // | ||
2085 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | ||
2086 | { | ||
2087 | m_log.Info("[INTERREGION]: Denied prim crossing for "+ | ||
2088 | "banned avatar"); | ||
2089 | |||
2090 | return false; | ||
2091 | } | ||
2092 | |||
2093 | // Force allocation of new LocalId | ||
2094 | // | ||
2095 | foreach (SceneObjectPart p in sceneObject.Children.Values) | ||
2096 | p.LocalId = 0; | ||
2097 | |||
2098 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
2099 | { | ||
2100 | if (sceneObject.RootPart.Shape.State != 0) | ||
2101 | { | ||
2102 | // Fix up attachment Parent Local ID | ||
2103 | // | ||
2104 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | ||
2105 | |||
2106 | uint parentLocalID = 0; | ||
2107 | if (sp != null) | ||
2108 | parentLocalID = sp.LocalId; | ||
2109 | |||
2110 | sceneObject.RootPart.IsAttachment = true; | ||
2111 | sceneObject.RootPart.SetParentLocalId(parentLocalID); | ||
2112 | |||
2113 | AddRestoredSceneObject(sceneObject, false, false); | ||
2114 | 2089 | ||
2115 | // Handle attachment special case | ||
2116 | // | ||
2117 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2118 | |||
2119 | if (RootPrim != null) | ||
2120 | { | ||
2121 | SceneObjectGroup grp = RootPrim.ParentGroup; | ||
2122 | |||
2123 | RootPrim.SetParentLocalId(parentLocalID); | ||
2124 | |||
2125 | if (grp != null) | ||
2126 | { | ||
2127 | m_log.DebugFormat("[ATTACHMENT]: Received "+ | ||
2128 | "attachment {0}, inworld asset id {1}", | ||
2129 | grp.RootPart.LastOwnerID.ToString(), | ||
2130 | grp.UUID.ToString()); | ||
2131 | |||
2132 | if (sp != null) | ||
2133 | { | ||
2134 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); | ||
2135 | m_log.DebugFormat("[ATTACHMENT]: Attach "+ | ||
2136 | "to avatar {0}", | ||
2137 | sp.UUID.ToString()); | ||
2138 | AttachObject(sp.ControllingClient, | ||
2139 | grp.LocalId, (uint)0, | ||
2140 | grp.GroupRotation, | ||
2141 | grp.AbsolutePosition, false); | ||
2142 | grp.SendGroupFullUpdate(); | ||
2143 | } | ||
2144 | else | ||
2145 | { | ||
2146 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | ||
2147 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | ||
2148 | } | ||
2149 | } | ||
2150 | } | ||
2151 | } | ||
2152 | else | ||
2153 | { | ||
2154 | AddRestoredSceneObject(sceneObject, true, false); | ||
2155 | |||
2156 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | ||
2157 | true, sceneObject.AbsolutePosition)) | ||
2158 | { | ||
2159 | // Deny non attachments based on parcel settings | ||
2160 | // | ||
2161 | m_log.Info("[INTERREGION]: Denied prim crossing "+ | ||
2162 | "because of parcel settings"); | ||
2163 | |||
2164 | DeleteSceneObject(sceneObject, false); | ||
2165 | |||
2166 | return false; | ||
2167 | } | ||
2168 | } | ||
2169 | } | ||
2170 | } | 2090 | } |
2171 | else if ((XMLMethod == 100) && m_allowScriptCrossings) | 2091 | else if ((XMLMethod == 100) && m_allowScriptCrossings) |
2172 | { | 2092 | { |
2173 | m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor"); | 2093 | m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor"); |
2094 | |||
2174 | XmlDocument doc = new XmlDocument(); | 2095 | XmlDocument doc = new XmlDocument(); |
2175 | doc.LoadXml(objXMLData); | 2096 | doc.LoadXml(objXMLData); |
2176 | 2097 | ||
@@ -2244,6 +2165,123 @@ namespace OpenSim.Region.Framework.Scenes | |||
2244 | return true; | 2165 | return true; |
2245 | } | 2166 | } |
2246 | 2167 | ||
2168 | public bool IncomingCreateObject(ISceneObject sog) | ||
2169 | { | ||
2170 | //Console.WriteLine(" >>> IncomingCreateObject <<<"); | ||
2171 | SceneObjectGroup newObject; | ||
2172 | try | ||
2173 | { | ||
2174 | newObject = (SceneObjectGroup)sog; | ||
2175 | } | ||
2176 | catch (Exception e) | ||
2177 | { | ||
2178 | m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message); | ||
2179 | return false; | ||
2180 | } | ||
2181 | |||
2182 | if (!AddSceneObject(newObject.UUID, newObject)) | ||
2183 | { | ||
2184 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); | ||
2185 | return false; | ||
2186 | } | ||
2187 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | ||
2188 | return true; | ||
2189 | } | ||
2190 | |||
2191 | public bool AddSceneObject(UUID primID, SceneObjectGroup sceneObject) | ||
2192 | { | ||
2193 | // If the user is banned, we won't let any of their objects | ||
2194 | // enter. Period. | ||
2195 | // | ||
2196 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | ||
2197 | { | ||
2198 | m_log.Info("[INTERREGION]: Denied prim crossing for " + | ||
2199 | "banned avatar"); | ||
2200 | |||
2201 | return false; | ||
2202 | } | ||
2203 | |||
2204 | // Force allocation of new LocalId | ||
2205 | // | ||
2206 | foreach (SceneObjectPart p in sceneObject.Children.Values) | ||
2207 | p.LocalId = 0; | ||
2208 | |||
2209 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
2210 | { | ||
2211 | if (sceneObject.RootPart.Shape.State != 0) | ||
2212 | { | ||
2213 | // Fix up attachment Parent Local ID | ||
2214 | // | ||
2215 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | ||
2216 | |||
2217 | uint parentLocalID = 0; | ||
2218 | if (sp != null) | ||
2219 | parentLocalID = sp.LocalId; | ||
2220 | |||
2221 | sceneObject.RootPart.IsAttachment = true; | ||
2222 | sceneObject.RootPart.SetParentLocalId(parentLocalID); | ||
2223 | |||
2224 | AddRestoredSceneObject(sceneObject, false, false); | ||
2225 | |||
2226 | // Handle attachment special case | ||
2227 | // | ||
2228 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2229 | //SceneObjectPart RootPrim = sceneObject.RootPart; | ||
2230 | |||
2231 | if (RootPrim != null) | ||
2232 | { | ||
2233 | SceneObjectGroup grp = RootPrim.ParentGroup; | ||
2234 | |||
2235 | RootPrim.SetParentLocalId(parentLocalID); | ||
2236 | |||
2237 | if (grp != null) | ||
2238 | { | ||
2239 | m_log.DebugFormat("[ATTACHMENT]: Received " + | ||
2240 | "attachment {0}, inworld asset id {1}", | ||
2241 | //grp.RootPart.LastOwnerID.ToString(), | ||
2242 | grp.GetFromAssetID(), | ||
2243 | grp.UUID.ToString()); | ||
2244 | |||
2245 | if (sp != null) | ||
2246 | { | ||
2247 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | ||
2248 | m_log.DebugFormat("[ATTACHMENT]: Attach " + | ||
2249 | "to avatar {0}", | ||
2250 | sp.UUID.ToString()); | ||
2251 | AttachObject(sp.ControllingClient, | ||
2252 | grp.LocalId, (uint)0, | ||
2253 | grp.GroupRotation, | ||
2254 | grp.AbsolutePosition, false); | ||
2255 | grp.SendGroupFullUpdate(); | ||
2256 | } | ||
2257 | else | ||
2258 | { | ||
2259 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | ||
2260 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | ||
2261 | } | ||
2262 | } | ||
2263 | } | ||
2264 | } | ||
2265 | else | ||
2266 | { | ||
2267 | AddRestoredSceneObject(sceneObject, true, false); | ||
2268 | |||
2269 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | ||
2270 | true, sceneObject.AbsolutePosition)) | ||
2271 | { | ||
2272 | // Deny non attachments based on parcel settings | ||
2273 | // | ||
2274 | m_log.Info("[INTERREGION]: Denied prim crossing " + | ||
2275 | "because of parcel settings"); | ||
2276 | |||
2277 | DeleteSceneObject(sceneObject, false); | ||
2278 | |||
2279 | return false; | ||
2280 | } | ||
2281 | } | ||
2282 | } | ||
2283 | return true; | ||
2284 | } | ||
2247 | #endregion | 2285 | #endregion |
2248 | 2286 | ||
2249 | #region Add/Remove Avatar Methods | 2287 | #region Add/Remove Avatar Methods |