aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-30 16:52:12 +0000
committerTeravus Ovares2008-04-30 16:52:12 +0000
commitb70da6ac1955ada29e1cb4dbe9aeb915735ec686 (patch)
tree68f6f5f3e7fe2b0fd9a8e0c9baf2dbfafeb90882 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parent* Deal with a situation where the new fields in the inventory store are null ... (diff)
downloadopensim-SC-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.zip
opensim-SC-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.gz
opensim-SC-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.bz2
opensim-SC-b70da6ac1955ada29e1cb4dbe9aeb915735ec686.tar.xz
* Patch by Melanie. Implements proper objectflags on child objects. Thanks Melanie!
RE: 0001079: r4387. touch() event does not fire when touch script is in root prim and child prims are touched
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs107
1 files changed, 15 insertions, 92 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index c28e66f..863146c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -96,8 +96,6 @@ namespace OpenSim.Region.Environment.Scenes
96 private LLVector3 lastPhysGroupPos; 96 private LLVector3 lastPhysGroupPos;
97 private LLQuaternion lastPhysGroupRot; 97 private LLQuaternion lastPhysGroupRot;
98 98
99 private scriptEvents m_aggregateScriptEvents = scriptEvents.None;
100
101 /// <summary> 99 /// <summary>
102 /// The constituent parts of this group 100 /// The constituent parts of this group
103 /// </summary> 101 /// </summary>
@@ -716,7 +714,7 @@ namespace OpenSim.Region.Environment.Scenes
716 m_rootPart.SetParentLocalId(0); 714 m_rootPart.SetParentLocalId(0);
717 m_rootPart.SetAttachmentPoint((byte)0); 715 m_rootPart.SetAttachmentPoint((byte)0);
718 m_rootPart.m_IsAttachment = false; 716 m_rootPart.m_IsAttachment = false;
719 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); 717 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
720 AttachToBackup(); 718 AttachToBackup();
721 m_rootPart.ScheduleFullUpdate(); 719 m_rootPart.ScheduleFullUpdate();
722 m_rootPart.ClearUndoState(); 720 m_rootPart.ClearUndoState();
@@ -737,7 +735,7 @@ namespace OpenSim.Region.Environment.Scenes
737 //m_rootPart.SetAttachmentPoint((byte)0); 735 //m_rootPart.SetAttachmentPoint((byte)0);
738 m_rootPart.m_IsAttachment = false; 736 m_rootPart.m_IsAttachment = false;
739 AbsolutePosition = m_rootPart.m_attachedPos; 737 AbsolutePosition = m_rootPart.m_attachedPos;
740 //m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); 738 //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
741 //AttachToBackup(); 739 //AttachToBackup();
742 //m_rootPart.ScheduleFullUpdate(); 740 //m_rootPart.ScheduleFullUpdate();
743 741
@@ -943,100 +941,25 @@ namespace OpenSim.Region.Environment.Scenes
943 d.AddActiveScripts(count); 941 d.AddActiveScripts(count);
944 } 942 }
945 943
946 public void RemoveScriptEvents(LLUUID scriptid)
947 {
948 lock (m_scriptEvents)
949 {
950 if (m_scriptEvents.ContainsKey(scriptid))
951 {
952 scriptEvents oldparts = scriptEvents.None;
953 oldparts = (scriptEvents) m_scriptEvents[scriptid];
954
955 // remove values from aggregated script events
956 m_aggregateScriptEvents &= ~oldparts;
957 m_scriptEvents.Remove(scriptid);
958 }
959 }
960 aggregateScriptEvents();
961 }
962
963 public void SetScriptEvents(LLUUID scriptid, int events)
964 {
965 scriptEvents oldparts;
966 lock (m_scriptEvents)
967 {
968 if (m_scriptEvents.ContainsKey(scriptid))
969 {
970 oldparts = m_scriptEvents[scriptid];
971
972 // remove values from aggregated script events
973 m_aggregateScriptEvents &= ~oldparts;
974 m_scriptEvents[scriptid] = (scriptEvents) events;
975 }
976 else
977 {
978 m_scriptEvents.Add(scriptid, (scriptEvents) events);
979 }
980 }
981
982 aggregateScriptEvents();
983 }
984
985 public void aggregateScriptEvents() 944 public void aggregateScriptEvents()
986 { 945 {
987 // Aggregate script events 946 uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags();
988 lock (m_scriptEvents)
989 {
990 foreach (scriptEvents s in m_scriptEvents.Values)
991 {
992 m_aggregateScriptEvents |= s;
993 }
994 }
995 uint objectflagupdate = m_rootPart.ObjectFlags;
996
997 if (
998 ((m_aggregateScriptEvents & scriptEvents.touch) != 0) ||
999 ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) ||
1000 ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0)
1001 )
1002 {
1003 objectflagupdate |= (uint) LLObject.ObjectFlags.Touch;
1004 }
1005 else
1006 {
1007 objectflagupdate &= ~(uint) LLObject.ObjectFlags.Touch;
1008 }
1009 947
1010 if ((m_aggregateScriptEvents & scriptEvents.money) != 0) 948 scriptEvents aggregateScriptEvents=0;
1011 {
1012 objectflagupdate |= (uint) LLObject.ObjectFlags.Money;
1013 }
1014 else
1015 {
1016 objectflagupdate &= ~(uint) LLObject.ObjectFlags.Money;
1017 }
1018 949
1019 if (
1020 ((m_aggregateScriptEvents & scriptEvents.collision) != 0) ||
1021 ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) ||
1022 ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0)
1023 )
1024 {
1025 // subscribe to physics updates.
1026 }
1027 else
1028 {
1029 // unsubscribe to physics updates.
1030 }
1031 lock (m_parts) 950 lock (m_parts)
1032 { 951 {
1033 foreach (SceneObjectPart part in m_parts.Values) 952 foreach (SceneObjectPart part in m_parts.Values)
1034 { 953 {
1035 part.ObjectFlags = objectflagupdate; 954 if(part == null)
955 continue;
956 if(part != RootPart)
957 part.ObjectFlags = objectflagupdate;
958 aggregateScriptEvents |= part.m_aggregateScriptEvents;
1036 } 959 }
1037 } 960 }
1038 961
1039 if ((m_aggregateScriptEvents & scriptEvents.at_target) != 0) 962 if ((aggregateScriptEvents & scriptEvents.at_target) != 0)
1040 { 963 {
1041 m_scriptListens_atTarget = true; 964 m_scriptListens_atTarget = true;
1042 } 965 }
@@ -1045,7 +968,7 @@ namespace OpenSim.Region.Environment.Scenes
1045 m_scriptListens_atTarget = false; 968 m_scriptListens_atTarget = false;
1046 } 969 }
1047 970
1048 if ((m_aggregateScriptEvents & scriptEvents.not_at_target) != 0) 971 if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0)
1049 { 972 {
1050 m_scriptListens_notAtTarget = true; 973 m_scriptListens_notAtTarget = true;
1051 } 974 }
@@ -1082,12 +1005,12 @@ namespace OpenSim.Region.Environment.Scenes
1082 { 1005 {
1083 if (m_parts.Count > 1) 1006 if (m_parts.Count > 1)
1084 { 1007 {
1085 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); 1008 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim);
1086 foreach (SceneObjectPart part in m_parts.Values) 1009 foreach (SceneObjectPart part in m_parts.Values)
1087 { 1010 {
1088 if (part.LocalId != m_rootPart.LocalId) 1011 if (part.LocalId != m_rootPart.LocalId)
1089 { 1012 {
1090 part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); 1013 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim);
1091 } 1014 }
1092 // Hack to get the physics scene geometries in the right spot 1015 // Hack to get the physics scene geometries in the right spot
1093 ResetChildPrimPhysicsPositions(); 1016 ResetChildPrimPhysicsPositions();
@@ -1095,7 +1018,7 @@ namespace OpenSim.Region.Environment.Scenes
1095 } 1018 }
1096 else 1019 else
1097 { 1020 {
1098 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); 1021 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim);
1099 } 1022 }
1100 } 1023 }
1101 } 1024 }
@@ -1333,7 +1256,7 @@ namespace OpenSim.Region.Environment.Scenes
1333 else 1256 else
1334 { 1257 {
1335 part.RemFlag(LLObject.ObjectFlags.Phantom); 1258 part.RemFlag(LLObject.ObjectFlags.Phantom);
1336 if ((part.ObjectFlags & (int) LLObject.ObjectFlags.Physics) != 0) 1259 if ((part.GetEffectiveObjectFlags() & (int) LLObject.ObjectFlags.Physics) != 0)
1337 { 1260 {
1338 part.DoPhysicsPropertyUpdate(true, false); 1261 part.DoPhysicsPropertyUpdate(true, false);
1339 } 1262 }