diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 |
6 files changed, 88 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index cabb5f9..22909bc 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -209,6 +209,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; | 209 | public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; |
210 | public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; | 210 | public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; |
211 | 211 | ||
212 | /// <summary> | ||
213 | /// Triggered when an object or attachment enters a scene | ||
214 | /// </summary> | ||
215 | public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; | ||
216 | public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); | ||
217 | |||
212 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); | 218 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); |
213 | 219 | ||
214 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; | 220 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; |
@@ -411,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
411 | } | 417 | } |
412 | } | 418 | } |
413 | } | 419 | } |
414 | } | 420 | } |
415 | 421 | ||
416 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 422 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
417 | { | 423 | { |
@@ -1228,6 +1234,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1228 | } | 1234 | } |
1229 | } | 1235 | } |
1230 | 1236 | ||
1237 | public void TriggerOnIncomingSceneObject(SceneObjectGroup so) | ||
1238 | { | ||
1239 | OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject; | ||
1240 | if (handlerIncomingSceneObject != null) | ||
1241 | { | ||
1242 | foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList()) | ||
1243 | { | ||
1244 | try | ||
1245 | { | ||
1246 | d(so); | ||
1247 | } | ||
1248 | catch (Exception e) | ||
1249 | { | ||
1250 | m_log.ErrorFormat( | ||
1251 | "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}", | ||
1252 | e.Message, e.StackTrace); | ||
1253 | } | ||
1254 | } | ||
1255 | } | ||
1256 | } | ||
1257 | |||
1231 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) | 1258 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) |
1232 | { | 1259 | { |
1233 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; | 1260 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d2f33b0..12f0489 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2433,9 +2433,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2433 | return successYN; | 2433 | return successYN; |
2434 | } | 2434 | } |
2435 | 2435 | ||
2436 | /// <summary> | ||
2437 | /// Called when objects or attachments cross the border between regions. | ||
2438 | /// </summary> | ||
2439 | /// <param name="sog"></param> | ||
2440 | /// <returns></returns> | ||
2436 | public bool IncomingCreateObject(ISceneObject sog) | 2441 | public bool IncomingCreateObject(ISceneObject sog) |
2437 | { | 2442 | { |
2438 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2443 | //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
2439 | SceneObjectGroup newObject; | 2444 | SceneObjectGroup newObject; |
2440 | try | 2445 | try |
2441 | { | 2446 | { |
@@ -2452,7 +2457,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2452 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); | 2457 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); |
2453 | return false; | 2458 | return false; |
2454 | } | 2459 | } |
2460 | |||
2455 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | 2461 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); |
2462 | |||
2463 | // Do this as late as possible so that listeners have full access to the incoming object | ||
2464 | EventManager.TriggerOnIncomingSceneObject(newObject); | ||
2465 | |||
2456 | return true; | 2466 | return true; |
2457 | } | 2467 | } |
2458 | 2468 | ||
@@ -2464,6 +2474,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2464 | /// <returns>False</returns> | 2474 | /// <returns>False</returns> |
2465 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) | 2475 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) |
2466 | { | 2476 | { |
2477 | //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); | ||
2478 | |||
2467 | ScenePresence sp = GetScenePresence(userID); | 2479 | ScenePresence sp = GetScenePresence(userID); |
2468 | if (sp != null) | 2480 | if (sp != null) |
2469 | { | 2481 | { |
@@ -2498,7 +2510,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2498 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2510 | foreach (SceneObjectPart p in sceneObject.Children.Values) |
2499 | p.LocalId = 0; | 2511 | p.LocalId = 0; |
2500 | 2512 | ||
2501 | if ((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) // Attachment | 2513 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2502 | { | 2514 | { |
2503 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2515 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2504 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2516 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
@@ -2523,29 +2535,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2523 | 2535 | ||
2524 | //RootPrim.SetParentLocalId(parentLocalID); | 2536 | //RootPrim.SetParentLocalId(parentLocalID); |
2525 | 2537 | ||
2526 | m_log.DebugFormat("[ATTACHMENT]: Received " + | 2538 | m_log.DebugFormat( |
2527 | "attachment {0}, inworld asset id {1}", | 2539 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); |
2528 | //grp.RootPart.LastOwnerID.ToString(), | ||
2529 | grp.GetFromItemID(), | ||
2530 | grp.UUID.ToString()); | ||
2531 | 2540 | ||
2532 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2541 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2533 | m_log.DebugFormat("[ATTACHMENT]: Attach " + | 2542 | m_log.DebugFormat( |
2534 | "to avatar {0} at position {1}", | 2543 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2535 | sp.UUID.ToString(), grp.AbsolutePosition); | 2544 | |
2536 | AttachObject(sp.ControllingClient, | 2545 | AttachObject( |
2537 | grp.LocalId, (uint)0, | 2546 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); |
2538 | grp.GroupRotation, | ||
2539 | grp.AbsolutePosition, false); | ||
2540 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2547 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2541 | grp.SendGroupFullUpdate(); | 2548 | grp.SendGroupFullUpdate(); |
2542 | } | 2549 | } |
2543 | else | 2550 | else |
2544 | { | 2551 | { |
2545 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2552 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2546 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2553 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2547 | } | 2554 | } |
2548 | |||
2549 | } | 2555 | } |
2550 | else | 2556 | else |
2551 | { | 2557 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 545183b..9ceab19 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/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9cb1398..4676a30 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -337,7 +337,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | private bool IsAttachmentCheckFull() | 340 | /// <summary> |
341 | /// Check both the attachment property and the relevant properties of the underlying root part. | ||
342 | /// </summary> | ||
343 | /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't | ||
344 | /// have the IsAttachment property yet checked. | ||
345 | /// | ||
346 | /// FIXME: However, this should be fixed so that this property | ||
347 | /// propertly reflects the underlying status. | ||
348 | /// <returns></returns> | ||
349 | public bool IsAttachmentCheckFull() | ||
341 | { | 350 | { |
342 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); | 351 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); |
343 | } | 352 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 72604d8..11682d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4171,9 +4171,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4171 | ScheduleFullUpdate(); | 4171 | ScheduleFullUpdate(); |
4172 | } | 4172 | } |
4173 | 4173 | ||
4174 | // Added to handle bug in libsecondlife's TextureEntry.ToBytes() | 4174 | /// <summary> |
4175 | // not handling RGBA properly. Cycles through, and "fixes" the color | 4175 | /// Update the textures on the part. |
4176 | // info | 4176 | /// </summary> |
4177 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() | ||
4178 | /// not handling RGBA properly. Cycles through, and "fixes" the color | ||
4179 | /// info | ||
4180 | /// <param name="tex"></param> | ||
4177 | public void UpdateTexture(Primitive.TextureEntry tex) | 4181 | public void UpdateTexture(Primitive.TextureEntry tex) |
4178 | { | 4182 | { |
4179 | //Color4 tmpcolor; | 4183 | //Color4 tmpcolor; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f1555f7..1b7ca8b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -106,6 +106,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | } | 106 | } |
107 | protected ScenePresenceAnimator m_animator; | 107 | protected ScenePresenceAnimator m_animator; |
108 | 108 | ||
109 | /// <value> | ||
110 | /// The scene objects attached to this avatar. Do not change this list directly - use methods such as | ||
111 | /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it. | ||
112 | /// </value> | ||
113 | public List<SceneObjectGroup> Attachments | ||
114 | { | ||
115 | get { return m_attachments; } | ||
116 | } | ||
117 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
118 | |||
109 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); | 119 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); |
110 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 120 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
111 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 121 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
@@ -223,9 +233,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
223 | // Agent's Draw distance. | 233 | // Agent's Draw distance. |
224 | protected float m_DrawDistance; | 234 | protected float m_DrawDistance; |
225 | 235 | ||
226 | protected AvatarAppearance m_appearance; | 236 | protected AvatarAppearance m_appearance; |
227 | |||
228 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
229 | 237 | ||
230 | // neighbouring regions we have enabled a child agent in | 238 | // neighbouring regions we have enabled a child agent in |
231 | // holds the seed cap for the child agent in that region | 239 | // holds the seed cap for the child agent in that region |
@@ -640,12 +648,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
640 | #endregion | 648 | #endregion |
641 | 649 | ||
642 | #region Constructor(s) | 650 | #region Constructor(s) |
643 | 651 | ||
644 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) | 652 | public ScenePresence() |
645 | { | 653 | { |
646 | m_animator = new ScenePresenceAnimator(this); | ||
647 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 654 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
648 | CreateSceneViewer(); | 655 | CreateSceneViewer(); |
656 | m_animator = new ScenePresenceAnimator(this); | ||
657 | } | ||
658 | |||
659 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | ||
660 | { | ||
649 | m_rootRegionHandle = reginfo.RegionHandle; | 661 | m_rootRegionHandle = reginfo.RegionHandle; |
650 | m_controllingClient = client; | 662 | m_controllingClient = client; |
651 | m_firstname = m_controllingClient.FirstName; | 663 | m_firstname = m_controllingClient.FirstName; |
@@ -669,7 +681,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
669 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 681 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
670 | m_reprioritization_timer.AutoReset = false; | 682 | m_reprioritization_timer.AutoReset = false; |
671 | 683 | ||
672 | |||
673 | AdjustKnownSeeds(); | 684 | AdjustKnownSeeds(); |
674 | Animator.TrySetMovementAnimation("STAND"); | 685 | Animator.TrySetMovementAnimation("STAND"); |
675 | // we created a new ScenePresence (a new child agent) in a fresh region. | 686 | // we created a new ScenePresence (a new child agent) in a fresh region. |
@@ -1150,7 +1161,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1150 | 1161 | ||
1151 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1162 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1152 | SendInitialData(); | 1163 | SendInitialData(); |
1153 | |||
1154 | } | 1164 | } |
1155 | 1165 | ||
1156 | /// <summary> | 1166 | /// <summary> |
@@ -3388,8 +3398,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3388 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3398 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3389 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3399 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3390 | m_physicsActor.SubscribeEvents(500); | 3400 | m_physicsActor.SubscribeEvents(500); |
3391 | m_physicsActor.LocalID = LocalId; | 3401 | m_physicsActor.LocalID = LocalId; |
3392 | |||
3393 | } | 3402 | } |
3394 | 3403 | ||
3395 | private void OutOfBoundsCall(Vector3 pos) | 3404 | private void OutOfBoundsCall(Vector3 pos) |
@@ -3399,7 +3408,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3399 | 3408 | ||
3400 | //AddToPhysicalScene(flying); | 3409 | //AddToPhysicalScene(flying); |
3401 | if (ControllingClient != null) | 3410 | if (ControllingClient != null) |
3402 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.",true); | 3411 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3403 | } | 3412 | } |
3404 | 3413 | ||
3405 | // Event called by the physics plugin to tell the avatar about a collision. | 3414 | // Event called by the physics plugin to tell the avatar about a collision. |
@@ -3539,13 +3548,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3539 | m_animator = null; | 3548 | m_animator = null; |
3540 | } | 3549 | } |
3541 | 3550 | ||
3542 | public ScenePresence() | ||
3543 | { | ||
3544 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | ||
3545 | CreateSceneViewer(); | ||
3546 | m_animator = new ScenePresenceAnimator(this); | ||
3547 | } | ||
3548 | |||
3549 | public void AddAttachment(SceneObjectGroup gobj) | 3551 | public void AddAttachment(SceneObjectGroup gobj) |
3550 | { | 3552 | { |
3551 | lock (m_attachments) | 3553 | lock (m_attachments) |