Merge fixes, and fix the build

avinationmerge
Tom 2011-09-14 18:46:42 -07:00
parent 03f6734f43
commit cda4cd6b55
10 changed files with 184 additions and 354 deletions

View File

@ -313,15 +313,11 @@ namespace Flotsam.RegionModules.AssetCache
} }
catch (Exception e) catch (Exception e)
{ {
LogException(e); m_log.ErrorFormat(
"[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
asset.ID, e.Message, e.StackTrace);
} }
} }
catch (Exception e)
{
m_log.ErrorFormat(
"[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
asset.ID, e.Message, e.StackTrace);
}
} }
public void Cache(AssetBase asset) public void Cache(AssetBase asset)

View File

@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// If we're an NPC then skip all the item checks and manipulations since we don't have an // If we're an NPC then skip all the item checks and manipulations since we don't have an
// inventory right now. // inventory right now.
if (sp.PresenceType == PresenceType.Npc) if (sp.PresenceType == PresenceType.Npc)
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null);
else else
RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p);
} }
@ -343,17 +343,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
} }
public UUID RezSingleAttachmentFromInventory( public ISceneEntity RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
{ {
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; } if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; }
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
// be removed when that functionality is implemented in opensim // be removed when that functionality is implemented in opensim
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
if (updateInventoryStatus) if (updateInventoryStatus)
{ {
@ -367,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
{ {
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null) if (invAccess != null)
@ -462,9 +461,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!att.IsDeleted) if (!att.IsDeleted)
attachmentPoint = att.AttachmentPoint; attachmentPoint = att.AttachmentPoint;
ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
if (m_scene.InventoryService != null) if (m_scene.InventoryService != null)
item = m_scene.InventoryService.GetItem(item); item = m_scene.InventoryService.GetItem(item);

View File

@ -96,6 +96,8 @@ namespace OpenSim.Region.CoreModules.World.Land
// caches ExtendedLandData // caches ExtendedLandData
private Cache parcelInfoCache; private Cache parcelInfoCache;
private Dictionary<UUID, Vector3> forcedPosition =
new Dictionary<UUID, Vector3>();
#region INonSharedRegionModule Members #region INonSharedRegionModule Members

View File

@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
// Same as above, but also load script states from a separate doc // Same as above, but also load script states from a separate doc
UUID RezSingleAttachmentFromInventory( ISceneEntity RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc); IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc);
/// <summary> /// <summary>

View File

@ -2695,9 +2695,9 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnClientLogin(client); EventManager.TriggerOnClientLogin(client);
// Send initial parcel data // Send initial parcel data
Vector3 pos = presence.AbsolutePosition; Vector3 pos = createdSp.AbsolutePosition;
ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y);
land.SendLandUpdateToClient(presence.ControllingClient); land.SendLandUpdateToClient(client);
} }
} }
} }
@ -3500,7 +3500,7 @@ namespace OpenSim.Region.Framework.Scenes
// check if banned regions are to be blacked out. // check if banned regions are to be blacked out.
if (vialogin || (!m_seeIntoBannedRegion)) if (vialogin || (!m_seeIntoBannedRegion))
{ {
if (!AuthorizeUser(agent.AgentID, out reason)) if (!AuthorizeUser(agent, out reason))
return false; return false;
} }
} }
@ -3696,47 +3696,31 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="reason">outputs the reason to this string</param> /// <param name="reason">outputs the reason to this string</param>
/// <returns>True if the region accepts this agent. False if it does not. False will /// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns> /// also return a reason.</returns>
protected virtual bool AuthorizeUser(UUID agentID, out string reason) protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
{ {
reason = String.Empty; reason = String.Empty;
if (!m_strictAccessControl) return true; if (!m_strictAccessControl) return true;
if (Permissions.IsGod(agentID)) return true; if (Permissions.IsGod(agent.AgentID)) return true;
if (AuthorizationService != null) if (AuthorizationService != null)
{ {
if (!AuthorizationService.IsAuthorizedForRegion( if (!AuthorizationService.IsAuthorizedForRegion(
agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
agentID, RegionInfo.RegionName); agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
return false; return false;
} }
} }
if (m_regInfo.EstateSettings != null) if (m_regInfo.EstateSettings != null)
{ {
int flags = GetUserFlags(agentID); if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0))
if (m_regInfo.EstateSettings.IsBanned(agentID, flags))
{ {
//Add some more info to help users m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
if (!m_regInfo.EstateSettings.IsBanned(agentID, 32)) agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the region requires age verification",
agentID, RegionInfo.RegionName);
reason = String.Format("Denied access to region {0}: Region requires age verification", RegionInfo.RegionName);
return false;
}
if (!m_regInfo.EstateSettings.IsBanned(agentID, 4))
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} {1} because the region requires payment info on file",
agentID, RegionInfo.RegionName);
reason = String.Format("Denied access to region {0}: Region requires payment info on file", RegionInfo.RegionName);
return false;
}
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {3} because the user is on the banlist",
agentID, RegionInfo.RegionName);
reason = String.Format("Denied access to region {0}: You have been banned from that region.", reason = String.Format("Denied access to region {0}: You have been banned from that region.",
RegionInfo.RegionName); RegionInfo.RegionName);
return false; return false;
@ -3753,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes
if (groupsModule != null) if (groupsModule != null)
{ {
GroupMembershipData[] GroupMembership = GroupMembershipData[] GroupMembership =
groupsModule.GetMembershipData(agentID); groupsModule.GetMembershipData(agent.AgentID);
if (GroupMembership != null) if (GroupMembership != null)
{ {
@ -3782,16 +3766,44 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
if (!m_regInfo.EstateSettings.PublicAccess && if (!m_regInfo.EstateSettings.PublicAccess &&
!m_regInfo.EstateSettings.HasAccess(agentID) && !m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess) !groupAccess)
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
agentID, RegionInfo.RegionName); agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
RegionInfo.RegionName); RegionInfo.RegionName);
return false; return false;
} }
// TODO: estate/region settings are not properly hooked up
// to ILandObject.isRestrictedFromLand()
// if (null != LandChannel)
// {
// // region seems to have local Id of 1
// ILandObject land = LandChannel.GetLandObject(1);
// if (null != land)
// {
// if (land.isBannedFromLand(agent.AgentID))
// {
// m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land",
// agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
// reason = String.Format("Denied access to private region {0}: You are banned from that region.",
// RegionInfo.RegionName);
// return false;
// }
// if (land.isRestrictedFromLand(agent.AgentID))
// {
// m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
// agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
// reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
// RegionInfo.RegionName);
// return false;
// }
// }
// }
return true; return true;
} }
@ -5387,9 +5399,16 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if (!AuthorizeUser(agentID, out reason)) try
{
if (!AuthorizeUser(GetScenePresence(agentID).ControllingClient.RequestClientInfo(), out reason))
{
// m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
return false;
}
}
catch
{ {
// m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
return false; return false;
} }

