diff options
author | UbitUmarov | 2018-12-30 22:31:32 +0000 |
---|---|---|
committer | UbitUmarov | 2018-12-30 22:31:32 +0000 |
commit | ffca7de65d2c19081899dae75303a3f98833c665 (patch) | |
tree | a5b91c89b9421f8ff68ef64eedaf4b139dc5ee56 /OpenSim | |
parent | mantis 8436: fix lludp message (diff) | |
download | opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.zip opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.gz opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.bz2 opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.xz |
add some persistence (mysql only)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 26 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 7 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 17 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 106 |
5 files changed, 134 insertions, 36 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e754522..55de192 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Data.MySQL | |||
62 | /// </summary> | 62 | /// </summary> |
63 | private object m_dbLock = new object(); | 63 | private object m_dbLock = new object(); |
64 | 64 | ||
65 | protected virtual Assembly Assembly | 65 | protected Assembly Assembly |
66 | { | 66 | { |
67 | get { return GetType().Assembly; } | 67 | get { return GetType().Assembly; } |
68 | } | 68 | } |
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL | |||
76 | Initialise(connectionString); | 76 | Initialise(connectionString); |
77 | } | 77 | } |
78 | 78 | ||
79 | public virtual void Initialise(string connectionString) | 79 | public void Initialise(string connectionString) |
80 | { | 80 | { |
81 | m_connectionString = connectionString; | 81 | m_connectionString = connectionString; |
82 | 82 | ||
@@ -189,7 +189,7 @@ namespace OpenSim.Data.MySQL | |||
189 | "AttachedPosY, AttachedPosZ, " + | 189 | "AttachedPosY, AttachedPosZ, " + |
190 | "PhysicsShapeType, Density, GravityModifier, " + | 190 | "PhysicsShapeType, Density, GravityModifier, " + |
191 | "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " + | 191 | "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " + |
192 | "RotationAxisLocks" + | 192 | "RotationAxisLocks, sopanims" + |
193 | ") values (" + "?UUID, " + | 193 | ") values (" + "?UUID, " + |
194 | "?CreationDate, ?Name, ?Text, " + | 194 | "?CreationDate, ?Name, ?Text, " + |
195 | "?Description, ?SitName, ?TouchName, " + | 195 | "?Description, ?SitName, ?TouchName, " + |
@@ -226,7 +226,7 @@ namespace OpenSim.Data.MySQL | |||
226 | "?AttachedPosY, ?AttachedPosZ, " + | 226 | "?AttachedPosY, ?AttachedPosZ, " + |
227 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 227 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
228 | "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," + | 228 | "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," + |
229 | "?RotationAxisLocks)"; | 229 | "?RotationAxisLocks, ?sopanims)"; |
230 | 230 | ||
231 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 231 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
232 | 232 | ||
@@ -1499,6 +1499,19 @@ namespace OpenSim.Data.MySQL | |||
1499 | pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString()); | 1499 | pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString()); |
1500 | prim.PhysicsInertia = pdata; | 1500 | prim.PhysicsInertia = pdata; |
1501 | 1501 | ||
1502 | if (!(row["sopanims"] is DBNull)) | ||
1503 | { | ||
1504 | Byte[] data = (byte[])row["sopanims"]; | ||
1505 | if (data.Length > 0) | ||
1506 | prim.DeSerializeAnimations(data); | ||
1507 | else | ||
1508 | prim.Animations = null; | ||
1509 | } | ||
1510 | else | ||
1511 | { | ||
1512 | prim.Animations = null; | ||
1513 | } | ||
1514 | |||
1502 | return prim; | 1515 | return prim; |
1503 | } | 1516 | } |
1504 | 1517 | ||
@@ -1878,6 +1891,11 @@ namespace OpenSim.Data.MySQL | |||
1878 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | 1891 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); |
1879 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); | 1892 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); |
1880 | cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks); | 1893 | cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks); |
1894 | |||
1895 | if (prim.Animations!= null) | ||
1896 | cmd.Parameters.AddWithValue("sopanims", prim.SerializeAnimations()); | ||
1897 | else | ||
1898 | cmd.Parameters.AddWithValue("sopanims", null); | ||
1881 | } | 1899 | } |
1882 | 1900 | ||
1883 | /// <summary> | 1901 | /// <summary> |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 0577392..7333df7 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -467,3 +467,10 @@ COMMIT; | |||
467 | BEGIN; | 467 | BEGIN; |
468 | ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL; | 468 | ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL; |
469 | COMMIT; | 469 | COMMIT; |
470 | |||
471 | :VERSION 58 #----- Add sop animations | ||
472 | |||
473 | BEGIN; | ||
474 | ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL; | ||
475 | COMMIT; | ||
476 | |||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 794162e..cbe2324 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2424,8 +2424,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2424 | } | 2424 | } |
2425 | 2425 | ||
2426 | /// <summary> | 2426 | /// <summary> |
2427 | /// Send an alert message to the client. On the Linden client (tested 1.19.1.4), this pops up a brief duration | 2427 | /// Send an alert message to the client. This pops up a brief duration information box at a corner |
2428 | /// blue information box in the bottom right hand corner. | ||
2429 | /// </summary> | 2428 | /// </summary> |
2430 | /// <param name="message"></param> | 2429 | /// <param name="message"></param> |
2431 | public void SendAlertMessage(string message) | 2430 | public void SendAlertMessage(string message) |
@@ -2464,17 +2463,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2464 | /// the AlertMessage packet).</param> | 2463 | /// the AlertMessage packet).</param> |
2465 | public void SendAgentAlertMessage(string message, bool modal) | 2464 | public void SendAgentAlertMessage(string message, bool modal) |
2466 | { | 2465 | { |
2467 | OutPacket(BuildAgentAlertPacket(message, modal), ThrottleOutPacketType.Task); | ||
2468 | } | ||
2469 | |||
2470 | /// <summary> | ||
2471 | /// Construct an agent alert packet | ||
2472 | /// </summary> | ||
2473 | /// <param name="message"></param> | ||
2474 | /// <param name="modal"></param> | ||
2475 | /// <returns></returns> | ||
2476 | public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal) | ||
2477 | { | ||
2478 | // Prepend a slash to make the message come up in the top right | 2466 | // Prepend a slash to make the message come up in the top right |
2479 | // again. | 2467 | // again. |
2480 | // Allow special formats to be sent from aware modules. | 2468 | // Allow special formats to be sent from aware modules. |
@@ -2484,8 +2472,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2484 | alertPack.AgentData.AgentID = AgentId; | 2472 | alertPack.AgentData.AgentID = AgentId; |
2485 | alertPack.AlertData.Message = Util.StringToBytes256(message); | 2473 | alertPack.AlertData.Message = Util.StringToBytes256(message); |
2486 | alertPack.AlertData.Modal = modal; | 2474 | alertPack.AlertData.Modal = modal; |
2487 | 2475 | OutPacket(alertPack, ThrottleOutPacketType.Task); | |
2488 | return alertPack; | ||
2489 | } | 2476 | } |
2490 | 2477 | ||
2491 | public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, | 2478 | public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e5aa21e..c32e01b 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -64,21 +64,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
64 | 64 | ||
65 | public delegate void SynchronizeSceneHandler(Scene scene); | 65 | public delegate void SynchronizeSceneHandler(Scene scene); |
66 | 66 | ||
67 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); | ||
68 | 67 | ||
69 | public int NextObjectAnimationSequenceNumber | ||
70 | { | ||
71 | get | ||
72 | { | ||
73 | int ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
74 | if (ret <= 0 ) | ||
75 | { | ||
76 | m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0xafff5fL); | ||
77 | ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
78 | } | ||
79 | return ret; | ||
80 | } | ||
81 | } | ||
82 | #region Fields | 68 | #region Fields |
83 | 69 | ||
84 | /// <summary> | 70 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fd3a96b..479fb91 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -32,6 +32,8 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Runtime.Serialization; | 33 | using System.Runtime.Serialization; |
34 | using System.Security.Permissions; | 34 | using System.Security.Permissions; |
35 | using System.Threading; | ||
36 | using System.Text; | ||
35 | using System.Xml; | 37 | using System.Xml; |
36 | using System.Xml.Serialization; | 38 | using System.Xml.Serialization; |
37 | using log4net; | 39 | using log4net; |
@@ -5657,13 +5659,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
5657 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); | 5659 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); |
5658 | } | 5660 | } |
5659 | 5661 | ||
5662 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); | ||
5663 | public static int NextObjectAnimationSequenceNumber | ||
5664 | { | ||
5665 | get | ||
5666 | { | ||
5667 | int ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
5668 | if (ret <= 0) | ||
5669 | { | ||
5670 | m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0xafff5fL); | ||
5671 | ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
5672 | } | ||
5673 | return ret; | ||
5674 | } | ||
5675 | } | ||
5676 | |||
5660 | private object animsLock = new object(); | 5677 | private object animsLock = new object(); |
5661 | public Dictionary<UUID, int> Animations = null; | 5678 | public Dictionary<UUID, int> Animations = null; |
5662 | public Dictionary<UUID, string> AnimationsNames = null; | 5679 | public Dictionary<UUID, string> AnimationsNames = null; |
5663 | 5680 | ||
5664 | public bool AddAnimation(UUID animId, string animName) | 5681 | public bool AddAnimation(UUID animId, string animName) |
5665 | { | 5682 | { |
5666 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | 5683 | if (animId == UUID.Zero || string.IsNullOrEmpty(animName) || |
5684 | ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | ||
5667 | return false; | 5685 | return false; |
5668 | 5686 | ||
5669 | lock (animsLock) | 5687 | lock (animsLock) |
@@ -5676,7 +5694,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5676 | if (Animations.ContainsKey(animId)) | 5694 | if (Animations.ContainsKey(animId)) |
5677 | return false; | 5695 | return false; |
5678 | 5696 | ||
5679 | Animations[animId] = ParentGroup.Scene.NextObjectAnimationSequenceNumber; | 5697 | Animations[animId] = NextObjectAnimationSequenceNumber; |
5680 | AnimationsNames[animId] = animName; | 5698 | AnimationsNames[animId] = animName; |
5681 | ScheduleUpdate(PrimUpdateFlags.Animations); | 5699 | ScheduleUpdate(PrimUpdateFlags.Animations); |
5682 | } | 5700 | } |
@@ -5685,7 +5703,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5685 | 5703 | ||
5686 | public bool RemoveAnimation(UUID animId) | 5704 | public bool RemoveAnimation(UUID animId) |
5687 | { | 5705 | { |
5688 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | 5706 | if (animId == UUID.Zero || ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
5689 | return false; | 5707 | return false; |
5690 | 5708 | ||
5691 | lock (animsLock) | 5709 | lock (animsLock) |
@@ -5726,5 +5744,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
5726 | return Animations.Count; | 5744 | return Animations.Count; |
5727 | } | 5745 | } |
5728 | } | 5746 | } |
5747 | |||
5748 | public Byte[] SerializeAnimations() | ||
5749 | { | ||
5750 | if (AnimationsNames == null) | ||
5751 | return null; | ||
5752 | |||
5753 | |||
5754 | lock (animsLock) | ||
5755 | { | ||
5756 | if (AnimationsNames.Count == 0) | ||
5757 | return new byte[] { 0 }; | ||
5758 | |||
5759 | using (MemoryStream ms = new MemoryStream()) | ||
5760 | { | ||
5761 | byte[] tmp = Utils.UInt16ToBytes((ushort)Animations.Count); | ||
5762 | ms.Write(tmp, 0, 2); | ||
5763 | |||
5764 | foreach(KeyValuePair<UUID,string> kvp in AnimationsNames) | ||
5765 | { | ||
5766 | tmp = kvp.Key.GetBytes(); | ||
5767 | ms.Write(tmp, 0, 16); | ||
5768 | if(string.IsNullOrEmpty(kvp.Value)) | ||
5769 | ms.WriteByte(0); | ||
5770 | else | ||
5771 | { | ||
5772 | byte[] str = Util.StringToBytes(kvp.Value, 64); | ||
5773 | int len = str.Length - 1; | ||
5774 | ms.WriteByte((byte)len); | ||
5775 | ms.Write(str, 0 , len); | ||
5776 | } | ||
5777 | } | ||
5778 | return ms.ToArray(); | ||
5779 | } | ||
5780 | } | ||
5781 | } | ||
5782 | |||
5783 | public void DeSerializeAnimations(Byte[] data) | ||
5784 | { | ||
5785 | if(data == null) | ||
5786 | { | ||
5787 | Animations = null; | ||
5788 | AnimationsNames = null; | ||
5789 | return; | ||
5790 | } | ||
5791 | |||
5792 | if (data.Length < 2) | ||
5793 | { | ||
5794 | Animations = new Dictionary<UUID, int>(); | ||
5795 | AnimationsNames = new Dictionary<UUID, string>(); | ||
5796 | return; | ||
5797 | } | ||
5798 | |||
5799 | try | ||
5800 | { | ||
5801 | int count = (int)Utils.BytesToUInt16(data, 0); | ||
5802 | if(count == 0) | ||
5803 | return; | ||
5804 | |||
5805 | Animations = new Dictionary<UUID, int>(count); | ||
5806 | AnimationsNames = new Dictionary<UUID, string>(count); | ||
5807 | int pos = 2; | ||
5808 | while(--count >= 0) | ||
5809 | { | ||
5810 | UUID id = new UUID(data, pos); | ||
5811 | if(id == UUID.Zero) | ||
5812 | break; | ||
5813 | pos += 16; | ||
5814 | int strlen = data[pos++]; | ||
5815 | string name = UTF8Encoding.UTF8.GetString(data, pos, strlen); | ||
5816 | if(string.IsNullOrEmpty(name)) | ||
5817 | break; | ||
5818 | pos += strlen; | ||
5819 | Animations[id] = NextObjectAnimationSequenceNumber; | ||
5820 | AnimationsNames[id] = name; | ||
5821 | } | ||
5822 | return; | ||
5823 | } | ||
5824 | catch { } | ||
5825 | |||
5826 | Animations = null; | ||
5827 | AnimationsNames = null; | ||
5828 | } | ||
5729 | } | 5829 | } |
5730 | } | 5830 | } |