aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-07 22:57:32 +0000
committerJustin Clarke Casey2008-11-07 22:57:32 +0000
commitbf9384d5943e755df9bbfce793c0cd89252e4044 (patch)
tree4aa927cb3fe4f86ab93d4fdb91e5fdee83031c18
parent* Fix bug in r7162 where avatars could not move (diff)
downloadopensim-SC_OLD-bf9384d5943e755df9bbfce793c0cd89252e4044.zip
opensim-SC_OLD-bf9384d5943e755df9bbfce793c0cd89252e4044.tar.gz
opensim-SC_OLD-bf9384d5943e755df9bbfce793c0cd89252e4044.tar.bz2
opensim-SC_OLD-bf9384d5943e755df9bbfce793c0cd89252e4044.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2582
* Send prim flags as booleans from LLClientView rather than in the native LL array * Thanks idb
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs43
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs52
5 files changed, 41 insertions, 67 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e0823b2..4759761 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Framework
113 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); 113 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
114 public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); 114 public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
115 115
116 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); 116 public delegate void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient);
117 117
118 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); 118 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
119 119
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 1a0fb29..d0f057e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4690,7 +4690,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4690 4690
4691 if (handlerUpdatePrimFlags != null) 4691 if (handlerUpdatePrimFlags != null)
4692 { 4692 {
4693 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 4693 byte[] data = Pack.ToBytes();
4694 int i = 46;
4695 bool UsePhysics = (data[i++] != 0) ? true : false;
4696 bool IsTemporary = (data[i++] != 0) ? true : false;
4697 bool IsPhantom = (data[i++] != 0) ? true : false;
4698 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
4694 } 4699 }
4695 break; 4700 break;
4696 case PacketType.ObjectImage: 4701 case PacketType.ObjectImage:
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 2f7ca21..0b24ce9 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1194,14 +1194,14 @@ namespace OpenSim.Region.Environment.Scenes
1194 /// <param name="localID"></param> 1194 /// <param name="localID"></param>
1195 /// <param name="packet"></param> 1195 /// <param name="packet"></param>
1196 /// <param name="remoteClient"></param> 1196 /// <param name="remoteClient"></param>
1197 protected internal void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 1197 protected internal void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient)
1198 { 1198 {
1199 SceneObjectGroup group = GetGroupByPrim(localID); 1199 SceneObjectGroup group = GetGroupByPrim(localID);
1200 if (group != null) 1200 if (group != null)
1201 { 1201 {
1202 if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) 1202 if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId))
1203 { 1203 {
1204 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); 1204 group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom);
1205 } 1205 }
1206 } 1206 }
1207 } 1207 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 949ac3d..b428269 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1407,34 +1407,23 @@ namespace OpenSim.Region.Environment.Scenes
1407 1407
1408 public void ScriptSetPhysicsStatus(bool UsePhysics) 1408 public void ScriptSetPhysicsStatus(bool UsePhysics)
1409 { 1409 {
1410 if (m_scene.m_physicalPrim) 1410 bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
1411 { 1411 bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
1412 lock (m_parts) 1412 UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom);
1413 { 1413 }
1414 foreach (SceneObjectPart part in m_parts.Values)
1415 {
1416 if (UsePhysics)
1417 part.AddFlag(PrimFlags.Physics);
1418 else
1419 part.RemFlag(PrimFlags.Physics);
1420 1414
1421 part.DoPhysicsPropertyUpdate(UsePhysics, false); 1415 public void ScriptSetTemporaryStatus(bool TemporaryStatus)
1422 IsSelected = false; 1416 {
1423 } 1417 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
1424 } 1418 bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
1425 } 1419 UpdatePrimFlags(RootPart.LocalId, UsePhysics, TemporaryStatus, IsPhantom);
1426 } 1420 }
1427 1421
1428 public void ScriptSetPhantomStatus(bool PhantomStatus) 1422 public void ScriptSetPhantomStatus(bool PhantomStatus)
1429 { 1423 {
1430 byte[] flags = new byte[50]; 1424 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
1431 // only the following 3 flags are updated by UpdatePrimFlags 1425 bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
1432 flags[46] = (byte)((RootPart.Flags & PrimFlags.Physics) != 0 ? 1 : 0); 1426 UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus);
1433 flags[47] = (byte)((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0 ? 1 : 0);
1434 flags[48] = (byte)(PhantomStatus ? 1 : 0);
1435 // 94 is the packet type that comes from the ll viewer when selecting/unselecting
1436 // so pretend we are from the viewer
1437 UpdatePrimFlags(RootPart.LocalId, (ushort)94, true, flags);
1438 } 1427 }
1439 1428
1440 public void applyImpulse(PhysicsVector impulse) 1429 public void applyImpulse(PhysicsVector impulse)
@@ -2160,11 +2149,11 @@ namespace OpenSim.Region.Environment.Scenes
2160 /// <param name="type"></param> 2149 /// <param name="type"></param>
2161 /// <param name="inUse"></param> 2150 /// <param name="inUse"></param>
2162 /// <param name="data"></param> 2151 /// <param name="data"></param>
2163 public void UpdatePrimFlags(uint localID, ushort type, bool inUse, byte[] data) 2152 public void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom)
2164 { 2153 {
2165 SceneObjectPart selectionPart = GetChildPart(localID); 2154 SceneObjectPart selectionPart = GetChildPart(localID);
2166 2155
2167 if (data[47] != 0) // Temporary 2156 if (IsTemporary)
2168 { 2157 {
2169 DetachFromBackup(); 2158 DetachFromBackup();
2170 // Remove from database and parcel prim count 2159 // Remove from database and parcel prim count
@@ -2181,14 +2170,14 @@ namespace OpenSim.Region.Environment.Scenes
2181 { 2170 {
2182 if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0) 2171 if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
2183 { 2172 {
2184 data[46] = 0; // Reset physics 2173 UsePhysics = false; // Reset physics
2185 break; 2174 break;
2186 } 2175 }
2187 } 2176 }
2188 2177
2189 foreach (SceneObjectPart part in m_parts.Values) 2178 foreach (SceneObjectPart part in m_parts.Values)
2190 { 2179 {
2191 part.UpdatePrimFlags(type, inUse, data); 2180 part.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom);
2192 } 2181 }
2193 } 2182 }
2194 } 2183 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index d2c4253..bdeaa6f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -2031,6 +2031,14 @@ if (m_shape != null) {
2031 } 2031 }
2032 } 2032 }
2033 2033
2034 public void ScriptSetTemporaryStatus(bool Temporary)
2035 {
2036 if (m_parentGroup != null)
2037 {
2038 m_parentGroup.ScriptSetTemporaryStatus(Temporary);
2039 }
2040 }
2041
2034 public void ScriptSetPhysicsStatus(bool UsePhysics) 2042 public void ScriptSetPhysicsStatus(bool UsePhysics)
2035 { 2043 {
2036 if (m_parentGroup == null) 2044 if (m_parentGroup == null)
@@ -3046,45 +3054,17 @@ if (m_shape != null) {
3046 } 3054 }
3047 } 3055 }
3048 3056
3049 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) 3057 public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom)
3050 { 3058 {
3051 //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1));
3052 //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2));
3053 //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3));
3054 //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4));
3055 //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5));
3056 //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6));
3057 3059
3058 bool usePhysics = false;
3059 bool IsTemporary = false;
3060 bool IsPhantom = false;
3061 // bool castsShadows = false;
3062 bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0); 3060 bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0);
3063 //bool IsLocked = false;
3064 int i = 0;
3065 3061
3066 try 3062 if (UsePhysics)
3067 {
3068 i += 46;
3069 //IsLocked = (data[i++] != 0) ? true : false;
3070 usePhysics = ((data[i++] != 0) && m_parentGroup.Scene.m_physicalPrim) ? true : false;
3071 //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
3072 IsTemporary = (data[i++] != 0) ? true : false;
3073 IsPhantom = (data[i++] != 0) ? true : false;
3074 // castsShadows = (data[i++] != 0) ? true : false;
3075 }
3076 catch (Exception)
3077 {
3078 Console.WriteLine("Ignoring invalid Packet:");
3079 //Silently ignore it - TODO: FIXME Quick
3080 }
3081
3082 if (usePhysics)
3083 { 3063 {
3084 AddFlag(PrimFlags.Physics); 3064 AddFlag(PrimFlags.Physics);
3085 if (!wasUsingPhysics) 3065 if (!wasUsingPhysics)
3086 { 3066 {
3087 DoPhysicsPropertyUpdate(usePhysics, false); 3067 DoPhysicsPropertyUpdate(UsePhysics, false);
3088 if (m_parentGroup != null) 3068 if (m_parentGroup != null)
3089 { 3069 {
3090 if (m_parentGroup.RootPart != null) 3070 if (m_parentGroup.RootPart != null)
@@ -3102,7 +3082,7 @@ if (m_shape != null) {
3102 RemFlag(PrimFlags.Physics); 3082 RemFlag(PrimFlags.Physics);
3103 if (wasUsingPhysics) 3083 if (wasUsingPhysics)
3104 { 3084 {
3105 DoPhysicsPropertyUpdate(usePhysics, false); 3085 DoPhysicsPropertyUpdate(UsePhysics, false);
3106 } 3086 }
3107 } 3087 }
3108 3088
@@ -3127,12 +3107,12 @@ if (m_shape != null) {
3127 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z), 3107 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
3128 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 3108 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
3129 RotationOffset, 3109 RotationOffset,
3130 usePhysics); 3110 UsePhysics);
3131 3111
3132 if (PhysActor != null) 3112 if (PhysActor != null)
3133 { 3113 {
3134 PhysActor.LocalID = LocalId; 3114 PhysActor.LocalID = LocalId;
3135 DoPhysicsPropertyUpdate(usePhysics, true); 3115 DoPhysicsPropertyUpdate(UsePhysics, true);
3136 if (m_parentGroup != null) 3116 if (m_parentGroup != null)
3137 { 3117 {
3138 if (m_parentGroup.RootPart != null) 3118 if (m_parentGroup.RootPart != null)
@@ -3147,8 +3127,8 @@ if (m_shape != null) {
3147 } 3127 }
3148 else 3128 else
3149 { 3129 {
3150 PhysActor.IsPhysical = usePhysics; 3130 PhysActor.IsPhysical = UsePhysics;
3151 DoPhysicsPropertyUpdate(usePhysics, false); 3131 DoPhysicsPropertyUpdate(UsePhysics, false);
3152 if (m_parentGroup != null) 3132 if (m_parentGroup != null)
3153 { 3133 {
3154 if (m_parentGroup.RootPart != null) 3134 if (m_parentGroup.RootPart != null)