View File

@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DetachToGround() public void DetachToGround()
{ {
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar == null) if (avatar == null)
return; return;
@ -1259,14 +1259,14 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.FromItemID = UUID.Zero; RootPart.FromItemID = UUID.Zero;
AbsolutePosition = detachedpos; AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero; AttachedAvatar = UUID.Zero;
SceneObjectPart[] parts = m_parts.GetArray(); //SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) //for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = UUID.Zero; // parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0); AttachmentPoint = (byte)0;
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
HasGroupChanged = true; HasGroupChanged = true;
RootPart.Rezzed = DateTime.Now; RootPart.Rezzed = DateTime.Now;
@ -1279,7 +1279,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DetachToInventoryPrep() public void DetachToInventoryPrep()
{ {
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
//Vector3 detachedpos = new Vector3(127f, 127f, 127f); //Vector3 detachedpos = new Vector3(127f, 127f, 127f);
if (avatar != null) if (avatar != null)
{ {
@ -1287,15 +1287,15 @@ namespace OpenSim.Region.Framework.Scenes
avatar.RemoveAttachment(this); avatar.RemoveAttachment(this);
} }
m_rootPart.AttachedAvatar = UUID.Zero; AttachedAvatar = UUID.Zero;
SceneObjectPart[] parts = m_parts.GetArray(); /*SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = UUID.Zero; parts[i].AttachedAvatar = UUID.Zero;*/
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0); //m_rootPart.SetAttachmentPoint((byte)0);
m_rootPart.IsAttachment = false; IsAttachment = false;
AbsolutePosition = m_rootPart.AttachedPos; AbsolutePosition = m_rootPart.AttachedPos;
//m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
//AttachToBackup(); //AttachToBackup();
@ -1471,7 +1471,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteGroupFromScene(bool silent) public void DeleteGroupFromScene(bool silent)
{ {
// We need to keep track of this state in case this group is still queued for backup. // We need to keep track of this state in case this group is still queued for backup.
m_isDeleted = true; IsDeleted = true;
DetachFromBackup(); DetachFromBackup();
@ -1746,97 +1746,63 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public SceneObjectGroup Copy(bool userExposed) public SceneObjectGroup Copy(bool userExposed)
{ {
SceneObjectGroup dupe; SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
try dupe.m_isBackedUp = false;
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
// Warning, The following code related to previousAttachmentStatus is needed so that clones of
// attachments do not bordercross while they're being duplicated. This is hacktastic!
// Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
// unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
// (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
// then restore it's attachment state
// This is only necessary when userExposed is false!
bool previousAttachmentStatus = dupe.IsAttachment;
if (!userExposed)
dupe.IsAttachment = true;
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
if (!userExposed)
{ {
m_dupeInProgress = true; dupe.IsAttachment = previousAttachmentStatus;
dupe = (SceneObjectGroup)MemberwiseClone(); }
dupe.m_isBackedUp = false;
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
// Warning, The following code related to previousAttachmentStatus is needed so that clones of dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
// attachments do not bordercross while they're being duplicated. This is hacktastic! dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
// Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
// unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
// (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
// then restore it's attachment state
// This is only necessary when userExposed is false! if (userExposed)
dupe.m_rootPart.TrimPermissions();
bool previousAttachmentStatus = dupe.IsAttachment; List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray());
if (!userExposed)
dupe.IsAttachment = true;
if (!userExposed) partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
dupe.RootPart.IsAttachment = true; {
return p1.LinkNum.CompareTo(p2.LinkNum);
}
);
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); foreach (SceneObjectPart part in partList)
if (!userExposed) {
SceneObjectPart newPart;
if (part.UUID != m_rootPart.UUID)
{ {
dupe.IsAttachment = previousAttachmentStatus; newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart.LinkNum = part.LinkNum;
}
else
{
newPart = dupe.m_rootPart;
} }
if (!userExposed)
{
dupe.RootPart.IsAttachment = previousAttachmentStatus;
}
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
if (userExposed)
dupe.m_rootPart.TrimPermissions();
List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray());
partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
{
return p1.LinkNum.CompareTo(p2.LinkNum);
}
);
foreach (SceneObjectPart part in partList)
{
if (part.UUID != m_rootPart.UUID)
{
SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart.LinkNum = part.LinkNum;
}
// Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed)
{
PrimitiveBaseShape pbs = part.Shape;
part.PhysActor
= m_scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", part.Name, part.UUID),
pbs,
part.AbsolutePosition,
part.Scale,
part.RotationOffset,
part.PhysActor.IsPhysical,
m_localId);
part.PhysActor.SetMaterial((int)part.Material);
part.PhysActor.LocalID = part.LocalId;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
}
}
if (userExposed)
{
dupe.UpdateParentIDs();
dupe.HasGroupChanged = true;
dupe.AttachToBackup();
}
ScheduleGroupForFullUpdate();
// Need to duplicate the physics actor as well // Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed) if (part.PhysActor != null && userExposed)
{ {
PrimitiveBaseShape pbs = newPart.Shape; PrimitiveBaseShape pbs = newPart.Shape;
newPart.PhysActor newPart.PhysActor
= m_scene.PhysicsScene.AddPrimShape( = m_scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", newPart.Name, newPart.UUID), string.Format("{0}/{1}", newPart.Name, newPart.UUID),
@ -1846,14 +1812,20 @@ namespace OpenSim.Region.Framework.Scenes
newPart.RotationOffset, newPart.RotationOffset,
part.PhysActor.IsPhysical, part.PhysActor.IsPhysical,
newPart.LocalId); newPart.LocalId);
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
} }
finally
if (userExposed)
{ {
m_dupeInProgress = false; dupe.UpdateParentIDs();
dupe.HasGroupChanged = true;
dupe.AttachToBackup();
ScheduleGroupForFullUpdate();
} }
return dupe; return dupe;
} }
@ -1983,22 +1955,8 @@ namespace OpenSim.Region.Framework.Scenes
public void stopMoveToTarget() public void stopMoveToTarget()
{ {
SceneObjectPart rootpart = m_rootPart; if (RootPart.PhysActor != null)
if (rootpart != null) RootPart.PhysActor.PIDActive = false;
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null) avatar.StopMoveToPosition();
}
else
{
if (rootpart.PhysActor != null)
{
rootpart.PhysActor.PIDActive = false;
}
}
}
} }
public void rotLookAt(Quaternion target, float strength, float damping) public void rotLookAt(Quaternion target, float strength, float damping)
@ -3087,8 +3045,6 @@ namespace OpenSim.Region.Framework.Scenes
prevScale.X *= x; prevScale.X *= x;
prevScale.Y *= y; prevScale.Y *= y;
prevScale.Z *= z; prevScale.Z *= z;
part.IgnoreUndoUpdate = false;
// RootPart.IgnoreUndoUpdate = true; // RootPart.IgnoreUndoUpdate = true;
RootPart.Resize(prevScale); RootPart.Resize(prevScale);
// RootPart.IgnoreUndoUpdate = false; // RootPart.IgnoreUndoUpdate = false;

