Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
806082cd6e
|
@ -4271,7 +4271,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
block.OwnerID = sop.OwnerID;
|
block.OwnerID = sop.OwnerID;
|
||||||
|
|
||||||
block.ItemID = sop.FromUserInventoryItemID;
|
block.ItemID = sop.FromUserInventoryItemID;
|
||||||
block.FolderID = UUID.Zero; // sop.FromFolderID ??
|
block.FolderID = UUID.Zero; // sog.FromFolderID ??
|
||||||
block.FromTaskID = UUID.Zero; // ???
|
block.FromTaskID = UUID.Zero; // ???
|
||||||
block.InventorySerial = (short)sop.InventorySerial;
|
block.InventorySerial = (short)sop.InventorySerial;
|
||||||
|
|
||||||
|
@ -4957,7 +4957,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||||
if (data.ParentGroup.IsAttachment)
|
if (data.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
|
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
|
||||||
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// At the moment we can only deal with a single attachment
|
// At the moment we can only deal with a single attachment
|
||||||
if (attachments.Count != 0)
|
if (attachments.Count != 0)
|
||||||
{
|
{
|
||||||
UUID oldAttachmentItemID = attachments[0].GetFromItemID();
|
UUID oldAttachmentItemID = attachments[0].FromItemID;
|
||||||
|
|
||||||
if (oldAttachmentItemID != UUID.Zero)
|
if (oldAttachmentItemID != UUID.Zero)
|
||||||
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
|
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
|
||||||
|
@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new attachment to inventory if we don't already have it.
|
// Add the new attachment to inventory if we don't already have it.
|
||||||
UUID newAttachmentItemID = group.GetFromItemID();
|
UUID newAttachmentItemID = group.FromItemID;
|
||||||
if (newAttachmentItemID == UUID.Zero)
|
if (newAttachmentItemID == UUID.Zero)
|
||||||
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
||||||
foreach (SceneObjectGroup so in existingAttachments)
|
foreach (SceneObjectGroup so in existingAttachments)
|
||||||
{
|
{
|
||||||
if (so.GetFromItemID() == itemID)
|
if (so.FromItemID == itemID)
|
||||||
{
|
{
|
||||||
alreadyOn = true;
|
alreadyOn = true;
|
||||||
break;
|
break;
|
||||||
|
@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (so.AttachedAvatar != sp.UUID)
|
if (so.AttachedAvatar != sp.UUID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID inventoryID = so.GetFromItemID();
|
UUID inventoryID = so.FromItemID;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
|
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
|
||||||
|
@ -359,9 +359,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
||||||
|
|
||||||
sp.RemoveAttachment(so);
|
sp.RemoveAttachment(so);
|
||||||
|
so.FromItemID = UUID.Zero;
|
||||||
|
|
||||||
SceneObjectPart rootPart = so.RootPart;
|
SceneObjectPart rootPart = so.RootPart;
|
||||||
rootPart.FromItemID = UUID.Zero;
|
|
||||||
so.AbsolutePosition = sp.AbsolutePosition;
|
so.AbsolutePosition = sp.AbsolutePosition;
|
||||||
so.AttachedAvatar = UUID.Zero;
|
so.AttachedAvatar = UUID.Zero;
|
||||||
rootPart.SetParentLocalId(0);
|
rootPart.SetParentLocalId(0);
|
||||||
|
@ -475,7 +475,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID);
|
InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID);
|
||||||
item = m_scene.InventoryService.GetItem(item);
|
item = m_scene.InventoryService.GetItem(item);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
|
@ -647,7 +647,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
// sets itemID so client can show item as 'attached' in inventory
|
// sets itemID so client can show item as 'attached' in inventory
|
||||||
grp.SetFromItemID(item.ID);
|
grp.FromItemID = item.ID;
|
||||||
|
|
||||||
if (m_scene.AddInventoryItem(item))
|
if (m_scene.AddInventoryItem(item))
|
||||||
{
|
{
|
||||||
|
@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (entity is SceneObjectGroup)
|
if (entity is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
group = (SceneObjectGroup)entity;
|
group = (SceneObjectGroup)entity;
|
||||||
if (group.GetFromItemID() == itemID)
|
if (group.FromItemID == itemID)
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
||||||
sp.RemoveAttachment(group);
|
sp.RemoveAttachment(group);
|
||||||
|
@ -889,7 +889,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
||||||
|
|
||||||
// Save avatar attachment information
|
// Save avatar attachment information
|
||||||
m_log.Debug(
|
m_log.Debug(
|
||||||
|
@ -912,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||||
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
||||||
if (sp != null && group != null)
|
if (sp != null && group != null)
|
||||||
DetachSingleAttachmentToInv(sp, group.GetFromItemID());
|
DetachSingleAttachmentToInv(sp, group.FromItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
|
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
|
||||||
|
|
|
@ -120,8 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
|
||||||
// Check item status
|
// Check item status
|
||||||
Assert.That(m_presence.Appearance.GetAttachpoint(
|
Assert.That(
|
||||||
attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
|
m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
|
||||||
|
Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -654,9 +654,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
//
|
//
|
||||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||||
{
|
{
|
||||||
if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
||||||
{
|
{
|
||||||
InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
|
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
|
||||||
folder = m_Scene.InventoryService.GetFolder(f);
|
folder = m_Scene.InventoryService.GetFolder(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -962,7 +962,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
rootPart.SalePrice = item.SalePrice;
|
rootPart.SalePrice = item.SalePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootPart.FromFolderID = item.Folder;
|
so.FromFolderID = item.Folder;
|
||||||
|
|
||||||
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
|
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
|
||||||
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
||||||
|
@ -1008,7 +1008,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
|
||||||
if (isAttachment)
|
if (isAttachment)
|
||||||
so.SetFromItemID(item.ID);
|
so.FromItemID = item.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2163,12 +2163,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.RemoveFromPhysics();
|
part.RemoveFromPhysics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (rootPart.PhysActor != null)
|
|
||||||
// {
|
|
||||||
// PhysicsScene.RemovePrim(rootPart.PhysActor);
|
|
||||||
// rootPart.PhysActor = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (UnlinkSceneObject(group, false))
|
if (UnlinkSceneObject(group, false))
|
||||||
{
|
{
|
||||||
|
@ -2572,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup grp = sceneObject;
|
SceneObjectGroup grp = sceneObject;
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
|
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||||
|
|
||||||
|
|
|
@ -571,7 +571,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set { m_LoopSoundSlavePrims = value; }
|
set { m_LoopSoundSlavePrims = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// The UUID for the Region this Object is in.
|
/// <summary>
|
||||||
|
/// The UUID for the region this object is in.
|
||||||
|
/// </summary>
|
||||||
public UUID RegionUUID
|
public UUID RegionUUID
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -584,6 +586,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The item ID that this object was rezzed from, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If not applicable will be UUID.Zero
|
||||||
|
/// </remarks>
|
||||||
|
public UUID FromItemID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The folder ID that this object was rezzed from, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If not applicable will be UUID.Zero
|
||||||
|
/// </remarks>
|
||||||
|
public UUID FromFolderID { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// ~SceneObjectGroup()
|
// ~SceneObjectGroup()
|
||||||
|
@ -646,18 +664,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFromItemID(UUID AssetId)
|
|
||||||
{
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
parts[i].FromItemID = AssetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID GetFromItemID()
|
|
||||||
{
|
|
||||||
return m_rootPart.FromItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
|
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2687,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_rootPart.AttachedPos = pos;
|
m_rootPart.AttachedPos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RootPart.GetStatusSandbox())
|
if (RootPart.GetStatusSandbox())
|
||||||
{
|
{
|
||||||
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
|
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
|
||||||
|
@ -2697,8 +2704,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AbsolutePosition = pos;
|
|
||||||
|
|
||||||
|
AbsolutePosition = pos;
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3270,7 +3277,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual string ExtraToXmlString()
|
public virtual string ExtraToXmlString()
|
||||||
{
|
{
|
||||||
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
|
return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ExtraFromXmlString(string xmlstr)
|
public virtual void ExtraFromXmlString(string xmlstr)
|
||||||
|
@ -3282,7 +3289,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UUID uuid = UUID.Zero;
|
UUID uuid = UUID.Zero;
|
||||||
UUID.TryParse(id, out uuid);
|
UUID.TryParse(id, out uuid);
|
||||||
|
|
||||||
SetFromItemID(uuid);
|
FromItemID = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -125,12 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Is this sop a root part?
|
/// Is this a root part?
|
||||||
/// </value>
|
/// </value>
|
||||||
|
/// <remarks>
|
||||||
|
/// This will return true even if the whole object is attached to an avatar.
|
||||||
|
/// </remarks>
|
||||||
public bool IsRoot
|
public bool IsRoot
|
||||||
{
|
{
|
||||||
get { return ParentGroup.RootPart == this; }
|
get { return ParentGroup.RootPart == this; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -159,15 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
||||||
/// null at any time.
|
/// null at any time.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public PhysicsActor PhysActor
|
public PhysicsActor PhysActor { get; set; }
|
||||||
{
|
|
||||||
get { return m_physActor; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
|
|
||||||
m_physActor = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Xantor 20080528 Sound stuff:
|
//Xantor 20080528 Sound stuff:
|
||||||
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
||||||
|
@ -187,10 +181,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
||||||
|
|
||||||
public uint TimeStampTerse;
|
public uint TimeStampTerse;
|
||||||
|
|
||||||
public UUID FromItemID;
|
|
||||||
|
|
||||||
public UUID FromFolderID;
|
|
||||||
|
|
||||||
public int STATUS_ROTATE_X;
|
public int STATUS_ROTATE_X;
|
||||||
|
|
||||||
|
@ -266,7 +256,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private bool m_passTouches;
|
private bool m_passTouches;
|
||||||
|
|
||||||
private PhysicsActor m_physActor;
|
|
||||||
protected Vector3 m_acceleration;
|
protected Vector3 m_acceleration;
|
||||||
protected Vector3 m_angularVelocity;
|
protected Vector3 m_angularVelocity;
|
||||||
|
|
||||||
|
@ -1112,6 +1101,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parent ID of this part.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If this is a root part which is not attached to an avatar then the value will be 0.
|
||||||
|
/// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
|
||||||
|
/// If this is a child part then the value is the local ID of the root part.
|
||||||
|
/// </remarks>
|
||||||
public uint ParentID
|
public uint ParentID
|
||||||
{
|
{
|
||||||
get { return _parentID; }
|
get { return _parentID; }
|
||||||
|
@ -1488,40 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (VolumeDetectActive)
|
if (VolumeDetectActive)
|
||||||
isPhantom = false;
|
isPhantom = false;
|
||||||
|
|
||||||
// Added clarification.. since A rigid body is an object that you can kick around, etc.
|
|
||||||
bool RigidBody = isPhysical && !isPhantom;
|
|
||||||
|
|
||||||
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
|
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
|
||||||
// or flexible
|
// or flexible
|
||||||
if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||||
{
|
{
|
||||||
try
|
// Added clarification.. since A rigid body is an object that you can kick around, etc.
|
||||||
{
|
bool rigidBody = isPhysical && !isPhantom;
|
||||||
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
|
||||||
string.Format("{0}/{1}", Name, UUID),
|
|
||||||
Shape,
|
|
||||||
AbsolutePosition,
|
|
||||||
Scale,
|
|
||||||
RotationOffset,
|
|
||||||
RigidBody,
|
|
||||||
m_localId);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
|
||||||
PhysActor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basic Physics can also return null as well as an exception catch.
|
PhysicsActor pa = AddToPhysics(rigidBody);
|
||||||
PhysicsActor pa = PhysActor;
|
|
||||||
|
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
{
|
|
||||||
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
|
||||||
pa.SetMaterial(Material);
|
|
||||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
|
||||||
pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4322,41 +4296,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup.Scene == null)
|
if (ParentGroup.Scene == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ParentGroup.Scene.CollidablePrims && PhysActor == null)
|
if (ParentGroup.Scene.CollidablePrims && pa == null)
|
||||||
{
|
{
|
||||||
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
pa = AddToPhysics(UsePhysics);
|
||||||
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
|
||||||
string.Format("{0}/{1}", Name, UUID),
|
|
||||||
Shape,
|
|
||||||
AbsolutePosition,
|
|
||||||
Scale,
|
|
||||||
RotationOffset,
|
|
||||||
UsePhysics,
|
|
||||||
m_localId);
|
|
||||||
|
|
||||||
PhysActor.SetMaterial(Material);
|
if (pa != null)
|
||||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
|
||||||
|
|
||||||
if (!ParentGroup.IsDeleted)
|
|
||||||
{
|
{
|
||||||
if (LocalId == ParentGroup.RootPart.LocalId)
|
pa.SetMaterial(Material);
|
||||||
|
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
|
|
||||||
|
if (!ParentGroup.IsDeleted)
|
||||||
{
|
{
|
||||||
ParentGroup.CheckSculptAndLoad();
|
if (LocalId == ParentGroup.RootPart.LocalId)
|
||||||
|
{
|
||||||
|
ParentGroup.CheckSculptAndLoad();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
|
||||||
|
(CollisionSound != UUID.Zero)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pa.OnCollisionUpdate += PhysicsCollision;
|
||||||
|
pa.SubscribeEvents(1000);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
|
||||||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
|
||||||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
|
||||||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
|
|
||||||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
|
|
||||||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
|
|
||||||
(CollisionSound != UUID.Zero)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
|
||||||
PhysActor.SubscribeEvents(1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // it already has a physical representation
|
else // it already has a physical representation
|
||||||
|
@ -4418,7 +4387,52 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This removes the part from physics
|
/// Adds this part to the physics scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This method also sets the PhysActor property.</remarks>
|
||||||
|
/// <param name="rigidBody">Add this prim with a rigid body.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// The physics actor. null if there was a failure.
|
||||||
|
/// </returns>
|
||||||
|
private PhysicsActor AddToPhysics(bool rigidBody)
|
||||||
|
{
|
||||||
|
PhysicsActor pa;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
|
string.Format("{0}/{1}", Name, UUID),
|
||||||
|
Shape,
|
||||||
|
AbsolutePosition,
|
||||||
|
Scale,
|
||||||
|
RotationOffset,
|
||||||
|
rigidBody,
|
||||||
|
m_localId);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
||||||
|
pa = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
|
||||||
|
// properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
|
||||||
|
// being set.
|
||||||
|
PhysActor = pa;
|
||||||
|
|
||||||
|
// Basic Physics can also return null as well as an exception catch.
|
||||||
|
if (pa != null)
|
||||||
|
{
|
||||||
|
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||||
|
pa.SetMaterial(Material);
|
||||||
|
DoPhysicsPropertyUpdate(rigidBody, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This removes the part from the physics scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
|
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
|
||||||
|
|
|
@ -3514,6 +3514,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the mass.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// The mass.
|
||||||
|
/// </returns>
|
||||||
|
public float GetMass()
|
||||||
|
{
|
||||||
|
PhysicsActor pa = PhysicsActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
|
return pa.Mass;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
internal void PushForce(Vector3 impulse)
|
internal void PushForce(Vector3 impulse)
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
|
|
|
@ -2022,27 +2022,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
|
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (part.ParentID == 0)
|
|
||||||
|
Vector3 pos;
|
||||||
|
|
||||||
|
if (!part.IsRoot)
|
||||||
{
|
{
|
||||||
return new LSL_Vector(part.AbsolutePosition.X,
|
pos = part.OffsetPosition;
|
||||||
part.AbsolutePosition.Y,
|
|
||||||
part.AbsolutePosition.Z);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_host.IsRoot)
|
if (part.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
return new LSL_Vector(m_host.AttachedPos.X,
|
pos = part.AttachedPos;
|
||||||
m_host.AttachedPos.Y,
|
|
||||||
m_host.AttachedPos.Z);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new LSL_Vector(part.OffsetPosition.X,
|
pos = part.AbsolutePosition;
|
||||||
part.OffsetPosition.Y,
|
|
||||||
part.OffsetPosition.Z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
|
||||||
|
|
||||||
|
return new LSL_Vector(pos.X, pos.Y, pos.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetRot(LSL_Rotation rot)
|
public void llSetRot(LSL_Rotation rot)
|
||||||
|
@ -2907,7 +2908,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Float llGetMass()
|
public LSL_Float llGetMass()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
return m_host.GetMass();
|
|
||||||
|
if (m_host.ParentGroup.IsAttachment)
|
||||||
|
{
|
||||||
|
ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
|
||||||
|
|
||||||
|
if (attachedAvatar != null)
|
||||||
|
{
|
||||||
|
return attachedAvatar.GetMass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_host.IsRoot)
|
||||||
|
{
|
||||||
|
return m_host.ParentGroup.GetMass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_host.GetMass();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llCollisionFilter(string name, string id, int accept)
|
public void llCollisionFilter(string name, string id, int accept)
|
||||||
|
@ -3055,7 +3080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
SceneObjectPart host = (SceneObjectPart)o;
|
SceneObjectPart host = (SceneObjectPart)o;
|
||||||
|
|
||||||
SceneObjectGroup grp = host.ParentGroup;
|
SceneObjectGroup grp = host.ParentGroup;
|
||||||
UUID itemID = grp.GetFromItemID();
|
UUID itemID = grp.FromItemID;
|
||||||
ScenePresence presence = World.GetScenePresence(host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(host.OwnerID);
|
||||||
|
|
||||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||||
|
@ -7146,6 +7171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case (int)ScriptBaseClass.PRIM_POSITION:
|
case (int)ScriptBaseClass.PRIM_POSITION:
|
||||||
|
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -10330,6 +10356,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
||||||
break;
|
break;
|
||||||
|
// For the following 8 see the Object version below
|
||||||
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Invalid or unhandled constant.
|
||||||
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10367,6 +10422,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
||||||
break;
|
break;
|
||||||
|
// The following 8 I have intentionaly coded to return zero. They are part of
|
||||||
|
// "Land Impact" calculations. These calculations are probably not applicable
|
||||||
|
// to OpenSim, required figures (cpu/memory usage) are not currently tracked
|
||||||
|
// I have intentionally left these all at zero rather than return possibly
|
||||||
|
// missleading numbers
|
||||||
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
|
// in SL this currently includes crashed scripts
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
|
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
|
// Average cpu time per simulator frame expended on all scripts in the objetc
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
|
// according to the SL wiki A prim or linkset will have prim
|
||||||
|
// equivalent of the number of prims in a linkset if it does not
|
||||||
|
// contain a mesh anywhere in the link set or is not a normal prim
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count * 0.06
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Invalid or unhandled constant.
|
||||||
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,6 +479,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int DEBUG_CHANNEL = 0x7FFFFFFF;
|
public const int DEBUG_CHANNEL = 0x7FFFFFFF;
|
||||||
public const int PUBLIC_CHANNEL = 0x00000000;
|
public const int PUBLIC_CHANNEL = 0x00000000;
|
||||||
|
|
||||||
|
// Constants for llGetObjectDetails
|
||||||
|
public const int OBJECT_UNKNOWN_DETAIL = -1;
|
||||||
public const int OBJECT_NAME = 1;
|
public const int OBJECT_NAME = 1;
|
||||||
public const int OBJECT_DESC = 2;
|
public const int OBJECT_DESC = 2;
|
||||||
public const int OBJECT_POS = 3;
|
public const int OBJECT_POS = 3;
|
||||||
|
@ -487,6 +489,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int OBJECT_OWNER = 6;
|
public const int OBJECT_OWNER = 6;
|
||||||
public const int OBJECT_GROUP = 7;
|
public const int OBJECT_GROUP = 7;
|
||||||
public const int OBJECT_CREATOR = 8;
|
public const int OBJECT_CREATOR = 8;
|
||||||
|
public const int OBJECT_RUNNING_SCRIPT_COUNT = 9;
|
||||||
|
public const int OBJECT_TOTAL_SCRIPT_COUNT = 10;
|
||||||
|
public const int OBJECT_SCRIPT_MEMORY = 11;
|
||||||
|
public const int OBJECT_SCRIPT_TIME = 12;
|
||||||
|
public const int OBJECT_PRIM_EQUIVALENCE = 13;
|
||||||
|
public const int OBJECT_SERVER_COST = 14;
|
||||||
|
public const int OBJECT_STREAMING_COST = 15;
|
||||||
|
public const int OBJECT_PHYSICS_COST = 16;
|
||||||
|
|
||||||
// Can not be public const?
|
// Can not be public const?
|
||||||
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
||||||
|
|
Loading…
Reference in New Issue