aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2010-08-10 19:49:35 +0100
committerMelanie2010-08-10 19:49:35 +0100
commitc2e5d1d20319be54e7cdc8ae1e5a82c640ea6928 (patch)
treef78ebe5ce10d6b5efa0700e381e751296277b7e6 /OpenSim/Region/Framework/Scenes
parentRemove 4000+ DOS line endings. Grrr! (diff)
parentChanging prim color generates event CHANGED_COLOR. (diff)
downloadopensim-SC_OLD-c2e5d1d20319be54e7cdc8ae1e5a82c640ea6928.zip
opensim-SC_OLD-c2e5d1d20319be54e7cdc8ae1e5a82c640ea6928.tar.gz
opensim-SC_OLD-c2e5d1d20319be54e7cdc8ae1e5a82c640ea6928.tar.bz2
opensim-SC_OLD-c2e5d1d20319be54e7cdc8ae1e5a82c640ea6928.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs64
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs42
6 files changed, 100 insertions, 68 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index 4e25c46..e183f9d 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -130,8 +130,6 @@ namespace OpenSim.Region.Framework.Scenes
130 { 130 {
131 return (EntityBase) MemberwiseClone(); 131 return (EntityBase) MemberwiseClone();
132 } 132 }
133
134 public abstract void SetText(string text, Vector3 color, double alpha);
135 } 133 }
136 134
137 //Nested Classes 135 //Nested Classes
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 05036f1..7e83634 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1363,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes
1363 m_regInfo.EstateSettings.Save(); 1363 m_regInfo.EstateSettings.Save();
1364 } 1364 }
1365 else 1365 else
1366 m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid,\n you must create the estate owner account first."); 1366 m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
1367 } 1367 }
1368 else 1368 else
1369 { 1369 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a862fa2..a0f267c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1619,7 +1619,7 @@ namespace OpenSim.Region.Framework.Scenes
1619 ScheduleGroupForFullUpdate(); 1619 ScheduleGroupForFullUpdate();
1620 } 1620 }
1621 1621
1622 public override void SetText(string text, Vector3 color, double alpha) 1622 public void SetText(string text, Vector3 color, double alpha)
1623 { 1623 {
1624 Color = Color.FromArgb(0xff - (int) (alpha * 0xff), 1624 Color = Color.FromArgb(0xff - (int) (alpha * 0xff),
1625 (int) (color.X * 0xff), 1625 (int) (color.X * 0xff),
@@ -1838,30 +1838,10 @@ namespace OpenSim.Region.Framework.Scenes
1838 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1838 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1839 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1839 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1840 1840
1841 if (userExposed) 1841 lockPartsForRead(true);
1842 dupe.m_rootPart.TrimPermissions();
1843
1844 /// may need to create a new Physics actor.
1845 if (dupe.RootPart.PhysActor != null && userExposed)
1846 {
1847 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
1848
1849 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1850 dupe.RootPart.Name,
1851 pbs,
1852 dupe.RootPart.AbsolutePosition,
1853 dupe.RootPart.Scale,
1854 dupe.RootPart.RotationOffset,
1855 dupe.RootPart.PhysActor.IsPhysical);
1856
1857 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
1858 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1859 }
1860 1842
1861 List<SceneObjectPart> partList; 1843 List<SceneObjectPart> partList;
1862 1844
1863 lockPartsForRead(true);
1864
1865 partList = new List<SceneObjectPart>(m_parts.Values); 1845 partList = new List<SceneObjectPart>(m_parts.Values);
1866 1846
1867 lockPartsForRead(false); 1847 lockPartsForRead(false);
@@ -1884,14 +1864,30 @@ namespace OpenSim.Region.Framework.Scenes
1884 1864
1885 if (userExposed) 1865 if (userExposed)
1886 { 1866 {
1887 dupe.UpdateParentIDs(); 1867 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1888 dupe.HasGroupChanged = true; 1868 newPart.LinkNum = part.LinkNum;
1889 dupe.AttachToBackup();
1890
1891 ScheduleGroupForFullUpdate();
1892 } 1869 }
1870
1871 // Need to duplicate the physics actor as well
1872 if (part.PhysActor != null && userExposed)
1873 {
1874 PrimitiveBaseShape pbs = part.Shape;
1875
1876 part.PhysActor
1877 = m_scene.PhysicsScene.AddPrimShape(
1878 part.Name,
1879 pbs,
1880 part.AbsolutePosition,
1881 part.Scale,
1882 part.RotationOffset,
1883 part.PhysActor.IsPhysical);
1884
1885 part.PhysActor.LocalID = part.LocalId;
1886 part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
1887 }
1893 } 1888 }
1894 finally 1889
1890 if (userExposed)
1895 { 1891 {
1896 m_dupeInProgress = false; 1892 m_dupeInProgress = false;
1897 } 1893 }
@@ -1909,7 +1905,6 @@ namespace OpenSim.Region.Framework.Scenes
1909 SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed)); 1905 SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed));
1910 } 1906 }
1911 1907
1912 public void ScriptSetPhysicsStatus(bool UsePhysics)
1913 { 1908 {
1914 bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); 1909 bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
1915 bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); 1910 bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 277384e..ba1f562 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -151,8 +151,17 @@ namespace OpenSim.Region.Framework.Scenes
151 // TODO: This needs to be persisted in next XML version update! 151 // TODO: This needs to be persisted in next XML version update!
152 [XmlIgnore] 152 [XmlIgnore]
153 public int[] PayPrice = {-2,-2,-2,-2,-2}; 153 public int[] PayPrice = {-2,-2,-2,-2,-2};
154
154 [XmlIgnore] 155 [XmlIgnore]
155 public PhysicsActor PhysActor; 156 public PhysicsActor PhysActor
157 {
158 get { return m_physActor; }
159 set
160 {
161// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
162 m_physActor = value;
163 }
164 }
156 165
157 //Xantor 20080528 Sound stuff: 166 //Xantor 20080528 Sound stuff:
158 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. 167 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
@@ -307,6 +316,7 @@ namespace OpenSim.Region.Framework.Scenes
307 /// </summary> 316 /// </summary>
308 private byte m_updateFlag; 317 private byte m_updateFlag;
309 318
319 private PhysicsActor m_physActor;
310 protected Vector3 m_acceleration; 320 protected Vector3 m_acceleration;
311 protected Vector3 m_angularVelocity; 321 protected Vector3 m_angularVelocity;
312 322
@@ -406,7 +416,7 @@ namespace OpenSim.Region.Framework.Scenes
406 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 416 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
407 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log 417 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
408 418
409 _flags = 0; 419 Flags = 0;
410 CreateSelected = true; 420 CreateSelected = true;
411 421
412 TrimPermissions(); 422 TrimPermissions();
@@ -434,7 +444,7 @@ namespace OpenSim.Region.Framework.Scenes
434 private uint _groupMask = (uint)PermissionMask.None; 444 private uint _groupMask = (uint)PermissionMask.None;
435 private uint _everyoneMask = (uint)PermissionMask.None; 445 private uint _everyoneMask = (uint)PermissionMask.None;
436 private uint _nextOwnerMask = (uint)PermissionMask.All; 446 private uint _nextOwnerMask = (uint)PermissionMask.All;
437 private PrimFlags _flags = 0; 447 private PrimFlags _flags = PrimFlags.None;
438 private DateTime m_expires; 448 private DateTime m_expires;
439 private DateTime m_rezzed; 449 private DateTime m_rezzed;
440 private bool m_createSelected = false; 450 private bool m_createSelected = false;
@@ -485,10 +495,14 @@ namespace OpenSim.Region.Framework.Scenes
485 } 495 }
486 } 496 }
487 497
498 /// <summary>
499 /// This is idential to the Flags property, except that the returned value is uint rather than PrimFlags
500 /// </summary>
501 [Obsolete("Use Flags property instead")]
488 public uint ObjectFlags 502 public uint ObjectFlags
489 { 503 {
490 get { return (uint)_flags; } 504 get { return (uint)Flags; }
491 set { _flags = (PrimFlags)value; } 505 set { Flags = (PrimFlags)value; }
492 } 506 }
493 507
494 public UUID UUID 508 public UUID UUID
@@ -1026,7 +1040,11 @@ namespace OpenSim.Region.Framework.Scenes
1026 public bool CreateSelected 1040 public bool CreateSelected
1027 { 1041 {
1028 get { return m_createSelected; } 1042 get { return m_createSelected; }
1029 set { m_createSelected = value; } 1043 set
1044 {
1045// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID);
1046 m_createSelected = value;
1047 }
1030 } 1048 }
1031 1049
1032 #endregion 1050 #endregion
@@ -1194,7 +1212,11 @@ namespace OpenSim.Region.Framework.Scenes
1194 public PrimFlags Flags 1212 public PrimFlags Flags
1195 { 1213 {
1196 get { return _flags; } 1214 get { return _flags; }
1197 set { _flags = value; } 1215 set
1216 {
1217// m_log.DebugFormat("[SOP]: Setting flags for {0} {1} to {2}", UUID, Name, value);
1218 _flags = value;
1219 }
1198 } 1220 }
1199 1221
1200 [XmlIgnore] 1222 [XmlIgnore]
@@ -1329,7 +1351,7 @@ namespace OpenSim.Region.Framework.Scenes
1329 if ((ObjectFlags & (uint) flag) == 0) 1351 if ((ObjectFlags & (uint) flag) == 0)
1330 { 1352 {
1331 //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); 1353 //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString());
1332 _flags |= flag; 1354 Flags |= flag;
1333 1355
1334 if (flag == PrimFlags.TemporaryOnRez) 1356 if (flag == PrimFlags.TemporaryOnRez)
1335 ResetExpire(); 1357 ResetExpire();
@@ -1554,7 +1576,7 @@ namespace OpenSim.Region.Framework.Scenes
1554 } 1576 }
1555 else 1577 else
1556 { 1578 {
1557 m_log.DebugFormat("[SPEW]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); 1579 m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
1558 } 1580 }
1559 } 1581 }
1560 } 1582 }
@@ -1824,7 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes
1824 /// that's not wholesome. Had to make Scene public 1846 /// that's not wholesome. Had to make Scene public
1825 //PhysActor = null; 1847 //PhysActor = null;
1826 1848
1827 if ((ObjectFlags & (uint)PrimFlags.Phantom) == 0) 1849 if ((Flags & PrimFlags.Phantom) == 0)
1828 { 1850 {
1829 if (UsePhysics) 1851 if (UsePhysics)
1830 { 1852 {
@@ -1971,12 +1993,14 @@ namespace OpenSim.Region.Framework.Scenes
1971 } 1993 }
1972 1994
1973 public uint GetEffectiveObjectFlags() 1995 public uint GetEffectiveObjectFlags()
1974 { 1996 {
1975 PrimFlags f = _flags; 1997 // Commenting this section of code out since it doesn't actually do anything, as enums are handled by
1976 if (m_parentGroup == null || m_parentGroup.RootPart == this) 1998 // value rather than reference
1977 f &= ~(PrimFlags.Touch | PrimFlags.Money); 1999// PrimFlags f = _flags;
2000// if (m_parentGroup == null || m_parentGroup.RootPart == this)
2001// f &= ~(PrimFlags.Touch | PrimFlags.Money);
1978 2002
1979 return (uint)_flags | (uint)LocalFlags; 2003 return (uint)Flags | (uint)LocalFlags;
1980 } 2004 }
1981 2005
1982 public Vector3 GetGeometricCenter() 2006 public Vector3 GetGeometricCenter()
@@ -2733,10 +2757,10 @@ namespace OpenSim.Region.Framework.Scenes
2733 public void RemFlag(PrimFlags flag) 2757 public void RemFlag(PrimFlags flag)
2734 { 2758 {
2735 // PrimFlags prevflag = Flags; 2759 // PrimFlags prevflag = Flags;
2736 if ((ObjectFlags & (uint) flag) != 0) 2760 if ((Flags & flag) != 0)
2737 { 2761 {
2738 //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString()); 2762 //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString());
2739 _flags &= ~flag; 2763 Flags &= ~flag;
2740 } 2764 }
2741 //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); 2765 //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
2742 //ScheduleFullUpdate(); 2766 //ScheduleFullUpdate();
@@ -2999,10 +3023,10 @@ namespace OpenSim.Region.Framework.Scenes
2999 3023
3000 if (remoteClient.AgentId == _ownerID) 3024 if (remoteClient.AgentId == _ownerID)
3001 { 3025 {
3002 if ((uint) (_flags & PrimFlags.CreateSelected) != 0) 3026 if ((Flags & PrimFlags.CreateSelected) != 0)
3003 { 3027 {
3004 clientFlags |= (uint) PrimFlags.CreateSelected; 3028 clientFlags |= (uint) PrimFlags.CreateSelected;
3005 _flags &= ~PrimFlags.CreateSelected; 3029 Flags &= ~PrimFlags.CreateSelected;
3006 } 3030 }
3007 } 3031 }
3008 //bool isattachment = IsAttachment; 3032 //bool isattachment = IsAttachment;
@@ -3308,6 +3332,7 @@ namespace OpenSim.Region.Framework.Scenes
3308 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3332 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
3309 tex.FaceTextures[face].RGBA = texcolor; 3333 tex.FaceTextures[face].RGBA = texcolor;
3310 UpdateTexture(tex); 3334 UpdateTexture(tex);
3335 TriggerScriptChangedEvent(Changed.COLOR);
3311 return; 3336 return;
3312 } 3337 }
3313 else if (face == ALL_SIDES) 3338 else if (face == ALL_SIDES)
@@ -3329,6 +3354,7 @@ namespace OpenSim.Region.Framework.Scenes
3329 tex.DefaultTexture.RGBA = texcolor; 3354 tex.DefaultTexture.RGBA = texcolor;
3330 } 3355 }
3331 UpdateTexture(tex); 3356 UpdateTexture(tex);
3357 TriggerScriptChangedEvent(Changed.COLOR);
3332 return; 3358 return;
3333 } 3359 }
3334 } 3360 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9d95324..3154872 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3560,11 +3560,6 @@ namespace OpenSim.Region.Framework.Scenes
3560 } 3560 }
3561 } 3561 }
3562 3562
3563 public override void SetText(string text, Vector3 color, double alpha)
3564 {
3565 throw new Exception("Can't set Text on avatar.");
3566 }
3567
3568 /// <summary> 3563 /// <summary>
3569 /// Adds a physical representation of the avatar to the Physics plugin 3564 /// Adds a physical representation of the avatar to the Physics plugin
3570 /// </summary> 3565 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 8a103d7..c9662ef 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -48,24 +48,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
48 TestHelper.InMethod(); 48 TestHelper.InMethod();
49 Scene scene = SceneSetupHelpers.SetupScene(); 49 Scene scene = SceneSetupHelpers.SetupScene();
50 50
51 UUID ownerUuid = new UUID("00000000-0000-0000-0000-000000000010"); 51 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
52 string objName = "obj1"; 52 string part1Name = "part1";
53 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); 53 UUID part1Id = new UUID("00000000-0000-0000-0000-000000000001");
54 string part2Name = "part2";
55 UUID part2Id = new UUID("00000000-0000-0000-0000-000000000002");
54 56
55 SceneObjectPart part 57 SceneObjectPart part1
56 = new SceneObjectPart(ownerUuid, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 58 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
57 { Name = objName, UUID = objUuid }; 59 { Name = part1Name, UUID = part1Id };
60 SceneObjectGroup so = new SceneObjectGroup(part1);
61 SceneObjectPart part2
62 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
63 { Name = part2Name, UUID = part2Id };
64 so.AddPart(part2);
58 65
59 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 66 scene.AddNewSceneObject(so, false);
60 67
61 SceneObjectGroup duplicatedSo 68 SceneObjectGroup dupeSo
62 = scene.SceneGraph.DuplicateObject( 69 = scene.SceneGraph.DuplicateObject(
63 part.LocalId, new Vector3(10, 0, 0), 0, ownerUuid, UUID.Zero, Quaternion.Identity); 70 part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity);
71 Assert.That(dupeSo.Children.Count, Is.EqualTo(2));
64 72
65 Assert.That(duplicatedSo.Children.Count, Is.EqualTo(1)); 73 SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
66 Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part.LocalId)); 74 SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);
75 Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId));
76 Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId));
67 77
68 //SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); 78 Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags));
79 Assert.That(dupePart2.Flags, Is.EqualTo(part2.Flags));
80
81 /*
82 Assert.That(part1.PhysActor, Is.Not.Null);
83 Assert.That(part2.PhysActor, Is.Not.Null);
84 Assert.That(dupePart1.PhysActor, Is.Not.Null);
85 Assert.That(dupePart2.PhysActor, Is.Not.Null);
86 */
69 } 87 }
70 } 88 }
71} \ No newline at end of file 89} \ No newline at end of file