From 8428b25939d39711e732eeb3928e8a8e64aad8a9 Mon Sep 17 00:00:00 2001 From: KittoFlora Date: Mon, 26 Oct 2009 00:10:23 +0100 Subject: Add llRotLookat pt1. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 32171a0..5f46f6f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2187,6 +2187,11 @@ if (m_shape != null) { ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); } + + public void RotLookAt(Quaternion target, float strength, float damping) + { + m_parentGroup.rotLookAt(target, strength, damping); + } /// /// Schedules this prim for a full update @@ -2662,6 +2667,13 @@ if (m_shape != null) { SetText(text); } + public void StopLookAt() + { + m_parentGroup.stopLookAt(); + + m_parentGroup.ScheduleGroupForTerseUpdate(); + } + public void StopMoveToTarget() { m_parentGroup.stopMoveToTarget(); -- cgit v1.1 From 28aa8010b2b47b73c6b867ff8f6284f98f12f37a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Nov 2009 21:38:38 +0100 Subject: - Lower TIME_MS_TOLERANCE to 200ms - Allow m_updateFlag to be reset to 0 in the event of a terse update being rejected - Re-add a synchronous SendTo for certain types of packets --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 73d0984..c0fd437 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1064,14 +1064,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Clear all pending updates of parts to clients - /// - private void ClearUpdateSchedule() - { - m_updateFlag = 0; - } - private void SendObjectPropertiesToClient(UUID AgentID) { ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); @@ -2387,8 +2379,8 @@ namespace OpenSim.Region.Framework.Scenes { const float ROTATION_TOLERANCE = 0.01f; const float VELOCITY_TOLERANCE = 0.001f; - const float POSITION_TOLERANCE = 0.05f; - const int TIME_MS_TOLERANCE = 3000; + const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary + const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. if (m_updateFlag == 1) { @@ -2401,7 +2393,7 @@ namespace OpenSim.Region.Framework.Scenes Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); - ClearUpdateSchedule(); + // This causes the Scene to 'poll' physical objects every couple of frames // bad, so it's been replaced by an event driven method. @@ -2419,13 +2411,15 @@ namespace OpenSim.Region.Framework.Scenes m_lastAngularVelocity = AngularVelocity; m_lastTerseSent = Environment.TickCount; } + //Moved this outside of the if clause so updates don't get blocked.. *sigh* + m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* } else { if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes { AddFullUpdateToAllAvatars(); - ClearUpdateSchedule(); + m_updateFlag = 0; //Same here } } } -- cgit v1.1 From d1147136946daf14724183b3191119be44ff8b16 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 18:02:12 +0100 Subject: Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us: - Faster prim inventory actions. Multiple threads can read at once. - Fixes the known prim inventory thread locks - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cdec135..bbece2f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes + /// Get the inventory list /// public TaskInventoryDictionary TaskInventory { - get { return m_inventory.Items; } - set { m_inventory.Items = value; } + get { + return m_inventory.Items; + } + set { + m_inventory.Items = value; + } } public uint ObjectFlags @@ -2101,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes //Trys to fetch sound id from prim's inventory. //Prim's inventory doesn't support non script items yet - lock (TaskInventory) + TaskInventory.LockItemsForRead(true); + + foreach (KeyValuePair item in TaskInventory) { - foreach (KeyValuePair item in TaskInventory) + if (item.Value.Name == sound) { - if (item.Value.Name == sound) - { - soundID = item.Value.ItemID; - break; - } + soundID = item.Value.ItemID; + break; } } + + TaskInventory.LockItemsForRead(false); } List avatarts = m_parentGroup.Scene.GetAvatars(); @@ -2457,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes if (!UUID.TryParse(sound, out soundID)) { // search sound file from inventory - lock (TaskInventory) + TaskInventory.LockItemsForRead(true); + foreach (KeyValuePair item in TaskInventory) { - foreach (KeyValuePair item in TaskInventory) + if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) { - if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) - { - soundID = item.Value.ItemID; - break; - } + soundID = item.Value.ItemID; + break; } } + TaskInventory.LockItemsForRead(false); } if (soundID == UUID.Zero) -- cgit v1.1 From cc8246206d5044aff0b306a4bcaf4b321fb826c9 Mon Sep 17 00:00:00 2001 From: KittoFlora Date: Sat, 5 Dec 2009 09:03:02 +0100 Subject: Secnond revision of Sit and Stand for unscripted prims; Comment out spammy debug messages in Interregion.... --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 19e3023..9f2c3db 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -212,6 +212,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_sitTargetOrientation = Quaternion.Identity; private Vector3 m_sitTargetPosition; private string m_sitAnimation = "SIT"; + private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; private readonly UndoStack m_undo = new UndoStack(5); @@ -993,6 +994,13 @@ namespace OpenSim.Region.Framework.Scenes get { return _flags; } set { _flags = value; } } + + [XmlIgnore] + public bool IsOccupied // KF If an av is sittingon this prim + { + get { return m_occupied; } + set { m_occupied = value; } + } [XmlIgnore] public UUID SitTargetAvatar -- cgit v1.1 From 0d1d437bd3bf608448d71ea7de8e4f7cfb0371f0 Mon Sep 17 00:00:00 2001 From: KittoFlora Date: Sun, 6 Dec 2009 21:11:59 +0100 Subject: Fix linked physical daughter prim position update. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9f2c3db..a6382ee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -513,9 +513,16 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; - if (actor != null && _parentID == 0) + if (actor != null) { - m_groupPosition = actor.Position; + if (_parentID == 0) + { + m_groupPosition = actor.Position; + } + else + { + m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too! + } } if (IsAttachment) @@ -1743,9 +1750,13 @@ namespace OpenSim.Region.Framework.Scenes Quaternion parentRot = ParentGroup.RootPart.RotationOffset; Vector3 axPos = OffsetPosition; - axPos *= parentRot; Vector3 translationOffsetPosition = axPos; + + int tx = (int)GroupPosition.X; + int ty = (int)GroupPosition.Y; + int tz = (int)GroupPosition.Z; + return GroupPosition + translationOffsetPosition; } -- cgit v1.1 From ee9d46c8255840473ed62c3b37270b35af1a9027 Mon Sep 17 00:00:00 2001 From: KittoFlora Date: Tue, 8 Dec 2009 05:49:05 +0100 Subject: Correct AbsolutePosition calculation --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a6382ee..a23c11e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -849,7 +849,8 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) return GroupPosition; - return m_offsetPosition + m_groupPosition; } +// return m_offsetPosition + m_groupPosition; } + return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! } public SceneObjectGroup ParentGroup -- cgit v1.1 From 7cd44c1a818615ca0e267f64c74593ad0361350b Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Tue, 15 Dec 2009 20:04:53 -0500 Subject: Fix prim linking bug, Manis #14 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a23c11e..778e384 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -513,18 +513,24 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; + + if (actor != null && _parentID == 0) + { + m_groupPosition = actor.Position; + } +/* if (actor != null) { if (_parentID == 0) { - m_groupPosition = actor.Position; + m_groupPosition = actor.Position; } else { m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too! } } - +*/ if (IsAttachment) { ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); -- cgit v1.1 From e38e8ae98759e403175016260edd27772b5c9e4c Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Sat, 19 Dec 2009 19:54:44 -0500 Subject: Fix mantis #10 & #14 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 33 +++++++--------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 778e384..0eddbfd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -513,24 +513,11 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; - if (actor != null && _parentID == 0) { m_groupPosition = actor.Position; - } -/* - if (actor != null) - { - if (_parentID == 0) - { - m_groupPosition = actor.Position; - } - else - { - m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too! - } } -*/ + if (IsAttachment) { ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); @@ -545,7 +532,6 @@ namespace OpenSim.Region.Framework.Scenes StoreUndoState(); m_groupPosition = value; - PhysicsActor actor = PhysActor; if (actor != null) { @@ -1755,16 +1741,17 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 GetWorldPosition() { Quaternion parentRot = ParentGroup.RootPart.RotationOffset; - Vector3 axPos = OffsetPosition; axPos *= parentRot; Vector3 translationOffsetPosition = axPos; - - int tx = (int)GroupPosition.X; - int ty = (int)GroupPosition.Y; - int tz = (int)GroupPosition.Z; - - return GroupPosition + translationOffsetPosition; + if(_parentID == 0) + { + return GroupPosition; + } + else + { + return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position + } } /// @@ -1775,7 +1762,7 @@ namespace OpenSim.Region.Framework.Scenes { Quaternion newRot; - if (this.LinkNum == 0) + if (this.LinkNum < 2) //KF Single or root prim { newRot = RotationOffset; } -- cgit v1.1 From 1121919b57e1495d0357d59e010a865b91757bfb Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 3 Jan 2010 22:02:36 +0000 Subject: Solve conflict --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index eda3d60..a14e3ad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2910,13 +2910,6 @@ namespace OpenSim.Region.Framework.Scenes SetText(text); } - public void StopLookAt() - { - m_parentGroup.stopLookAt(); - - m_parentGroup.ScheduleGroupForTerseUpdate(); - } - public void StopMoveToTarget() { m_parentGroup.stopMoveToTarget(); -- cgit v1.1 From 496a8a4f7ca5422daa30913595b6b1a03fa8a59a Mon Sep 17 00:00:00 2001 From: CasperW Date: Wed, 20 Jan 2010 22:14:43 +0100 Subject: Fixed an issue with PayPrice sometimes being shared between multiple objects --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a7c14cf..4c97467 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.Framework.Scenes // TODO: This needs to be persisted in next XML version update! [XmlIgnore] - public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; + public int[] PayPrice = {-2,-2,-2,-2,-2}; [XmlIgnore] public PhysicsActor PhysActor; -- cgit v1.1 From 1abb70cc73c997c08a416fecf689b83453f853d0 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 21 Jan 2010 19:31:02 -0500 Subject: Add glue for llSetVehicleFlags(), llRemoveVehicleFlags(). ChODE: Add associated methods. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4c97467..04be9fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2963,7 +2963,23 @@ namespace OpenSim.Region.Framework.Scenes PhysActor.VehicleRotationParam(param, rotation); } } - + + public void SetVehicleFlags(int flags) + { + if (PhysActor != null) + { + PhysActor.VehicleFlagsSet(flags); + } + } + + public void RemoveVehicleFlags(int flags) + { + if (PhysActor != null) + { + PhysActor.VehicleFlagsRemove(flags); + } + } + public void SetGroup(UUID groupID, IClientAPI client) { _groupID = groupID; -- cgit v1.1 From 7f61de8f57d9f01e532dc37a5ef81153ba40fc24 Mon Sep 17 00:00:00 2001 From: CasperW Date: Thu, 25 Feb 2010 14:14:53 +0100 Subject: Allow particles and texture anims to be persisted to XML. This behaviour is expected. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 11682d9..0d19589 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -518,14 +518,12 @@ namespace OpenSim.Region.Framework.Scenes set { m_scriptAccessPin = (int)value; } } - [XmlIgnore] public Byte[] TextureAnimation { get { return m_TextureAnimation; } set { m_TextureAnimation = value; } } - [XmlIgnore] public Byte[] ParticleSystem { get { return m_particleSystem; } -- cgit v1.1 From 83929c69e35d156d99be46a6ee50b0d3fe5c9f25 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Mar 2010 00:56:55 -0600 Subject: - implementing server 1.38 functions Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c283bc..a85a4b3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4680,5 +4680,10 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error("[Physics] " + ex); } } + + public Color4 GetTextColor() + { + return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); + } } } -- cgit v1.1 From f6f6ef1532517972b973d8a500818dcd50873352 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 11 Mar 2010 19:12:38 -0500 Subject: Dynamics Integration Part 1 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0d19589..1353518 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -747,7 +747,16 @@ namespace OpenSim.Region.Framework.Scenes /// public Vector3 Acceleration { - get { return m_acceleration; } + get + { + PhysicsActor actor = PhysActor; + if (actor != null) + { + m_acceleration = actor.Acceleration; + } + return m_acceleration; + } + set { m_acceleration = value; } } -- cgit v1.1 From 819806261026cccd68dee649f11938ae5bf10029 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Sun, 14 Mar 2010 16:22:13 -0400 Subject: RotLookAt repaired; debug msg cleanup. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 35 ++-------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 31ea502..548a64f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2705,38 +2705,7 @@ namespace OpenSim.Region.Framework.Scenes public void RotLookAt(Quaternion target, float strength, float damping) { - rotLookAt(target, strength, damping); - } - - public void rotLookAt(Quaternion target, float strength, float damping) - { - if (IsAttachment) - { - /* - ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); - if (avatar != null) - { - Rotate the Av? - } */ - } - else - { - APIDDamp = damping; - APIDStrength = strength; - APIDTarget = target; - } - } - - public void startLookAt(Quaternion rot, float damp, float strength) - { - APIDDamp = damp; - APIDStrength = strength; - APIDTarget = rot; - } - - public void stopLookAt() - { - APIDTarget = Quaternion.Identity; + m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. } /// @@ -3460,7 +3429,7 @@ namespace OpenSim.Region.Framework.Scenes public void StopLookAt() { - m_parentGroup.stopLookAt(); + m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. m_parentGroup.ScheduleGroupForTerseUpdate(); } -- cgit v1.1 From 87664017773227d07b39382efa2aa94f22bbe6c6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 3 May 2010 04:28:30 +0200 Subject: Adapt CM to the new CHANGED_OWNER handling --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4b2641c..48e65a5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4683,5 +4683,17 @@ namespace OpenSim.Region.Framework.Scenes { return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); } + + public void ResetOwnerChangeFlag() + { + List inv = Inventory.GetInventoryList(); + + foreach (UUID itemID in inv) + { + TaskInventoryItem item = Inventory.GetInventoryItem(itemID); + item.OwnerChanged = false; + Inventory.UpdateInventoryItem(item); + } + } } } -- cgit v1.1 From e3dac1292ef000daadda3e264354d8df0fc77c22 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 29 May 2010 02:10:34 -0700 Subject: Implement suspended updates - When an operation is occurring on lots of prims in a single group, don't schedule any updates until the operation has completed. This makes things like llSetAlpha(LINK_SET,0.0,ALL_SIDES); a *lot* faster, more efficient and less buggy, and also makes unlinking a lot better. Linking is still treacherous.. this needs to be analysed. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c84596b..6e73b65 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2724,7 +2724,10 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) { - m_parentGroup.QueueForUpdateCheck(); + if (!m_parentGroup.areUpdatesSuspended) + { + m_parentGroup.QueueForUpdateCheck(); + } } int timeNow = Util.UnixTimeSinceEpoch(); @@ -4450,8 +4453,9 @@ namespace OpenSim.Region.Framework.Scenes { m_shape.TextureEntry = textureEntry; TriggerScriptChangedEvent(Changed.TEXTURE); - + m_updateFlag = 1; ParentGroup.HasGroupChanged = true; + //This is madness.. //ParentGroup.ScheduleGroupForFullUpdate(); //This is sparta -- cgit v1.1 From d4b4cbf5a5fead727b5e2e48f69d2016eb942cff Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 31 May 2010 19:00:02 +0200 Subject: Fix create selection getting overwritten by multiple updates for the same prim. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6e73b65..2f4191d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -388,7 +388,6 @@ namespace OpenSim.Region.Framework.Scenes // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log _flags = 0; - _flags |= PrimFlags.CreateSelected; TrimPermissions(); //m_undo = new UndoStack(ParentGroup.GetSceneMaxUndo()); @@ -418,6 +417,7 @@ namespace OpenSim.Region.Framework.Scenes private PrimFlags _flags = 0; private DateTime m_expires; private DateTime m_rezzed; + private bool m_createSelected = true; public UUID CreatorID { @@ -978,6 +978,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_updateFlag = value; } } + [XmlIgnore] + public bool CreateSelected + { + get { return m_createSelected; } + set { m_createSelected = value; } + } + #endregion //--------------- -- cgit v1.1 From eca15cfbf25134ddc8bb752abbe3a6ba01bf07a9 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 1 Jun 2010 02:45:14 +0200 Subject: Change the handling of CreateSelected. Only send it on real creation, not for each prim coming into view. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2f4191d..e4a36ef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -388,6 +388,7 @@ namespace OpenSim.Region.Framework.Scenes // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log _flags = 0; + CreateSelected = true; TrimPermissions(); //m_undo = new UndoStack(ParentGroup.GetSceneMaxUndo()); @@ -417,7 +418,7 @@ namespace OpenSim.Region.Framework.Scenes private PrimFlags _flags = 0; private DateTime m_expires; private DateTime m_rezzed; - private bool m_createSelected = true; + private bool m_createSelected = false; public UUID CreatorID { -- cgit v1.1 From f59e272643a92b20e7f7eb97f54a30c8b045725d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 13 Jun 2010 22:21:05 +0200 Subject: Introduce SOP.UpdateSitters() to update sitting avatars' chat position if needed --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e4a36ef..705e0a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4720,5 +4720,13 @@ namespace OpenSim.Region.Framework.Scenes Inventory.UpdateInventoryItem(item); } } + + public void UpdateSitter() + { + if (m_sitTargetAvatar != UUID.Zero) + return; + + // Update sitting avatar chat position + } } } -- cgit v1.1 From 3d319d6c3ff2bded0f4b6c730f227a490dd2fb2e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 13 Jun 2010 22:23:07 +0200 Subject: Actually update the SP. EXPERIMENTAL --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 705e0a3..a83119e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4726,7 +4726,13 @@ namespace OpenSim.Region.Framework.Scenes if (m_sitTargetAvatar != UUID.Zero) return; + ScenePresence p = m_parentGroup.Scene.GetScenePresence(m_sitTargetAvatar); + if (p == null) + return; + // Update sitting avatar chat position + + p.AbsolutePosition = AbsolutePosition; } } } -- cgit v1.1 From 520b0e131c43e97d4a08c8ed93a32228ab61a99e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 13 Jun 2010 22:37:11 +0200 Subject: Try to make prims stop moving. Reset velocity, etc, unconditionally. Although the phys actor may be new, the prim fields could still be set and the slimupdates system would continue sending that data out. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a83119e..be2bbc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1738,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes // which stops client-side interpolation of deactivated joint proxy objects. } - if (!UsePhysics && !isNew) + if (!UsePhysics) { // reset velocity to 0 on physics switch-off. Without that, the client thinks the // prim still has velocity and continues to interpolate its position along the old -- cgit v1.1 From 305876180690e5c236d6bda60a6173a16ad5edc8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 13 Jun 2010 22:43:14 +0200 Subject: D.U.H. un-reverse a reversed condition --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index be2bbc5..c3e87b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4723,7 +4723,7 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateSitter() { - if (m_sitTargetAvatar != UUID.Zero) + if (m_sitTargetAvatar == UUID.Zero) return; ScenePresence p = m_parentGroup.Scene.GetScenePresence(m_sitTargetAvatar); -- cgit v1.1 From d520360cb83bb3f7733228ff74cf083b0855b261 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 13 Jun 2010 23:01:15 +0200 Subject: Try it witht he root prim --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c3e87b7..68681c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4732,7 +4732,7 @@ namespace OpenSim.Region.Framework.Scenes // Update sitting avatar chat position - p.AbsolutePosition = AbsolutePosition; + p.AbsolutePosition = GroupPosition; } } } -- cgit v1.1 From 62763cc0fb80caae199ea03d2cb8d031924c111e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Jun 2010 00:02:17 +0200 Subject: Report current position instead of position at the time we sat down --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 68681c9..91b7d35 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4732,7 +4732,7 @@ namespace OpenSim.Region.Framework.Scenes // Update sitting avatar chat position - p.AbsolutePosition = GroupPosition; + p.AbsolutePosition = GroupPosition + OffsetPosition + m_sitTargetPosition; } } } -- cgit v1.1 From 093cc047cd42f4cc3d59f365aa70cc196855e83f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Jun 2010 00:03:43 +0200 Subject: Revert "Try it witht he root prim" This reverts commit d520360cb83bb3f7733228ff74cf083b0855b261. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 91b7d35..c3e87b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4732,7 +4732,7 @@ namespace OpenSim.Region.Framework.Scenes // Update sitting avatar chat position - p.AbsolutePosition = GroupPosition + OffsetPosition + m_sitTargetPosition; + p.AbsolutePosition = AbsolutePosition; } } } -- cgit v1.1 From 5fda89fdb5ca6569239412b7b2d38163b8b3b5ab Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Jun 2010 00:04:02 +0200 Subject: Revert "D.U.H." This reverts commit 305876180690e5c236d6bda60a6173a16ad5edc8. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c3e87b7..be2bbc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4723,7 +4723,7 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateSitter() { - if (m_sitTargetAvatar == UUID.Zero) + if (m_sitTargetAvatar != UUID.Zero) return; ScenePresence p = m_parentGroup.Scene.GetScenePresence(m_sitTargetAvatar); -- cgit v1.1 From f9b4f5f594caf609d255c585c4224f0455403908 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Jun 2010 00:05:01 +0200 Subject: Revert "Introduce SOP.UpdateSitters() to update sitting avatars' chat position if" This reverts commit f59e272643a92b20e7f7eb97f54a30c8b045725d. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index be2bbc5..b80a557 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4720,19 +4720,5 @@ namespace OpenSim.Region.Framework.Scenes Inventory.UpdateInventoryItem(item); } } - - public void UpdateSitter() - { - if (m_sitTargetAvatar != UUID.Zero) - return; - - ScenePresence p = m_parentGroup.Scene.GetScenePresence(m_sitTargetAvatar); - if (p == null) - return; - - // Update sitting avatar chat position - - p.AbsolutePosition = AbsolutePosition; - } } } -- cgit v1.1 From a1416612a9f9e0d5cbe1c1f02d313e9be020226d Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sun, 20 Jun 2010 14:45:04 -0700 Subject: Update all clients sitting on a linkset if a child prim is moved. This prevents avatars being "lost in the void" until they stand up when a child prim is moved that they're sitting on. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b80a557..78faa01 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -711,6 +711,12 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } + + List avs = ParentGroup.GetLinkedAvatars(); + foreach (ScenePresence av in avs) + { + av.SendFullUpdateToAllClients(); + } } } } -- cgit v1.1 From 6f4d4543b94f28160d697489e591da6614f0c8fc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jun 2010 03:51:16 +0200 Subject: Make newly created prims be named "Object" and make newly created scripts have a default touch handler. Compatibility patch --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 09c945b..5b007e6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset, Vector3 offsetPosition) { - m_name = "Primitive"; + m_name = "Object"; Rezzed = DateTime.UtcNow; _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); @@ -1625,7 +1625,7 @@ namespace OpenSim.Region.Framework.Scenes PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); part.Shape = shape; - part.Name = "Primitive"; + part.Name = "Object"; part._ownerID = UUID.Random(); return part; -- cgit v1.1 From fe2b044d38f3bd3aa669334d34567fd991a67b3e Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 3 Jul 2010 06:10:55 -0700 Subject: Fix Undo! Made a lot of changes to Undo state saving; it now considers that groups of objects can be moved and not just individual prims.. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5b007e6..72ad281 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3504,9 +3504,12 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.ScheduleGroupForTerseUpdate(); //m_parentGroup.ScheduleGroupForFullUpdate(); } - public void StoreUndoState() { + StoreUndoState(false); + } + public void StoreUndoState(bool group) + { if (!Undoing) { if (!IgnoreUndoUpdate) @@ -3528,7 +3531,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup.GetSceneMaxUndo() > 0) { UndoState nUndo = new UndoState(this); - + nUndo.GroupChange = group; m_undo.Push(nUndo); } @@ -4010,6 +4013,15 @@ namespace OpenSim.Region.Framework.Scenes nUndo = new UndoState(this); } UndoState goback = m_undo.Pop(); + m_log.Debug("Got goback"); + if (goback == null) + { + m_log.Debug("it's null"); + } + else + { + m_log.Debug(goback.GroupPosition.ToString()); + } if (goback != null) { goback.PlaybackState(this); -- cgit v1.1 From 5b68343361cbd000a2f024b37797ec235abb7207 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sun, 4 Jul 2010 19:28:39 -0700 Subject: The majority of the Undo fix. There is still an issue with Rotation which i'll address next; however position undo and scale undo should be working just fine now. Also removed some residual debug logging. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 61 +++++++++++----------- 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 72ad281..93a23ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_offsetPosition; } set { - StoreUndoState(); + StoreUndoState(UndoType.STATE_PRIM_POSITION); m_offsetPosition = value; if (ParentGroup != null && !ParentGroup.IsDeleted) @@ -759,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes set { - StoreUndoState(); + StoreUndoState(UndoType.STATE_PRIM_ROTATION); m_rotationOffset = value; PhysicsActor actor = PhysActor; @@ -958,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_shape.Scale; } set { - StoreUndoState(); + StoreUndoState(UndoType.STATE_PRIM_SCALE); if (m_shape != null) { m_shape.Scale = value; @@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes { m_redo.Clear(); } - StoreUndoState(); + StoreUndoState(UndoType.STATE_ALL); } public byte ConvertScriptUintToByte(uint indata) @@ -2721,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { - StoreUndoState(); + StoreUndoState(UndoType.STATE_PRIM_SCALE); m_shape.Scale = scale; ParentGroup.HasGroupChanged = true; @@ -3504,13 +3504,11 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.ScheduleGroupForTerseUpdate(); //m_parentGroup.ScheduleGroupForFullUpdate(); } - public void StoreUndoState() + public void StoreUndoState(UndoType type) { - StoreUndoState(false); - } - public void StoreUndoState(bool group) - { - if (!Undoing) + + + if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) { if (!IgnoreUndoUpdate) { @@ -3521,17 +3519,25 @@ namespace OpenSim.Region.Framework.Scenes if (m_undo.Count > 0) { UndoState last = m_undo.Peek(); - if (last != null) - { - if (last.Compare(this)) - return; - } + } if (m_parentGroup.GetSceneMaxUndo() > 0) { - UndoState nUndo = new UndoState(this); - nUndo.GroupChange = group; + UndoState lastUndo = m_undo.Peek(); + + UndoState nUndo = new UndoState(this, type); + + if (lastUndo != null) + { + TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); + if (ts.TotalMilliseconds < 500) + { + //Delete the last entry since it was less than 500 milliseconds ago + nUndo.Merge(lastUndo); + m_undo.Pop(); + } + } m_undo.Push(nUndo); } @@ -4008,20 +4014,13 @@ namespace OpenSim.Region.Framework.Scenes if (m_undo.Count > 0) { UndoState nUndo = null; - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - nUndo = new UndoState(this); - } UndoState goback = m_undo.Pop(); - m_log.Debug("Got goback"); - if (goback == null) - { - m_log.Debug("it's null"); - } - else + if (m_parentGroup.GetSceneMaxUndo() > 0) { - m_log.Debug(goback.GroupPosition.ToString()); + nUndo = new UndoState(this, goback.Type); } + + if (goback != null) { goback.PlaybackState(this); @@ -4036,13 +4035,13 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_redo) { + UndoState gofwd = m_redo.Pop(); if (m_parentGroup.GetSceneMaxUndo() > 0) { - UndoState nUndo = new UndoState(this); + UndoState nUndo = new UndoState(this, gofwd.Type); m_undo.Push(nUndo); } - UndoState gofwd = m_redo.Pop(); if (gofwd != null) gofwd.PlayfwdState(this); } -- cgit v1.1 From e947d04038f7b42929368d9f7b6d440be139e675 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 5 Jul 2010 05:44:35 -0700 Subject: Undo fix is now complete. This commit repairs the special case of the root prim moving or rotating independently of the rest of the group. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 93a23ca..3327b1e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3506,8 +3506,6 @@ namespace OpenSim.Region.Framework.Scenes } public void StoreUndoState(UndoType type) { - - if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) { if (!IgnoreUndoUpdate) -- cgit v1.1 From 8aa5f30082f667fc23ccfdb839e04ba8b72f872c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 10 Jul 2010 10:51:49 +0200 Subject: Make taken items go back to the folder they came from --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3327b1e..b552cdc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -180,6 +180,9 @@ namespace OpenSim.Region.Framework.Scenes public UUID FromItemID; [XmlIgnore] + public UUID FromFolderID; + + [XmlIgnore] public int STATUS_ROTATE_X; [XmlIgnore] -- cgit v1.1 From 7f0f11304f0979355d75538ab7326b687b62e76e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 11 Jul 2010 14:26:57 +0200 Subject: Add scripted controllers into agent intersim messaging --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b552cdc..e87766e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4145,6 +4145,10 @@ namespace OpenSim.Region.Framework.Scenes case 16: _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & baseMask; + // Prevent the client from creating no mod, no copy + // objects + if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0) + _nextOwnerMask |= (uint)PermissionMask.Transfer; break; } SendFullUpdateToAllClients(); -- cgit v1.1 From 5f4105d48c9776423a730e6480a2587bd64550a5 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 12 Jul 2010 13:55:56 -0700 Subject: Removed the CHANGED_COLOR event post from the Color accessor in SOP. This is not the correct usage of this changed event - it's only supposed to be posted when the /textures/ change colour or alpha transparency, not the floating text. This fixes several race conditions in scripts ported from SL. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e87766e..f8ae321 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -882,7 +882,6 @@ namespace OpenSim.Region.Framework.Scenes set { m_color = value; - TriggerScriptChangedEvent(Changed.COLOR); /* ScheduleFullUpdate() need not be called b/c after * setting the color, the text will be set, so then -- cgit v1.1 From ddfff55cc76144607086fbca03c86df57a271ed0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 21:06:49 +0200 Subject: Preserve attachment data while a prim is in world. Allows attachment editing on the ground without losing attachpoint and position --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f8ae321..87b2d74 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -182,6 +182,14 @@ namespace OpenSim.Region.Framework.Scenes [XmlIgnore] public UUID FromFolderID; + // The following two are to hold the attachment data + // while an object is inworld + [XmlIgnore] + public byte AttachPoint = 0; + + [XmlIgnore] + public Vector3 AttachOffset = Vector3.Zero; + [XmlIgnore] public int STATUS_ROTATE_X; -- cgit v1.1 From 8d2b4b7b487f7a35b610d894c03619e638866473 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 15 Jul 2010 20:03:08 +0200 Subject: Fix a few permissions vulnerability. Owners could cause permissions escalation on items contained in prims using a hacked viewer --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 87b2d74..b19c443 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4156,6 +4156,9 @@ namespace OpenSim.Region.Framework.Scenes // objects if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0) _nextOwnerMask |= (uint)PermissionMask.Transfer; + + _nextOwnerMask |= (uint)PermissionMask.Move; + break; } SendFullUpdateToAllClients(); -- cgit v1.1 From e3184753a6956078a2e34c449d5e30843b5d7f94 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 3 Aug 2010 05:25:23 +0200 Subject: Log the UUID of a prim that fails meshing and set the prim to phantom during region startup --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b19c443..032fbe8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1497,14 +1497,21 @@ namespace OpenSim.Region.Framework.Scenes // or flexible if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) { - PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( - Name, - Shape, - AbsolutePosition, - Scale, - RotationOffset, - RigidBody); - + try + { + PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( + Name, + Shape, + AbsolutePosition, + Scale, + RotationOffset, + RigidBody); + } + catch + { + m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); + PhysActor = null; + } // Basic Physics returns null.. joy joy joy. if (PhysActor != null) { -- cgit v1.1 From 8bdbcda2b70ede033c38a604af573554dd2776ad Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Aug 2010 18:50:17 +0200 Subject: We already have a record of killed prims. It just wasn't used by the new JHurlicane code anymore. Use it to prevent sending updates after kills. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 032fbe8..67cb7cc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3043,6 +3043,15 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID = _ownerID; UUID objectID = UUID; UUID parentID = GetRootPartUUID(); + + if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) + { + // Use the avatar as the parent for HUDs, since the prims + // are not sent to other avatars + objectID = _ownerID; + parentID = _ownerID; + } + UUID soundID = UUID.Zero; Vector3 position = AbsolutePosition; // region local ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; -- cgit v1.1 From c5c6627adb79644b93c5871243a9eeeff553829c Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Aug 2010 02:39:42 -0700 Subject: Implement CHANGED_REGION_(RE)START and also fix various CHANGED_* constants which had the wrong values (checked using LSL in SL). This addresses mantis #217 and mantis #53. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 032fbe8..a0fabff 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -56,9 +56,10 @@ namespace OpenSim.Region.Framework.Scenes LINK = 32, ALLOWED_DROP = 64, OWNER = 128, - REGION_RESTART = 256, - REGION = 512, - TELEPORT = 1024 + REGION = 256, + TELEPORT = 512, + REGION_RESTART = 1024, + ANIMATION = 16384 } // I don't really know where to put this except here. -- cgit v1.1 From a636af13e77aae588f425b7bc9504854a7ed1261 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Aug 2010 06:37:40 -0700 Subject: Make sure the avatar position gets moved along with a prim it is sitting on. This fixes mantis #208 and (maybe) issues with chat and sound coming from the wrong place when sat on a vehicle. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ba84b88..badd357 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -682,25 +682,13 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + } catch (Exception e) { m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); } } - - // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too - if (m_sitTargetAvatar != UUID.Zero) - { - if (m_parentGroup != null) // TODO can there be a SOP without a SOG? - { - ScenePresence avatar; - if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) - { - avatar.ParentPosition = GetWorldPosition(); - } - } - } } } @@ -709,6 +697,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_offsetPosition; } set { + Vector3 oldpos = m_offsetPosition; StoreUndoState(UndoType.STATE_PRIM_POSITION); m_offsetPosition = value; @@ -727,7 +716,12 @@ namespace OpenSim.Region.Framework.Scenes List avs = ParentGroup.GetLinkedAvatars(); foreach (ScenePresence av in avs) { - av.SendFullUpdateToAllClients(); + if (av.LinkedPrim == m_uuid) + { + Vector3 offset = (m_offsetPosition - oldpos); + av.OffsetPosition += offset; + av.SendFullUpdateToAllClients(); + } } } } -- cgit v1.1 From 4f80d75bf3fa6de226203c6752e7a8e53fda8108 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 7 Aug 2010 06:28:04 -0700 Subject: Add a CHANGED_POSITION event so scripts don't have to run expensive loops to check for position changes --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index efdc19c..d544619 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes TELEPORT = 512, REGION_RESTART = 1024, MEDIA = 2048, - ANIMATION = 16384 + ANIMATION = 16384, + POSITION = 32768 } // I don't really know where to put this except here. @@ -730,6 +731,7 @@ namespace OpenSim.Region.Framework.Scenes } } } + TriggerScriptChangedEvent(Changed.POSITION); } } -- cgit v1.1 From 19ab4c950880beb3ac88a172b775c3973782ec3d Mon Sep 17 00:00:00 2001 From: meta7 Date: Sat, 7 Aug 2010 16:52:03 -0700 Subject: Fix a rather nasty issue where the Backup() process causes objects and avatars sitting on them to be pushed to the corner of the sim. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0ce450..77581af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -718,17 +718,20 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); - } - - List avs = ParentGroup.GetLinkedAvatars(); - foreach (ScenePresence av in avs) - { - if (av.LinkedPrim == m_uuid) - { - Vector3 offset = (m_offsetPosition - oldpos); - av.OffsetPosition += offset; - av.SendFullUpdateToAllClients(); - } + } + + if (!m_parentGroup.m_dupeInProgress) + { + List avs = ParentGroup.GetLinkedAvatars(); + foreach (ScenePresence av in avs) + { + if (av.LinkedPrim == m_uuid) + { + Vector3 offset = (m_offsetPosition - oldpos); + av.OffsetPosition += offset; + av.SendFullUpdateToAllClients(); + } + } } } TriggerScriptChangedEvent(Changed.POSITION); -- cgit v1.1 From d98d5ee6be233cf644be5ee1011c4a7f4b86ae46 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 10 Aug 2010 19:42:18 +0100 Subject: Remove windows line endinge --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 77581af..277384e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -718,20 +718,20 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); - } - - if (!m_parentGroup.m_dupeInProgress) - { - List avs = ParentGroup.GetLinkedAvatars(); - foreach (ScenePresence av in avs) - { - if (av.LinkedPrim == m_uuid) - { - Vector3 offset = (m_offsetPosition - oldpos); - av.OffsetPosition += offset; - av.SendFullUpdateToAllClients(); - } - } + } + + if (!m_parentGroup.m_dupeInProgress) + { + List avs = ParentGroup.GetLinkedAvatars(); + foreach (ScenePresence av in avs) + { + if (av.LinkedPrim == m_uuid) + { + Vector3 offset = (m_offsetPosition - oldpos); + av.OffsetPosition += offset; + av.SendFullUpdateToAllClients(); + } + } } } TriggerScriptChangedEvent(Changed.POSITION); -- cgit v1.1 From fa393cb13a6008ed82c13d9f2bcec96dd8e21cae Mon Sep 17 00:00:00 2001 From: meta7 Date: Wed, 11 Aug 2010 13:39:36 -0700 Subject: Fix Omega getting overwritten on startup. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fbe1da9..dd780b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1827,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes // which stops client-side interpolation of deactivated joint proxy objects. } - if (!UsePhysics) + if (!UsePhysics && !isNew) { // reset velocity to 0 on physics switch-off. Without that, the client thinks the // prim still has velocity and continues to interpolate its position along the old -- cgit v1.1 From a0c87b5af6bba104fe50de3006b5dd515a8eb833 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Sep 2010 23:12:32 +0200 Subject: JustinCC is evil. f7b28dd3 broke script persistence. This fixes it. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c4a2a3..40112c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -514,7 +514,7 @@ namespace OpenSim.Region.Framework.Scenes // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part if (Inventory != null) - Inventory.ResetInventoryIDs(); + Inventory.ResetObjectID(); } } @@ -2800,6 +2800,7 @@ namespace OpenSim.Region.Framework.Scenes UUID = UUID.Random(); LinkNum = linkNum; LocalId = 0; + Inventory.ResetInventoryIDs(); } /// -- cgit v1.1 From 2804c97a39ece1352bc8ce8cf3672307798417df Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Oct 2010 22:06:47 +0100 Subject: Change the part for sound playback to be the root part / object UUID instead of the child prim because using the child prim plain doesn't work. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index efdb94c..726bda1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2730,7 +2730,7 @@ namespace OpenSim.Region.Framework.Scenes public void PreloadSound(string sound) { // UUID ownerID = OwnerID; - UUID objectID = UUID; + UUID objectID = ParentGroup.RootPart.UUID; UUID soundID = UUID.Zero; if (!UUID.TryParse(sound, out soundID)) @@ -3112,7 +3112,7 @@ namespace OpenSim.Region.Framework.Scenes volume = 0; UUID ownerID = _ownerID; - UUID objectID = UUID; + UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = GetRootPartUUID(); if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) @@ -3157,11 +3157,11 @@ namespace OpenSim.Region.Framework.Scenes else soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); ParentGroup.PlaySoundMasterPrim = this; - ownerID = this._ownerID; - objectID = this.UUID; - parentID = this.GetRootPartUUID(); - position = this.AbsolutePosition; // region local - regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle; + ownerID = _ownerID; + objectID = ParentGroup.RootPart.UUID; + parentID = GetRootPartUUID(); + position = AbsolutePosition; // region local + regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; if (triggered) soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); else @@ -3169,7 +3169,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) { ownerID = prim._ownerID; - objectID = prim.UUID; + objectID = prim.ParentGroup.RootPart.UUID; parentID = prim.GetRootPartUUID(); position = prim.AbsolutePosition; // region local regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; -- cgit v1.1 From 3eb68c319e1211bf0d4e251931f23d44ac88e63e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Oct 2010 08:24:18 +0200 Subject: change default next owner persm to mod/trans to match SL. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 726bda1..f0740f8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -443,7 +443,7 @@ namespace OpenSim.Region.Framework.Scenes private uint _ownerMask = (uint)PermissionMask.All; private uint _groupMask = (uint)PermissionMask.None; private uint _everyoneMask = (uint)PermissionMask.None; - private uint _nextOwnerMask = (uint)PermissionMask.All; + private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); private PrimFlags _flags = PrimFlags.None; private DateTime m_expires; private DateTime m_rezzed; @@ -1668,6 +1668,9 @@ namespace OpenSim.Region.Framework.Scenes // Move afterwards ResetIDs as it clears the localID dupe.LocalId = localID; + if(dupe.PhysActor != null) + dupe.PhysActor.LocalID = localID; + // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe._lastOwnerID = OwnerID; -- cgit v1.1 From 78a6e5489beccbd4de7385219d0d214323a3d9a1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Oct 2010 20:50:16 +0200 Subject: Fix merge issues --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7ec3697..0321515 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -191,7 +191,6 @@ namespace OpenSim.Region.Framework.Scenes public UUID FromFolderID; -<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs // The following two are to hold the attachment data // while an object is inworld [XmlIgnore] @@ -201,9 +200,6 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 AttachOffset = Vector3.Zero; [XmlIgnore] -======= - ->>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs public int STATUS_ROTATE_X; @@ -633,20 +629,12 @@ namespace OpenSim.Region.Framework.Scenes set { m_LoopSoundSlavePrims = value; } } -<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs -======= - ->>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs public Byte[] TextureAnimation { get { return m_TextureAnimation; } set { m_TextureAnimation = value; } } -<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs -======= - ->>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs public Byte[] ParticleSystem { get { return m_particleSystem; } -- cgit v1.1 From 5f266fd57131193a9ff37b03f214aa0476e2e3aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Oct 2010 17:18:21 +0200 Subject: Change the results from llGetPrimitiveParams to be the same as SL for the prim position. This will make attached resizer scripts work like SL. Existing resizers may be affected adversely. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0321515..5521326 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1060,7 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes { get { if (IsAttachment) - return GroupPosition; + return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); // return m_offsetPosition + m_groupPosition; } return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! -- cgit v1.1 From c2bd6ccdb8f9a5063450f684c31d75df537ff5e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 23:20:30 +0100 Subject: Fix playing sound from HUDs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5521326..be3e87f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3115,14 +3115,6 @@ namespace OpenSim.Region.Framework.Scenes UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = GetRootPartUUID(); - if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) - { - // Use the avatar as the parent for HUDs, since the prims - // are not sent to other avatars - objectID = _ownerID; - parentID = _ownerID; - } - UUID soundID = UUID.Zero; Vector3 position = AbsolutePosition; // region local ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; -- cgit v1.1 From 4f15b8d4e6be1e1fe88ad32aa43595861d1005ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 20:44:39 +0100 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index be3e87f..b615d42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4822,7 +4822,7 @@ namespace OpenSim.Region.Framework.Scenes { TaskInventoryItem item = Inventory.GetInventoryItem(itemID); item.OwnerChanged = false; - Inventory.UpdateInventoryItem(item); + Inventory.UpdateInventoryItem(item, false, false); } } } -- cgit v1.1 From b3a71c6df1538c61247f7d4711aba4c840508db8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 24 Nov 2010 18:56:25 +0100 Subject: Prevent an overlength button label from producing a debug dump and aborting the script. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bdd42fc..8cc2be1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -803,7 +803,7 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 offset = (m_offsetPosition - oldpos); av.OffsetPosition += offset; - av.SendFullUpdateToAllClients(); + av.SendAvatarDataToAllAgents(); } } } -- cgit v1.1 From 62e66b17bcc6e9dd856a0d46b3097f452d865a3b Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 15 Dec 2010 17:54:57 +0100 Subject: Make sure the material is set on physical prims --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a109d68..0297a39 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1608,6 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes Scale, RotationOffset, RigidBody); + PhysActor.SetMaterial(Material); } catch { @@ -4432,6 +4433,7 @@ namespace OpenSim.Region.Framework.Scenes Scale, RotationOffset, UsePhysics); + PhysActor.SetMaterial(Material); pa = PhysActor; if (pa != null) -- cgit v1.1 From b16f4024dbf89e2a9a30232fe0be452c0e722b90 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Dec 2010 21:04:10 +0100 Subject: Update child prim group positions in moving vehicles --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0297a39..faa6f37 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -730,9 +730,10 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; - if (actor != null && _parentID == 0) + if (_parentID == 0) { - m_groupPosition = actor.Position; + if (actor != null) + m_groupPosition = actor.Position; } if (IsAttachment) @@ -742,6 +743,8 @@ namespace OpenSim.Region.Framework.Scenes return sp.AbsolutePosition; } + // use root prim's group position. Physics may have updated it + m_groupPosition = ParentGroup.RootPart.GroupPosition; return m_groupPosition; } set -- cgit v1.1 From 0aeafc9919b9f6b78adba231a03d75db16977398 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Dec 2010 07:25:56 +0100 Subject: Fix the recent stack overflow --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index faa6f37..fe9201b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -734,6 +734,7 @@ namespace OpenSim.Region.Framework.Scenes { if (actor != null) m_groupPosition = actor.Position; + return m_groupPosition; } if (IsAttachment) @@ -741,6 +742,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); if (sp != null) return sp.AbsolutePosition; + return m_groupPosition; } // use root prim's group position. Physics may have updated it -- cgit v1.1 From b17150c3e8db0058fd1c29cb8ef991932730d31b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Dec 2010 08:05:42 +0100 Subject: Fix the corner casse of stack overflow when logging out with attachments --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fe9201b..3e3f032 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -742,11 +742,11 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); if (sp != null) return sp.AbsolutePosition; - return m_groupPosition; } // use root prim's group position. Physics may have updated it - m_groupPosition = ParentGroup.RootPart.GroupPosition; + if (ParentGroup.RootPart != this) + m_groupPosition = ParentGroup.RootPart.GroupPosition; return m_groupPosition; } set -- cgit v1.1 From 61b7ec5fb552d045343590c773565968d1cdb6c1 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Sun, 26 Dec 2010 22:52:03 +0000 Subject: Fixing AbsolutePosition to correct llSensor in vehicles --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3e3f032..6496a25 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1108,12 +1108,10 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 AbsolutePosition { - get { - if (IsAttachment) - return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); - -// return m_offsetPosition + m_groupPosition; } - return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! + get + { + return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); + } } public SceneObjectGroup ParentGroup -- cgit v1.1 From 932db1c3742415bd089620ca4eba9ed8ac857d85 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 May 2011 11:30:21 +0200 Subject: Add PayPrice to serialization format Xml2 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e7e3014..4e1d6b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -145,7 +145,6 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 StatusSandboxPos; - // TODO: This needs to be persisted in next XML version update! [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; -- cgit v1.1 From 61bf2bf2ddce323255d7d009274d8da5a2da54c9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Jun 2011 18:32:25 +0200 Subject: Make Buoyancy a prim property --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4e1d6b6..cb321aa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastAcceleration; protected Vector3 m_lastAngularVelocity; protected int m_lastTerseSent; + protected float m_buoyancy = 0.0f; /// /// Stores media texture data @@ -1335,6 +1336,19 @@ namespace OpenSim.Region.Framework.Scenes set { m_collisionSoundVolume = value; } } + public float Buoyancy + { + get { return m_buoyancy; } + set + { + m_buoyancy = value; + if (PhysActor != null) + { + PhysActor.Buoyancy = value; + } + } + } + #endregion Public Properties with only Get #region Private Methods @@ -3275,14 +3289,6 @@ 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 == null) -- cgit v1.1 From fedfa02b64deeaf78555b5767908e14bc27e4aa8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jul 2011 21:20:11 +0200 Subject: Remove another core SNAFU. AbsolutePosition is NOT equal to group position in attachments! Breaks resizers!!! --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ff1d520..0746b06 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1118,9 +1118,6 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (IsAttachment) - return GroupPosition; - return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); } } -- cgit v1.1 From bb402d0d95c934fbcd8b1c03e228ec1d0a14f14d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 15 Jul 2011 12:08:40 -0700 Subject: Add localid support to ch0de properly --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 980f7a3..2214f2f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1633,7 +1633,8 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - RigidBody); + RigidBody, + m_localId); PhysActor.SetMaterial(Material); } catch @@ -4442,7 +4443,8 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - UsePhysics); + UsePhysics, + m_localId); PhysActor.SetMaterial(Material); pa = PhysActor; -- cgit v1.1 From 8dff9d564dfbf4841f03a919df44e8ae3d76de25 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jul 2011 19:35:49 +0200 Subject: Revert "Add localid support to ch0de properly" This reverts commit bb402d0d95c934fbcd8b1c03e228ec1d0a14f14d. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2214f2f..980f7a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1633,8 +1633,7 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - RigidBody, - m_localId); + RigidBody); PhysActor.SetMaterial(Material); } catch @@ -4443,8 +4442,7 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - UsePhysics, - m_localId); + UsePhysics); PhysActor.SetMaterial(Material); pa = PhysActor; -- cgit v1.1 From c7dbd7cbd035ccc412624cd221348479d43798d6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jul 2011 12:08:40 -0700 Subject: Fox some local id issues in physics glue --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 980f7a3..2214f2f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1633,7 +1633,8 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - RigidBody); + RigidBody, + m_localId); PhysActor.SetMaterial(Material); } catch @@ -4442,7 +4443,8 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - UsePhysics); + UsePhysics, + m_localId); PhysActor.SetMaterial(Material); pa = PhysActor; -- cgit v1.1 From f5623b5c3903606606fedead8f365244c0eddbed Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 19 Jul 2011 10:15:34 -0700 Subject: Tidy up a superfluous AddPrimShape override in PhysicsScene --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2214f2f..037f384 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4437,7 +4437,6 @@ namespace OpenSim.Region.Framework.Scenes { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( - LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, -- cgit v1.1 From c768d18c92d145427eb1b1679894f082b0bed7a5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Jul 2011 18:16:36 +0100 Subject: Revert "Tidy up a superfluous AddPrimShape override in PhysicsScene" This reverts commit f5623b5c3903606606fedead8f365244c0eddbed. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 037f384..2214f2f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4437,6 +4437,7 @@ namespace OpenSim.Region.Framework.Scenes { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( + LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, -- cgit v1.1 From cbaa4aa88fd45df70003176254579492f11e0d5a Mon Sep 17 00:00:00 2001 From: Careminster Team Date: Tue, 19 Jul 2011 10:15:34 -0700 Subject: Tidy up a superfluous AddPrimShape override in PhysicsScene --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2214f2f..037f384 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4437,7 +4437,6 @@ namespace OpenSim.Region.Framework.Scenes { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( - LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, -- cgit v1.1 From 03f6734f4367b08e2b181ed68bc80b885e76148f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 7 Sep 2011 09:42:18 -0700 Subject: First set of merge fixes --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 63 +++++++++------------- 1 file changed, 26 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 893faf8..6988718 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -852,7 +852,7 @@ namespace OpenSim.Region.Framework.Scenes set { - StoreUndoState(UndoType.STATE_PRIM_ROTATION); + StoreUndoState(); m_rotationOffset = value; PhysicsActor actor = PhysActor; @@ -3590,7 +3590,8 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.ScheduleGroupForTerseUpdate(); //m_parentGroup.ScheduleGroupForFullUpdate(); } - public void StoreUndoState(UndoType type) + + public void StoreUndoState() { StoreUndoState(false); } @@ -3613,57 +3614,45 @@ namespace OpenSim.Region.Framework.Scenes // TODO: May need to fix for group comparison if (last.Compare(this)) { - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", - // Name, LocalId, m_undo.Count); - + // m_log.DebugFormat( + // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", + // Name, LocalId, m_undo.Count); + return; } } } - - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", - // Name, LocalId, forGroup, m_undo.Count); - + + // m_log.DebugFormat( + // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", + // Name, LocalId, forGroup, m_undo.Count); + if (m_parentGroup.GetSceneMaxUndo() > 0) { UndoState nUndo = new UndoState(this, forGroup); - - UndoState nUndo = new UndoState(this, type); - if (lastUndo != null) - { - TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); - if (ts.TotalMilliseconds < 500) - { - //Delete the last entry since it was less than 500 milliseconds ago - nUndo.Merge(lastUndo); - m_undo.Pop(); - } - } m_undo.Push(nUndo); - + if (m_redo.Count > 0) m_redo.Clear(); - - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", - // Name, LocalId, forGroup, m_undo.Count); + + // m_log.DebugFormat( + // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", + // Name, LocalId, forGroup, m_undo.Count); } } } } -// else -// { -// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); -// } + // else + // { + // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); + // } } -// else -// { -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); -// } + // else + // { + // m_log.DebugFormat( + // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); + // } } /// -- cgit v1.1 From cda4cd6b551156ed503a5f284ad6c5a9a0e1c5a5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 14 Sep 2011 18:46:42 -0700 Subject: Merge fixes, and fix the build --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6988718..0c3b404 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -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) -- cgit v1.1 From 2a8a46a32d49fa6629ae3c35365456e0625e3ba5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Dec 2011 18:32:40 +0100 Subject: Fix CHANGED_TEXTURE and CHANGED_COLOR. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 79 +++++++++++----------- 1 file changed, 40 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 11040b7..c88e1d7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3231,7 +3231,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetFaceColor(Vector3 color, int face) { - Primitive.TextureEntry tex = Shape.Textures; + // The only way to get a deep copy/ If we don't do this, we can + // mever detect color changes further down. + Byte[] buf = Shape.Textures.GetBytes(); + Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); Color4 texcolor; if (face >= 0 && face < GetNumberOfSides()) { @@ -3240,8 +3243,7 @@ namespace OpenSim.Region.Framework.Scenes texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.FaceTextures[face].RGBA = texcolor; - UpdateTexture(tex); - TriggerScriptChangedEvent(Changed.COLOR); + UpdateTextureEntry(tex.GetBytes()); return; } else if (face == ALL_SIDES) @@ -3262,8 +3264,7 @@ namespace OpenSim.Region.Framework.Scenes texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.DefaultTexture.RGBA = texcolor; } - UpdateTexture(tex); - TriggerScriptChangedEvent(Changed.COLOR); + UpdateTextureEntry(tex.GetBytes()); return; } } @@ -4585,46 +4586,46 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Update the textures on the part. - /// - /// - /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() - /// not handling RGBA properly. Cycles through, and "fixes" the color - /// info - /// - /// - public void UpdateTexture(Primitive.TextureEntry tex) - { - //Color4 tmpcolor; - //for (uint i = 0; i < 32; i++) - //{ - // if (tex.FaceTextures[i] != null) - // { - // tmpcolor = tex.GetFace((uint) i).RGBA; - // tmpcolor.A = tmpcolor.A*255; - // tmpcolor.R = tmpcolor.R*255; - // tmpcolor.G = tmpcolor.G*255; - // tmpcolor.B = tmpcolor.B*255; - // tex.FaceTextures[i].RGBA = tmpcolor; - // } - //} - //tmpcolor = tex.DefaultTexture.RGBA; - //tmpcolor.A = tmpcolor.A*255; - //tmpcolor.R = tmpcolor.R*255; - //tmpcolor.G = tmpcolor.G*255; - //tmpcolor.B = tmpcolor.B*255; - //tex.DefaultTexture.RGBA = tmpcolor; - UpdateTextureEntry(tex.GetBytes()); - } - - /// /// Update the texture entry for this part. /// /// public void UpdateTextureEntry(byte[] textureEntry) { + Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length); + Primitive.TextureEntry oldTex = Shape.Textures; + + Changed changeFlags = 0; + + for (int i = 0 ; i < GetNumberOfSides(); i++) + { + Primitive.TextureEntryFace newFace = newTex.DefaultTexture; + Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture; + + if (oldTex.FaceTextures[i] != null) + oldFace = oldTex.FaceTextures[i]; + if (newTex.FaceTextures[i] != null) + newFace = newTex.FaceTextures[i]; + + Color4 oldRGBA = oldFace.RGBA; + Color4 newRGBA = newFace.RGBA; + + if (oldRGBA.R != newRGBA.R || + oldRGBA.G != newRGBA.G || + oldRGBA.B != newRGBA.B || + oldRGBA.A != newRGBA.A) + changeFlags |= Changed.COLOR; + + if (oldFace.TextureID != newFace.TextureID) + changeFlags |= Changed.TEXTURE; + + // Max change, skip the rest of testing + if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) + break; + } + m_shape.TextureEntry = textureEntry; - TriggerScriptChangedEvent(Changed.TEXTURE); + if (changeFlags != 0) + TriggerScriptChangedEvent(changeFlags); UpdateFlag = UpdateRequired.FULL; ParentGroup.HasGroupChanged = true; -- cgit v1.1 From 6362df1202aa1b44dc576128bcd6afd597046792 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Dec 2011 19:33:25 +0100 Subject: Serialize the Volume Detect field --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dbf29d0..3bce3c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -220,8 +220,7 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 RotationAxis = Vector3.One; - public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this - // Certainly this must be a persistant setting finally + public bool VolumeDetectActive; public bool IsWaitingForFirstSpinUpdatePacket; -- cgit v1.1 From 5490a3e549c2c1753bf562cef53ad70250731081 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 6 Dec 2011 19:44:45 +0100 Subject: Fix phantom and temp flags not taking --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3bce3c0..0e48515 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4307,6 +4307,9 @@ namespace OpenSim.Region.Framework.Scenes bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); bool wasVD = VolumeDetectActive; +// m_log.DebugFormat("[SOP]: Old states: phys: {0} temp: {1} phan: {2} vd: {3}", wasUsingPhysics, wasTemporary, wasPhantom, wasVD); +// m_log.DebugFormat("[SOP]: New states: phys: {0} temp: {1} phan: {2} vd: {3}", UsePhysics, SetTemporary, SetPhantom, SetVD); + if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) return; @@ -4336,6 +4339,11 @@ namespace OpenSim.Region.Framework.Scenes SetPhantom = false; } } + else if (wasVD) + { + // Correspondingly, if VD is turned off, also turn off phantom + SetPhantom = false; + } if (UsePhysics && IsJoint()) { -- cgit v1.1 From 00b36eb0fedc8de0d3a3ce9461828970fbd50fd8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 9 Dec 2011 20:55:48 +0100 Subject: Restore the Avination way of position and angle calculation so resizers work again. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0e48515..428fe1c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -682,7 +682,7 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; - if (actor != null && ParentID == 0) + if (ParentID == 0) { if (actor != null) m_groupPosition = actor.Position; @@ -1080,10 +1080,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentGroup.IsAttachment) - return GroupPosition; - - return m_offsetPosition + m_groupPosition; + return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); } } -- cgit v1.1 From 045f3b8b110780953953b0b5187be69ea75b7c65 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 5 Jan 2012 07:37:31 +0100 Subject: Clean up GetWorldPosition --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fa8b1c0..c45cfb8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2015,13 +2015,9 @@ namespace OpenSim.Region.Framework.Scenes axPos *= parentRot; Vector3 translationOffsetPosition = axPos; if(_parentID == 0) - { - return GroupPosition; - } - else - { - return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position - } + return GroupPosition; + else + return ParentGroup.AbsolutePosition + translationOffsetPosition; } /// -- cgit v1.1 From 4cbf8d728e3bc4286463ef0e7cb611b10f594321 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 14 Jan 2012 05:39:56 +0100 Subject: Fix merge --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c9a8832..b232855 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2747,11 +2747,6 @@ namespace OpenSim.Region.Framework.Scenes public void RotLookAt(Quaternion target, float strength, float damping) { - m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. - } - - public void rotLookAt(Quaternion target, float strength, float damping) - { if (ParentGroup.IsAttachment) { /* -- cgit v1.1 From 6cc9aa30ac40ecb62870d8ecf566680a1a83d630 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 8 Feb 2012 15:45:44 +0000 Subject: first change in SOP. in AddPrimShape(..) give physics the world rotation and not local offset. Currently physics interface only knows about world frame --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ac39b6b..1696dc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1539,7 +1539,8 @@ namespace OpenSim.Region.Framework.Scenes Shape, AbsolutePosition, Scale, - RotationOffset, +// RotationOffset, + GetWorldRotation(), // physics wants world rotation RigidBody, m_localId); } @@ -4366,7 +4367,8 @@ namespace OpenSim.Region.Framework.Scenes Shape, AbsolutePosition, Scale, - RotationOffset, +// RotationOffset, + GetWorldRotation(), //physics wants world rotation like all other functions send UsePhysics, m_localId); -- cgit v1.1 From 6af01f6767838235091b9e34cdaea05951d68f68 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 8 Feb 2012 23:14:53 +0000 Subject: initial introdution of physics actor building control. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1696dc5..577c0d3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1503,7 +1503,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) +// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) + public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building) { if (!ParentGroup.Scene.CollidablePrims) return; @@ -1557,6 +1558,8 @@ namespace OpenSim.Region.Framework.Scenes PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + if (!building) + PhysActor.Building = false; } } } @@ -1792,6 +1795,10 @@ namespace OpenSim.Region.Framework.Scenes if (!isNew) ParentGroup.Scene.RemovePhysicalPrim(1); + Velocity = new Vector3(0, 0, 0); + Acceleration = new Vector3(0, 0, 0); + AngularVelocity = new Vector3(0, 0, 0); + PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; PhysActor.delink(); @@ -4268,7 +4275,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) +// public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) + public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building) { bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); @@ -4286,6 +4294,9 @@ namespace OpenSim.Region.Framework.Scenes // that... // ... if VD is changed, all others are not. // ... if one of the others is changed, VD is not. + // do this first + if (building && PhysActor != null && PhysActor.Building != building) + PhysActor.Building = building; if (SetVD) // VD is active, special logic applies { // State machine logic for VolumeDetect @@ -4448,6 +4459,9 @@ namespace OpenSim.Region.Framework.Scenes } // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); + // and last in case we have a new actor and not building + if (PhysActor != null && PhysActor.Building != building) + PhysActor.Building = building; if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; -- cgit v1.1 From f6f0d884bda8b5179d04a9cfe15efa3908552bcc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 15 Feb 2012 17:08:33 +0000 Subject: try to make crossings work better. chode no longer prevents crossings i hope --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ac39b6b..f9e61be 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2612,9 +2612,9 @@ namespace OpenSim.Region.Framework.Scenes Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) { ParentGroup.AbsolutePosition = newpos; return; -- cgit v1.1 From a758abaa9fa7250d1b61bcd906ca12539307851d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 15 Feb 2012 17:08:33 +0000 Subject: try to make crossings work better. chode no longer prevents crossings i hope --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 577c0d3..19dedde 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2620,9 +2620,9 @@ namespace OpenSim.Region.Framework.Scenes Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) - | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) + || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) { ParentGroup.AbsolutePosition = newpos; return; -- cgit v1.1 From 5351ff925c20c0fd189ee7de85c31521aca8cdf3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 18 Feb 2012 14:08:42 +0000 Subject: let SOG know about vehicles. Still needs serialization and applyphyscis on deserialize, etc --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 42 ++++++++++------------ 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 19dedde..6438694 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3170,34 +3170,37 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleType(int type) { - if (PhysActor != null) - { - PhysActor.VehicleType = type; - } + if (ParentGroup.IsDeleted) + return; + ParentGroup.VehicleType = type; + } + + public void SetVehicleFlags(int param, bool remove) + { + if (ParentGroup.IsDeleted) + return; + ParentGroup.SetVehicleFlags(param, remove); } public void SetVehicleFloatParam(int param, float value) { - if (PhysActor != null) - { - PhysActor.VehicleFloatParam(param, value); - } + if (ParentGroup.IsDeleted) + return; + ParentGroup.SetVehicleFloatParam(param, value); } public void SetVehicleVectorParam(int param, Vector3 value) { - if (PhysActor != null) - { - PhysActor.VehicleVectorParam(param, value); - } + if (ParentGroup.IsDeleted) + return; + ParentGroup.SetVehicleVectorParam(param, value); } public void SetVehicleRotationParam(int param, Quaternion rotation) { - if (PhysActor != null) - { - PhysActor.VehicleRotationParam(param, rotation); - } + if (ParentGroup.IsDeleted) + return; + ParentGroup.SetVehicleRotationParam(param, rotation); } /// @@ -3381,13 +3384,6 @@ namespace OpenSim.Region.Framework.Scenes hasProfileCut = hasDimple; // is it the same thing? } - public void SetVehicleFlags(int param, bool remove) - { - if (PhysActor != null) - { - PhysActor.VehicleFlags(param, remove); - } - } public void SetGroup(UUID groupID, IClientAPI client) { -- cgit v1.1 From b77d354e6dcf1eb31486f0db3236780f63f23844 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 19 Feb 2012 13:21:01 +0000 Subject: moved vehicle from SOG to SOP --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 87 +++++++++++++++++++--- 1 file changed, 76 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6438694..eb59ffd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -310,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes private UUID m_collisionSound; private float m_collisionSoundVolume; + + private SOPVehicle m_vehicle = null; + #endregion Fields // ~SceneObjectPart() @@ -1556,8 +1559,14 @@ namespace OpenSim.Region.Framework.Scenes { PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info PhysActor.SetMaterial(Material); + + // if root part apply vehicle + if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) + m_vehicle.SetVehicle(PhysActor); + DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + if (!building) PhysActor.Building = false; } @@ -3168,39 +3177,90 @@ namespace OpenSim.Region.Framework.Scenes } } + + public int VehicleType + { + get + { + if (m_vehicle == null) + return (int)Vehicle.TYPE_NONE; + else + return (int)m_vehicle.Type; + } + set + { + SetVehicleType(value); + } + } + public void SetVehicleType(int type) { - if (ParentGroup.IsDeleted) - return; - ParentGroup.VehicleType = type; + m_vehicle = null; + if (type == (int)Vehicle.TYPE_NONE) + { + if (_parentID ==0 && PhysActor != null) + PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; + return; + } + m_vehicle = new SOPVehicle(); + m_vehicle.ProcessTypeChange((Vehicle)type); + { + if (_parentID ==0 && PhysActor != null) + PhysActor.VehicleType = type; + return; + } } public void SetVehicleFlags(int param, bool remove) { - if (ParentGroup.IsDeleted) + if (m_vehicle == null) return; - ParentGroup.SetVehicleFlags(param, remove); + + m_vehicle.ProcessVehicleFlags(param, remove); + + if (_parentID ==0 && PhysActor != null) + { + PhysActor.VehicleFlags(param, remove); + } } public void SetVehicleFloatParam(int param, float value) { - if (ParentGroup.IsDeleted) + if (m_vehicle == null) return; - ParentGroup.SetVehicleFloatParam(param, value); + + m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); + + if (_parentID == 0 && PhysActor != null) + { + PhysActor.VehicleFloatParam(param, value); + } } public void SetVehicleVectorParam(int param, Vector3 value) { - if (ParentGroup.IsDeleted) + if (m_vehicle == null) return; - ParentGroup.SetVehicleVectorParam(param, value); + + m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); + + if (_parentID == 0 && PhysActor != null) + { + PhysActor.VehicleVectorParam(param, value); + } } public void SetVehicleRotationParam(int param, Quaternion rotation) { - if (ParentGroup.IsDeleted) + if (m_vehicle == null) return; - ParentGroup.SetVehicleRotationParam(param, rotation); + + m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); + + if (_parentID == 0 && PhysActor != null) + { + PhysActor.VehicleRotationParam(param, rotation); + } } /// @@ -4380,6 +4440,11 @@ namespace OpenSim.Region.Framework.Scenes m_localId); PhysActor.SetMaterial(Material); + + // if root part apply vehicle + if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) + m_vehicle.SetVehicle(PhysActor); + DoPhysicsPropertyUpdate(UsePhysics, true); if (!ParentGroup.IsDeleted) -- cgit v1.1 From 60d68ee3122a974007adec6e651fad461d8abda4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 19 Feb 2012 18:10:00 +0000 Subject: Vehicle XML serialization more complete. Inactived by coments in SceneObjectSerializar.cs until proper testing --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index eb59ffd..4cd5183 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3177,6 +3177,18 @@ namespace OpenSim.Region.Framework.Scenes } } + public SOPVehicle sopVehicle + { + get + { + return m_vehicle; + } + set + { + m_vehicle = value; + } + } + public int VehicleType { @@ -3196,6 +3208,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleType(int type) { m_vehicle = null; + if (type == (int)Vehicle.TYPE_NONE) { if (_parentID ==0 && PhysActor != null) -- cgit v1.1 From d6b8febbf44e5aed73153129a4fa55c3fb10eee2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 20 Feb 2012 19:49:01 +0100 Subject: Make vehicles retain velocity when crossing between regions. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 613f9b5..d32b20a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1539,6 +1539,7 @@ namespace OpenSim.Region.Framework.Scenes // or flexible if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) { + Vector3 velocity = Velocity; try { PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( @@ -1570,6 +1571,9 @@ namespace OpenSim.Region.Framework.Scenes DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + Velocity = velocity; + PhysActor.Velocity = velocity; + if (!building) PhysActor.Building = false; } -- cgit v1.1 From 0e4d5a4d3ce54530f39d513146b066a55769d231 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Feb 2012 10:10:04 +0100 Subject: Also preserve angular velocity on crossing. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d32b20a..dd9431b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1540,6 +1540,7 @@ namespace OpenSim.Region.Framework.Scenes if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) { Vector3 velocity = Velocity; + Vector3 rotationalVelocity = AngularVelocity; try { PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( @@ -1572,7 +1573,9 @@ namespace OpenSim.Region.Framework.Scenes PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); Velocity = velocity; + AngularVelocity = rotationalVelocity; PhysActor.Velocity = velocity; + PhysActor.RotationalVelocity = rotationalVelocity; if (!building) PhysActor.Building = false; -- cgit v1.1 From e07440d0c53fdc8e90f4887242e3b21049a729c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 25 Feb 2012 22:20:25 +0000 Subject: changed SOP Force and Torque, adding XML (de/)serialization, also changed Buoyance. PLEASE trap deserialization from inventory etc, making force and torque vector3.Zero, unless we want then to rez moving. (needs checking/testing as usual) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 93 +++++++++++++++++++--- 1 file changed, 81 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd9431b..f35a27e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -294,6 +294,8 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastAngularVelocity; protected int m_lastTerseSent; protected float m_buoyancy = 0.0f; + protected Vector3 m_force; + protected Vector3 m_torque; /// /// Stores media texture data @@ -1302,14 +1304,66 @@ namespace OpenSim.Region.Framework.Scenes public float Buoyancy { - get { return m_buoyancy; } + get + { + if (ParentID != 0 && ParentGroup != null) + m_buoyancy = ParentGroup.RootPart.Buoyancy; + return m_buoyancy; + } set { m_buoyancy = value; - if (PhysActor != null) + if (ParentID != 0) { + if (ParentGroup != null) + ParentGroup.RootPart.Buoyancy = value; + } + else if (PhysActor != null) PhysActor.Buoyancy = value; + } + } + + public Vector3 Force + { + get + { + if (ParentID != 0 && ParentGroup != null) + m_force = ParentGroup.RootPart.Force; + return m_force; + } + + set + { + m_force = value; + if (ParentID != 0) + { + if (ParentGroup != null) + ParentGroup.RootPart.Force = value; } + else if (PhysActor != null) + PhysActor.Force = value; + } + } + + public Vector3 Torque + { + get + { + if (ParentID != 0 && ParentGroup != null) + m_torque = ParentGroup.RootPart.Torque; + return m_torque; + } + + set + { + m_torque = value; + if (ParentID != 0) + { + if (ParentGroup != null) + ParentGroup.RootPart.Torque = value; + } + else if (PhysActor != null) + PhysActor.Torque = value; } } @@ -1488,20 +1542,24 @@ namespace OpenSim.Region.Framework.Scenes /// /// Vector force /// true for the local frame, false for the global frame - public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) + + // this is actualy Set Torque.. keeping naming so not to edit lslapi also + public void SetAngularImpulse(Vector3 torquei, bool localGlobalTF) { - Vector3 impulse = impulsei; + Vector3 torque = torquei; if (localGlobalTF) { +/* Quaternion grot = GetWorldRotation(); Quaternion AXgrot = grot; Vector3 AXimpulsei = impulsei; Vector3 newimpulse = AXimpulsei * AXgrot; - impulse = newimpulse; + */ + torque *= GetWorldRotation(); } - ParentGroup.setAngularImpulse(impulse); + Torque = torque; } /// @@ -1571,14 +1629,22 @@ namespace OpenSim.Region.Framework.Scenes DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + + if (!building) + PhysActor.Building = false; Velocity = velocity; AngularVelocity = rotationalVelocity; PhysActor.Velocity = velocity; PhysActor.RotationalVelocity = rotationalVelocity; - if (!building) - PhysActor.Building = false; + // if not vehicle and root part apply force and torque + if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) + && LocalId == ParentGroup.RootPart.LocalId) + { + PhysActor.Force = Force; + PhysActor.Torque = Torque; + } } } } @@ -2002,10 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 GetForce() { - if (PhysActor != null) - return PhysActor.Force; - else - return Vector3.Zero; + return Force; } /// @@ -3150,10 +3213,13 @@ namespace OpenSim.Region.Framework.Scenes public void SetBuoyancy(float fvalue) { + Buoyancy = fvalue; +/* if (PhysActor != null) { PhysActor.Buoyancy = fvalue; } + */ } public void SetDieAtEdge(bool p) @@ -3181,10 +3247,13 @@ namespace OpenSim.Region.Framework.Scenes public void SetForce(Vector3 force) { + Force = force; +/* if (PhysActor != null) { PhysActor.Force = force; } + */ } public SOPVehicle sopVehicle -- cgit v1.1 From c82709c0d6c72852d8614651f9cb31df09fff883 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 02:36:34 +0100 Subject: Implement llSetKeyframedMotion. No persistence, no region crossing. Yet. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd9431b..b6d5c4b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1855,6 +1855,9 @@ namespace OpenSim.Region.Framework.Scenes { if (UsePhysics) { + if (ParentGroup.KeyframeMotion != null) + ParentGroup.KeyframeMotion.Stop(); + ParentGroup.KeyframeMotion = null; ParentGroup.Scene.AddPhysicalPrim(1); PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; -- cgit v1.1 From 9a15bba99bad2861813660c1c1da236d154809e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 13:22:17 +0100 Subject: Fix an infinite recursion caused by checking the wrong values for Buoyancy, Force and Torque --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 825f2a3..3ab7e5a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1306,19 +1306,20 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_buoyancy = ParentGroup.RootPart.Buoyancy; - return m_buoyancy; + if (ParentGroup.RootPart == this) + return m_buoyancy; + + return ParentGroup.RootPart.Buoyancy; } set { - m_buoyancy = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Buoyancy = value; + ParentGroup.RootPart.Buoyancy = value; + return; } - else if (PhysActor != null) + m_buoyancy = value; + if (PhysActor != null) PhysActor.Buoyancy = value; } } @@ -1327,20 +1328,21 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_force = ParentGroup.RootPart.Force; - return m_force; + if (ParentGroup.RootPart == this) + return m_force; + + return ParentGroup.RootPart.Force; } set { - m_force = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Force = value; + ParentGroup.RootPart.Force = value; + return; } - else if (PhysActor != null) + m_force = value; + if (PhysActor != null) PhysActor.Force = value; } } @@ -1349,20 +1351,21 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_torque = ParentGroup.RootPart.Torque; - return m_torque; + if (ParentGroup.RootPart == this) + return m_torque; + + return ParentGroup.RootPart.Torque; } set { - m_torque = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Torque = value; + ParentGroup.RootPart.Torque = value; + return; } - else if (PhysActor != null) + m_torque = value; + if (PhysActor != null) PhysActor.Torque = value; } } -- cgit v1.1 From 8cdc115c91bd074539c5fbae719313d4dc616355 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 14:30:24 +0100 Subject: Fix deserialization of Buoyancy, Force and Torque. Remove debug from the new code. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ab7e5a..0728042 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1313,7 +1313,7 @@ namespace OpenSim.Region.Framework.Scenes } set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Buoyancy = value; return; @@ -1336,7 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Force = value; return; @@ -1359,7 +1359,7 @@ namespace OpenSim.Region.Framework.Scenes set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Torque = value; return; -- cgit v1.1 From fca8c82232a42191270cb8d18dba6b54d382a2c2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 18:11:38 +0100 Subject: Move KeyframeMotion from SOG to SOP because we can't persist it any other way because SOG doesn't technically exist in the DB --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0728042..ea3d716 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -315,6 +315,14 @@ namespace OpenSim.Region.Framework.Scenes private SOPVehicle m_vehicle = null; + private KeyframeMotion m_keyframeMotion = null; + + public KeyframeMotion KeyframeMotion + { + get; set; + } + + #endregion Fields // ~SceneObjectPart() @@ -1924,9 +1932,9 @@ namespace OpenSim.Region.Framework.Scenes { if (UsePhysics) { - if (ParentGroup.KeyframeMotion != null) - ParentGroup.KeyframeMotion.Stop(); - ParentGroup.KeyframeMotion = null; + if (ParentGroup.RootPart.KeyframeMotion != null) + ParentGroup.RootPart.KeyframeMotion.Stop(); + ParentGroup.RootPart.KeyframeMotion = null; ParentGroup.Scene.AddPhysicalPrim(1); PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; -- cgit v1.1 From aee4ca2f1cfa2aaee88ebbf72513d6a06cefeb65 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 27 Feb 2012 08:50:19 +0100 Subject: Fix vehicles going physical stopping llTargetOmega parts (boat radar) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ea3d716..1c72b10 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -916,7 +916,7 @@ namespace OpenSim.Region.Framework.Scenes get { PhysicsActor actor = PhysActor; - if ((actor != null) && actor.IsPhysical) + if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this) { m_angularVelocity = actor.RotationalVelocity; } @@ -1893,7 +1893,8 @@ namespace OpenSim.Region.Framework.Scenes Velocity = new Vector3(0, 0, 0); Acceleration = new Vector3(0, 0, 0); - AngularVelocity = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; @@ -1917,7 +1918,8 @@ namespace OpenSim.Region.Framework.Scenes // velocity-vector. Velocity = new Vector3(0, 0, 0); Acceleration = new Vector3(0, 0, 0); - AngularVelocity = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); //RotationalVelocity = new Vector3(0, 0, 0); } -- cgit v1.1 From cca94aaefc36fad366e789d6d2e902dda078e3f7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 6 Mar 2012 05:13:39 +0000 Subject: make copied parts have diferent LocalIds than original. More building control for ubitODE. for all let physics know about linking of physical parts. Assume UNTESTED --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1c72b10..b132a19 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1727,8 +1727,6 @@ namespace OpenSim.Region.Framework.Scenes // Move afterwards ResetIDs as it clears the localID dupe.LocalId = localID; - if(dupe.PhysActor != null) - dupe.PhysActor.LocalID = localID; // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe.LastOwnerID = OwnerID; @@ -1749,6 +1747,9 @@ namespace OpenSim.Region.Framework.Scenes dupe.DoPhysicsPropertyUpdate(UsePhysics, true); } + if (dupe.PhysActor != null) + dupe.PhysActor.LocalID = localID; + ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); -- cgit v1.1 From 17b1454d6f3b45618b1007c85fe97242284aff3c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 6 Mar 2012 20:20:12 +0100 Subject: Null PhysActor on SOP.Copy() to prevent clobbering the original one --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b132a19..9c06786 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1691,10 +1691,9 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) dupe.UUID = UUID.Random(); - //memberwiseclone means it also clones the physics actor reference - // This will make physical prim 'bounce' if not set to null. - if (!userExposed) - dupe.PhysActor = null; + // The PhysActor cannot be valid on a copy because the copy is not in the scene yet. + // Null it, the caller has to create a new one once the object is added to a scene + dupe.PhysActor = null; dupe.OwnerID = AgentID; dupe.GroupID = GroupID; -- cgit v1.1 From 3d3b81e67698cc361a9eca28083f5f526ff1de2e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 7 Mar 2012 07:31:26 +0000 Subject: changes on undo/redo (untested/incomplete). Think we may consider moving this mfrom SOP to client side. At least does seem to work a bit better ( again there wwas a issue on sop.copy ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 72 ++++++++-------------- 1 file changed, 27 insertions(+), 45 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9c06786..8dd2c76 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -263,8 +263,8 @@ namespace OpenSim.Region.Framework.Scenes private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; - private readonly Stack m_undo = new Stack(5); - private readonly Stack m_redo = new Stack(5); + private Stack m_undo = new Stack(5); + private Stack m_redo = new Stack(5); private bool m_passTouches; @@ -1711,6 +1711,11 @@ namespace OpenSim.Region.Framework.Scenes dupe.Category = Category; dupe.m_rezzed = m_rezzed; + dupe.m_undo = new Stack(5); + dupe.m_redo = new Stack(5); + dupe.IgnoreUndoUpdate = false; + dupe.Undoing = false; + dupe.m_inventory = new SceneObjectPartInventory(dupe); dupe.m_inventory.Items = (TaskInventoryDictionary)m_inventory.Items.Clone(); @@ -3661,61 +3666,38 @@ namespace OpenSim.Region.Framework.Scenes public void StoreUndoState(bool forGroup) { - if (!Undoing) + if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended { - if (!IgnoreUndoUpdate) + if (ParentGroup != null) { - if (ParentGroup != null) + lock (m_undo) { - lock (m_undo) + if (m_undo.Count > 0) { - if (m_undo.Count > 0) - { - UndoState last = m_undo.Peek(); - if (last != null) - { - // TODO: May need to fix for group comparison - if (last.Compare(this)) - { - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", - // Name, LocalId, m_undo.Count); + // see if we had a change - return; - } + UndoState last = m_undo.Peek(); + if (last != null) + { + if (last.Compare(this, forGroup)) + { + return; } } - - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", - // Name, LocalId, forGroup, m_undo.Count); - - if (ParentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this, forGroup); + } - m_undo.Push(nUndo); + if (ParentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this, forGroup); - if (m_redo.Count > 0) - m_redo.Clear(); + m_undo.Push(nUndo); - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", - // Name, LocalId, forGroup, m_undo.Count); - } + if (m_redo.Count > 0) + m_redo.Clear(); } } } - // else - // { - // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); - // } } - // else - // { - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); - // } } /// @@ -3751,7 +3733,7 @@ namespace OpenSim.Region.Framework.Scenes nUndo = new UndoState(this, goback.ForGroup); } - goback.PlaybackState(this); + goback.PlayState(this); if (nUndo != null) m_redo.Push(nUndo); @@ -3785,7 +3767,7 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); } - gofwd.PlayfwdState(this); + gofwd.PlayState(this); } // m_log.DebugFormat( -- cgit v1.1 From 05cdf9bda910ced0da29474b8b40a58e8a423d69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Mar 2012 01:53:58 +0000 Subject: more changes in undo/redo. Basicly moved control to llclientview.cs. later we can move back to a dispatcher function on SOG that handles the several cases( in a viwer independent way (?)) and calls current exec funtions. made cosmetic changes replacing decimals by hexs so bits are easier to read. Changed behavour of case 12 and 28 ( 0x0c and 0x1c) to make identical to 0x0d and 0x1d ( scale only and scale plus position). DOn't see 12 and 28 in use... cases 1c and 1d still broken --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8dd2c76..4ba04c1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -828,7 +828,7 @@ namespace OpenSim.Region.Framework.Scenes set { - StoreUndoState(); +// StoreUndoState(); m_rotationOffset = value; PhysicsActor actor = PhysActor; @@ -1007,7 +1007,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_shape != null) { - StoreUndoState(); +// StoreUndoState(); m_shape.Scale = value; -- cgit v1.1 From 908abb1c3dded307e769abac71f660b835875975 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Mar 2012 20:32:19 +0000 Subject: BIG MESS. changed Iclient interface so only one event is used to inform scene about position scale or rotation change by client (others can be added). Its served at SceneGraph that does permition checks, undostore and sends down to SOG. changed values are stored in a class (ObjectChangeData) and what is changed as a enum (ObjectChangeWhat) with bit fields and 'macros' of this for better readability (at top of scenegraph.cs lasy to find better place for now) this can be extended for other things clients changes and need undo/redo. SOG process acording to what is changed. Changed UNDO/redo to use this also (warning is only storing what is changed, previus stored all, this must be checked for side efects. to save all PRS change commented line in scenegraph). Still have excessive calls to ScheduleGroupForTerseUpdate. **** UNTESTED **** --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 47 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6622495..c806fda 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1944,6 +1944,7 @@ namespace OpenSim.Region.Framework.Scenes PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + if (ParentID != 0 && ParentID != LocalId) { if (ParentGroup.RootPart.PhysActor != null) @@ -3656,7 +3657,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.ScheduleGroupForTerseUpdate(); //ParentGroup.ScheduleGroupForFullUpdate(); } - +/* public void StoreUndoState() { StoreUndoState(false); @@ -3697,6 +3698,44 @@ namespace OpenSim.Region.Framework.Scenes } } } +*/ + + + public void StoreUndoState(ObjectChangeWhat what) + { + if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended + { + if (ParentGroup != null) + { + lock (m_undo) + { + if (m_undo.Count > 0) + { + // see if we had a change + + UndoState last = m_undo.Peek(); + if (last != null) + { + if (last.Compare(this, what)) + { + return; + } + } + } + + if (ParentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this, what); + + m_undo.Push(nUndo); + + if (m_redo.Count > 0) + m_redo.Clear(); + } + } + } + } + } /// /// Return number of undos on the stack. Here temporarily pending a refactor. @@ -3725,10 +3764,10 @@ namespace OpenSim.Region.Framework.Scenes if (goback != null) { UndoState nUndo = null; - + if (ParentGroup.GetSceneMaxUndo() > 0) { - nUndo = new UndoState(this, goback.ForGroup); + nUndo = new UndoState(this, goback.data.what); } goback.PlayState(this); @@ -3760,7 +3799,7 @@ namespace OpenSim.Region.Framework.Scenes { if (ParentGroup.GetSceneMaxUndo() > 0) { - UndoState nUndo = new UndoState(this, gofwd.ForGroup); + UndoState nUndo = new UndoState(this, gofwd.data.what); m_undo.Push(nUndo); } -- cgit v1.1 From ab235abc46e3d902a7aaf61e589b81f826a2d7a5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Mar 2012 00:36:34 +0000 Subject: Changed undo redo internals. moved exec code to UndoState.cs from sop that now only sees a unified UndoRedoStore class, added size limit on buffers so only last 5 undo/redo are kept. (5 is hardcode like it was ) ***UNTESTED*** --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 155 +++------------------ 1 file changed, 22 insertions(+), 133 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c806fda..f70b259 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -263,8 +263,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; - private Stack m_undo = new Stack(5); - private Stack m_redo = new Stack(5); + private UndoRedoState m_UndoRedo = new UndoRedoState(5); private bool m_passTouches; @@ -1709,8 +1708,8 @@ namespace OpenSim.Region.Framework.Scenes dupe.Category = Category; dupe.m_rezzed = m_rezzed; - dupe.m_undo = new Stack(5); - dupe.m_redo = new Stack(5); + dupe.m_UndoRedo = new UndoRedoState(5); + dupe.IgnoreUndoUpdate = false; dupe.Undoing = false; @@ -3657,82 +3656,14 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.ScheduleGroupForTerseUpdate(); //ParentGroup.ScheduleGroupForFullUpdate(); } -/* - public void StoreUndoState() - { - StoreUndoState(false); - } - - public void StoreUndoState(bool forGroup) - { - if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended - { - if (ParentGroup != null) - { - lock (m_undo) - { - if (m_undo.Count > 0) - { - // see if we had a change - - UndoState last = m_undo.Peek(); - if (last != null) - { - if (last.Compare(this, forGroup)) - { - return; - } - } - } - - if (ParentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this, forGroup); - - m_undo.Push(nUndo); - - if (m_redo.Count > 0) - m_redo.Clear(); - } - } - } - } - } -*/ - public void StoreUndoState(ObjectChangeWhat what) { - if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended + lock (m_UndoRedo) { - if (ParentGroup != null) + if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended { - lock (m_undo) - { - if (m_undo.Count > 0) - { - // see if we had a change - - UndoState last = m_undo.Peek(); - if (last != null) - { - if (last.Compare(this, what)) - { - return; - } - } - } - - if (ParentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this, what); - - m_undo.Push(nUndo); - - if (m_redo.Count > 0) - m_redo.Clear(); - } - } + m_UndoRedo.StoreUndo(this, what); } } } @@ -3744,84 +3675,42 @@ namespace OpenSim.Region.Framework.Scenes { get { - lock (m_undo) - return m_undo.Count; + lock (m_UndoRedo) + return m_UndoRedo.Count; } } public void Undo() { - lock (m_undo) + lock (m_UndoRedo) { -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", -// Name, LocalId, m_undo.Count); - - if (m_undo.Count > 0) - { - UndoState goback = m_undo.Pop(); - - if (goback != null) - { - UndoState nUndo = null; - - if (ParentGroup.GetSceneMaxUndo() > 0) - { - nUndo = new UndoState(this, goback.data.what); - } - - goback.PlayState(this); - - if (nUndo != null) - m_redo.Push(nUndo); - } - } + if (Undoing || ParentGroup == null) + return; -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}", -// Name, LocalId, m_undo.Count); + Undoing = true; + m_UndoRedo.Undo(this); + Undoing = false; } } public void Redo() { - lock (m_undo) + lock (m_UndoRedo) { -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", -// Name, LocalId, m_redo.Count); - - if (m_redo.Count > 0) - { - UndoState gofwd = m_redo.Pop(); - - if (gofwd != null) - { - if (ParentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this, gofwd.data.what); - - m_undo.Push(nUndo); - } - - gofwd.PlayState(this); - } + if (Undoing || ParentGroup == null) + return; -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", -// Name, LocalId, m_redo.Count); - } + Undoing = true; + m_UndoRedo.Redo(this); + Undoing = false; } } public void ClearUndoState() { -// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId); - - lock (m_undo) + lock (m_UndoRedo) { - m_undo.Clear(); - m_redo.Clear(); + m_UndoRedo.Clear(); } } -- cgit v1.1 From 7832889437c801836aef50edee43862bc6b290b6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Mar 2012 11:01:38 +0000 Subject: Physical phantoms testable with chOde. Volume detection was changed and also needs testing. Started making it more independent of phantom acording to new sl. ** 99.999...% UNTESTED *** --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 283 +++++++++++---------- 1 file changed, 145 insertions(+), 138 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f70b259..a17862e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1577,16 +1577,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// -// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) + public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building) { if (!ParentGroup.Scene.CollidablePrims) return; -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", -// Name, LocalId, UUID, m_physicalPrim); - bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; @@ -1597,15 +1593,16 @@ namespace OpenSim.Region.Framework.Scenes else { // Special case for VolumeDetection: If VolumeDetection is set, the phantom flag is locally ignored - if (VolumeDetectActive) - isPhantom = false; +// if (VolumeDetectActive) +// isPhantom = false; // Added clarification.. since A rigid body is an object that you can kick around, etc. - bool RigidBody = isPhysical && !isPhantom; +// 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 // or flexible - if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + // if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + if ((!isPhantom || isPhysical || VolumeDetectActive) && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) { Vector3 velocity = Velocity; Vector3 rotationalVelocity = AngularVelocity; @@ -1616,9 +1613,9 @@ namespace OpenSim.Region.Framework.Scenes Shape, AbsolutePosition, Scale, -// RotationOffset, - GetWorldRotation(), // physics wants world rotation - RigidBody, + GetWorldRotation(), + isPhysical, + isPhantom, m_localId); } catch @@ -1637,8 +1634,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) m_vehicle.SetVehicle(PhysActor); - DoPhysicsPropertyUpdate(RigidBody, true); - PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + DoPhysicsPropertyUpdate(isPhysical, true); + if(VolumeDetectActive) // change if not the default only + PhysActor.SetVolumeDetect(1); if (!building) PhysActor.Building = false; @@ -1888,73 +1886,62 @@ namespace OpenSim.Region.Framework.Scenes { if (UsePhysics != PhysActor.IsPhysical || isNew) { - if (PhysActor.IsPhysical) // implies UsePhysics==false for this block + if (PhysActor.IsPhysical) { - if (!isNew) + if (!isNew) // implies UsePhysics==false for this block + { ParentGroup.Scene.RemovePhysicalPrim(1); - Velocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); - if (ParentGroup.RootPart == this) - AngularVelocity = new Vector3(0, 0, 0); + Velocity = new Vector3(0, 0, 0); + Acceleration = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); - PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; - PhysActor.delink(); + if (PhysActor.Phantom) + { + RemoveFromPhysics(); + return; + } - if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) - { - // destroy all joints connected to this now deactivated body - ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); + PhysActor.IsPhysical = UsePhysics; + PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; + PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; + PhysActor.delink(); + if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) + { + // destroy all joints connected to this now deactivated body + ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); + } } - - // stop client-side interpolation of all joint proxy objects that have just been deleted - // this is done because RemoveAllJointsConnectedToActor invokes the OnJointDeactivated callback, - // which stops client-side interpolation of deactivated joint proxy objects. - } - - if (!UsePhysics && !isNew) - { - // reset velocity to 0 on physics switch-off. Without that, the client thinks the - // prim still has velocity and continues to interpolate its position along the old - // velocity-vector. - Velocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); - if (ParentGroup.RootPart == this) - AngularVelocity = new Vector3(0, 0, 0); - //RotationalVelocity = new Vector3(0, 0, 0); } - PhysActor.IsPhysical = UsePhysics; - - // If we're not what we're supposed to be in the physics scene, recreate ourselves. - //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); - /// that's not wholesome. Had to make Scene public - //PhysActor = null; + if (PhysActor.IsPhysical != UsePhysics) + PhysActor.IsPhysical = UsePhysics; - if ((Flags & PrimFlags.Phantom) == 0) + if (UsePhysics) { - if (UsePhysics) - { - if (ParentGroup.RootPart.KeyframeMotion != null) - ParentGroup.RootPart.KeyframeMotion.Stop(); - ParentGroup.RootPart.KeyframeMotion = null; - ParentGroup.Scene.AddPhysicalPrim(1); + if (ParentGroup.RootPart.KeyframeMotion != null) + ParentGroup.RootPart.KeyframeMotion.Stop(); + ParentGroup.RootPart.KeyframeMotion = null; + ParentGroup.Scene.AddPhysicalPrim(1); - PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; + PhysActor.OnOutOfBounds += PhysicsOutOfBounds; - if (ParentID != 0 && ParentID != LocalId) + if (ParentID != 0 && ParentID != LocalId) + { + if (ParentGroup.RootPart.PhysActor != null) { - if (ParentGroup.RootPart.PhysActor != null) - { - PhysActor.link(ParentGroup.RootPart.PhysActor); - } + PhysActor.link(ParentGroup.RootPart.PhysActor); } } - } + } } + bool phan = ((Flags & PrimFlags.Phantom) != 0); + if (PhysActor.Phantom != phan) + PhysActor.Phantom = phan; + // If this part is a sculpt then delay the physics update until we've asynchronously loaded the // mesh data. if (Shape.SculptEntry) @@ -4355,40 +4342,45 @@ namespace OpenSim.Region.Framework.Scenes bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); bool wasVD = VolumeDetectActive; -// m_log.DebugFormat("[SOP]: Old states: phys: {0} temp: {1} phan: {2} vd: {3}", wasUsingPhysics, wasTemporary, wasPhantom, wasVD); -// m_log.DebugFormat("[SOP]: New states: phys: {0} temp: {1} phan: {2} vd: {3}", UsePhysics, SetTemporary, SetPhantom, SetVD); - if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) return; + // do this first + if (building && PhysActor != null && PhysActor.Building != building) + PhysActor.Building = building; + // Special cases for VD. VD can only be called from a script // and can't be combined with changes to other states. So we can rely // that... // ... if VD is changed, all others are not. // ... if one of the others is changed, VD is not. - // do this first - if (building && PhysActor != null && PhysActor.Building != building) - PhysActor.Building = building; + if (SetVD) // VD is active, special logic applies - { - // State machine logic for VolumeDetect - // More logic below - bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom; - if (phanReset) // Phantom changes from on to off switch VD off too - { - SetVD = false; // Switch it of for the course of this routine - VolumeDetectActive = false; // and also permanently - if (PhysActor != null) - PhysActor.SetVolumeDetect(0); // Let physics know about it too - } - else - { - // If volumedetect is active we don't want phantom to be applied. - // If this is a new call to VD out of the state "phantom" - // this will also cause the prim to be visible to physics + /* volume detection is now independent of phantom in sl + + { + // State machine logic for VolumeDetect + // More logic below + + + bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom; + + if (phanReset) // Phantom changes from on to off switch VD off too + { + SetVD = false; // Switch it of for the course of this routine + VolumeDetectActive = false; // and also permanently + if (PhysActor != null) + PhysActor.SetVolumeDetect(0); // Let physics know about it too + } + else + { + // If volumedetect is active we don't want phantom to be applied. + // If this is a new call to VD out of the state "phantom" + // this will also cause the prim to be visible to physics + */ SetPhantom = false; - } +/* } } else if (wasVD) { @@ -4400,10 +4392,11 @@ namespace OpenSim.Region.Framework.Scenes { SetPhantom = true; } - +*/ if (UsePhysics) { AddFlag(PrimFlags.Physics); +/* if (!wasUsingPhysics) { DoPhysicsPropertyUpdate(UsePhysics, false); @@ -4416,84 +4409,99 @@ namespace OpenSim.Region.Framework.Scenes } } } + */ } else { RemFlag(PrimFlags.Physics); +/* if (wasUsingPhysics) { DoPhysicsPropertyUpdate(UsePhysics, false); } - } +*/ + } - if (SetPhantom - || ParentGroup.IsAttachment + if (SetPhantom) + AddFlag(PrimFlags.Phantom); + else + RemFlag(PrimFlags.Phantom); + + if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints { AddFlag(PrimFlags.Phantom); + Velocity = new Vector3(0, 0, 0); + Acceleration = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); + if (PhysActor != null) + { + ParentGroup.Scene.RemovePhysicalPrim(1); RemoveFromPhysics(); + } } - else // Not phantom + else { - RemFlag(PrimFlags.Phantom); - if (ParentGroup.Scene == null) return; - if (ParentGroup.Scene.CollidablePrims && PhysActor == null) + if (ParentGroup.Scene.CollidablePrims) { - // It's not phantom anymore. So make sure the physics engine get's knowledge of it - PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( - string.Format("{0}/{1}", Name, UUID), - Shape, - AbsolutePosition, - Scale, -// RotationOffset, - GetWorldRotation(), //physics wants world rotation like all other functions send - UsePhysics, - m_localId); + if (PhysActor == null) + { + PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( + string.Format("{0}/{1}", Name, UUID), + Shape, + AbsolutePosition, + Scale, + GetWorldRotation(), //physics wants world rotation like all other functions send + UsePhysics, + SetPhantom, + m_localId); - PhysActor.SetMaterial(Material); + PhysActor.SetMaterial(Material); + + // if root part apply vehicle + if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) + m_vehicle.SetVehicle(PhysActor); - // if root part apply vehicle - if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) - m_vehicle.SetVehicle(PhysActor); + DoPhysicsPropertyUpdate(UsePhysics, true); - DoPhysicsPropertyUpdate(UsePhysics, true); + if (!ParentGroup.IsDeleted) + { + if (LocalId == ParentGroup.RootPart.LocalId) + { + ParentGroup.CheckSculptAndLoad(); + } + } - if (!ParentGroup.IsDeleted) - { - if (LocalId == ParentGroup.RootPart.LocalId) + 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) + ) { - ParentGroup.CheckSculptAndLoad(); + PhysActor.OnCollisionUpdate += PhysicsCollision; + PhysActor.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) - ) + else // it already has a physical representation { - PhysActor.OnCollisionUpdate += PhysicsCollision; - PhysActor.SubscribeEvents(1000); - } - } - else // it already has a physical representation - { - DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim + DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. - if (!ParentGroup.IsDeleted) - { - if (LocalId == ParentGroup.RootPart.LocalId) + if (!ParentGroup.IsDeleted) { - ParentGroup.CheckSculptAndLoad(); + if (LocalId == ParentGroup.RootPart.LocalId) + { + ParentGroup.CheckSculptAndLoad(); + } } } } @@ -4509,7 +4517,7 @@ namespace OpenSim.Region.Framework.Scenes if (this.PhysActor != null) { PhysActor.SetVolumeDetect(1); - AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active +// AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active this.VolumeDetectActive = true; } } @@ -4517,8 +4525,7 @@ namespace OpenSim.Region.Framework.Scenes { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like // (mumbles, well, at least if you have infinte CPU powers :-)) - PhysicsActor pa = this.PhysActor; - if (pa != null) + if (this.PhysActor != null) { PhysActor.SetVolumeDetect(0); } -- cgit v1.1 From a35e00e81eba1d3b0990c9c8139d77d34d6cbb7e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 12 Mar 2012 07:50:14 +0000 Subject: allocate UndoRedoStore only on demand --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a17862e..94e4560 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -263,7 +263,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; - private UndoRedoState m_UndoRedo = new UndoRedoState(5); + private UndoRedoState m_UndoRedo = null; private bool m_passTouches; @@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.Category = Category; dupe.m_rezzed = m_rezzed; - dupe.m_UndoRedo = new UndoRedoState(5); + dupe.m_UndoRedo = null; dupe.IgnoreUndoUpdate = false; dupe.Undoing = false; @@ -3646,6 +3646,9 @@ namespace OpenSim.Region.Framework.Scenes public void StoreUndoState(ObjectChangeWhat what) { + if (m_UndoRedo == null) + m_UndoRedo = new UndoRedoState(5); + lock (m_UndoRedo) { if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended @@ -3662,18 +3665,19 @@ namespace OpenSim.Region.Framework.Scenes { get { - lock (m_UndoRedo) - return m_UndoRedo.Count; + if (m_UndoRedo == null) + return 0; + return m_UndoRedo.Count; } } public void Undo() { + if (m_UndoRedo == null || Undoing || ParentGroup == null) + return; + lock (m_UndoRedo) { - if (Undoing || ParentGroup == null) - return; - Undoing = true; m_UndoRedo.Undo(this); Undoing = false; @@ -3682,11 +3686,11 @@ namespace OpenSim.Region.Framework.Scenes public void Redo() { + if (m_UndoRedo == null || Undoing || ParentGroup == null) + return; + lock (m_UndoRedo) { - if (Undoing || ParentGroup == null) - return; - Undoing = true; m_UndoRedo.Redo(this); Undoing = false; @@ -3695,6 +3699,9 @@ namespace OpenSim.Region.Framework.Scenes public void ClearUndoState() { + if (m_UndoRedo == null || Undoing) + return; + lock (m_UndoRedo) { m_UndoRedo.Clear(); -- cgit v1.1 From ebcd4910a21726c830796cfe14c0792007b766b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 13:08:32 +0100 Subject: Refactor, move OjectChangeData into it's own file and rename ObjectChnageWhat what into ObjectChangeType change. What is no name for a variable or type! --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 94e4560..f647544 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3644,7 +3644,7 @@ namespace OpenSim.Region.Framework.Scenes //ParentGroup.ScheduleGroupForFullUpdate(); } - public void StoreUndoState(ObjectChangeWhat what) + public void StoreUndoState(ObjectChangeType change) { if (m_UndoRedo == null) m_UndoRedo = new UndoRedoState(5); @@ -3653,7 +3653,7 @@ namespace OpenSim.Region.Framework.Scenes { if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended { - m_UndoRedo.StoreUndo(this, what); + m_UndoRedo.StoreUndo(this, change); } } } -- cgit v1.1 From 3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Mar 2012 17:56:32 +0000 Subject: initial suport for ExtraPhysical parts parameters. Reading from llclientView to SOP including SOPserialization (not to databases). No action on physics still. No send to viewer, etc --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 114 ++++++++++++++++++--- 1 file changed, 100 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f647544..ace53f6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -295,7 +295,13 @@ namespace OpenSim.Region.Framework.Scenes protected float m_buoyancy = 0.0f; protected Vector3 m_force; protected Vector3 m_torque; - + + protected byte m_physicsShapeType = (byte)PhysShapeType.prim; + protected float m_density = 1000.0f; // in kg/m^3 + protected float m_gravitymod = 1.0f; + protected float m_friction = 0.6f; // wood + protected float m_bounce = 0.5f; // wood + /// /// Stores media texture data /// @@ -556,19 +562,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public byte Material - { - get { return (byte) m_material; } - set - { - m_material = (Material)value; - if (PhysActor != null) - { - PhysActor.SetMaterial((int)value); - } - } - } - public bool PassTouches { get { return m_passTouches; } @@ -1377,6 +1370,87 @@ namespace OpenSim.Region.Framework.Scenes } } + public byte Material + { + get { return (byte)m_material; } + set + { + if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) + { + m_material = (Material)value; + m_friction = SOPMaterialData.friction(m_material); + m_bounce = SOPMaterialData.bounce(m_material); + if (PhysActor != null) + { + PhysActor.SetMaterial((int)value); + } + } + } + } + + public byte PhysicsShapeType + { + get { return m_physicsShapeType; } + set + { + if (value < 0 || value >= (byte)PhysShapeType.convex) + value = (byte)PhysShapeType.prim; //convex not supported ? + + else if (value == (byte)PhysShapeType.none) + { + if (ParentGroup == null || ParentGroup.RootPart == this) + value = (byte)PhysShapeType.prim; + } + m_physicsShapeType = value; + } + } + + public float Density // in kg/m^3 + { + get { return m_density; } + set + { + if (value >=1 && value <= 22587.0) + { + m_density = value; + } + } + } + + public float GravityModifier + { + get { return m_gravitymod; } + set + { if( value >= -1 && value <=28.0f) + m_gravitymod = value; + } + } + + public float Friction + { + get { return m_friction; } + set + { + if (value >= 0 && value <= 255.0f) + { + m_friction = value; + } + } + } + + public float Bounciness + { + get { return m_bounce; } + set + { + if (value >= 0 && value <= 1.0f) + { + m_bounce = value; + } + } + } + + #endregion Public Properties with only Get private uint ApplyMask(uint val, bool set, uint mask) @@ -4334,6 +4408,18 @@ namespace OpenSim.Region.Framework.Scenes } } + + public void UpdateExtraPhysics(ExtraPhysicsData physdata) + { + if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) + return; + + PhysicsShapeType = (byte)physdata.PhysShapeType; + Density = physdata.Density; + GravityModifier = physdata.GravitationModifier; + Friction = physdata.Friction; + Bounciness = physdata.Bounce; + } /// /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. /// -- cgit v1.1 From 741badc4fa1da61d86fdbb2d33056fa8c6599e69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Mar 2012 19:24:41 +0000 Subject: let PhysicsShapeType none remove physics remove physics on child parts **UnTested** --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 48 +++++++++++++++++----- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ace53f6..a68b3eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1657,9 +1657,13 @@ namespace OpenSim.Region.Framework.Scenes if (!ParentGroup.Scene.CollidablePrims) return; + if (PhysicsShapeType == (byte)PhysShapeType.none) + return; + bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; + if (IsJoint()) { DoPhysicsPropertyUpdate(isPhysical, true); @@ -2016,6 +2020,7 @@ namespace OpenSim.Region.Framework.Scenes if (PhysActor.Phantom != phan) PhysActor.Phantom = phan; + // If this part is a sculpt then delay the physics update until we've asynchronously loaded the // mesh data. if (Shape.SculptEntry) @@ -4414,11 +4419,34 @@ namespace OpenSim.Region.Framework.Scenes if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) return; - PhysicsShapeType = (byte)physdata.PhysShapeType; - Density = physdata.Density; - GravityModifier = physdata.GravitationModifier; - Friction = physdata.Friction; - Bounciness = physdata.Bounce; + if (PhysicsShapeType != (byte)physdata.PhysShapeType) + { + PhysicsShapeType = (byte)physdata.PhysShapeType; + + if (PhysicsShapeType == (byte)PhysShapeType.none) + { + if (PhysActor != null) + { + Velocity = new Vector3(0, 0, 0); + Acceleration = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); + ParentGroup.Scene.RemovePhysicalPrim(1); + RemoveFromPhysics(); + } + } + else if (PhysActor == null) + ApplyPhysics((uint)Flags, VolumeDetectActive, false); + } + + if(Density != physdata.Density) + Density = physdata.Density; + if(GravityModifier != physdata.GravitationModifier) + GravityModifier = physdata.GravitationModifier; + if(Friction != physdata.Friction) + Friction = physdata.Friction; + if(Bounciness != physdata.Bounce) + Bounciness = physdata.Bounce; } /// /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. @@ -4448,9 +4476,10 @@ namespace OpenSim.Region.Framework.Scenes // ... if VD is changed, all others are not. // ... if one of the others is changed, VD is not. +/* if (SetVD) // VD is active, special logic applies - /* volume detection is now independent of phantom in sl + volume detection is now independent of phantom in sl { // State machine logic for VolumeDetect @@ -4471,9 +4500,8 @@ namespace OpenSim.Region.Framework.Scenes // If volumedetect is active we don't want phantom to be applied. // If this is a new call to VD out of the state "phantom" // this will also cause the prim to be visible to physics - */ SetPhantom = false; -/* } + } } else if (wasVD) { @@ -4520,10 +4548,10 @@ namespace OpenSim.Region.Framework.Scenes else RemFlag(PrimFlags.Phantom); - if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment + if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints { - AddFlag(PrimFlags.Phantom); +// AddFlag(PrimFlags.Phantom); Velocity = new Vector3(0, 0, 0); Acceleration = new Vector3(0, 0, 0); -- cgit v1.1 From cf9ebd301c32fa7cd991e78647ce011b0aefc796 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Mar 2012 18:24:04 +0000 Subject: bug fixs, added a default physics shape estimator based on being a mesh or not and use it on unlink if new root part as type none. Viewer doesn't get updated even with fullupdates we are missing something still --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 84 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a68b3eb..84ed40c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -986,7 +986,11 @@ namespace OpenSim.Region.Framework.Scenes public PrimitiveBaseShape Shape { get { return m_shape; } - set { m_shape = value;} + set + { + m_shape = value; + m_physicsShapeType = DefaultPhysicsShapeType(); + } } /// @@ -1377,31 +1381,68 @@ namespace OpenSim.Region.Framework.Scenes { if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) { - m_material = (Material)value; - m_friction = SOPMaterialData.friction(m_material); - m_bounce = SOPMaterialData.bounce(m_material); - if (PhysActor != null) + bool update = false; + + if (m_material != (Material)value) + { + update = true; + m_material = (Material)value; + } + + if (m_friction != SOPMaterialData.friction(m_material)) + { + update = true; + m_friction = SOPMaterialData.friction(m_material); + } + + if (m_bounce != SOPMaterialData.bounce(m_material)) { - PhysActor.SetMaterial((int)value); + update = true; + m_bounce = SOPMaterialData.bounce(m_material); + } + + if (update) + { + if (PhysActor != null) + { + PhysActor.SetMaterial((int)value); + } + if(ParentGroup != null) + ParentGroup.HasGroupChanged = true; + ScheduleFullUpdateIfNone(); } } } } + // not a propriety to move to methods place later + public byte DefaultPhysicsShapeType() + { + byte type; + + if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh)) + type = (byte)PhysShapeType.convex; + else + type = (byte)PhysShapeType.prim; + + return type; + } + public byte PhysicsShapeType { get { return m_physicsShapeType; } set { - if (value < 0 || value >= (byte)PhysShapeType.convex) - value = (byte)PhysShapeType.prim; //convex not supported ? - - else if (value == (byte)PhysShapeType.none) + if (value >= 0 && value <= (byte)PhysShapeType.convex) { - if (ParentGroup == null || ParentGroup.RootPart == this) - value = (byte)PhysShapeType.prim; + if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) + m_physicsShapeType = DefaultPhysicsShapeType(); + else + m_physicsShapeType = value; + ScheduleFullUpdateIfNone(); } - m_physicsShapeType = value; + else + m_physicsShapeType = DefaultPhysicsShapeType(); } } @@ -1413,6 +1454,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >=1 && value <= 22587.0) { m_density = value; + ScheduleFullUpdateIfNone(); } } } @@ -1423,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes set { if( value >= -1 && value <=28.0f) m_gravitymod = value; + ScheduleFullUpdateIfNone(); } } @@ -1434,6 +1477,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 255.0f) { m_friction = value; + ScheduleFullUpdateIfNone(); } } } @@ -1446,6 +1490,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 1.0f) { m_bounce = value; + ScheduleFullUpdateIfNone(); } } } @@ -2942,6 +2987,19 @@ namespace OpenSim.Region.Framework.Scenes APIDTarget = Quaternion.Identity; } + + + public void ScheduleFullUpdateIfNone() + { + if (ParentGroup == null) + return; + +// ??? ParentGroup.HasGroupChanged = true; + + if (UpdateFlag != UpdateRequired.FULL) + ScheduleFullUpdate(); + } + /// /// Schedules this prim for a full update /// -- cgit v1.1 From 84ca09f7c5cec051014181853083e52691bb7e07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 02:24:13 +0000 Subject: added ObjectPhysicsProperties http event message to send viewer that data. For now on caps/EventQueue, and still only used on a material change... --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 84ed40c..f188e8d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4730,7 +4730,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); } - + // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } -- cgit v1.1 From ae8e089b9c73a6a675038759e3e3f9491819eb72 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Mar 2012 15:33:49 +0000 Subject: some more work on costs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f188e8d..fbe959a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1416,6 +1416,14 @@ namespace OpenSim.Region.Framework.Scenes } // not a propriety to move to methods place later + private bool HasMesh() + { + if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh)) + return true; + return false; + } + + // not a propriety to move to methods place later public byte DefaultPhysicsShapeType() { byte type; @@ -1428,6 +1436,60 @@ namespace OpenSim.Region.Framework.Scenes return type; } + [XmlIgnore] + public bool UsesComplexCost + { + get + { + byte pst = PhysicsShapeType; + if(pst == (byte) PhysShapeType.none || pst == (byte) PhysShapeType.convex || HasMesh()) + return true; + return false; + } + } + + [XmlIgnore] + public float PhysicsCost + { + get + { + if(PhysicsShapeType == (byte)PhysShapeType.none) + return 0; + + float cost = 0.1f; + if (PhysActor != null) +// cost += PhysActor.Cost; + + if ((Flags & PrimFlags.Physics) != 0) + cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3 + return cost; + } + } + + [XmlIgnore] + public float StreamingCost + { + get + { + + + return 0.1f; + } + } + + [XmlIgnore] + public float SimulationCost + { + get + { + // ignoring scripts. Don't like considering them for this + if((Flags & PrimFlags.Physics) != 0) + return 1.0f; + + return 0.5f; + } + } + public byte PhysicsShapeType { get { return m_physicsShapeType; } -- cgit v1.1 From f2d17433bbb942e6b97fe7879f910f8fd2d7a0d6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 20 Mar 2012 12:34:06 +0100 Subject: Cause prims to be saved if extra physics parameters are changed --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fbe959a..9914c78 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1505,6 +1505,7 @@ namespace OpenSim.Region.Framework.Scenes } else m_physicsShapeType = DefaultPhysicsShapeType(); + ParentGroup.HasGroupChanged = true; } } @@ -1518,6 +1519,7 @@ namespace OpenSim.Region.Framework.Scenes m_density = value; ScheduleFullUpdateIfNone(); } + ParentGroup.HasGroupChanged = true; } } @@ -1528,6 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes { if( value >= -1 && value <=28.0f) m_gravitymod = value; ScheduleFullUpdateIfNone(); + ParentGroup.HasGroupChanged = true; } } @@ -1541,6 +1544,7 @@ namespace OpenSim.Region.Framework.Scenes m_friction = value; ScheduleFullUpdateIfNone(); } + ParentGroup.HasGroupChanged = true; } } @@ -1554,6 +1558,7 @@ namespace OpenSim.Region.Framework.Scenes m_bounce = value; ScheduleFullUpdateIfNone(); } + ParentGroup.HasGroupChanged = true; } } -- cgit v1.1 From efd7ff31468755c7066c68fb6b5910f7b18aa3f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 20 Mar 2012 16:46:16 +0000 Subject: add some more notifications about changes on physical parameters ( still incomple and there should be a better away ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9914c78..0ffd114 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1030,6 +1030,7 @@ namespace OpenSim.Region.Framework.Scenes } public UpdateRequired UpdateFlag { get; set; } + public bool UpdatePhysRequired { get; set; } /// /// Used for media on a prim. @@ -1410,6 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes if(ParentGroup != null) ParentGroup.HasGroupChanged = true; ScheduleFullUpdateIfNone(); + UpdatePhysRequired = true; } } } @@ -1501,11 +1503,12 @@ namespace OpenSim.Region.Framework.Scenes m_physicsShapeType = DefaultPhysicsShapeType(); else m_physicsShapeType = value; - ScheduleFullUpdateIfNone(); } else m_physicsShapeType = DefaultPhysicsShapeType(); - ParentGroup.HasGroupChanged = true; + + if(m_physicsShapeType != value) + UpdatePhysRequired = true; } } @@ -1517,9 +1520,8 @@ namespace OpenSim.Region.Framework.Scenes if (value >=1 && value <= 22587.0) { m_density = value; - ScheduleFullUpdateIfNone(); + UpdatePhysRequired = true; } - ParentGroup.HasGroupChanged = true; } } @@ -1529,8 +1531,7 @@ namespace OpenSim.Region.Framework.Scenes set { if( value >= -1 && value <=28.0f) m_gravitymod = value; - ScheduleFullUpdateIfNone(); - ParentGroup.HasGroupChanged = true; + UpdatePhysRequired = true; } } @@ -1542,9 +1543,8 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 255.0f) { m_friction = value; - ScheduleFullUpdateIfNone(); + UpdatePhysRequired = true; } - ParentGroup.HasGroupChanged = true; } } @@ -1556,9 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 1.0f) { m_bounce = value; - ScheduleFullUpdateIfNone(); + UpdatePhysRequired = true; } - ParentGroup.HasGroupChanged = true; } } -- cgit v1.1 From 7f7801ecb9cff8c31eee732c18f540afc67c6d38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 20 Mar 2012 18:02:43 +0100 Subject: Cover the case where prims are loaded and ParentGroup is not yet set --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9914c78..84b4bb3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1505,7 +1505,8 @@ namespace OpenSim.Region.Framework.Scenes } else m_physicsShapeType = DefaultPhysicsShapeType(); - ParentGroup.HasGroupChanged = true; + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; } } @@ -1519,7 +1520,8 @@ namespace OpenSim.Region.Framework.Scenes m_density = value; ScheduleFullUpdateIfNone(); } - ParentGroup.HasGroupChanged = true; + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; } } @@ -1530,7 +1532,8 @@ namespace OpenSim.Region.Framework.Scenes { if( value >= -1 && value <=28.0f) m_gravitymod = value; ScheduleFullUpdateIfNone(); - ParentGroup.HasGroupChanged = true; + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; } } @@ -1544,7 +1547,8 @@ namespace OpenSim.Region.Framework.Scenes m_friction = value; ScheduleFullUpdateIfNone(); } - ParentGroup.HasGroupChanged = true; + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; } } @@ -1558,7 +1562,8 @@ namespace OpenSim.Region.Framework.Scenes m_bounce = value; ScheduleFullUpdateIfNone(); } - ParentGroup.HasGroupChanged = true; + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; } } -- cgit v1.1 From 11ed932263161d1dbea99d4a5699ba6d00894053 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 01:46:41 +0000 Subject: Tell physics about physics shape when creating. Added some virtual methods to get/set density,gravmod, frition,bounce and shape type ( not in use ). UbitOde now should do convex type on creation or everytime the mesh is changed ( as in change size, shape, etc ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 85d2bee..a494864 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1832,6 +1832,7 @@ namespace OpenSim.Region.Framework.Scenes GetWorldRotation(), isPhysical, isPhantom, + PhysicsShapeType, m_localId); } catch @@ -4732,6 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes GetWorldRotation(), //physics wants world rotation like all other functions send UsePhysics, SetPhantom, + PhysicsShapeType, m_localId); PhysActor.SetMaterial(Material); -- cgit v1.1 From f6cbafcaf0f33b37d076d654e35c20990eb205d8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 02:39:16 +0000 Subject: Changes of PrimShapeType should now work with UbitOde ( almost untested ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 43 +++++++++++++--------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a494864..51a3c18 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1497,6 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_physicsShapeType; } set { + byte oldv = m_physicsShapeType; if (value >= 0 && value <= (byte)PhysShapeType.convex) { if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) @@ -1507,11 +1508,33 @@ namespace OpenSim.Region.Framework.Scenes else m_physicsShapeType = DefaultPhysicsShapeType(); - if (ParentGroup != null) - ParentGroup.HasGroupChanged = true; - if(m_physicsShapeType != value) + if (m_physicsShapeType != oldv && ParentGroup != null) + { + if (m_physicsShapeType == (byte)PhysShapeType.none) + { + if (PhysActor != null) + { + Velocity = new Vector3(0, 0, 0); + Acceleration = new Vector3(0, 0, 0); + if (ParentGroup.RootPart == this) + AngularVelocity = new Vector3(0, 0, 0); + ParentGroup.Scene.RemovePhysicalPrim(1); + RemoveFromPhysics(); + } + } + else if (PhysActor == null) + ApplyPhysics((uint)Flags, VolumeDetectActive, false); + else + PhysActor.PhysicsShapeType = m_physicsShapeType; + } + if (m_physicsShapeType != value) + { + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; + UpdatePhysRequired = true; + } } } @@ -4575,20 +4598,6 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsShapeType = (byte)physdata.PhysShapeType; - if (PhysicsShapeType == (byte)PhysShapeType.none) - { - if (PhysActor != null) - { - Velocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); - if (ParentGroup.RootPart == this) - AngularVelocity = new Vector3(0, 0, 0); - ParentGroup.Scene.RemovePhysicalPrim(1); - RemoveFromPhysics(); - } - } - else if (PhysActor == null) - ApplyPhysics((uint)Flags, VolumeDetectActive, false); } if(Density != physdata.Density) -- cgit v1.1 From 68736aa460869717a24ec5d68053b7a1f540b853 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 15:27:33 +0000 Subject: fix a bad reset of shapetype on pbshape change, added missing checksculpload ( to reload mesh on change ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 51a3c18..cfa3cd4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -989,7 +989,6 @@ namespace OpenSim.Region.Framework.Scenes set { m_shape = value; - m_physicsShapeType = DefaultPhysicsShapeType(); } } @@ -1003,7 +1002,6 @@ namespace OpenSim.Region.Framework.Scenes { if (m_shape != null) { -// StoreUndoState(); m_shape.Scale = value; @@ -1498,6 +1496,7 @@ namespace OpenSim.Region.Framework.Scenes set { byte oldv = m_physicsShapeType; + if (value >= 0 && value <= (byte)PhysShapeType.convex) { if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) @@ -1508,7 +1507,6 @@ namespace OpenSim.Region.Framework.Scenes else m_physicsShapeType = DefaultPhysicsShapeType(); - if (m_physicsShapeType != oldv && ParentGroup != null) { if (m_physicsShapeType == (byte)PhysShapeType.none) @@ -1526,13 +1524,18 @@ namespace OpenSim.Region.Framework.Scenes else if (PhysActor == null) ApplyPhysics((uint)Flags, VolumeDetectActive, false); else - PhysActor.PhysicsShapeType = m_physicsShapeType; - } - if (m_physicsShapeType != value) - { + { + PhysActor.PhysicsShapeType = m_physicsShapeType; + if (Shape.SculptEntry) + CheckSculptAndLoad(); + } + if (ParentGroup != null) ParentGroup.HasGroupChanged = true; + } + if (m_physicsShapeType != value) + { UpdatePhysRequired = true; } } -- cgit v1.1 From 1c4bcf3fedbdb3c8143f364c43c939da810e896e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 3 Apr 2012 23:13:48 +0200 Subject: Fix merge artefacts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 83b0b18..9ba3e92 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1803,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes impulse = newimpulse; } - ParentGroup.applyAngularImpulse(impulse); + ParentGroup.setAngularImpulse(impulse); } /// -- cgit v1.1 From 7154d480b9fe1e2098ac536285f4c3f643e42f0c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 3 Apr 2012 23:18:07 +0200 Subject: Remove duplicate implementation of Material { get; set; } --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9ba3e92..5c28d89 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -571,20 +571,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public byte Material - { - get { return (byte) m_material; } - set - { - m_material = (Material)value; - - PhysicsActor pa = PhysActor; - - if (pa != null) - pa.SetMaterial((int)value); - } - } - public bool PassTouches { get { return m_passTouches; } -- cgit v1.1 From dbec5e98595cfe87d26ef74703433db7956ab66d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 3 Apr 2012 23:22:47 +0200 Subject: Fix more merge artefacts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c28d89..9cd438c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4837,11 +4837,11 @@ namespace OpenSim.Region.Framework.Scenes { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like // (mumbles, well, at least if you have infinte CPU powers :-)) - if (this.PhysActor != null) + if (pa != null) { PhysActor.SetVolumeDetect(0); - - this.VolumeDetectActive = false; + this.VolumeDetectActive = false; + } } if (SetTemporary) -- cgit v1.1 From 726915e9ef369a5b4cb7089ec9301c5c927dd862 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 3 Apr 2012 23:38:12 +0200 Subject: Fix the last merge artefacts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9cd438c..aed25a7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4819,6 +4819,7 @@ namespace OpenSim.Region.Framework.Scenes } } + PhysicsActor pa = PhysActor; if (SetVD) { // If the above logic worked (this is urgent candidate to unit tests!) @@ -4828,7 +4829,7 @@ namespace OpenSim.Region.Framework.Scenes // logic should make sure, this Physactor is always here. if (pa != null) { - PhysActor.SetVolumeDetect(1); + pa.SetVolumeDetect(1); // AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active this.VolumeDetectActive = true; } @@ -4839,7 +4840,7 @@ namespace OpenSim.Region.Framework.Scenes // (mumbles, well, at least if you have infinte CPU powers :-)) if (pa != null) { - PhysActor.SetVolumeDetect(0); + pa.SetVolumeDetect(0); this.VolumeDetectActive = false; } } @@ -4856,8 +4857,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // and last in case we have a new actor and not building - if (PhysActor != null && PhysActor.Building != building) - PhysActor.Building = building; + if (pa != null && pa.Building != building) + pa.Building = building; if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; -- cgit v1.1 From 787cc0d076f0a56cf48dbef4475ec991da00adf0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Apr 2012 16:38:29 +0100 Subject: reverted changes to llApplyRotationalImpulse execution in SOP/SOG. This functions naming is misleading, Here Apply means to apply a instante impulse that may add to previus unprocessed ones and not setting a permanente torque (that is done by llSetTorque). --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index aed25a7..f091a91 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1789,7 +1789,7 @@ namespace OpenSim.Region.Framework.Scenes impulse = newimpulse; } - ParentGroup.setAngularImpulse(impulse); + ParentGroup.ApplyAngularImpulse(impulse); } /// -- cgit v1.1 From 867d50d14c1ad0ae1e885e163dfc4f2e9afc6749 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Apr 2012 17:01:29 +0100 Subject: remove more merge artefacts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f091a91..83021b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2186,18 +2186,11 @@ namespace OpenSim.Region.Framework.Scenes if (ParentID != 0 && ParentID != LocalId) { - ParentGroup.Scene.AddPhysicalPrim(1); + PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; - pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; - pa.OnOutOfBounds += PhysicsOutOfBounds; - if (ParentID != 0 && ParentID != LocalId) + if (parentPa != null) { - PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; - - if (parentPa != null) - { - pa.link(parentPa); - } + pa.link(parentPa); } } } -- cgit v1.1 From 016079ef2775d66ea85d9c62c5aef93ae2162821 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Apr 2012 18:24:56 +0100 Subject: minor changes.. a few physicsactor -> pa and a use a constant with |'ed bit fields in place of 6 individual checks ||'ed --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 83021b0..951e987 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2153,26 +2153,26 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup.RootPart == this) AngularVelocity = new Vector3(0, 0, 0); - if (PhysActor.Phantom) + if (pa.Phantom) { RemoveFromPhysics(); return; } - PhysActor.IsPhysical = UsePhysics; - PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; - PhysActor.delink(); + pa.IsPhysical = UsePhysics; + pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds -= PhysicsOutOfBounds; + pa.delink(); if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) { // destroy all joints connected to this now deactivated body - ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); + ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa); } } } - if (PhysActor.IsPhysical != UsePhysics) - PhysActor.IsPhysical = UsePhysics; + if (pa.IsPhysical != UsePhysics) + pa.IsPhysical = UsePhysics; if (UsePhysics) { @@ -2197,8 +2197,8 @@ namespace OpenSim.Region.Framework.Scenes } bool phan = ((Flags & PrimFlags.Phantom) != 0); - if (PhysActor.Phantom != phan) - PhysActor.Phantom = phan; + if (pa.Phantom != phan) + pa.Phantom = phan; // If this part is a sculpt then delay the physics update until we've asynchronously loaded the @@ -2320,7 +2320,10 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = PhysActor; if (pa != null) - return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); + { + Vector3 vtmp = pa.CenterOfMass; + return vtmp; + } else return new Vector3(0, 0, 0); } @@ -3524,18 +3527,12 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = PhysActor; if (pa != null) - pa.FloatOnWater = floatYN == 1; + pa.FloatOnWater = (floatYN == 1); } public void SetForce(Vector3 force) { Force = force; -/* - if (PhysActor != null) - { - PhysActor.Force = force; - } - */ } public SOPVehicle sopVehicle @@ -5066,33 +5063,32 @@ namespace OpenSim.Region.Framework.Scenes } PhysicsActor pa = PhysActor; - - 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) - ) + if (pa != null) { - // subscribe to physics updates. - if (pa != null) + const scriptEvents NeededSubsEvents = ( + scriptEvents.collision | scriptEvents.collision_start| scriptEvents.collision_end | + scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end + ); + 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) || + ((AggregateScriptEvents & NeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ) { + // subscribe to physics updates. pa.OnCollisionUpdate += PhysicsCollision; pa.SubscribeEvents(1000); } - } - else - { - if (pa != null) + else { pa.UnSubscribeEvents(); pa.OnCollisionUpdate -= PhysicsCollision; } } - //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) //{ // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; -- cgit v1.1 From ad544bdd3d37700af7c8d05bafaed7cdd3dd3cd6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 9 Apr 2012 18:03:37 +0100 Subject: sop.AddToPhysics(..) fixed and in use. For now it seems it needs to set sop.PhysActor, so made it return void. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 410 ++++++++------------- 1 file changed, 147 insertions(+), 263 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 969ddaf..d419710 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -122,6 +122,11 @@ namespace OpenSim.Region.Framework.Scenes /// Denote all sides of the prim /// public const int ALL_SIDES = -1; + + private const scriptEvents PhyscicsNeededSubsEvents = ( + scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end | + scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end + ); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -1821,18 +1826,20 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// + /// - public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building) + public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building) { + VolumeDetectActive = _VolumeDetectActive; //?? as is used this is redundante + if (!ParentGroup.Scene.CollidablePrims) return; if (PhysicsShapeType == (byte)PhysShapeType.none) return; - bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; - bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; - + bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0; + bool isPhantom = (_ObjectFlags & (uint) PrimFlags.Phantom) != 0; if (IsJoint()) { @@ -1840,68 +1847,11 @@ namespace OpenSim.Region.Framework.Scenes } else { - // Special case for VolumeDetection: If VolumeDetection is set, the phantom flag is locally ignored -// if (VolumeDetectActive) -// isPhantom = false; - - // 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 - // if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) - if ((!isPhantom || isPhysical || VolumeDetectActive) && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) - { - Vector3 velocity = Velocity; - Vector3 rotationalVelocity = AngularVelocity; - try - { - PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( - string.Format("{0}/{1}", Name, UUID), - Shape, - AbsolutePosition, - Scale, - GetWorldRotation(), - isPhysical, - isPhantom, - PhysicsShapeType, - m_localId); - } - catch - { - m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); - PhysActor = null; - } - - PhysicsActor pa = PhysActor; - - if (pa != null) - { - pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info - pa.SetMaterial(Material); - - // if root part apply vehicle - if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) - m_vehicle.SetVehicle(pa); - - DoPhysicsPropertyUpdate(isPhysical, true); - if(VolumeDetectActive) // change if not the default only - pa.SetVolumeDetect(1); - - if (!building) - pa.Building = false; - - Velocity = velocity; - AngularVelocity = rotationalVelocity; - pa.Velocity = velocity; - pa.RotationalVelocity = rotationalVelocity; - - // if not vehicle and root part apply force and torque - if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) - && LocalId == ParentGroup.RootPart.LocalId) - { - pa.Force = Force; - pa.Torque = Torque; - } - } - } + if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment + && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + AddToPhysics(isPhysical, isPhantom, building, true); + else + PhysActor = null; // just to be sure } } @@ -4628,7 +4578,6 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// -// public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building) { bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); @@ -4639,209 +4588,92 @@ namespace OpenSim.Region.Framework.Scenes if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) return; - // do this first - if (building && PhysActor != null && PhysActor.Building != building) - PhysActor.Building = building; - - // Special cases for VD. VD can only be called from a script - // and can't be combined with changes to other states. So we can rely - // that... - // ... if VD is changed, all others are not. - // ... if one of the others is changed, VD is not. - -/* - if (SetVD) // VD is active, special logic applies - - volume detection is now independent of phantom in sl - - { - // State machine logic for VolumeDetect - // More logic below - - - bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom; - - if (phanReset) // Phantom changes from on to off switch VD off too - { - SetVD = false; // Switch it of for the course of this routine - VolumeDetectActive = false; // and also permanently - if (PhysActor != null) - PhysActor.SetVolumeDetect(0); // Let physics know about it too - } - else - { - // If volumedetect is active we don't want phantom to be applied. - // If this is a new call to VD out of the state "phantom" - // this will also cause the prim to be visible to physics - SetPhantom = false; - } - } - else if (wasVD) - { - // Correspondingly, if VD is turned off, also turn off phantom - SetPhantom = false; - } - - if (UsePhysics && IsJoint()) - { - SetPhantom = true; - } -*/ if (UsePhysics) - { AddFlag(PrimFlags.Physics); -/* - if (!wasUsingPhysics) - { - DoPhysicsPropertyUpdate(UsePhysics, false); - - if (!ParentGroup.IsDeleted) - { - if (LocalId == ParentGroup.RootPart.LocalId) - { - ParentGroup.CheckSculptAndLoad(); - } - } - } - */ - } else - { RemFlag(PrimFlags.Physics); -/* - if (wasUsingPhysics) - { - DoPhysicsPropertyUpdate(UsePhysics, false); - } -*/ - } if (SetPhantom) AddFlag(PrimFlags.Phantom); else RemFlag(PrimFlags.Phantom); + if (SetTemporary) + AddFlag(PrimFlags.TemporaryOnRez); + else + RemFlag(PrimFlags.TemporaryOnRez); + + VolumeDetectActive = SetVD; + + if (ParentGroup.Scene == null) + return; + + PhysicsActor pa = PhysActor; + + if (pa != null && building && pa.Building != building) + pa.Building = building; + if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none - || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints + || (Shape.PathCurve == (byte)Extrusion.Flexible)) { -// AddFlag(PrimFlags.Phantom); + if (pa != null) + { + ParentGroup.Scene.RemovePhysicalPrim(1); + RemoveFromPhysics(); + } Velocity = new Vector3(0, 0, 0); Acceleration = new Vector3(0, 0, 0); if (ParentGroup.RootPart == this) AngularVelocity = new Vector3(0, 0, 0); - - if (PhysActor != null) - { - ParentGroup.Scene.RemovePhysicalPrim(1); - RemoveFromPhysics(); - } } else { - if (ParentGroup.Scene == null) - return; - if (ParentGroup.Scene.CollidablePrims) { - if (PhysActor == null) + if (pa == null) { - PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( - string.Format("{0}/{1}", Name, UUID), - Shape, - AbsolutePosition, - Scale, - GetWorldRotation(), //physics wants world rotation like all other functions send - UsePhysics, - SetPhantom, - PhysicsShapeType, - m_localId); - - PhysActor.SetMaterial(Material); - - // if root part apply vehicle - if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) - m_vehicle.SetVehicle(PhysActor); - - DoPhysicsPropertyUpdate(UsePhysics, true); - - if (!ParentGroup.IsDeleted) + AddToPhysics(UsePhysics, SetPhantom, building , false); + pa = PhysActor; + + if (pa != null) { - if (LocalId == ParentGroup.RootPart.LocalId) + 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) || + ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) +// (CollisionSound != UUID.Zero) + ) { - ParentGroup.CheckSculptAndLoad(); + 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 { DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. - if (!ParentGroup.IsDeleted) - { - if (LocalId == ParentGroup.RootPart.LocalId) - { - ParentGroup.CheckSculptAndLoad(); - } - } - } - } - } + if(VolumeDetectActive) + pa.SetVolumeDetect(1); + else + pa.SetVolumeDetect(0); - PhysicsActor pa = PhysActor; - if (SetVD) - { - // If the above logic worked (this is urgent candidate to unit tests!) - // we now have a physicsactor. - // Defensive programming calls for a check here. - // Better would be throwing an exception that could be catched by a unit test as the internal - // logic should make sure, this Physactor is always here. - if (pa != null) - { - pa.SetVolumeDetect(1); -// AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active - this.VolumeDetectActive = true; - } - } - else - { - // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like - // (mumbles, well, at least if you have infinte CPU powers :-)) - if (pa != null) - { - pa.SetVolumeDetect(0); - this.VolumeDetectActive = false; + if (pa.Building != building) + pa.Building = building; + } } - } - - if (SetTemporary) - { - AddFlag(PrimFlags.TemporaryOnRez); - } - else - { - RemFlag(PrimFlags.TemporaryOnRez); - } + } // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // and last in case we have a new actor and not building - if (pa != null && pa.Building != building) - pa.Building = building; + if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; @@ -4853,48 +4685,104 @@ namespace OpenSim.Region.Framework.Scenes /// /// Adds this part to the physics scene. + /// and sets the PhysActor property /// - /// This method also sets the PhysActor property. - /// Add this prim with a rigid body. - /// - /// The physics actor. null if there was a failure. - /// - private PhysicsActor AddToPhysics(bool rigidBody) - { + /// Add this prim as physical. + /// Add this prim as phantom. + /// tells physics to delay full construction of object + /// applies velocities, force and torque + private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) + { PhysicsActor pa; + Vector3 velocity = Velocity; + Vector3 rotationalVelocity = AngularVelocity;; + try { pa = ParentGroup.Scene.PhysicsScene.AddPrimShape( - string.Format("{0}/{1}", Name, UUID), - Shape, - AbsolutePosition, - Scale, - RotationOffset, - rigidBody, - m_localId); + string.Format("{0}/{1}", Name, UUID), + Shape, + AbsolutePosition, + Scale, + GetWorldRotation(), + isPhysical, + isPhantom, + PhysicsShapeType, + m_localId); } - catch + catch (Exception ex) { - m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); + m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 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); + + if (VolumeDetectActive) // change if not the default only + pa.SetVolumeDetect(1); + + if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) + m_vehicle.SetVehicle(pa); + + // we are going to tell rest of code about physics so better have this here + PhysActor = pa; + + // DoPhysicsPropertyUpdate(isPhysical, true); + // lets expand it here just with what it really needs to do + + if (isPhysical) + { + if (ParentGroup.RootPart.KeyframeMotion != null) + ParentGroup.RootPart.KeyframeMotion.Stop(); + ParentGroup.RootPart.KeyframeMotion = null; + ParentGroup.Scene.AddPhysicalPrim(1); + + pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds += PhysicsOutOfBounds; + + if (ParentID != 0 && ParentID != LocalId) + { + PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; + + if (parentPa != null) + { + pa.link(parentPa); + } + } + } + + if (applyDynamics) + // do independent of isphysical so parameters get setted (at least some) + { + Velocity = velocity; + AngularVelocity = rotationalVelocity; + pa.Velocity = velocity; + pa.RotationalVelocity = rotationalVelocity; + + // if not vehicle and root part apply force and torque + if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) + && LocalId == ParentGroup.RootPart.LocalId) + { + pa.Force = Force; + pa.Torque = Torque; + } + } + + if (Shape.SculptEntry) + CheckSculptAndLoad(); + else + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); + + if (!building) + pa.Building = false; } - return pa; - } + PhysActor = pa; + } /// /// This removes the part from the physics scene. @@ -5103,10 +4991,6 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = PhysActor; if (pa != null) { - const scriptEvents NeededSubsEvents = ( - scriptEvents.collision | scriptEvents.collision_start| scriptEvents.collision_end | - scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end - ); if ( // ((AggregateScriptEvents & scriptEvents.collision) != 0) || // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || @@ -5114,7 +4998,7 @@ namespace OpenSim.Region.Framework.Scenes // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & NeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) ) { // subscribe to physics updates. -- cgit v1.1 From c4a9eae961030280473f6df77e59cb53865535b6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 9 Apr 2012 23:33:42 +0100 Subject: make llGetGeometricCenter() work as in current SL. Now this is not real geom center but a average of positions relative to root prim ignoring prims details, so no need to use physics engine. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d419710..511ab19 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2260,18 +2260,29 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 GetGeometricCenter() { - PhysicsActor pa = PhysActor; - - if (pa != null) - { - Vector3 vtmp = pa.CenterOfMass; - return vtmp; - } - else + // this is not real geometric center but a average of positions relative to root prim acording to + // http://wiki.secondlife.com/wiki/llGetGeometricCenter + // ignoring tortured prims details since sl also seems to ignore + // so no real use in doing it on physics + if (ParentGroup.IsDeleted) return new Vector3(0, 0, 0); + + return ParentGroup.GetGeometricCenter(); + + /* + PhysicsActor pa = PhysActor; + + if (pa != null) + { + Vector3 vtmp = pa.CenterOfMass; + return vtmp; + } + else + return new Vector3(0, 0, 0); + */ } - public float GetMass() + public float GetMass() { PhysicsActor pa = PhysActor; -- cgit v1.1 From aeb5aed5b70bbe9c54ec7647a70f8fca7d0aee7e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 19 Apr 2012 23:01:22 +0100 Subject: changed - VolumeDetect and phantom setting interaction. Script VD(true) forces phantom ON. UI phantom off turns off VD. Other transitions should only change specific parameter. This is not as current SL. - Fixed volumedetect prims being wrongly removed from physics. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 511ab19..c73fc98 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1830,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building) { - VolumeDetectActive = _VolumeDetectActive; //?? as is used this is redundante + VolumeDetectActive = _VolumeDetectActive; if (!ParentGroup.Scene.CollidablePrims) return; @@ -1839,7 +1839,10 @@ namespace OpenSim.Region.Framework.Scenes return; bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0; - bool isPhantom = (_ObjectFlags & (uint) PrimFlags.Phantom) != 0; + bool isPhantom = (_ObjectFlags & (uint)PrimFlags.Phantom) != 0; + + if (_VolumeDetectActive) + isPhantom = true; if (IsJoint()) { @@ -2065,6 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Do a physics propery update for this part. + /// now also updates phantom and volume detector /// /// /// @@ -2096,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup.RootPart == this) AngularVelocity = new Vector3(0, 0, 0); - if (pa.Phantom) + if (pa.Phantom && !VolumeDetectActive) { RemoveFromPhysics(); return; @@ -2143,6 +2147,14 @@ namespace OpenSim.Region.Framework.Scenes if (pa.Phantom != phan) pa.Phantom = phan; +// some engines dont' have this check still +// if (VolumeDetectActive != pa.IsVolumeDtc) + { + if (VolumeDetectActive) + pa.SetVolumeDetect(1); + else + pa.SetVolumeDetect(0); + } // If this part is a sculpt then delay the physics update until we've asynchronously loaded the // mesh data. @@ -4599,6 +4611,12 @@ namespace OpenSim.Region.Framework.Scenes if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) return; + VolumeDetectActive = SetVD; + + // volume detector implies phantom + if (VolumeDetectActive) + SetPhantom = true; + if (UsePhysics) AddFlag(PrimFlags.Physics); else @@ -4614,7 +4632,6 @@ namespace OpenSim.Region.Framework.Scenes else RemFlag(PrimFlags.TemporaryOnRez); - VolumeDetectActive = SetVD; if (ParentGroup.Scene == null) return; @@ -4624,7 +4641,7 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null && building && pa.Building != building) pa.Building = building; - if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none + if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none || (Shape.PathCurve == (byte)Extrusion.Flexible)) { if (pa != null) @@ -4669,12 +4686,12 @@ namespace OpenSim.Region.Framework.Scenes else // it already has a physical representation { DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. - - if(VolumeDetectActive) - pa.SetVolumeDetect(1); - else - pa.SetVolumeDetect(0); - + /* moved into DoPhysicsPropertyUpdate + if(VolumeDetectActive) + pa.SetVolumeDetect(1); + else + pa.SetVolumeDetect(0); + */ if (pa.Building != building) pa.Building = building; } -- cgit v1.1 From 3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 20 Apr 2012 18:51:32 +0100 Subject: changed seletion code. SOP now knows about parts selection. UI actions are sent to SOP and this reports to SOG. Group is selected if any part is selected.sop.isSelect get() is only used in SOG. Will need to be improved for better performance on largelinksets. *UNTESTED* NEEDS CHECKING for side efects --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c73fc98..c9659cb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -304,6 +304,9 @@ namespace OpenSim.Region.Framework.Scenes protected float m_friction = 0.6f; // wood protected float m_bounce = 0.5f; // wood + + protected bool m_isSelected = false; + /// /// Stores media texture data /// @@ -577,6 +580,16 @@ namespace OpenSim.Region.Framework.Scenes } } + public bool IsSelected + { + get { return m_isSelected; } + set + { + m_isSelected = value; + if (ParentGroup != null) + ParentGroup.PartSelectChanged(value); + } + } public Dictionary CollisionFilter @@ -1907,6 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.m_rezzed = m_rezzed; dupe.m_UndoRedo = null; + dupe.m_isSelected = false; dupe.IgnoreUndoUpdate = false; dupe.Undoing = false; -- cgit v1.1 From dd745f60c201aee7ff48ba81d567e7b38a8f186c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 28 Apr 2012 21:36:38 +0100 Subject: fix llGetCenterOfMass ( checked with ubitODE only) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 40 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c9659cb..b198ca7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1865,7 +1865,7 @@ namespace OpenSim.Region.Framework.Scenes { if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) - AddToPhysics(isPhysical, isPhantom, building, true); + AddToPhysics(isPhysical, isPhantom, building, isPhysical); else PhysActor = null; // just to be sure } @@ -2308,7 +2308,7 @@ namespace OpenSim.Region.Framework.Scenes */ } - public float GetMass() + public float GetMass() { PhysicsActor pa = PhysActor; @@ -2318,6 +2318,40 @@ namespace OpenSim.Region.Framework.Scenes return 0; } + public Vector3 GetCenterOfMass() + { + if (ParentGroup.RootPart == this) + { + if (ParentGroup.IsDeleted) + return AbsolutePosition; + return ParentGroup.GetCenterOfMass(); + } + + PhysicsActor pa = PhysActor; + + if (pa != null) + { + Vector3 tmp = pa.CenterOfMass; + return tmp; + } + else + return AbsolutePosition; + } + + public Vector3 GetPartCenterOfMass() + { + PhysicsActor pa = PhysActor; + + if (pa != null) + { + Vector3 tmp = pa.CenterOfMass; + return tmp; + } + else + return AbsolutePosition; + } + + public Vector3 GetForce() { return Force; @@ -4802,7 +4836,7 @@ namespace OpenSim.Region.Framework.Scenes { Velocity = velocity; AngularVelocity = rotationalVelocity; - pa.Velocity = velocity; +// pa.Velocity = velocity; pa.RotationalVelocity = rotationalVelocity; // if not vehicle and root part apply force and torque -- cgit v1.1 From 98e9f225446ade7f1650db96fb4b8d763af1730e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 2 May 2012 00:29:56 +0200 Subject: Preserve attachment rotation on objects rezzed via a script. Makes toasters work right, finally. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b198ca7..b0bc188 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -197,6 +197,9 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 AttachOffset = Vector3.Zero; [XmlIgnore] + public Quaternion AttachRotation = Quaternion.Identity; + + [XmlIgnore] public int STATUS_ROTATE_X; public int STATUS_ROTATE_Y; -- cgit v1.1 From e3c376156c37fe8bf1b0e0b69cb4acd655d3528f Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 14 May 2012 22:45:54 +0200 Subject: Completely revamp collision handling. Now works as it is supposed to. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 672 ++++++--------------- 1 file changed, 171 insertions(+), 501 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0bc188..f7edd31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -271,7 +271,8 @@ namespace OpenSim.Region.Framework.Scenes private string m_touchName = String.Empty; private UndoRedoState m_UndoRedo = null; - private bool m_passTouches; + private bool m_passTouches = false; + private bool m_passCollisions = false; protected Vector3 m_acceleration; protected Vector3 m_angularVelocity; @@ -571,6 +572,7 @@ namespace OpenSim.Region.Framework.Scenes } } + [XmlIgnore] public bool PassTouches { get { return m_passTouches; } @@ -583,6 +585,18 @@ namespace OpenSim.Region.Framework.Scenes } } + public bool PassCollisions + { + get { return m_passCollisions; } + set + { + m_passCollisions = value; + + if (ParentGroup != null) + ParentGroup.HasGroupChanged = true; + } + } + public bool IsSelected { get { return m_isSelected; } @@ -2433,546 +2447,202 @@ namespace OpenSim.Region.Framework.Scenes { } - public void PhysicsCollision(EventArgs e) + private bool CollisionFilteredOut(SceneObjectPart dest, UUID objectID, string objectName) { -// m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID); - - // single threaded here - - CollisionEventUpdate a = (CollisionEventUpdate)e; - Dictionary collissionswith = a.m_objCollisionList; - List thisHitColliders = new List(); - List endedColliders = new List(); - List startedColliders = new List(); - - // calculate things that started colliding this time - // and build up list of colliders this time - foreach (uint localid in collissionswith.Keys) - { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - { - startedColliders.Add(localid); - } - //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); - } - - // calculate things that ended colliding - foreach (uint localID in m_lastColliders) - { - if (!thisHitColliders.Contains(localID)) - { - endedColliders.Add(localID); - } - } + if(dest.CollisionFilter.Count == 0) + return false; - //add the items that started colliding this time to the last colliders list. - foreach (uint localID in startedColliders) + if (dest.CollisionFilter.ContainsValue(objectID.ToString()) || + dest.CollisionFilter.ContainsValue(objectID.ToString() + objectName) || + dest.CollisionFilter.ContainsValue(UUID.Zero.ToString() + objectName)) { - m_lastColliders.Add(localID); - } - // remove things that ended colliding from the last colliders list - foreach (uint localID in endedColliders) - { - m_lastColliders.Remove(localID); + if (dest.CollisionFilter.ContainsKey(1)) + return false; + return true; } - if (ParentGroup.IsDeleted) - return; + if (dest.CollisionFilter.ContainsKey(1)) + return true; - // play the sound. - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) - { - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); - } + return false; + } - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) - { - // do event notification - if (startedColliders.Count > 0) - { - ColliderArgs StartCollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in startedColliders) - { - if (localId == 0) - continue; + private DetectedObject CreateDetObject(SceneObjectPart obj) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = obj.UUID; + detobj.nameStr = obj.Name; + detobj.ownerUUID = obj.OwnerID; + detobj.posVector = obj.AbsolutePosition; + detobj.rotQuat = obj.GetWorldRotation(); + detobj.velVector = obj.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = obj.GroupID; - if (ParentGroup.Scene == null) - return; + return detobj; + } - SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); - string data = ""; - if (obj != null) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) - || ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this object - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this object - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - } - } - else - { - ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) - { - if (av.LocalId == localId) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) - || ParentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this avatar - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - } + private DetectedObject CreateDetObject(ScenePresence av) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = av.UUID; + detobj.nameStr = av.ControllingClient.Name; + detobj.ownerUUID = av.UUID; + detobj.posVector = av.AbsolutePosition; + detobj.rotQuat = av.Rotation; + detobj.velVector = av.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = av.ControllingClient.ActiveGroupId; - } - }); - } - } + return detobj; + } - if (colliding.Count > 0) - { - StartCollidingMessage.Colliders = colliding; + private DetectedObject CreateDetObjectForGround() + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = ParentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; - if (ParentGroup.Scene == null) - return; + return detobj; + } -// if (m_parentGroup.PassCollision == true) -// { -// //TODO: Add pass to root prim! -// } + private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List colliders) + { + ColliderArgs colliderArgs = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in colliders) + { + if (localId == 0) + continue; - ParentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); - } + SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); + if (obj != null) + { + if (!dest.CollisionFilteredOut(this, obj.UUID, obj.Name)) + colliding.Add(CreateDetObject(obj)); } - } - - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision) != 0) - { - if (m_lastColliders.Count > 0) + else { - ColliderArgs CollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in m_lastColliders) + ScenePresence av = ParentGroup.Scene.GetScenePresence(localId); + if (av != null && (!av.IsChildAgent)) { - // always running this check because if the user deletes the object it would return a null reference. - if (localId == 0) - continue; - - if (ParentGroup.Scene == null) - return; - - SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); - string data = ""; - if (obj != null) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) - || ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this object - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - } - } - else - { - ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) - { - if (av.LocalId == localId) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) - || ParentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this avatar - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - } - - } - }); - } - } - if (colliding.Count > 0) - { - CollidingMessage.Colliders = colliding; - - if (ParentGroup.Scene == null) - return; - - ParentGroup.Scene.EventManager.TriggerScriptColliding(LocalId, CollidingMessage); + if (!dest.CollisionFilteredOut(this, av.UUID, av.Name)) + colliding.Add(CreateDetObject(av)); } } } - - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_end) != 0) - { - if (endedColliders.Count > 0) - { - ColliderArgs EndCollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in endedColliders) - { - if (localId == 0) - continue; - if (ParentGroup.Scene == null) - return; + colliderArgs.Colliders = colliding; - SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); - string data = ""; - if (obj != null) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this object - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj.OwnerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj.GroupID; - colliding.Add(detobj); - } - } - } - else - { - ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) - { - if (av.LocalId == localId) - { - if (ParentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) - || ParentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar - if (found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - //If it is 0, it is to not accept collisions from this avatar - else - { - } - } - else - { - bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } - } + return colliderArgs; + } - } - }); - } - } - - if (colliding.Count > 0) - { - EndCollidingMessage.Colliders = colliding; - - if (ParentGroup.Scene == null) - return; - - ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); - } - } - } + private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message); + + private void SendCollisionEvent(scriptEvents ev, List colliders, ScriptCollidingNotification notify) + { + bool sendToRoot = false; + ColliderArgs CollidingMessage; - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) + if (colliders.Count > 0) { - if (startedColliders.Count > 0) + if ((ScriptEvents & ev) != 0) { - ColliderArgs LandStartCollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in startedColliders) - { - if (localId == 0) - { - //Hope that all is left is ground! - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = UUID.Zero; - detobj.nameStr = ""; - detobj.ownerUUID = UUID.Zero; - detobj.posVector = ParentGroup.RootPart.AbsolutePosition; - detobj.rotQuat = Quaternion.Identity; - detobj.velVector = Vector3.Zero; - detobj.colliderType = 0; - detobj.groupUUID = UUID.Zero; - colliding.Add(detobj); - } - } - - if (colliding.Count > 0) - { - LandStartCollidingMessage.Colliders = colliding; + CollidingMessage = CreateColliderArgs(this, colliders); - if (ParentGroup.Scene == null) - return; + if (CollidingMessage.Colliders.Count > 0) + notify(LocalId, CollidingMessage); - ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage); - } + if (PassCollisions) + sendToRoot = true; + } + else + { + if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) + sendToRoot = true; + } + if (sendToRoot && ParentGroup.RootPart != this) + { + CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); + if (CollidingMessage.Colliders.Count > 0) + notify(ParentGroup.RootPart.LocalId, CollidingMessage); } } + } - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) + private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify) + { + if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) { - if (m_lastColliders.Count > 0) - { - ColliderArgs LandCollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in startedColliders) - { - if (localId == 0) - { - //Hope that all is left is ground! - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = UUID.Zero; - detobj.nameStr = ""; - detobj.ownerUUID = UUID.Zero; - detobj.posVector = ParentGroup.RootPart.AbsolutePosition; - detobj.rotQuat = Quaternion.Identity; - detobj.velVector = Vector3.Zero; - detobj.colliderType = 0; - detobj.groupUUID = UUID.Zero; - colliding.Add(detobj); - } - } + ColliderArgs LandCollidingMessage = new ColliderArgs(); + List colliding = new List(); + + colliding.Add(CreateDetObjectForGround()); + LandCollidingMessage.Colliders = colliding; - if (colliding.Count > 0) - { - LandCollidingMessage.Colliders = colliding; + notify(LocalId, LandCollidingMessage); + } + } - if (ParentGroup.Scene == null) - return; + public void PhysicsCollision(EventArgs e) + { + if (ParentGroup.Scene == null || ParentGroup.IsDeleted) + return; - ParentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage); - } - } + // single threaded here + CollisionEventUpdate a = (CollisionEventUpdate)e; + Dictionary collissionswith = a.m_objCollisionList; + List thisHitColliders = new List(); + List endedColliders = new List(); + List startedColliders = new List(); + + // calculate things that started colliding this time + // and build up list of colliders this time + foreach (uint localid in collissionswith.Keys) + { + thisHitColliders.Add(localid); + if (!m_lastColliders.Contains(localid)) + startedColliders.Add(localid); } - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) + // calculate things that ended colliding + foreach (uint localID in m_lastColliders) { - if (endedColliders.Count > 0) - { - ColliderArgs LandEndCollidingMessage = new ColliderArgs(); - List colliding = new List(); - foreach (uint localId in startedColliders) - { - if (localId == 0) - { - //Hope that all is left is ground! - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = UUID.Zero; - detobj.nameStr = ""; - detobj.ownerUUID = UUID.Zero; - detobj.posVector = ParentGroup.RootPart.AbsolutePosition; - detobj.rotQuat = Quaternion.Identity; - detobj.velVector = Vector3.Zero; - detobj.colliderType = 0; - detobj.groupUUID = UUID.Zero; - colliding.Add(detobj); - } - } + if (!thisHitColliders.Contains(localID)) + endedColliders.Add(localID); + } - if (colliding.Count > 0) - { - LandEndCollidingMessage.Colliders = colliding; + //add the items that started colliding this time to the last colliders list. + foreach (uint localID in startedColliders) + m_lastColliders.Add(localID); - if (ParentGroup.Scene == null) - return; + // remove things that ended colliding from the last colliders list + foreach (uint localID in endedColliders) + m_lastColliders.Remove(localID); - ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage); - } - } + // play the sound. + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + + SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); + SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); + SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); + + if (startedColliders.Contains(0)) + { + if (m_lastColliders.Contains(0)) + SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); + else + SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); } + if (endedColliders.Contains(0)) + SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); } public void PhysicsOutOfBounds(Vector3 pos) @@ -4724,7 +4394,7 @@ namespace OpenSim.Region.Framework.Scenes // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) // (CollisionSound != UUID.Zero) ) { @@ -5077,7 +4747,7 @@ namespace OpenSim.Region.Framework.Scenes // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) ) { // subscribe to physics updates. -- cgit v1.1 From e9e797b6814b960b140094bbff137e38f96d4ca8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 15 May 2012 00:15:44 +0200 Subject: Fix an omission --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f7edd31..4884469 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2564,7 +2564,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) + if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) sendToRoot = true; } if (sendToRoot && ParentGroup.RootPart != this) -- cgit v1.1 From 325973d36f98a4b2fb0291e8bdc0063c4264329d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 01:40:46 +0100 Subject: don't send colision events to volume detectors --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4884469..81244ef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2631,7 +2631,8 @@ namespace OpenSim.Region.Framework.Scenes SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); - SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); + if(!ParentGroup.RootPart.VolumeDetectActive) + SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); if (startedColliders.Contains(0)) -- cgit v1.1 From 995cd25f3027e1debb0ae5fc60b5dde831c31d17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 15 May 2012 02:36:11 +0200 Subject: Port the mel/dahlia fix --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 81244ef..7a1720c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4706,6 +4706,9 @@ namespace OpenSim.Region.Framework.Scenes public void aggregateScriptEvents() { + if (ParentGroup == null || ParentGroup.RootPart == null) + return; + AggregateScriptEvents = 0; // Aggregate script events -- cgit v1.1 From ca14534b91342f55e30838ccafba25424628f5b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 15:54:02 +0100 Subject: sop: - added UpdatePhysicsSubscribedEvents() to update physics ator collision events subcription where needed. Made it consider also VolumeDtc and phantom cases. - added extra calls to it on physics ator proprieties changes. - Fixed land collisions reports. - Handle the case of physics sending a last zero colisions reports to trigger collision_end. - Made the physics collisions report rate be 20 per second. (needs review/testing) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 166 +++++++++++++++------ 1 file changed, 118 insertions(+), 48 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a1720c..11d6b57 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -123,11 +123,17 @@ namespace OpenSim.Region.Framework.Scenes /// public const int ALL_SIDES = -1; - private const scriptEvents PhyscicsNeededSubsEvents = ( + private const scriptEvents PhysicsNeededSubsEvents = ( scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end | scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end ); - + private const scriptEvents PhyscicsPhantonSubsEvents = ( + scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end + ); + private const scriptEvents PhyscicsVolumeDtcSubsEvents = ( + scriptEvents.collision_start | scriptEvents.collision_end + ); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// @@ -1882,7 +1888,10 @@ namespace OpenSim.Region.Framework.Scenes { if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + { AddToPhysics(isPhysical, isPhantom, building, isPhysical); + UpdatePhysicsSubscribedEvents(); // not sure if appliable here + } else PhysActor = null; // just to be sure } @@ -1975,6 +1984,7 @@ namespace OpenSim.Region.Framework.Scenes bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); dupe.DoPhysicsPropertyUpdate(UsePhysics, true); +// dupe.UpdatePhysicsSubscribedEvents(); // not sure... } if (dupe.PhysActor != null) @@ -2602,30 +2612,45 @@ namespace OpenSim.Region.Framework.Scenes List endedColliders = new List(); List startedColliders = new List(); - // calculate things that started colliding this time - // and build up list of colliders this time - foreach (uint localid in collissionswith.Keys) + if (collissionswith.Count == 0) { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - startedColliders.Add(localid); - } + if (m_lastColliders.Count == 0) + return; // nothing to do - // calculate things that ended colliding - foreach (uint localID in m_lastColliders) - { - if (!thisHitColliders.Contains(localID)) + foreach (uint localID in m_lastColliders) + { endedColliders.Add(localID); + } + m_lastColliders.Clear(); } - //add the items that started colliding this time to the last colliders list. - foreach (uint localID in startedColliders) - m_lastColliders.Add(localID); + else + { + + // calculate things that started colliding this time + // and build up list of colliders this time + foreach (uint localid in collissionswith.Keys) + { + thisHitColliders.Add(localid); + if (!m_lastColliders.Contains(localid)) + startedColliders.Add(localid); + } + + // calculate things that ended colliding + foreach (uint localID in m_lastColliders) + { + if (!thisHitColliders.Contains(localID)) + endedColliders.Add(localID); + } - // remove things that ended colliding from the last colliders list - foreach (uint localID in endedColliders) - m_lastColliders.Remove(localID); + //add the items that started colliding this time to the last colliders list. + foreach (uint localID in startedColliders) + m_lastColliders.Add(localID); + // remove things that ended colliding from the last colliders list + foreach (uint localID in endedColliders) + m_lastColliders.Remove(localID); + } // play the sound. if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); @@ -2636,12 +2661,9 @@ namespace OpenSim.Region.Framework.Scenes SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); if (startedColliders.Contains(0)) - { - if (m_lastColliders.Contains(0)) - SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); - else - SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); - } + SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); + if (m_lastColliders.Contains(0)) + SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); if (endedColliders.Contains(0)) SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); } @@ -4383,26 +4405,28 @@ namespace OpenSim.Region.Framework.Scenes { if (pa == null) { - AddToPhysics(UsePhysics, SetPhantom, building , false); + AddToPhysics(UsePhysics, SetPhantom, building, false); pa = PhysActor; - - if (pa != null) - { - 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) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) -// (CollisionSound != UUID.Zero) - ) - { - pa.OnCollisionUpdate += PhysicsCollision; - pa.SubscribeEvents(1000); - } - } + /* + if (pa != null) + { + 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) || + ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + (CollisionSound != UUID.Zero) + ) + { + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); + } + } + */ } else // it already has a physical representation @@ -4414,9 +4438,13 @@ namespace OpenSim.Region.Framework.Scenes else pa.SetVolumeDetect(0); */ + + if (pa.Building != building) pa.Building = building; } + + UpdatePhysicsSubscribedEvents(); } } @@ -4539,8 +4567,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// This isn't the same as turning off physical, since even without being physical the prim has a physics - /// representation for collision detection. Rather, this would be used in situations such as making a prim - /// phantom. + /// representation for collision detection. /// public void RemoveFromPhysics() { @@ -4704,6 +4731,46 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } + + private void UpdatePhysicsSubscribedEvents() + { + PhysicsActor pa = PhysActor; + if (pa == null) + return; + + pa.OnCollisionUpdate -= PhysicsCollision; + + bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); + scriptEvents CombinedEvents = AggregateScriptEvents; + + // merge with root part + if (ParentGroup != null && ParentGroup.RootPart != null) + CombinedEvents |= ParentGroup.RootPart.AggregateScriptEvents; + + // submit to this part case + if (VolumeDetectActive) + { + CombinedEvents &= PhyscicsVolumeDtcSubsEvents; + hassound = false; + } + else if ((Flags & PrimFlags.Phantom) != 0) + CombinedEvents &= PhyscicsPhantonSubsEvents; + else + CombinedEvents &= PhysicsNeededSubsEvents; + + if (hassound || CombinedEvents != 0) + { + // subscribe to physics updates. + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(50); // 20 reports per second + } + else + { + pa.UnSubscribeEvents(); + } + } + + public void aggregateScriptEvents() { if (ParentGroup == null || ParentGroup.RootPart == null) @@ -4740,7 +4807,7 @@ namespace OpenSim.Region.Framework.Scenes { objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; } - +/* PhysicsActor pa = PhysActor; if (pa != null) { @@ -4751,7 +4818,7 @@ namespace OpenSim.Region.Framework.Scenes // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) ) { // subscribe to physics updates. @@ -4764,6 +4831,9 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; } } + */ + UpdatePhysicsSubscribedEvents(); + //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) //{ // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; -- cgit v1.1 From accab1e086b8a77b233371b07b648195355d6603 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 16:56:43 +0100 Subject: sop colisions don't play sounds on volume detectors --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 11d6b57..3850e46 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2652,7 +2652,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastColliders.Remove(localID); } // play the sound. - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && !ParentGroup.RootPart.VolumeDetectActive) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); -- cgit v1.1 From 81d7844f5196aeee7a02c924448795820dbf5e8b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 17:01:00 +0100 Subject: use part VolumeDetectActive and not rootPart.VolumeDetectActive to be coerent with other places in case of future changes. Should be equivalent if all is well. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3850e46..8716e20 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2652,11 +2652,14 @@ namespace OpenSim.Region.Framework.Scenes m_lastColliders.Remove(localID); } // play the sound. - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && !ParentGroup.RootPart.VolumeDetectActive) + + bool IsNotVolumeDtc = !VolumeDetectActive; + + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); - if(!ParentGroup.RootPart.VolumeDetectActive) + if (IsNotVolumeDtc) SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); -- cgit v1.1 From ea47b0362548101d201f3bef26436d3420d791fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 May 2012 12:27:49 +0100 Subject: Added a invalidCollisionSoundUUID so that scripts can stop all collision sounds with llCollisionSound("",...). UUID.Zero means defaults should be used. In case part has several scripts with confliting llCollisionSound result depende on exec order. Specially on reset the efect of "" depends on reset order, it should override the others. This is intermediate improve(?) since collisions sounds seem to need a deaper revision. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8716e20..2fb42f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1336,11 +1336,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_sitAnimation = value; } } + public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); + public UUID CollisionSound { get { return m_collisionSound; } set - { + { m_collisionSound = value; aggregateScriptEvents(); } @@ -2655,8 +2657,15 @@ namespace OpenSim.Region.Framework.Scenes bool IsNotVolumeDtc = !VolumeDetectActive; - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) + { + if(CollisionSound != UUID.Zero) + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + else + { + // default sounds + } + } SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (IsNotVolumeDtc) @@ -4743,7 +4752,7 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; - bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); + bool hassound = ( CollisionSound != invalidCollisionSoundUUID); scriptEvents CombinedEvents = AggregateScriptEvents; // merge with root part -- cgit v1.1 From 0de7219485b55ce297d963c46e5ba869eeb1b8e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 May 2012 23:36:37 +0100 Subject: collision sounds: simplify send code a bit and limit sending rate to 5 per sec per part ??? --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2fb42f4..38e7a12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -188,6 +188,7 @@ namespace OpenSim.Region.Framework.Scenes public double SoundRadius; + public uint TimeStampFull; public uint TimeStampLastActivity; // Will be used for AutoReturn @@ -332,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes private UUID m_collisionSound; private float m_collisionSoundVolume; + private DateTime LastColSoundSentTime; + private SOPVehicle m_vehicle = null; @@ -371,6 +374,7 @@ namespace OpenSim.Region.Framework.Scenes // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log m_inventory = new SceneObjectPartInventory(this); + LastColSoundSentTime = DateTime.UtcNow; } /// @@ -2660,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) { if(CollisionSound != UUID.Zero) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + SendCollisionSound(CollisionSound, CollisionSoundVolume); else { // default sounds @@ -3199,6 +3203,37 @@ namespace OpenSim.Region.Framework.Scenes } } + public void SendCollisionSound(UUID soundID, double volume) + { + if (soundID == UUID.Zero) + return; + + + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule == null) + return; + + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + DateTime now = DateTime.UtcNow; + if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ?? + return; + + LastColSoundSentTime = now; + + UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID parentID = ParentGroup.UUID; + Vector3 position = AbsolutePosition; // region local + ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0); + } + + /// /// Send a terse update to all clients /// -- cgit v1.1 From 7cbc54d92a4702efb8a7bc1b0ec611c4abbc104b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 01:04:30 +0100 Subject: default collision sounds. Incomplete, untested, needs revision --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 38e7a12..af9b7eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2667,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes SendCollisionSound(CollisionSound, CollisionSoundVolume); else { - // default sounds + CollisionSounds.PartCollisionSound(this, startedColliders); } } -- cgit v1.1 From b743835f9ed665c85eb78569b2bc31853eb64332 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 01:36:42 +0100 Subject: default colisionVolume is 0, use it only for user specified sound --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index af9b7eb..5874d34 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2661,10 +2661,13 @@ namespace OpenSim.Region.Framework.Scenes bool IsNotVolumeDtc = !VolumeDetectActive; - if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) + if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) { - if(CollisionSound != UUID.Zero) - SendCollisionSound(CollisionSound, CollisionSoundVolume); + if (CollisionSound != UUID.Zero) + { + if (CollisionSoundVolume > 0.0f) + SendCollisionSound(CollisionSound, CollisionSoundVolume); + } else { CollisionSounds.PartCollisionSound(this, startedColliders); -- cgit v1.1 From 6af78836a540c9b0a5972ab241364dae52e8e74d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 12:17:29 +0100 Subject: trigger collision sounds on active agent position for better spatial effect without using the detailed collision position. (current error will be half max physical prim size). Moved some checks from sop to collisionSound code --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5874d34..b5705b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2632,7 +2632,6 @@ namespace OpenSim.Region.Framework.Scenes else { - // calculate things that started colliding this time // and build up list of colliders this time foreach (uint localid in collissionswith.Keys) @@ -2657,22 +2656,13 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localID in endedColliders) m_lastColliders.Remove(localID); } + // play the sound. bool IsNotVolumeDtc = !VolumeDetectActive; if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) - { - if (CollisionSound != UUID.Zero) - { - if (CollisionSoundVolume > 0.0f) - SendCollisionSound(CollisionSound, CollisionSoundVolume); - } - else - { - CollisionSounds.PartCollisionSound(this, startedColliders); - } - } + CollisionSounds.PartCollisionSound(this, startedColliders); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (IsNotVolumeDtc) @@ -3206,12 +3196,11 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SendCollisionSound(UUID soundID, double volume) + public void SendCollisionSound(UUID soundID, double volume, Vector3 position) { if (soundID == UUID.Zero) return; - ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); if (soundModule == null) return; @@ -3230,10 +3219,9 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID = OwnerID; UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = ParentGroup.UUID; - Vector3 position = AbsolutePosition; // region local ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0); + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); } -- cgit v1.1 From 9ecdef2686de9045f1fddd8b64bcf73c04e1e0ab Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 May 2012 02:04:10 +0100 Subject: modulate collision sound intensity with collision relative velocity for parts also --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 45 ++++++++++++++-------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b5705b7..467b625 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -333,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes private UUID m_collisionSound; private float m_collisionSoundVolume; - private DateTime LastColSoundSentTime; + private int LastColSoundSentTime; private SOPVehicle m_vehicle = null; @@ -374,7 +374,7 @@ namespace OpenSim.Region.Framework.Scenes // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log m_inventory = new SceneObjectPartInventory(this); - LastColSoundSentTime = DateTime.UtcNow; + LastColSoundSentTime = Util.EnvironmentTickCount(); } /// @@ -2632,13 +2632,29 @@ namespace OpenSim.Region.Framework.Scenes else { + List soundinfolist = new List(); + CollisionForSoundInfo soundinfo; + ContactPoint curcontact; + // calculate things that started colliding this time // and build up list of colliders this time - foreach (uint localid in collissionswith.Keys) + foreach (uint id in collissionswith.Keys) { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - startedColliders.Add(localid); + thisHitColliders.Add(id); + if (!m_lastColliders.Contains(id)) + { + startedColliders.Add(id); + + curcontact = collissionswith[id]; + if (Math.Abs(curcontact.RelativeSpeed) > 0.2) + { + soundinfo = new CollisionForSoundInfo(); + soundinfo.colliderID = id; + soundinfo.position = curcontact.Position; + soundinfo.relativeVel = curcontact.RelativeSpeed; + soundinfolist.Add(soundinfo); + } + } } // calculate things that ended colliding @@ -2655,17 +2671,14 @@ namespace OpenSim.Region.Framework.Scenes // remove things that ended colliding from the last colliders list foreach (uint localID in endedColliders) m_lastColliders.Remove(localID); - } - - // play the sound. - bool IsNotVolumeDtc = !VolumeDetectActive; - - if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) - CollisionSounds.PartCollisionSound(this, startedColliders); + // play sounds. + if (soundinfolist.Count > 0 && !VolumeDetectActive && CollisionSound != invalidCollisionSoundUUID) + CollisionSounds.PartCollisionSound(this, soundinfolist); + } SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); - if (IsNotVolumeDtc) + if (!VolumeDetectActive) SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); @@ -3210,8 +3223,8 @@ namespace OpenSim.Region.Framework.Scenes if (volume < 0) volume = 0; - DateTime now = DateTime.UtcNow; - if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ?? + int now = Util.EnvironmentTickCount(); + if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) return; LastColSoundSentTime = now; -- cgit v1.1 From 2c498baf58005be487b4e457455a9896a96b90d3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 May 2012 13:53:49 +0100 Subject: a bit faster collision sound type verification plus a few fixes/changes --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 80 ++++++++++++++++------ 1 file changed, 60 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 467b625..5fddaed 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -329,7 +329,9 @@ namespace OpenSim.Region.Framework.Scenes private Vector3 m_cameraAtOffset; private bool m_forceMouselook; - // TODO: Collision sound should have default. + + // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound + private sbyte m_collisionSoundType; private UUID m_collisionSound; private float m_collisionSoundVolume; @@ -1342,12 +1344,39 @@ namespace OpenSim.Region.Framework.Scenes public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); + // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound + // runtime thing.. do not persist + [XmlIgnore] + public sbyte CollisionSoundType + { + get + { + return m_collisionSoundType; + } + set + { + m_collisionSoundType = value; + if (value == -1) + m_collisionSound = invalidCollisionSoundUUID; + else if (value == 0) + m_collisionSound = UUID.Zero; + } + } + public UUID CollisionSound { get { return m_collisionSound; } set { m_collisionSound = value; + + if (value == invalidCollisionSoundUUID) + m_collisionSoundType = -1; + else if (value == UUID.Zero) + m_collisionSoundType = 0; + else + m_collisionSoundType = 1; + aggregateScriptEvents(); } } @@ -2633,29 +2662,42 @@ namespace OpenSim.Region.Framework.Scenes else { List soundinfolist = new List(); - CollisionForSoundInfo soundinfo; - ContactPoint curcontact; // calculate things that started colliding this time // and build up list of colliders this time - foreach (uint id in collissionswith.Keys) + if (!VolumeDetectActive && CollisionSoundType >= 0) { - thisHitColliders.Add(id); - if (!m_lastColliders.Contains(id)) - { - startedColliders.Add(id); + CollisionForSoundInfo soundinfo; + ContactPoint curcontact; - curcontact = collissionswith[id]; - if (Math.Abs(curcontact.RelativeSpeed) > 0.2) + foreach (uint id in collissionswith.Keys) + { + thisHitColliders.Add(id); + if (!m_lastColliders.Contains(id)) { - soundinfo = new CollisionForSoundInfo(); - soundinfo.colliderID = id; - soundinfo.position = curcontact.Position; - soundinfo.relativeVel = curcontact.RelativeSpeed; - soundinfolist.Add(soundinfo); + startedColliders.Add(id); + + curcontact = collissionswith[id]; + if (Math.Abs(curcontact.RelativeSpeed) > 0.2) + { + soundinfo = new CollisionForSoundInfo(); + soundinfo.colliderID = id; + soundinfo.position = curcontact.Position; + soundinfo.relativeVel = curcontact.RelativeSpeed; + soundinfolist.Add(soundinfo); + } } } } + else + { + foreach (uint id in collissionswith.Keys) + { + thisHitColliders.Add(id); + if (!m_lastColliders.Contains(id)) + startedColliders.Add(id); + } + } // calculate things that ended colliding foreach (uint localID in m_lastColliders) @@ -2673,7 +2715,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastColliders.Remove(localID); // play sounds. - if (soundinfolist.Count > 0 && !VolumeDetectActive && CollisionSound != invalidCollisionSoundUUID) + if (soundinfolist.Count > 0) CollisionSounds.PartCollisionSound(this, soundinfolist); } @@ -4791,7 +4833,8 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; - bool hassound = ( CollisionSound != invalidCollisionSoundUUID); + bool hassound = (CollisionSoundType >= 0 && !VolumeDetectActive); + scriptEvents CombinedEvents = AggregateScriptEvents; // merge with root part @@ -4800,10 +4843,7 @@ namespace OpenSim.Region.Framework.Scenes // submit to this part case if (VolumeDetectActive) - { CombinedEvents &= PhyscicsVolumeDtcSubsEvents; - hassound = false; - } else if ((Flags & PrimFlags.Phantom) != 0) CombinedEvents &= PhyscicsPhantonSubsEvents; else -- cgit v1.1 From 32e63fc04fcf08163289c108b278c990208568d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 May 2012 17:30:01 +0100 Subject: missing update script events call --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5fddaed..2852c4b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1604,7 +1604,10 @@ namespace OpenSim.Region.Framework.Scenes } } else if (PhysActor == null) + { ApplyPhysics((uint)Flags, VolumeDetectActive, false); + UpdatePhysicsSubscribedEvents(); + } else { PhysActor.PhysicsShapeType = m_physicsShapeType; @@ -4664,7 +4667,15 @@ namespace OpenSim.Region.Framework.Scenes /// public void RemoveFromPhysics() { - ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); + PhysicsActor pa = PhysActor; + if (pa != null) + { + pa.OnCollisionUpdate -= PhysicsCollision; + pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds -= PhysicsOutOfBounds; + + ParentGroup.Scene.PhysicsScene.RemovePrim(pa); + } PhysActor = null; } -- cgit v1.1 From 10e9ad0086056f4afde081d629eca7cc6520a1ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 29 May 2012 16:56:04 +0200 Subject: Fix collision filtering --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2852c4b..a57e9bc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2495,21 +2495,21 @@ namespace OpenSim.Region.Framework.Scenes { } - private bool CollisionFilteredOut(SceneObjectPart dest, UUID objectID, string objectName) + public bool CollisionFilteredOut(UUID objectID, string objectName) { - if(dest.CollisionFilter.Count == 0) + if(CollisionFilter.Count == 0) return false; - if (dest.CollisionFilter.ContainsValue(objectID.ToString()) || - dest.CollisionFilter.ContainsValue(objectID.ToString() + objectName) || - dest.CollisionFilter.ContainsValue(UUID.Zero.ToString() + objectName)) + if (CollisionFilter.ContainsValue(objectID.ToString()) || + CollisionFilter.ContainsValue(objectID.ToString() + objectName) || + CollisionFilter.ContainsValue(UUID.Zero.ToString() + objectName)) { - if (dest.CollisionFilter.ContainsKey(1)) + if (CollisionFilter.ContainsKey(1)) return false; return true; } - if (dest.CollisionFilter.ContainsKey(1)) + if (CollisionFilter.ContainsKey(1)) return true; return false; @@ -2572,7 +2572,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); if (obj != null) { - if (!dest.CollisionFilteredOut(this, obj.UUID, obj.Name)) + if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) colliding.Add(CreateDetObject(obj)); } else @@ -2580,7 +2580,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = ParentGroup.Scene.GetScenePresence(localId); if (av != null && (!av.IsChildAgent)) { - if (!dest.CollisionFilteredOut(this, av.UUID, av.Name)) + if (!dest.CollisionFilteredOut(av.UUID, av.Name)) colliding.Add(CreateDetObject(av)); } } @@ -2724,7 +2724,7 @@ namespace OpenSim.Region.Framework.Scenes SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (!VolumeDetectActive) - SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); + SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); if (startedColliders.Contains(0)) -- cgit v1.1 From fd176aab8f97aaad037eefc1ae7dc5b9fb670a99 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jun 2012 22:41:29 +0200 Subject: Actually trigger land collisions in the root even when a child collides --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a57e9bc..5694c8c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2634,7 +2634,7 @@ namespace OpenSim.Region.Framework.Scenes colliding.Add(CreateDetObjectForGround()); LandCollidingMessage.Colliders = colliding; - notify(LocalId, LandCollidingMessage); + notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); } } -- cgit v1.1 From 170b820a114e5a53e70d7f1624109239b182ec9f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Jun 2012 01:53:25 +0200 Subject: Fix land collisions to work like SL. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5694c8c..8e74dc8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2626,14 +2626,24 @@ namespace OpenSim.Region.Framework.Scenes private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify) { - if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) + bool sendToRoot = true; + + ColliderArgs LandCollidingMessage = new ColliderArgs(); + List colliding = new List(); + + colliding.Add(CreateDetObjectForGround()); + LandCollidingMessage.Colliders = colliding; + + if (Inventory.ContainsScripts()) { - ColliderArgs LandCollidingMessage = new ColliderArgs(); - List colliding = new List(); - - colliding.Add(CreateDetObjectForGround()); - LandCollidingMessage.Colliders = colliding; + if (!PassCollisions) + sendToRoot = false; + } + if ((ScriptEvents & ev) != 0) + notify(LocalId, LandCollidingMessage); + if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) + { notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); } } -- cgit v1.1 From 065cda37112fecc00e3c10fe966edde2ddc46b4e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Jun 2012 12:19:42 +0100 Subject: Add sop IsPhysical and IsPhantom to be used gradually in core in place of asking physics engines all the time. Some engines delays may make them give wrong answers. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8e74dc8..b51ce38 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -611,7 +611,10 @@ namespace OpenSim.Region.Framework.Scenes public bool IsSelected { - get { return m_isSelected; } + get + { + return m_isSelected; + } set { m_isSelected = value; @@ -619,8 +622,23 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.PartSelectChanged(value); } } - - + + public bool IsPhysical + { + get + { + return ((Flags & PrimFlags.Physics) != 0); + } + } + + public bool IsPhantom + { + get + { + return ((Flags & PrimFlags.Phantom) != 0); + } + } + public Dictionary CollisionFilter { get { return m_CollisionFilter; } -- cgit v1.1 From 5d329791705fa5d82d37f5c3ff03d0f4f597c2e1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Jun 2012 14:31:35 +0100 Subject: Revert changes... This reverts commit c8227e1bb70817351de283fb647ec39f090fc9f1. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 24 +++------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b51ce38..8e74dc8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -611,10 +611,7 @@ namespace OpenSim.Region.Framework.Scenes public bool IsSelected { - get - { - return m_isSelected; - } + get { return m_isSelected; } set { m_isSelected = value; @@ -622,23 +619,8 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.PartSelectChanged(value); } } - - public bool IsPhysical - { - get - { - return ((Flags & PrimFlags.Physics) != 0); - } - } - - public bool IsPhantom - { - get - { - return ((Flags & PrimFlags.Phantom) != 0); - } - } - + + public Dictionary CollisionFilter { get { return m_CollisionFilter; } -- cgit v1.1 From c8f7cd60cd5e16b6917c0b67358bee4eb04716d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Jun 2012 19:05:36 +0100 Subject: fix turning off phanton always decreasing number of physical parts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8e74dc8..a48605d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4496,7 +4496,8 @@ namespace OpenSim.Region.Framework.Scenes { if (pa != null) { - ParentGroup.Scene.RemovePhysicalPrim(1); + if(wasUsingPhysics) + ParentGroup.Scene.RemovePhysicalPrim(1); RemoveFromPhysics(); } @@ -4513,38 +4514,37 @@ namespace OpenSim.Region.Framework.Scenes { AddToPhysics(UsePhysics, SetPhantom, building, false); pa = PhysActor; - /* - if (pa != null) - { - 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) || - ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || - ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || - (CollisionSound != UUID.Zero) - ) - { - pa.OnCollisionUpdate += PhysicsCollision; - pa.SubscribeEvents(1000); - } - } - */ +/* + if (pa != null) + { + 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) || + ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + (CollisionSound != UUID.Zero) + ) + { + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); + } + } +*/ } else // it already has a physical representation { DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. - /* moved into DoPhysicsPropertyUpdate - if(VolumeDetectActive) - pa.SetVolumeDetect(1); - else - pa.SetVolumeDetect(0); - */ - +/* moved into DoPhysicsPropertyUpdate + if(VolumeDetectActive) + pa.SetVolumeDetect(1); + else + pa.SetVolumeDetect(0); +*/ if (pa.Building != building) pa.Building = building; -- cgit v1.1 From ce7864632bf239a44321cc5806a95a78e0f259ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Jul 2012 17:13:11 +0100 Subject: added llSetVelocity. will refuse to work on vehicles and on attachments ( this last may need fix) added also some code for llSetAngularVelocity but not working still --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a48605d..ed32adc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1845,6 +1845,34 @@ namespace OpenSim.Region.Framework.Scenes } } +// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future + public void SetVelocity(Vector3 pVel, bool localGlobalTF) + { + if (ParentGroup == null || ParentGroup.IsDeleted) + return; + + if (ParentGroup.IsAttachment) + return; // don't work on attachments (for now ??) + + SceneObjectPart root = ParentGroup.RootPart; + + if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles + return; + + PhysicsActor pa = root.PhysActor; + + if (pa == null || !pa.IsPhysical) + return; + + if (localGlobalTF) + { + pVel = pVel * GetWorldRotation(); + } + + ParentGroup.Velocity = pVel; + } + + /// /// hook to the physics scene to apply angular impulse /// This is sent up to the group, which then finds the root prim -- cgit v1.1 From 6535f23e4b8fec9578dae5275db69b237a99e498 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jul 2012 02:05:01 +0200 Subject: Add saving vehicle physics data to the database --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ed32adc..dd30a59 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -338,7 +338,7 @@ namespace OpenSim.Region.Framework.Scenes private int LastColSoundSentTime; - private SOPVehicle m_vehicle = null; + private SOPVehicle m_vehicleParams = null; private KeyframeMotion m_keyframeMotion = null; @@ -3379,15 +3379,15 @@ namespace OpenSim.Region.Framework.Scenes Force = force; } - public SOPVehicle sopVehicle + public SOPVehicle VehicleParams { get { - return m_vehicle; + return m_vehicleParams; } set { - m_vehicle = value; + m_vehicleParams = value; } } @@ -3396,10 +3396,10 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (m_vehicle == null) + if (m_vehicleParams == null) return (int)Vehicle.TYPE_NONE; else - return (int)m_vehicle.Type; + return (int)m_vehicleParams.Type; } set { @@ -3409,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleType(int type) { - m_vehicle = null; + m_vehicleParams = null; if (type == (int)Vehicle.TYPE_NONE) { @@ -3417,8 +3417,8 @@ namespace OpenSim.Region.Framework.Scenes PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; return; } - m_vehicle = new SOPVehicle(); - m_vehicle.ProcessTypeChange((Vehicle)type); + m_vehicleParams = new SOPVehicle(); + m_vehicleParams.ProcessTypeChange((Vehicle)type); { if (_parentID ==0 && PhysActor != null) PhysActor.VehicleType = type; @@ -3428,10 +3428,10 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleFlags(int param, bool remove) { - if (m_vehicle == null) + if (m_vehicleParams == null) return; - m_vehicle.ProcessVehicleFlags(param, remove); + m_vehicleParams.ProcessVehicleFlags(param, remove); if (_parentID ==0 && PhysActor != null) { @@ -3441,10 +3441,10 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleFloatParam(int param, float value) { - if (m_vehicle == null) + if (m_vehicleParams == null) return; - m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); + m_vehicleParams.ProcessFloatVehicleParam((Vehicle)param, value); if (_parentID == 0 && PhysActor != null) { @@ -3454,10 +3454,10 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleVectorParam(int param, Vector3 value) { - if (m_vehicle == null) + if (m_vehicleParams == null) return; - m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); + m_vehicleParams.ProcessVectorVehicleParam((Vehicle)param, value); if (_parentID == 0 && PhysActor != null) { @@ -3467,10 +3467,10 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleRotationParam(int param, Quaternion rotation) { - if (m_vehicle == null) + if (m_vehicleParams == null) return; - m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); + m_vehicleParams.ProcessRotationVehicleParam((Vehicle)param, rotation); if (_parentID == 0 && PhysActor != null) { @@ -4637,8 +4637,8 @@ namespace OpenSim.Region.Framework.Scenes if (VolumeDetectActive) // change if not the default only pa.SetVolumeDetect(1); - if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) - m_vehicle.SetVehicle(pa); + if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId) + m_vehicleParams.SetVehicle(pa); // we are going to tell rest of code about physics so better have this here PhysActor = pa; @@ -4676,7 +4676,7 @@ namespace OpenSim.Region.Framework.Scenes pa.RotationalVelocity = rotationalVelocity; // if not vehicle and root part apply force and torque - if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) + if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE) && LocalId == ParentGroup.RootPart.LocalId) { pa.Force = Force; -- cgit v1.1 From 652ac5f66bacb048628bc953497ffe4256676f05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Jul 2012 05:28:47 +0100 Subject: more work on llSetAngularVelocity() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd30a59..0f44823 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1845,7 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes } } -// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future + // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future public void SetVelocity(Vector3 pVel, bool localGlobalTF) { if (ParentGroup == null || ParentGroup.IsDeleted) @@ -1871,6 +1871,33 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.Velocity = pVel; } + + // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future + public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) + { + if (ParentGroup == null || ParentGroup.IsDeleted) + return; + + if (ParentGroup.IsAttachment) + return; // don't work on attachments (for now ??) + + SceneObjectPart root = ParentGroup.RootPart; + + if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles + return; + + PhysicsActor pa = root.PhysActor; + + if (pa == null || !pa.IsPhysical) + return; + + if (localGlobalTF) + { + pAngVel = pAngVel * GetWorldRotation(); + } + + root.AngularVelocity = pAngVel; + } /// -- cgit v1.1 From acec9da95c2faa861ee37cc5e820118fc4649c80 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Jul 2012 05:37:41 +0100 Subject: let SOP AngularVelocity set physics actor angular velocity if it's physical root prim and not a vehicle. With this llSetAngularVelocity should work and also llTargetOmega will do the same in this case. but for now this llTargetOmega is being a normal physical rotation with damping, and stops with selection. Thats not like SL apparently --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0f44823..16a8588 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -959,7 +959,15 @@ namespace OpenSim.Region.Framework.Scenes } return m_angularVelocity; } - set { m_angularVelocity = value; } + set + { + m_angularVelocity = value; + PhysicsActor actor = PhysActor; + if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) + { + actor.RotationalVelocity = m_angularVelocity; + } + } } /// -- cgit v1.1 From ea91a36483f3eba90e16b664715d152f9eca2980 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 23:33:13 +0200 Subject: Add instrumentation to log finalizer being called. Suppressed for backup interim copies to avoid spammage. Not for release to the grid, must be reverted first! --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 16a8588..4d43943 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -149,6 +149,8 @@ namespace OpenSim.Region.Framework.Scenes #region Fields + public bool SuppressFinalizerLogging = false; + public bool AllowedDrop; public bool DIE_AT_EDGE; @@ -350,15 +352,18 @@ namespace OpenSim.Region.Framework.Scenes #endregion Fields -// ~SceneObjectPart() -// { + ~SceneObjectPart() + { + if (SuppressFinalizerLogging) + return; + // Console.WriteLine( // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", -// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); -// } + m_log.DebugFormat( + "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", + Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); + } #region Constructors -- cgit v1.1 From 906ac4adc4adc8eef84a584b73323fda25127806 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jul 2012 01:01:43 +0200 Subject: Revert "Add instrumentation to log finalizer being called. Suppressed for backup" This reverts commit ea91a36483f3eba90e16b664715d152f9eca2980. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4d43943..16a8588 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -149,8 +149,6 @@ namespace OpenSim.Region.Framework.Scenes #region Fields - public bool SuppressFinalizerLogging = false; - public bool AllowedDrop; public bool DIE_AT_EDGE; @@ -352,18 +350,15 @@ namespace OpenSim.Region.Framework.Scenes #endregion Fields - ~SceneObjectPart() - { - if (SuppressFinalizerLogging) - return; - +// ~SceneObjectPart() +// { // Console.WriteLine( // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); - m_log.DebugFormat( - "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", - Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); - } +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", +// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); +// } #region Constructors -- cgit v1.1 From 1dca94c72fabf06da4d85d6acad5894dabe79c5a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2012 20:10:38 +0100 Subject: don't subscribe collision events for nonphysical parts only because of collision sounds. Let them be passive --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 16a8588..735bd32 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4917,7 +4917,7 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; - bool hassound = (CollisionSoundType >= 0 && !VolumeDetectActive); + bool hassound = (!VolumeDetectActive && CollisionSoundType >= 0 && ((Flags & PrimFlags.Physics) != 0)); scriptEvents CombinedEvents = AggregateScriptEvents; -- cgit v1.1 From c1a0c7fad17bb2aead1539b61fe82fee16686190 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Aug 2012 23:09:32 +0200 Subject: Fix bad child prim permissions that can make objects change perms after rezzing --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ce652b4..ed626d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4487,6 +4487,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void ClonePermissions(SceneObjectPart source) + { + bool update = false; + + if (BaseMask != source.BaseMask || + OwnerMask != source.OwnerMask || + GroupMask != source.GroupMask || + EveryoneMask != source.EveryoneMask || + NextOwnerMask != source.NextOwnerMask) + update = true; + + BaseMask = source.BaseMask; + OwnerMask = source.OwnerMask; + GroupMask = source.GroupMask; + EveryoneMask = source.EveryoneMask; + NextOwnerMask = source.NextOwnerMask; + + if (update) + SendFullUpdateToAllClients(); + } + public bool IsHingeJoint() { // For now, we use the NINJA naming scheme for identifying joints. -- cgit v1.1 From ef6e007a4c7301dbd7a1a0392a07664e7034201b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 28 Aug 2012 03:21:03 +0100 Subject: [possible still very broken] mess around keyframes. timer events threads overlaps, some null objects exceptions, region crossing... --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ed626d0..bf5fc99 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -769,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes { m_groupPosition = value; PhysicsActor actor = PhysActor; - if (actor != null) + if (actor != null && ParentGroup.Scene.PhysicsScene != null) { try { @@ -3408,6 +3408,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendTerseUpdateToAllClients() { + if (ParentGroup == null || ParentGroup.Scene == null) + return; + ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) { SendTerseUpdateToClient(client); -- cgit v1.1 From c821153a4fcc0a0d806d2c9be63cf48494e4dd06 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 30 Aug 2012 00:15:46 +0100 Subject: [possible still bad] make use of keyframemotion.copy on sop.copy, replacing fromdata(seralize). for now its called with null group since sop.copy() hasn't usable new group information, so for copied keyframes be fully operational UpdateSceneObject(newgroup) needs to be called on them. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bf5fc99..4788a24 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2110,6 +2110,9 @@ namespace OpenSim.Region.Framework.Scenes Array.Copy(Shape.ExtraParams, extraP, extraP.Length); dupe.Shape.ExtraParams = extraP; + if (KeyframeMotion != null) + dupe.KeyframeMotion = KeyframeMotion.Copy(null); + if (userExposed) { if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) -- cgit v1.1 From a7281003d85b6e9620d02387d4d9a42dcae27b24 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 30 Aug 2012 01:30:56 +0100 Subject: move keyframemotion.copy from sop.copy to sog.copy, where there is newgroup information avaiable. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4788a24..56d289f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2110,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes Array.Copy(Shape.ExtraParams, extraP, extraP.Length); dupe.Shape.ExtraParams = extraP; - if (KeyframeMotion != null) - dupe.KeyframeMotion = KeyframeMotion.Copy(null); + // safeguard actual copy is done in sog.copy + dupe.KeyframeMotion = null; if (userExposed) { -- cgit v1.1 From a5d969d92f906b035da1a0489a7e4163d3e43aad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 23 Sep 2012 20:57:36 +0200 Subject: Comment out asset error for sculpts/meshes. If an asset is missing it's missing. We can't put it back so we don't need to know. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56d289f..e6ad89c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2146,10 +2146,10 @@ namespace OpenSim.Region.Framework.Scenes { if (asset != null) SculptTextureCallback(asset); - else - m_log.WarnFormat( - "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", - Name, UUID, id); +// else +// m_log.WarnFormat( +// "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", +// Name, UUID, id); } /// -- cgit v1.1 From 9eca154bced7423867e8f9597b8baf214de79087 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 26 Sep 2012 23:17:21 +0100 Subject: Make it possible to rescale SOGs when they are not in a scene. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4af508e..44573eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2972,16 +2972,20 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { - scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); - scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); - scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); - PhysicsActor pa = PhysActor; - if (pa != null && pa.IsPhysical) + + if (ParentGroup.Scene != null) { - scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); - scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); - scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); + scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); + scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); + scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); + + if (pa != null && pa.IsPhysical) + { + scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); + scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); + scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); + } } // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); -- cgit v1.1 From 9988558ec16144f1a69b666d39428cda4c0849c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 3 Oct 2012 23:14:56 +0100 Subject: meshworker basic replacement of SOP CheckSculptAndLoad ( for now disabled for all physics engines) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e6ad89c..1bddf22 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4902,6 +4902,8 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); + return; + if (ParentGroup.IsDeleted) return; -- cgit v1.1 From 78ce7a0a04dc5ce3212acfb0e88a3a5a1b876100 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Oct 2012 01:20:52 +0100 Subject: [DANGER UNTESTED] ODE mesh assets. Other plugins will not do meshs/sculpts now --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1bddf22..633cd3b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1095,9 +1095,9 @@ namespace OpenSim.Region.Framework.Scenes { actor.Size = m_shape.Scale; - if (Shape.SculptEntry) - CheckSculptAndLoad(); - else +// if (Shape.SculptEntry) +// CheckSculptAndLoad(); +// else ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } } @@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Framework.Scenes else { PhysActor.PhysicsShapeType = m_physicsShapeType; - if (Shape.SculptEntry) - CheckSculptAndLoad(); +// if (Shape.SculptEntry) +// CheckSculptAndLoad(); } if (ParentGroup != null) @@ -2115,12 +2115,13 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) { +/* if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) { ParentGroup.Scene.AssetService.Get( dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived); } - +*/ bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); dupe.DoPhysicsPropertyUpdate(UsePhysics, true); // dupe.UpdatePhysicsSubscribedEvents(); // not sure... @@ -2142,6 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes /// ID of asset received /// Register /// +/* protected void AssetReceived(string id, Object sender, AssetBase asset) { if (asset != null) @@ -2151,7 +2153,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", // Name, UUID, id); } - +*/ /// /// Do a physics property update for a NINJA joint. /// @@ -2341,9 +2343,9 @@ namespace OpenSim.Region.Framework.Scenes // If this part is a sculpt then delay the physics update until we've asynchronously loaded the // mesh data. - if (Shape.SculptEntry) - CheckSculptAndLoad(); - else +// if (Shape.SculptEntry) +// CheckSculptAndLoad(); +// else ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } @@ -3125,6 +3127,7 @@ namespace OpenSim.Region.Framework.Scenes /// Set sculpt and mesh data, and tell the physics engine to process the change. /// /// The mesh itself. +/* public void SculptTextureCallback(AssetBase texture) { if (m_shape.SculptEntry) @@ -3152,7 +3155,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - +*/ /// /// Send a full update to the client for the given part /// @@ -4377,7 +4380,7 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { m_shape.ReadInUpdateExtraParam(type, inUse, data); - +/* if (type == 0x30) { if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero) @@ -4385,7 +4388,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.Scene.AssetService.Get(m_shape.SculptTexture.ToString(), this, AssetReceived); } } - +*/ if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; @@ -4793,9 +4796,9 @@ namespace OpenSim.Region.Framework.Scenes } } - if (Shape.SculptEntry) - CheckSculptAndLoad(); - else +// if (Shape.SculptEntry) +// CheckSculptAndLoad(); +// else ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); if (!building) @@ -4898,6 +4901,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// When the physics engine has finished with it, the sculpt data is discarded to save memory. /// +/* public void CheckSculptAndLoad() { // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); @@ -4925,7 +4929,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - +*/ /// /// Update the texture entry for this part. /// -- cgit v1.1 From 48d8fbc9aedb3247a1dfd25be1b7dfbdd8719790 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Oct 2012 08:53:55 +0100 Subject: bug fix + make costs visible for testing --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 633cd3b..66d85c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1583,7 +1583,9 @@ namespace OpenSim.Region.Framework.Scenes float cost = 0.1f; if (PhysActor != null) -// cost += PhysActor.Cost; + cost = PhysActor.PhysicsCost; + else + cost = 0.1f; if ((Flags & PrimFlags.Physics) != 0) cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3 @@ -1596,9 +1598,12 @@ namespace OpenSim.Region.Framework.Scenes { get { - - - return 0.1f; + float cost; + if (PhysActor != null) + cost = PhysActor.StreamCost; + else + cost = 1.0f; + return 1.0f; } } -- cgit v1.1 From 8894f4ad7735fc0a37fd62c89467163f6ec503cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Oct 2012 01:34:32 +0200 Subject: Change permissions on child prim inventory items when god mode "force permissive" is used. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e6ad89c..c2d4764 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4460,7 +4460,7 @@ namespace OpenSim.Region.Framework.Scenes if (god) { BaseMask = ApplyMask(BaseMask, set, mask); - Inventory.ApplyGodPermissions(_baseMask); + Inventory.ApplyGodPermissions(BaseMask); } break; @@ -4479,7 +4479,7 @@ namespace OpenSim.Region.Framework.Scenes case 16: NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & baseMask; - // Prevent the client from creating no mod, no copy + // Prevent the client from creating no copy, no transfer // objects if ((NextOwnerMask & (uint)PermissionMask.Copy) == 0) NextOwnerMask |= (uint)PermissionMask.Transfer; -- cgit v1.1 From d554c0d574f9c4763df0bbff931de0f944db53a5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Oct 2012 01:37:59 +0100 Subject: normalize quaternion.Slerp outputs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 66d85c4..1857757 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5202,6 +5202,7 @@ namespace OpenSim.Region.Framework.Scenes } Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); + rot.Normalize(); UpdateRotation(rot); m_APIDIterations--; -- cgit v1.1 From aba078c93f4966cf6be10fc02228323843b9249e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 14 Oct 2012 17:32:46 +0200 Subject: Fix perms when linking an object. Set root part perms to the perms of the link set to make the build floater behave consistently. Fixes permissions exploit introduced on 23 August. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c2d4764..3274cbd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4497,20 +4497,20 @@ namespace OpenSim.Region.Framework.Scenes { bool update = false; - if (BaseMask != source.BaseMask || - OwnerMask != source.OwnerMask || - GroupMask != source.GroupMask || - EveryoneMask != source.EveryoneMask || - NextOwnerMask != source.NextOwnerMask) - update = true; - - BaseMask = source.BaseMask; - OwnerMask = source.OwnerMask; - GroupMask = source.GroupMask; - EveryoneMask = source.EveryoneMask; - NextOwnerMask = source.NextOwnerMask; - - if (update) + uint prevOwnerMask = OwnerMask; + uint prevGroupMask = GroupMask; + uint prevEveryoneMask = EveryoneMask; + uint prevNextOwnerMask = NextOwnerMask; + + OwnerMask = source.OwnerMask & BaseMask; + GroupMask = source.GroupMask & BaseMask; + EveryoneMask = source.EveryoneMask & BaseMask; + NextOwnerMask = source.NextOwnerMask & BaseMask; + + if (OwnerMask != prevOwnerMask || + GroupMask != prevGroupMask || + EveryoneMask != prevEveryoneMask || + NextOwnerMask != prevNextOwnerMask) SendFullUpdateToAllClients(); } -- cgit v1.1 From d15d71a7efd2e1d3510111cbc9e617fc113fc29c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Oct 2012 01:28:03 +0000 Subject: Put back the collision sound shim into SOP --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b7f4291..5714fdd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2864,6 +2864,35 @@ namespace OpenSim.Region.Framework.Scenes SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); } + // The Collision sounds code calls this + public void SendCollisionSound(UUID soundID, double volume, Vector3 position) + { + if (soundID == UUID.Zero) + return; + + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule == null) + return; + + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + int now = Util.EnvironmentTickCount(); + if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) + return; + + LastColSoundSentTime = now; + + UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID parentID = ParentGroup.UUID; + ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); + } + public void PhysicsOutOfBounds(Vector3 pos) { m_log.Error("[PHYSICS]: Physical Object went out of bounds."); -- cgit v1.1 From 5328808b1825ef7d73809c8ddd67542ee05bf575 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Oct 2012 21:19:00 +0100 Subject: Make sure we're not accessing a physics scene if we're not in one yet. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 49b771f..165dd85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -813,7 +813,7 @@ namespace OpenSim.Region.Framework.Scenes actor.Orientation = GetWorldRotation(); // Tell the physics engines that this prim changed. - if (ParentGroup.Scene != null) + if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } -- cgit v1.1 From 949da1d4af77247786b00041bc0d1732617b7286 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 9 Jan 2013 20:07:21 +0100 Subject: Change IsRoot to use ReferenceEquals to prevent operator == messiness --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2191cfa..b62667f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool IsRoot { - get { return ParentGroup.RootPart == this; } + get { return Object.ReferenceEquals(ParentGroup.RootPart, this); } } /// -- cgit v1.1 From d7f0bf04f6b69d7ea616f02d3f7f4381debda00e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 11 Jan 2013 16:24:48 +0000 Subject: update the last information sent in terse updates where they are sent to all clients and not only on Scheduled sends --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2191cfa..ff4ae85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool IsRoot { - get { return ParentGroup.RootPart == this; } + get { return Object.ReferenceEquals(ParentGroup.RootPart, this); } } /// @@ -319,7 +319,7 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastVelocity; protected Vector3 m_lastAcceleration; protected Vector3 m_lastAngularVelocity; - protected int m_lastTerseSent; + protected int m_lastUpdateSentTime; protected float m_buoyancy = 0.0f; protected Vector3 m_force; protected Vector3 m_torque; @@ -3198,6 +3198,14 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) { SendFullUpdate(avatar.ControllingClient); @@ -3271,17 +3279,10 @@ namespace OpenSim.Region.Framework.Scenes Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || - Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) + Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) { SendTerseUpdateToAllClients(); - // Update the "last" values - m_lastPosition = OffsetPosition; - m_lastRotation = RotationOffset; - m_lastVelocity = Velocity; - m_lastAcceleration = Acceleration; - m_lastAngularVelocity = AngularVelocity; - m_lastTerseSent = Environment.TickCount; } break; } @@ -3302,6 +3303,14 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.Scene == null) return; + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) { SendTerseUpdateToClient(client); -- cgit v1.1 From de49440839e905cc4b3668962be96f8e274704d0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 Jan 2013 22:17:10 +0000 Subject: dont send a full grp update on stopmovetotarget. just a rootpart terse --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ff4ae85..8528edc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3760,7 +3760,7 @@ namespace OpenSim.Region.Framework.Scenes { ParentGroup.stopMoveToTarget(); - ParentGroup.ScheduleGroupForTerseUpdate(); +// ParentGroup.ScheduleGroupForTerseUpdate(); //ParentGroup.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 6aa876a83b08390ab057eb012fd2c730010f79d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 05b69c1..415a82b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1736,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public float Bounciness + public float Restitution { get { return m_bounce; } set @@ -4494,8 +4494,8 @@ namespace OpenSim.Region.Framework.Scenes GravityModifier = physdata.GravitationModifier; if(Friction != physdata.Friction) Friction = physdata.Friction; - if(Bounciness != physdata.Bounce) - Bounciness = physdata.Bounce; + if(Restitution != physdata.Bounce) + Restitution = physdata.Bounce; } /// /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. -- cgit v1.1 From f954c53ddb009009e386a4046857cc20d0fd656c Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 6 Mar 2013 17:02:53 -0500 Subject: * Separate two if trees that got merged into one if tree with borked logic. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7cab841..e22cf47 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4574,7 +4574,8 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup.RootPart == this) AngularVelocity = new Vector3(0, 0, 0); } - else if (SetVD != wasVD) + + else { if (ParentGroup.Scene.CollidablePrims) { @@ -4620,9 +4621,31 @@ namespace OpenSim.Region.Framework.Scenes UpdatePhysicsSubscribedEvents(); } } - + if (SetVD) + { + // If the above logic worked (this is urgent candidate to unit tests!) + // we now have a physicsactor. + // Defensive programming calls for a check here. + // Better would be throwing an exception that could be catched by a unit test as the internal + // logic should make sure, this Physactor is always here. + if (pa != null) + { + pa.SetVolumeDetect(1); + AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active + VolumeDetectActive = true; + } // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); + } + else if (SetVD != wasVD) + { + // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like + // (mumbles, well, at least if you have infinte CPU powers :-)) + if (pa != null) + pa.SetVolumeDetect(0); + RemFlag(PrimFlags.Phantom); + VolumeDetectActive = false; + } // and last in case we have a new actor and not building if (ParentGroup != null) -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ffde415..9265805 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -43,6 +43,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Physics.Manager; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes { -- cgit v1.1 From 4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 31 Mar 2013 20:25:32 +0200 Subject: Export permission, part two. Setting export perms for textures and clothing works. Setting perms for prims also works but they don't propagate correctly yet. NOT FOR PRODUCTIN USE. Your database will need to be updated before you can use this! --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9265805..c2f0792 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -470,8 +470,8 @@ namespace OpenSim.Region.Framework.Scenes private uint _category; private Int32 _creationDate; private uint _parentID = 0; - private uint _baseMask = (uint)PermissionMask.All; - private uint _ownerMask = (uint)PermissionMask.All; + private uint _baseMask = (uint)(PermissionMask.All | PermissionMask.Export); + private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export); private uint _groupMask = (uint)PermissionMask.None; private uint _everyoneMask = (uint)PermissionMask.None; private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); @@ -4319,10 +4319,10 @@ namespace OpenSim.Region.Framework.Scenes public void TrimPermissions() { - BaseMask &= (uint)PermissionMask.All; - OwnerMask &= (uint)PermissionMask.All; + BaseMask &= (uint)(PermissionMask.All | PermissionMask.Export); + OwnerMask &= (uint)(PermissionMask.All | PermissionMask.Export); GroupMask &= (uint)PermissionMask.All; - EveryoneMask &= (uint)PermissionMask.All; + EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export); NextOwnerMask &= (uint)PermissionMask.All; } @@ -4425,10 +4425,22 @@ namespace OpenSim.Region.Framework.Scenes baseMask; break; case 8: + // Trying to set export permissions - extra checks + if (set && (mask & (uint)PermissionMask.Export) != 0) + { + if ((OwnerMask & (uint)PermissionMask.Export) == 0 || (BaseMask & (uint)PermissionMask.Export) == 0 || (NextOwnerMask & (uint)PermissionMask.All) != (uint)PermissionMask.All) + mask &= ~(uint)PermissionMask.Export; + } EveryoneMask = ApplyMask(EveryoneMask, set, mask) & baseMask; break; case 16: + // Force full perm if export + if ((EveryoneMask & (uint)PermissionMask.Export) != 0) + { + NextOwnerMask = (uint)PermissionMask.All; + break; + } NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & baseMask; // Prevent the client from creating no copy, no transfer @@ -5225,9 +5237,12 @@ namespace OpenSim.Region.Framework.Scenes public void ApplyNextOwnerPermissions() { - BaseMask &= NextOwnerMask; + // Export needs to be preserved in the base and everyone + // mask, but removed in the owner mask as a next owner + // can never change the export status + BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; OwnerMask &= NextOwnerMask; - EveryoneMask &= NextOwnerMask; + EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; Inventory.ApplyNextOwnerPermissions(); } -- cgit v1.1 From dc717303d4a361815e84312ce1c66528b58de2e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Jul 2014 01:15:33 +0100 Subject: replace old Attachoffset by AttachedPos. Comented out possible merge artifacts --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ce9baaa..ab1d2bd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -251,9 +251,6 @@ namespace OpenSim.Region.Framework.Scenes public byte AttachPoint = 0; [XmlIgnore] - public Vector3 AttachOffset = Vector3.Zero; - - [XmlIgnore] public Quaternion AttachRotation = Quaternion.Identity; [XmlIgnore] -- cgit v1.1 From 32b060a608d2bdb007f0d1fb65251f1e1fd5f3c5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Jul 2014 05:54:51 +0100 Subject: physics engine cannot change internal positions of linksets, at least not in teaseupdates --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ab1d2bd..fe1f00b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2956,7 +2956,7 @@ namespace OpenSim.Region.Framework.Scenes } //ParentGroup.RootPart.m_groupPosition = newpos; } - +/* ubit: there are no flexible links if (pa != null && ParentID != 0 && ParentGroup != null) { // Special case where a child object is requesting property updates. @@ -2976,7 +2976,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("{0} PhysicsRequestingTerseUpdate child: pos={1}, rot={2}, offPos={3}, offRot={4}", // "[SCENE OBJECT PART]", pa.Position, pa.Orientation, m_offsetPosition, RotationOffset); } - +*/ ScheduleTerseUpdate(); } -- cgit v1.1 From 243499ea4e10cb90f863199b83cd299afbd46c28 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Jul 2014 01:11:18 +0100 Subject: send updates on selected attachments as sl ( warinin if reverted then a fix is needed elsewhere since the changes are never sent) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fe1f00b..055473d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3289,9 +3289,9 @@ namespace OpenSim.Region.Framework.Scenes return; // Suppress full updates during attachment editing - // - if (ParentGroup.IsSelected && ParentGroup.IsAttachment) - return; + // sl Does send them + // if (ParentGroup.IsSelected && ParentGroup.IsAttachment) + // return; if (ParentGroup.IsDeleted) return; -- cgit v1.1 From 01e381fa33a7bd8ca9141a73f8dca0ff7832aaca Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:07:23 +0200 Subject: Make texture anims work right on singu --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 31 +++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 055473d..a292c79 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1878,22 +1878,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + { + byte[] data = new byte[16]; + int pos = 0; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); - m_TextureAnimation = data; + m_TextureAnimation = data; + } + else + { + m_TextureAnimation = Utils.EmptyBytes; + } } public void AdjustSoundGain(double volume) -- cgit v1.1 From 519df0d2a3e63190a56062859f79e5fabab23e26 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:30:09 +0200 Subject: Fix a condition check --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a292c79..98ea880 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1878,7 +1878,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON { byte[] data = new byte[16]; int pos = 0; -- cgit v1.1 From 0295e6822dd6408b6dc6580b4a7a92b0f057d4b8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Aug 2014 20:01:07 +0100 Subject: some cleanup ( well or not ) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 73 ++++++++++++++++++++-- 1 file changed, 67 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 98ea880..0930820 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -862,7 +862,8 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 offset = (m_offsetPosition - oldpos); av.AbsolutePosition += offset; - av.SendAvatarDataToAllAgents(); +// av.SendAvatarDataToAllAgents(); + av.SendTerseUpdateToAllClients(); } } } @@ -3257,7 +3258,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Send a full update for this part to all clients. /// - public void SendFullUpdateToAllClients() + public void SendFullUpdateToAllClientsInternal() { if (ParentGroup == null) return; @@ -3276,6 +3277,36 @@ namespace OpenSim.Region.Framework.Scenes }); } + public void SendFullUpdateToAllClients() + { + if (ParentGroup == null) + return; + + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + + if (ParentGroup.IsAttachment) + { + ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); + if (sp != null) + { + sp.SendAttachmentUpdate(this, UpdateRequired.FULL); + } + } + else + { + ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) + { + SendFullUpdate(avatar.ControllingClient); + }); + } + } + /// /// Sends a full update to the client /// @@ -3345,24 +3376,24 @@ namespace OpenSim.Region.Framework.Scenes !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) { - SendTerseUpdateToAllClients(); - + SendTerseUpdateToAllClientsInternal(); } break; } case UpdateRequired.FULL: { ClearUpdateSchedule(); - SendFullUpdateToAllClients(); + SendFullUpdateToAllClientsInternal(); break; } } } + /// /// Send a terse update to all clients /// - public void SendTerseUpdateToAllClients() + public void SendTerseUpdateToAllClientsInternal() { if (ParentGroup == null || ParentGroup.Scene == null) return; @@ -3381,6 +3412,36 @@ namespace OpenSim.Region.Framework.Scenes }); } + public void SendTerseUpdateToAllClients() + { + if (ParentGroup == null || ParentGroup.Scene == null) + return; + + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + + if (ParentGroup.IsAttachment) + { + ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); + if (sp != null) + { + sp.SendAttachmentUpdate(this, UpdateRequired.TERSE); + } + } + else + { + ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) + { + SendTerseUpdateToClient(client); + }); + } + } + public void SetAxisRotation(int axis, int rotate) { ParentGroup.SetAxisRotation(axis, rotate); -- cgit v1.1 From 1aa335078a15b176215df963980fdb1141494324 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Aug 2014 21:54:00 +0100 Subject: sop SendFullUpdate() goes by presence if it is a attachment --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0930820..6fbe732 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3237,7 +3237,19 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); - + + + if (ParentGroup.IsAttachment) + { + ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); + if (sp != null) + { + sp.SendAttachmentUpdate(this, UpdateRequired.FULL); + } + } + +/* this does nothing +SendFullUpdateToClient(remoteClient, Position) ignores position parameter if (IsRoot) { if (ParentGroup.IsAttachment) @@ -3249,6 +3261,7 @@ namespace OpenSim.Region.Framework.Scenes SendFullUpdateToClient(remoteClient, AbsolutePosition); } } +*/ else { SendFullUpdateToClient(remoteClient); -- cgit v1.1 From cf1d58d164cc536f13c1d9ab2b1aeac98e802003 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Sep 2014 15:16:13 +0100 Subject: do not send objectproprieties on sop.SetGroup(). I many cases this will arrive before creating the object in viewer with respective full update --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6fbe732..43ae880 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3807,8 +3807,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter // Name, groupID, OwnerID); GroupID = groupID; - if (client != null) - SendPropertiesToClient(client); +// if (client != null) +// SendPropertiesToClient(client); UpdateFlag = UpdateRequired.FULL; } -- cgit v1.1 From 79e47eb60e304fba1bdf04b57d374a843c250ef8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 Sep 2014 23:32:55 +0100 Subject: some changes in link/unlink code, bypassing complex variables set methods --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 43ae880..de07131 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -771,9 +771,20 @@ namespace OpenSim.Region.Framework.Scenes set { m_damage = value; } } + + + + public void setGroupPosition(Vector3 pos) + { + m_groupPosition = pos; + } + /// /// The position of the entire group that this prim belongs to. /// + /// + + public Vector3 GroupPosition { get @@ -811,7 +822,7 @@ namespace OpenSim.Region.Framework.Scenes // Root prim actually goes at Position if (ParentID == 0) { - actor.Position = value; + actor.Position = value; } else { @@ -832,6 +843,11 @@ namespace OpenSim.Region.Framework.Scenes } } + public void setOffsetPosition(Vector3 pos) + { + m_offsetPosition = pos; + } + public Vector3 OffsetPosition { get { return m_offsetPosition; } @@ -890,6 +906,11 @@ namespace OpenSim.Region.Framework.Scenes } } + public void setRotationOffset(Quaternion q) + { + m_rotationOffset = q; + } + public Quaternion RotationOffset { get -- cgit v1.1 From 6d2cdd31fe2bc330485cc519133e6d38562255ba Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 Sep 2014 23:59:05 +0100 Subject: populate collision lists with LinkNumber, and detected structure in Xengine --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index de07131..6daa109 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2707,6 +2707,7 @@ namespace OpenSim.Region.Framework.Scenes detobj.velVector = obj.Velocity; detobj.colliderType = 0; detobj.groupUUID = obj.GroupID; + detobj.linkNumber = LinkNum; // pass my link number return detobj; } @@ -2722,6 +2723,7 @@ namespace OpenSim.Region.Framework.Scenes detobj.velVector = av.Velocity; detobj.colliderType = 0; detobj.groupUUID = av.ControllingClient.ActiveGroupId; + detobj.linkNumber = LinkNum; // pass my link number return detobj; } @@ -2737,6 +2739,7 @@ namespace OpenSim.Region.Framework.Scenes detobj.velVector = Vector3.Zero; detobj.colliderType = 0; detobj.groupUUID = UUID.Zero; + detobj.linkNumber = LinkNum; // pass my link number not sure needed.. but no harm return detobj; } -- cgit v1.1 From 57caf468e8f999db49a383cf22e1f665488ca36f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 4 Oct 2014 08:30:04 +0100 Subject: bug fix: resend part targetOmega on deSelect --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6daa109..3fc741c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -666,6 +666,8 @@ namespace OpenSim.Region.Framework.Scenes m_isSelected = value; if (ParentGroup != null) ParentGroup.PartSelectChanged(value); + if (!m_isSelected && m_angularVelocity != Vector3.Zero) + ScheduleTerseUpdate(); } } -- cgit v1.1 From c0a75fcc038c50047e7fe3739f7b53d0e1310b03 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 6 Oct 2014 00:17:41 +0100 Subject: fix targetOmega resend on deselect on the right place, can't be at sop but packethandlers --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3fc741c..d5377d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -666,8 +666,7 @@ namespace OpenSim.Region.Framework.Scenes m_isSelected = value; if (ParentGroup != null) ParentGroup.PartSelectChanged(value); - if (!m_isSelected && m_angularVelocity != Vector3.Zero) - ScheduleTerseUpdate(); + } } -- cgit v1.1 From 639f128d2cace3a8efd10ffe9b9eba4d85ee7b1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 01:27:43 +0100 Subject: some cleanup, localID coerence fix.. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d5377d0..91293c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// True if the duplicate will immediately be in the scene, false otherwise /// - public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) + public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) { SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); dupe.m_shape = m_shape.Copy(); @@ -2178,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes } // Move afterwards ResetIDs as it clears the localID - dupe.LocalId = localID; + dupe.LocalId = plocalID; // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe.LastOwnerID = OwnerID; @@ -2208,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes } if (dupe.PhysActor != null) - dupe.PhysActor.LocalID = localID; + dupe.PhysActor.LocalID = plocalID; ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); -- cgit v1.1 From 9f18e3ba80a6469b7ff03c7cca595a0a3b999592 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 22 Mar 2015 21:53:02 -0700 Subject: Varregion: first cut at removing Border class checks for region crossings. Added Scene.PositionIsInCurrentRegion(pos) to sense when new position needs some crossing work. Many changes made to EntityTransferModule to accomodate new crossing sense logic. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 91293c4..8979659 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2979,10 +2979,7 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); - if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) - || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) - || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) - || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) + if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) { ParentGroup.AbsolutePosition = newpos; return; -- cgit v1.1