diff options
author | Justin Clark-Casey (justincc) | 2010-02-08 19:02:20 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-02-08 19:02:20 +0000 |
commit | 00947cf2ca7a9315ae1d508507db0c95348e25ec (patch) | |
tree | b6f9168e8cb6f299c2a66288bd5094dac49ccaa7 | |
parent | minor: log what kind of wearable cannot be found (diff) | |
download | opensim-SC_OLD-00947cf2ca7a9315ae1d508507db0c95348e25ec.zip opensim-SC_OLD-00947cf2ca7a9315ae1d508507db0c95348e25ec.tar.gz opensim-SC_OLD-00947cf2ca7a9315ae1d508507db0c95348e25ec.tar.bz2 opensim-SC_OLD-00947cf2ca7a9315ae1d508507db0c95348e25ec.tar.xz |
Add EventManager.OnIncomingSceneObject event which is triggered by an incoming scene object
Add a read-only Attachments property to ScenePresence
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 |
4 files changed, 58 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 473920e..9f74b2a 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -205,6 +205,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | public delegate void OnMakeRootAgentDelegate(ScenePresence presence); | 205 | public delegate void OnMakeRootAgentDelegate(ScenePresence presence); |
206 | public event OnMakeRootAgentDelegate OnMakeRootAgent; | 206 | public event OnMakeRootAgentDelegate OnMakeRootAgent; |
207 | 207 | ||
208 | /// <summary> | ||
209 | /// Triggered when an object or attachment enters a scene | ||
210 | /// </summary> | ||
211 | public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; | ||
212 | public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); | ||
213 | |||
208 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); | 214 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); |
209 | 215 | ||
210 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; | 216 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; |
@@ -407,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
407 | } | 413 | } |
408 | } | 414 | } |
409 | } | 415 | } |
410 | } | 416 | } |
411 | 417 | ||
412 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 418 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
413 | { | 419 | { |
@@ -1206,6 +1212,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1206 | } | 1212 | } |
1207 | } | 1213 | } |
1208 | 1214 | ||
1215 | public void TriggerOnIncomingSceneObject(SceneObjectGroup so) | ||
1216 | { | ||
1217 | OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject; | ||
1218 | if (handlerIncomingSceneObject != null) | ||
1219 | { | ||
1220 | foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList()) | ||
1221 | { | ||
1222 | try | ||
1223 | { | ||
1224 | d(so); | ||
1225 | } | ||
1226 | catch (Exception e) | ||
1227 | { | ||
1228 | m_log.ErrorFormat( | ||
1229 | "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}", | ||
1230 | e.Message, e.StackTrace); | ||
1231 | } | ||
1232 | } | ||
1233 | } | ||
1234 | } | ||
1235 | |||
1209 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) | 1236 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) |
1210 | { | 1237 | { |
1211 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; | 1238 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 73b0b3e..039d074 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2406,9 +2406,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2406 | return successYN; | 2406 | return successYN; |
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | /// <summary> | ||
2410 | /// Called when objects or attachments cross the border between regions. | ||
2411 | /// </summary> | ||
2412 | /// <param name="sog"></param> | ||
2413 | /// <returns></returns> | ||
2409 | public bool IncomingCreateObject(ISceneObject sog) | 2414 | public bool IncomingCreateObject(ISceneObject sog) |
2410 | { | 2415 | { |
2411 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2416 | //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
2412 | SceneObjectGroup newObject; | 2417 | SceneObjectGroup newObject; |
2413 | try | 2418 | try |
2414 | { | 2419 | { |
@@ -2425,7 +2430,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2425 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); | 2430 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); |
2426 | return false; | 2431 | return false; |
2427 | } | 2432 | } |
2433 | |||
2428 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | 2434 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); |
2435 | |||
2436 | // Do this as late as possible so that listeners have full access to the incoming object | ||
2437 | EventManager.TriggerOnIncomingSceneObject(newObject); | ||
2438 | |||
2429 | return true; | 2439 | return true; |
2430 | } | 2440 | } |
2431 | 2441 | ||
@@ -2437,6 +2447,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2437 | /// <returns>False</returns> | 2447 | /// <returns>False</returns> |
2438 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) | 2448 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) |
2439 | { | 2449 | { |
2450 | //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); | ||
2451 | |||
2440 | ScenePresence sp = GetScenePresence(userID); | 2452 | ScenePresence sp = GetScenePresence(userID); |
2441 | if (sp != null) | 2453 | if (sp != null) |
2442 | { | 2454 | { |
@@ -2496,29 +2508,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2496 | 2508 | ||
2497 | //RootPrim.SetParentLocalId(parentLocalID); | 2509 | //RootPrim.SetParentLocalId(parentLocalID); |
2498 | 2510 | ||
2499 | m_log.DebugFormat("[ATTACHMENT]: Received " + | 2511 | m_log.DebugFormat( |
2500 | "attachment {0}, inworld asset id {1}", | 2512 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); |
2501 | //grp.RootPart.LastOwnerID.ToString(), | ||
2502 | grp.GetFromItemID(), | ||
2503 | grp.UUID.ToString()); | ||
2504 | 2513 | ||
2505 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2514 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2506 | m_log.DebugFormat("[ATTACHMENT]: Attach " + | 2515 | m_log.DebugFormat( |
2507 | "to avatar {0} at position {1}", | 2516 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2508 | sp.UUID.ToString(), grp.AbsolutePosition); | 2517 | |
2509 | AttachObject(sp.ControllingClient, | 2518 | AttachObject( |
2510 | grp.LocalId, (uint)0, | 2519 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); |
2511 | grp.GroupRotation, | ||
2512 | grp.AbsolutePosition, false); | ||
2513 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2520 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2514 | grp.SendGroupFullUpdate(); | 2521 | grp.SendGroupFullUpdate(); |
2522 | |||
2523 | |||
2515 | } | 2524 | } |
2516 | else | 2525 | else |
2517 | { | 2526 | { |
2518 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2527 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2519 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2528 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2520 | } | 2529 | } |
2521 | |||
2522 | } | 2530 | } |
2523 | else | 2531 | else |
2524 | { | 2532 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 6164368..2f6a0db 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -191,7 +191,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
191 | if (handlerChildAgentUpdate != null) | 191 | if (handlerChildAgentUpdate != null) |
192 | handlerChildAgentUpdate(cAgentData); | 192 | handlerChildAgentUpdate(cAgentData); |
193 | 193 | ||
194 | |||
195 | return true; | 194 | return true; |
196 | } | 195 | } |
197 | 196 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e960d51..6b95624 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -104,6 +104,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | } | 104 | } |
105 | protected ScenePresenceAnimator m_animator; | 105 | protected ScenePresenceAnimator m_animator; |
106 | 106 | ||
107 | /// <value> | ||
108 | /// The scene objects attached to this avatar. Do not change this list directly - use methods such as | ||
109 | /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it. | ||
110 | /// </value> | ||
111 | public List<SceneObjectGroup> Attachments | ||
112 | { | ||
113 | get { return m_attachments; } | ||
114 | } | ||
107 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 115 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
108 | 116 | ||
109 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); | 117 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); |
@@ -1105,7 +1113,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1105 | 1113 | ||
1106 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1114 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1107 | SendInitialData(); | 1115 | SendInitialData(); |
1108 | |||
1109 | } | 1116 | } |
1110 | 1117 | ||
1111 | /// <summary> | 1118 | /// <summary> |