diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
19 files changed, 1840 insertions, 884 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 1e9711d..827f91e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -3161,7 +3161,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3161 | { | 3161 | { |
3162 | foreach (Action<Scene> d in handler.GetInvocationList()) | 3162 | foreach (Action<Scene> d in handler.GetInvocationList()) |
3163 | { | 3163 | { |
3164 | m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoque {0}", d.Method.Name.ToString()); | 3164 | m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString()); |
3165 | try | 3165 | try |
3166 | { | 3166 | { |
3167 | d(s); | 3167 | d(s); |
diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs index 7ed80f6..9372366 100644 --- a/OpenSim/Region/Framework/Scenes/GodController.cs +++ b/OpenSim/Region/Framework/Scenes/GodController.cs | |||
@@ -246,17 +246,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | { | 246 | { |
247 | bool newstate = false; | 247 | bool newstate = false; |
248 | if(m_forceGodModeAlwaysOn) | 248 | if(m_forceGodModeAlwaysOn) |
249 | newstate = true; | 249 | newstate = m_viewergodlevel >= 200; |
250 | else | 250 | if(state != null) |
251 | { | 251 | { |
252 | if(state != null) | 252 | OSDMap s = (OSDMap)state; |
253 | { | ||
254 | OSDMap s = (OSDMap)state; | ||
255 | 253 | ||
256 | if (s.ContainsKey("ViewerUiIsGod")) | 254 | if (s.ContainsKey("ViewerUiIsGod")) |
257 | newstate = s["ViewerUiIsGod"].AsBoolean(); | 255 | newstate = s["ViewerUiIsGod"].AsBoolean(); |
258 | m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default | 256 | m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default |
259 | } | ||
260 | } | 257 | } |
261 | UpdateGodLevels(newstate); | 258 | UpdateGodLevels(newstate); |
262 | } | 259 | } |
@@ -264,6 +261,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | public void HasMovedAway() | 261 | public void HasMovedAway() |
265 | { | 262 | { |
266 | m_lastLevelToViewer = 0; | 263 | m_lastLevelToViewer = 0; |
264 | if(m_forceGodModeAlwaysOn) | ||
265 | { | ||
266 | m_viewergodlevel = m_rightsGodLevel; | ||
267 | m_godlevel = m_rightsGodLevel; | ||
268 | } | ||
267 | } | 269 | } |
268 | 270 | ||
269 | public int UserLevel | 271 | public int UserLevel |
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index e4aa196..d81d8a2 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -495,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
495 | 495 | ||
496 | m_group.RootPart.Velocity = Vector3.Zero; | 496 | m_group.RootPart.Velocity = Vector3.Zero; |
497 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 497 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
498 | m_skippedUpdates = 1000; | ||
498 | m_group.SendGroupRootTerseUpdate(); | 499 | m_group.SendGroupRootTerseUpdate(); |
499 | // m_group.RootPart.ScheduleTerseUpdate(); | 500 | // m_group.RootPart.ScheduleTerseUpdate(); |
500 | } | 501 | } |
@@ -517,6 +518,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | return; | 518 | return; |
518 | if (m_running && !m_waitingCrossing) | 519 | if (m_running && !m_waitingCrossing) |
519 | StartTimer(); | 520 | StartTimer(); |
521 | m_skippedUpdates = 1000; | ||
520 | } | 522 | } |
521 | } | 523 | } |
522 | 524 | ||
@@ -643,10 +645,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
643 | m_group.RootPart.Velocity = Vector3.Zero; | 645 | m_group.RootPart.Velocity = Vector3.Zero; |
644 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 646 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
645 | m_group.SendGroupRootTerseUpdate(); | 647 | m_group.SendGroupRootTerseUpdate(); |
646 | // m_group.RootPart.ScheduleTerseUpdate(); | 648 | |
647 | m_frames.Clear(); | 649 | m_frames.Clear(); |
648 | } | 650 | } |
649 | 651 | ||
652 | Vector3 m_lastPosUpdate; | ||
653 | Quaternion m_lastRotationUpdate; | ||
654 | Vector3 m_currentVel; | ||
655 | int m_skippedUpdates; | ||
656 | |||
650 | private void DoOnTimer(double tickDuration) | 657 | private void DoOnTimer(double tickDuration) |
651 | { | 658 | { |
652 | if (m_skipLoops > 0) | 659 | if (m_skipLoops > 0) |
@@ -665,6 +672,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | if (m_group.RootPart.Velocity != Vector3.Zero) | 672 | if (m_group.RootPart.Velocity != Vector3.Zero) |
666 | { | 673 | { |
667 | m_group.RootPart.Velocity = Vector3.Zero; | 674 | m_group.RootPart.Velocity = Vector3.Zero; |
675 | m_skippedUpdates = 1000; | ||
668 | m_group.SendGroupRootTerseUpdate(); | 676 | m_group.SendGroupRootTerseUpdate(); |
669 | } | 677 | } |
670 | return; | 678 | return; |
@@ -677,7 +685,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
677 | // retry to set the position that evtually caused the outbound | 685 | // retry to set the position that evtually caused the outbound |
678 | // if still outside region this will call startCrossing below | 686 | // if still outside region this will call startCrossing below |
679 | m_isCrossing = false; | 687 | m_isCrossing = false; |
688 | m_skippedUpdates = 1000; | ||
680 | m_group.AbsolutePosition = m_nextPosition; | 689 | m_group.AbsolutePosition = m_nextPosition; |
690 | |||
681 | if (!m_isCrossing) | 691 | if (!m_isCrossing) |
682 | { | 692 | { |
683 | StopTimer(); | 693 | StopTimer(); |
@@ -700,10 +710,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
700 | } | 710 | } |
701 | 711 | ||
702 | m_currentFrame = m_frames[0]; | 712 | m_currentFrame = m_frames[0]; |
703 | m_currentFrame.TimeMS += (int)tickDuration; | ||
704 | } | 713 | } |
705 | //force a update on a keyframe transition | ||
706 | m_nextPosition = m_group.AbsolutePosition; | 714 | m_nextPosition = m_group.AbsolutePosition; |
715 | m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition; | ||
716 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); | ||
717 | |||
718 | m_currentFrame.TimeMS += (int)tickDuration; | ||
707 | update = true; | 719 | update = true; |
708 | } | 720 | } |
709 | 721 | ||
@@ -712,7 +724,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
712 | // Do the frame processing | 724 | // Do the frame processing |
713 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; | 725 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; |
714 | 726 | ||
715 | if (remainingSteps <= 0.0) | 727 | if (remainingSteps <= 1.0) |
716 | { | 728 | { |
717 | m_group.RootPart.Velocity = Vector3.Zero; | 729 | m_group.RootPart.Velocity = Vector3.Zero; |
718 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 730 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
@@ -720,92 +732,71 @@ namespace OpenSim.Region.Framework.Scenes | |||
720 | m_nextPosition = (Vector3)m_currentFrame.Position; | 732 | m_nextPosition = (Vector3)m_currentFrame.Position; |
721 | m_group.AbsolutePosition = m_nextPosition; | 733 | m_group.AbsolutePosition = m_nextPosition; |
722 | 734 | ||
723 | // we are sending imediate updates, no doing force a extra terseUpdate | ||
724 | // m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); | ||
725 | |||
726 | m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation; | 735 | m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation; |
727 | 736 | ||
728 | lock (m_frames) | 737 | lock (m_frames) |
729 | { | 738 | { |
730 | m_frames.RemoveAt(0); | 739 | m_frames.RemoveAt(0); |
731 | if (m_frames.Count > 0) | 740 | if (m_frames.Count > 0) |
741 | { | ||
732 | m_currentFrame = m_frames[0]; | 742 | m_currentFrame = m_frames[0]; |
743 | m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition; | ||
744 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); | ||
745 | m_group.RootPart.Velocity = m_currentVel; | ||
746 | m_currentFrame.TimeMS += (int)tickDuration; | ||
747 | } | ||
748 | else | ||
749 | m_group.RootPart.Velocity = Vector3.Zero; | ||
733 | } | 750 | } |
734 | |||
735 | update = true; | 751 | update = true; |
736 | } | 752 | } |
737 | else | 753 | else |
738 | { | 754 | { |
739 | float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; | 755 | bool lastSteps = remainingSteps < 4; |
740 | bool lastStep = m_currentFrame.TimeMS <= tickDuration; | 756 | Vector3 currentPosition = m_group.AbsolutePosition; |
741 | 757 | Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; | |
742 | Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition; | 758 | motionThisFrame /= (float)remainingSteps; |
743 | Vector3 motionThisFrame = v / (float)remainingSteps; | 759 | |
744 | v = v * 1000 / m_currentFrame.TimeMS; | 760 | m_nextPosition = currentPosition + motionThisFrame; |
745 | 761 | ||
746 | m_nextPosition = m_group.AbsolutePosition + motionThisFrame; | 762 | Quaternion currentRotation = m_group.GroupRotation; |
747 | 763 | if ((Quaternion)m_currentFrame.Rotation != currentRotation) | |
748 | if (Vector3.Mag(motionThisFrame) >= 0.05f) | ||
749 | update = true; | ||
750 | |||
751 | //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration; | ||
752 | //m_log.DebugFormat("KeyframeMotion.OnTimer: step {0}/{1}, curPosition={2}, finalPosition={3}, motionThisStep={4} (scene {5})", | ||
753 | // totalSteps - remainingSteps + 1, totalSteps, m_group.AbsolutePosition, m_currentFrame.Position, motionThisStep, m_scene.RegionInfo.RegionName); | ||
754 | |||
755 | if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation) | ||
756 | { | 764 | { |
757 | Quaternion current = m_group.GroupRotation; | 765 | float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; |
758 | |||
759 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); | 766 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); |
760 | step.Normalize(); | 767 | step.Normalize(); |
761 | /* use simpler change detection | 768 | m_group.RootPart.RotationOffset = step; |
762 | * float angle = 0; | 769 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f |
763 | 770 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f | |
764 | float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W; | 771 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) |
765 | float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W; | ||
766 | float aa_bb = aa * bb; | ||
767 | |||
768 | if (aa_bb == 0) | ||
769 | { | ||
770 | angle = 0; | ||
771 | } | ||
772 | else | ||
773 | { | ||
774 | float ab = current.X * step.X + | ||
775 | current.Y * step.Y + | ||
776 | current.Z * step.Z + | ||
777 | current.W * step.W; | ||
778 | float q = (ab * ab) / aa_bb; | ||
779 | |||
780 | if (q > 1.0f) | ||
781 | { | ||
782 | angle = 0; | ||
783 | } | ||
784 | else | ||
785 | { | ||
786 | angle = (float)Math.Acos(2 * q - 1); | ||
787 | } | ||
788 | } | ||
789 | |||
790 | if (angle > 0.01f) | ||
791 | */ | ||
792 | if (Math.Abs(step.X - current.X) > 0.001f | ||
793 | || Math.Abs(step.Y - current.Y) > 0.001f | ||
794 | || Math.Abs(step.Z - current.Z) > 0.001f) | ||
795 | // assuming w is a dependente var | ||
796 | { | ||
797 | // m_group.UpdateGroupRotationR(step); | ||
798 | m_group.RootPart.RotationOffset = step; | ||
799 | |||
800 | //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); | ||
801 | update = true; | 772 | update = true; |
802 | } | ||
803 | } | 773 | } |
804 | } | ||
805 | 774 | ||
806 | if (update) | ||
807 | { | ||
808 | m_group.AbsolutePosition = m_nextPosition; | 775 | m_group.AbsolutePosition = m_nextPosition; |
776 | if(lastSteps) | ||
777 | m_group.RootPart.Velocity = Vector3.Zero; | ||
778 | else | ||
779 | m_group.RootPart.Velocity = m_currentVel; | ||
780 | |||
781 | if(!update && ( | ||
782 | lastSteps || | ||
783 | m_skippedUpdates * tickDuration > 0.5 || | ||
784 | Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || | ||
785 | Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || | ||
786 | Math.Abs(m_nextPosition.Z - currentPosition.Z) > 5f | ||
787 | )) | ||
788 | { | ||
789 | update = true; | ||
790 | } | ||
791 | else | ||
792 | m_skippedUpdates++; | ||
793 | |||
794 | } | ||
795 | if(update) | ||
796 | { | ||
797 | m_lastPosUpdate = m_nextPosition; | ||
798 | m_lastRotationUpdate = m_group.GroupRotation; | ||
799 | m_skippedUpdates = 0; | ||
809 | m_group.SendGroupRootTerseUpdate(); | 800 | m_group.SendGroupRootTerseUpdate(); |
810 | } | 801 | } |
811 | } | 802 | } |
@@ -850,6 +841,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
850 | if (m_group.RootPart.Velocity != Vector3.Zero) | 841 | if (m_group.RootPart.Velocity != Vector3.Zero) |
851 | { | 842 | { |
852 | m_group.RootPart.Velocity = Vector3.Zero; | 843 | m_group.RootPart.Velocity = Vector3.Zero; |
844 | m_skippedUpdates = 1000; | ||
853 | m_group.SendGroupRootTerseUpdate(); | 845 | m_group.SendGroupRootTerseUpdate(); |
854 | // m_group.RootPart.ScheduleTerseUpdate(); | 846 | // m_group.RootPart.ScheduleTerseUpdate(); |
855 | } | 847 | } |
@@ -862,6 +854,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
862 | if (m_group != null) | 854 | if (m_group != null) |
863 | { | 855 | { |
864 | m_group.RootPart.Velocity = Vector3.Zero; | 856 | m_group.RootPart.Velocity = Vector3.Zero; |
857 | m_skippedUpdates = 1000; | ||
865 | m_group.SendGroupRootTerseUpdate(); | 858 | m_group.SendGroupRootTerseUpdate(); |
866 | // m_group.RootPart.ScheduleTerseUpdate(); | 859 | // m_group.RootPart.ScheduleTerseUpdate(); |
867 | 860 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index cbf40c8..53ca849 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -172,14 +172,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
172 | 172 | ||
173 | if (entity is SceneObjectPart) | 173 | if (entity is SceneObjectPart) |
174 | { | 174 | { |
175 | SceneObjectGroup sog = ((SceneObjectPart)entity).ParentGroup; | ||
175 | // Attachments are high priority, | 176 | // Attachments are high priority, |
176 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) | 177 | if (sog.IsAttachment) |
177 | return 2; | 178 | return 2; |
179 | |||
180 | |||
181 | if(presence.ParentPart != null) | ||
182 | { | ||
183 | if(presence.ParentPart.ParentGroup == sog) | ||
184 | return 2; | ||
185 | } | ||
178 | 186 | ||
179 | pqueue = ComputeDistancePriority(client, entity, false); | 187 | pqueue = ComputeDistancePriority(client, entity, false); |
180 | 188 | ||
181 | // Non physical prims are lower priority than physical prims | 189 | // Non physical prims are lower priority than physical prims |
182 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | 190 | PhysicsActor physActor = sog.RootPart.PhysActor; |
183 | if (physActor == null || !physActor.IsPhysical) | 191 | if (physActor == null || !physActor.IsPhysical) |
184 | pqueue++; | 192 | pqueue++; |
185 | } | 193 | } |
@@ -302,6 +310,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
302 | else | 310 | else |
303 | { | 311 | { |
304 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; | 312 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; |
313 | if(presence.ParentPart != null) | ||
314 | { | ||
315 | if(presence.ParentPart.ParentGroup == group) | ||
316 | return pqueue; | ||
317 | } | ||
318 | if(group.IsAttachment) | ||
319 | { | ||
320 | if(group.RootPart.LocalId == presence.LocalId) | ||
321 | return pqueue; | ||
322 | } | ||
323 | |||
305 | float bradius = group.GetBoundsRadius(); | 324 | float bradius = group.GetBoundsRadius(); |
306 | Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); | 325 | Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); |
307 | distance = Vector3.Distance(presencePos, grppos); | 326 | distance = Vector3.Distance(presencePos, grppos); |
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs index 651c52e..d38ef61 100644 --- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs +++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | 33 | ||
33 | namespace OpenSim.Region.Framework.Scenes | 34 | namespace OpenSim.Region.Framework.Scenes |
@@ -90,6 +91,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | else | 91 | else |
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
94 | } | ||
95 | |||
96 | public class FaceMaterial | ||
97 | { | ||
98 | public UUID ID; | ||
99 | public UUID NormalMapID = UUID.Zero; | ||
100 | public float NormalOffsetX = 0.0f; | ||
101 | public float NormalOffsetY = 0.0f; | ||
102 | public float NormalRepeatX = 1.0f; | ||
103 | public float NormalRepeatY = 1.0f; | ||
104 | public float NormalRotation = 0.0f; | ||
105 | |||
106 | public UUID SpecularMapID = UUID.Zero; | ||
107 | public float SpecularOffsetX = 0.0f; | ||
108 | public float SpecularOffsetY = 0.0f; | ||
109 | public float SpecularRepeatX = 1.0f; | ||
110 | public float SpecularRepeatY = 1.0f; | ||
111 | public float SpecularRotation = 0.0f; | ||
112 | |||
113 | public Color4 SpecularLightColor = new Color4(255,255,255,255); | ||
114 | public Byte SpecularLightExponent = 51; | ||
115 | public Byte EnvironmentIntensity = 0; | ||
116 | public Byte DiffuseAlphaMode = 1; | ||
117 | public Byte AlphaMaskCutoff = 0; | ||
118 | |||
119 | public FaceMaterial() | ||
120 | { } | ||
121 | |||
122 | public FaceMaterial(UUID pID, OSDMap mat) | ||
123 | { | ||
124 | ID = pID; | ||
125 | if(mat == null) | ||
126 | return; | ||
127 | float scale = 0.0001f; | ||
128 | NormalMapID = mat["NormMap"].AsUUID(); | ||
129 | NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal(); | ||
130 | NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal(); | ||
131 | NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal(); | ||
132 | NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal(); | ||
133 | NormalRotation = scale * (float)mat["NormRotation"].AsReal(); | ||
134 | |||
135 | SpecularMapID = mat["SpecMap"].AsUUID(); | ||
136 | SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal(); | ||
137 | SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal(); | ||
138 | SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal(); | ||
139 | SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal(); | ||
140 | SpecularRotation = scale * (float)mat["SpecRotation"].AsReal(); | ||
93 | 141 | ||
142 | SpecularLightColor = mat["SpecColor"].AsColor4(); | ||
143 | SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger(); | ||
144 | EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger(); | ||
145 | DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger(); | ||
146 | AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger(); | ||
147 | } | ||
148 | |||
149 | public OSDMap toOSD() | ||
150 | { | ||
151 | OSDMap mat = new OSDMap(); | ||
152 | float scale = 10000f; | ||
153 | |||
154 | mat["NormMap"] = NormalMapID; | ||
155 | mat["NormOffsetX"] = (int) (scale * NormalOffsetX); | ||
156 | mat["NormOffsetY"] = (int) (scale * NormalOffsetY); | ||
157 | mat["NormRepeatX"] = (int) (scale * NormalRepeatX); | ||
158 | mat["NormRepeatY"] = (int) (scale * NormalRepeatY); | ||
159 | mat["NormRotation"] = (int) (scale * NormalRotation); | ||
160 | |||
161 | mat["SpecMap"] = SpecularMapID; | ||
162 | mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX); | ||
163 | mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY); | ||
164 | mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX); | ||
165 | mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY); | ||
166 | mat["SpecRotation"] = (int) (scale * SpecularRotation); | ||
167 | |||
168 | mat["SpecColor"] = SpecularLightColor; | ||
169 | mat["SpecExp"] = SpecularLightExponent; | ||
170 | mat["EnvIntensity"] = EnvironmentIntensity; | ||
171 | mat["DiffuseAlphaMode"] = DiffuseAlphaMode; | ||
172 | mat["AlphaMaskCutoff"] = AlphaMaskCutoff; | ||
173 | |||
174 | return mat; | ||
175 | } | ||
94 | } | 176 | } |
95 | } \ No newline at end of file | 177 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cb06540..2f016fa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
338 | // Update item with new asset | 338 | // Update item with new asset |
339 | item.AssetID = asset.FullID; | 339 | item.AssetID = asset.FullID; |
340 | group.UpdateInventoryItem(item); | 340 | group.UpdateInventoryItem(item); |
341 | group.AggregatePerms(); | ||
341 | 342 | ||
342 | part.SendPropertiesToClient(remoteClient); | 343 | part.SendPropertiesToClient(remoteClient); |
343 | 344 | ||
@@ -647,7 +648,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | // Modify | 648 | // Modify |
648 | uint permsMask = ~ ((uint)PermissionMask.Copy | | 649 | uint permsMask = ~ ((uint)PermissionMask.Copy | |
649 | (uint)PermissionMask.Transfer | | 650 | (uint)PermissionMask.Transfer | |
650 | (uint)PermissionMask.Modify); | 651 | (uint)PermissionMask.Modify | |
652 | (uint)PermissionMask.Export); | ||
651 | 653 | ||
652 | // Now, reduce the next perms to the mask bits | 654 | // Now, reduce the next perms to the mask bits |
653 | // relevant to the operation | 655 | // relevant to the operation |
@@ -677,6 +679,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
677 | (uint)PermissionMask.Move; | 679 | (uint)PermissionMask.Move; |
678 | uint ownerPerms = item.CurrentPermissions; | 680 | uint ownerPerms = item.CurrentPermissions; |
679 | 681 | ||
682 | // These will be applied to the root prim at next rez. | ||
683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) | ||
684 | // are preserved due to the above mangling | ||
685 | ownerPerms &= nextPerms; | ||
686 | |||
687 | // Mask the base permissions. This is a conservative | ||
688 | // approach altering only the three main perms | ||
689 | basePerms &= nextPerms; | ||
690 | |||
691 | // Mask out the folded portion of the base mask. | ||
692 | // While the owner mask carries the actual folded | ||
693 | // permissions, the base mask carries the original | ||
694 | // base mask, before masking with the folded perms. | ||
695 | // We need this later for rezzing. | ||
696 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
697 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | ||
698 | |||
680 | // If this is an object, root prim perms may be more | 699 | // If this is an object, root prim perms may be more |
681 | // permissive than folded perms. Use folded perms as | 700 | // permissive than folded perms. Use folded perms as |
682 | // a mask | 701 | // a mask |
@@ -684,6 +703,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
684 | { | 703 | { |
685 | // Create a safe mask for the current perms | 704 | // Create a safe mask for the current perms |
686 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | 705 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; |
706 | if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
707 | foldedPerms |= (uint)PermissionMask.Export; | ||
708 | |||
687 | foldedPerms |= permsMask; | 709 | foldedPerms |= permsMask; |
688 | 710 | ||
689 | bool isRootMod = (item.CurrentPermissions & | 711 | bool isRootMod = (item.CurrentPermissions & |
@@ -691,6 +713,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | true : false; | 713 | true : false; |
692 | 714 | ||
693 | // Mask the owner perms to the folded perms | 715 | // Mask the owner perms to the folded perms |
716 | // Note that this is only to satisfy the viewer. | ||
717 | // The effect of this will be reversed on rez. | ||
694 | ownerPerms &= foldedPerms; | 718 | ownerPerms &= foldedPerms; |
695 | basePerms &= foldedPerms; | 719 | basePerms &= foldedPerms; |
696 | 720 | ||
@@ -705,15 +729,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | } | 729 | } |
706 | } | 730 | } |
707 | 731 | ||
708 | // These will be applied to the root prim at next rez. | ||
709 | // The slam bit (bit 3) and folded permission (bits 0-2) | ||
710 | // are preserved due to the above mangling | ||
711 | ownerPerms &= nextPerms; | ||
712 | |||
713 | // Mask the base permissions. This is a conservative | ||
714 | // approach altering only the three main perms | ||
715 | basePerms &= nextPerms; | ||
716 | |||
717 | // Assign to the actual item. Make sure the slam bit is | 732 | // Assign to the actual item. Make sure the slam bit is |
718 | // set, if it wasn't set before. | 733 | // set, if it wasn't set before. |
719 | itemCopy.BasePermissions = basePerms; | 734 | itemCopy.BasePermissions = basePerms; |
@@ -1200,6 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1200 | } | 1215 | } |
1201 | 1216 | ||
1202 | group.RemoveInventoryItem(localID, itemID); | 1217 | group.RemoveInventoryItem(localID, itemID); |
1218 | group.AggregatePerms(); | ||
1203 | } | 1219 | } |
1204 | 1220 | ||
1205 | part.SendPropertiesToClient(remoteClient); | 1221 | part.SendPropertiesToClient(remoteClient); |
@@ -1244,6 +1260,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1244 | agentItem.InvType = taskItem.InvType; | 1260 | agentItem.InvType = taskItem.InvType; |
1245 | agentItem.Flags = taskItem.Flags; | 1261 | agentItem.Flags = taskItem.Flags; |
1246 | 1262 | ||
1263 | // The code below isn't OK. It doesn't account for flags being changed | ||
1264 | // in the object inventory, so it will break when you do it. That | ||
1265 | // is the previous behaviour, so no matter at this moment. However, there is a lot | ||
1266 | // TODO: Fix this after the inventory fixer exists and has beenr run | ||
1247 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) | 1267 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) |
1248 | { | 1268 | { |
1249 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1269 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
@@ -1252,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1252 | else | 1272 | else |
1253 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1273 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1254 | 1274 | ||
1255 | agentItem.CurrentPermissions = agentItem.BasePermissions; | 1275 | agentItem.BasePermissions = agentItem.CurrentPermissions; |
1256 | 1276 | ||
1257 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1277 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1258 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); | 1278 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); |
@@ -1360,18 +1380,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | return; | 1380 | return; |
1361 | } | 1381 | } |
1362 | 1382 | ||
1363 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1383 | if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId)) |
1364 | { | ||
1365 | // If the item to be moved is no copy, we need to be able to | ||
1366 | // edit the prim. | ||
1367 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1368 | return; | ||
1369 | } | ||
1370 | else | ||
1371 | { | 1384 | { |
1372 | // If the item is copiable, then we just need to have perms | 1385 | // check also if we can delete the no copy item |
1373 | // on it. The delete check is a pure rights check | 1386 | if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId)) |
1374 | if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) | ||
1375 | return; | 1387 | return; |
1376 | } | 1388 | } |
1377 | 1389 | ||
@@ -1449,29 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1449 | return; | 1461 | return; |
1450 | } | 1462 | } |
1451 | 1463 | ||
1452 | // Can't transfer this | 1464 | if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart)) |
1453 | // | ||
1454 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1455 | return; | 1465 | return; |
1456 | 1466 | ||
1457 | bool overrideNoMod = false; | ||
1458 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1459 | overrideNoMod = true; | ||
1460 | |||
1461 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1462 | { | ||
1463 | // object cannot copy items to an object owned by a different owner | ||
1464 | // unless llAllowInventoryDrop has been called | ||
1465 | |||
1466 | return; | ||
1467 | } | ||
1468 | |||
1469 | // must have both move and modify permission to put an item in an object | ||
1470 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) | ||
1471 | { | ||
1472 | return; | ||
1473 | } | ||
1474 | |||
1475 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1467 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1476 | 1468 | ||
1477 | destTaskItem.ItemID = UUID.Random(); | 1469 | destTaskItem.ItemID = UUID.Random(); |
@@ -1512,9 +1504,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1512 | destTaskItem.Type = srcTaskItem.Type; | 1504 | destTaskItem.Type = srcTaskItem.Type; |
1513 | 1505 | ||
1514 | destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); | 1506 | destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); |
1515 | |||
1516 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1507 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1508 | { | ||
1517 | part.Inventory.RemoveInventoryItem(itemId); | 1509 | part.Inventory.RemoveInventoryItem(itemId); |
1510 | } | ||
1518 | 1511 | ||
1519 | ScenePresence avatar; | 1512 | ScenePresence avatar; |
1520 | 1513 | ||
@@ -1652,76 +1645,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
1652 | uint primLocalID) | 1645 | uint primLocalID) |
1653 | { | 1646 | { |
1654 | UUID itemID = itemInfo.ItemID; | 1647 | UUID itemID = itemInfo.ItemID; |
1648 | if (itemID == UUID.Zero) | ||
1649 | { | ||
1650 | m_log.ErrorFormat( | ||
1651 | "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!", | ||
1652 | remoteClient.Name); | ||
1653 | return; | ||
1654 | } | ||
1655 | 1655 | ||
1656 | // Find the prim we're dealing with | 1656 | // Find the prim we're dealing with |
1657 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 1657 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
1658 | if(part == null) | ||
1659 | { | ||
1660 | m_log.WarnFormat( | ||
1661 | "[PRIM INVENTORY]: " + | ||
1662 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1663 | itemID, primLocalID, remoteClient.Name); | ||
1664 | return; | ||
1665 | } | ||
1658 | 1666 | ||
1659 | if (part != null) | 1667 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); |
1668 | |||
1669 | if (currentItem == null) | ||
1660 | { | 1670 | { |
1661 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); | 1671 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); |
1662 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() | ||
1663 | & (uint)PrimFlags.AllowInventoryDrop) != 0; | ||
1664 | 1672 | ||
1665 | // Explicity allow anyone to add to the inventory if the | 1673 | // if not found Try library |
1666 | // AllowInventoryDrop flag has been set. Don't however let | 1674 | if (item == null && LibraryService != null && LibraryService.LibraryRootFolder != null) |
1667 | // them update an item unless they pass the external checks | 1675 | item = LibraryService.LibraryRootFolder.FindItem(itemID); |
1668 | // | ||
1669 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId) | ||
1670 | && (currentItem != null || !allowInventoryDrop)) | ||
1671 | return; | ||
1672 | 1676 | ||
1673 | if (currentItem == null) | 1677 | if(item == null) |
1674 | { | 1678 | { |
1675 | UUID copyID = UUID.Random(); | 1679 | m_log.ErrorFormat( |
1676 | if (itemID != UUID.Zero) | 1680 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", |
1677 | { | 1681 | itemID, remoteClient.Name); |
1678 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); | 1682 | return; |
1683 | } | ||
1679 | 1684 | ||
1680 | // Try library | 1685 | if (!Permissions.CanDropInObjectInv(item, remoteClient, part)) |
1681 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) | 1686 | return; |
1682 | { | ||
1683 | item = LibraryService.LibraryRootFolder.FindItem(itemID); | ||
1684 | } | ||
1685 | 1687 | ||
1686 | // If we've found the item in the user's inventory or in the library | 1688 | UUID copyID = UUID.Random(); |
1687 | if (item != null) | 1689 | bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient); |
1688 | { | 1690 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights); |
1689 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); | 1691 | m_log.InfoFormat( |
1690 | m_log.InfoFormat( | 1692 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1691 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1693 | item.Name, primLocalID, remoteClient.Name); |
1692 | item.Name, primLocalID, remoteClient.Name); | 1694 | part.SendPropertiesToClient(remoteClient); |
1693 | part.SendPropertiesToClient(remoteClient); | 1695 | if (!Permissions.BypassPermissions()) |
1694 | if (!Permissions.BypassPermissions()) | 1696 | { |
1695 | { | 1697 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1696 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1698 | { |
1697 | { | 1699 | List<UUID> uuids = new List<UUID>(); |
1698 | List<UUID> uuids = new List<UUID>(); | 1700 | uuids.Add(itemID); |
1699 | uuids.Add(itemID); | 1701 | RemoveInventoryItem(remoteClient, uuids); |
1700 | RemoveInventoryItem(remoteClient, uuids); | ||
1701 | } | ||
1702 | } | ||
1703 | } | ||
1704 | else | ||
1705 | { | ||
1706 | m_log.ErrorFormat( | ||
1707 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | ||
1708 | itemID, remoteClient.Name); | ||
1709 | } | ||
1710 | } | 1702 | } |
1711 | } | 1703 | } |
1712 | else // Updating existing item with new perms etc | 1704 | } |
1713 | { | 1705 | else // Updating existing item with new perms etc |
1706 | { | ||
1714 | // m_log.DebugFormat( | 1707 | // m_log.DebugFormat( |
1715 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", | 1708 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", |
1716 | // currentItem.Name, part.Name); | 1709 | // currentItem.Name, part.Name); |
1717 | 1710 | ||
1718 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the | 1711 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1719 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) | 1712 | return; |
1720 | // will not pass in a transaction ID in the update message. | 1713 | |
1721 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) | 1714 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the |
1722 | { | 1715 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) |
1723 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1716 | // will not pass in a transaction ID in the update message. |
1724 | remoteClient, part, transactionID, currentItem); | 1717 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) |
1718 | { | ||
1719 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | ||
1720 | remoteClient, part, transactionID, currentItem); | ||
1725 | 1721 | ||
1726 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1722 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1727 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1723 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
@@ -1729,49 +1725,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1729 | // remoteClient.SendAgentAlertMessage("Script saved", false); | 1725 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1730 | // else | 1726 | // else |
1731 | // remoteClient.SendAgentAlertMessage("Item saved", false); | 1727 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1732 | } | 1728 | } |
1733 | 1729 | ||
1734 | // Base ALWAYS has move | 1730 | // Base ALWAYS has move |
1735 | currentItem.BasePermissions |= (uint)PermissionMask.Move; | 1731 | currentItem.BasePermissions |= (uint)PermissionMask.Move; |
1736 | 1732 | ||
1737 | itemInfo.Flags = currentItem.Flags; | 1733 | itemInfo.Flags = currentItem.Flags; |
1738 | 1734 | ||
1739 | // Check if we're allowed to mess with permissions | 1735 | // Check if we're allowed to mess with permissions |
1740 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god | 1736 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god |
1737 | { | ||
1738 | if (remoteClient.AgentId != part.OwnerID) // Not owner | ||
1741 | { | 1739 | { |
1742 | if (remoteClient.AgentId != part.OwnerID) // Not owner | 1740 | // Friends and group members can't change any perms |
1743 | { | 1741 | itemInfo.BasePermissions = currentItem.BasePermissions; |
1744 | // Friends and group members can't change any perms | 1742 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; |
1745 | itemInfo.BasePermissions = currentItem.BasePermissions; | 1743 | itemInfo.GroupPermissions = currentItem.GroupPermissions; |
1746 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; | 1744 | itemInfo.NextPermissions = currentItem.NextPermissions; |
1747 | itemInfo.GroupPermissions = currentItem.GroupPermissions; | 1745 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; |
1748 | itemInfo.NextPermissions = currentItem.NextPermissions; | ||
1749 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | // Owner can't change base, and can change other | ||
1754 | // only up to base | ||
1755 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1756 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1757 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1758 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1759 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1760 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1761 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1762 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1763 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1764 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1765 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1766 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1767 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1768 | } | ||
1769 | |||
1770 | } | 1746 | } |
1771 | else | 1747 | else |
1772 | { | 1748 | { |
1773 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | 1749 | // Owner can't change base, and can change other |
1774 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | 1750 | // only up to base |
1751 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1775 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | 1752 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) |
1776 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | 1753 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; |
1777 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | 1754 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) |
@@ -1780,24 +1757,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1780 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | 1757 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; |
1781 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | 1758 | if (itemInfo.NextPermissions != currentItem.NextPermissions) |
1782 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | 1759 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; |
1760 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1761 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1762 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1763 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1783 | } | 1764 | } |
1784 | 1765 | ||
1785 | // Next ALWAYS has move | 1766 | } |
1786 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; | 1767 | else |
1768 | { | ||
1769 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | ||
1770 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | ||
1771 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1772 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1773 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1774 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1775 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1776 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1777 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1778 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1779 | } | ||
1787 | 1780 | ||
1788 | if (part.Inventory.UpdateInventoryItem(itemInfo)) | 1781 | // Next ALWAYS has move |
1789 | { | 1782 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; |
1790 | part.SendPropertiesToClient(remoteClient); | 1783 | |
1791 | } | 1784 | if (part.Inventory.UpdateInventoryItem(itemInfo)) |
1785 | { | ||
1786 | part.SendPropertiesToClient(remoteClient); | ||
1792 | } | 1787 | } |
1793 | } | 1788 | } |
1794 | else | ||
1795 | { | ||
1796 | m_log.WarnFormat( | ||
1797 | "[PRIM INVENTORY]: " + | ||
1798 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1799 | itemID, primLocalID, remoteClient.Name); | ||
1800 | } | ||
1801 | } | 1789 | } |
1802 | 1790 | ||
1803 | /// <summary> | 1791 | /// <summary> |
@@ -1960,6 +1948,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1960 | part.Inventory.AddInventoryItem(taskItem, false); | 1948 | part.Inventory.AddInventoryItem(taskItem, false); |
1961 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1949 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
1962 | 1950 | ||
1951 | part.ParentGroup.AggregatePerms(); | ||
1952 | |||
1963 | // tell anyone managing scripts that a new script exists | 1953 | // tell anyone managing scripts that a new script exists |
1964 | EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); | 1954 | EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); |
1965 | 1955 | ||
@@ -2095,13 +2085,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | /// <param name='action'>DeRezAction</param> | 2085 | /// <param name='action'>DeRezAction</param> |
2096 | /// <param name='destinationID'>User folder ID to place derezzed object</param> | 2086 | /// <param name='destinationID'>User folder ID to place derezzed object</param> |
2097 | public virtual void DeRezObjects( | 2087 | public virtual void DeRezObjects( |
2098 | IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID) | 2088 | IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true) |
2099 | { | 2089 | { |
2100 | // First, see of we can perform the requested action and | 2090 | // First, see of we can perform the requested action and |
2101 | // build a list of eligible objects | 2091 | // build a list of eligible objects |
2102 | List<uint> deleteIDs = new List<uint>(); | 2092 | List<uint> deleteIDs = new List<uint>(); |
2103 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2093 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
2104 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | 2094 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); |
2095 | List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>(); | ||
2096 | |||
2097 | ScenePresence sp = null; | ||
2098 | if(remoteClient != null) | ||
2099 | sp = remoteClient.SceneAgent as ScenePresence; | ||
2100 | else if(action != DeRezAction.Return) | ||
2101 | return; // only Return can be called without a client | ||
2105 | 2102 | ||
2106 | // Start with true for both, then remove the flags if objects | 2103 | // Start with true for both, then remove the flags if objects |
2107 | // that we can't derez are part of the selection | 2104 | // that we can't derez are part of the selection |
@@ -2157,17 +2154,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2157 | { | 2154 | { |
2158 | if (action == DeRezAction.TakeCopy) | 2155 | if (action == DeRezAction.TakeCopy) |
2159 | { | 2156 | { |
2160 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2157 | if (!Permissions.CanTakeCopyObject(grp, sp)) |
2161 | permissionToTakeCopy = false; | 2158 | permissionToTakeCopy = false; |
2162 | } | 2159 | } |
2163 | else | 2160 | else |
2164 | { | 2161 | { |
2165 | permissionToTakeCopy = false; | 2162 | permissionToTakeCopy = false; |
2166 | } | 2163 | } |
2167 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2164 | if (!Permissions.CanTakeObject(grp, sp)) |
2168 | permissionToTake = false; | 2165 | permissionToTake = false; |
2169 | 2166 | ||
2170 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2167 | if (!Permissions.CanDeleteObject(grp, remoteClient)) |
2171 | permissionToDelete = false; | 2168 | permissionToDelete = false; |
2172 | } | 2169 | } |
2173 | 2170 | ||
@@ -2208,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2208 | { | 2205 | { |
2209 | if (Permissions.CanReturnObjects( | 2206 | if (Permissions.CanReturnObjects( |
2210 | null, | 2207 | null, |
2211 | remoteClient.AgentId, | 2208 | remoteClient, |
2212 | new List<SceneObjectGroup>() {grp})) | 2209 | new List<SceneObjectGroup>() {grp})) |
2213 | { | 2210 | { |
2214 | permissionToTake = true; | 2211 | permissionToTake = true; |
2215 | permissionToDelete = true; | 2212 | permissionToDelete = true; |
2216 | 2213 | if(AddToReturns) | |
2217 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | 2214 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, |
2215 | "parcel owner return"); | ||
2218 | } | 2216 | } |
2219 | } | 2217 | } |
2220 | else // Auto return passes through here with null agent | 2218 | else // Auto return passes through here with null agent |
@@ -2224,26 +2222,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2224 | } | 2222 | } |
2225 | } | 2223 | } |
2226 | 2224 | ||
2227 | if (permissionToTake && (!permissionToDelete)) | ||
2228 | takeGroups.Add(grp); | ||
2229 | |||
2230 | if (permissionToDelete) | 2225 | if (permissionToDelete) |
2231 | { | 2226 | { |
2232 | if (permissionToTake) | 2227 | if (permissionToTake) |
2228 | takeDeleteGroups.Add(grp); | ||
2229 | else | ||
2233 | deleteGroups.Add(grp); | 2230 | deleteGroups.Add(grp); |
2234 | deleteIDs.Add(grp.LocalId); | 2231 | deleteIDs.Add(grp.LocalId); |
2235 | } | 2232 | } |
2233 | else if(permissionToTake) | ||
2234 | takeGroups.Add(grp); | ||
2236 | } | 2235 | } |
2237 | 2236 | ||
2238 | SendKillObject(deleteIDs); | 2237 | SendKillObject(deleteIDs); |
2239 | 2238 | ||
2240 | if (deleteGroups.Count > 0) | 2239 | if (takeDeleteGroups.Count > 0) |
2241 | { | 2240 | { |
2242 | foreach (SceneObjectGroup g in deleteGroups) | ||
2243 | deleteIDs.Remove(g.LocalId); | ||
2244 | |||
2245 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2241 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2246 | action, destinationID, deleteGroups, remoteClient, | 2242 | action, destinationID, takeDeleteGroups, remoteClient, |
2247 | true); | 2243 | true); |
2248 | } | 2244 | } |
2249 | if (takeGroups.Count > 0) | 2245 | if (takeGroups.Count > 0) |
@@ -2252,7 +2248,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2252 | action, destinationID, takeGroups, remoteClient, | 2248 | action, destinationID, takeGroups, remoteClient, |
2253 | false); | 2249 | false); |
2254 | } | 2250 | } |
2255 | if (deleteIDs.Count > 0) | 2251 | if (deleteGroups.Count > 0) |
2256 | { | 2252 | { |
2257 | foreach (SceneObjectGroup g in deleteGroups) | 2253 | foreach (SceneObjectGroup g in deleteGroups) |
2258 | DeleteSceneObject(g, true); | 2254 | DeleteSceneObject(g, true); |
@@ -2640,6 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2640 | 2636 | ||
2641 | // We can only call this after adding the scene object, since the scene object references the scene | 2637 | // We can only call this after adding the scene object, since the scene object references the scene |
2642 | // to find out if scripts should be activated at all. | 2638 | // to find out if scripts should be activated at all. |
2639 | group.AggregatePerms(); | ||
2643 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); | 2640 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); |
2644 | 2641 | ||
2645 | group.ScheduleGroupForFullUpdate(); | 2642 | group.ScheduleGroupForFullUpdate(); |
@@ -2649,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2649 | } | 2646 | } |
2650 | 2647 | ||
2651 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, | 2648 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, |
2652 | UUID AgentId) | 2649 | IClientAPI client) |
2653 | { | 2650 | { |
2654 | List<uint> localIDs = new List<uint>(); | 2651 | List<uint> localIDs = new List<uint>(); |
2655 | 2652 | ||
@@ -2659,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2659 | "parcel owner return"); | 2656 | "parcel owner return"); |
2660 | localIDs.Add(grp.RootPart.LocalId); | 2657 | localIDs.Add(grp.RootPart.LocalId); |
2661 | } | 2658 | } |
2662 | DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, | 2659 | DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return, |
2663 | UUID.Zero); | 2660 | UUID.Zero, false); |
2664 | 2661 | ||
2665 | return true; | 2662 | return true; |
2666 | } | 2663 | } |
@@ -2691,9 +2688,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | { | 2688 | { |
2692 | if (ownerID != UUID.Zero) | 2689 | if (ownerID != UUID.Zero) |
2693 | return; | 2690 | return; |
2694 | |||
2695 | if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID)) | ||
2696 | return; | ||
2697 | } | 2691 | } |
2698 | 2692 | ||
2699 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); | 2693 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); |
@@ -2724,21 +2718,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2724 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2718 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2725 | } | 2719 | } |
2726 | } | 2720 | } |
2727 | else // The object was deeded to the group | 2721 | else // The object deeded to the group |
2728 | { | 2722 | { |
2729 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) | 2723 | if (!Permissions.CanDeedObject(remoteClient, sog, groupID)) |
2730 | continue; | 2724 | continue; |
2731 | 2725 | ||
2732 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | 2726 | sog.SetOwnerId(groupID); |
2733 | continue; | ||
2734 | 2727 | ||
2735 | if (sog.GroupID != groupID) | 2728 | // this is wrong, GroupMask is used for group sharing, still possible to set |
2736 | continue; | 2729 | // this whould give owner rights to users that are member of group but don't have role powers to edit |
2730 | // sog.RootPart.GroupMask = sog.RootPart.OwnerMask; | ||
2737 | 2731 | ||
2738 | sog.SetOwnerId(groupID); | 2732 | // we should keep all permissions on deed to group |
2739 | // Make the group mask be the previous owner mask | 2733 | // and with this comented code, if user does not set next permissions on the object |
2740 | sog.RootPart.GroupMask = sog.RootPart.OwnerMask; | 2734 | // and on ALL contents of ALL prims, he may loose rights, making the object useless |
2741 | sog.ApplyNextOwnerPermissions(); | 2735 | sog.ApplyNextOwnerPermissions(); |
2736 | sog.AggregatePerms(); | ||
2742 | 2737 | ||
2743 | sog.ScheduleGroupForFullUpdate(); | 2738 | sog.ScheduleGroupForFullUpdate(); |
2744 | 2739 | ||
@@ -2748,8 +2743,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2748 | child.Inventory.ChangeInventoryOwner(groupID); | 2743 | child.Inventory.ChangeInventoryOwner(groupID); |
2749 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2744 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2750 | } | 2745 | } |
2751 | |||
2752 | |||
2753 | } | 2746 | } |
2754 | } | 2747 | } |
2755 | 2748 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2d62b50..4fef9c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -183,11 +183,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
183 | part.SendFullUpdate(remoteClient); | 183 | part.SendFullUpdate(remoteClient); |
184 | 184 | ||
185 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | 185 | // A prim is only tainted if it's allowed to be edited by the person clicking it. |
186 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | 186 | if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent)) |
187 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | ||
188 | { | 187 | { |
188 | bool oldsel = part.IsSelected; | ||
189 | part.IsSelected = true; | 189 | part.IsSelected = true; |
190 | EventManager.TriggerParcelPrimCountTainted(); | 190 | if(!oldsel) |
191 | EventManager.TriggerParcelPrimCountTainted(); | ||
191 | } | 192 | } |
192 | 193 | ||
193 | part.SendPropertiesToClient(remoteClient); | 194 | part.SendPropertiesToClient(remoteClient); |
@@ -229,6 +230,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | if (so.OwnerID == remoteClient.AgentId) | 230 | if (so.OwnerID == remoteClient.AgentId) |
230 | { | 231 | { |
231 | so.SetGroup(groupID, remoteClient); | 232 | so.SetGroup(groupID, remoteClient); |
233 | EventManager.TriggerParcelPrimCountTainted(); | ||
232 | } | 234 | } |
233 | } | 235 | } |
234 | } | 236 | } |
@@ -250,8 +252,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
250 | // handled by group, but by prim. Legacy cruft. | 252 | // handled by group, but by prim. Legacy cruft. |
251 | // TODO: Make selection flagging per prim! | 253 | // TODO: Make selection flagging per prim! |
252 | // | 254 | // |
253 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) | 255 | if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent)) |
254 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
255 | { | 256 | { |
256 | part.IsSelected = false; | 257 | part.IsSelected = false; |
257 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) | 258 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) |
@@ -327,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
327 | if(group == null || group.IsDeleted) | 328 | if(group == null || group.IsDeleted) |
328 | return; | 329 | return; |
329 | 330 | ||
330 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | 331 | if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) |
331 | { | 332 | { |
332 | group.GrabMovement(objectID, offset, pos, remoteClient); | 333 | group.GrabMovement(objectID, offset, pos, remoteClient); |
333 | } | 334 | } |
@@ -388,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
388 | SceneObjectGroup group = GetGroupByPrim(objectID); | 389 | SceneObjectGroup group = GetGroupByPrim(objectID); |
389 | if (group != null) | 390 | if (group != null) |
390 | { | 391 | { |
391 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | 392 | if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) |
392 | { | 393 | { |
393 | group.SpinStart(remoteClient); | 394 | group.SpinStart(remoteClient); |
394 | } | 395 | } |
@@ -406,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | SceneObjectGroup group = GetGroupByPrim(objectID); | 407 | SceneObjectGroup group = GetGroupByPrim(objectID); |
407 | if (group != null) | 408 | if (group != null) |
408 | { | 409 | { |
409 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | 410 | if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) |
410 | { | 411 | { |
411 | group.SpinMovement(rotation, remoteClient); | 412 | group.SpinMovement(rotation, remoteClient); |
412 | } | 413 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 893b38c..c55a7a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -37,52 +37,60 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
38 | { | 38 | { |
39 | #region Delegates | 39 | #region Delegates |
40 | public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); | 40 | public delegate uint GenerateClientFlagsHandler(SceneObjectPart part, ScenePresence sp, uint curEffectivePerms); |
41 | public delegate void SetBypassPermissionsHandler(bool value); | 41 | public delegate void SetBypassPermissionsHandler(bool value); |
42 | public delegate bool BypassPermissionsHandler(); | 42 | public delegate bool BypassPermissionsHandler(); |
43 | public delegate bool PropagatePermissionsHandler(); | 43 | public delegate bool PropagatePermissionsHandler(); |
44 | public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); | 44 | public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition); |
45 | public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); | 45 | public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter); |
46 | public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); | 46 | public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
47 | public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); | 47 | public delegate bool TransferObjectHandler(UUID objectID, UUID recipient); |
48 | public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); | 48 | public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
49 | public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); | 49 | public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID); |
50 | public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); | 50 | public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType); |
51 | public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); | 51 | public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType); |
52 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); | 52 | public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
53 | public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); | 53 | public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
54 | public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); | 54 | public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID); |
55 | public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); | 55 | public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
56 | public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); | 56 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); |
57 | public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); | 57 | public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
58 | public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); | 58 | public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); |
59 | public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); | 59 | public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land); |
60 | public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); | 60 | public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects); |
61 | public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); | 61 | public delegate bool InstantMessageHandler(UUID user, UUID target); |
62 | public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); | 62 | public delegate bool InventoryTransferHandler(UUID user, UUID target); |
63 | public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); | 63 | public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user); |
64 | public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); | 64 | public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user); |
65 | public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); | 65 | public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user); |
66 | public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene); | 66 | public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user); |
67 | public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene); | 67 | public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user); |
68 | public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); | 68 | public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part); |
69 | public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); | 69 | public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType); |
70 | public delegate bool IsGodHandler(UUID user, Scene requestFromScene); | 70 | public delegate bool StartScriptHandler(UUID script, UUID user); |
71 | public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); | 71 | public delegate bool StopScriptHandler(UUID script, UUID user); |
72 | public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user); | ||
73 | public delegate bool TerraformLandHandler(UUID user, Vector3 position); | ||
74 | public delegate bool RunConsoleCommandHandler(UUID user); | ||
75 | public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand); | ||
76 | public delegate bool IsGodHandler(UUID user); | ||
77 | public delegate bool IsGridGodHandler(UUID user); | ||
72 | public delegate bool IsAdministratorHandler(UUID user); | 78 | public delegate bool IsAdministratorHandler(UUID user); |
73 | public delegate bool IsEstateManagerHandler(UUID user); | 79 | public delegate bool IsEstateManagerHandler(UUID user); |
74 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); | 80 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel); |
75 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager); | 81 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager); |
76 | public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); | 82 | public delegate bool SellParcelHandler(UUID user, ILandObject parcel); |
77 | public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); | 83 | public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel); |
78 | public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); | 84 | public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel); |
79 | public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); | 85 | public delegate bool DeedParcelHandler(UUID user, ILandObject parcel); |
80 | public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene); | 86 | public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID); |
81 | public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); | 87 | public delegate bool BuyLandHandler(UUID user, ILandObject parcel); |
82 | public delegate bool LinkObjectHandler(UUID user, UUID objectID); | 88 | public delegate bool LinkObjectHandler(UUID user, UUID objectID); |
83 | public delegate bool DelinkObjectHandler(UUID user, UUID objectID); | 89 | public delegate bool DelinkObjectHandler(UUID user, UUID objectID); |
84 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); | 90 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); |
85 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 91 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
92 | public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart); | ||
93 | public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart); | ||
86 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 94 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
87 | public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 95 | public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
88 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); | 96 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); |
@@ -112,16 +120,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
112 | public event BypassPermissionsHandler OnBypassPermissions; | 120 | public event BypassPermissionsHandler OnBypassPermissions; |
113 | public event PropagatePermissionsHandler OnPropagatePermissions; | 121 | public event PropagatePermissionsHandler OnPropagatePermissions; |
114 | public event RezObjectHandler OnRezObject; | 122 | public event RezObjectHandler OnRezObject; |
123 | public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs; | ||
115 | public event DeleteObjectHandler OnDeleteObject; | 124 | public event DeleteObjectHandler OnDeleteObject; |
116 | public event TransferObjectHandler OnTransferObject; | 125 | public event TransferObjectHandler OnTransferObject; |
117 | public event TakeObjectHandler OnTakeObject; | 126 | public event TakeObjectHandler OnTakeObject; |
127 | |||
118 | public event SellGroupObjectHandler OnSellGroupObject; | 128 | public event SellGroupObjectHandler OnSellGroupObject; |
129 | public event SellObjectHandlerByUserID OnSellObjectByUserID; | ||
130 | public event SellObjectHandler OnSellObject; | ||
131 | |||
119 | public event TakeCopyObjectHandler OnTakeCopyObject; | 132 | public event TakeCopyObjectHandler OnTakeCopyObject; |
120 | public event DuplicateObjectHandler OnDuplicateObject; | 133 | public event DuplicateObjectHandler OnDuplicateObject; |
134 | public event EditObjectByIDsHandler OnEditObjectByIDs; | ||
121 | public event EditObjectHandler OnEditObject; | 135 | public event EditObjectHandler OnEditObject; |
122 | public event EditObjectInventoryHandler OnEditObjectInventory; | 136 | public event EditObjectInventoryHandler OnEditObjectInventory; |
123 | public event MoveObjectHandler OnMoveObject; | 137 | public event MoveObjectHandler OnMoveObject; |
124 | public event ObjectEntryHandler OnObjectEntry; | 138 | public event ObjectEntryHandler OnObjectEntry; |
139 | public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts; | ||
125 | public event ReturnObjectsHandler OnReturnObjects; | 140 | public event ReturnObjectsHandler OnReturnObjects; |
126 | public event InstantMessageHandler OnInstantMessage; | 141 | public event InstantMessageHandler OnInstantMessage; |
127 | public event InventoryTransferHandler OnInventoryTransfer; | 142 | public event InventoryTransferHandler OnInventoryTransfer; |
@@ -129,6 +144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | public event ViewNotecardHandler OnViewNotecard; | 144 | public event ViewNotecardHandler OnViewNotecard; |
130 | public event EditScriptHandler OnEditScript; | 145 | public event EditScriptHandler OnEditScript; |
131 | public event EditNotecardHandler OnEditNotecard; | 146 | public event EditNotecardHandler OnEditNotecard; |
147 | public event RunScriptHandlerByIDs OnRunScriptByIDs; | ||
132 | public event RunScriptHandler OnRunScript; | 148 | public event RunScriptHandler OnRunScript; |
133 | public event CompileScriptHandler OnCompileScript; | 149 | public event CompileScriptHandler OnCompileScript; |
134 | public event StartScriptHandler OnStartScript; | 150 | public event StartScriptHandler OnStartScript; |
@@ -137,7 +153,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | public event TerraformLandHandler OnTerraformLand; | 153 | public event TerraformLandHandler OnTerraformLand; |
138 | public event RunConsoleCommandHandler OnRunConsoleCommand; | 154 | public event RunConsoleCommandHandler OnRunConsoleCommand; |
139 | public event IssueEstateCommandHandler OnIssueEstateCommand; | 155 | public event IssueEstateCommandHandler OnIssueEstateCommand; |
140 | public event IsGodHandler OnIsGod; | ||
141 | public event IsGridGodHandler OnIsGridGod; | 156 | public event IsGridGodHandler OnIsGridGod; |
142 | public event IsAdministratorHandler OnIsAdministrator; | 157 | public event IsAdministratorHandler OnIsAdministrator; |
143 | public event IsEstateManagerHandler OnIsEstateManager; | 158 | public event IsEstateManagerHandler OnIsEstateManager; |
@@ -153,6 +168,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
153 | public event DelinkObjectHandler OnDelinkObject; | 168 | public event DelinkObjectHandler OnDelinkObject; |
154 | public event CreateObjectInventoryHandler OnCreateObjectInventory; | 169 | public event CreateObjectInventoryHandler OnCreateObjectInventory; |
155 | public event CopyObjectInventoryHandler OnCopyObjectInventory; | 170 | public event CopyObjectInventoryHandler OnCopyObjectInventory; |
171 | public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv; | ||
172 | public event DoDropInObjectInv OnDropInObjectInv; | ||
156 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; | 173 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; |
157 | public event TransferObjectInventoryHandler OnTransferObjectInventory; | 174 | public event TransferObjectInventoryHandler OnTransferObjectInventory; |
158 | public event CreateUserInventoryHandler OnCreateUserInventory; | 175 | public event CreateUserInventoryHandler OnCreateUserInventory; |
@@ -167,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | 184 | ||
168 | #region Object Permission Checks | 185 | #region Object Permission Checks |
169 | 186 | ||
170 | public uint GenerateClientFlags(UUID userID, UUID objectID) | 187 | public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp) |
171 | { | 188 | { |
172 | // libomv will moan about PrimFlags.ObjectYouOfficer being | 189 | // libomv will moan about PrimFlags.ObjectYouOfficer being |
173 | // obsolete... | 190 | // obsolete... |
@@ -179,12 +196,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | PrimFlags.ObjectTransfer | | 196 | PrimFlags.ObjectTransfer | |
180 | PrimFlags.ObjectYouOwner | | 197 | PrimFlags.ObjectYouOwner | |
181 | PrimFlags.ObjectAnyOwner | | 198 | PrimFlags.ObjectAnyOwner | |
182 | PrimFlags.ObjectOwnerModify | | 199 | PrimFlags.ObjectOwnerModify; |
183 | PrimFlags.ObjectYouOfficer; | ||
184 | #pragma warning restore 0612 | 200 | #pragma warning restore 0612 |
185 | 201 | ||
186 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); | ||
187 | |||
188 | if (part == null) | 202 | if (part == null) |
189 | return 0; | 203 | return 0; |
190 | 204 | ||
@@ -196,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
196 | Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); | 210 | Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); |
197 | foreach (GenerateClientFlagsHandler check in list) | 211 | foreach (GenerateClientFlagsHandler check in list) |
198 | { | 212 | { |
199 | perms &= check(userID, objectID); | 213 | perms &= check(part, sp, perms); |
200 | } | 214 | } |
201 | } | 215 | } |
202 | return perms; | 216 | return perms; |
@@ -248,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | Delegate[] list = handler.GetInvocationList(); | 262 | Delegate[] list = handler.GetInvocationList(); |
249 | foreach (RezObjectHandler h in list) | 263 | foreach (RezObjectHandler h in list) |
250 | { | 264 | { |
251 | if (h(objectCount, owner,objectPosition, m_scene) == false) | 265 | if (h(objectCount, owner,objectPosition) == false) |
252 | return false; | 266 | return false; |
253 | } | 267 | } |
254 | } | 268 | } |
@@ -262,141 +276,183 @@ namespace OpenSim.Region.Framework.Scenes | |||
262 | { | 276 | { |
263 | bool result = true; | 277 | bool result = true; |
264 | 278 | ||
265 | DeleteObjectHandler handler = OnDeleteObject; | 279 | DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs; |
266 | if (handler != null) | 280 | if (handler != null) |
267 | { | 281 | { |
268 | Delegate[] list = handler.GetInvocationList(); | 282 | Delegate[] list = handler.GetInvocationList(); |
269 | foreach (DeleteObjectHandler h in list) | 283 | foreach (DeleteObjectHandlerByIDs h in list) |
270 | { | 284 | { |
271 | if (h(objectID, deleter, m_scene) == false) | 285 | if (h(objectID, deleter) == false) |
272 | { | 286 | { |
273 | result = false; | 287 | result = false; |
274 | break; | 288 | break; |
275 | } | 289 | } |
276 | } | 290 | } |
277 | } | 291 | } |
278 | |||
279 | return result; | 292 | return result; |
280 | } | 293 | } |
281 | 294 | ||
282 | public bool CanTransferObject(UUID objectID, UUID recipient) | 295 | public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client) |
283 | { | 296 | { |
284 | bool result = true; | 297 | DeleteObjectHandler handler = OnDeleteObject; |
298 | if (handler != null) | ||
299 | { | ||
300 | if(sog == null || client == null || client.SceneAgent == null) | ||
301 | return false; | ||
302 | |||
303 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
304 | |||
305 | Delegate[] list = handler.GetInvocationList(); | ||
306 | foreach (DeleteObjectHandler h in list) | ||
307 | { | ||
308 | if (h(sog, sp) == false) | ||
309 | return false; | ||
310 | } | ||
311 | } | ||
312 | |||
313 | return true; | ||
314 | } | ||
285 | 315 | ||
316 | public bool CanTransferObject(UUID objectID, UUID recipient) | ||
317 | { | ||
286 | TransferObjectHandler handler = OnTransferObject; | 318 | TransferObjectHandler handler = OnTransferObject; |
287 | if (handler != null) | 319 | if (handler != null) |
288 | { | 320 | { |
289 | Delegate[] list = handler.GetInvocationList(); | 321 | Delegate[] list = handler.GetInvocationList(); |
290 | foreach (TransferObjectHandler h in list) | 322 | foreach (TransferObjectHandler h in list) |
291 | { | 323 | { |
292 | if (h(objectID, recipient, m_scene) == false) | 324 | if (h(objectID, recipient) == false) |
293 | { | 325 | return false; |
294 | result = false; | ||
295 | break; | ||
296 | } | ||
297 | } | 326 | } |
298 | } | 327 | } |
299 | 328 | return true; | |
300 | return result; | ||
301 | } | 329 | } |
302 | 330 | ||
303 | #endregion | 331 | #endregion |
304 | 332 | ||
305 | #region TAKE OBJECT | 333 | #region TAKE OBJECT |
306 | public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) | 334 | public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp) |
307 | { | 335 | { |
308 | bool result = true; | ||
309 | |||
310 | TakeObjectHandler handler = OnTakeObject; | 336 | TakeObjectHandler handler = OnTakeObject; |
311 | if (handler != null) | 337 | if (handler != null) |
312 | { | 338 | { |
339 | if(sog == null || sp == null) | ||
340 | return false; | ||
341 | |||
313 | Delegate[] list = handler.GetInvocationList(); | 342 | Delegate[] list = handler.GetInvocationList(); |
314 | foreach (TakeObjectHandler h in list) | 343 | foreach (TakeObjectHandler h in list) |
315 | { | 344 | { |
316 | if (h(objectID, AvatarTakingUUID, m_scene) == false) | 345 | if (h(sog, sp) == false) |
317 | { | 346 | return false; |
318 | result = false; | ||
319 | break; | ||
320 | } | ||
321 | } | 347 | } |
322 | } | 348 | } |
323 | |||
324 | // m_log.DebugFormat( | 349 | // m_log.DebugFormat( |
325 | // "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", | 350 | // "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", |
326 | // objectID, AvatarTakingUUID, result); | 351 | // objectID, AvatarTakingUUID, result); |
327 | 352 | return true; | |
328 | return result; | ||
329 | } | 353 | } |
330 | 354 | ||
331 | #endregion | 355 | #endregion |
332 | 356 | ||
333 | #region SELL GROUP OBJECT | 357 | #region SELL GROUP OBJECT |
334 | public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene) | 358 | public bool CanSellGroupObject(UUID userID, UUID groupID) |
335 | { | 359 | { |
336 | bool result = true; | ||
337 | |||
338 | SellGroupObjectHandler handler = OnSellGroupObject; | 360 | SellGroupObjectHandler handler = OnSellGroupObject; |
339 | if (handler != null) | 361 | if (handler != null) |
340 | { | 362 | { |
341 | Delegate[] list = handler.GetInvocationList(); | 363 | Delegate[] list = handler.GetInvocationList(); |
342 | foreach (SellGroupObjectHandler h in list) | 364 | foreach (SellGroupObjectHandler h in list) |
343 | { | 365 | { |
344 | if (h(userID, groupID, scene) == false) | 366 | if (h(userID, groupID) == false) |
345 | { | 367 | return false; |
346 | result = false; | ||
347 | break; | ||
348 | } | ||
349 | } | 368 | } |
350 | } | 369 | } |
351 | |||
352 | //m_log.DebugFormat( | 370 | //m_log.DebugFormat( |
353 | // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}", | 371 | // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}", |
354 | // userID, groupID, result); | 372 | // userID, groupID, result); |
373 | return true; | ||
374 | } | ||
355 | 375 | ||
356 | return result; | 376 | #endregion |
377 | |||
378 | #region SELL OBJECT | ||
379 | public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType) | ||
380 | { | ||
381 | SellObjectHandler handler = OnSellObject; | ||
382 | if (handler != null) | ||
383 | { | ||
384 | if(sog == null || client == null || client.SceneAgent == null) | ||
385 | return false; | ||
386 | |||
387 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
388 | Delegate[] list = handler.GetInvocationList(); | ||
389 | foreach (SellObjectHandler h in list) | ||
390 | { | ||
391 | if (h(sog, sp, saleType) == false) | ||
392 | return false; | ||
393 | } | ||
394 | } | ||
395 | return true; | ||
396 | } | ||
397 | |||
398 | public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType) | ||
399 | { | ||
400 | SellObjectHandlerByUserID handler = OnSellObjectByUserID; | ||
401 | if (handler != null) | ||
402 | { | ||
403 | if(sog == null) | ||
404 | return false; | ||
405 | Delegate[] list = handler.GetInvocationList(); | ||
406 | foreach (SellObjectHandlerByUserID h in list) | ||
407 | { | ||
408 | if (h(sog, userID, saleType) == false) | ||
409 | return false; | ||
410 | } | ||
411 | } | ||
412 | return true; | ||
357 | } | 413 | } |
358 | 414 | ||
359 | #endregion | 415 | #endregion |
360 | 416 | ||
361 | 417 | ||
362 | #region TAKE COPY OBJECT | 418 | #region TAKE COPY OBJECT |
363 | public bool CanTakeCopyObject(UUID objectID, UUID userID) | 419 | public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp) |
364 | { | 420 | { |
365 | bool result = true; | ||
366 | |||
367 | TakeCopyObjectHandler handler = OnTakeCopyObject; | 421 | TakeCopyObjectHandler handler = OnTakeCopyObject; |
368 | if (handler != null) | 422 | if (handler != null) |
369 | { | 423 | { |
424 | if(sog == null || sp == null) | ||
425 | return false; | ||
370 | Delegate[] list = handler.GetInvocationList(); | 426 | Delegate[] list = handler.GetInvocationList(); |
371 | foreach (TakeCopyObjectHandler h in list) | 427 | foreach (TakeCopyObjectHandler h in list) |
372 | { | 428 | { |
373 | if (h(objectID, userID, m_scene) == false) | 429 | if (h(sog, sp) == false) |
374 | { | 430 | return false; |
375 | result = false; | ||
376 | break; | ||
377 | } | ||
378 | } | 431 | } |
379 | } | 432 | } |
380 | |||
381 | // m_log.DebugFormat( | 433 | // m_log.DebugFormat( |
382 | // "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", | 434 | // "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", |
383 | // objectID, userID, result); | 435 | // objectID, userID, result); |
384 | 436 | return true; | |
385 | return result; | ||
386 | } | 437 | } |
387 | 438 | ||
388 | #endregion | 439 | #endregion |
389 | 440 | ||
390 | #region DUPLICATE OBJECT | 441 | #region DUPLICATE OBJECT |
391 | public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) | 442 | public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID) |
392 | { | 443 | { |
393 | DuplicateObjectHandler handler = OnDuplicateObject; | 444 | DuplicateObjectHandler handler = OnDuplicateObject; |
394 | if (handler != null) | 445 | if (handler != null) |
395 | { | 446 | { |
447 | if(sog == null || sog.IsDeleted) | ||
448 | return false; | ||
449 | ScenePresence sp = m_scene.GetScenePresence(agentID); | ||
450 | if(sp == null || sp.IsDeleted) | ||
451 | return false; | ||
396 | Delegate[] list = handler.GetInvocationList(); | 452 | Delegate[] list = handler.GetInvocationList(); |
397 | foreach (DuplicateObjectHandler h in list) | 453 | foreach (DuplicateObjectHandler h in list) |
398 | { | 454 | { |
399 | if (h(objectCount, objectID, owner, m_scene, objectPosition) == false) | 455 | if (h(sog, sp) == false) |
400 | return false; | 456 | return false; |
401 | } | 457 | } |
402 | } | 458 | } |
@@ -405,16 +461,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
405 | 461 | ||
406 | #endregion | 462 | #endregion |
407 | 463 | ||
464 | #region persence EDIT or MOVE OBJECT | ||
465 | private const uint CANSELECTMASK = (uint)( | ||
466 | PrimFlags.ObjectMove | | ||
467 | PrimFlags.ObjectModify | | ||
468 | PrimFlags.ObjectOwnerModify | ||
469 | ); | ||
470 | |||
471 | public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp) | ||
472 | { | ||
473 | uint perms = GenerateClientFlags(part, sp); | ||
474 | return (perms & CANSELECTMASK) != 0; | ||
475 | } | ||
476 | |||
477 | #endregion | ||
408 | #region EDIT OBJECT | 478 | #region EDIT OBJECT |
409 | public bool CanEditObject(UUID objectID, UUID editorID) | 479 | public bool CanEditObject(UUID objectID, UUID editorID) |
410 | { | 480 | { |
481 | EditObjectByIDsHandler handler = OnEditObjectByIDs; | ||
482 | if (handler != null) | ||
483 | { | ||
484 | Delegate[] list = handler.GetInvocationList(); | ||
485 | foreach (EditObjectByIDsHandler h in list) | ||
486 | { | ||
487 | if (h(objectID, editorID) == false) | ||
488 | return false; | ||
489 | } | ||
490 | } | ||
491 | return true; | ||
492 | } | ||
493 | |||
494 | public bool CanEditObject(SceneObjectGroup sog, IClientAPI client) | ||
495 | { | ||
411 | EditObjectHandler handler = OnEditObject; | 496 | EditObjectHandler handler = OnEditObject; |
412 | if (handler != null) | 497 | if (handler != null) |
413 | { | 498 | { |
499 | if(sog == null || client == null || client.SceneAgent == null) | ||
500 | return false; | ||
501 | |||
502 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
503 | |||
414 | Delegate[] list = handler.GetInvocationList(); | 504 | Delegate[] list = handler.GetInvocationList(); |
415 | foreach (EditObjectHandler h in list) | 505 | foreach (EditObjectHandler h in list) |
416 | { | 506 | { |
417 | if (h(objectID, editorID, m_scene) == false) | 507 | if (h(sog, sp) == false) |
418 | return false; | 508 | return false; |
419 | } | 509 | } |
420 | } | 510 | } |
@@ -429,7 +519,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | Delegate[] list = handler.GetInvocationList(); | 519 | Delegate[] list = handler.GetInvocationList(); |
430 | foreach (EditObjectInventoryHandler h in list) | 520 | foreach (EditObjectInventoryHandler h in list) |
431 | { | 521 | { |
432 | if (h(objectID, editorID, m_scene) == false) | 522 | if (h(objectID, editorID) == false) |
433 | return false; | 523 | return false; |
434 | } | 524 | } |
435 | } | 525 | } |
@@ -439,15 +529,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
439 | #endregion | 529 | #endregion |
440 | 530 | ||
441 | #region MOVE OBJECT | 531 | #region MOVE OBJECT |
442 | public bool CanMoveObject(UUID objectID, UUID moverID) | 532 | public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client) |
443 | { | 533 | { |
444 | MoveObjectHandler handler = OnMoveObject; | 534 | MoveObjectHandler handler = OnMoveObject; |
445 | if (handler != null) | 535 | if (handler != null) |
446 | { | 536 | { |
537 | if(sog == null || client == null || client.SceneAgent == null) | ||
538 | return false; | ||
539 | |||
540 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
541 | |||
447 | Delegate[] list = handler.GetInvocationList(); | 542 | Delegate[] list = handler.GetInvocationList(); |
448 | foreach (MoveObjectHandler h in list) | 543 | foreach (MoveObjectHandler h in list) |
449 | { | 544 | { |
450 | if (h(objectID, moverID, m_scene) == false) | 545 | if (h(sog, sp) == false) |
451 | return false; | 546 | return false; |
452 | } | 547 | } |
453 | } | 548 | } |
@@ -457,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | #endregion | 552 | #endregion |
458 | 553 | ||
459 | #region OBJECT ENTRY | 554 | #region OBJECT ENTRY |
460 | public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint) | 555 | public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint) |
461 | { | 556 | { |
462 | ObjectEntryHandler handler = OnObjectEntry; | 557 | ObjectEntryHandler handler = OnObjectEntry; |
463 | if (handler != null) | 558 | if (handler != null) |
@@ -465,7 +560,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | Delegate[] list = handler.GetInvocationList(); | 560 | Delegate[] list = handler.GetInvocationList(); |
466 | foreach (ObjectEntryHandler h in list) | 561 | foreach (ObjectEntryHandler h in list) |
467 | { | 562 | { |
468 | if (h(objectID, enteringRegion, newPoint, m_scene) == false) | 563 | if (h(sog, enteringRegion, newPoint) == false) |
564 | return false; | ||
565 | } | ||
566 | } | ||
567 | return true; | ||
568 | } | ||
569 | |||
570 | public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land) | ||
571 | { | ||
572 | ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts; | ||
573 | if (handler != null) | ||
574 | { | ||
575 | Delegate[] list = handler.GetInvocationList(); | ||
576 | foreach (ObjectEnterWithScriptsHandler h in list) | ||
577 | { | ||
578 | if (h(sog, land) == false) | ||
469 | return false; | 579 | return false; |
470 | } | 580 | } |
471 | } | 581 | } |
@@ -475,29 +585,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
475 | #endregion | 585 | #endregion |
476 | 586 | ||
477 | #region RETURN OBJECT | 587 | #region RETURN OBJECT |
478 | public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) | 588 | public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects) |
479 | { | 589 | { |
480 | bool result = true; | ||
481 | |||
482 | ReturnObjectsHandler handler = OnReturnObjects; | 590 | ReturnObjectsHandler handler = OnReturnObjects; |
483 | if (handler != null) | 591 | if (handler != null) |
484 | { | 592 | { |
593 | if(objects == null) | ||
594 | return false; | ||
595 | |||
596 | ScenePresence sp = null; | ||
597 | if(client != null && client.SceneAgent != null) | ||
598 | sp = client.SceneAgent as ScenePresence; | ||
599 | |||
485 | Delegate[] list = handler.GetInvocationList(); | 600 | Delegate[] list = handler.GetInvocationList(); |
486 | foreach (ReturnObjectsHandler h in list) | 601 | foreach (ReturnObjectsHandler h in list) |
487 | { | 602 | { |
488 | if (h(land, user, objects, m_scene) == false) | 603 | if (h(land, sp, objects) == false) |
489 | { | 604 | return false; |
490 | result = false; | ||
491 | break; | ||
492 | } | ||
493 | } | 605 | } |
494 | } | 606 | } |
495 | |||
496 | // m_log.DebugFormat( | 607 | // m_log.DebugFormat( |
497 | // "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", | 608 | // "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", |
498 | // user, objects.Count, land.LandData.Name, result); | 609 | // user, objects.Count, land.LandData.Name, result); |
499 | 610 | ||
500 | return result; | 611 | return true; |
501 | } | 612 | } |
502 | 613 | ||
503 | #endregion | 614 | #endregion |
@@ -511,7 +622,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
511 | Delegate[] list = handler.GetInvocationList(); | 622 | Delegate[] list = handler.GetInvocationList(); |
512 | foreach (InstantMessageHandler h in list) | 623 | foreach (InstantMessageHandler h in list) |
513 | { | 624 | { |
514 | if (h(user, target, m_scene) == false) | 625 | if (h(user, target) == false) |
515 | return false; | 626 | return false; |
516 | } | 627 | } |
517 | } | 628 | } |
@@ -529,7 +640,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
529 | Delegate[] list = handler.GetInvocationList(); | 640 | Delegate[] list = handler.GetInvocationList(); |
530 | foreach (InventoryTransferHandler h in list) | 641 | foreach (InventoryTransferHandler h in list) |
531 | { | 642 | { |
532 | if (h(user, target, m_scene) == false) | 643 | if (h(user, target) == false) |
533 | return false; | 644 | return false; |
534 | } | 645 | } |
535 | } | 646 | } |
@@ -547,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
547 | Delegate[] list = handler.GetInvocationList(); | 658 | Delegate[] list = handler.GetInvocationList(); |
548 | foreach (ViewScriptHandler h in list) | 659 | foreach (ViewScriptHandler h in list) |
549 | { | 660 | { |
550 | if (h(script, objectID, user, m_scene) == false) | 661 | if (h(script, objectID, user) == false) |
551 | return false; | 662 | return false; |
552 | } | 663 | } |
553 | } | 664 | } |
@@ -562,7 +673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
562 | Delegate[] list = handler.GetInvocationList(); | 673 | Delegate[] list = handler.GetInvocationList(); |
563 | foreach (ViewNotecardHandler h in list) | 674 | foreach (ViewNotecardHandler h in list) |
564 | { | 675 | { |
565 | if (h(script, objectID, user, m_scene) == false) | 676 | if (h(script, objectID, user) == false) |
566 | return false; | 677 | return false; |
567 | } | 678 | } |
568 | } | 679 | } |
@@ -580,7 +691,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | Delegate[] list = handler.GetInvocationList(); | 691 | Delegate[] list = handler.GetInvocationList(); |
581 | foreach (EditScriptHandler h in list) | 692 | foreach (EditScriptHandler h in list) |
582 | { | 693 | { |
583 | if (h(script, objectID, user, m_scene) == false) | 694 | if (h(script, objectID, user) == false) |
584 | return false; | 695 | return false; |
585 | } | 696 | } |
586 | } | 697 | } |
@@ -595,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
595 | Delegate[] list = handler.GetInvocationList(); | 706 | Delegate[] list = handler.GetInvocationList(); |
596 | foreach (EditNotecardHandler h in list) | 707 | foreach (EditNotecardHandler h in list) |
597 | { | 708 | { |
598 | if (h(script, objectID, user, m_scene) == false) | 709 | if (h(script, objectID, user) == false) |
599 | return false; | 710 | return false; |
600 | } | 711 | } |
601 | } | 712 | } |
@@ -607,19 +718,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
607 | #region RUN SCRIPT (When Script Placed in Object) | 718 | #region RUN SCRIPT (When Script Placed in Object) |
608 | public bool CanRunScript(UUID script, UUID objectID, UUID user) | 719 | public bool CanRunScript(UUID script, UUID objectID, UUID user) |
609 | { | 720 | { |
721 | RunScriptHandlerByIDs handler = OnRunScriptByIDs; | ||
722 | if (handler != null) | ||
723 | { | ||
724 | Delegate[] list = handler.GetInvocationList(); | ||
725 | foreach (RunScriptHandlerByIDs h in list) | ||
726 | { | ||
727 | if (h(script, objectID, user) == false) | ||
728 | return false; | ||
729 | } | ||
730 | } | ||
731 | return true; | ||
732 | } | ||
733 | |||
734 | public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part) | ||
735 | { | ||
610 | RunScriptHandler handler = OnRunScript; | 736 | RunScriptHandler handler = OnRunScript; |
611 | if (handler != null) | 737 | if (handler != null) |
612 | { | 738 | { |
739 | if(item == null || part == null) | ||
740 | return false; | ||
613 | Delegate[] list = handler.GetInvocationList(); | 741 | Delegate[] list = handler.GetInvocationList(); |
614 | foreach (RunScriptHandler h in list) | 742 | foreach (RunScriptHandler h in list) |
615 | { | 743 | { |
616 | if (h(script, objectID, user, m_scene) == false) | 744 | if (h(item, part) == false) |
617 | return false; | 745 | return false; |
618 | } | 746 | } |
619 | } | 747 | } |
620 | return true; | 748 | return true; |
621 | } | 749 | } |
622 | 750 | ||
751 | |||
623 | #endregion | 752 | #endregion |
624 | 753 | ||
625 | #region COMPILE SCRIPT (When Script needs to get (re)compiled) | 754 | #region COMPILE SCRIPT (When Script needs to get (re)compiled) |
@@ -631,7 +760,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
631 | Delegate[] list = handler.GetInvocationList(); | 760 | Delegate[] list = handler.GetInvocationList(); |
632 | foreach (CompileScriptHandler h in list) | 761 | foreach (CompileScriptHandler h in list) |
633 | { | 762 | { |
634 | if (h(ownerUUID, scriptType, m_scene) == false) | 763 | if (h(ownerUUID, scriptType) == false) |
635 | return false; | 764 | return false; |
636 | } | 765 | } |
637 | } | 766 | } |
@@ -649,7 +778,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
649 | Delegate[] list = handler.GetInvocationList(); | 778 | Delegate[] list = handler.GetInvocationList(); |
650 | foreach (StartScriptHandler h in list) | 779 | foreach (StartScriptHandler h in list) |
651 | { | 780 | { |
652 | if (h(script, user, m_scene) == false) | 781 | if (h(script, user) == false) |
653 | return false; | 782 | return false; |
654 | } | 783 | } |
655 | } | 784 | } |
@@ -667,7 +796,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
667 | Delegate[] list = handler.GetInvocationList(); | 796 | Delegate[] list = handler.GetInvocationList(); |
668 | foreach (StopScriptHandler h in list) | 797 | foreach (StopScriptHandler h in list) |
669 | { | 798 | { |
670 | if (h(script, user, m_scene) == false) | 799 | if (h(script, user) == false) |
671 | return false; | 800 | return false; |
672 | } | 801 | } |
673 | } | 802 | } |
@@ -685,7 +814,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
685 | Delegate[] list = handler.GetInvocationList(); | 814 | Delegate[] list = handler.GetInvocationList(); |
686 | foreach (ResetScriptHandler h in list) | 815 | foreach (ResetScriptHandler h in list) |
687 | { | 816 | { |
688 | if (h(prim, script, user, m_scene) == false) | 817 | if (h(prim, script, user) == false) |
689 | return false; | 818 | return false; |
690 | } | 819 | } |
691 | } | 820 | } |
@@ -703,7 +832,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
703 | Delegate[] list = handler.GetInvocationList(); | 832 | Delegate[] list = handler.GetInvocationList(); |
704 | foreach (TerraformLandHandler h in list) | 833 | foreach (TerraformLandHandler h in list) |
705 | { | 834 | { |
706 | if (h(user, pos, m_scene) == false) | 835 | if (h(user, pos) == false) |
707 | return false; | 836 | return false; |
708 | } | 837 | } |
709 | } | 838 | } |
@@ -721,7 +850,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
721 | Delegate[] list = handler.GetInvocationList(); | 850 | Delegate[] list = handler.GetInvocationList(); |
722 | foreach (RunConsoleCommandHandler h in list) | 851 | foreach (RunConsoleCommandHandler h in list) |
723 | { | 852 | { |
724 | if (h(user, m_scene) == false) | 853 | if (h(user) == false) |
725 | return false; | 854 | return false; |
726 | } | 855 | } |
727 | } | 856 | } |
@@ -739,7 +868,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
739 | Delegate[] list = handler.GetInvocationList(); | 868 | Delegate[] list = handler.GetInvocationList(); |
740 | foreach (IssueEstateCommandHandler h in list) | 869 | foreach (IssueEstateCommandHandler h in list) |
741 | { | 870 | { |
742 | if (h(user, m_scene, ownerCommand) == false) | 871 | if (h(user, ownerCommand) == false) |
743 | return false; | 872 | return false; |
744 | } | 873 | } |
745 | } | 874 | } |
@@ -750,13 +879,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
750 | #region CAN BE GODLIKE | 879 | #region CAN BE GODLIKE |
751 | public bool IsGod(UUID user) | 880 | public bool IsGod(UUID user) |
752 | { | 881 | { |
753 | IsGodHandler handler = OnIsGod; | 882 | IsAdministratorHandler handler = OnIsAdministrator; |
754 | if (handler != null) | 883 | if (handler != null) |
755 | { | 884 | { |
756 | Delegate[] list = handler.GetInvocationList(); | 885 | Delegate[] list = handler.GetInvocationList(); |
757 | foreach (IsGodHandler h in list) | 886 | foreach (IsAdministratorHandler h in list) |
758 | { | 887 | { |
759 | if (h(user, m_scene) == false) | 888 | if (h(user) == false) |
760 | return false; | 889 | return false; |
761 | } | 890 | } |
762 | } | 891 | } |
@@ -771,7 +900,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
771 | Delegate[] list = handler.GetInvocationList(); | 900 | Delegate[] list = handler.GetInvocationList(); |
772 | foreach (IsGridGodHandler h in list) | 901 | foreach (IsGridGodHandler h in list) |
773 | { | 902 | { |
774 | if (h(user, m_scene) == false) | 903 | if (h(user) == false) |
775 | return false; | 904 | return false; |
776 | } | 905 | } |
777 | } | 906 | } |
@@ -819,7 +948,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
819 | Delegate[] list = handler.GetInvocationList(); | 948 | Delegate[] list = handler.GetInvocationList(); |
820 | foreach (EditParcelPropertiesHandler h in list) | 949 | foreach (EditParcelPropertiesHandler h in list) |
821 | { | 950 | { |
822 | if (h(user, parcel, p, m_scene, allowManager) == false) | 951 | if (h(user, parcel, p, allowManager) == false) |
823 | return false; | 952 | return false; |
824 | } | 953 | } |
825 | } | 954 | } |
@@ -836,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
836 | Delegate[] list = handler.GetInvocationList(); | 965 | Delegate[] list = handler.GetInvocationList(); |
837 | foreach (SellParcelHandler h in list) | 966 | foreach (SellParcelHandler h in list) |
838 | { | 967 | { |
839 | if (h(user, parcel, m_scene) == false) | 968 | if (h(user, parcel) == false) |
840 | return false; | 969 | return false; |
841 | } | 970 | } |
842 | } | 971 | } |
@@ -853,7 +982,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | Delegate[] list = handler.GetInvocationList(); | 982 | Delegate[] list = handler.GetInvocationList(); |
854 | foreach (AbandonParcelHandler h in list) | 983 | foreach (AbandonParcelHandler h in list) |
855 | { | 984 | { |
856 | if (h(user, parcel, m_scene) == false) | 985 | if (h(user, parcel) == false) |
857 | return false; | 986 | return false; |
858 | } | 987 | } |
859 | } | 988 | } |
@@ -869,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
869 | Delegate[] list = handler.GetInvocationList(); | 998 | Delegate[] list = handler.GetInvocationList(); |
870 | foreach (ReclaimParcelHandler h in list) | 999 | foreach (ReclaimParcelHandler h in list) |
871 | { | 1000 | { |
872 | if (h(user, parcel, m_scene) == false) | 1001 | if (h(user, parcel) == false) |
873 | return false; | 1002 | return false; |
874 | } | 1003 | } |
875 | } | 1004 | } |
@@ -884,22 +1013,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
884 | Delegate[] list = handler.GetInvocationList(); | 1013 | Delegate[] list = handler.GetInvocationList(); |
885 | foreach (DeedParcelHandler h in list) | 1014 | foreach (DeedParcelHandler h in list) |
886 | { | 1015 | { |
887 | if (h(user, parcel, m_scene) == false) | 1016 | if (h(user, parcel) == false) |
888 | return false; | 1017 | return false; |
889 | } | 1018 | } |
890 | } | 1019 | } |
891 | return true; | 1020 | return true; |
892 | } | 1021 | } |
893 | 1022 | ||
894 | public bool CanDeedObject(UUID user, UUID group) | 1023 | public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID) |
895 | { | 1024 | { |
896 | DeedObjectHandler handler = OnDeedObject; | 1025 | DeedObjectHandler handler = OnDeedObject; |
897 | if (handler != null) | 1026 | if (handler != null) |
898 | { | 1027 | { |
1028 | if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero) | ||
1029 | return false; | ||
1030 | |||
1031 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
1032 | |||
899 | Delegate[] list = handler.GetInvocationList(); | 1033 | Delegate[] list = handler.GetInvocationList(); |
900 | foreach (DeedObjectHandler h in list) | 1034 | foreach (DeedObjectHandler h in list) |
901 | { | 1035 | { |
902 | if (h(user, group, m_scene) == false) | 1036 | if (h(sp, sog, targetGroupID) == false) |
903 | return false; | 1037 | return false; |
904 | } | 1038 | } |
905 | } | 1039 | } |
@@ -914,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
914 | Delegate[] list = handler.GetInvocationList(); | 1048 | Delegate[] list = handler.GetInvocationList(); |
915 | foreach (BuyLandHandler h in list) | 1049 | foreach (BuyLandHandler h in list) |
916 | { | 1050 | { |
917 | if (h(user, parcel, m_scene) == false) | 1051 | if (h(user, parcel) == false) |
918 | return false; | 1052 | return false; |
919 | } | 1053 | } |
920 | } | 1054 | } |
@@ -990,6 +1124,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
990 | return true; | 1124 | return true; |
991 | } | 1125 | } |
992 | 1126 | ||
1127 | public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart) | ||
1128 | { | ||
1129 | DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv; | ||
1130 | if (handler != null) | ||
1131 | { | ||
1132 | if (sourcePart == null || destPart == null || item == null) | ||
1133 | return false; | ||
1134 | Delegate[] list = handler.GetInvocationList(); | ||
1135 | foreach (DoObjectInvToObjectInv h in list) | ||
1136 | { | ||
1137 | if (h(item, sourcePart, destPart) == false) | ||
1138 | return false; | ||
1139 | } | ||
1140 | } | ||
1141 | return true; | ||
1142 | } | ||
1143 | |||
1144 | public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart) | ||
1145 | { | ||
1146 | DoDropInObjectInv handler = OnDropInObjectInv; | ||
1147 | if (handler != null) | ||
1148 | { | ||
1149 | if (client == null || client.SceneAgent == null|| destPart == null || item == null) | ||
1150 | return false; | ||
1151 | |||
1152 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
1153 | if(sp == null || sp.IsDeleted) | ||
1154 | return false; | ||
1155 | |||
1156 | Delegate[] list = handler.GetInvocationList(); | ||
1157 | foreach (DoDropInObjectInv h in list) | ||
1158 | { | ||
1159 | if (h(item, sp, destPart) == false) | ||
1160 | return false; | ||
1161 | } | ||
1162 | } | ||
1163 | return true; | ||
1164 | } | ||
1165 | |||
993 | public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) | 1166 | public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) |
994 | { | 1167 | { |
995 | DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; | 1168 | DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2137b42..715ae5c 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -540,6 +540,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | private Timer m_mapGenerationTimer = new Timer(); | 540 | private Timer m_mapGenerationTimer = new Timer(); |
541 | private bool m_generateMaptiles; | 541 | private bool m_generateMaptiles; |
542 | 542 | ||
543 | protected int m_lastHealth = -1; | ||
544 | protected int m_lastUsers = -1; | ||
545 | |||
543 | #endregion Fields | 546 | #endregion Fields |
544 | 547 | ||
545 | #region Properties | 548 | #region Properties |
@@ -805,6 +808,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
805 | private float m_minReprioritizationDistance = 32f; | 808 | private float m_minReprioritizationDistance = 32f; |
806 | public bool ObjectsCullingByDistance = false; | 809 | public bool ObjectsCullingByDistance = false; |
807 | 810 | ||
811 | private ExpiringCache<UUID, UUID> TeleportTargetsCoolDown = new ExpiringCache<UUID, UUID>(); | ||
812 | |||
808 | public AgentCircuitManager AuthenticateHandler | 813 | public AgentCircuitManager AuthenticateHandler |
809 | { | 814 | { |
810 | get { return m_authenticateHandler; } | 815 | get { return m_authenticateHandler; } |
@@ -1212,6 +1217,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1212 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1217 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1213 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1218 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1214 | 1219 | ||
1220 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
1221 | if (restartConfig != null) | ||
1222 | { | ||
1223 | string markerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
1224 | |||
1225 | if (markerPath != String.Empty) | ||
1226 | { | ||
1227 | string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".started"); | ||
1228 | try | ||
1229 | { | ||
1230 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
1231 | FileStream fs = File.Create(path); | ||
1232 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
1233 | Byte[] buf = enc.GetBytes(pidstring); | ||
1234 | fs.Write(buf, 0, buf.Length); | ||
1235 | fs.Close(); | ||
1236 | } | ||
1237 | catch (Exception) | ||
1238 | { | ||
1239 | } | ||
1240 | } | ||
1241 | } | ||
1242 | |||
1243 | StartTimerWatchdog(); | ||
1215 | } | 1244 | } |
1216 | 1245 | ||
1217 | public Scene(RegionInfo regInfo) | 1246 | public Scene(RegionInfo regInfo) |
@@ -1482,6 +1511,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1482 | return; | 1511 | return; |
1483 | } | 1512 | } |
1484 | 1513 | ||
1514 | IEtcdModule etcd = RequestModuleInterface<IEtcdModule>(); | ||
1515 | if (etcd != null) | ||
1516 | { | ||
1517 | etcd.Delete("Health"); | ||
1518 | etcd.Delete("HealthFlags"); | ||
1519 | etcd.Delete("RootAgents"); | ||
1520 | } | ||
1521 | |||
1485 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); | 1522 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); |
1486 | 1523 | ||
1487 | 1524 | ||
@@ -1520,6 +1557,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1520 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1557 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1521 | Backup(true); | 1558 | Backup(true); |
1522 | 1559 | ||
1560 | m_log.Debug("[SCENE]: Closing scene"); | ||
1561 | |||
1523 | m_sceneGraph.Close(); | 1562 | m_sceneGraph.Close(); |
1524 | 1563 | ||
1525 | base.Close(); | 1564 | base.Close(); |
@@ -2351,6 +2390,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2351 | EventManager.TriggerOnSceneObjectLoaded(group); | 2390 | EventManager.TriggerOnSceneObjectLoaded(group); |
2352 | SceneObjectPart rootPart = group.GetPart(group.UUID); | 2391 | SceneObjectPart rootPart = group.GetPart(group.UUID); |
2353 | rootPart.Flags &= ~PrimFlags.Scripted; | 2392 | rootPart.Flags &= ~PrimFlags.Scripted; |
2393 | group.AggregateDeepPerms(); | ||
2354 | rootPart.TrimPermissions(); | 2394 | rootPart.TrimPermissions(); |
2355 | 2395 | ||
2356 | // Don't do this here - it will get done later on when sculpt data is loaded. | 2396 | // Don't do this here - it will get done later on when sculpt data is loaded. |
@@ -2603,8 +2643,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2603 | { | 2643 | { |
2604 | // Otherwise, use this default creation code; | 2644 | // Otherwise, use this default creation code; |
2605 | sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); | 2645 | sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); |
2606 | AddNewSceneObject(sceneObject, true); | ||
2607 | sceneObject.SetGroup(groupID, null); | 2646 | sceneObject.SetGroup(groupID, null); |
2647 | AddNewSceneObject(sceneObject, true); | ||
2608 | 2648 | ||
2609 | if (AgentPreferencesService != null) // This will override the brave new full perm world! | 2649 | if (AgentPreferencesService != null) // This will override the brave new full perm world! |
2610 | { | 2650 | { |
@@ -2622,6 +2662,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2622 | if (UserManagementModule != null) | 2662 | if (UserManagementModule != null) |
2623 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); | 2663 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); |
2624 | 2664 | ||
2665 | sceneObject.AggregateDeepPerms(); | ||
2625 | sceneObject.ScheduleGroupForFullUpdate(); | 2666 | sceneObject.ScheduleGroupForFullUpdate(); |
2626 | 2667 | ||
2627 | return sceneObject; | 2668 | return sceneObject; |
@@ -2768,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2768 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2809 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2769 | if (sog != null && !sog.IsAttachment) | 2810 | if (sog != null && !sog.IsAttachment) |
2770 | { | 2811 | { |
2771 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | 2812 | if (!exceptNoCopy || ((sog.EffectiveOwnerPerms & (uint)PermissionMask.Copy) != 0)) |
2772 | { | 2813 | { |
2773 | DeleteSceneObject((SceneObjectGroup)e, false); | 2814 | DeleteSceneObject((SceneObjectGroup)e, false); |
2774 | } | 2815 | } |
@@ -2782,7 +2823,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2782 | } | 2823 | } |
2783 | if (toReturn.Count > 0) | 2824 | if (toReturn.Count > 0) |
2784 | { | 2825 | { |
2785 | returnObjects(toReturn.ToArray(), UUID.Zero); | 2826 | returnObjects(toReturn.ToArray(), null); |
2786 | } | 2827 | } |
2787 | } | 2828 | } |
2788 | 2829 | ||
@@ -2944,15 +2985,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2944 | // Return 'true' if position inside region. | 2985 | // Return 'true' if position inside region. |
2945 | public bool PositionIsInCurrentRegion(Vector3 pos) | 2986 | public bool PositionIsInCurrentRegion(Vector3 pos) |
2946 | { | 2987 | { |
2947 | bool ret = false; | 2988 | float t = pos.X; |
2948 | int xx = (int)Math.Floor(pos.X); | 2989 | if (t < 0 || t >= RegionInfo.RegionSizeX) |
2949 | int yy = (int)Math.Floor(pos.Y); | ||
2950 | if (xx < 0 || yy < 0) | ||
2951 | return false; | 2990 | return false; |
2952 | 2991 | ||
2953 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | 2992 | t = pos.Y; |
2954 | ret = true; | 2993 | if (t < 0 || t >= RegionInfo.RegionSizeY) |
2955 | return ret; | 2994 | return false; |
2995 | |||
2996 | return true; | ||
2956 | } | 2997 | } |
2957 | 2998 | ||
2958 | /// <summary> | 2999 | /// <summary> |
@@ -3603,7 +3644,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3603 | /// <param name="GroupID">Group of new object</param> | 3644 | /// <param name="GroupID">Group of new object</param> |
3604 | public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) | 3645 | public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) |
3605 | { | 3646 | { |
3606 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | 3647 | bool createSelected = (flags & (uint)PrimFlags.CreateSelected) != 0; |
3648 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, AgentID, | ||
3649 | GroupID, Quaternion.Identity, createSelected); | ||
3607 | if (copy != null) | 3650 | if (copy != null) |
3608 | EventManager.TriggerObjectAddedToScene(copy); | 3651 | EventManager.TriggerObjectAddedToScene(copy); |
3609 | } | 3652 | } |
@@ -3633,6 +3676,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3633 | SceneObjectPart target = GetSceneObjectPart(localID); | 3676 | SceneObjectPart target = GetSceneObjectPart(localID); |
3634 | SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj); | 3677 | SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj); |
3635 | 3678 | ||
3679 | bool createSelected = (dupeFlags & (uint)PrimFlags.CreateSelected) != 0; | ||
3680 | |||
3636 | if (target != null && target2 != null) | 3681 | if (target != null && target2 != null) |
3637 | { | 3682 | { |
3638 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); | 3683 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); |
@@ -3674,13 +3719,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3674 | Quaternion worldRot = target2.GetWorldRotation(); | 3719 | Quaternion worldRot = target2.GetWorldRotation(); |
3675 | 3720 | ||
3676 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3721 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3677 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3722 | copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, worldRot, createSelected); |
3678 | //obj.Rotation = worldRot; | 3723 | //obj.Rotation = worldRot; |
3679 | //obj.UpdateGroupRotationR(worldRot); | 3724 | //obj.UpdateGroupRotationR(worldRot); |
3680 | } | 3725 | } |
3681 | else | 3726 | else |
3682 | { | 3727 | { |
3683 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); | 3728 | copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, Quaternion.Identity, createSelected); |
3684 | } | 3729 | } |
3685 | 3730 | ||
3686 | if (copy != null) | 3731 | if (copy != null) |
@@ -3983,7 +4028,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3983 | 4028 | ||
3984 | if (!LoginsEnabled) | 4029 | if (!LoginsEnabled) |
3985 | { | 4030 | { |
3986 | reason = "Logins Disabled"; | 4031 | reason = "Logins to this region are disabled"; |
3987 | return false; | 4032 | return false; |
3988 | } | 4033 | } |
3989 | 4034 | ||
@@ -5077,65 +5122,59 @@ Label_GroupsDone: | |||
5077 | #endregion | 5122 | #endregion |
5078 | 5123 | ||
5079 | #region Script Engine | 5124 | #region Script Engine |
5080 | 5125 | public bool LSLScriptDanger(SceneObjectPart part, Vector3 pos) | |
5081 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) | ||
5082 | { | 5126 | { |
5127 | |||
5083 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 5128 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
5084 | if (part != null) | 5129 | if (parcel == null) |
5085 | { | 5130 | return true; |
5086 | if (parcel != null) | 5131 | |
5087 | { | 5132 | LandData ldata = parcel.LandData; |
5088 | if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0) | 5133 | if (ldata == null) |
5089 | { | 5134 | return true; |
5090 | return true; | 5135 | |
5091 | } | 5136 | uint landflags = ldata.Flags; |
5092 | else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID)) | 5137 | |
5093 | { | 5138 | uint mask = (uint)(ParcelFlags.CreateObjects | ParcelFlags.AllowAPrimitiveEntry); |
5094 | return true; | 5139 | if((landflags & mask) != mask) |
5095 | } | 5140 | return true; |
5096 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 5141 | |
5097 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | 5142 | if((landflags & (uint)ParcelFlags.AllowOtherScripts) != 0) |
5098 | { | 5143 | return false; |
5099 | return true; | ||
5100 | } | ||
5101 | else | ||
5102 | { | ||
5103 | return false; | ||
5104 | } | ||
5105 | } | ||
5106 | else | ||
5107 | { | ||
5108 | 5144 | ||
5109 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) | 5145 | if(part == null) |
5110 | { | 5146 | return true; |
5111 | // The only time parcel != null when an object is inside a region is when | 5147 | if(part.GroupID == ldata.GroupID && (landflags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
5112 | // there is nothing behind the landchannel. IE, no land plugin loaded. | ||
5113 | return true; | ||
5114 | } | ||
5115 | else | ||
5116 | { | ||
5117 | // The object is outside of this region. Stop piping events to it. | ||
5118 | return false; | ||
5119 | } | ||
5120 | } | ||
5121 | } | ||
5122 | else | ||
5123 | { | ||
5124 | return false; | 5148 | return false; |
5125 | } | 5149 | |
5150 | return true; | ||
5126 | } | 5151 | } |
5127 | 5152 | ||
5128 | public bool ScriptDanger(uint localID, Vector3 pos) | 5153 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
5129 | { | 5154 | { |
5130 | SceneObjectPart part = GetSceneObjectPart(localID); | 5155 | if (part == null) |
5131 | if (part != null) | 5156 | return false; |
5157 | |||
5158 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | ||
5159 | if (parcel != null) | ||
5132 | { | 5160 | { |
5133 | return ScriptDanger(part, pos); | 5161 | if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0) |
5162 | return true; | ||
5163 | |||
5164 | if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID)) | ||
5165 | return true; | ||
5166 | |||
5167 | if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | ||
5168 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | ||
5169 | return true; | ||
5134 | } | 5170 | } |
5135 | else | 5171 | else |
5136 | { | 5172 | { |
5137 | return false; | 5173 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) |
5174 | return true; | ||
5138 | } | 5175 | } |
5176 | |||
5177 | return false; | ||
5139 | } | 5178 | } |
5140 | 5179 | ||
5141 | public bool PipeEventsForScript(uint localID) | 5180 | public bool PipeEventsForScript(uint localID) |
@@ -5512,23 +5551,24 @@ Label_GroupsDone: | |||
5512 | return 0; | 5551 | return 0; |
5513 | } | 5552 | } |
5514 | 5553 | ||
5515 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5554 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 2000) |
5516 | { | 5555 | { |
5517 | health+=1; | 5556 | health+=1; |
5518 | flags |= 1; | 5557 | flags |= 1; |
5519 | } | 5558 | } |
5520 | 5559 | ||
5521 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | 5560 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 2000) |
5522 | { | 5561 | { |
5523 | health+=1; | 5562 | health+=1; |
5524 | flags |= 2; | 5563 | flags |= 2; |
5525 | } | 5564 | } |
5526 | 5565 | ||
5527 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | 5566 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 2000) |
5528 | { | 5567 | { |
5529 | health+=1; | 5568 | health+=1; |
5530 | flags |= 4; | 5569 | flags |= 4; |
5531 | } | 5570 | } |
5571 | /* | ||
5532 | else | 5572 | else |
5533 | { | 5573 | { |
5534 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | 5574 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; |
@@ -5541,6 +5581,7 @@ proc.WaitForExit(); | |||
5541 | Thread.Sleep(1000); | 5581 | Thread.Sleep(1000); |
5542 | Environment.Exit(1); | 5582 | Environment.Exit(1); |
5543 | } | 5583 | } |
5584 | */ | ||
5544 | 5585 | ||
5545 | if (flags != 7) | 5586 | if (flags != 7) |
5546 | return health; | 5587 | return health; |
@@ -6305,6 +6346,32 @@ Environment.Exit(1); | |||
6305 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | 6346 | public void TimerWatchdog(object sender, ElapsedEventArgs e) |
6306 | { | 6347 | { |
6307 | CheckHeartbeat(); | 6348 | CheckHeartbeat(); |
6349 | |||
6350 | IEtcdModule etcd = RequestModuleInterface<IEtcdModule>(); | ||
6351 | int flags; | ||
6352 | string message; | ||
6353 | if (etcd != null) | ||
6354 | { | ||
6355 | int health = GetHealth(out flags, out message); | ||
6356 | if (health != m_lastHealth) | ||
6357 | { | ||
6358 | m_lastHealth = health; | ||
6359 | |||
6360 | etcd.Store("Health", health.ToString(), 300000); | ||
6361 | etcd.Store("HealthFlags", flags.ToString(), 300000); | ||
6362 | } | ||
6363 | |||
6364 | int roots = 0; | ||
6365 | foreach (ScenePresence sp in GetScenePresences()) | ||
6366 | if (!sp.IsChildAgent && !sp.IsNPC) | ||
6367 | roots++; | ||
6368 | |||
6369 | if (m_lastUsers != roots) | ||
6370 | { | ||
6371 | m_lastUsers = roots; | ||
6372 | etcd.Store("RootAgents", roots.ToString(), 300000); | ||
6373 | } | ||
6374 | } | ||
6308 | } | 6375 | } |
6309 | 6376 | ||
6310 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 6377 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
@@ -6461,5 +6528,21 @@ Environment.Exit(1); | |||
6461 | 6528 | ||
6462 | m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty); | 6529 | m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty); |
6463 | } | 6530 | } |
6531 | |||
6532 | public bool InTeleportTargetsCoolDown(UUID sourceID, UUID targetID, double timeout) | ||
6533 | { | ||
6534 | lock(TeleportTargetsCoolDown) | ||
6535 | { | ||
6536 | UUID lastSource = UUID.Zero; | ||
6537 | TeleportTargetsCoolDown.TryGetValue(targetID, out lastSource); | ||
6538 | if(lastSource == UUID.Zero) | ||
6539 | { | ||
6540 | TeleportTargetsCoolDown.Add(targetID, sourceID, timeout); | ||
6541 | return false; | ||
6542 | } | ||
6543 | TeleportTargetsCoolDown.AddOrUpdate(targetID, sourceID, timeout); | ||
6544 | return lastSource == sourceID; | ||
6545 | } | ||
6546 | } | ||
6464 | } | 6547 | } |
6465 | } | 6548 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2f65ce2..a005068 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | sceneObject.ForceInventoryPersistence(); | 343 | sceneObject.ForceInventoryPersistence(); |
344 | sceneObject.HasGroupChanged = true; | 344 | sceneObject.HasGroupChanged = true; |
345 | } | 345 | } |
346 | 346 | sceneObject.AggregateDeepPerms(); | |
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | 349 | ||
@@ -549,6 +549,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
549 | // that are part of the Scene Object being removed | 549 | // that are part of the Scene Object being removed |
550 | m_numTotalPrim -= grp.PrimCount; | 550 | m_numTotalPrim -= grp.PrimCount; |
551 | 551 | ||
552 | bool isPh = (grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics; | ||
553 | int nphysparts = 0; | ||
552 | // Go through all parts (primitives and meshes) of this Scene Object | 554 | // Go through all parts (primitives and meshes) of this Scene Object |
553 | foreach (SceneObjectPart part in grp.Parts) | 555 | foreach (SceneObjectPart part in grp.Parts) |
554 | { | 556 | { |
@@ -559,10 +561,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | m_numMesh--; | 561 | m_numMesh--; |
560 | else | 562 | else |
561 | m_numPrim--; | 563 | m_numPrim--; |
564 | |||
565 | if(isPh && part.PhysicsShapeType != (byte)PhysShapeType.none) | ||
566 | nphysparts++; | ||
562 | } | 567 | } |
563 | 568 | ||
564 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 569 | if (nphysparts > 0 ) |
565 | RemovePhysicalPrim(grp.PrimCount); | 570 | RemovePhysicalPrim(nphysparts); |
566 | } | 571 | } |
567 | 572 | ||
568 | bool ret = Entities.Remove(uuid); | 573 | bool ret = Entities.Remove(uuid); |
@@ -1358,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1358 | SceneObjectGroup grp = part.ParentGroup; | 1363 | SceneObjectGroup grp = part.ParentGroup; |
1359 | if (grp != null) | 1364 | if (grp != null) |
1360 | { | 1365 | { |
1361 | if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) | 1366 | if (m_parentScene.Permissions.CanEditObject(grp, remoteClient)) |
1362 | { | 1367 | { |
1363 | // These two are exceptions SL makes in the interpretation | 1368 | // These two are exceptions SL makes in the interpretation |
1364 | // of the change flags. Must check them here because otherwise | 1369 | // of the change flags. Must check them here because otherwise |
@@ -1379,7 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) | 1384 | if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) |
1380 | { | 1385 | { |
1381 | // Are we allowed to move it? | 1386 | // Are we allowed to move it? |
1382 | if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId)) | 1387 | if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient)) |
1383 | { | 1388 | { |
1384 | // Strip all but move and rotation from request | 1389 | // Strip all but move and rotation from request |
1385 | data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); | 1390 | data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); |
@@ -1406,7 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | 1411 | ||
1407 | if (part != null) | 1412 | if (part != null) |
1408 | { | 1413 | { |
1409 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) | 1414 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient)) |
1410 | { | 1415 | { |
1411 | bool physbuild = false; | 1416 | bool physbuild = false; |
1412 | if (part.ParentGroup.RootPart.PhysActor != null) | 1417 | if (part.ParentGroup.RootPart.PhysActor != null) |
@@ -1428,7 +1433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1428 | SceneObjectGroup group = GetGroupByPrim(localID); | 1433 | SceneObjectGroup group = GetGroupByPrim(localID); |
1429 | if (group != null) | 1434 | if (group != null) |
1430 | { | 1435 | { |
1431 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1436 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1432 | { | 1437 | { |
1433 | bool physbuild = false; | 1438 | bool physbuild = false; |
1434 | if (group.RootPart.PhysActor != null) | 1439 | if (group.RootPart.PhysActor != null) |
@@ -1474,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1474 | SceneObjectGroup group = GetGroupByPrim(localID); | 1479 | SceneObjectGroup group = GetGroupByPrim(localID); |
1475 | if (group != null) | 1480 | if (group != null) |
1476 | { | 1481 | { |
1477 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1482 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1478 | { | 1483 | { |
1479 | group.UpdateSingleRotation(rot, localID); | 1484 | group.UpdateSingleRotation(rot, localID); |
1480 | } | 1485 | } |
@@ -1492,7 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1492 | SceneObjectGroup group = GetGroupByPrim(localID); | 1497 | SceneObjectGroup group = GetGroupByPrim(localID); |
1493 | if (group != null) | 1498 | if (group != null) |
1494 | { | 1499 | { |
1495 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1500 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1496 | { | 1501 | { |
1497 | group.UpdateSingleRotation(rot, pos, localID); | 1502 | group.UpdateSingleRotation(rot, pos, localID); |
1498 | } | 1503 | } |
@@ -1510,7 +1515,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1510 | SceneObjectGroup group = GetGroupByPrim(localID); | 1515 | SceneObjectGroup group = GetGroupByPrim(localID); |
1511 | if (group != null) | 1516 | if (group != null) |
1512 | { | 1517 | { |
1513 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1518 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1514 | { | 1519 | { |
1515 | group.UpdateGroupRotationR(rot); | 1520 | group.UpdateGroupRotationR(rot); |
1516 | } | 1521 | } |
@@ -1529,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1529 | SceneObjectGroup group = GetGroupByPrim(localID); | 1534 | SceneObjectGroup group = GetGroupByPrim(localID); |
1530 | if (group != null) | 1535 | if (group != null) |
1531 | { | 1536 | { |
1532 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1537 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1533 | { | 1538 | { |
1534 | group.UpdateGroupRotationPR(pos, rot); | 1539 | group.UpdateGroupRotationPR(pos, rot); |
1535 | } | 1540 | } |
@@ -1547,7 +1552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1547 | SceneObjectGroup group = GetGroupByPrim(localID); | 1552 | SceneObjectGroup group = GetGroupByPrim(localID); |
1548 | if (group != null) | 1553 | if (group != null) |
1549 | { | 1554 | { |
1550 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) | 1555 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment) |
1551 | { | 1556 | { |
1552 | group.UpdateSinglePosition(pos, localID); | 1557 | group.UpdateSinglePosition(pos, localID); |
1553 | } | 1558 | } |
@@ -1562,17 +1567,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1562 | /// <param name="remoteClient"></param> | 1567 | /// <param name="remoteClient"></param> |
1563 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) | 1568 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) |
1564 | { | 1569 | { |
1565 | UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId); | ||
1566 | } | ||
1567 | |||
1568 | /// <summary> | ||
1569 | /// Update the position of the given group. | ||
1570 | /// </summary> | ||
1571 | /// <param name="localId"></param> | ||
1572 | /// <param name="pos"></param> | ||
1573 | /// <param name="updatingAgentId"></param> | ||
1574 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId) | ||
1575 | { | ||
1576 | SceneObjectGroup group = GetGroupByPrim(localId); | 1570 | SceneObjectGroup group = GetGroupByPrim(localId); |
1577 | 1571 | ||
1578 | if (group != null) | 1572 | if (group != null) |
@@ -1580,7 +1574,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1580 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1574 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1581 | { | 1575 | { |
1582 | // Set the new attachment point data in the object | 1576 | // Set the new attachment point data in the object |
1583 | byte attachmentPoint = group.GetAttachmentPoint(); | 1577 | byte attachmentPoint = (byte)group.AttachmentPoint; |
1584 | group.UpdateGroupPosition(pos); | 1578 | group.UpdateGroupPosition(pos); |
1585 | group.IsAttachment = false; | 1579 | group.IsAttachment = false; |
1586 | group.AbsolutePosition = group.RootPart.AttachedPos; | 1580 | group.AbsolutePosition = group.RootPart.AttachedPos; |
@@ -1589,8 +1583,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1589 | } | 1583 | } |
1590 | else | 1584 | else |
1591 | { | 1585 | { |
1592 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) | 1586 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) |
1593 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1587 | && m_parentScene.Permissions.CanObjectEntry(group, false, pos)) |
1594 | { | 1588 | { |
1595 | group.UpdateGroupPosition(pos); | 1589 | group.UpdateGroupPosition(pos); |
1596 | } | 1590 | } |
@@ -1614,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1614 | 1608 | ||
1615 | if (group != null) | 1609 | if (group != null) |
1616 | { | 1610 | { |
1617 | if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) | 1611 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1618 | { | 1612 | { |
1619 | group.UpdateTextureEntry(localID, texture); | 1613 | group.UpdateTextureEntry(localID, texture); |
1620 | } | 1614 | } |
@@ -1638,7 +1632,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1638 | SceneObjectGroup group = GetGroupByPrim(localID); | 1632 | SceneObjectGroup group = GetGroupByPrim(localID); |
1639 | if (group != null) | 1633 | if (group != null) |
1640 | { | 1634 | { |
1641 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1635 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1642 | { | 1636 | { |
1643 | // VolumeDetect can't be set via UI and will always be off when a change is made there | 1637 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1644 | // now only change volume dtc if phantom off | 1638 | // now only change volume dtc if phantom off |
@@ -1685,7 +1679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1685 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1679 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1686 | if (group != null) | 1680 | if (group != null) |
1687 | { | 1681 | { |
1688 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1682 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1689 | { | 1683 | { |
1690 | group.SetPartName(Util.CleanString(name), primLocalID); | 1684 | group.SetPartName(Util.CleanString(name), primLocalID); |
1691 | group.HasGroupChanged = true; | 1685 | group.HasGroupChanged = true; |
@@ -1703,7 +1697,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1703 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1697 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1704 | if (group != null) | 1698 | if (group != null) |
1705 | { | 1699 | { |
1706 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1700 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1707 | { | 1701 | { |
1708 | group.SetPartDescription(Util.CleanString(description), primLocalID); | 1702 | group.SetPartDescription(Util.CleanString(description), primLocalID); |
1709 | group.HasGroupChanged = true; | 1703 | group.HasGroupChanged = true; |
@@ -1725,7 +1719,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1725 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1719 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1726 | if (group != null) | 1720 | if (group != null) |
1727 | { | 1721 | { |
1728 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1722 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1729 | { | 1723 | { |
1730 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1724 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1731 | if (part != null) | 1725 | if (part != null) |
@@ -1742,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1742 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1736 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1743 | if (group != null) | 1737 | if (group != null) |
1744 | { | 1738 | { |
1745 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1739 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1746 | { | 1740 | { |
1747 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1741 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1748 | if (part != null) | 1742 | if (part != null) |
@@ -1996,6 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1996 | { | 1990 | { |
1997 | newRoot.TriggerScriptChangedEvent(Changed.LINK); | 1991 | newRoot.TriggerScriptChangedEvent(Changed.LINK); |
1998 | newRoot.ParentGroup.HasGroupChanged = true; | 1992 | newRoot.ParentGroup.HasGroupChanged = true; |
1993 | newRoot.ParentGroup.InvalidatePartsLinkMaps(); | ||
1999 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); | 1994 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); |
2000 | } | 1995 | } |
2001 | } | 1996 | } |
@@ -2012,6 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | // from the database. They will be rewritten immediately, | 2007 | // from the database. They will be rewritten immediately, |
2013 | // minus the rows for the unlinked child prims. | 2008 | // minus the rows for the unlinked child prims. |
2014 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); | 2009 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); |
2010 | g.InvalidatePartsLinkMaps(); | ||
2015 | g.TriggerScriptChangedEvent(Changed.LINK); | 2011 | g.TriggerScriptChangedEvent(Changed.LINK); |
2016 | g.HasGroupChanged = true; // Persist | 2012 | g.HasGroupChanged = true; // Persist |
2017 | g.ScheduleGroupForFullUpdate(); | 2013 | g.ScheduleGroupForFullUpdate(); |
@@ -2025,27 +2021,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2025 | 2021 | ||
2026 | protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) | 2022 | protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) |
2027 | { | 2023 | { |
2028 | UUID user = remoteClient.AgentId; | 2024 | SceneObjectGroup sog = GetGroupByPrim(localID); |
2029 | UUID objid = UUID.Zero; | 2025 | if(sog == null) |
2030 | SceneObjectPart obj = null; | 2026 | return; |
2031 | |||
2032 | EntityBase[] entityList = GetEntities(); | ||
2033 | foreach (EntityBase ent in entityList) | ||
2034 | { | ||
2035 | if (ent is SceneObjectGroup) | ||
2036 | { | ||
2037 | SceneObjectGroup sog = ent as SceneObjectGroup; | ||
2038 | |||
2039 | foreach (SceneObjectPart part in sog.Parts) | ||
2040 | { | ||
2041 | if (part.LocalId == localID) | ||
2042 | { | ||
2043 | objid = part.UUID; | ||
2044 | obj = part; | ||
2045 | } | ||
2046 | } | ||
2047 | } | ||
2048 | } | ||
2049 | 2027 | ||
2050 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints | 2028 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints |
2051 | //aka ObjectFlags.JointWheel = IncludeInSearch | 2029 | //aka ObjectFlags.JointWheel = IncludeInSearch |
@@ -2062,15 +2040,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2062 | // libomv will complain about PrimFlags.JointWheel being | 2040 | // libomv will complain about PrimFlags.JointWheel being |
2063 | // deprecated, so we | 2041 | // deprecated, so we |
2064 | #pragma warning disable 0612 | 2042 | #pragma warning disable 0612 |
2065 | if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user)) | 2043 | if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient)) |
2066 | { | 2044 | { |
2067 | obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel); | 2045 | sog.RootPart.AddFlag(PrimFlags.JointWheel); |
2068 | obj.ParentGroup.HasGroupChanged = true; | 2046 | sog.HasGroupChanged = true; |
2069 | } | 2047 | } |
2070 | else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user)) | 2048 | else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient)) |
2071 | { | 2049 | { |
2072 | obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel); | 2050 | sog.RootPart.RemFlag(PrimFlags.JointWheel); |
2073 | obj.ParentGroup.HasGroupChanged = true; | 2051 | sog.HasGroupChanged = true; |
2074 | } | 2052 | } |
2075 | #pragma warning restore 0612 | 2053 | #pragma warning restore 0612 |
2076 | } | 2054 | } |
@@ -2086,7 +2064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2086 | /// <param name="rot"></param> | 2064 | /// <param name="rot"></param> |
2087 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> | 2065 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> |
2088 | /// <summary> | 2066 | /// <summary> |
2089 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 2067 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, UUID AgentID, UUID GroupID, Quaternion rot, bool createSelected) |
2090 | { | 2068 | { |
2091 | // m_log.DebugFormat( | 2069 | // m_log.DebugFormat( |
2092 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | 2070 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", |
@@ -2095,27 +2073,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2073 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2096 | if (original != null) | 2074 | if (original != null) |
2097 | { | 2075 | { |
2098 | if (m_parentScene.Permissions.CanDuplicateObject( | 2076 | if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID)) |
2099 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | ||
2100 | { | 2077 | { |
2101 | SceneObjectGroup copy = original.Copy(true); | 2078 | SceneObjectGroup copy = original.Copy(true); |
2102 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 2079 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
2103 | 2080 | ||
2081 | SceneObjectPart[] parts = copy.Parts; | ||
2082 | |||
2083 | m_numTotalPrim += parts.Length; | ||
2084 | |||
2104 | if (original.OwnerID != AgentID) | 2085 | if (original.OwnerID != AgentID) |
2105 | { | 2086 | { |
2106 | copy.SetOwnerId(AgentID); | 2087 | copy.SetOwner(AgentID, GroupID); |
2107 | copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID); | ||
2108 | |||
2109 | SceneObjectPart[] partList = copy.Parts; | ||
2110 | 2088 | ||
2111 | if (m_parentScene.Permissions.PropagatePermissions()) | 2089 | if (m_parentScene.Permissions.PropagatePermissions()) |
2112 | { | 2090 | { |
2113 | foreach (SceneObjectPart child in partList) | 2091 | foreach (SceneObjectPart child in parts) |
2114 | { | 2092 | { |
2115 | child.Inventory.ChangeInventoryOwner(AgentID); | 2093 | child.Inventory.ChangeInventoryOwner(AgentID); |
2116 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2094 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2117 | child.ApplyNextOwnerPermissions(); | 2095 | child.ApplyNextOwnerPermissions(); |
2118 | } | 2096 | } |
2097 | copy.AggregatePerms(); | ||
2119 | } | 2098 | } |
2120 | } | 2099 | } |
2121 | 2100 | ||
@@ -2125,10 +2104,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2125 | lock (SceneObjectGroupsByFullID) | 2104 | lock (SceneObjectGroupsByFullID) |
2126 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2105 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2127 | 2106 | ||
2128 | SceneObjectPart[] parts = copy.Parts; | ||
2129 | |||
2130 | m_numTotalPrim += parts.Length; | ||
2131 | |||
2132 | foreach (SceneObjectPart part in parts) | 2107 | foreach (SceneObjectPart part in parts) |
2133 | { | 2108 | { |
2134 | if (part.GetPrimType() == PrimType.SCULPT) | 2109 | if (part.GetPrimType() == PrimType.SCULPT) |
@@ -2144,28 +2119,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2144 | 2119 | ||
2145 | // PROBABLE END OF FIXME | 2120 | // PROBABLE END OF FIXME |
2146 | 2121 | ||
2147 | // Since we copy from a source group that is in selected | 2122 | copy.IsSelected = createSelected; |
2148 | // state, but the copy is shown deselected in the viewer, | ||
2149 | // We need to clear the selection flag here, else that | ||
2150 | // prim never gets persisted at all. The client doesn't | ||
2151 | // think it's selected, so it will never send a deselect... | ||
2152 | copy.IsSelected = false; | ||
2153 | |||
2154 | m_numPrim += copy.Parts.Length; | ||
2155 | 2123 | ||
2156 | if (rot != Quaternion.Identity) | 2124 | if (rot != Quaternion.Identity) |
2157 | { | ||
2158 | copy.UpdateGroupRotationR(rot); | 2125 | copy.UpdateGroupRotationR(rot); |
2159 | } | 2126 | |
2127 | // required for physics to update it's position | ||
2128 | copy.ResetChildPrimPhysicsPositions(); | ||
2160 | 2129 | ||
2161 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); | 2130 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); |
2162 | copy.HasGroupChanged = true; | ||
2163 | copy.ScheduleGroupForFullUpdate(); | ||
2164 | copy.ResumeScripts(); | 2131 | copy.ResumeScripts(); |
2165 | 2132 | ||
2166 | // required for physics to update it's position | 2133 | copy.HasGroupChanged = true; |
2167 | copy.AbsolutePosition = copy.AbsolutePosition; | 2134 | copy.ScheduleGroupForFullUpdate(); |
2168 | |||
2169 | return copy; | 2135 | return copy; |
2170 | } | 2136 | } |
2171 | } | 2137 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 9f98554..12e53a8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | /// <param name="item">The user inventory item being added.</param> | 111 | /// <param name="item">The user inventory item being added.</param> |
112 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> | 112 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> |
113 | /// <returns></returns> | 113 | /// <returns></returns> |
114 | public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID) | 114 | public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true) |
115 | { | 115 | { |
116 | // m_log.DebugFormat( | 116 | // m_log.DebugFormat( |
117 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", | 117 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", |
@@ -120,69 +120,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID; | 120 | UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID; |
121 | 121 | ||
122 | SceneObjectPart part = GetPart(localID); | 122 | SceneObjectPart part = GetPart(localID); |
123 | if (part != null) | 123 | if (part == null) |
124 | { | 124 | { |
125 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 125 | m_log.ErrorFormat( |
126 | 126 | "[PRIM INVENTORY]: " + | |
127 | taskItem.ItemID = newItemId; | 127 | "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", |
128 | taskItem.AssetID = item.AssetID; | 128 | localID, Name, UUID, newItemId); |
129 | taskItem.Name = item.Name; | 129 | return false; |
130 | taskItem.Description = item.Description; | 130 | } |
131 | taskItem.OwnerID = part.OwnerID; // Transfer ownership | 131 | |
132 | taskItem.CreatorID = item.CreatorIdAsUuid; | 132 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
133 | taskItem.Type = item.AssetType; | ||
134 | taskItem.InvType = item.InvType; | ||
135 | |||
136 | if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) | ||
137 | { | ||
138 | taskItem.BasePermissions = item.BasePermissions & | ||
139 | item.NextPermissions; | ||
140 | taskItem.CurrentPermissions = item.CurrentPermissions & | ||
141 | item.NextPermissions; | ||
142 | taskItem.EveryonePermissions = item.EveryOnePermissions & | ||
143 | item.NextPermissions; | ||
144 | taskItem.GroupPermissions = item.GroupPermissions & | ||
145 | item.NextPermissions; | ||
146 | taskItem.NextPermissions = item.NextPermissions; | ||
147 | // We're adding this to a prim we don't own. Force | ||
148 | // owner change | ||
149 | taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | taskItem.BasePermissions = item.BasePermissions; | ||
154 | taskItem.CurrentPermissions = item.CurrentPermissions; | ||
155 | taskItem.EveryonePermissions = item.EveryOnePermissions; | ||
156 | taskItem.GroupPermissions = item.GroupPermissions; | ||
157 | taskItem.NextPermissions = item.NextPermissions; | ||
158 | } | ||
159 | 133 | ||
160 | taskItem.Flags = item.Flags; | 134 | taskItem.ItemID = newItemId; |
135 | taskItem.AssetID = item.AssetID; | ||
136 | taskItem.Name = item.Name; | ||
137 | taskItem.Description = item.Description; | ||
138 | taskItem.OwnerID = part.OwnerID; // Transfer ownership | ||
139 | taskItem.CreatorID = item.CreatorIdAsUuid; | ||
140 | taskItem.Type = item.AssetType; | ||
141 | taskItem.InvType = item.InvType; | ||
142 | |||
143 | if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) | ||
144 | { | ||
145 | taskItem.BasePermissions = item.BasePermissions & | ||
146 | item.NextPermissions; | ||
147 | taskItem.CurrentPermissions = item.CurrentPermissions & | ||
148 | item.NextPermissions; | ||
149 | taskItem.EveryonePermissions = item.EveryOnePermissions & | ||
150 | item.NextPermissions; | ||
151 | taskItem.GroupPermissions = item.GroupPermissions & | ||
152 | item.NextPermissions; | ||
153 | taskItem.NextPermissions = item.NextPermissions; | ||
154 | // We're adding this to a prim we don't own. Force | ||
155 | // owner change | ||
156 | taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
157 | |||
158 | } | ||
159 | else | ||
160 | { | ||
161 | taskItem.BasePermissions = item.BasePermissions; | ||
162 | taskItem.CurrentPermissions = item.CurrentPermissions; | ||
163 | taskItem.EveryonePermissions = item.EveryOnePermissions; | ||
164 | taskItem.GroupPermissions = item.GroupPermissions; | ||
165 | taskItem.NextPermissions = item.NextPermissions; | ||
166 | } | ||
167 | |||
168 | taskItem.Flags = item.Flags; | ||
161 | 169 | ||
162 | // m_log.DebugFormat( | 170 | // m_log.DebugFormat( |
163 | // "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}", | 171 | // "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}", |
164 | // taskItem.Flags, taskItem.Name, localID, remoteClient.Name); | 172 | // taskItem.Flags, taskItem.Name, localID, remoteClient.Name); |
165 | 173 | ||
166 | // TODO: These are pending addition of those fields to TaskInventoryItem | 174 | // TODO: These are pending addition of those fields to TaskInventoryItem |
167 | // taskItem.SalePrice = item.SalePrice; | 175 | // taskItem.SalePrice = item.SalePrice; |
168 | // taskItem.SaleType = item.SaleType; | 176 | // taskItem.SaleType = item.SaleType; |
169 | taskItem.CreationDate = (uint)item.CreationDate; | 177 | taskItem.CreationDate = (uint)item.CreationDate; |
170 | 178 | ||
171 | bool addFromAllowedDrop = agentID != part.OwnerID; | 179 | bool addFromAllowedDrop; |
172 | 180 | if(withModRights) | |
173 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); | 181 | addFromAllowedDrop = false; |
174 | |||
175 | return true; | ||
176 | } | ||
177 | else | 182 | else |
178 | { | 183 | addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0; |
179 | m_log.ErrorFormat( | 184 | |
180 | "[PRIM INVENTORY]: " + | 185 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); |
181 | "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", | 186 | part.ParentGroup.AggregatePerms(); |
182 | localID, Name, UUID, newItemId); | 187 | return true; |
183 | } | ||
184 | 188 | ||
185 | return false; | ||
186 | } | 189 | } |
187 | 190 | ||
188 | /// <summary> | 191 | /// <summary> |
@@ -248,6 +251,194 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | return -1; | 251 | return -1; |
249 | } | 252 | } |
250 | 253 | ||
254 | // new test code, to place in better place later | ||
255 | private object PermissionsLock = new object(); | ||
256 | |||
257 | private uint m_EffectiveEveryOnePerms; | ||
258 | public uint EffectiveEveryOnePerms | ||
259 | { | ||
260 | get | ||
261 | { | ||
262 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
263 | // bc this is on heavy duty code paths | ||
264 | // but for now we need to test the concept | ||
265 | // AggregateDeepPerms(); | ||
266 | return m_EffectiveEveryOnePerms; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | private uint m_EffectiveGroupPerms; | ||
271 | public uint EffectiveGroupPerms | ||
272 | { | ||
273 | get | ||
274 | { | ||
275 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
276 | // bc this is on heavy duty code paths | ||
277 | // but for now we need to test the concept | ||
278 | // AggregateDeepPerms(); | ||
279 | return m_EffectiveGroupPerms; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | private uint m_EffectiveGroupOrEveryOnePerms; | ||
284 | public uint EffectiveGroupOrEveryOnePerms | ||
285 | { | ||
286 | get | ||
287 | { | ||
288 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
289 | // bc this is on heavy duty code paths | ||
290 | // but for now we need to test the concept | ||
291 | // AggregateDeepPerms(); | ||
292 | return m_EffectiveGroupOrEveryOnePerms; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | private uint m_EffectiveOwnerPerms; | ||
297 | public uint EffectiveOwnerPerms | ||
298 | { | ||
299 | get | ||
300 | { | ||
301 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
302 | // bc this is on heavy duty code paths | ||
303 | // but for now we need to test the concept | ||
304 | // AggregateDeepPerms(); | ||
305 | return m_EffectiveOwnerPerms; | ||
306 | } | ||
307 | } | ||
308 | |||
309 | // aggregates perms scanning parts and their contents | ||
310 | // AggregatePerms does same using cached parts content perms | ||
311 | public void AggregateDeepPerms() | ||
312 | { | ||
313 | lock(PermissionsLock) | ||
314 | { | ||
315 | // aux | ||
316 | const uint allmask = (uint)PermissionMask.AllEffective; | ||
317 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
318 | const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); | ||
319 | |||
320 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; | ||
321 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; | ||
322 | |||
323 | uint rootOwnerPerms = RootPart.OwnerMask; | ||
324 | uint owner = rootOwnerPerms; | ||
325 | uint rootGroupPerms = RootPart.GroupMask; | ||
326 | uint group = rootGroupPerms; | ||
327 | uint rootEveryonePerms = RootPart.EveryoneMask; | ||
328 | uint everyone = rootEveryonePerms; | ||
329 | |||
330 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
331 | for (int i = 0; i < parts.Length; i++) | ||
332 | { | ||
333 | SceneObjectPart part = parts[i]; | ||
334 | part.AggregateInnerPerms(); | ||
335 | owner &= part.AggregatedInnerOwnerPerms; | ||
336 | group &= part.AggregatedInnerGroupPerms; | ||
337 | everyone &= part.AggregatedInnerEveryonePerms; | ||
338 | } | ||
339 | // recover modify and move | ||
340 | rootOwnerPerms &= movemodmask; | ||
341 | owner |= rootOwnerPerms; | ||
342 | if((owner & copytransfermast) == 0) | ||
343 | owner |= (uint)PermissionMask.Transfer; | ||
344 | |||
345 | owner &= basePerms; | ||
346 | m_EffectiveOwnerPerms = owner; | ||
347 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; | ||
348 | |||
349 | // recover modify and move | ||
350 | rootGroupPerms &= movemodmask; | ||
351 | group |= rootGroupPerms; | ||
352 | if(noBaseTransfer) | ||
353 | group &=~(uint)PermissionMask.Copy; | ||
354 | else | ||
355 | group |= ownertransfermask; | ||
356 | |||
357 | uint groupOrEveryone = group; | ||
358 | m_EffectiveGroupPerms = group & owner; | ||
359 | |||
360 | // recover move | ||
361 | rootEveryonePerms &= (uint)PermissionMask.Move; | ||
362 | everyone |= rootEveryonePerms; | ||
363 | everyone &= ~(uint)PermissionMask.Modify; | ||
364 | if(noBaseTransfer) | ||
365 | everyone &=~(uint)PermissionMask.Copy; | ||
366 | else | ||
367 | everyone |= ownertransfermask; | ||
368 | |||
369 | groupOrEveryone |= everyone; | ||
370 | |||
371 | m_EffectiveEveryOnePerms = everyone & owner; | ||
372 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | ||
373 | } | ||
374 | } | ||
375 | |||
376 | // aggregates perms scanning parts, assuming their contents was already aggregated and cached | ||
377 | // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop | ||
378 | public void AggregatePerms() | ||
379 | { | ||
380 | lock(PermissionsLock) | ||
381 | { | ||
382 | // aux | ||
383 | const uint allmask = (uint)PermissionMask.AllEffective; | ||
384 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
385 | const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); | ||
386 | |||
387 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; | ||
388 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; | ||
389 | |||
390 | uint rootOwnerPerms = RootPart.OwnerMask; | ||
391 | uint owner = rootOwnerPerms; | ||
392 | uint rootGroupPerms = RootPart.GroupMask; | ||
393 | uint group = rootGroupPerms; | ||
394 | uint rootEveryonePerms = RootPart.EveryoneMask; | ||
395 | uint everyone = rootEveryonePerms; | ||
396 | |||
397 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
398 | for (int i = 0; i < parts.Length; i++) | ||
399 | { | ||
400 | SceneObjectPart part = parts[i]; | ||
401 | owner &= part.AggregatedInnerOwnerPerms; | ||
402 | group &= part.AggregatedInnerGroupPerms; | ||
403 | everyone &= part.AggregatedInnerEveryonePerms; | ||
404 | } | ||
405 | // recover modify and move | ||
406 | rootOwnerPerms &= movemodmask; | ||
407 | owner |= rootOwnerPerms; | ||
408 | if((owner & copytransfermast) == 0) | ||
409 | owner |= (uint)PermissionMask.Transfer; | ||
410 | |||
411 | owner &= basePerms; | ||
412 | m_EffectiveOwnerPerms = owner; | ||
413 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; | ||
414 | |||
415 | // recover modify and move | ||
416 | rootGroupPerms &= movemodmask; | ||
417 | group |= rootGroupPerms; | ||
418 | if(noBaseTransfer) | ||
419 | group &=~(uint)PermissionMask.Copy; | ||
420 | else | ||
421 | group |= ownertransfermask; | ||
422 | |||
423 | uint groupOrEveryone = group; | ||
424 | m_EffectiveGroupPerms = group & owner; | ||
425 | |||
426 | // recover move | ||
427 | rootEveryonePerms &= (uint)PermissionMask.Move; | ||
428 | everyone |= rootEveryonePerms; | ||
429 | everyone &= ~(uint)PermissionMask.Modify; | ||
430 | if(noBaseTransfer) | ||
431 | everyone &=~(uint)PermissionMask.Copy; | ||
432 | else | ||
433 | everyone |= ownertransfermask; | ||
434 | |||
435 | groupOrEveryone |= everyone; | ||
436 | |||
437 | m_EffectiveEveryOnePerms = everyone & owner; | ||
438 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | ||
439 | } | ||
440 | } | ||
441 | |||
251 | public uint GetEffectivePermissions() | 442 | public uint GetEffectivePermissions() |
252 | { | 443 | { |
253 | return GetEffectivePermissions(false); | 444 | return GetEffectivePermissions(false); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5928764..e73795e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -117,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | NOT_STATUS_ROTATE_Z = 0xF7 | 117 | NOT_STATUS_ROTATE_Z = 0xF7 |
118 | } | 118 | } |
119 | 119 | ||
120 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm | ||
121 | public static readonly uint SLAM = 16; | ||
122 | |||
123 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 120 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
124 | 121 | ||
125 | /// <summary> | 122 | /// <summary> |
@@ -156,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | timeLastChanged = DateTime.UtcNow.Ticks; | 153 | timeLastChanged = DateTime.UtcNow.Ticks; |
157 | if (!m_hasGroupChanged) | 154 | if (!m_hasGroupChanged) |
158 | timeFirstChanged = DateTime.UtcNow.Ticks; | 155 | timeFirstChanged = DateTime.UtcNow.Ticks; |
159 | if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) | 156 | if (m_rootPart != null && m_scene != null) |
160 | { | 157 | { |
161 | /* | 158 | /* |
162 | if (m_rand == null) | 159 | if (m_rand == null) |
@@ -379,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
379 | public bool m_dupeInProgress = false; | 376 | public bool m_dupeInProgress = false; |
380 | internal Dictionary<UUID, string> m_savedScriptState; | 377 | internal Dictionary<UUID, string> m_savedScriptState; |
381 | 378 | ||
379 | public UUID MonitoringObject { get; set; } | ||
380 | |||
382 | #region Properties | 381 | #region Properties |
383 | 382 | ||
384 | /// <summary> | 383 | /// <summary> |
@@ -539,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
539 | 538 | ||
540 | 539 | ||
541 | public bool inTransit = false; | 540 | public bool inTransit = false; |
542 | public delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos); | 541 | private delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos, TeleportObjectData tpData); |
543 | 542 | ||
544 | /// <summary> | 543 | /// <summary> |
545 | /// The absolute position of this scene object in the scene | 544 | /// The absolute position of this scene object in the scene |
@@ -561,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
561 | { | 560 | { |
562 | inTransit = true; | 561 | inTransit = true; |
563 | SOGCrossDelegate d = CrossAsync; | 562 | SOGCrossDelegate d = CrossAsync; |
564 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); | 563 | d.BeginInvoke(this, val, null, CrossAsyncCompleted, d); |
565 | } | 564 | } |
566 | return; | 565 | return; |
567 | } | 566 | } |
@@ -602,7 +601,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
602 | av.sitSOGmoved(); | 601 | av.sitSOGmoved(); |
603 | } | 602 | } |
604 | 603 | ||
605 | |||
606 | // now that position is changed tell it to scripts | 604 | // now that position is changed tell it to scripts |
607 | if (triggerScriptEvent) | 605 | if (triggerScriptEvent) |
608 | { | 606 | { |
@@ -618,64 +616,75 @@ namespace OpenSim.Region.Framework.Scenes | |||
618 | } | 616 | } |
619 | } | 617 | } |
620 | 618 | ||
621 | public SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val) | 619 | private SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val, TeleportObjectData tpdata) |
622 | { | 620 | { |
623 | Scene sogScene = sog.m_scene; | 621 | Scene sogScene = sog.m_scene; |
624 | IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>(); | 622 | SceneObjectPart root = sog.RootPart; |
625 | 623 | ||
626 | Vector3 newpos = Vector3.Zero; | 624 | bool isTeleport = tpdata != null; |
627 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
628 | 625 | ||
629 | if (sog.RootPart.DIE_AT_EDGE) | 626 | if(!isTeleport) |
630 | { | 627 | { |
631 | try | 628 | if (root.DIE_AT_EDGE) |
632 | { | ||
633 | sogScene.DeleteSceneObject(sog, false); | ||
634 | } | ||
635 | catch (Exception) | ||
636 | { | 629 | { |
637 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | 630 | try |
631 | { | ||
632 | sogScene.DeleteSceneObject(sog, false); | ||
633 | } | ||
634 | catch (Exception) | ||
635 | { | ||
636 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | ||
637 | } | ||
638 | return sog; | ||
638 | } | 639 | } |
639 | return sog; | ||
640 | } | ||
641 | 640 | ||
642 | if (sog.RootPart.RETURN_AT_EDGE) | 641 | if (root.RETURN_AT_EDGE) |
643 | { | ||
644 | // We remove the object here | ||
645 | try | ||
646 | { | ||
647 | List<uint> localIDs = new List<uint>(); | ||
648 | localIDs.Add(sog.RootPart.LocalId); | ||
649 | sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, | ||
650 | "Returned at region cross"); | ||
651 | sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero); | ||
652 | } | ||
653 | catch (Exception) | ||
654 | { | 642 | { |
655 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | 643 | // We remove the object here |
644 | try | ||
645 | { | ||
646 | List<uint> localIDs = new List<uint>(); | ||
647 | localIDs.Add(root.LocalId); | ||
648 | sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, | ||
649 | "Returned at region cross"); | ||
650 | sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); | ||
651 | } | ||
652 | catch (Exception) | ||
653 | { | ||
654 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | ||
655 | } | ||
656 | return sog; | ||
656 | } | 657 | } |
657 | return sog; | ||
658 | } | 658 | } |
659 | 659 | ||
660 | if (sog.m_rootPart.KeyframeMotion != null) | 660 | if (root.KeyframeMotion != null) |
661 | sog.m_rootPart.KeyframeMotion.StartCrossingCheck(); | 661 | root.KeyframeMotion.StartCrossingCheck(); |
662 | |||
663 | if(root.PhysActor != null) | ||
664 | root.PhysActor.CrossingStart(); | ||
665 | |||
666 | IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>(); | ||
662 | 667 | ||
663 | if (entityTransfer == null) | 668 | if (entityTransfer == null) |
664 | return sog; | 669 | return sog; |
665 | 670 | ||
671 | Vector3 newpos = Vector3.Zero; | ||
672 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
673 | |||
666 | destination = entityTransfer.GetObjectDestination(sog, val, out newpos); | 674 | destination = entityTransfer.GetObjectDestination(sog, val, out newpos); |
667 | if (destination == null) | 675 | if (destination == null) |
668 | return sog; | 676 | return sog; |
669 | 677 | ||
670 | if (sog.m_sittingAvatars.Count == 0) | 678 | if (sog.m_sittingAvatars.Count == 0) |
671 | { | 679 | { |
672 | entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, true); | 680 | entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, !isTeleport, true); |
673 | return sog; | 681 | return sog; |
674 | } | 682 | } |
675 | 683 | ||
676 | string reason = String.Empty; | 684 | string reason = String.Empty; |
677 | EntityTransferContext ctx = new EntityTransferContext(); | 685 | EntityTransferContext ctx = new EntityTransferContext(); |
678 | 686 | ||
687 | Vector3 curPos = root.GroupPosition; | ||
679 | foreach (ScenePresence av in sog.m_sittingAvatars) | 688 | foreach (ScenePresence av in sog.m_sittingAvatars) |
680 | { | 689 | { |
681 | // We need to cross these agents. First, let's find | 690 | // We need to cross these agents. First, let's find |
@@ -686,10 +695,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
686 | 695 | ||
687 | // We set the avatar position as being the object | 696 | // We set the avatar position as being the object |
688 | // position to get the region to send to | 697 | // position to get the region to send to |
698 | if(av.IsNPC) | ||
699 | continue; | ||
700 | |||
701 | if(av.IsInTransit) | ||
702 | return sog; | ||
703 | |||
689 | if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) | 704 | if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) |
690 | { | ||
691 | return sog; | 705 | return sog; |
692 | } | 706 | |
693 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | 707 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); |
694 | } | 708 | } |
695 | 709 | ||
@@ -697,8 +711,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
697 | // be made to stand up | 711 | // be made to stand up |
698 | 712 | ||
699 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); | 713 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); |
700 | 714 | List<ScenePresence> avsToCrossFar = new List<ScenePresence>(); | |
701 | foreach (ScenePresence av in sog.m_sittingAvatars) | 715 | ulong destHandle = destination.RegionHandle; |
716 | List<ScenePresence> sittingAvatars = GetSittingAvatars(); | ||
717 | foreach (ScenePresence av in sittingAvatars) | ||
702 | { | 718 | { |
703 | byte cflags = 1; | 719 | byte cflags = 1; |
704 | 720 | ||
@@ -712,68 +728,175 @@ namespace OpenSim.Region.Framework.Scenes | |||
712 | else | 728 | else |
713 | cflags = 3; | 729 | cflags = 3; |
714 | } | 730 | } |
731 | if(!av.knowsNeighbourRegion(destHandle)) | ||
732 | cflags |= 8; | ||
715 | 733 | ||
716 | // 1 is crossing | 734 | // 1 is crossing |
717 | // 2 is sitting | 735 | // 2 is sitting |
718 | // 4 is sitting at sittarget | 736 | // 4 is sitting at sittarget |
719 | av.crossingFlags = cflags; | 737 | // 8 far crossing |
720 | 738 | ||
721 | avinfo.av = av; | 739 | avinfo.av = av; |
722 | avinfo.ParentID = av.ParentID; | 740 | avinfo.ParentID = av.ParentID; |
723 | avsToCross.Add(avinfo); | 741 | avsToCross.Add(avinfo); |
724 | 742 | ||
743 | if(!av.knowsNeighbourRegion(destHandle)) | ||
744 | { | ||
745 | cflags |= 8; | ||
746 | avsToCrossFar.Add(av); | ||
747 | } | ||
748 | |||
749 | if(av.IsNPC) | ||
750 | av.crossingFlags = 0; | ||
751 | else | ||
752 | av.crossingFlags = cflags; | ||
753 | |||
725 | av.PrevSitOffset = av.OffsetPosition; | 754 | av.PrevSitOffset = av.OffsetPosition; |
726 | av.ParentID = 0; | 755 | av.ParentID = 0; |
727 | } | 756 | } |
728 | 757 | ||
758 | Vector3 vel = root.Velocity; | ||
759 | Vector3 avel = root.AngularVelocity; | ||
760 | Vector3 acc = root.Acceleration; | ||
761 | Quaternion ori = root.RotationOffset; | ||
762 | |||
763 | if(isTeleport) | ||
764 | { | ||
765 | root.Stop(); | ||
766 | sogScene.ForEachScenePresence(delegate(ScenePresence av) | ||
767 | { | ||
768 | av.ControllingClient.SendEntityUpdate(root,PrimUpdateFlags.SendInTransit); | ||
769 | av.ControllingClient.SendEntityTerseUpdateImmediate(root); | ||
770 | }); | ||
771 | |||
772 | root.Velocity = tpdata.vel; | ||
773 | root.AngularVelocity = tpdata.avel; | ||
774 | root.Acceleration = tpdata.acc; | ||
775 | root.RotationOffset = tpdata.ori; | ||
776 | } | ||
777 | |||
729 | if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false)) | 778 | if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false)) |
730 | { | 779 | { |
780 | if(isTeleport) | ||
781 | { | ||
782 | sogScene.ForEachScenePresence(delegate(ScenePresence oav) | ||
783 | { | ||
784 | if(sittingAvatars.Contains(oav)) | ||
785 | return; | ||
786 | if(oav.knowsNeighbourRegion(destHandle)) | ||
787 | return; | ||
788 | oav.ControllingClient.SendEntityUpdate(root, PrimUpdateFlags.Kill); | ||
789 | foreach (ScenePresence sav in sittingAvatars) | ||
790 | { | ||
791 | sav.SendKillTo(oav); | ||
792 | } | ||
793 | }); | ||
794 | } | ||
795 | bool crossedfar = false; | ||
796 | foreach (ScenePresence av in avsToCrossFar) | ||
797 | { | ||
798 | if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) | ||
799 | crossedfar = true; | ||
800 | else | ||
801 | av.crossingFlags = 0; | ||
802 | } | ||
803 | |||
804 | if(crossedfar) | ||
805 | Thread.Sleep(1000); | ||
806 | |||
731 | foreach (avtocrossInfo avinfo in avsToCross) | 807 | foreach (avtocrossInfo avinfo in avsToCross) |
732 | { | 808 | { |
733 | ScenePresence av = avinfo.av; | 809 | ScenePresence av = avinfo.av; |
734 | if (!av.IsInTransit) // just in case... | 810 | av.IsInTransit = true; |
735 | { | 811 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); |
736 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
737 | 812 | ||
738 | av.IsInTransit = true; | 813 | if(av.crossingFlags > 0) |
814 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); | ||
739 | 815 | ||
740 | // CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 816 | if (av.IsChildAgent) |
741 | // d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | 817 | { |
742 | entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx); | 818 | // avatar crossed do some extra cleanup |
743 | if (av.IsChildAgent) | 819 | if (av.ParentUUID != UUID.Zero) |
744 | { | ||
745 | // avatar crossed do some extra cleanup | ||
746 | if (av.ParentUUID != UUID.Zero) | ||
747 | { | ||
748 | av.ClearControls(); | ||
749 | av.ParentPart = null; | ||
750 | } | ||
751 | } | ||
752 | else | ||
753 | { | 820 | { |
754 | // avatar cross failed we need do dedicated standUp | 821 | av.ClearControls(); |
755 | // part of it was done at CrossAgentToNewRegionAsync | 822 | av.ParentPart = null; |
756 | // so for now just remove the sog controls | ||
757 | // this may need extra care | ||
758 | av.UnRegisterSeatControls(sog.UUID); | ||
759 | } | 823 | } |
760 | |||
761 | av.ParentUUID = UUID.Zero; | 824 | av.ParentUUID = UUID.Zero; |
825 | av.ParentPart = null; | ||
762 | // In any case | 826 | // In any case |
763 | av.IsInTransit = false; | 827 | av.IsInTransit = false; |
764 | av.crossingFlags = 0; | 828 | av.crossingFlags = 0; |
765 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); | 829 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); |
766 | } | 830 | } |
767 | else | 831 | else |
768 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val); | 832 | { |
833 | // avatar cross failed we need do dedicated standUp | ||
834 | // part of it was done at CrossAgentToNewRegionAsync | ||
835 | // so for now just remove the sog controls | ||
836 | // this may need extra care | ||
837 | av.UnRegisterSeatControls(sog.UUID); | ||
838 | av.ParentUUID = UUID.Zero; | ||
839 | av.ParentPart = null; | ||
840 | Vector3 oldp = curPos; | ||
841 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); | ||
842 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); | ||
843 | av.AbsolutePosition = oldp; | ||
844 | av.crossingFlags = 0; | ||
845 | av.sitAnimation = "SIT"; | ||
846 | av.IsInTransit = false; | ||
847 | if(av.Animator!= null) | ||
848 | av.Animator.SetMovementAnimations("STAND"); | ||
849 | av.AddToPhysicalScene(false); | ||
850 | sogScene.ForEachScenePresence(delegate(ScenePresence oav) | ||
851 | { | ||
852 | if(sittingAvatars.Contains(oav)) | ||
853 | return; | ||
854 | if(oav.knowsNeighbourRegion(destHandle)) | ||
855 | av.SendAvatarDataToAgent(oav); | ||
856 | else | ||
857 | { | ||
858 | av.SendAvatarDataToAgent(oav); | ||
859 | av.SendAppearanceToAgent(oav); | ||
860 | if (av.Animator != null) | ||
861 | av.Animator.SendAnimPackToClient(oav.ControllingClient); | ||
862 | av.SendAttachmentsToAgentNF(oav); // not ok | ||
863 | } | ||
864 | }); | ||
865 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname); | ||
866 | } | ||
769 | } | 867 | } |
868 | |||
869 | if(crossedfar) | ||
870 | { | ||
871 | Thread.Sleep(10000); | ||
872 | foreach (ScenePresence av in avsToCrossFar) | ||
873 | { | ||
874 | if(av.IsChildAgent) | ||
875 | { | ||
876 | av.Scene.CloseAgent(av.UUID, false); | ||
877 | } | ||
878 | else | ||
879 | av.RemoveNeighbourRegion(destHandle); | ||
880 | } | ||
881 | } | ||
882 | avsToCrossFar.Clear(); | ||
770 | avsToCross.Clear(); | 883 | avsToCross.Clear(); |
771 | sog.RemoveScriptInstances(true); | 884 | sog.RemoveScriptInstances(true); |
772 | sog.Clear(); | 885 | sog.Clear(); |
773 | return sog; | 886 | return sog; |
774 | } | 887 | } |
775 | else // cross failed, put avas back ?? | 888 | else |
776 | { | 889 | { |
890 | if(isTeleport) | ||
891 | { | ||
892 | if((tpdata.flags & OSTPOBJ_STOPONFAIL) == 0) | ||
893 | { | ||
894 | root.Velocity = vel; | ||
895 | root.AngularVelocity = avel; | ||
896 | root.Acceleration = acc; | ||
897 | } | ||
898 | root.RotationOffset = ori; | ||
899 | } | ||
777 | foreach (avtocrossInfo avinfo in avsToCross) | 900 | foreach (avtocrossInfo avinfo in avsToCross) |
778 | { | 901 | { |
779 | ScenePresence av = avinfo.av; | 902 | ScenePresence av = avinfo.av; |
@@ -783,7 +906,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
783 | } | 906 | } |
784 | } | 907 | } |
785 | avsToCross.Clear(); | 908 | avsToCross.Clear(); |
786 | |||
787 | return sog; | 909 | return sog; |
788 | } | 910 | } |
789 | 911 | ||
@@ -795,11 +917,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
795 | if (!sog.IsDeleted) | 917 | if (!sog.IsDeleted) |
796 | { | 918 | { |
797 | SceneObjectPart rootp = sog.m_rootPart; | 919 | SceneObjectPart rootp = sog.m_rootPart; |
920 | |||
798 | Vector3 oldp = rootp.GroupPosition; | 921 | Vector3 oldp = rootp.GroupPosition; |
799 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); | 922 | oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); |
800 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); | 923 | oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); |
801 | rootp.GroupPosition = oldp; | 924 | rootp.GroupPosition = oldp; |
802 | 925 | ||
926 | rootp.Stop(); | ||
927 | |||
803 | SceneObjectPart[] parts = sog.m_parts.GetArray(); | 928 | SceneObjectPart[] parts = sog.m_parts.GetArray(); |
804 | 929 | ||
805 | foreach (SceneObjectPart part in parts) | 930 | foreach (SceneObjectPart part in parts) |
@@ -813,47 +938,150 @@ namespace OpenSim.Region.Framework.Scenes | |||
813 | av.sitSOGmoved(); | 938 | av.sitSOGmoved(); |
814 | } | 939 | } |
815 | 940 | ||
816 | sog.Velocity = Vector3.Zero; | ||
817 | |||
818 | if (sog.m_rootPart.KeyframeMotion != null) | 941 | if (sog.m_rootPart.KeyframeMotion != null) |
819 | sog.m_rootPart.KeyframeMotion.CrossingFailure(); | 942 | sog.m_rootPart.KeyframeMotion.CrossingFailure(); |
820 | 943 | ||
821 | if (sog.RootPart.PhysActor != null) | 944 | if (sog.RootPart.PhysActor != null) |
822 | { | ||
823 | sog.RootPart.PhysActor.CrossingFailure(); | 945 | sog.RootPart.PhysActor.CrossingFailure(); |
824 | } | ||
825 | 946 | ||
826 | sog.inTransit = false; | 947 | sog.inTransit = false; |
948 | AttachToBackup(); | ||
827 | sog.ScheduleGroupForFullUpdate(); | 949 | sog.ScheduleGroupForFullUpdate(); |
828 | } | 950 | } |
829 | } | 951 | } |
830 | 952 | ||
831 | /* outdated | 953 | private class TeleportObjectData |
832 | private void CrossAgentToNewRegionCompleted(ScenePresence agent) | ||
833 | { | 954 | { |
834 | //// If the cross was successful, this agent is a child agent | 955 | public int flags; |
835 | if (agent.IsChildAgent) | 956 | public Vector3 vel; |
957 | public Vector3 avel; | ||
958 | public Vector3 acc; | ||
959 | public Quaternion ori; | ||
960 | public UUID sourceID; | ||
961 | } | ||
962 | |||
963 | // copy from LSL_constants.cs | ||
964 | const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination | ||
965 | const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails | ||
966 | const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation | ||
967 | |||
968 | public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) | ||
969 | { | ||
970 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) | ||
971 | return -1; | ||
972 | |||
973 | inTransit = true; | ||
974 | |||
975 | PhysicsActor pa = RootPart.PhysActor; | ||
976 | if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) | ||
836 | { | 977 | { |
837 | if (agent.ParentUUID != UUID.Zero) | 978 | inTransit = false; |
979 | return -1; | ||
980 | } | ||
981 | |||
982 | bool stop = (flags & OSTPOBJ_STOPATTARGET) != 0; | ||
983 | bool setrot = (flags & OSTPOBJ_SETROT) != 0; | ||
984 | |||
985 | rotation.Normalize(); | ||
986 | |||
987 | Quaternion currentRot = RootPart.RotationOffset; | ||
988 | if(setrot) | ||
989 | rotation = Quaternion.Conjugate(currentRot) * rotation; | ||
990 | |||
991 | bool dorot = setrot | (Math.Abs(rotation.W) < 0.99999); | ||
992 | |||
993 | Vector3 vel = Vector3.Zero; | ||
994 | Vector3 avel = Vector3.Zero; | ||
995 | Vector3 acc = Vector3.Zero; | ||
996 | |||
997 | if(!stop) | ||
998 | { | ||
999 | vel = RootPart.Velocity; | ||
1000 | avel = RootPart.AngularVelocity; | ||
1001 | acc = RootPart.Acceleration; | ||
1002 | } | ||
1003 | Quaternion ori = RootPart.RotationOffset; | ||
1004 | |||
1005 | if(dorot) | ||
1006 | { | ||
1007 | if(!stop) | ||
838 | { | 1008 | { |
839 | agent.HandleForceReleaseControls(agent.ControllingClient,agent.UUID); | 1009 | vel *= rotation; |
840 | agent.ParentPart = null; | 1010 | avel *= rotation; |
841 | // agent.ParentPosition = Vector3.Zero; | 1011 | acc *= rotation; |
842 | // agent.ParentUUID = UUID.Zero; | ||
843 | } | 1012 | } |
1013 | ori *= rotation; | ||
844 | } | 1014 | } |
845 | 1015 | ||
846 | agent.ParentUUID = UUID.Zero; | 1016 | if(Scene.PositionIsInCurrentRegion(targetPosition)) |
847 | // agent.Reset(); | 1017 | { |
848 | // else // Not successful | 1018 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) |
849 | // agent.RestoreInCurrentScene(); | 1019 | { |
1020 | inTransit = false; | ||
1021 | return -2; | ||
1022 | } | ||
850 | 1023 | ||
851 | // In any case | 1024 | Vector3 curPos = AbsolutePosition; |
852 | agent.IsInTransit = false; | 1025 | ILandObject curLand = Scene.LandChannel.GetLandObject(curPos.X, curPos.Y); |
1026 | float posX = targetPosition.X; | ||
1027 | float posY = targetPosition.Y; | ||
1028 | ILandObject land = Scene.LandChannel.GetLandObject(posX, posY); | ||
1029 | if(land != null && land != curLand) | ||
1030 | { | ||
1031 | if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) | ||
1032 | { | ||
1033 | inTransit = false; | ||
1034 | return -3; | ||
1035 | } | ||
1036 | |||
1037 | UUID agentID; | ||
1038 | foreach (ScenePresence av in m_sittingAvatars) | ||
1039 | { | ||
1040 | agentID = av.UUID; | ||
1041 | if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) | ||
1042 | { | ||
1043 | inTransit = false; | ||
1044 | return -4; | ||
1045 | } | ||
1046 | } | ||
1047 | } | ||
1048 | |||
1049 | RootPart.Velocity = vel; | ||
1050 | RootPart.AngularVelocity = avel; | ||
1051 | RootPart.Acceleration = acc; | ||
1052 | RootPart.RotationOffset = ori; | ||
1053 | |||
1054 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; | ||
1055 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; | ||
1056 | if(targetPosition.Z < h) | ||
1057 | targetPosition.Z = h; | ||
1058 | |||
1059 | inTransit = false; | ||
1060 | AbsolutePosition = targetPosition; | ||
1061 | RootPart.ScheduleTerseUpdate(); | ||
1062 | return 1; | ||
1063 | } | ||
1064 | |||
1065 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 20.0)) | ||
1066 | { | ||
1067 | inTransit = false; | ||
1068 | return -1; | ||
1069 | } | ||
853 | 1070 | ||
854 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | 1071 | TeleportObjectData tdata = new TeleportObjectData(); |
1072 | tdata.flags = flags; | ||
1073 | tdata.vel = vel; | ||
1074 | tdata.avel = avel; | ||
1075 | tdata.acc = acc; | ||
1076 | tdata.ori = ori; | ||
1077 | tdata.sourceID = sourceID; | ||
1078 | |||
1079 | |||
1080 | SOGCrossDelegate d = CrossAsync; | ||
1081 | d.BeginInvoke(this, targetPosition, tdata, CrossAsyncCompleted, d); | ||
1082 | return 0; | ||
855 | } | 1083 | } |
856 | */ | 1084 | |
857 | public override Vector3 Velocity | 1085 | public override Vector3 Velocity |
858 | { | 1086 | { |
859 | get { return RootPart.Velocity; } | 1087 | get { return RootPart.Velocity; } |
@@ -1786,63 +2014,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1786 | } | 2014 | } |
1787 | } | 2015 | } |
1788 | 2016 | ||
1789 | /// <summary> | ||
1790 | /// Attach this scene object to the given avatar. | ||
1791 | /// </summary> | ||
1792 | /// <param name="agentID"></param> | ||
1793 | /// <param name="attachmentpoint"></param> | ||
1794 | /// <param name="AttachOffset"></param> | ||
1795 | private void AttachToAgent( | ||
1796 | ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) | ||
1797 | { | ||
1798 | if (avatar != null) | ||
1799 | { | ||
1800 | // don't attach attachments to child agents | ||
1801 | if (avatar.IsChildAgent) return; | ||
1802 | |||
1803 | // Remove from database and parcel prim count | ||
1804 | m_scene.DeleteFromStorage(so.UUID); | ||
1805 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
1806 | |||
1807 | so.AttachedAvatar = avatar.UUID; | ||
1808 | |||
1809 | if (so.RootPart.PhysActor != null) | ||
1810 | { | ||
1811 | m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); | ||
1812 | so.RootPart.PhysActor = null; | ||
1813 | } | ||
1814 | |||
1815 | so.AbsolutePosition = attachOffset; | ||
1816 | so.RootPart.AttachedPos = attachOffset; | ||
1817 | so.IsAttachment = true; | ||
1818 | so.RootPart.SetParentLocalId(avatar.LocalId); | ||
1819 | so.AttachmentPoint = attachmentpoint; | ||
1820 | |||
1821 | avatar.AddAttachment(this); | ||
1822 | |||
1823 | if (!silent) | ||
1824 | { | ||
1825 | // Killing it here will cause the client to deselect it | ||
1826 | // It then reappears on the avatar, deselected | ||
1827 | // through the full update below | ||
1828 | // | ||
1829 | if (IsSelected) | ||
1830 | { | ||
1831 | m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId }); | ||
1832 | } | ||
1833 | |||
1834 | IsSelected = false; // fudge.... | ||
1835 | ScheduleGroupForFullUpdate(); | ||
1836 | } | ||
1837 | } | ||
1838 | else | ||
1839 | { | ||
1840 | m_log.WarnFormat( | ||
1841 | "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", | ||
1842 | UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName); | ||
1843 | } | ||
1844 | } | ||
1845 | |||
1846 | public byte GetAttachmentPoint() | 2017 | public byte GetAttachmentPoint() |
1847 | { | 2018 | { |
1848 | return m_rootPart.Shape.State; | 2019 | return m_rootPart.Shape.State; |
@@ -1957,6 +2128,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1957 | 2128 | ||
1958 | if (part.LinkNum == 2) | 2129 | if (part.LinkNum == 2) |
1959 | RootPart.LinkNum = 1; | 2130 | RootPart.LinkNum = 1; |
2131 | InvalidatePartsLinkMaps(); | ||
1960 | } | 2132 | } |
1961 | 2133 | ||
1962 | /// <summary> | 2134 | /// <summary> |
@@ -2233,7 +2405,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2233 | { | 2405 | { |
2234 | if (part.OwnerID != userId) | 2406 | if (part.OwnerID != userId) |
2235 | { | 2407 | { |
2236 | part.LastOwnerID = part.OwnerID; | 2408 | if(part.GroupID != part.OwnerID) |
2409 | part.LastOwnerID = part.OwnerID; | ||
2237 | part.OwnerID = userId; | 2410 | part.OwnerID = userId; |
2238 | } | 2411 | } |
2239 | }); | 2412 | }); |
@@ -2313,7 +2486,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2313 | RootPart.UUID); | 2486 | RootPart.UUID); |
2314 | m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); | 2487 | m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); |
2315 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, | 2488 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, |
2316 | DeRezAction.Return, UUID.Zero); | 2489 | DeRezAction.Return, UUID.Zero, false); |
2317 | 2490 | ||
2318 | return; | 2491 | return; |
2319 | } | 2492 | } |
@@ -2443,17 +2616,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2443 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 2616 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
2444 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 2617 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
2445 | 2618 | ||
2446 | |||
2447 | if (userExposed) | 2619 | if (userExposed) |
2448 | dupe.m_rootPart.TrimPermissions(); | 2620 | dupe.m_rootPart.TrimPermissions(); |
2449 | 2621 | ||
2450 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray()); | 2622 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray()); |
2451 | 2623 | ||
2452 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | 2624 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) |
2453 | { | 2625 | { |
2454 | return p1.LinkNum.CompareTo(p2.LinkNum); | 2626 | return p1.LinkNum.CompareTo(p2.LinkNum); |
2455 | } | 2627 | } |
2456 | ); | 2628 | ); |
2457 | 2629 | ||
2458 | foreach (SceneObjectPart part in partList) | 2630 | foreach (SceneObjectPart part in partList) |
2459 | { | 2631 | { |
@@ -2505,12 +2677,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2505 | if (dupe.m_rootPart.PhysActor != null) | 2677 | if (dupe.m_rootPart.PhysActor != null) |
2506 | dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building | 2678 | dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building |
2507 | 2679 | ||
2680 | dupe.AggregateDeepPerms(); | ||
2681 | |||
2508 | dupe.HasGroupChanged = true; | 2682 | dupe.HasGroupChanged = true; |
2509 | dupe.AttachToBackup(); | 2683 | dupe.AttachToBackup(); |
2510 | 2684 | ||
2511 | ScheduleGroupForFullUpdate(); | 2685 | dupe.ScheduleGroupForFullUpdate(); |
2512 | } | 2686 | } |
2513 | 2687 | ||
2688 | dupe.InvalidatePartsLinkMaps(); | ||
2514 | m_dupeInProgress = false; | 2689 | m_dupeInProgress = false; |
2515 | return dupe; | 2690 | return dupe; |
2516 | } | 2691 | } |
@@ -2746,25 +2921,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
2746 | } | 2921 | } |
2747 | 2922 | ||
2748 | /// <summary> | 2923 | /// <summary> |
2749 | /// Set the owner of the root part. | 2924 | /// Set the owner of all linkset. |
2750 | /// </summary> | 2925 | /// </summary> |
2751 | /// <param name="part"></param> | ||
2752 | /// <param name="cAgentID"></param> | 2926 | /// <param name="cAgentID"></param> |
2753 | /// <param name="cGroupID"></param> | 2927 | /// <param name="cGroupID"></param> |
2754 | public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID) | 2928 | public void SetOwner(UUID cAgentID, UUID cGroupID) |
2755 | { | 2929 | { |
2756 | part.LastOwnerID = part.OwnerID; | 2930 | SceneObjectPart rpart = RootPart; |
2757 | part.OwnerID = cAgentID; | 2931 | UUID oldowner = rpart.OwnerID; |
2758 | part.GroupID = cGroupID; | 2932 | ForEachPart(delegate(SceneObjectPart part) |
2933 | { | ||
2934 | if(part.GroupID != part.OwnerID) | ||
2935 | part.LastOwnerID = part.OwnerID; | ||
2936 | part.OwnerID = cAgentID; | ||
2937 | part.GroupID = cGroupID; | ||
2938 | }); | ||
2759 | 2939 | ||
2760 | if (part.OwnerID != cAgentID) | 2940 | if (oldowner != cAgentID) |
2761 | { | 2941 | { |
2762 | // Apply Next Owner Permissions if we're not bypassing permissions | 2942 | // Apply Next Owner Permissions if we're not bypassing permissions |
2763 | if (!m_scene.Permissions.BypassPermissions()) | 2943 | if (!m_scene.Permissions.BypassPermissions()) |
2944 | { | ||
2764 | ApplyNextOwnerPermissions(); | 2945 | ApplyNextOwnerPermissions(); |
2946 | AggregatePerms(); | ||
2947 | } | ||
2765 | } | 2948 | } |
2766 | 2949 | ||
2767 | part.ScheduleFullUpdate(); | 2950 | rpart.ScheduleFullUpdate(); |
2768 | } | 2951 | } |
2769 | 2952 | ||
2770 | /// <summary> | 2953 | /// <summary> |
@@ -3264,6 +3447,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3264 | ResetChildPrimPhysicsPositions(); | 3447 | ResetChildPrimPhysicsPositions(); |
3265 | 3448 | ||
3266 | InvalidBoundsRadius(); | 3449 | InvalidBoundsRadius(); |
3450 | InvalidatePartsLinkMaps(); | ||
3267 | 3451 | ||
3268 | if (m_rootPart.PhysActor != null) | 3452 | if (m_rootPart.PhysActor != null) |
3269 | m_rootPart.PhysActor.Building = false; | 3453 | m_rootPart.PhysActor.Building = false; |
@@ -3420,6 +3604,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3420 | objectGroup.HasGroupChangedDueToDelink = true; | 3604 | objectGroup.HasGroupChangedDueToDelink = true; |
3421 | 3605 | ||
3422 | InvalidBoundsRadius(); | 3606 | InvalidBoundsRadius(); |
3607 | InvalidatePartsLinkMaps(); | ||
3608 | objectGroup.AggregatePerms(); | ||
3423 | 3609 | ||
3424 | if (sendEvents) | 3610 | if (sendEvents) |
3425 | linkPart.TriggerScriptChangedEvent(Changed.LINK); | 3611 | linkPart.TriggerScriptChangedEvent(Changed.LINK); |
@@ -3958,8 +4144,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3958 | 4144 | ||
3959 | public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) | 4145 | public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) |
3960 | { | 4146 | { |
3961 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits | 4147 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits |
3962 | uint foldedPerms = RootPart.OwnerMask & 3; | 4148 | uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask; |
3963 | 4149 | ||
3964 | ForEachPart(part => | 4150 | ForEachPart(part => |
3965 | { | 4151 | { |
@@ -3970,14 +4156,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3970 | part.Inventory.ApplyGodPermissions(part.BaseMask); | 4156 | part.Inventory.ApplyGodPermissions(part.BaseMask); |
3971 | }); | 4157 | }); |
3972 | 4158 | ||
3973 | uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); | 4159 | uint lockMask = ~(uint)(PermissionMask.Move); |
3974 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); | 4160 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move); |
3975 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); | 4161 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); |
3976 | 4162 | ||
3977 | // m_log.DebugFormat( | 4163 | // m_log.DebugFormat( |
3978 | // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", | 4164 | // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", |
3979 | // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); | 4165 | // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); |
3980 | 4166 | AggregatePerms(); | |
3981 | RootPart.ScheduleFullUpdate(); | 4167 | RootPart.ScheduleFullUpdate(); |
3982 | } | 4168 | } |
3983 | 4169 | ||
@@ -4002,6 +4188,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4002 | { | 4188 | { |
4003 | foreach (SceneObjectPart part in Parts) | 4189 | foreach (SceneObjectPart part in Parts) |
4004 | part.Inventory.ApplyGodPermissions(RootPart.BaseMask); | 4190 | part.Inventory.ApplyGodPermissions(RootPart.BaseMask); |
4191 | AggregatePerms(); | ||
4005 | } | 4192 | } |
4006 | 4193 | ||
4007 | HasGroupChanged = true; | 4194 | HasGroupChanged = true; |
@@ -4647,7 +4834,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4647 | } | 4834 | } |
4648 | if ((change & ObjectChangeType.Position) != 0) | 4835 | if ((change & ObjectChangeType.Position) != 0) |
4649 | { | 4836 | { |
4650 | if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) | 4837 | if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position)) |
4651 | UpdateGroupPosition(data.position); | 4838 | UpdateGroupPosition(data.position); |
4652 | updateType = updatetype.groupterse; | 4839 | updateType = updatetype.groupterse; |
4653 | } | 4840 | } |
@@ -5056,6 +5243,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
5056 | return Ptot; | 5243 | return Ptot; |
5057 | } | 5244 | } |
5058 | 5245 | ||
5246 | public void GetInertiaData(out float TotalMass, out Vector3 CenterOfMass, out Vector3 Inertia, out Vector4 aux ) | ||
5247 | { | ||
5248 | PhysicsActor pa = RootPart.PhysActor; | ||
5249 | |||
5250 | if(((RootPart.Flags & PrimFlags.Physics) !=0) && pa !=null) | ||
5251 | { | ||
5252 | PhysicsInertiaData inertia; | ||
5253 | |||
5254 | inertia = pa.GetInertiaData(); | ||
5255 | |||
5256 | TotalMass = inertia.TotalMass; | ||
5257 | CenterOfMass = inertia.CenterOfMass; | ||
5258 | Inertia = inertia.Inertia; | ||
5259 | aux = inertia.InertiaRotation; | ||
5260 | |||
5261 | return; | ||
5262 | } | ||
5263 | |||
5264 | TotalMass = GetMass(); | ||
5265 | CenterOfMass = GetCenterOfMass() - AbsolutePosition; | ||
5266 | CenterOfMass *= Quaternion.Conjugate(RootPart.RotationOffset); | ||
5267 | Inertia = Vector3.Zero; | ||
5268 | aux = Vector4.Zero; | ||
5269 | } | ||
5270 | |||
5271 | public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux ) | ||
5272 | { | ||
5273 | PhysicsInertiaData inertia = new PhysicsInertiaData(); | ||
5274 | inertia.TotalMass = TotalMass; | ||
5275 | inertia.CenterOfMass = CenterOfMass; | ||
5276 | inertia.Inertia = Inertia; | ||
5277 | inertia.InertiaRotation = aux; | ||
5278 | |||
5279 | if(TotalMass < 0) | ||
5280 | RootPart.PhysicsInertia = null; | ||
5281 | else | ||
5282 | RootPart.PhysicsInertia = new PhysicsInertiaData(inertia); | ||
5283 | |||
5284 | PhysicsActor pa = RootPart.PhysActor; | ||
5285 | if(pa !=null) | ||
5286 | pa.SetInertiaData(inertia); | ||
5287 | } | ||
5288 | |||
5059 | /// <summary> | 5289 | /// <summary> |
5060 | /// Set the user group to which this scene object belongs. | 5290 | /// Set the user group to which this scene object belongs. |
5061 | /// </summary> | 5291 | /// </summary> |
@@ -5217,6 +5447,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5217 | { | 5447 | { |
5218 | part.ResetOwnerChangeFlag(); | 5448 | part.ResetOwnerChangeFlag(); |
5219 | }); | 5449 | }); |
5450 | AggregatePerms(); | ||
5220 | } | 5451 | } |
5221 | 5452 | ||
5222 | // clear some references to easy cg | 5453 | // clear some references to easy cg |
@@ -5230,6 +5461,84 @@ namespace OpenSim.Region.Framework.Scenes | |||
5230 | m_PlaySoundSlavePrims.Clear(); | 5461 | m_PlaySoundSlavePrims.Clear(); |
5231 | m_LoopSoundMasterPrim = null; | 5462 | m_LoopSoundMasterPrim = null; |
5232 | m_targets.Clear(); | 5463 | m_targets.Clear(); |
5464 | m_partsNameToLinkMap.Clear(); | ||
5465 | } | ||
5466 | |||
5467 | private Dictionary<string,int> m_partsNameToLinkMap = new Dictionary<string, int>(); | ||
5468 | private string GetLinkNumber_lastname; | ||
5469 | private int GetLinkNumber_lastnumber; | ||
5470 | |||
5471 | // this scales bad but so does GetLinkNumPart | ||
5472 | public int GetLinkNumber(string name) | ||
5473 | { | ||
5474 | if(String.IsNullOrEmpty(name) || name == "Object") | ||
5475 | return -1; | ||
5476 | |||
5477 | lock(m_partsNameToLinkMap) | ||
5478 | { | ||
5479 | if(m_partsNameToLinkMap.Count == 0) | ||
5480 | { | ||
5481 | GetLinkNumber_lastname = String.Empty; | ||
5482 | GetLinkNumber_lastnumber = -1; | ||
5483 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
5484 | for (int i = 0; i < parts.Length; i++) | ||
5485 | { | ||
5486 | string s = parts[i].Name; | ||
5487 | if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive") | ||
5488 | continue; | ||
5489 | |||
5490 | if(m_partsNameToLinkMap.ContainsKey(s)) | ||
5491 | { | ||
5492 | int ol = parts[i].LinkNum; | ||
5493 | if(ol < m_partsNameToLinkMap[s]) | ||
5494 | m_partsNameToLinkMap[s] = ol; | ||
5495 | } | ||
5496 | else | ||
5497 | m_partsNameToLinkMap[s] = parts[i].LinkNum; | ||
5498 | } | ||
5499 | } | ||
5500 | |||
5501 | if(name == GetLinkNumber_lastname) | ||
5502 | return GetLinkNumber_lastnumber; | ||
5503 | |||
5504 | if(m_partsNameToLinkMap.ContainsKey(name)) | ||
5505 | { | ||
5506 | lock(m_partsNameToLinkMap) | ||
5507 | { | ||
5508 | GetLinkNumber_lastname = name; | ||
5509 | GetLinkNumber_lastnumber = m_partsNameToLinkMap[name]; | ||
5510 | return GetLinkNumber_lastnumber; | ||
5511 | } | ||
5512 | } | ||
5513 | } | ||
5514 | |||
5515 | if(m_sittingAvatars.Count > 0) | ||
5516 | { | ||
5517 | int j = m_parts.Count + 1; | ||
5518 | |||
5519 | ScenePresence[] avs = m_sittingAvatars.ToArray(); | ||
5520 | for (int i = 0; i < avs.Length; i++, j++) | ||
5521 | { | ||
5522 | if (avs[i].Name == name) | ||
5523 | { | ||
5524 | GetLinkNumber_lastname = name; | ||
5525 | GetLinkNumber_lastnumber = j; | ||
5526 | return j; | ||
5527 | } | ||
5528 | } | ||
5529 | } | ||
5530 | |||
5531 | return -1; | ||
5532 | } | ||
5533 | |||
5534 | public void InvalidatePartsLinkMaps() | ||
5535 | { | ||
5536 | lock(m_partsNameToLinkMap) | ||
5537 | { | ||
5538 | m_partsNameToLinkMap.Clear(); | ||
5539 | GetLinkNumber_lastname = String.Empty; | ||
5540 | GetLinkNumber_lastnumber = -1; | ||
5541 | } | ||
5233 | } | 5542 | } |
5234 | 5543 | ||
5235 | #endregion | 5544 | #endregion |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b8ac089..19bf53f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | 244 | ||
245 | public uint TimeStampTerse; | 245 | public uint TimeStampTerse; |
246 | 246 | ||
247 | // The following two are to hold the attachment data | ||
248 | // while an object is inworld | ||
249 | [XmlIgnore] | ||
250 | public byte AttachPoint = 0; | ||
251 | |||
252 | [XmlIgnore] | 247 | [XmlIgnore] |
253 | public Quaternion AttachRotation = Quaternion.Identity; | 248 | public Quaternion AttachRotation = Quaternion.Identity; |
254 | 249 | ||
@@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
277 | 272 | ||
278 | public scriptEvents AggregateScriptEvents; | 273 | public scriptEvents AggregateScriptEvents; |
279 | 274 | ||
280 | public Vector3 AttachedPos; | 275 | public Vector3 AttachedPos |
276 | { | ||
277 | get; | ||
278 | set; | ||
279 | } | ||
281 | 280 | ||
282 | // rotation locks on local X,Y and or Z axis bit flags | 281 | // rotation locks on local X,Y and or Z axis bit flags |
283 | // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum | 282 | // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum |
@@ -407,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
407 | 406 | ||
408 | private SOPVehicle m_vehicleParams = null; | 407 | private SOPVehicle m_vehicleParams = null; |
409 | 408 | ||
409 | private PhysicsInertiaData m_physicsInertia; | ||
410 | |||
410 | public KeyframeMotion KeyframeMotion | 411 | public KeyframeMotion KeyframeMotion |
411 | { | 412 | { |
412 | get; set; | 413 | get; set; |
@@ -476,8 +477,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
476 | APIDActive = false; | 477 | APIDActive = false; |
477 | Flags = 0; | 478 | Flags = 0; |
478 | CreateSelected = true; | 479 | CreateSelected = true; |
479 | |||
480 | TrimPermissions(); | 480 | TrimPermissions(); |
481 | AggregateInnerPerms(); | ||
481 | } | 482 | } |
482 | 483 | ||
483 | #endregion Constructors | 484 | #endregion Constructors |
@@ -637,6 +638,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
637 | set | 638 | set |
638 | { | 639 | { |
639 | m_name = value; | 640 | m_name = value; |
641 | if(ParentGroup != null) | ||
642 | ParentGroup.InvalidatePartsLinkMaps(); | ||
640 | 643 | ||
641 | PhysicsActor pa = PhysActor; | 644 | PhysicsActor pa = PhysActor; |
642 | 645 | ||
@@ -1063,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1063 | m_angularVelocity = value; | 1066 | m_angularVelocity = value; |
1064 | 1067 | ||
1065 | PhysicsActor actor = PhysActor; | 1068 | PhysicsActor actor = PhysActor; |
1066 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) | 1069 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this) |
1067 | { | 1070 | { |
1068 | actor.RotationalVelocity = m_angularVelocity; | 1071 | actor.RotationalVelocity = m_angularVelocity; |
1069 | } | 1072 | } |
@@ -1089,6 +1092,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1089 | m_acceleration = Vector3.Zero; | 1092 | m_acceleration = Vector3.Zero; |
1090 | else | 1093 | else |
1091 | m_acceleration = value; | 1094 | m_acceleration = value; |
1095 | |||
1096 | PhysicsActor actor = PhysActor; | ||
1097 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this) | ||
1098 | { | ||
1099 | actor.Acceleration = m_acceleration; | ||
1100 | } | ||
1092 | } | 1101 | } |
1093 | } | 1102 | } |
1094 | 1103 | ||
@@ -2013,7 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2013 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future | 2022 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future |
2014 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) | 2023 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) |
2015 | { | 2024 | { |
2016 | if (ParentGroup == null || ParentGroup.IsDeleted) | 2025 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
2017 | return; | 2026 | return; |
2018 | 2027 | ||
2019 | if (ParentGroup.IsAttachment) | 2028 | if (ParentGroup.IsAttachment) |
@@ -2040,7 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2040 | // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future | 2049 | // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future |
2041 | public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) | 2050 | public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) |
2042 | { | 2051 | { |
2043 | if (ParentGroup == null || ParentGroup.IsDeleted) | 2052 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
2044 | return; | 2053 | return; |
2045 | 2054 | ||
2046 | if (ParentGroup.IsAttachment) | 2055 | if (ParentGroup.IsAttachment) |
@@ -2074,6 +2083,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2074 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> | 2083 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> |
2075 | public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) | 2084 | public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) |
2076 | { | 2085 | { |
2086 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | ||
2087 | return; | ||
2088 | |||
2077 | Vector3 impulse = impulsei; | 2089 | Vector3 impulse = impulsei; |
2078 | 2090 | ||
2079 | if (localGlobalTF) | 2091 | if (localGlobalTF) |
@@ -2228,7 +2240,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2228 | dupe.LocalId = plocalID; | 2240 | dupe.LocalId = plocalID; |
2229 | 2241 | ||
2230 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 2242 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
2231 | dupe.LastOwnerID = OwnerID; | 2243 | if(OwnerID != GroupID) |
2244 | dupe.LastOwnerID = OwnerID; | ||
2245 | else | ||
2246 | dupe.LastOwnerID = LastOwnerID; // redundant ? | ||
2247 | |||
2232 | dupe.RezzerID = RezzerID; | 2248 | dupe.RezzerID = RezzerID; |
2233 | 2249 | ||
2234 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 2250 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
@@ -2537,6 +2553,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2537 | return (uint)Flags | (uint)LocalFlags; | 2553 | return (uint)Flags | (uint)LocalFlags; |
2538 | } | 2554 | } |
2539 | 2555 | ||
2556 | // some of this lines need be moved to other place later | ||
2557 | |||
2558 | // effective permitions considering only this part inventory contents perms | ||
2559 | public uint AggregatedInnerOwnerPerms {get; private set; } | ||
2560 | public uint AggregatedInnerGroupPerms {get; private set; } | ||
2561 | public uint AggregatedInnerEveryonePerms {get; private set; } | ||
2562 | private object InnerPermsLock = new object(); | ||
2563 | |||
2564 | public void AggregateInnerPerms() | ||
2565 | { | ||
2566 | // assuming child prims permissions masks are irrelevant on a linkset | ||
2567 | // root part is handle at SOG since its masks are the sog masks | ||
2568 | const uint mask = (uint)PermissionMask.AllEffective; | ||
2569 | |||
2570 | uint owner = mask; | ||
2571 | uint group = mask; | ||
2572 | uint everyone = mask; | ||
2573 | |||
2574 | lock(InnerPermsLock) // do we really need this? | ||
2575 | { | ||
2576 | if(Inventory != null) | ||
2577 | Inventory.AggregateInnerPerms(ref owner, ref group, ref everyone); | ||
2578 | |||
2579 | AggregatedInnerOwnerPerms = owner & mask; | ||
2580 | AggregatedInnerGroupPerms = group & mask; | ||
2581 | AggregatedInnerEveryonePerms = everyone & mask; | ||
2582 | } | ||
2583 | } | ||
2584 | |||
2540 | public Vector3 GetGeometricCenter() | 2585 | public Vector3 GetGeometricCenter() |
2541 | { | 2586 | { |
2542 | // this is not real geometric center but a average of positions relative to root prim acording to | 2587 | // this is not real geometric center but a average of positions relative to root prim acording to |
@@ -3340,25 +3385,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3340 | /// <param name="remoteClient"></param> | 3385 | /// <param name="remoteClient"></param> |
3341 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 3386 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
3342 | { | 3387 | { |
3343 | SendFullUpdateToClient(remoteClient, OffsetPosition); | 3388 | if (ParentGroup == null || ParentGroup.IsDeleted) |
3344 | } | ||
3345 | |||
3346 | /// <summary> | ||
3347 | /// Sends a full update to the client | ||
3348 | /// </summary> | ||
3349 | /// <param name="remoteClient"></param> | ||
3350 | /// <param name="lPos"></param> | ||
3351 | public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos) | ||
3352 | { | ||
3353 | if (ParentGroup == null) | ||
3354 | return; | ||
3355 | |||
3356 | // Suppress full updates during attachment editing | ||
3357 | // sl Does send them | ||
3358 | // if (ParentGroup.IsSelected && ParentGroup.IsAttachment) | ||
3359 | // return; | ||
3360 | |||
3361 | if (ParentGroup.IsDeleted) | ||
3362 | return; | 3389 | return; |
3363 | 3390 | ||
3364 | if (ParentGroup.IsAttachment | 3391 | if (ParentGroup.IsAttachment |
@@ -3516,6 +3543,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3516 | Force = force; | 3543 | Force = force; |
3517 | } | 3544 | } |
3518 | 3545 | ||
3546 | public PhysicsInertiaData PhysicsInertia | ||
3547 | { | ||
3548 | get | ||
3549 | { | ||
3550 | return m_physicsInertia; | ||
3551 | } | ||
3552 | set | ||
3553 | { | ||
3554 | m_physicsInertia = value; | ||
3555 | } | ||
3556 | } | ||
3557 | |||
3519 | public SOPVehicle VehicleParams | 3558 | public SOPVehicle VehicleParams |
3520 | { | 3559 | { |
3521 | get | 3560 | get |
@@ -3689,7 +3728,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3689 | bool hasDimple; | 3728 | bool hasDimple; |
3690 | bool hasProfileCut; | 3729 | bool hasProfileCut; |
3691 | 3730 | ||
3692 | PrimType primType = GetPrimType(); | 3731 | if(Shape.SculptEntry) |
3732 | { | ||
3733 | if (Shape.SculptType != (byte)SculptType.Mesh) | ||
3734 | return 1; // sculp | ||
3735 | |||
3736 | //hack to detect new upload with faces data enconded on pbs | ||
3737 | if ((Shape.ProfileCurve & 0xf0) != (byte)HollowShape.Triangle) | ||
3738 | // old broken upload TODO | ||
3739 | return 8; | ||
3740 | } | ||
3741 | |||
3742 | PrimType primType = GetPrimType(true); | ||
3693 | HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | 3743 | HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); |
3694 | 3744 | ||
3695 | switch (primType) | 3745 | switch (primType) |
@@ -3733,13 +3783,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3733 | if (hasProfileCut) ret += 2; | 3783 | if (hasProfileCut) ret += 2; |
3734 | if (hasHollow) ret += 1; | 3784 | if (hasHollow) ret += 1; |
3735 | break; | 3785 | break; |
3736 | case PrimType.SCULPT: | ||
3737 | // Special mesh handling | ||
3738 | if (Shape.SculptType == (byte)SculptType.Mesh) | ||
3739 | ret = 8; // if it's a mesh then max 8 faces | ||
3740 | else | ||
3741 | ret = 1; // if it's a sculpt then max 1 face | ||
3742 | break; | ||
3743 | } | 3786 | } |
3744 | 3787 | ||
3745 | return ret; | 3788 | return ret; |
@@ -3750,9 +3793,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3750 | /// </summary> | 3793 | /// </summary> |
3751 | /// <param name="primShape"></param> | 3794 | /// <param name="primShape"></param> |
3752 | /// <returns></returns> | 3795 | /// <returns></returns> |
3753 | public PrimType GetPrimType() | 3796 | public PrimType GetPrimType(bool ignoreSculpt = false) |
3754 | { | 3797 | { |
3755 | if (Shape.SculptEntry) | 3798 | if (Shape.SculptEntry && !ignoreSculpt) |
3756 | return PrimType.SCULPT; | 3799 | return PrimType.SCULPT; |
3757 | 3800 | ||
3758 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 3801 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) |
@@ -4464,7 +4507,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4464 | 4507 | ||
4465 | break; | 4508 | break; |
4466 | } | 4509 | } |
4467 | 4510 | AggregateInnerPerms(); | |
4468 | SendFullUpdateToAllClients(); | 4511 | SendFullUpdateToAllClients(); |
4469 | } | 4512 | } |
4470 | } | 4513 | } |
@@ -4481,6 +4524,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4481 | EveryoneMask = source.EveryoneMask & BaseMask; | 4524 | EveryoneMask = source.EveryoneMask & BaseMask; |
4482 | NextOwnerMask = source.NextOwnerMask & BaseMask; | 4525 | NextOwnerMask = source.NextOwnerMask & BaseMask; |
4483 | 4526 | ||
4527 | AggregateInnerPerms(); | ||
4528 | |||
4484 | if (OwnerMask != prevOwnerMask || | 4529 | if (OwnerMask != prevOwnerMask || |
4485 | GroupMask != prevGroupMask || | 4530 | GroupMask != prevGroupMask || |
4486 | EveryoneMask != prevEveryoneMask || | 4531 | EveryoneMask != prevEveryoneMask || |
@@ -4714,8 +4759,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4714 | 4759 | ||
4715 | if (VolumeDetectActive) // change if not the default only | 4760 | if (VolumeDetectActive) // change if not the default only |
4716 | pa.SetVolumeDetect(1); | 4761 | pa.SetVolumeDetect(1); |
4762 | |||
4763 | bool isroot = (m_localId == ParentGroup.RootPart.LocalId); | ||
4717 | 4764 | ||
4718 | if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId) | 4765 | if(isroot && m_physicsInertia != null) |
4766 | pa.SetInertiaData(m_physicsInertia); | ||
4767 | |||
4768 | if (isroot && m_vehicleParams != null ) | ||
4719 | { | 4769 | { |
4720 | m_vehicleParams.SetVehicle(pa); | 4770 | m_vehicleParams.SetVehicle(pa); |
4721 | if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled) | 4771 | if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled) |
@@ -5181,7 +5231,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5181 | /// <param name="scene">The scene the prim is being rezzed into</param> | 5231 | /// <param name="scene">The scene the prim is being rezzed into</param> |
5182 | public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) | 5232 | public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) |
5183 | { | 5233 | { |
5184 | if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) | 5234 | if ((OwnerID != item.Owner) || ((item.CurrentPermissions & (uint)PermissionMask.Slam) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) |
5185 | { | 5235 | { |
5186 | if (scene.Permissions.PropagatePermissions()) | 5236 | if (scene.Permissions.PropagatePermissions()) |
5187 | { | 5237 | { |
@@ -5212,16 +5262,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5212 | 5262 | ||
5213 | if (OwnerID != item.Owner) | 5263 | if (OwnerID != item.Owner) |
5214 | { | 5264 | { |
5215 | //LogPermissions("Before ApplyNextOwnerPermissions"); | 5265 | if(OwnerID != GroupID) |
5266 | LastOwnerID = OwnerID; | ||
5267 | OwnerID = item.Owner; | ||
5268 | Inventory.ChangeInventoryOwner(item.Owner); | ||
5216 | 5269 | ||
5217 | if (scene.Permissions.PropagatePermissions()) | 5270 | if (scene.Permissions.PropagatePermissions()) |
5218 | ApplyNextOwnerPermissions(); | 5271 | ApplyNextOwnerPermissions(); |
5219 | |||
5220 | //LogPermissions("After ApplyNextOwnerPermissions"); | ||
5221 | |||
5222 | LastOwnerID = OwnerID; | ||
5223 | OwnerID = item.Owner; | ||
5224 | Inventory.ChangeInventoryOwner(item.Owner); | ||
5225 | } | 5272 | } |
5226 | } | 5273 | } |
5227 | 5274 | ||
@@ -5245,6 +5292,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5245 | GroupMask = 0; // Giving an object zaps group permissions | 5292 | GroupMask = 0; // Giving an object zaps group permissions |
5246 | 5293 | ||
5247 | Inventory.ApplyNextOwnerPermissions(); | 5294 | Inventory.ApplyNextOwnerPermissions(); |
5295 | AggregateInnerPerms(); | ||
5248 | } | 5296 | } |
5249 | 5297 | ||
5250 | public void UpdateLookAt() | 5298 | public void UpdateLookAt() |
@@ -5306,6 +5354,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5306 | item.OwnerChanged = false; | 5354 | item.OwnerChanged = false; |
5307 | Inventory.UpdateInventoryItem(item, false, false); | 5355 | Inventory.UpdateInventoryItem(item, false, false); |
5308 | } | 5356 | } |
5357 | AggregateInnerPerms(); | ||
5309 | } | 5358 | } |
5310 | 5359 | ||
5311 | /// <summary> | 5360 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6557003..b53c355 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", | 360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", |
361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
362 | 362 | ||
363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part)) |
364 | { | 364 | { |
365 | StoreScriptError(item.ItemID, "no permission"); | 365 | StoreScriptError(item.ItemID, "no permission"); |
366 | return false; | 366 | return false; |
@@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
807 | else | 807 | else |
808 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 808 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
809 | 809 | ||
810 | m_part.AggregateInnerPerms(); | ||
810 | m_inventorySerial++; | 811 | m_inventorySerial++; |
811 | //m_inventorySerial += 2; | 812 | //m_inventorySerial += 2; |
812 | HasInventoryChanged = true; | 813 | HasInventoryChanged = true; |
@@ -829,7 +830,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
829 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 830 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
830 | } | 831 | } |
831 | m_items.LockItemsForWrite(false); | 832 | m_items.LockItemsForWrite(false); |
832 | 833 | m_part.AggregateInnerPerms(); | |
833 | m_inventorySerial++; | 834 | m_inventorySerial++; |
834 | } | 835 | } |
835 | 836 | ||
@@ -943,8 +944,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
943 | 944 | ||
944 | group.SetGroup(m_part.GroupID, null); | 945 | group.SetGroup(m_part.GroupID, null); |
945 | 946 | ||
946 | // TODO: Remove magic number badness | 947 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) |
947 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
948 | { | 948 | { |
949 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 949 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
950 | { | 950 | { |
@@ -964,10 +964,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | 964 | ||
965 | foreach (SceneObjectPart part in partList) | 965 | foreach (SceneObjectPart part in partList) |
966 | { | 966 | { |
967 | // TODO: Remove magic number badness | 967 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) |
968 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
969 | { | 968 | { |
970 | part.LastOwnerID = part.OwnerID; | 969 | if(part.GroupID != part.OwnerID) |
970 | part.LastOwnerID = part.OwnerID; | ||
971 | part.OwnerID = item.OwnerID; | 971 | part.OwnerID = item.OwnerID; |
972 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 972 | part.Inventory.ChangeInventoryOwner(item.OwnerID); |
973 | } | 973 | } |
@@ -981,6 +981,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
981 | } | 981 | } |
982 | // old code end | 982 | // old code end |
983 | rootPart.TrimPermissions(); | 983 | rootPart.TrimPermissions(); |
984 | group.AggregateDeepPerms(); | ||
984 | } | 985 | } |
985 | 986 | ||
986 | return true; | 987 | return true; |
@@ -1022,16 +1023,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1022 | item.AssetID = m_items[item.ItemID].AssetID; | 1023 | item.AssetID = m_items[item.ItemID].AssetID; |
1023 | 1024 | ||
1024 | m_items[item.ItemID] = item; | 1025 | m_items[item.ItemID] = item; |
1026 | |||
1025 | m_inventorySerial++; | 1027 | m_inventorySerial++; |
1026 | if (fireScriptEvents) | 1028 | if (fireScriptEvents) |
1027 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 1029 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
1028 | 1030 | ||
1029 | if (considerChanged) | 1031 | if (considerChanged) |
1030 | { | 1032 | { |
1033 | m_part.AggregateInnerPerms(); | ||
1034 | m_part.ParentGroup.AggregatePerms(); | ||
1031 | HasInventoryChanged = true; | 1035 | HasInventoryChanged = true; |
1032 | m_part.ParentGroup.HasGroupChanged = true; | 1036 | m_part.ParentGroup.HasGroupChanged = true; |
1033 | } | 1037 | } |
1034 | m_items.LockItemsForWrite(false); | 1038 | m_items.LockItemsForWrite(false); |
1039 | |||
1035 | return true; | 1040 | return true; |
1036 | } | 1041 | } |
1037 | else | 1042 | else |
@@ -1068,6 +1073,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1068 | m_items.LockItemsForWrite(true); | 1073 | m_items.LockItemsForWrite(true); |
1069 | m_items.Remove(itemID); | 1074 | m_items.Remove(itemID); |
1070 | m_items.LockItemsForWrite(false); | 1075 | m_items.LockItemsForWrite(false); |
1076 | |||
1077 | m_part.AggregateInnerPerms(); | ||
1078 | m_part.ParentGroup.AggregatePerms(); | ||
1079 | |||
1071 | m_inventorySerial++; | 1080 | m_inventorySerial++; |
1072 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 1081 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
1073 | 1082 | ||
@@ -1170,7 +1179,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1170 | foreach (TaskInventoryItem item in m_items.Values) | 1179 | foreach (TaskInventoryItem item in m_items.Values) |
1171 | { | 1180 | { |
1172 | UUID ownerID = item.OwnerID; | 1181 | UUID ownerID = item.OwnerID; |
1173 | uint everyoneMask = 0; | 1182 | uint everyoneMask = item.EveryonePermissions; |
1174 | uint baseMask = item.BasePermissions; | 1183 | uint baseMask = item.BasePermissions; |
1175 | uint ownerMask = item.CurrentPermissions; | 1184 | uint ownerMask = item.CurrentPermissions; |
1176 | uint groupMask = item.GroupPermissions; | 1185 | uint groupMask = item.GroupPermissions; |
@@ -1319,6 +1328,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1319 | } | 1328 | } |
1320 | } | 1329 | } |
1321 | 1330 | ||
1331 | public void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone) | ||
1332 | { | ||
1333 | foreach (TaskInventoryItem item in m_items.Values) | ||
1334 | { | ||
1335 | owner &= item.CurrentPermissions; | ||
1336 | group &= item.GroupPermissions; | ||
1337 | everyone &= item.EveryonePermissions; | ||
1338 | } | ||
1339 | } | ||
1340 | |||
1322 | public uint MaskEffectivePermissions() | 1341 | public uint MaskEffectivePermissions() |
1323 | { | 1342 | { |
1324 | uint mask=0x7fffffff; | 1343 | uint mask=0x7fffffff; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9545c13..6d4cb52 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1778,6 +1778,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1778 | 1778 | ||
1779 | private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>(); | 1779 | private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>(); |
1780 | 1780 | ||
1781 | public void AddNeighbourRegion(GridRegion region, string capsPath) | ||
1782 | { | ||
1783 | lock (m_knownChildRegions) | ||
1784 | { | ||
1785 | ulong regionHandle = region.RegionHandle; | ||
1786 | m_knownChildRegions.Add(regionHandle,capsPath); | ||
1787 | |||
1788 | spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); | ||
1789 | sizeInfo.sizeX = region.RegionSizeX; | ||
1790 | sizeInfo.sizeY = region.RegionSizeY; | ||
1791 | m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo; | ||
1792 | } | ||
1793 | } | ||
1794 | |||
1781 | public void AddNeighbourRegionSizeInfo(GridRegion region) | 1795 | public void AddNeighbourRegionSizeInfo(GridRegion region) |
1782 | { | 1796 | { |
1783 | lock (m_knownChildRegions) | 1797 | lock (m_knownChildRegions) |
@@ -1826,6 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1826 | } | 1840 | } |
1827 | } | 1841 | } |
1828 | 1842 | ||
1843 | public bool knowsNeighbourRegion(ulong regionHandle) | ||
1844 | { | ||
1845 | lock (m_knownChildRegions) | ||
1846 | return m_knownChildRegions.ContainsKey(regionHandle); | ||
1847 | } | ||
1848 | |||
1829 | public void DropOldNeighbours(List<ulong> oldRegions) | 1849 | public void DropOldNeighbours(List<ulong> oldRegions) |
1830 | { | 1850 | { |
1831 | foreach (ulong handle in oldRegions) | 1851 | foreach (ulong handle in oldRegions) |
@@ -2010,6 +2030,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2010 | return; | 2030 | return; |
2011 | } | 2031 | } |
2012 | 2032 | ||
2033 | |||
2013 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2034 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2014 | 2035 | ||
2015 | if(!haveGroupInformation && !IsChildAgent && !IsNPC) | 2036 | if(!haveGroupInformation && !IsChildAgent && !IsNPC) |
@@ -2029,11 +2050,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); | 2050 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); |
2030 | } | 2051 | } |
2031 | 2052 | ||
2032 | // Tell the client that we're totally ready | ||
2033 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
2034 | |||
2035 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2036 | |||
2037 | if (!string.IsNullOrEmpty(m_callbackURI)) | 2053 | if (!string.IsNullOrEmpty(m_callbackURI)) |
2038 | { | 2054 | { |
2039 | // We cannot sleep here since this would hold up the inbound packet processing thread, as | 2055 | // We cannot sleep here since this would hold up the inbound packet processing thread, as |
@@ -2054,6 +2070,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2054 | 2070 | ||
2055 | Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); | 2071 | Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); |
2056 | m_callbackURI = null; | 2072 | m_callbackURI = null; |
2073 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2057 | } | 2074 | } |
2058 | // else | 2075 | // else |
2059 | // { | 2076 | // { |
@@ -2062,19 +2079,58 @@ namespace OpenSim.Region.Framework.Scenes | |||
2062 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | 2079 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); |
2063 | // } | 2080 | // } |
2064 | 2081 | ||
2065 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2082 | |
2083 | // Tell the client that we're totally ready | ||
2084 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
2085 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2086 | |||
2087 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; | ||
2088 | |||
2089 | int delayctnr = Util.EnvironmentTickCount(); | ||
2090 | |||
2091 | if (!IsChildAgent) | ||
2092 | { | ||
2093 | if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) | ||
2094 | { | ||
2095 | |||
2096 | // SceneObjectPart root = ParentPart.ParentGroup.RootPart; | ||
2097 | // if(root.LocalId != ParentPart.LocalId) | ||
2098 | // ControllingClient.SendEntityTerseUpdateImmediate(root); | ||
2099 | // ControllingClient.SendEntityTerseUpdateImmediate(ParentPart); | ||
2100 | ParentPart.ParentGroup.SendFullUpdateToClient(ControllingClient); | ||
2101 | } | ||
2102 | |||
2103 | // verify baked textures and cache | ||
2104 | bool cachedbaked = false; | ||
2105 | |||
2106 | if (IsNPC) | ||
2107 | cachedbaked = true; | ||
2108 | else | ||
2109 | { | ||
2110 | if (m_scene.AvatarFactory != null && !isHGTP) | ||
2111 | cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | ||
2112 | |||
2113 | // not sure we need this | ||
2114 | if (!cachedbaked) | ||
2115 | { | ||
2116 | if (m_scene.AvatarFactory != null) | ||
2117 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | ||
2118 | } | ||
2119 | } | ||
2120 | m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
2121 | } | ||
2066 | 2122 | ||
2067 | if(m_teleportFlags > 0) | 2123 | if(m_teleportFlags > 0) |
2068 | { | 2124 | { |
2069 | gotCrossUpdate = false; // sanity check | 2125 | gotCrossUpdate = false; // sanity check |
2070 | Thread.Sleep(500); // let viewers catch us | 2126 | if(Util.EnvironmentTickCountSubtract(delayctnr)< 500) |
2127 | Thread.Sleep(500); // let viewers catch us | ||
2071 | } | 2128 | } |
2072 | 2129 | ||
2073 | if(!gotCrossUpdate) | 2130 | if(!gotCrossUpdate) |
2074 | RotateToLookAt(look); | 2131 | RotateToLookAt(look); |
2075 | 2132 | ||
2076 | // HG | 2133 | // HG |
2077 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; | ||
2078 | if(isHGTP) | 2134 | if(isHGTP) |
2079 | { | 2135 | { |
2080 | // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); | 2136 | // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); |
@@ -2101,28 +2157,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2101 | 2157 | ||
2102 | if (!IsChildAgent) | 2158 | if (!IsChildAgent) |
2103 | { | 2159 | { |
2104 | // verify baked textures and cache | ||
2105 | bool cachedbaked = false; | ||
2106 | |||
2107 | if (IsNPC) | ||
2108 | cachedbaked = true; | ||
2109 | else | ||
2110 | { | ||
2111 | if (m_scene.AvatarFactory != null && !isHGTP) | ||
2112 | cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | ||
2113 | |||
2114 | // not sure we need this | ||
2115 | if (!cachedbaked) | ||
2116 | { | ||
2117 | if (m_scene.AvatarFactory != null) | ||
2118 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | ||
2119 | } | ||
2120 | } | ||
2121 | |||
2122 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | 2160 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |
2123 | 2161 | ||
2124 | // send avatar object to all presences including us, so they cross it into region | 2162 | // send avatar object to all presences including us, so they cross it into region |
2125 | // then hide if necessary | 2163 | // then hide if necessary |
2164 | |||
2126 | SendInitialAvatarDataToAllAgents(allpresences); | 2165 | SendInitialAvatarDataToAllAgents(allpresences); |
2127 | 2166 | ||
2128 | // send this look | 2167 | // send this look |
@@ -2230,13 +2269,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2230 | m_lastChildAgentUpdateDrawDistance = DrawDistance; | 2269 | m_lastChildAgentUpdateDrawDistance = DrawDistance; |
2231 | m_lastChildAgentUpdatePosition = AbsolutePosition; | 2270 | m_lastChildAgentUpdatePosition = AbsolutePosition; |
2232 | m_childUpdatesBusy = false; // allow them | 2271 | m_childUpdatesBusy = false; // allow them |
2272 | |||
2273 | |||
2233 | } | 2274 | } |
2234 | 2275 | ||
2235 | m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2276 | m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2236 | 2277 | ||
2278 | |||
2279 | |||
2237 | // send the rest of the world | 2280 | // send the rest of the world |
2238 | if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) | 2281 | if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) |
2239 | SendInitialDataToMe(); | 2282 | SendInitialDataToMe(); |
2283 | |||
2240 | 2284 | ||
2241 | // priority uses avatar position only | 2285 | // priority uses avatar position only |
2242 | // m_reprioritizationLastPosition = AbsolutePosition; | 2286 | // m_reprioritizationLastPosition = AbsolutePosition; |
@@ -3110,6 +3154,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | 3154 | ||
3111 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; | 3155 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; |
3112 | m_pos = standPos; | 3156 | m_pos = standPos; |
3157 | |||
3113 | } | 3158 | } |
3114 | 3159 | ||
3115 | // We need to wait until we have calculated proper stand positions before sitting up the physical | 3160 | // We need to wait until we have calculated proper stand positions before sitting up the physical |
@@ -3124,6 +3169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3124 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3169 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
3125 | 3170 | ||
3126 | SendAvatarDataToAllAgents(); | 3171 | SendAvatarDataToAllAgents(); |
3172 | m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on | ||
3127 | } | 3173 | } |
3128 | 3174 | ||
3129 | // reset to default sitAnimation | 3175 | // reset to default sitAnimation |
@@ -3256,6 +3302,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3256 | // Moved here to avoid a race with default sit anim | 3302 | // Moved here to avoid a race with default sit anim |
3257 | // The script event needs to be raised after the default sit anim is set. | 3303 | // The script event needs to be raised after the default sit anim is set. |
3258 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3304 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
3305 | m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on | ||
3259 | } | 3306 | } |
3260 | } | 3307 | } |
3261 | 3308 | ||
@@ -3405,6 +3452,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3405 | 3452 | ||
3406 | Animator.SetMovementAnimations("SIT"); | 3453 | Animator.SetMovementAnimations("SIT"); |
3407 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3454 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
3455 | m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on | ||
3408 | } | 3456 | } |
3409 | 3457 | ||
3410 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 3458 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
@@ -3968,7 +4016,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3968 | int count = 0; | 4016 | int count = 0; |
3969 | foreach (ScenePresence p in presences) | 4017 | foreach (ScenePresence p in presences) |
3970 | { | 4018 | { |
3971 | p.ControllingClient.SendAvatarDataImmediate(this); | 4019 | p.ControllingClient.SendEntityFullUpdateImmediate(this); |
3972 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | 4020 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
3973 | // either just kill the object | 4021 | // either just kill the object |
3974 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); | 4022 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); |
@@ -3981,7 +4029,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3981 | 4029 | ||
3982 | public void SendInitialAvatarDataToAgent(ScenePresence p) | 4030 | public void SendInitialAvatarDataToAgent(ScenePresence p) |
3983 | { | 4031 | { |
3984 | p.ControllingClient.SendAvatarDataImmediate(this); | 4032 | p.ControllingClient.SendEntityFullUpdateImmediate(this); |
3985 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) | 4033 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) |
3986 | // either just kill the object | 4034 | // either just kill the object |
3987 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); | 4035 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); |
@@ -3998,12 +4046,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3998 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); | 4046 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); |
3999 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.IsViewerUIGod) | 4047 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.IsViewerUIGod) |
4000 | return; | 4048 | return; |
4001 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 4049 | avatar.ControllingClient.SendEntityFullUpdateImmediate(this); |
4002 | } | 4050 | } |
4003 | 4051 | ||
4004 | public void SendAvatarDataToAgentNF(ScenePresence avatar) | 4052 | public void SendAvatarDataToAgentNF(ScenePresence avatar) |
4005 | { | 4053 | { |
4006 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 4054 | avatar.ControllingClient.SendEntityFullUpdateImmediate(this); |
4007 | } | 4055 | } |
4008 | 4056 | ||
4009 | /// <summary> | 4057 | /// <summary> |
@@ -6440,7 +6488,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6440 | if (check) | 6488 | if (check) |
6441 | { | 6489 | { |
6442 | // check is relative to current parcel only | 6490 | // check is relative to current parcel only |
6443 | if (currentParcelUUID == null || oldhide == currentParcelHide) | 6491 | if (oldhide == currentParcelHide) |
6444 | return; | 6492 | return; |
6445 | 6493 | ||
6446 | allpresences = m_scene.GetScenePresences(); | 6494 | allpresences = m_scene.GetScenePresences(); |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b8d210c..87d1ace 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
114 | // Script state may, or may not, exist. Not having any, is NOT | 114 | // Script state may, or may not, exist. Not having any, is NOT |
115 | // ever a problem. | 115 | // ever a problem. |
116 | sceneObject.LoadScriptState(reader); | 116 | sceneObject.LoadScriptState(reader); |
117 | 117 | sceneObject.AggregateDeepPerms(); | |
118 | return sceneObject; | 118 | return sceneObject; |
119 | } | 119 | } |
120 | 120 | ||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
278 | // Script state may, or may not, exist. Not having any, is NOT | 278 | // Script state may, or may not, exist. Not having any, is NOT |
279 | // ever a problem. | 279 | // ever a problem. |
280 | sceneObject.LoadScriptState(doc); | 280 | sceneObject.LoadScriptState(doc); |
281 | 281 | sceneObject.AggregatePerms(); | |
282 | return sceneObject; | 282 | return sceneObject; |
283 | } | 283 | } |
284 | catch (Exception e) | 284 | catch (Exception e) |
@@ -453,9 +453,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
453 | m_SOPXmlProcessors.Add("Torque", ProcessTorque); | 453 | m_SOPXmlProcessors.Add("Torque", ProcessTorque); |
454 | m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); | 454 | m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); |
455 | 455 | ||
456 | |||
457 | m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); | 456 | m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); |
458 | 457 | ||
458 | m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia); | ||
459 | |||
459 | m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks); | 460 | m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks); |
460 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | 461 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); |
461 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | 462 | m_SOPXmlProcessors.Add("Density", ProcessDensity); |
@@ -781,6 +782,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
781 | } | 782 | } |
782 | } | 783 | } |
783 | 784 | ||
785 | private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader) | ||
786 | { | ||
787 | PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader); | ||
788 | |||
789 | if (pdata == null) | ||
790 | { | ||
791 | obj.PhysicsInertia = null; | ||
792 | m_log.DebugFormat( | ||
793 | "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
794 | obj.Name, obj.UUID); | ||
795 | } | ||
796 | else | ||
797 | { | ||
798 | obj.PhysicsInertia = pdata; | ||
799 | } | ||
800 | } | ||
801 | |||
784 | private static void ProcessShape(SceneObjectPart obj, XmlReader reader) | 802 | private static void ProcessShape(SceneObjectPart obj, XmlReader reader) |
785 | { | 803 | { |
786 | List<string> errorNodeNames; | 804 | List<string> errorNodeNames; |
@@ -1498,6 +1516,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1498 | if (sop.VehicleParams != null) | 1516 | if (sop.VehicleParams != null) |
1499 | sop.VehicleParams.ToXml2(writer); | 1517 | sop.VehicleParams.ToXml2(writer); |
1500 | 1518 | ||
1519 | if (sop.PhysicsInertia != null) | ||
1520 | sop.PhysicsInertia.ToXml2(writer); | ||
1521 | |||
1501 | if(sop.RotationAxisLocks != 0) | 1522 | if(sop.RotationAxisLocks != 0) |
1502 | writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); | 1523 | writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); |
1503 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1524 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
@@ -1739,6 +1760,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1739 | 1760 | ||
1740 | reader.ReadEndElement(); // SceneObjectPart | 1761 | reader.ReadEndElement(); // SceneObjectPart |
1741 | 1762 | ||
1763 | obj.AggregateInnerPerms(); | ||
1742 | // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); | 1764 | // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); |
1743 | return obj; | 1765 | return obj; |
1744 | } | 1766 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 01bc491..0f022dd 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
70 | //obj.RegenerateFullIDs(); | 70 | //obj.RegenerateFullIDs(); |
71 | 71 | ||
72 | scene.AddNewSceneObject(obj, true); | 72 | scene.AddNewSceneObject(obj, true); |
73 | obj.AggregateDeepPerms(); | ||
73 | } | 74 | } |
74 | } | 75 | } |
75 | else | 76 | else |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 56723bf..4d2eb3f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
67 | 67 | ||
68 | SceneObjectGroup dupeSo | 68 | SceneObjectGroup dupeSo |
69 | = scene.SceneGraph.DuplicateObject( | 69 | = scene.SceneGraph.DuplicateObject( |
70 | part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity); | 70 | part1.LocalId, new Vector3(10, 0, 0), ownerId, UUID.Zero, Quaternion.Identity, false); |
71 | Assert.That(dupeSo.Parts.Length, Is.EqualTo(2)); | 71 | Assert.That(dupeSo.Parts.Length, Is.EqualTo(2)); |
72 | 72 | ||
73 | SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); | 73 | SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index e1e973c..abf8c48 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |||
@@ -157,29 +157,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
157 | 157 | ||
158 | // Cross | 158 | // Cross |
159 | sceneA.SceneGraph.UpdatePrimGroupPosition( | 159 | sceneA.SceneGraph.UpdatePrimGroupPosition( |
160 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId); | 160 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); |
161 | 161 | ||
162 | // crossing is async | 162 | // crossing is async |
163 | Thread.Sleep(500); | 163 | Thread.Sleep(500); |
164 | 164 | ||
165 | SceneObjectGroup so1PostCross; | 165 | SceneObjectGroup so1PostCross; |
166 | 166 | ||
167 | { | 167 | ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); |
168 | ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); | 168 | Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); |
169 | Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); | ||
170 | 169 | ||
171 | ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); | 170 | ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); |
172 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); | 171 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); |
173 | sceneBTc.CompleteMovement(); | 172 | sceneBTc.CompleteMovement(); |
174 | 173 | ||
175 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | 174 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); |
176 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); | 175 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); |
176 | |||
177 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); | ||
178 | so1PostCross = sceneB.GetSceneObjectGroup(so1Id); | ||
179 | Assert.NotNull(so1PostCross); | ||
180 | Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); | ||
177 | 181 | ||
178 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); | ||
179 | so1PostCross = sceneB.GetSceneObjectGroup(so1Id); | ||
180 | Assert.NotNull(so1PostCross); | ||
181 | Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); | ||
182 | } | ||
183 | 182 | ||
184 | Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; | 183 | Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; |
185 | 184 | ||
@@ -187,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
187 | 186 | ||
188 | // Recross | 187 | // Recross |
189 | sceneB.SceneGraph.UpdatePrimGroupPosition( | 188 | sceneB.SceneGraph.UpdatePrimGroupPosition( |
190 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId); | 189 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); |
191 | 190 | ||
192 | // crossing is async | 191 | // crossing is async |
193 | Thread.Sleep(500); | 192 | Thread.Sleep(500); |
@@ -255,13 +254,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
255 | lmmA.EventManagerOnNoLandDataFromStorage(); | 254 | lmmA.EventManagerOnNoLandDataFromStorage(); |
256 | lmmB.EventManagerOnNoLandDataFromStorage(); | 255 | lmmB.EventManagerOnNoLandDataFromStorage(); |
257 | 256 | ||
257 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
258 | TestClient tc = new TestClient(acd, sceneA); | ||
259 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
260 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
261 | ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
262 | |||
258 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | 263 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); |
259 | UUID so1Id = so1.UUID; | 264 | UUID so1Id = so1.UUID; |
260 | so1.AbsolutePosition = new Vector3(128, 10, 20); | 265 | so1.AbsolutePosition = new Vector3(128, 10, 20); |
261 | 266 | ||
262 | // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly | 267 | // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly |
263 | // because only this will execute permission checks in the source region. | 268 | // because only this will execute permission checks in the source region. |
264 | sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId); | 269 | sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), sp1SceneA.ControllingClient); |
265 | 270 | ||
266 | // crossing is async | 271 | // crossing is async |
267 | Thread.Sleep(500); | 272 | Thread.Sleep(500); |