From edce4e9c67b1c3b90474951532e78a2ea07e69fd Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 20 Oct 2010 00:40:05 -0400 Subject: [PATCH 1/3] * This removes an ugly extraparams hack that I used and makes UploadObjectAsset into a generic linkset upload tool. --- .../ObjectCaps/UploadObjectAssetModule.cs | 81 ++++++++++++++----- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index d5c6e9d8b4..465da290f0 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -47,6 +47,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using OSD = OpenMetaverse.StructuredData.OSD; using OSDMap = OpenMetaverse.StructuredData.OSDMap; using OpenSim.Framework.Capabilities; +using ExtraParamType = OpenMetaverse.ExtraParamType; namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps { @@ -188,25 +189,71 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps rootrot = obj.Rotation; } + + // Combine the extraparams data into it's ugly blob again.... - int bytelength = 0; + //int bytelength = 0; + //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + //{ + // bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; + //} + //byte[] extraparams = new byte[bytelength]; + //int position = 0; + + + + //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) + //{ + // Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, + // obj.ExtraParams[extparams].ExtraParamData.Length); + // + // position += obj.ExtraParams[extparams].ExtraParamData.Length; + // } + + //pbs.ExtraParams = extraparams; for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) { - bytelength += obj.ExtraParams[extparams].ExtraParamData.Length; + UploadObjectAssetMessage.Object.ExtraParam extraParam = obj.ExtraParams[extparams]; + switch ((ushort)extraParam.Type) + { + case (ushort)ExtraParamType.Sculpt: + pbs.SculptEntry = true; + pbs.SculptTexture = obj.SculptID; + pbs.SculptType = (byte)SculptType.Mesh; + + break; + case (ushort)ExtraParamType.Flexible: + Primitive.FlexibleData flex = new Primitive.FlexibleData(extraParam.ExtraParamData, 0); + pbs.FlexiEntry = true; + pbs.FlexiDrag = flex.Drag; + pbs.FlexiForceX = flex.Force.X; + pbs.FlexiForceY = flex.Force.Y; + pbs.FlexiForceZ = flex.Force.Z; + pbs.FlexiGravity = flex.Gravity; + pbs.FlexiSoftness = flex.Softness; + pbs.FlexiTension = flex.Tension; + pbs.FlexiWind = flex.Wind; + break; + case (ushort)ExtraParamType.Light: + Primitive.LightData light = new Primitive.LightData(extraParam.ExtraParamData, 0); + pbs.LightColorA = light.Color.A; + pbs.LightColorB = light.Color.B; + pbs.LightColorG = light.Color.G; + pbs.LightColorR = light.Color.R; + pbs.LightCutoff = light.Cutoff; + pbs.LightEntry = true; + pbs.LightFalloff = light.Falloff; + pbs.LightIntensity = light.Intensity; + pbs.LightRadius = light.Radius; + break; + case 0x40: + pbs.ReadProjectionData(extraParam.ExtraParamData, 0); + break; + + } + + } - byte[] extraparams = new byte[bytelength]; - int position = 0; - - for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) - { - Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, - obj.ExtraParams[extparams].ExtraParamData.Length); - - position += obj.ExtraParams[extparams].ExtraParamData.Length; - } - - pbs.ExtraParams = extraparams; - pbs.PathBegin = (ushort) obj.PathBegin; pbs.PathCurve = (byte) obj.PathCurve; pbs.PathEnd = (ushort) obj.PathEnd; @@ -269,9 +316,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; prim.Scale = obj.Scale; - prim.Shape.SculptEntry = true; - prim.Shape.SculptTexture = obj.SculptID; - prim.Shape.SculptType = (byte) SculptType.Mesh; + SceneObjectGroup grp = new SceneObjectGroup(); From 9f975ad5aacdca94b2c8531bb00ac486c6e5af52 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 20 Oct 2010 01:23:54 -0400 Subject: [PATCH 2/3] * One more goofy thing. I note that the sculpt texture id is broken out of the ExtraParams data in UploadObjectAsset. At this moment, if you're uploading a Sculpt, make sure to break out the Texture ID into the object data or it might not get applied appropriately. --- .../CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index 465da290f0..09b97196bf 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -217,9 +217,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps switch ((ushort)extraParam.Type) { case (ushort)ExtraParamType.Sculpt: + Primitive.SculptData sculpt = new Primitive.SculptData(extraParam.ExtraParamData, 0); + pbs.SculptEntry = true; + pbs.SculptTexture = obj.SculptID; - pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptType = (byte)sculpt.Type; break; case (ushort)ExtraParamType.Flexible: From a7acb650d400a280a7b9edabd304376dff9c81af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 22:26:07 -0700 Subject: [PATCH 3/3] Deleted verbose debug messages that are bringing sims to an halt. Increased the user cache expiration period to 33 hours. --- .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 4 ++-- .../Connectors/UserAccounts/UserAccountServiceConnector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e7cfda1bf1..155335bded 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -36,7 +36,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { public class UserAccountCache { - private const double CACHE_EXPIRATION_SECONDS = 120.0; + private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! private static readonly ILog m_log = LogManager.GetLogger( @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts if (account != null) m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); - m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); + //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } public UserAccount Get(UUID userID, out bool inCache) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 38c191a913..2a5df83193 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -113,7 +113,7 @@ namespace OpenSim.Services.Connectors public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) { - m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); + //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); Dictionary sendData = new Dictionary(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();