From ec6f87d3eff699ca28214629d360c15e5df13156 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Jan 2018 23:51:43 +0000 Subject: disable some XmlResolver --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 +++-- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +- .../Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | 1 + .../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 1 + 6 files changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f29cdf4..71c8807 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2420,6 +2420,7 @@ namespace OpenSim.Region.Framework.Scenes else { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xmlData); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); XmlElement coll = (XmlElement)e; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index bf217a5..c20c81d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -505,6 +505,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (KeyValuePair state in states) { XmlDocument sdoc = new XmlDocument(); + sdoc.XmlResolver=null; sdoc.LoadXml(state.Value); XmlNodeList rootL = sdoc.GetElementsByTagName("State"); XmlNode rootNode = rootL[0]; @@ -540,6 +541,7 @@ namespace OpenSim.Region.Framework.Scenes return; XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; try { doc.LoadXml(objXMLData); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3380191..21311b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1994,6 +1994,7 @@ namespace OpenSim.Region.Framework.Scenes public void SaveScriptedState(XmlTextWriter writer, bool oldIDs) { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; Dictionary states = new Dictionary(); SceneObjectPart[] parts = m_parts.GetArray(); @@ -2782,7 +2783,7 @@ namespace OpenSim.Region.Framework.Scenes return RootPart.Torque; } - // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object + // This is used by llMoveToTarget() in an attached object public void MoveToTarget(Vector3 target, float tau) { if (IsAttachment) @@ -2790,7 +2791,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); if (avatar != null) - avatar.MoveToTarget(target, false, false); + avatar.MoveToTarget(target, false, false, tau); } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index de9d986..30f7151 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -455,7 +455,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID)) { XmlDocument doc = new XmlDocument(); - + doc.XmlResolver=null; doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); ////////// CRUFT WARNING /////////////////////////////////// diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 41f3ef4..a93782e 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -147,6 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xml); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); if (e == null) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 82bbe6f..948c345 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -255,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization try { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xmlData); XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); -- cgit v1.1 From ce0aa53cc43a99ee9bb82cd912758629d278d46e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Jan 2018 23:59:47 +0000 Subject: let tau do something in avatar MoveToTarget --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 296 +++++++++++++---------- 1 file changed, 163 insertions(+), 133 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6bce406..e10e787 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -101,7 +101,8 @@ namespace OpenSim.Region.Framework.Scenes public bool IsGod { get; set; } private PresenceType m_presenceType; - public PresenceType PresenceType { + public PresenceType PresenceType + { get {return m_presenceType;} private set { @@ -368,8 +369,28 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_headrotation = Quaternion.Identity; //PauPaw:Proper PID Controler for autopilot************ - public bool MovingToTarget { get; private set; } - public Vector3 MoveToPositionTarget { get; private set; } + + private bool m_movingToTarget; + public bool MovingToTarget + { + get {return m_movingToTarget;} + private set {m_movingToTarget = value; } + } + + private Vector3 m_moveToPositionTarget; + public Vector3 MoveToPositionTarget + { + get {return m_moveToPositionTarget;} + private set {m_moveToPositionTarget = value; } + } + + private float m_moveToSpeed; + public float MoveToSpeed + { + get {return m_moveToSpeed;} + private set {m_moveToSpeed = value; } + } + private double m_delayedStop = -1.0; /// @@ -1160,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnStopAnim += HandleStopAnim; ControllingClient.OnChangeAnim += avnHandleChangeAnim; ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; - ControllingClient.OnAutoPilotGo += MoveToTarget; + ControllingClient.OnAutoPilotGo += MoveToTargetHandle; ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; // ControllingClient.OnAgentFOV += HandleAgentFOV; @@ -1180,7 +1201,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnStopAnim -= HandleStopAnim; ControllingClient.OnChangeAnim -= avnHandleChangeAnim; ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; - ControllingClient.OnAutoPilotGo -= MoveToTarget; + ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; // ControllingClient.OnAgentFOV += HandleAgentFOV; } @@ -2587,11 +2608,12 @@ namespace OpenSim.Region.Framework.Scenes } bool update_movementflag = false; - bool mvToTarget = MovingToTarget; + bool mvToTarget = m_movingToTarget; if (agentData.UseClientAgentPosition) { - MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f; - MoveToPositionTarget = agentData.ClientAgentPosition; + m_movingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f; + m_moveToPositionTarget = agentData.ClientAgentPosition; + m_moveToSpeed = -1f; } int i = 0; @@ -2686,7 +2708,7 @@ namespace OpenSim.Region.Framework.Scenes update_movementflag = true; } - if (MovingToTarget) + if (m_movingToTarget) { // If the user has pressed a key then we want to cancel any move to target. if (DCFlagKeyPressed) @@ -2787,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - if(MovingToTarget || + if(m_movingToTarget || (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying && Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface) ) @@ -2878,7 +2900,7 @@ namespace OpenSim.Region.Framework.Scenes bool updated = false; - Vector3 LocalVectorToTarget3D = MoveToPositionTarget - AbsolutePosition; + Vector3 LocalVectorToTarget3D = m_moveToPositionTarget - AbsolutePosition; // m_log.DebugFormat( // "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}", @@ -2891,9 +2913,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - Vector3 hdist = LocalVectorToTarget3D; - hdist.Z = 0; - distanceToTarget = hdist.Length(); + distanceToTarget = (float)Math.Sqrt(LocalVectorToTarget3D.X * LocalVectorToTarget3D.X + + LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y); } // m_log.DebugFormat( @@ -2905,128 +2926,126 @@ namespace OpenSim.Region.Framework.Scenes { // We are close enough to the target Velocity = Vector3.Zero; - AbsolutePosition = MoveToPositionTarget; + AbsolutePosition = m_moveToPositionTarget; if (Flying) { - if (LandAtTarget) - Flying = false; + if (LandAtTarget) + Flying = false; // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot // the target if flying. // We really need to be more subtle (slow the avatar as it approaches the target) or at // least be able to set collision status once, rather than 5 times to give it enough // weighting so that that PhysicsActor thinks it really is colliding. - for (int i = 0; i < 5; i++) - IsColliding = true; + for (int i = 0; i < 5; i++) + IsColliding = true; } ResetMoveToTarget(); return false; } - else - { - try - { - // move avatar in 3D at one meter/second towards target, in avatar coordinate frame. - // This movement vector gets added to the velocity through AddNewMovement(). - // Theoretically we might need a more complex PID approach here if other - // unknown forces are acting on the avatar and we need to adaptively respond - // to such forces, but the following simple approach seems to works fine. - - LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(Rotation); // change to avatar coords - LocalVectorToTarget3D.Normalize(); - - // update avatar movement flags. the avatar coordinate system is as follows: - // - // +X (forward) - // - // ^ - // | - // | - // | - // | - // (left) +Y <--------o--------> -Y - // avatar - // | - // | - // | - // | - // v - // -X - // - - // based on the above avatar coordinate system, classify the movement into - // one of left/right/back/forward. - - const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK | - Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT | - Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP | - Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)); - - MovementFlag &= noMovFlagsMask; - uint tmpAgentControlFlags = (uint)m_AgentControlFlags; - tmpAgentControlFlags &= noMovFlagsMask; - - if (LocalVectorToTarget3D.X < 0) //MoveBack - { - MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; - tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; - updated = true; - } - else if (LocalVectorToTarget3D.X > 0) //Move Forward - { - MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; - tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; - updated = true; - } - - if (LocalVectorToTarget3D.Y > 0) //MoveLeft - { - MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; - tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; - updated = true; - } - else if (LocalVectorToTarget3D.Y < 0) //MoveRight - { - MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; - tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; - updated = true; - } - - if (LocalVectorToTarget3D.Z > 0) //Up - { - // Don't set these flags for up or down - doing so will make the avatar crouch or - // keep trying to jump even if walking along level ground - //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; - //AgentControlFlags - //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; - updated = true; - } - else if (LocalVectorToTarget3D.Z < 0) //Down - { - //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; - //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; - updated = true; - } + if(m_moveToSpeed > 0 && distanceToTarget <= m_moveToSpeed * Scene.FrameTime) + m_moveToSpeed = distanceToTarget / Scene.FrameTime; + try + { + // move avatar in 3D towards target, in avatar coordinate frame. + // This movement vector gets added to the velocity through AddNewMovement(). + // Theoretically we might need a more complex PID approach here if other + // unknown forces are acting on the avatar and we need to adaptively respond + // to such forces, but the following simple approach seems to works fine. + + float angle = 0.5f * (float)Math.Atan2(LocalVectorToTarget3D.Y, LocalVectorToTarget3D.X); + Quaternion rot = new Quaternion(0,0, (float)Math.Sin(angle),(float)Math.Cos(angle)); + Rotation = rot; + LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(rot); // change to avatar coords + LocalVectorToTarget3D.Normalize(); + + // update avatar movement flags. the avatar coordinate system is as follows: + // + // +X (forward) + // + // ^ + // | + // | + // | + // | + // (left) +Y <--------o--------> -Y + // avatar + // | + // | + // | + // | + // v + // -X + // + + // based on the above avatar coordinate system, classify the movement into + // one of left/right/back/forward. + + const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK | + Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT | + Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP | + Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)); + + MovementFlag &= noMovFlagsMask; + uint tmpAgentControlFlags = (uint)m_AgentControlFlags; + tmpAgentControlFlags &= noMovFlagsMask; + + if (LocalVectorToTarget3D.X < 0) //MoveBack + { + MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; + tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; + updated = true; + } + else if (LocalVectorToTarget3D.X > 0) //Move Forward + { + MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; + tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; + updated = true; + } + + if (LocalVectorToTarget3D.Y > 0) //MoveLeft + { + MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; + tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; + updated = true; + } + else if (LocalVectorToTarget3D.Y < 0) //MoveRight + { + MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; + tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; + updated = true; + } + + if (LocalVectorToTarget3D.Z > 0) //Up + updated = true; + + else if (LocalVectorToTarget3D.Z < 0) //Down + updated = true; + // m_log.DebugFormat( // "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", // LocalVectorToTarget3D, agent_control_v3, Name); - m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags; + m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags; + if(updated) agent_control_v3 += LocalVectorToTarget3D; - } - catch (Exception e) - { - //Avoid system crash, can be slower but... - m_log.DebugFormat("Crash! {0}", e.ToString()); - } + } + catch (Exception e) + { + //Avoid system crash, can be slower but... + m_log.DebugFormat("Crash! {0}", e.ToString()); } return updated; // AddNewMovement(agent_control_v3); } + public void MoveToTargetHandle(Vector3 pos, bool noFly, bool landAtTarget) + { + MoveToTarget(pos, noFly, landAtTarget); + } /// /// Move to the given target over time. /// @@ -3039,8 +3058,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// If true and the avatar starts flying during the move then land at the target. /// - public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) - { + public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget, float tau = -1f) + { m_delayedStop = -1; if (SitGround) @@ -3073,30 +3092,36 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); + terrainHeight += Appearance.AvatarHeight; // so 1.5 * AvatarHeight above ground at target bool shouldfly = Flying; if (noFly) shouldfly = false; else if (pos.Z > terrainHeight || Flying) shouldfly = true; - LandAtTarget = landAtTarget; - MovingToTarget = true; - MoveToPositionTarget = pos; - Flying = shouldfly; - - // Rotate presence around the z-axis to point in same direction as movement. - // Ignore z component of vector Vector3 localVectorToTarget3D = pos - AbsolutePosition; // m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y); + + m_movingToTarget = true; + LandAtTarget = landAtTarget; + m_moveToPositionTarget = pos; + if(tau > 0) + { + if(tau < Scene.FrameTime) + tau = Scene.FrameTime; + m_moveToSpeed = localVectorToTarget3D.Length() / tau; + if(m_moveToSpeed < 0.5f) //to tune + m_moveToSpeed = 0.5f; + else if(m_moveToSpeed > 50f) + m_moveToSpeed = 50f; - // Calculate the yaw. - Vector3 angle = new Vector3(0, 0, (float)(Math.Atan2(localVectorToTarget3D.Y, localVectorToTarget3D.X))); - -// m_log.DebugFormat("[SCENE PRESENCE]: Angle is {0}", angle); + SetAlwaysRun = false; + } + else + m_moveToSpeed = 4.096f * m_speedModifier; - Rotation = Quaternion.CreateFromEulers(angle); -// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); + Flying = shouldfly; Vector3 control = Vector3.Zero; if(HandleMoveToTargetUpdate(1f, ref control)) @@ -3110,7 +3135,8 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); - MovingToTarget = false; + m_movingToTarget = false; + m_moveToSpeed = -1f; // MoveToPositionTarget = Vector3.Zero; // lock(m_forceToApplyLock) // m_forceToApplyValid = false; // cancel possible last action @@ -3294,7 +3320,7 @@ namespace OpenSim.Region.Framework.Scenes RemoveFromPhysicalScene(); } - if (MovingToTarget) + if (m_movingToTarget) ResetMoveToTarget(); Velocity = Vector3.Zero; @@ -3436,7 +3462,7 @@ namespace OpenSim.Region.Framework.Scenes RemoveFromPhysicalScene(); - if (MovingToTarget) + if (m_movingToTarget) ResetMoveToTarget(); Velocity = Vector3.Zero; @@ -3716,8 +3742,12 @@ namespace OpenSim.Region.Framework.Scenes if ((vec.Z == 0f) && !Flying) direc.Z = 0f; // Prevent camera WASD up. + bool notmvtrgt = !m_movingToTarget || m_moveToSpeed <= 0; // odd rescalings - direc *= 0.032f * 128f * SpeedModifier * thisAddSpeedModifier; + if(notmvtrgt) + direc *= 4.096f * SpeedModifier * thisAddSpeedModifier; + else + direc *= m_moveToSpeed; // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); @@ -3735,12 +3765,12 @@ namespace OpenSim.Region.Framework.Scenes // landing situation, prevent avatar moving or it may fail to land // animator will handle this condition and do the land direc = Vector3.Zero; - else + else if(notmvtrgt) direc *= 4.0f; } else if (IsColliding) { - if (direc.Z > 2.0f) // reinforce jumps + if (direc.Z > 2.0f && notmvtrgt) // reinforce jumps { direc.Z *= 2.6f; } @@ -3780,7 +3810,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsInTransit || IsLoggingIn) return; - if(MovingToTarget) + if(m_movingToTarget) { m_delayedStop = -1; Vector3 control = Vector3.Zero; -- cgit v1.1 From 0b96cd56fc74de6508ac3d858dec5e5726bea80f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Jan 2018 00:30:00 +0000 Subject: don't be bad Jenkins.. --- OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index e5c847e..90c5197 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); - m_scene.Update(10); + m_scene.Update(50); double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); @@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); - m_scene.Update(10); + m_scene.Update(50); distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); -- cgit v1.1 From 89a690c11f8c7b6bbe0b6339e79a64d1ae428aec Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Jan 2018 12:24:07 +0000 Subject: a few more xml things --- .../Scenes/Animation/DefaultAvatarAnimations.cs | 4 +++ OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 2 ++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- .../CoalescedSceneObjectsSerializer.cs | 3 +++ .../Scenes/Serialization/SceneObjectSerializer.cs | 31 ++++++++++++++-------- .../Scenes/Serialization/SceneXmlLoader.cs | 13 ++++++--- OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 16 ++++++----- 7 files changed, 48 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs index b8db3a9..38ab934 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs @@ -58,7 +58,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation using (XmlTextReader reader = new XmlTextReader(path)) { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; XmlDocument doc = new XmlDocument(); + doc.XmlResolver = null; + doc.Load(reader); // if (doc.DocumentElement != null) // { diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 351eda3..22734b3 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs @@ -593,6 +593,8 @@ namespace OpenSim.Region.Framework.Scenes UTF8Encoding enc = new UTF8Encoding(); MemoryStream ms = new MemoryStream(enc.GetBytes(text)); XmlTextReader xreader = new XmlTextReader(ms); + xreader.DtdProcessing = DtdProcessing.Prohibit; + xreader.XmlResolver = null; SOPVehicle v = new SOPVehicle(); bool error; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 71c8807..84367df 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2389,7 +2389,7 @@ namespace OpenSim.Region.Framework.Scenes { using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) { - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) { reader.Read(); bool isSingleObject = reader.Name != "CoalescedObject"; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index a93782e..c3bc4a0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -133,6 +133,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { using (XmlTextReader reader = new XmlTextReader(sr)) { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; + reader.MoveToContent(); // skip possible xml declaration if (reader.Name != "CoalescedObject") diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 948c345..a2d512a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) { - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) { try { @@ -267,18 +267,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return null; } - StringReader sr = new StringReader(parts[0].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); - SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); - reader.Close(); - sr.Close(); + SceneObjectGroup sceneObject; + using(StringReader sr = new StringReader(parts[0].OuterXml)) + { + using(XmlTextReader reader = new XmlTextReader(sr)) + { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; + + sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); + } + } // Then deal with the rest + SceneObjectPart part; for (int i = 1; i < parts.Count; i++) { - sr = new StringReader(parts[i].OuterXml); - reader = new XmlTextReader(sr); - SceneObjectPart part = SceneObjectPart.FromXml(reader); + using(StringReader sr = new StringReader(parts[i].OuterXml)) + { + using(XmlTextReader reader = new XmlTextReader(sr)) + { + part = SceneObjectPart.FromXml(reader); + } + } int originalLinkNum = part.LinkNum; @@ -289,8 +300,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (originalLinkNum != 0) part.LinkNum = originalLinkNum; - reader.Close(); - sr.Close(); } XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 34fdb6d..977dd73 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -49,14 +49,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; XmlNode rootNode; if (fileName.StartsWith("http:") || File.Exists(fileName)) { - XmlTextReader reader = new XmlTextReader(fileName); - reader.WhitespaceHandling = WhitespaceHandling.None; - doc.Load(reader); - reader.Close(); + using(XmlTextReader reader = new XmlTextReader(fileName)) + { + reader.WhitespaceHandling = WhitespaceHandling.None; + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; + + doc.Load(reader); + } rootNode = doc.FirstChild; foreach (XmlNode aPrimNode in rootNode.ChildNodes) { diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 89d78cf..1beca04 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -196,13 +196,15 @@ namespace OpenSim.Region.Framework.Scenes // ITerrainChannel.LoadFromXmlString() public void LoadFromXmlString(string data) { - StringReader sr = new StringReader(data); - XmlTextReader reader = new XmlTextReader(sr); - reader.Read(); - - ReadXml(reader); - reader.Close(); - sr.Close(); + using(StringReader sr = new StringReader(data)) + { + using(XmlTextReader reader = new XmlTextReader(sr)) + { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; + ReadXml(reader); + } + } } // ITerrainChannel.Merge -- cgit v1.1