aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs54
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs11
6 files changed, 124 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2c7cd40..ea6174a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -701,22 +701,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
701 sp.RemoveAttachment(so); 701 sp.RemoveAttachment(so);
702 so.FromItemID = UUID.Zero; 702 so.FromItemID = UUID.Zero;
703 703
704 so.AttachedAvatar = UUID.Zero;
705 so.ClearPartAttachmentData();
706
704 SceneObjectPart rootPart = so.RootPart; 707 SceneObjectPart rootPart = so.RootPart;
708
709 rootPart.SetParentLocalId(0);
705 so.AbsolutePosition = absolutePos; 710 so.AbsolutePosition = absolutePos;
706 if (absoluteRot != Quaternion.Identity) 711 if (absoluteRot != Quaternion.Identity)
707 { 712 {
708 so.UpdateGroupRotationR(absoluteRot); 713 so.UpdateGroupRotationR(absoluteRot);
709 } 714 }
710 so.AttachedAvatar = UUID.Zero; 715
711 rootPart.SetParentLocalId(0); 716// rootPart.RemFlag(PrimFlags.TemporaryOnRez);
712 so.ClearPartAttachmentData(); 717// rootPart.AddFlag(PrimFlags.Phantom);
713 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false); 718
719// rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false);
720
721 // not physical, not temporary, phaton, not volume detector
722 so.UpdatePrimFlags(rootPart.LocalId,false,false,true,rootPart.VolumeDetectActive);
723
714 so.HasGroupChanged = true; 724 so.HasGroupChanged = true;
715 rootPart.Rezzed = DateTime.Now; 725 rootPart.Rezzed = DateTime.Now;
716 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
717 so.AttachToBackup(); 726 so.AttachToBackup();
718 m_scene.EventManager.TriggerParcelPrimCountTainted(); 727 m_scene.EventManager.TriggerParcelPrimCountTainted();
719 rootPart.ScheduleFullUpdate(); 728
720 rootPart.ClearUndoState(); 729 rootPart.ClearUndoState();
721 730
722 List<UUID> uuids = new List<UUID>(); 731 List<UUID> uuids = new List<UUID>();
@@ -729,6 +738,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
729 738
730 // Attach (NULL) stops scripts. We don't want that. Resume them. 739 // Attach (NULL) stops scripts. We don't want that. Resume them.
731 so.ResumeScripts(); 740 so.ResumeScripts();
741 so.ScheduleGroupForTerseUpdate();
742 so.RootPart.ScheduleFullUpdate();
732 } 743 }
733 744
734 public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) 745 public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so)
@@ -907,8 +918,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
907 918
908 so.AttachedAvatar = sp.UUID; 919 so.AttachedAvatar = sp.UUID;
909 920
910 if (so.RootPart.PhysActor != null) 921// if (so.RootPart.PhysActor != null)
911 so.RootPart.RemoveFromPhysics(); 922// so.RootPart.RemoveFromPhysics();
923
924 foreach (SceneObjectPart part in so.Parts)
925 {
926 if (part.KeyframeMotion != null)
927 {
928 part.KeyframeMotion.Delete();
929 part.KeyframeMotion = null;
930 }
931
932// if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
933// {
934// PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
935// }
936// else
937 if (part.PhysActor != null)
938 {
939 if(part.PhysActor.IsPhysical)
940 so.Scene.RemovePhysicalPrim(1);
941 part.RemoveFromPhysics();
942 }
943 }
944
945 so.RootPart.Flags &= ~PrimFlags.Physics;
912 946
913 so.AbsolutePosition = attachOffset; 947 so.AbsolutePosition = attachOffset;
914 so.RootPart.AttachedPos = attachOffset; 948 so.RootPart.AttachedPos = attachOffset;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 8634a3a..e003a59 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2705,12 +2705,17 @@ namespace OpenSim.Region.Framework.Scenes
2705 return; 2705 return;
2706 } 2706 }
2707 2707
2708 bool oldUsePhysics = (root.Flags & PrimFlags.Physics) != 0;
2708 m_sceneGraph.LinkObjects(root, children); 2709 m_sceneGraph.LinkObjects(root, children);
2709 2710
2710 ScenePresence sp; 2711 ScenePresence sp;
2711 if (TryGetScenePresence(agentId, out sp)) 2712 if (TryGetScenePresence(agentId, out sp))
2712 { 2713 {
2713 root.SendPropertiesToClient(sp.ControllingClient); 2714 root.SendPropertiesToClient(sp.ControllingClient);
2715 if (oldUsePhysics && (root.Flags & PrimFlags.Physics) == 0)
2716 {
2717 sp.ControllingClient.SendAlertMessage("Object physics canceled");
2718 }
2714 } 2719 }
2715 } 2720 }
2716 2721
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index aa81000..323b588 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -204,6 +204,12 @@ namespace OpenSim.Region.Framework.Scenes
204 /// </summary> 204 /// </summary>
205 public int m_linksetCapacity = 0; 205 public int m_linksetCapacity = 0;
206 206
207 /// <summary>
208 /// Max prims an Physical object will hold
209 /// </summary>
210 ///
211 public int m_linksetPhysCapacity = 5;
212
207 public bool m_clampPrimSize; 213 public bool m_clampPrimSize;
208 public bool m_trustBinaries; 214 public bool m_trustBinaries;
209 public bool m_allowScriptCrossings; 215 public bool m_allowScriptCrossings;
@@ -901,6 +907,9 @@ namespace OpenSim.Region.Framework.Scenes
901 m_linksetCapacity = RegionInfo.LinksetCapacity; 907 m_linksetCapacity = RegionInfo.LinksetCapacity;
902 } 908 }
903 909
910 m_linksetPhysCapacity = startupConfig.GetInt("LinksetPhysPrims", m_linksetPhysCapacity);
911
912
904 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 913 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
905 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 914 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
906 915
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index b0f8991..973891b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1547,6 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
1547 // VolumeDetect can't be set via UI and will always be off when a change is made there 1547 // VolumeDetect can't be set via UI and will always be off when a change is made there
1548 // now only change volume dtc if phantom off 1548 // now only change volume dtc if phantom off
1549 1549
1550 bool wantedPhys = UsePhysics;
1550 if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data 1551 if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
1551 { 1552 {
1552 bool vdtc; 1553 bool vdtc;
@@ -1563,10 +1564,17 @@ namespace OpenSim.Region.Framework.Scenes
1563 if (part != null) 1564 if (part != null)
1564 { 1565 {
1565 part.UpdateExtraPhysics(PhysData); 1566 part.UpdateExtraPhysics(PhysData);
1566 if (part.UpdatePhysRequired) 1567 if (part.UpdatePhysRequired && remoteClient != null)
1567 remoteClient.SendPartPhysicsProprieties(part); 1568 remoteClient.SendPartPhysicsProprieties(part);
1568 } 1569 }
1569 } 1570 }
1571
1572 if (wantedPhys != group.UsesPhysics && remoteClient != null)
1573 {
1574 remoteClient.SendAlertMessage("Object physics canceled because exceeds the limit of " +
1575 m_parentScene.m_linksetPhysCapacity + " physical prims with shape type not set to None");
1576 group.RootPart.ScheduleFullUpdate();
1577 }
1570 } 1578 }
1571 } 1579 }
1572 } 1580 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d3dd5d7..15349e3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -907,10 +907,10 @@ namespace OpenSim.Region.Framework.Scenes
907 return; 907 return;
908 } 908 }
909 IsSelected = partSelect; 909 IsSelected = partSelect;
910 if (!IsAttachment) 910// if (!IsAttachment)
911 { 911// {
912 ScheduleGroupForFullUpdate(); 912// ScheduleGroupForFullUpdate();
913 } 913// }
914 } 914 }
915 } 915 }
916 // PlaySoundMasterPrim no longer in use to remove 916 // PlaySoundMasterPrim no longer in use to remove
@@ -1712,7 +1712,9 @@ namespace OpenSim.Region.Framework.Scenes
1712 m_rootPart.SetParentLocalId(0); 1712 m_rootPart.SetParentLocalId(0);
1713 AttachmentPoint = (byte)0; 1713 AttachmentPoint = (byte)0;
1714 // must check if buildind should be true or false here 1714 // must check if buildind should be true or false here
1715 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); 1715// m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
1716 ApplyPhysics();
1717
1716 HasGroupChanged = true; 1718 HasGroupChanged = true;
1717 RootPart.Rezzed = DateTime.Now; 1719 RootPart.Rezzed = DateTime.Now;
1718 RootPart.RemFlag(PrimFlags.TemporaryOnRez); 1720 RootPart.RemFlag(PrimFlags.TemporaryOnRez);
@@ -2879,6 +2881,33 @@ namespace OpenSim.Region.Framework.Scenes
2879 return; 2881 return;
2880 } 2882 }
2881 2883
2884 // physical prims count limit
2885 // not very eficient :(
2886
2887 if (UsesPhysics && m_scene.m_linksetPhysCapacity > 0 && (PrimCount + objectGroup.PrimCount) >
2888 m_scene.m_linksetPhysCapacity)
2889 {
2890 int cntr = 0;
2891 foreach (SceneObjectPart part in Parts)
2892 {
2893 if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
2894 cntr++;
2895 }
2896 foreach (SceneObjectPart part in objectGroup.Parts)
2897 {
2898 if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
2899 cntr++;
2900 }
2901
2902 if (cntr > m_scene.m_linksetPhysCapacity)
2903 {
2904 // cancel physics
2905 RootPart.Flags &= ~PrimFlags.Physics;
2906 ApplyPhysics();
2907 }
2908 }
2909
2910
2882 // 'linkPart' == the root of the group being linked into this group 2911 // 'linkPart' == the root of the group being linked into this group
2883 SceneObjectPart linkPart = objectGroup.m_rootPart; 2912 SceneObjectPart linkPart = objectGroup.m_rootPart;
2884 2913
@@ -3477,8 +3506,12 @@ namespace OpenSim.Region.Framework.Scenes
3477 { 3506 {
3478 SceneObjectPart[] parts = m_parts.GetArray(); 3507 SceneObjectPart[] parts = m_parts.GetArray();
3479 3508
3480 if (Scene != null) 3509 if (Scene != null && UsePhysics)
3481 { 3510 {
3511 int maxprims = m_scene.m_linksetPhysCapacity;
3512 bool checkShape = (maxprims > 0 &&
3513 parts.Length > maxprims);
3514
3482 for (int i = 0; i < parts.Length; i++) 3515 for (int i = 0; i < parts.Length; i++)
3483 { 3516 {
3484 SceneObjectPart part = parts[i]; 3517 SceneObjectPart part = parts[i];
@@ -3489,6 +3522,15 @@ namespace OpenSim.Region.Framework.Scenes
3489 UsePhysics = false; // Reset physics 3522 UsePhysics = false; // Reset physics
3490 break; 3523 break;
3491 } 3524 }
3525
3526 if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
3527 {
3528 if (--maxprims < 0)
3529 {
3530 UsePhysics = false;
3531 break;
3532 }
3533 }
3492 } 3534 }
3493 } 3535 }
3494 3536
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f4809a7..1fb4c1b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1400,6 +1400,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1400 SceneObjectGroup group = m_host.ParentGroup; 1400 SceneObjectGroup group = m_host.ParentGroup;
1401 bool allow = true; 1401 bool allow = true;
1402 1402
1403 int maxprims = World.m_linksetPhysCapacity;
1404 bool checkShape = (maxprims > 0 && group.PrimCount > maxprims);
1405
1403 foreach (SceneObjectPart part in group.Parts) 1406 foreach (SceneObjectPart part in group.Parts)
1404 { 1407 {
1405 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) 1408 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
@@ -1407,6 +1410,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1407 allow = false; 1410 allow = false;
1408 break; 1411 break;
1409 } 1412 }
1413 if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
1414 {
1415 if (--maxprims < 0)
1416 {
1417 allow = false;
1418 break;
1419 }
1420 }
1410 } 1421 }
1411 1422
1412 if (!allow) 1423 if (!allow)