From 7759bda833c03f4c29500dce32b835a7aef8285b Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Wed, 20 Apr 2011 21:58:49 -0700
Subject: Added an "immediate" queue to the priority queue. This is per
Melanie's very good suggestion. The immediate queue is serviced completely
before all others, making it a very good place to put avatar updates &
attachments.
Moved the priority queue out of the LLUDP directory and
into the framework. It is now a fairly general utility.
---
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index e3ed905..2e80156 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes
// If this is an update for our own avatar give it the highest priority
if (client.AgentId == entity.UUID)
- return 0;
+ return PriorityQueue.ImmediateQueue;
uint priority;
@@ -172,7 +172,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
// throw new InvalidOperationException("Prioritization agent not defined");
- return Int32.MaxValue;
+ return PriorityQueue.NumberOfQueues - 1;
}
// Use group position for child prims, since we are putting child prims in
--
cgit v1.1
From 13d6e05d5a346dcb9dbaec29af37ee63be790acb Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 21 Apr 2011 23:03:38 +0100
Subject: Implement agent limits
---
OpenSim/Region/Framework/Scenes/Scene.cs | 20 ++++++++++++++++++++
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +++++
2 files changed, 25 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fdd5205..01de824 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3665,6 +3665,15 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
+ int num = m_sceneGraph.GetNumberOfScenePresences();
+
+ if (num >= RegionInfo.RegionSettings.AgentLimit)
+ {
+ if (!Permissions.IsAdministrator(cAgentData.AgentID))
+ return false;
+ }
+
+
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
@@ -4966,6 +4975,17 @@ namespace OpenSim.Region.Framework.Scenes
// child agent creation, thereby emulating the SL behavior.
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
{
+ int num = m_sceneGraph.GetNumberOfScenePresences();
+
+ if (num >= RegionInfo.RegionSettings.AgentLimit)
+ {
+ if (!Permissions.IsAdministrator(agentID))
+ {
+ reason = "The region is full";
+ return false;
+ }
+ }
+
reason = String.Empty;
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 72f0402..fc31b65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -800,6 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
return m_scenePresenceArray;
}
+ public int GetNumberOfScenePresences()
+ {
+ return m_scenePresenceArray.Count;
+ }
+
///
/// Request a scene presence by UUID. Fast, indexed lookup.
///
--
cgit v1.1
From a3bd769cb33ee59b883998205454bb340d44cb9e Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Fri, 22 Apr 2011 14:55:23 -0700
Subject: Added a second immediate queue to be used for the BestAvatar policy
and currently used for all of an avatars attachments by the other policies.
Also changed the way items are pulled from the update queues to bias close
objects even more.
---
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 34 +++++++++++++++++++++++---
1 file changed, 30 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 2e80156..a7637c0 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes
// If this is an update for our own avatar give it the highest priority
if (client.AgentId == entity.UUID)
- return PriorityQueue.ImmediateQueue;
+ return 0;
uint priority;
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes
private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
{
- return 1;
+ // And anything attached to this avatar gets top priority as well
+ if (entity is SceneObjectPart)
+ {
+ SceneObjectPart sop = (SceneObjectPart)entity;
+ if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
+ return 1;
+ }
+
+ return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues
}
private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
{
+ // And anything attached to this avatar gets top priority as well
+ if (entity is SceneObjectPart)
+ {
+ SceneObjectPart sop = (SceneObjectPart)entity;
+ if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
+ return 1;
+ }
+
return ComputeDistancePriority(client,entity,false);
}
private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
{
+ // And anything attached to this avatar gets top priority as well
+ if (entity is SceneObjectPart)
+ {
+ SceneObjectPart sop = (SceneObjectPart)entity;
+ if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
+ return 1;
+ }
+
return ComputeDistancePriority(client,entity,true);
}
@@ -197,8 +221,10 @@ namespace OpenSim.Region.Framework.Scenes
// And convert the distance to a priority queue, this computation gives queues
// at 10, 20, 40, 80, 160, 320, 640, and 1280m
- uint pqueue = 1;
- for (int i = 0; i < 8; i++)
+ uint pqueue = PriorityQueue.NumberOfImmediateQueues;
+ uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
+
+ for (int i = 0; i < queues - 1; i++)
{
if (distance < 10 * Math.Pow(2.0,i))
break;
--
cgit v1.1
From 77ab7ce084d32c45273d79e9ec4f52c43e3a1d97 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 25 Apr 2011 15:11:29 -0700
Subject: Fixed the transmission of throttles from root agent to child agents.
Child throttles are based on the number of child agents known to the root and
at least 1/4 of the throttle given to the root.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 33 +++++++++++-------------
1 file changed, 15 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 00a1487..ef0eb89 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2632,18 +2632,17 @@ namespace OpenSim.Region.Framework.Scenes
cadu.GroupAccess = 0;
cadu.Position = AbsolutePosition;
cadu.regionHandle = m_rootRegionHandle;
+
+ // Throttles
float multiplier = 1;
- int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
- if (innacurateNeighbors != 0)
- {
- multiplier = 1f / (float)innacurateNeighbors;
- }
- if (multiplier <= 0f)
- {
+ int childRegions = m_knownChildRegions.Count;
+ if (childRegions != 0)
+ multiplier = 1f / childRegions;
+
+ // Minimum throttle for a child region is 1/4 of the root region throttle
+ if (multiplier <= 0.25f)
multiplier = 0.25f;
- }
- //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
cadu.Velocity = Velocity;
@@ -3039,16 +3038,14 @@ namespace OpenSim.Region.Framework.Scenes
// Throttles
float multiplier = 1;
- int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
- if (innacurateNeighbors != 0)
- {
- multiplier = 1f / innacurateNeighbors;
- }
- if (multiplier <= 0f)
- {
+ int childRegions = m_knownChildRegions.Count;
+ if (childRegions != 0)
+ multiplier = 1f / childRegions;
+
+ // Minimum throttle for a child region is 1/4 of the root region throttle
+ if (multiplier <= 0.25f)
multiplier = 0.25f;
- }
- //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
+
cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
cAgent.HeadRotation = m_headrotation;
--
cgit v1.1
From 1505fbb647f72803efd39aa5e38ad39e6811f6fb Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Tue, 26 Apr 2011 08:54:05 -0700
Subject: Add back the high prioritization for other avatars in the
BestAvatarResponsiveness prioritizer.
---
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index a7637c0..4595a29 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -165,18 +165,20 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!presence.IsChildAgent)
{
+ // All avatars other than our own go into pqueue 1
+ if (entity is ScenePresence)
+ return 1;
+
if (entity is SceneObjectPart)
{
+ // Attachments are high priority,
+ if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
+ return 1;
+
// Non physical prims are lower priority than physical prims
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
if (physActor == null || !physActor.IsPhysical)
pqueue++;
-
- // Attachments are high priority,
- // MIC: shouldn't these already be in the highest priority queue already
- // since their root position is same as the avatars?
- if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
- pqueue = 1;
}
}
}
--
cgit v1.1
From 16f6f55f2d203f9ef40fba85860bb9dbd416bd0f Mon Sep 17 00:00:00 2001
From: dahlia
Date: Tue, 26 Apr 2011 16:22:44 -0700
Subject: network traffic reduction - decrease update frequency for moving
avatars when velocity is unchanged
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 +++++++++++++++++-------
1 file changed, 24 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ef0eb89..e4413a9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2340,12 +2340,14 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Client(s)
+
///
/// Sends a location update to the client connected to this scenePresence
///
///
public void SendTerseUpdateToClient(IClientAPI remoteClient)
{
+
// If the client is inactive, it's getting its updates from another
// server.
if (remoteClient.IsActive)
@@ -2358,8 +2360,8 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
remoteClient.SendPrimUpdate(
- this,
- PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
+ this,
+ PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -2367,16 +2369,31 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+
+ // vars to support reduced update frequency when velocity is unchanged
+ private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
+ private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
+
///
/// Send a location/velocity/accelleration update to all agents in scene
///
public void SendTerseUpdateToAllClients()
{
- m_perfMonMS = Util.EnvironmentTickCount();
-
- m_scene.ForEachClient(SendTerseUpdateToClient);
+ int currentTick = Util.EnvironmentTickCount();
- m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
+ // decrease update frequency when avatar is moving but velocity is not changing
+ if (m_velocity.Length() < 0.01f
+ || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
+ || currentTick - lastTerseUpdateToAllClientsTick > 1500)
+ {
+ m_perfMonMS = currentTick;
+ lastVelocitySentToAllClients = m_velocity;
+ lastTerseUpdateToAllClientsTick = currentTick;
+
+ m_scene.ForEachClient(SendTerseUpdateToClient);
+
+ m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
+ }
}
public void SendCoarseLocations(List coarseLocations, List avatarUUIDs)
@@ -3268,10 +3285,7 @@ namespace OpenSim.Region.Framework.Scenes
m_updateflag = true;
- // The magic constant 0.95f seems to make walking feel less jerky,
- // probably because it hackishly accounts for the overall latency of
- // these Velocity updates -- Diva
- Velocity = force * .95F;
+ Velocity = force;
m_forceToApply = null;
}
--
cgit v1.1
From 50aa93137d052c643a6ed44c32f0b4c5b32da79e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 28 Apr 2011 00:59:21 +0100
Subject: Fix a bug where physical objects rezzed with an initial velocity by
script do not receive this velocity.
This is a minimal fix for the 0.7.1 release, pending a non copy/paste solution.
This hopefully addresses http://opensimulator.org/mantis/view.php?id=5457
The bug was introduced in commit 3ba5eeb
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0f85925..0b2b01a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2039,6 +2039,12 @@ namespace OpenSim.Region.Framework.Scenes
if (rot != null)
group.UpdateGroupRotationR((Quaternion)rot);
+ // TODO: This needs to be refactored with the similar code in
+ // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
+ // possibly by allowing this method to take a null rotation.
+ if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
+ group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
+
// We can only call this after adding the scene object, since the scene object references the scene
// to find out if scripts should be activated at all.
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
--
cgit v1.1
From cd7517ccb9d522f5fecd57523285a0b17c147620 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 28 Apr 2011 22:59:12 +0100
Subject: Stop CHANGED_INVENTORY firing twice if a notecard is edited in prim.
Addresses http://opensimulator.org/mantis/view.php?id=5444
Fix is to stop the asset transaction calling UpdateInventoryItem() since the caller is doing it anyway, which is more correct.
This did not effect scripts.
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 ++++
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0b2b01a..b0f0de6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1430,6 +1430,10 @@ namespace OpenSim.Region.Framework.Scenes
}
else // Updating existing item with new perms etc
{
+// m_log.DebugFormat(
+// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
+// currentItem.Name, part.Name);
+
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface();
if (agentTransactions != null)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3281eab..3b60f8c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -693,8 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
{
TaskInventoryItem it = GetInventoryItem(item.ItemID);
if (it != null)
-
{
+// m_log.DebugFormat("[PRIM INVENTORY]: Updating item {0} in {1}", item.Name, m_part.Name);
+
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
@@ -711,14 +712,16 @@ namespace OpenSim.Region.Framework.Scenes
m_items[item.ItemID] = item;
m_inventorySerial++;
}
-
+
if (fireScriptEvents)
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
+
if (considerChanged)
{
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
}
+
return true;
}
else
--
cgit v1.1
From 9892e115ccdcc8567087041917fb5c7694aa8836 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 28 Apr 2011 20:19:54 -0700
Subject: Fatpack message on agent transfers: 1 message only (UpdateAgent)
containing the agent and all attachments. Preserves backwards compatibility
-- older sims get passed attachments one by one. Meaning that I finally
introduced versioning in the simulation service.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 124 +++++----------------
3 files changed, 32 insertions(+), 98 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 01de824..696c6ee 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2316,7 +2316,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool IncomingCreateObject(ISceneObject sog)
{
- //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
+ //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
+ // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
+
SceneObjectGroup newObject;
try
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 19a9506..bccbe68 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3361,6 +3361,8 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog = Copy(false);
sog.m_isDeleted = false;
+ sog.RootPart.IsAttachment = false;
+ sog.RootPart.GroupPosition = sog.RootPart.AttachedPos;
return sog;
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e4413a9..507fc50 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3078,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.Appearance = new AvatarAppearance(m_appearance);
-/*
- try
- {
- // We might not pass the Wearables in all cases...
- // They're only needed so that persistent changes to the appearance
- // are preserved in the new region where the user is moving to.
- // But in Hypergrid we might not let this happen.
- int i = 0;
- UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
- foreach (AvatarWearable aw in m_appearance.Wearables)
- {
- if (aw != null)
- {
- wears[i++] = aw.ItemID;
- wears[i++] = aw.AssetID;
- }
- else
- {
- wears[i++] = UUID.Zero;
- wears[i++] = UUID.Zero;
- }
- }
- cAgent.Wearables = wears;
-
- cAgent.VisualParams = m_appearance.VisualParams;
-
- if (m_appearance.Texture != null)
- cAgent.AgentTextures = m_appearance.Texture.GetBytes();
- }
- catch (Exception e)
- {
- m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
- }
-
- //Attachments
- List attPoints = m_appearance.GetAttachedPoints();
- if (attPoints != null)
- {
- //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
- int i = 0;
- AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
- foreach (int point in attPoints)
- {
- attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
- }
- cAgent.Attachments = attachs;
- }
-*/
lock (scriptedcontrols)
{
ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3145,9 +3097,21 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
- // cAgent.GroupID = ??
- // Groups???
-
+ // Attachment objects
+ if (m_attachments != null && m_attachments.Count > 0)
+ {
+ cAgent.AttachmentObjects = new List();
+ cAgent.AttachmentObjectStates = new List();
+ IScriptModule se = m_scene.RequestModuleInterface();
+ foreach (SceneObjectGroup sog in m_attachments)
+ {
+ // We need to make a copy and pass that copy
+ // because of transfers withn the same sim
+ ISceneObject clone = sog.CloneForNewScene();
+ cAgent.AttachmentObjects.Add(clone);
+ cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
+ }
+ }
}
public void CopyFrom(AgentData cAgent)
@@ -3188,50 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes
AddToPhysicalScene(isFlying);
}
-/*
- uint i = 0;
- try
- {
- if (cAgent.Wearables == null)
- cAgent.Wearables = new UUID[0];
- AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
- for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
- {
- UUID itemId = cAgent.Wearables[n];
- UUID assetId = cAgent.Wearables[n + 1];
- wears[i++] = new AvatarWearable(itemId, assetId);
- }
- // m_appearance.Wearables = wears;
- Primitive.TextureEntry textures = null;
- if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
- textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
-
- byte[] visuals = null;
-
- if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
- visuals = (byte[])cAgent.VisualParams.Clone();
-
- m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
- }
- catch (Exception e)
- {
- m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
- }
-
- // Attachments
- try
- {
- if (cAgent.Attachments != null)
- {
- m_appearance.ClearAttachments();
- foreach (AvatarAttachment att in cAgent.Attachments)
- {
- m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
- }
- }
- }
- catch { }
-*/
try
{
lock (scriptedcontrols)
@@ -3261,8 +3181,18 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
- //cAgent.GroupID = ??
- //Groups???
+ if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
+ {
+ m_attachments = new List();
+ int i = 0;
+ foreach (ISceneObject so in cAgent.AttachmentObjects)
+ {
+ ((SceneObjectGroup)so).LocalId = 0;
+ ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
+ so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
+ m_scene.IncomingCreateObject(so);
+ }
+ }
}
public bool CopyAgent(out IAgentData agent)
--
cgit v1.1
From 73caa4e94abc920269c2eba8423be49192ef184b Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 29 Apr 2011 08:42:51 -0700
Subject: Minor correction to yesterday's changes. Make normal prim crossing
(no attach) work well again.
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 --
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++
2 files changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bccbe68..19a9506 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3361,8 +3361,6 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog = Copy(false);
sog.m_isDeleted = false;
- sog.RootPart.IsAttachment = false;
- sog.RootPart.GroupPosition = sog.RootPart.AttachedPos;
return sog;
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 507fc50..fe4a7d1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3108,6 +3108,9 @@ namespace OpenSim.Region.Framework.Scenes
// We need to make a copy and pass that copy
// because of transfers withn the same sim
ISceneObject clone = sog.CloneForNewScene();
+ // Attachment module assumes that GroupPosition holds the offsets...!
+ ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
+ ((SceneObjectGroup)clone).RootPart.IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
}
--
cgit v1.1