aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJonathan Freedman2010-11-05 19:10:02 -0700
committerJonathan Freedman2010-11-05 19:10:02 -0700
commit4f40374464899dad82abdb9c36ea863ceac0d83f (patch)
treea9b116ccca55fb07b8c79ab7f6fdfafc8466d740 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into mantis5110 (diff)
parentMerge branch 'master' of /var/git/opensim/ (diff)
downloadopensim-SC_OLD-4f40374464899dad82abdb9c36ea863ceac0d83f.zip
opensim-SC_OLD-4f40374464899dad82abdb9c36ea863ceac0d83f.tar.gz
opensim-SC_OLD-4f40374464899dad82abdb9c36ea863ceac0d83f.tar.bz2
opensim-SC_OLD-4f40374464899dad82abdb9c36ea863ceac0d83f.tar.xz
Merge git://github.com/opensim/opensim into mantis5110
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs63
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs20
3 files changed, 52 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7a6449d..f164201 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3100,6 +3100,7 @@ namespace OpenSim.Region.Framework.Scenes
3100 UUID ownerID = _ownerID; 3100 UUID ownerID = _ownerID;
3101 UUID objectID = ParentGroup.RootPart.UUID; 3101 UUID objectID = ParentGroup.RootPart.UUID;
3102 UUID parentID = GetRootPartUUID(); 3102 UUID parentID = GetRootPartUUID();
3103
3103 UUID soundID = UUID.Zero; 3104 UUID soundID = UUID.Zero;
3104 Vector3 position = AbsolutePosition; // region local 3105 Vector3 position = AbsolutePosition; // region local
3105 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; 3106 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0390414..fe9dc56 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -171,9 +171,6 @@ namespace OpenSim.Region.Framework.Scenes
171 171
172 private float m_health = 100f; 172 private float m_health = 100f;
173 173
174 // Default AV Height
175 private float m_avHeight = 127.0f;
176
177 protected RegionInfo m_regionInfo; 174 protected RegionInfo m_regionInfo;
178 protected ulong crossingFromRegion; 175 protected ulong crossingFromRegion;
179 176
@@ -841,9 +838,10 @@ namespace OpenSim.Region.Framework.Scenes
841 } 838 }
842 839
843 float localAVHeight = 1.56f; 840 float localAVHeight = 1.56f;
844 if (m_avHeight != 127.0f) 841 if (m_appearance != null)
845 { 842 {
846 localAVHeight = m_avHeight; 843 if (m_appearance.AvatarHeight > 0)
844 localAVHeight = m_appearance.AvatarHeight;
847 } 845 }
848 846
849 float posZLimit = 0; 847 float posZLimit = 0;
@@ -872,6 +870,12 @@ namespace OpenSim.Region.Framework.Scenes
872 870
873 AddToPhysicalScene(isFlying); 871 AddToPhysicalScene(isFlying);
874 872
873 if (m_appearance != null)
874 {
875 if (m_appearance.AvatarHeight > 0)
876 SetHeight(m_appearance.AvatarHeight);
877 }
878
875 if (m_forceFly) 879 if (m_forceFly)
876 { 880 {
877 m_physicsActor.Flying = true; 881 m_physicsActor.Flying = true;
@@ -1060,10 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes
1060 /// </summary> 1064 /// </summary>
1061 public void SetHeight(float height) 1065 public void SetHeight(float height)
1062 { 1066 {
1063 m_avHeight = height;
1064 if (PhysicsActor != null && !IsChildAgent) 1067 if (PhysicsActor != null && !IsChildAgent)
1065 { 1068 {
1066 Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight); 1069 Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
1067 PhysicsActor.Size = SetSize; 1070 PhysicsActor.Size = SetSize;
1068 } 1071 }
1069 } 1072 }
@@ -1687,9 +1690,10 @@ namespace OpenSim.Region.Framework.Scenes
1687 m_parentID = 0; 1690 m_parentID = 0;
1688 SendFullUpdateToAllClients(); 1691 SendFullUpdateToAllClients();
1689 m_requestedSitTargetID = 0; 1692 m_requestedSitTargetID = 0;
1690 if ((m_physicsActor != null) && (m_avHeight > 0)) 1693 if (m_physicsActor != null && m_appearance != null)
1691 { 1694 {
1692 SetHeight(m_avHeight); 1695 if (m_appearance.AvatarHeight > 0)
1696 SetHeight(m_appearance.AvatarHeight);
1693 } 1697 }
1694 } 1698 }
1695 1699
@@ -2391,11 +2395,14 @@ namespace OpenSim.Region.Framework.Scenes
2391 if (m_appearance.Texture == null) 2395 if (m_appearance.Texture == null)
2392 return; 2396 return;
2393 2397
2394 if (LocalId == remoteAvatar.LocalId) 2398// MT: This is needed for sit. It's legal to send it to oneself, and the name
2395 { 2399// of the method is a misnomer
2396 m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); 2400//
2397 return; 2401// if (LocalId == remoteAvatar.LocalId)
2398 } 2402// {
2403// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID);
2404// return;
2405// }
2399 2406
2400 if (IsChildAgent) 2407 if (IsChildAgent)
2401 { 2408 {
@@ -2576,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes
2576 cadu.ActiveGroupID = UUID.Zero.Guid; 2583 cadu.ActiveGroupID = UUID.Zero.Guid;
2577 cadu.AgentID = UUID.Guid; 2584 cadu.AgentID = UUID.Guid;
2578 cadu.alwaysrun = m_setAlwaysRun; 2585 cadu.alwaysrun = m_setAlwaysRun;
2579 cadu.AVHeight = m_avHeight; 2586 cadu.AVHeight = m_appearance.AvatarHeight;
2580 Vector3 tempCameraCenter = m_CameraCenter; 2587 Vector3 tempCameraCenter = m_CameraCenter;
2581 cadu.cameraPosition = tempCameraCenter; 2588 cadu.cameraPosition = tempCameraCenter;
2582 cadu.drawdistance = m_DrawDistance; 2589 cadu.drawdistance = m_DrawDistance;
@@ -2912,7 +2919,6 @@ namespace OpenSim.Region.Framework.Scenes
2912 2919
2913 m_CameraCenter = cAgentData.Center + offset; 2920 m_CameraCenter = cAgentData.Center + offset;
2914 2921
2915 m_avHeight = cAgentData.Size.Z;
2916 //SetHeight(cAgentData.AVHeight); 2922 //SetHeight(cAgentData.AVHeight);
2917 2923
2918 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 2924 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
@@ -2937,8 +2943,6 @@ namespace OpenSim.Region.Framework.Scenes
2937 cAgent.Position = AbsolutePosition; 2943 cAgent.Position = AbsolutePosition;
2938 cAgent.Velocity = m_velocity; 2944 cAgent.Velocity = m_velocity;
2939 cAgent.Center = m_CameraCenter; 2945 cAgent.Center = m_CameraCenter;
2940 // Don't copy the size; it is inferred from apearance parameters
2941 //cAgent.Size = new Vector3(0, 0, m_avHeight);
2942 cAgent.AtAxis = m_CameraAtAxis; 2946 cAgent.AtAxis = m_CameraAtAxis;
2943 cAgent.LeftAxis = m_CameraLeftAxis; 2947 cAgent.LeftAxis = m_CameraLeftAxis;
2944 cAgent.UpAxis = m_CameraUpAxis; 2948 cAgent.UpAxis = m_CameraUpAxis;
@@ -3056,7 +3060,6 @@ namespace OpenSim.Region.Framework.Scenes
3056 m_pos = cAgent.Position; 3060 m_pos = cAgent.Position;
3057 m_velocity = cAgent.Velocity; 3061 m_velocity = cAgent.Velocity;
3058 m_CameraCenter = cAgent.Center; 3062 m_CameraCenter = cAgent.Center;
3059 //m_avHeight = cAgent.Size.Z;
3060 m_CameraAtAxis = cAgent.AtAxis; 3063 m_CameraAtAxis = cAgent.AtAxis;
3061 m_CameraLeftAxis = cAgent.LeftAxis; 3064 m_CameraLeftAxis = cAgent.LeftAxis;
3062 m_CameraUpAxis = cAgent.UpAxis; 3065 m_CameraUpAxis = cAgent.UpAxis;
@@ -3075,6 +3078,12 @@ namespace OpenSim.Region.Framework.Scenes
3075 m_setAlwaysRun = cAgent.AlwaysRun; 3078 m_setAlwaysRun = cAgent.AlwaysRun;
3076 3079
3077 m_appearance = new AvatarAppearance(cAgent.Appearance); 3080 m_appearance = new AvatarAppearance(cAgent.Appearance);
3081 if (m_physicsActor != null)
3082 {
3083 bool isFlying = m_physicsActor.Flying;
3084 RemoveFromPhysicalScene();
3085 AddToPhysicalScene(isFlying);
3086 }
3078 3087
3079/* 3088/*
3080 uint i = 0; 3089 uint i = 0;
@@ -3184,21 +3193,17 @@ namespace OpenSim.Region.Framework.Scenes
3184 /// </summary> 3193 /// </summary>
3185 public void AddToPhysicalScene(bool isFlying) 3194 public void AddToPhysicalScene(bool isFlying)
3186 { 3195 {
3196 if (m_appearance.AvatarHeight == 0)
3197 m_appearance.SetHeight();
3198
3187 PhysicsScene scene = m_scene.PhysicsScene; 3199 PhysicsScene scene = m_scene.PhysicsScene;
3188 3200
3189 Vector3 pVec = AbsolutePosition; 3201 Vector3 pVec = AbsolutePosition;
3190 3202
3191 // Old bug where the height was in centimeters instead of meters 3203 // Old bug where the height was in centimeters instead of meters
3192 if (m_avHeight == 127.0f) 3204 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3193 { 3205 new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying);
3194 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f), 3206
3195 isFlying);
3196 }
3197 else
3198 {
3199 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3200 new Vector3(0f, 0f, m_avHeight), isFlying);
3201 }
3202 scene.AddPhysicsActorTaint(m_physicsActor); 3207 scene.AddPhysicsActorTaint(m_physicsActor);
3203 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3208 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3204 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3209 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e661ca9..7f37878 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); 1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); 1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
1138 writer.WriteElementString("Flags", sop.Flags.ToString()); 1138 WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); 1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1141 if (sop.MediaUrl != null) 1141 if (sop.MediaUrl != null)
@@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1188 1188
1189 } 1189 }
1190 1190
1191 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1192 {
1193 // Older versions of serialization can't cope with commas
1194 if (options.ContainsKey("version"))
1195 {
1196 float version = 0.5F;
1197 float.TryParse(options["version"].ToString(), out version);
1198 if (version < 0.5)
1199 flagsStr = flagsStr.Replace(",", "");
1200 }
1201
1202 writer.WriteElementString(name, flagsStr);
1203 }
1204
1191 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) 1205 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
1192 { 1206 {
1193 if (tinv.Count > 0) // otherwise skip this 1207 if (tinv.Count > 0) // otherwise skip this
@@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1275 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1289 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1276 writer.WriteElementString("State", shp.State.ToString()); 1290 writer.WriteElementString("State", shp.State.ToString());
1277 1291
1278 writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); 1292 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1279 writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); 1293 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
1280 1294
1281 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1295 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1282 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1296 writer.WriteElementString("SculptType", shp.SculptType.ToString());