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

@ -312,17 +312,13 @@ namespace Flotsam.RegionModules.AssetCache
}
}
catch (Exception e)
{
LogException(e);
}
}
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)
{

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
// inventory right now.
if (sp.PresenceType == PresenceType.Npc)
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p);
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null);
else
RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p);
}
@ -343,17 +343,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
}
public UUID RezSingleAttachmentFromInventory(
public ISceneEntity RezSingleAttachmentFromInventory(
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; }
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
// be removed when that functionality is implemented in opensim
AttachmentPt &= 0x7f;
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
if (updateInventoryStatus)
{
@ -367,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
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>();
if (invAccess != null)
@ -462,9 +461,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!att.IsDeleted)
attachmentPoint = att.AttachmentPoint;
ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
if (m_scene.InventoryService != null)
item = m_scene.InventoryService.GetItem(item);

View File

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

View File

@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
// 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);
/// <summary>

View File

@ -2695,9 +2695,9 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnClientLogin(client);
// Send initial parcel data
Vector3 pos = presence.AbsolutePosition;
Vector3 pos = createdSp.AbsolutePosition;
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.
if (vialogin || (!m_seeIntoBannedRegion))
{
if (!AuthorizeUser(agent.AgentID, out reason))
if (!AuthorizeUser(agent, out reason))
return false;
}
}
@ -3696,20 +3696,20 @@ namespace OpenSim.Region.Framework.Scenes
/// <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
/// 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;
if (!m_strictAccessControl) return true;
if (Permissions.IsGod(agentID)) return true;
if (Permissions.IsGod(agent.AgentID)) return true;
if (AuthorizationService != null)
{
if (!AuthorizationService.IsAuthorizedForRegion(
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",
agentID, RegionInfo.RegionName);
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);
return false;
}
@ -3717,26 +3717,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_regInfo.EstateSettings != null)
{
int flags = GetUserFlags(agentID);
if (m_regInfo.EstateSettings.IsBanned(agentID, flags))
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0))
{
//Add some more info to help users
if (!m_regInfo.EstateSettings.IsBanned(agentID, 32))
{
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);
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
reason = String.Format("Denied access to region {0}: You have been banned from that region.",
RegionInfo.RegionName);
return false;
@ -3753,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes
if (groupsModule != null)
{
GroupMembershipData[] GroupMembership =
groupsModule.GetMembershipData(agentID);
groupsModule.GetMembershipData(agent.AgentID);
if (GroupMembership != null)
{
@ -3782,16 +3766,44 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
if (!m_regInfo.EstateSettings.PublicAccess &&
!m_regInfo.EstateSettings.HasAccess(agentID) &&
!m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess)
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate",
agentID, RegionInfo.RegionName);
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
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;
}
// 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;
}
@ -5387,11 +5399,18 @@ 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
{
return false;
}
if (position == Vector3.Zero) // Teleport
{

View File

@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DetachToGround()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar == null)
return;
@ -1259,14 +1259,14 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.FromItemID = UUID.Zero;
AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero;
AttachedAvatar = UUID.Zero;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = UUID.Zero;
//SceneObjectPart[] parts = m_parts.GetArray();
//for (int i = 0; i < parts.Length; i++)
// parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0);
AttachmentPoint = (byte)0;
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
HasGroupChanged = true;
RootPart.Rezzed = DateTime.Now;
@ -1279,7 +1279,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DetachToInventoryPrep()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
//Vector3 detachedpos = new Vector3(127f, 127f, 127f);
if (avatar != null)
{
@ -1287,15 +1287,15 @@ namespace OpenSim.Region.Framework.Scenes
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++)
parts[i].AttachedAvatar = UUID.Zero;
parts[i].AttachedAvatar = UUID.Zero;*/
m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0);
m_rootPart.IsAttachment = false;
IsAttachment = false;
AbsolutePosition = m_rootPart.AttachedPos;
//m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
//AttachToBackup();
@ -1471,7 +1471,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteGroupFromScene(bool silent)
{
// We need to keep track of this state in case this group is still queued for backup.
m_isDeleted = true;
IsDeleted = true;
DetachFromBackup();
@ -1746,11 +1746,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public SceneObjectGroup Copy(bool userExposed)
{
SceneObjectGroup dupe;
try
{
m_dupeInProgress = true;
dupe = (SceneObjectGroup)MemberwiseClone();
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
dupe.m_isBackedUp = false;
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
@ -1768,20 +1764,13 @@ namespace OpenSim.Region.Framework.Scenes
if (!userExposed)
dupe.IsAttachment = true;
if (!userExposed)
dupe.RootPart.IsAttachment = true;
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
if (!userExposed)
{
dupe.IsAttachment = previousAttachmentStatus;
}
if (!userExposed)
{
dupe.RootPart.IsAttachment = previousAttachmentStatus;
}
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
@ -1798,40 +1787,17 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList)
{
SceneObjectPart newPart;
if (part.UUID != m_rootPart.UUID)
{
SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart.LinkNum = part.LinkNum;
}
// Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed)
else
{
PrimitiveBaseShape pbs = part.Shape;
newPart = dupe.m_rootPart;
}
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
if (part.PhysActor != null && userExposed)
{
@ -1850,10 +1816,16 @@ namespace OpenSim.Region.Framework.Scenes
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
}
}
finally
if (userExposed)
{
m_dupeInProgress = false;
dupe.UpdateParentIDs();
dupe.HasGroupChanged = true;
dupe.AttachToBackup();
ScheduleGroupForFullUpdate();
}
return dupe;
}
@ -1983,22 +1955,8 @@ namespace OpenSim.Region.Framework.Scenes
public void stopMoveToTarget()
{
SceneObjectPart rootpart = m_rootPart;
if (rootpart != null)
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null) avatar.StopMoveToPosition();
}
else
{
if (rootpart.PhysActor != null)
{
rootpart.PhysActor.PIDActive = false;
}
}
}
if (RootPart.PhysActor != null)
RootPart.PhysActor.PIDActive = false;
}
public void rotLookAt(Quaternion target, float strength, float damping)
@ -3087,8 +3045,6 @@ namespace OpenSim.Region.Framework.Scenes
prevScale.X *= x;
prevScale.Y *= y;
prevScale.Z *= z;
part.IgnoreUndoUpdate = false;
// RootPart.IgnoreUndoUpdate = true;
RootPart.Resize(prevScale);
// RootPart.IgnoreUndoUpdate = false;

