Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

prebuild-update
Melanie 2010-08-26 23:39:20 +01:00
commit 1f1d72eba5
15 changed files with 193 additions and 131 deletions

View File

@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
/// ownerless phantom.
///
/// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock
/// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
///
/// </value>
protected HashSet<uint> m_killRecord;
@ -382,18 +382,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
/// <summary>
/// First name of the agent/avatar represented by the client
/// </summary>
public string FirstName { get { return m_firstName; } }
/// <summary>
/// Last name of the agent/avatar represented by the client
/// </summary>
public string LastName { get { return m_lastName; } }
/// <summary>
/// Full name of the client (first name and last name)
/// </summary>
public string Name { get { return FirstName + " " + LastName; } }
public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@ -3531,6 +3535,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EntityUpdate update;
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
{
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
// safety measure.
//
// Receiving updates after kills results in undeleteable prims that persist until relog and
// currently occurs because prims can be deleted before all queued updates are sent.
if (m_killRecord.Contains(update.Entity.LocalId))
{
// m_log.WarnFormat(
// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
// update.Entity.LocalId, Name);
continue;
}
if (update.Entity is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)update.Entity;

View File

@ -37,6 +37,7 @@ using OpenSim.Framework;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
@ -448,12 +449,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
group.DetachToInventoryPrep();
m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID);
UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
m_scene.DeleteSceneObject(group, false);
return;
}
}
}
}
public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
{
// If this is an attachment, then we need to save the modified
// object back into the avatar's inventory. First we save the
// attachment point information, then we update the relative
// positioning (which caused this method to get driven in the
// first place. Then we have to mark the object as NOT an
// attachment. This is necessary in order to correctly save
// and retrieve GroupPosition information for the attachment.
// Then we save the asset back into the appropriate inventory
// entry. Finally, we restore the object's attachment status.
byte attachmentPoint = sog.GetAttachmentPoint();
sog.UpdateGroupPosition(pos);
sog.RootPart.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos;
UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
sog.SetAttachmentPoint(attachmentPoint);
}
/// <summary>
/// Update the attachment asset for the new sog details if they have changed.
/// </summary>
///
/// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
/// these details are not stored on the region.
///
/// <param name="remoteClient"></param>
/// <param name="grp"></param>
/// <param name="itemID"></param>
/// <param name="agentID"></param>
protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
{
if (grp != null)
{
if (!grp.HasGroupChanged)
{
m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
return;
}
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
if (item != null)
{
AssetBase asset = m_scene.CreateAsset(
grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
m_scene.AssetService.Store(asset);
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
m_scene.InventoryService.UpdateItem(item);
// this gets called when the agent logs off!
if (remoteClient != null)
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
}
}
}
}

View File

@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
m_log.InfoFormat(
m_log.DebugFormat(
"[INVENTORY TRANSFER]: {0} IM type received from {1}",
(InstantMessageDialog)im.dialog, client.Name);

View File

@ -142,9 +142,18 @@ namespace OpenSim.Region.DataSnapshot.Providers
node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
xmlobject.AppendChild(node);
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
node.InnerText = land.LandData.GlobalID.ToString();
xmlobject.AppendChild(node);
if (land != null && land.LandData != null)
{
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
node.InnerText = land.LandData.GlobalID.ToString();
xmlobject.AppendChild(node);
}
else
{
// Something is wrong with this object. Let's not list it.
m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
continue;
}
node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
Vector3 loc = obj.AbsolutePosition;

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using log4net;
using OpenSim.Region.DataSnapshot.Interfaces;
@ -98,13 +99,21 @@ namespace OpenSim.Region.DataSnapshot
{
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
try
{
snapXWriter.Formatting = Formatting.Indented;
snapXWriter.WriteStartDocument();
data.WriteTo(snapXWriter);
snapXWriter.WriteEndDocument();
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
{
snapXWriter.Formatting = Formatting.Indented;
snapXWriter.WriteStartDocument();
data.WriteTo(snapXWriter);
snapXWriter.WriteEndDocument();
}
}
catch (Exception e)
{
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
}
}
//mark provider as not stale, parent scene as stale
@ -185,12 +194,19 @@ namespace OpenSim.Region.DataSnapshot
//save snapshot
String path = DataFileNameScene(scene);
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
try
{
snapXWriter.Formatting = Formatting.Indented;
snapXWriter.WriteStartDocument();
regionElement.WriteTo(snapXWriter);
snapXWriter.WriteEndDocument();
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
{
snapXWriter.Formatting = Formatting.Indented;
snapXWriter.WriteStartDocument();
regionElement.WriteTo(snapXWriter);
snapXWriter.WriteEndDocument();
}
}
catch (Exception e)
{
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
}
m_scenes[scene] = false;
@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
#region Helpers
private string DataFileNameFragment(Scene scene, String fragmentName)
{
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml"));
return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
}
private string DataFileNameScene(Scene scene)
{
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml"));
return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
//return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
}
private static string Sanitize(string name)
{
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
string invalidReStr = string.Format(@"[{0}]", invalidChars);
string newname = Regex.Replace(name, invalidReStr, "_");
return newname.Replace('.', '_');
}
private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
{
XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");

View File

@ -131,5 +131,13 @@ namespace OpenSim.Region.Framework.Interfaces
/// A <see cref="IClientAPI"/>
/// </param>
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
/// <summary>
/// Update the position of an attachment
/// </summary>
/// <param name="client"></param>
/// <param name="sog"></param>
/// <param name="pos"></param>
void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
}
}

