From e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jan 2017 01:02:57 +0000 Subject: change GenerateClientFlags(...) to work with a scenepresence; make use of the new IsGod to check its God rights; remove the non standard estate manager right to move other ppl prims i added on last commits; coment out a test method i added sometime ago --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1267993..eedba9d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1112,7 +1112,7 @@ namespace OpenSim.Framework /// void SendKillObject(List localID); - void SendPartFullUpdate(ISceneEntity ent, uint? parentID); +// void SendPartFullUpdate(ISceneEntity ent, uint? parentID); void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); -- cgit v1.1 From c74fa02d87058e1d974b47c9a4d49c60ded07b51 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 13 Jan 2017 17:09:08 +0000 Subject: Harmonize case in Permissions enum --- OpenSim/Framework/Util.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 6d679f2..6c0142e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -63,11 +63,12 @@ namespace OpenSim.Framework None = 0, // folded perms - foldedTransfer = 1, - foldedModify = 1 << 1, - foldedCopy = 1 << 2, + FoldedTransfer = 1, + FoldedModify = 1 << 1, + FoldedCopy = 1 << 2, + FoldedExport = 1 << 4, - foldedMask = 0x07, + FoldedMask = 0x17, // Transfer = 1 << 13, -- cgit v1.1 From fb86e415615ddfd917485daf5e4a4f2f0486359f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jan 2017 14:19:58 +0000 Subject: fix incoerent definition of Slam bit (bits 3 and 4 used in diferent places.) this may still be wrong on other places; Do not loose folded permitions, WARNING MASTER IS NOW UNSTABLE. permissions are still broken" --- OpenSim/Framework/Util.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 6c0142e..2ede363 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -66,9 +66,10 @@ namespace OpenSim.Framework FoldedTransfer = 1, FoldedModify = 1 << 1, FoldedCopy = 1 << 2, - FoldedExport = 1 << 4, + FoldedExport = 1 << 3, + Slam = 1 << 4, - FoldedMask = 0x17, + FoldedMask = 0x0f, // Transfer = 1 << 13, -- cgit v1.1 From 1ff831c45b292840e572b74153986218a590e739 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jan 2017 16:33:51 +0000 Subject: make the Slam bit actually be the two previus used ones, to try to minimize compatibilty issues --- OpenSim/Framework/Util.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2ede363..746814d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -66,8 +66,8 @@ namespace OpenSim.Framework FoldedTransfer = 1, FoldedModify = 1 << 1, FoldedCopy = 1 << 2, - FoldedExport = 1 << 3, - Slam = 1 << 4, + Slam = (1 << 3) | (1 << 4), + FoldedExport = 1 << 5, FoldedMask = 0x0f, -- cgit v1.1 From e28ac282ebde0e274d0b1783b46fdb40bd9eccd0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jan 2017 16:49:56 +0000 Subject: oops fix FolderMask acording --- OpenSim/Framework/Util.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 746814d..31c2df7 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -69,7 +69,7 @@ namespace OpenSim.Framework Slam = (1 << 3) | (1 << 4), FoldedExport = 1 << 5, - FoldedMask = 0x0f, + FoldedMask = 0x027, // Transfer = 1 << 13, -- cgit v1.1 From e475e658282acc1683713ba78ec6e163c5be240e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Jan 2017 13:43:54 +0000 Subject: use of PermissionMask Bit3 for slam was a recent mistake, so make it only bit4 and move folded export to its more natural place as bit3 --- OpenSim/Framework/Util.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 31c2df7..2deb1fb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -66,10 +66,10 @@ namespace OpenSim.Framework FoldedTransfer = 1, FoldedModify = 1 << 1, FoldedCopy = 1 << 2, - Slam = (1 << 3) | (1 << 4), - FoldedExport = 1 << 5, + FoldedExport = 1 << 3, + Slam = (1 << 4), - FoldedMask = 0x027, + FoldedMask = 0x0f, // Transfer = 1 << 13, -- cgit v1.1 From 568614af2cee0c9e6cd86dd682c7bc768afe655b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 16 Jan 2017 14:53:42 +0000 Subject: Remove the last instance of the legacy slam but being set New objects now get only the real slam bit. --- OpenSim/Framework/Util.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2deb1fb..0037f4f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -67,6 +67,14 @@ namespace OpenSim.Framework FoldedModify = 1 << 1, FoldedCopy = 1 << 2, FoldedExport = 1 << 3, + + // DO NOT USE THIS FOR NEW WORK. IT IS DEPRECATED AND + // EXISTS ONLY TO REACT TO EXISTING OBJECTS HAVING IT. + // NEW CODE SHOULD NEVER SET THIS BIT! + // Use InventoryItemFlags.ObjectSlamPerm in the Flags field of + // this legacy slam bit. It comes from prior incomplete + // understanding of the code and the prohibition on + // reading viewer code that used to be in place. Slam = (1 << 4), FoldedMask = 0x0f, -- cgit v1.1 From 733072b6a371f52d5c13f61d4b2a145a370370f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Jan 2017 19:01:41 +0000 Subject: chance new effective permissions code to ease aggregation on demand( ie on changes). But still doing full aggregation on checks, so still heavy --- OpenSim/Framework/Util.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0037f4f..9f5868b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -80,15 +80,17 @@ namespace OpenSim.Framework FoldedMask = 0x0f, // - Transfer = 1 << 13, - Modify = 1 << 14, - Copy = 1 << 15, - Export = 1 << 16, - Move = 1 << 19, - Damage = 1 << 20, + Transfer = 1 << 13, // 0x02000 + Modify = 1 << 14, // 0x04000 + Copy = 1 << 15, // 0x08000 + Export = 1 << 16, // 0x10000 + Move = 1 << 19, // 0x80000 + Damage = 1 << 20, // 0x100000 does not seem to be in use // All does not contain Export, which is special and must be // explicitly given - All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19) + All = 0x8e000, + AllAndExport = 0x9e000, + AllEffective = 0x9e000 } /// -- cgit v1.1 From d62854cbd317d0410bb814ca1182c9aad44cb9e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 21 Jan 2017 00:30:42 +0000 Subject: set a sane default region ObjectCapacity --- OpenSim/Framework/RegionInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 99e97e8..7de8c52 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -130,7 +130,7 @@ namespace OpenSim.Framework private float m_physPrimMin = 0; private int m_physPrimMax = 0; private bool m_clampPrimSize = false; - private int m_objectCapacity = 0; + private int m_objectCapacity = 15000; private int m_maxPrimsPerUser = -1; private int m_linksetCapacity = 0; private string m_regionType = String.Empty; @@ -753,7 +753,7 @@ namespace OpenSim.Framework m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); allKeys.Remove("ClampPrimSize"); - m_objectCapacity = config.GetInt("MaxPrims", 15000); + m_objectCapacity = config.GetInt("MaxPrims", m_objectCapacity); allKeys.Remove("MaxPrims"); m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1); -- cgit v1.1 From 0091c37ed3fd3f9ed4edf079a61f986daadca16b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 27 Jan 2017 20:21:24 +0000 Subject: several changes relative to objects return and parcel prim counts: avoid null refs, report correct count of returned objects, make obkects counts by ownership coerent with return rules, etc --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index eedba9d..ab6d58f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -107,7 +107,7 @@ namespace OpenSim.Framework public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); public delegate void DeRezObject( - IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID); + IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true); public delegate void GenericCall5(IClientAPI remoteClient, bool status); -- cgit v1.1 From 5a18ea31cf9d9a97fc1a65f8623b633c244221c2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 30 Jan 2017 13:59:05 +0000 Subject: Make negative asset caching actually work Also fixes some merge artefacts in HGAssetBroker where cached assets were requested but not actually used and completely squelch a materials debug message because there is nothing the user can do to fix it anyway. --- OpenSim/Framework/IAssetCache.cs | 2 +- OpenSim/Framework/WearableCacheItem.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 8477116..1e6d19d 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs @@ -48,7 +48,7 @@ namespace OpenSim.Framework /// /// /// null if the asset does not exist. - AssetBase Get(string id); + AssetBase Get(string id, out bool negative); /// /// Check whether an asset with the specified id exists in the cache. diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index ccaf69e..f181c39 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -113,7 +113,8 @@ namespace OpenSim.Framework { if (dataCache.Check(item.TextureID.ToString())) { - AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); + bool negative; + AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative); if (assetItem != null) { itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); -- cgit v1.1 From 5ceb315e3463eaa50abf43a4c07cb37d9486b1fd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 15:30:17 +0000 Subject: Secure sim stats with an (optional) password. There is way too much in these stats to expose them to the world, at least for some of us. --- OpenSim/Framework/Monitoring/StatsManager.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 55c3276..a6b341f 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -47,6 +47,8 @@ namespace OpenSim.Framework.Monitoring // Subcommand used to list other stats. public const string ListSubCommand = "list"; + public static string StatsPassword { get; set; } + // All subcommands public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand }; @@ -302,6 +304,17 @@ namespace OpenSim.Framework.Monitoring int response_code = 200; string contenttype = "text/json"; + if (StatsPassword != String.Empty && (!request.ContainsKey("pass") || request["pass"].ToString() != StatsPassword)) + { + responsedata["int_response_code"] = response_code; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Access denied"; + responsedata["access_control_allow_origin"] = "*"; + + return responsedata; + } + string pCategoryName = StatsManager.AllSubCommand; string pContainerName = StatsManager.AllSubCommand; string pStatName = StatsManager.AllSubCommand; -- cgit v1.1 From a5151bb337cfee14dff6045d7f8e293201ae94ac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 16:31:01 +0000 Subject: Refactor asset handling as per Ubit's suggestion --- OpenSim/Framework/IAssetCache.cs | 5 +++-- OpenSim/Framework/WearableCacheItem.cs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 1e6d19d..2df9199 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs @@ -47,8 +47,9 @@ namespace OpenSim.Framework /// Get an asset by its id. /// /// - /// null if the asset does not exist. - AssetBase Get(string id, out bool negative); + /// Will be set to null if no asset was found + /// False if the asset has been negative-cached + bool Get(string id, out AssetBase asset); /// /// Check whether an asset with the specified id exists in the cache. diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index f181c39..427e149 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -113,8 +113,8 @@ namespace OpenSim.Framework { if (dataCache.Check(item.TextureID.ToString())) { - bool negative; - AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative); + AssetBase assetItem; + dataCache.Get(item.TextureID.ToString(), out assetItem); if (assetItem != null) { itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); -- cgit v1.1 From adcb1d8798c0404d0c9f894d1b33003557066123 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 24 Feb 2017 01:33:02 +0000 Subject: Allow setting the stats log file location in OpenSim.ini rather than app.exe.config --- OpenSim/Framework/Servers/ServerBase.cs | 17 +++++++++++++++++ OpenSim/Framework/Util.cs | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 8965e71..f627ae6 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers protected OpenSimAppender m_consoleAppender; protected FileAppender m_logFileAppender; + protected FileAppender m_statsLogFileAppender; protected DateTime m_startuptime; protected string m_startupDirectory = Environment.CurrentDirectory; @@ -156,6 +157,10 @@ namespace OpenSim.Framework.Servers { m_logFileAppender = (FileAppender)appender; } + else if (appender.Name == "StatsLogFileAppender") + { + m_statsLogFileAppender = (FileAppender)appender; + } } if (null == m_consoleAppender) @@ -185,6 +190,18 @@ namespace OpenSim.Framework.Servers m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File); } + + if (m_statsLogFileAppender != null && startupConfig != null) + { + string cfgStatsFileName = startupConfig.GetString("StatsLogFile", null); + if (cfgStatsFileName != null) + { + m_statsLogFileAppender.File = cfgStatsFileName; + m_statsLogFileAppender.ActivateOptions(); + } + + m_log.InfoFormat("[SERVER BASE]: Stats Logging started to file {0}", m_statsLogFileAppender.File); + } } /// diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0037f4f..dcb660a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1190,7 +1190,7 @@ namespace OpenSim.Framework { foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) { - if (appender is FileAppender) + if (appender is FileAppender && appender.Name == "LogFileAppender") { return ((FileAppender)appender).File; } @@ -1199,6 +1199,19 @@ namespace OpenSim.Framework return "./OpenSim.log"; } + public static string statsLogFile() + { + foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) + { + if (appender is FileAppender && appender.Name == "StatsLogFileAppender") + { + return ((FileAppender)appender).File; + } + } + + return "./OpenSimStats.log"; + } + public static string logDir() { return Path.GetDirectoryName(logFile()); -- cgit v1.1 From 6463ab7d795933ed6745b4e43cab7bc6ffe98c0a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 31 Mar 2017 14:44:22 +0100 Subject: If a DNS resolution fails on an outbound request, simply allow it --- OpenSim/Framework/OutboundUrlFilter.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs index ee4707f..63ae361 100644 --- a/OpenSim/Framework/OutboundUrlFilter.cs +++ b/OpenSim/Framework/OutboundUrlFilter.cs @@ -212,7 +212,17 @@ namespace OpenSim.Framework // Check that we are permitted to make calls to this endpoint. bool foundIpv4Address = false; - IPAddress[] addresses = Dns.GetHostAddresses(url.Host); + IPAddress[] addresses = null; + + try + { + addresses = Dns.GetHostAddresses(url.Host); + } + catch + { + // If there is a DNS error, we can't stop the script! + return true; + } foreach (IPAddress addr in addresses) { @@ -253,4 +263,4 @@ namespace OpenSim.Framework return allowed; } } -} \ No newline at end of file +} -- cgit v1.1 From 443fc60cdf399a49832e787ca58c2644bef7e457 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Apr 2017 17:49:17 +0100 Subject: store the physics inertia override in Mysql and add it to serializer. run prebuild is required --- OpenSim/Framework/PhysicsInertia.cs | 262 ++++++++++++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 OpenSim/Framework/PhysicsInertia.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs new file mode 100644 index 0000000..af70634 --- /dev/null +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -0,0 +1,262 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using System.Text; +using System.IO; +using System.Xml; + +namespace OpenSim.Framework +{ + public class PhysicsInertiaData + { + public float TotalMass; // the total mass of a linkset + public Vector3 CenterOfMass; // the center of mass position relative to root part position + public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords + public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation + // or the upper triangle of the inertia tensor + // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy)) + + public PhysicsInertiaData() + { + } + + public PhysicsInertiaData(PhysicsInertiaData source) + { + TotalMass = source.TotalMass; + CenterOfMass = source.CenterOfMass; + Inertia = source.Inertia; + InertiaRotation = source.InertiaRotation; + } + + private XmlTextWriter writer; + + private void XWint(string name, int i) + { + writer.WriteElementString(name, i.ToString()); + } + + private void XWfloat(string name, float f) + { + writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); + } + + private void XWVector(string name, Vector3 vec) + { + writer.WriteStartElement(name); + writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + + private void XWVector4(string name, Vector4 quat) + { + writer.WriteStartElement(name); + writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); + writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + + public void ToXml2(XmlTextWriter twriter) + { + writer = twriter; + writer.WriteStartElement("PhysicsInertia"); + + XWfloat("MASS", TotalMass); + XWVector("CM", CenterOfMass); + XWVector("INERTIA", Inertia); + XWVector4("IROT", InertiaRotation); + + writer.WriteEndElement(); + writer = null; + } + + XmlReader reader; + + private int XRint() + { + return reader.ReadElementContentAsInt(); + } + + private float XRfloat() + { + return reader.ReadElementContentAsFloat(); + } + + public Vector3 XRvector() + { + Vector3 vec; + reader.ReadStartElement(); + vec.X = reader.ReadElementContentAsFloat(); + vec.Y = reader.ReadElementContentAsFloat(); + vec.Z = reader.ReadElementContentAsFloat(); + reader.ReadEndElement(); + return vec; + } + + public Vector4 XRVector4() + { + Vector4 q; + reader.ReadStartElement(); + q.X = reader.ReadElementContentAsFloat(); + q.Y = reader.ReadElementContentAsFloat(); + q.Z = reader.ReadElementContentAsFloat(); + q.W = reader.ReadElementContentAsFloat(); + reader.ReadEndElement(); + return q; + } + + public static bool EReadProcessors( + Dictionary processors, + XmlReader xtr) + { + bool errors = false; + + string nodeName = string.Empty; + while (xtr.NodeType != XmlNodeType.EndElement) + { + nodeName = xtr.Name; + + Action p = null; + if (processors.TryGetValue(xtr.Name, out p)) + { + try + { + p(); + } + catch + { + errors = true; + if (xtr.NodeType == XmlNodeType.EndElement) + xtr.Read(); + } + } + else + { + xtr.ReadOuterXml(); // ignore + } + } + + return errors; + } + + public string ToXml2() + { + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter xwriter = new XmlTextWriter(sw)) + { + ToXml2(xwriter); + } + + return sw.ToString(); + } + } + + public static PhysicsInertiaData FromXml2(string text) + { + if (text == String.Empty) + return null; + + UTF8Encoding enc = new UTF8Encoding(); + MemoryStream ms = new MemoryStream(enc.GetBytes(text)); + XmlTextReader xreader = new XmlTextReader(ms); + + PhysicsInertiaData v = new PhysicsInertiaData(); + bool error; + + v.FromXml2(xreader, out error); + + xreader.Close(); + + if (error) + return null; + + return v; + } + + public static PhysicsInertiaData FromXml2(XmlReader reader) + { + PhysicsInertiaData data = new PhysicsInertiaData(); + + bool errors = false; + + data.FromXml2(reader, out errors); + if (errors) + return null; + + return data; + } + + private void FromXml2(XmlReader _reader, out bool errors) + { + errors = false; + reader = _reader; + + Dictionary m_XmlProcessors = new Dictionary(); + + m_XmlProcessors.Add("MASS", ProcessXR_Mass); + m_XmlProcessors.Add("CM", ProcessXR_CM); + m_XmlProcessors.Add("INERTIA", ProcessXR_Inertia); + m_XmlProcessors.Add("IROT", ProcessXR_InertiaRotation); + + reader.ReadStartElement("PhysicsInertia", String.Empty); + + errors = EReadProcessors( + m_XmlProcessors, + reader); + + reader.ReadEndElement(); + reader = null; + } + + private void ProcessXR_Mass() + { + TotalMass = XRfloat(); + } + + private void ProcessXR_CM() + { + CenterOfMass = XRvector(); + } + + private void ProcessXR_Inertia() + { + Inertia = XRvector(); + } + + private void ProcessXR_InertiaRotation() + { + InertiaRotation = XRVector4(); + } + } +} -- cgit v1.1 From 63383bf3c5f5923b33e43ddd6b24b5616288ff4f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Apr 2017 21:55:37 +0100 Subject: add functions to send entity updates imediatly, except for avatars (or now) they should be use to bypass normal delayed updates, for debug --- OpenSim/Framework/IClientAPI.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ab6d58f..6cb37b2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -685,9 +685,10 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = 0x3fffffff, - CancelKill = 0x7fffffff, - Kill = 0x80000000 + FullUpdate = 0x0fffffff, + SendInTransit = 1 << 30, + CancelKill = 0x4fffffff, // 1 << 31 + Kill = 0x80000000 // 1 << 32 } /* included in .net 4.0 @@ -1187,7 +1188,8 @@ namespace OpenSim.Framework void SetAgentThrottleSilent(int throttle, int setting); int GetAgentThrottleSilent(int throttle); - void SendAvatarDataImmediate(ISceneEntity avatar); + void SendEntityFullUpdateImmediate(ISceneEntity entity); + void SendEntityTerseUpdateImmediate(ISceneEntity entity); /// /// Send a positional, velocity, etc. update to the viewer for a given entity. -- cgit v1.1 From 0f7ffc56cee22aa95af58d19d3ea2193cea07340 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 15 Apr 2017 10:46:18 +0100 Subject: several changes for osTeleportObject --- OpenSim/Framework/IClientAPI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 6cb37b2..5ca8c88 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -685,10 +685,10 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = 0x0fffffff, - SendInTransit = 1 << 30, - CancelKill = 0x4fffffff, // 1 << 31 - Kill = 0x80000000 // 1 << 32 + FullUpdate = 0x0fffffff, + SendInTransit = 0x20000000, + CancelKill = 0x4fffffff, // 1 << 30 + Kill = 0x80000000 // 1 << 31 } /* included in .net 4.0 -- cgit v1.1 From 7c5376f224743358a7640477fedfd9de5b27b48d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Apr 2017 14:21:01 +0100 Subject: move mesh pbs creation code out of mesh upload code into to PrimitiveBaseShape.cs --- OpenSim/Framework/PrimitiveBaseShape.cs | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 29985d2..a830551 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -328,6 +328,70 @@ namespace OpenSim.Framework return shape; } + public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID) + { + PrimitiveBaseShape shape = new PrimitiveBaseShape(); + + shape._pathScaleX = 100; + shape._pathScaleY = 100; + + if(numberOfFaces <= 0) // oops ? + numberOfFaces = 1; + + switch(numberOfFaces) + { + case 1: // torus + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Curve1; + break; + + case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere) + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Curve1; + shape.ProfileHollow = 1; + break; + + case 3: // cylinder + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 4: // cylinder with hollow + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileHollow = 1; + break; + + case 5: // prism + shape.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 6: // box + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 7: // box with hollow + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileHollow = 1; + break; + + default: // 8 faces box with cut + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileBegin = 1; + break; + } + + shape.SculptEntry = true; + shape.SculptType = (byte)OpenMetaverse.SculptType.Mesh; + shape.SculptTexture = meshAssetID; + + return shape; + } + public void SetScale(float side) { _scale = new Vector3(side, side, side); -- cgit v1.1