aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDiva Canto2010-11-29 09:58:20 -0800
committerDiva Canto2010-11-29 09:58:20 -0800
commitf3835fe15c91ece4ad61ba1caa67603374ad2574 (patch)
treebed4cf2014aeea194086d940e8c86ac998bc692a /OpenSim/Region/Framework
parentFix unit test. (diff)
parentFix the build break (diff)
downloadopensim-SC_OLD-f3835fe15c91ece4ad61ba1caa67603374ad2574.zip
opensim-SC_OLD-f3835fe15c91ece4ad61ba1caa67603374ad2574.tar.gz
opensim-SC_OLD-f3835fe15c91ece4ad61ba1caa67603374ad2574.tar.bz2
opensim-SC_OLD-f3835fe15c91ece4ad61ba1caa67603374ad2574.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs261
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs40
3 files changed, 177 insertions, 139 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 70aceb1..90223b1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2324,16 +2324,14 @@ namespace OpenSim.Region.Framework.Scenes
2324 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2324 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
2325 return false; 2325 return false;
2326 } 2326 }
2327 2327
2328 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); 2328 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2329 2329
2330 newObject.ResumeScripts(); 2330 newObject.ResumeScripts();
2331 2331
2332 // Do this as late as possible so that listeners have full access to the incoming object 2332 // Do this as late as possible so that listeners have full access to the incoming object
2333 EventManager.TriggerOnIncomingSceneObject(newObject); 2333 EventManager.TriggerOnIncomingSceneObject(newObject);
2334 2334
2335 TriggerChangedTeleport(newObject);
2336
2337 return true; 2335 return true;
2338 } 2336 }
2339 2337
@@ -2441,7 +2439,7 @@ namespace OpenSim.Region.Framework.Scenes
2441 return true; 2439 return true;
2442 } 2440 }
2443 2441
2444 private void TriggerChangedTeleport(SceneObjectGroup sog) 2442 private int GetStateSource(SceneObjectGroup sog)
2445 { 2443 {
2446 ScenePresence sp = GetScenePresence(sog.OwnerID); 2444 ScenePresence sp = GetScenePresence(sog.OwnerID);
2447 2445
@@ -2452,13 +2450,12 @@ namespace OpenSim.Region.Framework.Scenes
2452 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) 2450 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
2453 { 2451 {
2454 // This will get your attention 2452 // This will get your attention
2455 //m_log.Error("[XXX] Triggering "); 2453 //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
2456 2454
2457 // Trigger CHANGED_TELEPORT 2455 return 5; // StateSource.Teleporting
2458 sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
2459 } 2456 }
2460
2461 } 2457 }
2458 return 2; // StateSource.PrimCrossing
2462 } 2459 }
2463 2460
2464 #endregion 2461 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index db69093..82214bf 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -445,8 +445,36 @@ namespace OpenSim.Region.Framework.Scenes
445 PhysicsActor actor = m_physicsActor; 445 PhysicsActor actor = m_physicsActor;
446 if (actor != null) 446 if (actor != null)
447 m_pos = actor.Position; 447 m_pos = actor.Position;
448 else
449 {
450 // Obtain the correct position of a seated avatar.
451 // In addition to providing the correct position while
452 // the avatar is seated, this value will also
453 // be used as the location to unsit to.
454 //
455 // If m_parentID is not 0, assume we are a seated avatar
456 // and we should return the position based on the sittarget
457 // offset and rotation of the prim we are seated on.
458 //
459 // Generally, m_pos will contain the position of the avatar
460 // in the sim unless the avatar is on a sit target. While
461 // on a sit target, m_pos will contain the desired offset
462 // without the parent rotation applied.
463 if (m_parentID != 0)
464 {
465 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
466 if (part != null)
467 {
468 return m_parentPosition + (m_pos * part.GetWorldRotation());
469 }
470 else
471 {
472 return m_parentPosition + m_pos;
473 }
474 }
475 }
448 476
449 return m_parentPosition + m_pos; 477 return m_pos;
450 } 478 }
451 set 479 set
452 { 480 {
@@ -703,7 +731,9 @@ namespace OpenSim.Region.Framework.Scenes
703 // Note: This won't send data *to* other clients in that region (children don't send) 731 // Note: This won't send data *to* other clients in that region (children don't send)
704 732
705// MIC: This gets called again in CompleteMovement 733// MIC: This gets called again in CompleteMovement
706 SendInitialFullUpdateToAllClients(); 734 // SendInitialFullUpdateToAllClients();
735 SendOtherAgentsAvatarDataToMe();
736 SendOtherAgentsAppearanceToMe();
707 737
708 RegisterToEvents(); 738 RegisterToEvents();
709 SetDirectionVectors(); 739 SetDirectionVectors();
@@ -1613,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes
1613 { 1643 {
1614 AbsolutePosition = part.AbsolutePosition; 1644 AbsolutePosition = part.AbsolutePosition;
1615 Velocity = Vector3.Zero; 1645 Velocity = Vector3.Zero;
1616 SendFullUpdateToAllClients(); 1646 SendAvatarDataToAllAgents();
1617 1647
1618 //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); 1648 //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
1619 } 1649 }
@@ -1688,7 +1718,7 @@ namespace OpenSim.Region.Framework.Scenes
1688 m_parentPosition = Vector3.Zero; 1718 m_parentPosition = Vector3.Zero;
1689 1719
1690 m_parentID = 0; 1720 m_parentID = 0;
1691 SendFullUpdateToAllClients(); 1721 SendAvatarDataToAllAgents();
1692 m_requestedSitTargetID = 0; 1722 m_requestedSitTargetID = 0;
1693 if (m_physicsActor != null && m_appearance != null) 1723 if (m_physicsActor != null && m_appearance != null)
1694 { 1724 {
@@ -2154,7 +2184,7 @@ namespace OpenSim.Region.Framework.Scenes
2154 RemoveFromPhysicalScene(); 2184 RemoveFromPhysicalScene();
2155 2185
2156 Animator.TrySetMovementAnimation(sitAnimation); 2186 Animator.TrySetMovementAnimation(sitAnimation);
2157 SendFullUpdateToAllClients(); 2187 SendAvatarDataToAllAgents();
2158 // This may seem stupid, but Our Full updates don't send avatar rotation :P 2188 // This may seem stupid, but Our Full updates don't send avatar rotation :P
2159 // So we're also sending a terse update (which has avatar rotation) 2189 // So we're also sending a terse update (which has avatar rotation)
2160 // [Update] We do now. 2190 // [Update] We do now.
@@ -2379,165 +2409,169 @@ namespace OpenSim.Region.Framework.Scenes
2379 } 2409 }
2380 2410
2381 /// <summary> 2411 /// <summary>
2382 /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) 2412 /// Do everything required once a client completes its movement into a region and becomes
2413 /// a root agent.
2383 /// </summary> 2414 /// </summary>
2384 /// <param name="remoteAvatar"></param> 2415 private void SendInitialData()
2385 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
2386 { 2416 {
2387 // 2 stage check is needed. 2417 // Moved this into CompleteMovement to ensure that m_appearance is initialized before
2388 if (remoteAvatar == null) 2418 // the inventory arrives
2389 return; 2419 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2390
2391 IClientAPI cl = remoteAvatar.ControllingClient;
2392 if (cl == null)
2393 return;
2394 2420
2395 if (m_appearance.Texture == null) 2421 // This agent just became root. We are going to tell everyone about it. The process of
2396 return; 2422 // getting other avatars information was initiated in the constructor... don't do it
2423 // again here...
2424 SendAvatarDataToAllAgents();
2397 2425
2398// MT: This is needed for sit. It's legal to send it to oneself, and the name 2426 // We have an appearance but we may not have the baked textures. Check the asset cache
2399// of the method is a misnomer 2427 // to see if all the baked textures are already here.
2400// 2428 if (m_scene.AvatarFactory != null)
2401// if (LocalId == remoteAvatar.LocalId) 2429 {
2402// { 2430 if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient))
2403// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); 2431 {
2404// return; 2432// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
2405// } 2433 SendAppearanceToAgent(this);
2406 2434
2407 if (IsChildAgent) 2435 // If the avatars baked textures are all in the cache, then we have a
2436 // complete appearance... send it out, if not, then we'll send it when
2437 // the avatar finishes updating its appearance
2438 SendAppearanceToAllOtherAgents();
2439 }
2440 }
2441 else
2408 { 2442 {
2409 m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID); 2443 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
2410 return;
2411 } 2444 }
2412
2413 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
2414 m_scene.StatsReporter.AddAgentUpdates(1);
2415 } 2445 }
2416 2446
2417 /// <summary> 2447 /// <summary>
2418 /// Tell *ALL* agents about this agent 2448 /// Send this agent's avatar data to all other root and child agents in the scene
2449 /// This agent must be root. This avatar will receive its own update.
2419 /// </summary> 2450 /// </summary>
2420 public void SendInitialFullUpdateToAllClients() 2451 public void SendAvatarDataToAllAgents()
2421 { 2452 {
2422 m_perfMonMS = Util.EnvironmentTickCount(); 2453 // only send update from root agents to other clients; children are only "listening posts"
2423 int avUpdates = 0; 2454 if (IsChildAgent)
2424 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
2425 { 2455 {
2426 ++avUpdates; 2456 m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
2427 2457 return;
2428 // Don't update ourselves 2458 }
2429 if (avatar.LocalId == LocalId) 2459
2430 return; 2460 m_perfMonMS = Util.EnvironmentTickCount();
2431
2432 // If this is a root agent, then get info about the avatar
2433 if (!IsChildAgent)
2434 {
2435 SendFullUpdateToOtherClient(avatar);
2436 }
2437 2461
2438 // If the other avatar is a root 2462 int count = 0;
2439 if (!avatar.IsChildAgent) 2463 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2440 { 2464 {
2441 avatar.SendFullUpdateToOtherClient(this); 2465 SendAvatarDataToAgent(scenePresence);
2442 avatar.SendAppearanceToOtherAgent(this); 2466 count++;
2443 avatar.Animator.SendAnimPackToClient(ControllingClient); 2467 });
2444 }
2445 });
2446 2468
2447 m_scene.StatsReporter.AddAgentUpdates(avUpdates); 2469 m_scene.StatsReporter.AddAgentUpdates(count);
2448 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2470 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2449
2450 //Animator.SendAnimPack();
2451 } 2471 }
2452 2472
2453 public void SendFullUpdateToAllClients() 2473 /// <summary>
2474 /// Send avatar data for all other root agents to this agent, this agent
2475 /// can be either a child or root
2476 /// </summary>
2477 public void SendOtherAgentsAvatarDataToMe()
2454 { 2478 {
2455 m_perfMonMS = Util.EnvironmentTickCount(); 2479 m_perfMonMS = Util.EnvironmentTickCount();
2456 2480
2457 // only send update from root agents to other clients; children are only "listening posts"
2458 if (IsChildAgent)
2459 {
2460 m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
2461 return;
2462 }
2463
2464 int count = 0; 2481 int count = 0;
2465 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 2482 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2466 { 2483 {
2467 if (sp.IsChildAgent) 2484 // only send information about root agents
2468 return; 2485 if (scenePresence.IsChildAgent)
2469 SendFullUpdateToOtherClient(sp); 2486 return;
2470 ++count; 2487
2471 }); 2488 // only send information about other root agents
2489 if (scenePresence.UUID == UUID)
2490 return;
2491
2492 scenePresence.SendAvatarDataToAgent(this);
2493 count++;
2494 });
2495
2472 m_scene.StatsReporter.AddAgentUpdates(count); 2496 m_scene.StatsReporter.AddAgentUpdates(count);
2473 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2497 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2474
2475 Animator.SendAnimPack();
2476 } 2498 }
2477 2499
2478 /// <summary> 2500 /// <summary>
2479 /// Do everything required once a client completes its movement into a region 2501 /// Send avatar data to an agent.
2480 /// </summary> 2502 /// </summary>
2481 public void SendInitialData() 2503 /// <param name="avatar"></param>
2504 private void SendAvatarDataToAgent(ScenePresence avatar)
2482 { 2505 {
2483 // Moved this into CompleteMovement to ensure that m_appearance is initialized before 2506// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2484 // the inventory arrives
2485 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2486 2507
2487 m_controllingClient.SendAvatarDataImmediate(this); 2508 avatar.ControllingClient.SendAvatarDataImmediate(this);
2488 if (m_scene.AvatarFactory != null) 2509 Animator.SendAnimPackToClient(avatar.ControllingClient);
2489 { 2510 }
2490 if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) 2511
2491 { 2512 /// <summary>
2492// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); 2513 /// Send this agent's appearance to all other root and child agents in the scene
2493 m_controllingClient.SendAppearance( 2514 /// This agent must be root.
2494 m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); 2515 /// </summary>
2495 } 2516 public void SendAppearanceToAllOtherAgents()
2496 } 2517 {
2497 else 2518 // only send update from root agents to other clients; children are only "listening posts"
2519 if (IsChildAgent)
2498 { 2520 {
2499 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); 2521 m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
2522 return;
2500 } 2523 }
2524
2525 m_perfMonMS = Util.EnvironmentTickCount();
2501 2526
2502 SendInitialFullUpdateToAllClients(); 2527 int count = 0;
2528 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2529 {
2530 if (scenePresence.UUID == UUID)
2531 return;
2532
2533 SendAppearanceToAgent(scenePresence);
2534 count++;
2535 });
2536
2537 m_scene.StatsReporter.AddAgentUpdates(count);
2538 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2503 } 2539 }
2504 2540
2505 /// <summary> 2541 /// <summary>
2506 /// 2542 /// Send appearance from all other root agents to this agent. this agent
2543 /// can be either root or child
2507 /// </summary> 2544 /// </summary>
2508 public void SendAppearanceToAllOtherAgents() 2545 public void SendOtherAgentsAppearanceToMe()
2509 { 2546 {
2510// DEBUG ON
2511// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
2512// DEBUG OFF
2513 m_perfMonMS = Util.EnvironmentTickCount(); 2547 m_perfMonMS = Util.EnvironmentTickCount();
2514 2548
2549 int count = 0;
2515 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2550 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2516 { 2551 {
2517 if (scenePresence.UUID != UUID) 2552 // only send information about root agents
2518 { 2553 if (scenePresence.IsChildAgent)
2519 SendAppearanceToOtherAgent(scenePresence); 2554 return;
2520 } 2555
2556 // only send information about other root agents
2557 if (scenePresence.UUID == UUID)
2558 return;
2559
2560 scenePresence.SendAppearanceToAgent(this);
2561 count++;
2521 }); 2562 });
2522 2563
2564 m_scene.StatsReporter.AddAgentUpdates(count);
2523 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2565 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2524 } 2566 }
2525 2567
2526 /// <summary> 2568 /// <summary>
2527 /// Send appearance data to an agent that isn't this one. 2569 /// Send appearance data to an agent.
2528 /// </summary> 2570 /// </summary>
2529 /// <param name="avatar"></param> 2571 /// <param name="avatar"></param>
2530 public void SendAppearanceToOtherAgent(ScenePresence avatar) 2572 private void SendAppearanceToAgent(ScenePresence avatar)
2531 { 2573 {
2532 if (LocalId == avatar.LocalId)
2533 {
2534 m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID);
2535 return;
2536 }
2537
2538// DEBUG ON
2539// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); 2574// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2540// DEBUG OFF
2541 2575
2542 avatar.ControllingClient.SendAppearance( 2576 avatar.ControllingClient.SendAppearance(
2543 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2577 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
@@ -3050,9 +3084,6 @@ namespace OpenSim.Region.Framework.Scenes
3050 3084
3051 public void CopyFrom(AgentData cAgent) 3085 public void CopyFrom(AgentData cAgent)
3052 { 3086 {
3053// DEBUG ON
3054 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
3055// DEBUG OFF
3056 m_originRegionID = cAgent.RegionID; 3087 m_originRegionID = cAgent.RegionID;
3057 3088
3058 m_callbackURI = cAgent.CallbackURI; 3089 m_callbackURI = cAgent.CallbackURI;
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index aee2d10..3978a7d 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
86 /// <param name="assetUuids">The assets gathered</param> 86 /// <param name="assetUuids">The assets gathered</param>
87 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids) 87 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
88 { 88 {
89 assetUuids[assetUuid] = assetType; 89 try
90 90 {
91 if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) 91 assetUuids[assetUuid] = assetType;
92 { 92
93 GetWearableAssetUuids(assetUuid, assetUuids); 93 if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
94 } 94 {
95 else if (AssetType.Gesture == assetType) 95 GetWearableAssetUuids(assetUuid, assetUuids);
96 { 96 }
97 GetGestureAssetUuids(assetUuid, assetUuids); 97 else if (AssetType.Gesture == assetType)
98 } 98 {
99 else if (AssetType.LSLText == assetType) 99 GetGestureAssetUuids(assetUuid, assetUuids);
100 { 100 }
101 GetScriptAssetUuids(assetUuid, assetUuids); 101 else if (AssetType.LSLText == assetType)
102 {
103 GetScriptAssetUuids(assetUuid, assetUuids);
104 }
105 else if (AssetType.Object == assetType)
106 {
107 GetSceneObjectAssetUuids(assetUuid, assetUuids);
108 }
102 } 109 }
103 else if (AssetType.Object == assetType) 110 catch (Exception)
104 { 111 {
105 GetSceneObjectAssetUuids(assetUuid, assetUuids); 112 m_log.ErrorFormat(
113 "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
114 assetUuid, assetType);
115 throw;
106 } 116 }
107 } 117 }
108 118