View File

@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Scenes
public class Prioritizer
{
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes
break;
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
break;
}
// Adjust priority so that root prims are sent to the viewer first. This is especially important for
@ -122,9 +121,16 @@ namespace OpenSim.Region.Framework.Scenes
// Use group position for child prims
Vector3 entityPos;
if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
{
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
entityPos = entity.AbsolutePosition;
}
return Vector3.DistanceSquared(presencePos, entityPos);
}
@ -144,9 +150,16 @@ namespace OpenSim.Region.Framework.Scenes
// Use group position for child prims
Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
{
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
entityPos = entity.AbsolutePosition;
}
if (!presence.IsChildAgent)
{

View File

@ -1799,53 +1799,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
{
SceneObjectGroup objectGroup = grp;
if (objectGroup != null)
{
if (!grp.HasGroupChanged)
{
m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
return;
}
m_log.InfoFormat(
"[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
AssetService.Store(asset);
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
InventoryService.UpdateItem(item);
// this gets called when the agent loggs off!
if (remoteClient != null)
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
}
}
}
public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
{
itemID = UUID.Zero;

View File

@ -3608,18 +3608,6 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
private ILandObject GetParcelAtPoint(float x, float y)
{
foreach (var parcel in AllParcels())
{
if (parcel.ContainsPoint((int)x,(int)y))
{
return parcel;
}
}
return null;
}
/// <summary>
/// Update an AgentCircuitData object with new information
/// </summary>

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// A user will arrive shortly, set up appropriate credentials so it can connect
/// </summary>
public event ExpectUserDelegate OnExpectUser;
// public event ExpectUserDelegate OnExpectUser;
/// <summary>
/// A Prim will arrive shortly
@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// A new prim has arrived
/// </summary>
public event PrimCrossing OnPrimCrossingIntoRegion;
// public event PrimCrossing OnPrimCrossingIntoRegion;
///// <summary>
///// A New Region is up and available
@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// We have a child agent for this avatar and we're getting a status update about it
/// </summary>
public event ChildAgentUpdate OnChildAgentUpdate;
// public event ChildAgentUpdate OnChildAgentUpdate;
//public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
/// <summary>

View File

@ -1289,37 +1289,21 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="localID"></param>
/// <param name="pos"></param>
/// <param name="remoteClient"></param>
protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
// Vector3 oldPos = group.AbsolutePosition;
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
// If this is an attachment, then we need to save the modified
// object back into the avatar's inventory. First we save the
// attachment point information, then we update the relative
// positioning (which caused this method to get driven in the
// first place. Then we have to mark the object as NOT an
// attachment. This is necessary in order to correctly save
// and retrieve GroupPosition information for the attachment.
// Then we save the asset back into the appropriate inventory
// entry. Finally, we restore the object's attachment status.
byte attachmentPoint = group.GetAttachmentPoint();
group.UpdateGroupPosition(pos);
group.RootPart.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
group.SetAttachmentPoint(attachmentPoint);
if (m_parentScene.AttachmentsModule != null)
m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
}
else
{
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
&& m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
{
group.UpdateGroupPosition(pos);
}
@ -1328,14 +1312,19 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Update the texture entry of the given prim.
/// </summary>
///
/// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
/// the texture is given in its byte serialized form.
///
/// <param name="localID"></param>
/// <param name="texture"></param>
/// <param name="remoteClient"></param>
protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
@ -1700,8 +1689,6 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart newRoot = newSet[0];
newSet.RemoveAt(0);
List<uint> linkIDs = new List<uint>();
foreach (SceneObjectPart newChild in newSet)
newChild.UpdateFlag = 0;

View File

@ -4727,20 +4727,8 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.IsDeleted)
return;
Vector3 lPos = OffsetPosition;
if (IsAttachment)
{
if (ParentGroup.RootPart != this)
return;
lPos = ParentGroup.RootPart.AttachedPos;
}
else
{
if (ParentGroup.RootPart == this)
lPos = AbsolutePosition;
}
if (IsAttachment && ParentGroup.RootPart != this)
return;
// Causes this thread to dig into the Client Thread Data.
// Remember your locking here!

View File

@ -577,7 +577,6 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
{
UUID ownerID = item.OwnerID;
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
if (null == rezAsset)

View File

@ -2326,15 +2326,15 @@ namespace OpenSim.Region.Framework.Scenes
{
m_perfMonMS = Util.EnvironmentTickCount();
PhysicsActor actor = m_physicsActor;
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
Vector3 pos = m_pos;
pos.Z += m_appearance.HipOffset;
//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 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
remoteClient.SendPrimUpdate(
this,
PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
m_scene.StatsReporter.AddAgentUpdates(1);