View File

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

View File

@ -131,6 +131,7 @@ namespace OpenSim.Region.Framework.Scenes
// private SceneObjectGroup proxyObjectGroup;
//private SceneObjectPart proxyObjectPart = null;
public Vector3 lastKnownAllowedPosition;
public bool sentMessageAboutRestrictedParcelFlyingDown;
public Vector4 CollisionPlane = Vector4.UnitW;
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;
}
/// <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()
{
if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time)

View File

@ -50,16 +50,11 @@ namespace OpenSim.Region.Framework.Scenes
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 Scale = Vector3.Zero;
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>
/// Is this undo state for an entire group?
@ -77,88 +72,40 @@ namespace OpenSim.Region.Framework.Scenes
{
ForGroup = forGroup;
// if (ForGroup)
GroupScale = part.ParentGroup.RootPart.Shape.Scale;
// if (ForGroup)
Position = part.ParentGroup.AbsolutePosition;
// else
// Position = part.OffsetPosition;
//FUBAR WARNING: Do NOT get the group's absoluteposition here
//or you'll experience a loop and/or a stack issue
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);
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for root part", Position);
Rotation = part.RotationOffset;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
Scale = part.Shape.Scale;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for root part", Scale);
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for root part", Scale);
}
else
{
Position = part.OffsetPosition;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for child part", Position);
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for child part", Position);
Rotation = part.RotationOffset;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation);
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation);
Scale = part.Shape.Scale;
// m_log.DebugFormat(
// "[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;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for child part", Scale);
}
}
/// <summary>
/// Compare the relevant state in the given part to this state.
/// </summary>
@ -183,15 +130,15 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
private void RestoreState(SceneObjectPart part)
public void PlaybackState(SceneObjectPart part)
{
part.Undoing = true;
if (part.ParentID == 0)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
// Position, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
// Position, part.Name, part.LocalId);
if (Position != Vector3.Zero)
{
@ -201,9 +148,9 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentGroup.UpdateRootPosition(Position);
}
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
if (ForGroup)
part.UpdateRotation(Rotation);
@ -212,9 +159,9 @@ namespace OpenSim.Region.Framework.Scenes
if (Scale != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
if (ForGroup)
part.ParentGroup.GroupResize(Scale);
@ -228,24 +175,24 @@ namespace OpenSim.Region.Framework.Scenes
{
if (Position != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
// part.OffsetPosition, Position, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
// part.OffsetPosition, Position, part.Name, part.LocalId);
part.OffsetPosition = Position;
}
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
part.Resize(Scale);
}

View File

@ -1219,7 +1219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public virtual void llDie()
{
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)
@ -3250,8 +3250,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup grp = m_host.ParentGroup;
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
grp.AttachToAgent(m_host.OwnerID, (uint)attachment, Vector3.Zero, false);
if (presence.Scene.AttachmentsModule != null)
{
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
SceneObjectPart part = World.GetSceneObjectPart(objID);
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
ScenePresence presence = World.GetScenePresence(objID);
@ -10064,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0);
if (detectedParams == null)
{
if (m_host.IsAttachment == true)
if (m_host.ParentGroup.IsAttachment == true)
{
detectedParams = new DetectParams();
detectedParams.Key = m_host.OwnerID;