View File

@ -3243,6 +3243,14 @@ namespace OpenSim.Region.Framework.Scenes
STATUS_ROTATE_Z = rotate; STATUS_ROTATE_Z = rotate;
} }
public void SetBuoyancy(float fvalue)
{
if (PhysActor != null)
{
PhysActor.Buoyancy = fvalue;
}
}
public void SetDieAtEdge(bool p) public void SetDieAtEdge(bool p)
{ {
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)

View File

@ -131,6 +131,7 @@ namespace OpenSim.Region.Framework.Scenes
// private SceneObjectGroup proxyObjectGroup; // private SceneObjectGroup proxyObjectGroup;
//private SceneObjectPart proxyObjectPart = null; //private SceneObjectPart proxyObjectPart = null;
public Vector3 lastKnownAllowedPosition; public Vector3 lastKnownAllowedPosition;
public bool sentMessageAboutRestrictedParcelFlyingDown;
public Vector4 CollisionPlane = Vector4.UnitW; public Vector4 CollisionPlane = Vector4.UnitW;
private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
@ -4316,103 +4317,6 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
return flags; return flags;
} }
/// <summary>
/// RezAttachments. This should only be called upon login on the first region.
/// Attachment rezzings on crossings and TPs are done in a different way.
/// </summary>
public void RezAttachments()
{
if (null == m_appearance)
{
m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID);
return;
}
XmlDocument doc = new XmlDocument();
string stateData = String.Empty;
IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>();
if (attServ != null)
{
m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service");
stateData = attServ.Get(ControllingClient.AgentId.ToString());
if (stateData != String.Empty)
{
try
{
doc.LoadXml(stateData);
}
catch { }
}
}
Dictionary<UUID, string> itemData = new Dictionary<UUID, string>();
XmlNodeList nodes = doc.GetElementsByTagName("Attachment");
if (nodes.Count > 0)
{
foreach (XmlNode n in nodes)
{
XmlElement elem = (XmlElement)n;
string itemID = elem.GetAttribute("ItemID");
string xml = elem.InnerXml;
itemData[new UUID(itemID)] = xml;
}
}
List<AvatarAttachment> attachments = m_appearance.GetAttachments();
foreach (AvatarAttachment attach in attachments)
{
if (IsDeleted)
return;
int p = attach.AttachPoint;
UUID itemID = attach.ItemID;
//UUID assetID = attach.AssetID;
// For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
// But they're not used anyway, the item is being looked up for now, so let's proceed.
//if (UUID.Zero == assetID)
//{
// m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID);
// continue;
//}
try
{
string xmlData;
XmlDocument d = new XmlDocument();
UUID asset;
if (itemData.TryGetValue(itemID, out xmlData))
{
d.LoadXml(xmlData);
m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID);
// Rez from inventory
asset
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d);
}
else
{
// Rez from inventory (with a null doc to let
// CHANGED_OWNER happen)
asset
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null);
}
m_log.InfoFormat(
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2}",
p, itemID, asset);
}
catch (Exception e)
{
m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace);
}
}
}
private void ReprioritizeUpdates() private void ReprioritizeUpdates()
{ {
if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time)

View File

@ -50,16 +50,11 @@ namespace OpenSim.Region.Framework.Scenes
public class UndoState public class UndoState
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Vector3 Position = Vector3.Zero; public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.Zero; public Vector3 Scale = Vector3.Zero;
public Quaternion Rotation = Quaternion.Identity; public Quaternion Rotation = Quaternion.Identity;
public Vector3 GroupPosition = Vector3.Zero;
public Quaternion GroupRotation = Quaternion.Identity;
public Vector3 GroupScale = Vector3.Zero;
public DateTime LastUpdated = DateTime.Now;
public UndoType Type;
/// <summary> /// <summary>
/// Is this undo state for an entire group? /// Is this undo state for an entire group?
@ -77,88 +72,40 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ForGroup = forGroup; ForGroup = forGroup;
// if (ForGroup) // if (ForGroup)
GroupScale = part.ParentGroup.RootPart.Shape.Scale; Position = part.ParentGroup.AbsolutePosition;
// else
// Position = part.OffsetPosition;
//FUBAR WARNING: Do NOT get the group's absoluteposition here // m_log.DebugFormat(
//or you'll experience a loop and/or a stack issue // "[UNDO STATE]: Storing undo position {0} for root part", Position);
GroupPosition = part.ParentGroup.RootPart.AbsolutePosition;
GroupRotation = part.ParentGroup.GroupRotation;
Position = part.ParentGroup.RootPart.AbsolutePosition;
// else
// Position = part.OffsetPosition;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for root part", Position);
Rotation = part.RotationOffset; Rotation = part.RotationOffset;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
Scale = part.Shape.Scale; Scale = part.Shape.Scale;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for root part", Scale); // "[UNDO STATE]: Storing undo scale {0} for root part", Scale);
} }
else else
{ {
Position = part.OffsetPosition; Position = part.OffsetPosition;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for child part", Position); // "[UNDO STATE]: Storing undo position {0} for child part", Position);
Rotation = part.RotationOffset; Rotation = part.RotationOffset;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation);
Scale = part.Shape.Scale; Scale = part.Shape.Scale;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for child part", Scale); // "[UNDO STATE]: Storing undo scale {0} for child part", Scale);
}
}
public void Merge(UndoState last)
{
if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION)))
{
GroupPosition = last.GroupPosition;
Position = last.Position;
}
if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE)))
{
GroupScale = last.GroupScale;
Scale = last.Scale;
}
if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION)))
{
GroupRotation = last.GroupRotation;
Rotation = last.Rotation;
}
if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION)))
{
Position = last.Position;
}
if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE)))
{
Scale = last.Scale;
}
if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION)))
{
Rotation = last.Rotation;
}
Type = Type | last.Type;
}
public bool Compare(UndoState undo)
{
if (undo == null || Position == null) return false;
if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation)
{
return true;
}
else
{
return false;
} }
} }
/// <summary> /// <summary>
/// Compare the relevant state in the given part to this state. /// Compare the relevant state in the given part to this state.
/// </summary> /// </summary>
@ -183,15 +130,15 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
private void RestoreState(SceneObjectPart part) public void PlaybackState(SceneObjectPart part)
{ {
part.Undoing = true; part.Undoing = true;
if (part.ParentID == 0) if (part.ParentID == 0)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
// Position, part.Name, part.LocalId); // Position, part.Name, part.LocalId);
if (Position != Vector3.Zero) if (Position != Vector3.Zero)
{ {
@ -201,9 +148,9 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentGroup.UpdateRootPosition(Position); part.ParentGroup.UpdateRootPosition(Position);
} }
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId); // part.RotationOffset, Rotation, part.Name, part.LocalId);
if (ForGroup) if (ForGroup)
part.UpdateRotation(Rotation); part.UpdateRotation(Rotation);
@ -212,9 +159,9 @@ namespace OpenSim.Region.Framework.Scenes
if (Scale != Vector3.Zero) if (Scale != Vector3.Zero)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId); // part.Shape.Scale, Scale, part.Name, part.LocalId);
if (ForGroup) if (ForGroup)
part.ParentGroup.GroupResize(Scale); part.ParentGroup.GroupResize(Scale);
@ -228,24 +175,24 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (Position != Vector3.Zero) if (Position != Vector3.Zero)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
// part.OffsetPosition, Position, part.Name, part.LocalId); // part.OffsetPosition, Position, part.Name, part.LocalId);
part.OffsetPosition = Position; part.OffsetPosition = Position;
} }
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId); // part.RotationOffset, Rotation, part.Name, part.LocalId);
part.UpdateRotation(Rotation); part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero) if (Scale != Vector3.Zero)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId); // part.Shape.Scale, Scale, part.Name, part.LocalId);
part.Resize(Scale); part.Resize(Scale);
} }

