diff options
author | lbsa71 | 2007-11-30 08:08:14 +0000 |
---|---|---|
committer | lbsa71 | 2007-11-30 08:08:14 +0000 |
commit | d2b1b54f497b9d401958806b433559dbbb9fa4fa (patch) | |
tree | 870e65ce7c0067ddda0c1c6a7011fdefa4c5bc68 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Extended our semi-stupid implementation of in world object permissions to s... (diff) | |
download | opensim-SC-d2b1b54f497b9d401958806b433559dbbb9fa4fa.zip opensim-SC-d2b1b54f497b9d401958806b433559dbbb9fa4fa.tar.gz opensim-SC-d2b1b54f497b9d401958806b433559dbbb9fa4fa.tar.bz2 opensim-SC-d2b1b54f497b9d401958806b433559dbbb9fa4fa.tar.xz |
* Removed permissions flag appliance from Xml deserialization
* Various code convention compliance
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 81 |
1 files changed, 47 insertions, 34 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index d8e2143..e2e97c5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -74,7 +74,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | [XmlIgnore] public uint TimeStampTerse = 0; | 74 | [XmlIgnore] public uint TimeStampTerse = 0; |
75 | [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn | 75 | [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn |
76 | 76 | ||
77 | protected SceneObjectGroup m_parentGroup; | ||
78 | 77 | ||
79 | /// <summary> | 78 | /// <summary> |
80 | /// Only used internally to schedule client updates | 79 | /// Only used internally to schedule client updates |
@@ -386,6 +385,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
386 | get { return OwnerID; } | 385 | get { return OwnerID; } |
387 | } | 386 | } |
388 | 387 | ||
388 | // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. | ||
389 | protected SceneObjectGroup m_parentGroup; | ||
389 | public SceneObjectGroup ParentGroup | 390 | public SceneObjectGroup ParentGroup |
390 | { | 391 | { |
391 | get { return m_parentGroup; } | 392 | get { return m_parentGroup; } |
@@ -533,7 +534,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
533 | } | 534 | } |
534 | 535 | ||
535 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 536 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
536 | doPhysicsPropertyUpdate(UsePhysics, true); | 537 | DoPhysicsPropertyUpdate(UsePhysics, true); |
537 | ScheduleFullUpdate(); | 538 | ScheduleFullUpdate(); |
538 | } | 539 | } |
539 | 540 | ||
@@ -547,28 +548,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
547 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 548 | public static SceneObjectPart FromXml(XmlReader xmlReader) |
548 | { | 549 | { |
549 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 550 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
550 | SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); | 551 | SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); |
552 | return newobject; | ||
553 | } | ||
554 | |||
555 | public void ApplyPhysics() | ||
556 | { | ||
557 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | ||
558 | DoPhysicsPropertyUpdate(UsePhysics, true); | ||
559 | } | ||
551 | 560 | ||
552 | if (!newobject.ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | 561 | public void ApplyPermissions() |
562 | { | ||
563 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | ||
553 | { | 564 | { |
554 | newobject.EveryoneMask = newobject.ObjectFlags; | 565 | EveryoneMask = ObjectFlags; |
555 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; | 566 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; |
556 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | 567 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; |
557 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; | 568 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; |
558 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; | 569 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; |
559 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; | 570 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; |
560 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; | 571 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; |
561 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; | 572 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; |
562 | } | 573 | } |
563 | else | 574 | else |
564 | { | 575 | { |
565 | newobject.EveryoneMask = newobject.ObjectFlags; | 576 | EveryoneMask = ObjectFlags; |
566 | } | 577 | } |
567 | |||
568 | bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | ||
569 | newobject.doPhysicsPropertyUpdate(UsePhysics, true); | ||
570 | |||
571 | return newobject; | ||
572 | } | 578 | } |
573 | 579 | ||
574 | /// <summary> | 580 | /// <summary> |
@@ -719,7 +725,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
719 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 725 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
720 | dupe.Shape.ExtraParams = extraP; | 726 | dupe.Shape.ExtraParams = extraP; |
721 | bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 727 | bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
722 | dupe.doPhysicsPropertyUpdate(UsePhysics, true); | 728 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); |
723 | 729 | ||
724 | return dupe; | 730 | return dupe; |
725 | } | 731 | } |
@@ -961,10 +967,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
961 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) | 967 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) |
962 | { | 968 | { |
963 | bool hasPrim = false; | 969 | bool hasPrim = false; |
964 | bool UsePhysics = false; | 970 | bool usePhysics = false; |
965 | bool IsTemporary = false; | 971 | bool IsTemporary = false; |
966 | bool IsPhantom = false; | 972 | bool IsPhantom = false; |
967 | bool CastsShadows = false; | 973 | bool castsShadows = false; |
968 | bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 974 | bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
969 | //bool IsLocked = false; | 975 | //bool IsLocked = false; |
970 | int i = 0; | 976 | int i = 0; |
@@ -974,11 +980,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
974 | { | 980 | { |
975 | i += 46; | 981 | i += 46; |
976 | //IsLocked = (data[i++] != 0) ? true : false; | 982 | //IsLocked = (data[i++] != 0) ? true : false; |
977 | UsePhysics = ((data[i++] != 0) && m_parentGroup.m_scene.m_physicalPrim) ? true : false; | 983 | usePhysics = ((data[i++] != 0) && m_parentGroup.m_scene.m_physicalPrim) ? true : false; |
978 | //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString()); | 984 | //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString()); |
979 | IsTemporary = (data[i++] != 0) ? true : false; | 985 | IsTemporary = (data[i++] != 0) ? true : false; |
980 | IsPhantom = (data[i++] != 0) ? true : false; | 986 | IsPhantom = (data[i++] != 0) ? true : false; |
981 | CastsShadows = (data[i++] != 0) ? true : false; | 987 | castsShadows = (data[i++] != 0) ? true : false; |
982 | } | 988 | } |
983 | catch (Exception) | 989 | catch (Exception) |
984 | { | 990 | { |
@@ -986,12 +992,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
986 | //Silently ignore it - TODO: FIXME Quick | 992 | //Silently ignore it - TODO: FIXME Quick |
987 | } | 993 | } |
988 | 994 | ||
989 | if (UsePhysics ) | 995 | if (usePhysics ) |
990 | { | 996 | { |
991 | AddFlag(LLObject.ObjectFlags.Physics); | 997 | AddFlag(LLObject.ObjectFlags.Physics); |
992 | if (!wasUsingPhysics) | 998 | if (!wasUsingPhysics) |
993 | { | 999 | { |
994 | doPhysicsPropertyUpdate(UsePhysics,false); | 1000 | DoPhysicsPropertyUpdate(usePhysics,false); |
995 | } | 1001 | } |
996 | 1002 | ||
997 | } | 1003 | } |
@@ -1000,7 +1006,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1000 | RemFlag(LLObject.ObjectFlags.Physics); | 1006 | RemFlag(LLObject.ObjectFlags.Physics); |
1001 | if (wasUsingPhysics) | 1007 | if (wasUsingPhysics) |
1002 | { | 1008 | { |
1003 | doPhysicsPropertyUpdate(UsePhysics, false); | 1009 | DoPhysicsPropertyUpdate(usePhysics, false); |
1004 | } | 1010 | } |
1005 | } | 1011 | } |
1006 | 1012 | ||
@@ -1030,13 +1036,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1030 | AbsolutePosition.Z), | 1036 | AbsolutePosition.Z), |
1031 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | 1037 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), |
1032 | new Quaternion(RotationOffset.W, RotationOffset.X, | 1038 | new Quaternion(RotationOffset.W, RotationOffset.X, |
1033 | RotationOffset.Y, RotationOffset.Z), UsePhysics); | 1039 | RotationOffset.Y, RotationOffset.Z), usePhysics); |
1034 | doPhysicsPropertyUpdate(UsePhysics, true); | 1040 | DoPhysicsPropertyUpdate(usePhysics, true); |
1035 | } | 1041 | } |
1036 | else | 1042 | else |
1037 | { | 1043 | { |
1038 | PhysActor.IsPhysical = UsePhysics; | 1044 | PhysActor.IsPhysical = usePhysics; |
1039 | doPhysicsPropertyUpdate(UsePhysics,false); | 1045 | DoPhysicsPropertyUpdate(usePhysics,false); |
1040 | } | 1046 | } |
1041 | } | 1047 | } |
1042 | 1048 | ||
@@ -1051,7 +1057,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1051 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 1057 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
1052 | ScheduleFullUpdate(); | 1058 | ScheduleFullUpdate(); |
1053 | } | 1059 | } |
1054 | public void doPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 1060 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
1055 | { | 1061 | { |
1056 | 1062 | ||
1057 | if (PhysActor != null) | 1063 | if (PhysActor != null) |
@@ -1271,13 +1277,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1271 | { | 1277 | { |
1272 | clientFlags = ObjectFlags; | 1278 | clientFlags = ObjectFlags; |
1273 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) | 1279 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1274 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; | 1280 | { |
1281 | clientFlags = (clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectCopy); | ||
1282 | } | ||
1283 | |||
1275 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) | 1284 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1276 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; | 1285 | { |
1286 | clientFlags = clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectMove; | ||
1287 | } | ||
1277 | 1288 | ||
1278 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; | 1289 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; |
1279 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; | 1290 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; |
1280 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | 1291 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; |
1292 | |||
1293 | // TODO, FIXME, ERROR : This whole block amounts to moot because of this. | ||
1281 | clientFlags = EveryoneMask; | 1294 | clientFlags = EveryoneMask; |
1282 | } | 1295 | } |
1283 | } | 1296 | } |
@@ -1372,7 +1385,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1372 | { | 1385 | { |
1373 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); | 1386 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); |
1374 | RemFlag(LLObject.ObjectFlags.Physics); | 1387 | RemFlag(LLObject.ObjectFlags.Physics); |
1375 | doPhysicsPropertyUpdate(false,true); | 1388 | DoPhysicsPropertyUpdate(false,true); |
1376 | m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1389 | m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
1377 | 1390 | ||
1378 | 1391 | ||