From 9ae26fc5afc96c793186b79e80ac8f1a8a040d5b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 16 Jul 2017 05:19:27 +0100 Subject: store kfm on inventory. this may still be a bit confusing on rez --- .../InventoryAccess/InventoryAccessModule.cs | 13 +++++++----- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 11 ++++++----- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- .../Region/Framework/Scenes/SceneObjectGroup.cs | 3 +++ .../Scenes/Serialization/SceneObjectSerializer.cs | 23 ++++++++++++++++++++++ 5 files changed, 42 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 3f3245c..f1409bb 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess Dictionary originalPositions = new Dictionary(); Dictionary originalRotations = new Dictionary(); // this possible is not needed if keyframes are saved - Dictionary originalKeyframes = new Dictionary(); +// Dictionary originalKeyframes = new Dictionary(); foreach (SceneObjectGroup objectGroup in objlist) { @@ -423,8 +423,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess objectGroup.RootPart.SetForce(Vector3.Zero); objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); - originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; - objectGroup.RootPart.KeyframeMotion = null; +// originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; +// objectGroup.RootPart.KeyframeMotion = null; Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition; originalPositions[objectGroup.UUID] = inventoryStoredPosition; @@ -476,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID]; - objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; +// objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; if (objectGroup.RootPart.KeyframeMotion != null) objectGroup.RootPart.KeyframeMotion.Resume(); } @@ -989,11 +989,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // one full update during the attachment // process causes some clients to fail to display the // attachment properly. - m_Scene.AddNewSceneObject(group, true, false); if (!attachment) { group.AbsolutePosition = pos + veclist[i]; + m_Scene.AddNewSceneObject(group, true, false); // Fire on_rez group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); @@ -1001,6 +1001,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess group.ScheduleGroupForFullUpdate(); } + else + m_Scene.AddNewSceneObject(group, true, false); + // m_log.DebugFormat( // "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 712ae01..c64a0f8 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -755,7 +755,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - bool lastSteps = remainingSteps < 4; +// bool lastSteps = remainingSteps < 4; + Vector3 currentPosition = m_group.AbsolutePosition; Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; motionThisFrame /= (float)remainingSteps; @@ -776,13 +777,13 @@ namespace OpenSim.Region.Framework.Scenes } m_group.AbsolutePosition = m_nextPosition; - if(lastSteps) - m_group.RootPart.Velocity = Vector3.Zero; - else +// if(lastSteps) +// m_group.RootPart.Velocity = Vector3.Zero; +// else m_group.RootPart.Velocity = m_currentVel; if(!update && ( - lastSteps || +// lastSteps || m_skippedUpdates * tickDuration > 0.5 || Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5e8487d..c06b3dd 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1651,10 +1651,11 @@ namespace OpenSim.Region.Framework.Scenes physicsMS2 = (float)(tmpMS2 - tmpMS); tmpMS = tmpMS2; +/* // Apply any pending avatar force input to the avatar's velocity if (Frame % m_update_entitymovement == 0) m_sceneGraph.UpdateScenePresenceMovement(); - +*/ if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations) { m_sendingCoarseLocations = true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6f46a92..19449b1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -657,6 +657,9 @@ namespace OpenSim.Region.Framework.Scenes } } + if(!m_scene.IsRunning) + return sog; + if (root.KeyframeMotion != null) root.KeyframeMotion.StartCrossingCheck(); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3d867a4..cdf275b 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -112,9 +112,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization while (reader.ReadToNextSibling("Part")); } + reader.ReadEndElement(); + + if (reader.Name == "KeyframeMotion" && reader.NodeType == XmlNodeType.Element) + { + + string innerkeytxt = reader.ReadElementContentAsString(); + sceneObject.RootPart.KeyframeMotion = + KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(innerkeytxt)); + } + else + sceneObject.RootPart.KeyframeMotion = null; + // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(reader); + sceneObject.InvalidateDeepEffectivePerms(); return sceneObject; } @@ -211,9 +224,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); // OtherParts + if (sceneObject.RootPart.KeyframeMotion != null) + { + Byte[] data = sceneObject.RootPart.KeyframeMotion.Serialize(); + + writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); + writer.WriteBase64(data, 0, data.Length); + writer.WriteEndElement(); + } + if (doScriptStates) sceneObject.SaveScriptedState(writer); + if (!noRootElement) writer.WriteEndElement(); // SceneObjectGroup -- cgit v1.1