View File

@ -1219,7 +1219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public virtual void llDie() public virtual void llDie()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (!m_host.IsAttachment) throw new SelfDeleteException(); if (!m_host.ParentGroup.IsAttachment) throw new SelfDeleteException();
} }
public LSL_Float llGround(LSL_Vector offset) public LSL_Float llGround(LSL_Vector offset)
@ -3250,8 +3250,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup grp = m_host.ParentGroup; SceneObjectGroup grp = m_host.ParentGroup;
ScenePresence presence = World.GetScenePresence(m_host.OwnerID); ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
if (presence.Scene.AttachmentsModule != null)
grp.AttachToAgent(m_host.OwnerID, (uint)attachment, Vector3.Zero, false); {
presence.Scene.AttachmentsModule.AttachObject(presence.ControllingClient, grp, (uint)attachment, false);
}
} }
} }
@ -8034,7 +8036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the UUID with the avatar UUID and report it's bounding box // the UUID with the avatar UUID and report it's bounding box
SceneObjectPart part = World.GetSceneObjectPart(objID); SceneObjectPart part = World.GetSceneObjectPart(objID);
if (part != null && part.ParentGroup.IsAttachment) if (part != null && part.ParentGroup.IsAttachment)
objID = part.ParentGroup.RootPart.AttachedAvatar; objID = part.ParentGroup.AttachedAvatar;
// Find out if this is an avatar ID. If so, return it's box // Find out if this is an avatar ID. If so, return it's box
ScenePresence presence = World.GetScenePresence(objID); ScenePresence presence = World.GetScenePresence(objID);
@ -10064,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0);
if (detectedParams == null) if (detectedParams == null)
{ {
if (m_host.IsAttachment == true) if (m_host.ParentGroup.IsAttachment == true)
{ {
detectedParams = new DetectParams(); detectedParams = new DetectParams();
detectedParams.Key = m_host.OwnerID; detectedParams.Key = m_host.OwnerID;