From a1dc4e830dac3fa31a107aa855d2d2b2efeca0f2 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 20 Dec 2011 13:40:24 -0800 Subject: Remove unused SetAcceleration and add set on Acceleration parameter --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | 6 +----- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 3 ++- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 3 ++- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 3 ++- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 7 +------ OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 + OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 6 +----- OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 6 +----- OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs | 6 +----- OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs | 6 +----- 11 files changed, 14 insertions(+), 35 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 55ba18a..9f9b4f0 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -46,7 +46,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; -using OpenSim.Server.Base; +using OpenSim.Server.Base; using OpenSim.Services.Base; using OpenSim.Services.Interfaces; using OpenSim.Services.UserAccountService; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 5e2eeeb..9964edc 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs @@ -232,6 +232,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override Vector3 Acceleration { get { return _acceleration; } + set { _acceleration = value; } } public override bool Kinematic @@ -252,11 +253,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { } - public void SetAcceleration(Vector3 accel) - { - _acceleration = accel; - } - public override void AddForce(Vector3 force, bool pushforce) { } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 9a6857b..0cab5d1 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -231,7 +231,8 @@ public class BSCharacter : PhysicsActor } } public override Vector3 Acceleration { - get { return _acceleration; } + get { return _acceleration; } + set { _acceleration = value; } } public override Quaternion Orientation { get { return _orientation; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 8782e62..898436b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -417,7 +417,8 @@ public sealed class BSPrim : PhysicsActor } } public override OMV.Vector3 Acceleration { - get { return _acceleration; } + get { return _acceleration; } + set { _acceleration = value; } } public override OMV.Quaternion Orientation { get { return _orientation; } diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index c2acf97..0587054 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.Physics.Manager public abstract Vector3 Torque { get; set; } public abstract float CollisionScore { get; set;} - public abstract Vector3 Acceleration { get; } + public abstract Vector3 Acceleration { get; set; } public abstract Quaternion Orientation { get; set; } public abstract int PhysicsActorType { get; set; } public abstract bool IsPhysical { get; set; } @@ -458,6 +458,7 @@ namespace OpenSim.Region.Physics.Manager public override Vector3 Acceleration { get { return Vector3.Zero; } + set { } } public override bool IsPhysical diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 73c1c02..1363cfd 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -689,12 +689,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override Vector3 Acceleration { get { return _acceleration; } - } - - public void SetAcceleration(Vector3 accel) - { - m_pidControllerActive = true; - _acceleration = accel; + set { _acceleration = value; } } /// diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 94e6185..75364b7 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2497,6 +2497,7 @@ Console.WriteLine(" JointCreateFixed"); public override Vector3 Acceleration { get { return _acceleration; } + set { _acceleration = value; } } public override void AddForce(Vector3 force, bool pushforce) diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index a70179b..ae534ea 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -231,6 +231,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override Vector3 Acceleration { get { return _acceleration; } + set { _acceleration = value; } } public override bool Kinematic @@ -251,11 +252,6 @@ namespace OpenSim.Region.Physics.POSPlugin { } - public void SetAcceleration(Vector3 accel) - { - _acceleration = accel; - } - public override void AddForce(Vector3 force, bool pushforce) { } diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index 91ec3df..e4fd7eb 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs @@ -193,6 +193,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override Vector3 Acceleration { get { return _acceleration; } + set { _acceleration = value; } } public override bool Kinematic @@ -201,11 +202,6 @@ namespace OpenSim.Region.Physics.POSPlugin set { } } - public void SetAcceleration(Vector3 accel) - { - _acceleration = accel; - } - public override void AddForce(Vector3 force, bool pushforce) { } diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs index 92261cd..9216a9e 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs @@ -233,11 +233,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin public override Vector3 Acceleration { get { return _acceleration; } - } - - public void SetAcceleration(Vector3 accel) - { - _acceleration = accel; + set { _acceleration = value; } } public override void AddForce(Vector3 force, bool pushforce) diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs index c0e24fd..42bd119 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs @@ -207,11 +207,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin public override Vector3 Acceleration { get { return _acceleration; } - } - - public void SetAcceleration(Vector3 accel) - { - _acceleration = accel; + set { _acceleration = value; } } public override void AddForce(Vector3 force, bool pushforce) -- cgit v1.1 From fa79588a20fb4bcc79a24214b7c055efaff97f77 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Jan 2012 15:42:36 +0000 Subject: minor: add missing newlines to pCampbot usage statement --- OpenSim/Tools/pCampBot/pCampBot.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index 6249fae..a73fcbe 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -112,10 +112,10 @@ namespace pCampBot " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" + " -password password for the bots\n" + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" + - " current options are:" + - " p (physics)" + - " g (grab)" + - " t (teleport)" + + " current options are:\n" + + " p (physics)\n" + + " g (grab)\n" + + " t (teleport)\n" + // " c (cross)" + " -wear set appearance folder to load from (default: no)\n" + " -h, -help show this message"); -- cgit v1.1 From 983b49c0c872e997576d7fc167319e28e6f970e3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Jan 2012 18:25:31 +0000 Subject: commented out "Prevented flyoff" log message for now as this becomes problematic with bot testing. Please uncomment if still needed. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3d1c1b5..42cd4be 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2844,7 +2844,7 @@ namespace OpenSim.Region.Framework.Scenes Velocity = Vector3.Zero; AbsolutePosition = pos; - m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); +// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); AddToPhysicalScene(isFlying); } -- cgit v1.1 From 0ab2289cdcf2417964de5ba36b0d9d4b512013d0 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 3 Jan 2012 16:52:08 -0800 Subject: Access to these static methods to serialize objects are useful outside of serializer --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 60cc788..bca49f7 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1263,7 +1263,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString(name, flagsStr.Replace(",", "")); } - static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) + public static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) { if (tinv.Count > 0) // otherwise skip this { @@ -1317,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) + public static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) { if (shp != null) { @@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return obj; } - static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) + public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) { TaskInventoryDictionary tinv = new TaskInventoryDictionary(); @@ -1538,7 +1538,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// The name of the xml element containing the shape /// true if any errors were encountered during parsing, false otherwise /// The shape parsed - static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) + public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) { errors = false; -- cgit v1.1 From 82df5de5cf91960ff5f50d0f0568ac6443516960 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 16:15:05 +0000 Subject: Remove the pointless LLClientView.m_imageManager null check. Despite the code comments we never actually null it. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b37fd54..fe28ba3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -348,7 +348,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers protected Scene m_scene; - protected LLImageManager m_imageManager; + private LLImageManager m_imageManager; protected string m_firstName; protected string m_lastName; protected Thread m_clientThread; @@ -499,8 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IsActive = false; // Shutdown the image manager - if (m_imageManager != null) - m_imageManager.Close(); + m_imageManager.Close(); // Fire the callback for this connection closing if (OnConnectionClosed != null) @@ -3940,14 +3939,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) - { - ProcessTextureRequests(); - } - } - - void ProcessTextureRequests() - { - if (m_imageManager != null) m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); } @@ -7479,12 +7470,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; - // in the end, we null this, so we have to check if it's null - if (m_imageManager != null) - { - m_imageManager.EnqueueReq(args); - } + m_imageManager.EnqueueReq(args); } + return true; } -- cgit v1.1 From fc391d4b10b5f05be4d0b44db5be0f2133b74434 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Wed, 4 Jan 2012 12:01:18 -0800 Subject: Added EventManager.OnRegionStarted which is triggered when Heartbeat is started. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 2 files changed, 25 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4f71915..fd35c62 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -401,6 +401,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; + public delegate void RegionStarted(Scene scene); + public event RegionStarted OnRegionStarted; + public delegate void LoginsEnabled(string regionName); public event LoginsEnabled OnLoginsEnabled; @@ -2243,6 +2246,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerOnRegionStarted(Scene scene) + { + RegionStarted handler = OnRegionStarted; + + if (handler != null) + { + foreach (RegionStarted d in handler.GetInvocationList()) + { + try + { + d(scene); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerLoginsEnabled (string regionName) { LoginsEnabled handler = OnLoginsEnabled; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0f84da9..027ec96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1194,6 +1194,7 @@ namespace OpenSim.Region.Framework.Scenes try { + m_eventManager.TriggerOnRegionStarted(this); while (!shuttingdown) Update(); -- cgit v1.1 From 3a64522267352d1c68ef99ac76c65bd3c4f9eaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 21:40:15 +0000 Subject: Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes. --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 24 +++++--- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../ClientStack/Linden/UDP/LLImageManager.cs | 72 ++++++++++++++++++---- .../Agent/TextureSender/J2KDecoderModule.cs | 4 ++ 4 files changed, 80 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index cb9692a..185a909 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_currentPacket = 2; } - + while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) { sendMore = SendPacket(client); @@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP return (m_currentPacket > m_stopPacket); } + /// + /// This is where we decide what we need to update + /// and assign the real discardLevel and packetNumber + /// assuming of course that the connected client might be bonkers + /// public void RunUpdate() { - //This is where we decide what we need to update - //and assign the real discardLevel and packetNumber - //assuming of course that the connected client might be bonkers - if (!HasAsset) { if (!m_assetRequested) { m_assetRequested = true; +// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); AssetService.Get(TextureID.ToString(), this, AssetReceived); } } @@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //Request decode m_decodeRequested = true; + +// m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID); + // Do we have a jpeg decoder? if (J2KDecoder != null) { @@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send it off to the jpeg decoder J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback); } - } else { @@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_currentPacket == 0) return 0; + if (m_currentPacket == 1) return FIRST_PACKET_SIZE; int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE; + if (result < 0) - { result = FIRST_PACKET_SIZE; - } + return result; } @@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UUID assetID = UUID.Zero; if (asset != null) + { assetID = asset.FullID; + } else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) { // Unfortunately we need this here, there's no other way. @@ -395,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } AssetDataCallback(assetID, asset); - } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fe28ba3..eb1a50e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Add a handler for the given packet type. /// /// - /// The packet is handled on its own thread. If packets must be handled in the order in which thye + /// The packet is handled on its own thread. If packets must be handled in the order in which they /// are received then please use the synchronous version of this method. /// /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index e3a881f..3e31b7d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void EnqueueReq(TextureRequestArgs newRequest) { - //Make sure we're not shutting down.. if (!m_shuttingdown) { J2KImage imgrequest; @@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); - try + try { lock (m_syncRoot) - m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); + m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); } catch (Exception) { } } else { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); - //Check the packet sequence to make sure this isn't older than + //Check the packet sequence to make sure this isn't older than //one we've already received if (newRequest.requestSequence > imgrequest.LastSequence) { @@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Update the requested priority imgrequest.Priority = newRequest.Priority; + UpdateImageInQueue(imgrequest); - //Run an update imgrequest.RunUpdate(); + +// J2KImage imgrequest2 = new J2KImage(this); +// imgrequest2.J2KDecoder = m_j2kDecodeModule; +// imgrequest2.AssetService = m_assetCache; +// imgrequest2.AgentID = m_client.AgentId; +// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface(); +// imgrequest2.DiscardLevel = newRequest.DiscardLevel; +// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber); +// imgrequest2.Priority = newRequest.Priority; +// imgrequest2.TextureID = newRequest.RequestedAssetID; +// imgrequest2.Priority = newRequest.Priority; +// +// //Add this download to the priority queue +// AddImageToQueue(imgrequest2); +// +// imgrequest2.RunUpdate(); + } +// else +// { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater", +// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence); +// } } } else @@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); @@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Add this download to the priority queue AddImageToQueue(imgrequest); - //Run an update imgrequest.RunUpdate(); } } @@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If null was returned, the texture priority queue is currently empty if (image == null) - return false; + break; if (image.IsDecoded) { @@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // written. Undecoded textures should not be going into the priority // queue, because a high priority undecoded texture will clog up the // pipeline for a client - return true; +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}", +// image.TextureID); + + break; } } +// if (packetsSent != 0) +// m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent); + return m_priorityQueue.Count > 0; } @@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_priorityQueue.Count > 0) { - try { image = m_priorityQueue.FindMax(); } + try + { + image = m_priorityQueue.FindMax(); + } catch (Exception) { } } } @@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_syncRoot) { - try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } + try + { + m_priorityQueue.Add(ref image.PriorityQueueHandle, image); + } catch (Exception) { } } } @@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { lock (m_syncRoot) { - try { m_priorityQueue.Delete(image.PriorityQueueHandle); } + try + { + m_priorityQueue.Delete(image.PriorityQueueHandle); + } catch (Exception) { } } } @@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { lock (m_syncRoot) { - try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } + try + { + m_priorityQueue.Replace(image.PriorityQueueHandle, image); + } catch (Exception) { image.PriorityQueueHandle = null; diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 7dd9087..14dee84 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender // If it's cached, return the cached results if (m_decodedCache.TryGetValue(assetID, out result)) { +// m_log.DebugFormat( +// "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}", +// result.Length, assetID); + callback(assetID, result); } else -- cgit v1.1 From 0634c3850563fc38a4026f70a7bfd64a05198fa3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 22:22:46 +0000 Subject: Separate out rebake request code from cache validation code AvatarFactoryModule. This allows some logic simplification and allows an external caller to manually request rebakes even if textures are uploaded (future command). --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 72 ++++++++++++---------- .../Framework/Interfaces/IAvatarFactoryModule.cs | 22 +++++++ 2 files changed, 63 insertions(+), 31 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e8aee3e..d64a0c1 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -156,7 +156,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; // WriteBakedTexturesReport(sp, m_log.DebugFormat); - ValidateBakedTextureCache(sp, false); + if (!ValidateBakedTextureCache(sp)) + RequestRebake(sp, true); // This appears to be set only in the final stage of the appearance // update transaction. In theory, we should be able to do an immediate @@ -251,15 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } /// - /// Check for the existence of the baked texture assets. - /// - /// - public bool ValidateBakedTextureCache(IScenePresence sp) - { - return ValidateBakedTextureCache(sp, true); - } - - /// /// Queue up a request to send appearance. /// /// @@ -292,17 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - #endregion - - #region AvatarFactoryModule private methods - - /// - /// Check for the existence of the baked texture assets. Request a rebake - /// unless checkonly is true. - /// - /// - /// - private bool ValidateBakedTextureCache(IScenePresence sp, bool checkonly) + public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures @@ -330,16 +312,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory defonly = false; // found a non-default texture reference if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) - { - if (checkonly) - return false; - - m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", - face.TextureID, idx, sp.Name); - - sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); - } + return false; } m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); @@ -348,6 +321,43 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return (defonly ? false : true); } + public void RequestRebake(IScenePresence sp, bool missingTexturesOnly) + { + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) + { + int idx = AvatarAppearance.BAKE_INDICES[i]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + + // if there is no texture entry, skip it + if (face == null) + continue; + +// m_log.DebugFormat( +// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", +// face.TextureID, idx, client.Name, client.AgentId); + + // if the texture is one of the "defaults" then skip it + // this should probably be more intelligent (skirt texture doesnt matter + // if the avatar isnt wearing a skirt) but if any of the main baked + // textures is default then the rest should be as well + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + continue; + + if (missingTexturesOnly && m_scene.AssetService.Get(face.TextureID.ToString()) != null) + continue; + else + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + + sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); + } + } + + #endregion + + #region AvatarFactoryModule private methods + private Dictionary GetBakedTextureFaces(ScenePresence sp) { if (sp.IsChildAgent) diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs index 8670229..04df9c3 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs @@ -61,7 +61,29 @@ namespace OpenSim.Region.Framework.Interfaces /// true if a valid agent was found, false otherwise bool SaveBakedTextures(UUID agentId); + /// + /// Validate that OpenSim can find the baked textures need to display a given avatar + /// + /// + /// + /// + /// true if all the baked textures referenced by the texture IDs exist or the appearance is only using default textures. false otherwise. + /// bool ValidateBakedTextureCache(IScenePresence sp); + + /// + /// Request a rebake of textures for an avatar. + /// + /// + /// This will send the request to the viewer, since it's there that the rebake is done. + /// + /// Avatar to rebake. + /// + /// If true, only request a rebake for the textures that are missing. + /// If false then we request a rebake of all textures for which we already have references. + /// + void RequestRebake(IScenePresence sp, bool missingTexturesOnly); + void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); -- cgit v1.1 From 8fb70a2058e98dea63e7ee7c5b55532668fccd38 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 22:45:07 +0000 Subject: Add "appearance rebake" command to ask a specific viewer to rebake textures from the server end. This is not as useful as it sounds, since you can only request rebakes for texture IDs already received. In other words, if the viewer has never sent the server this information (which happens quite often) then it will have no effect. Nonetheless, this is useful for diagnostic/debugging purposes. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 15 ++++++-- .../Avatar/Appearance/AppearanceInfoModule.cs | 40 +++++++++++++++++++++- 2 files changed, 51 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index d64a0c1..9df0592 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -343,12 +343,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) continue; - if (missingTexturesOnly && m_scene.AssetService.Get(face.TextureID.ToString()) != null) - continue; + if (missingTexturesOnly) + { + if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + continue; + else + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + } else + { m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.", face.TextureID, idx, sp.Name); + } sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 1ce24f1..7e15718 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -114,6 +114,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance "Send appearance data for each avatar in the simulator to other viewers.", "Optionally, you can specify that only a particular avatar's appearance data is sent.", HandleSendAppearanceCommand); + + scene.AddCommand( + this, "appearance rebake", + "appearance rebake ", + "Send a request to the user's viewer for it to rebake and reupload its appearance textures.", + "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not." + + "\nThis will only work for texture ids that the viewer has already uploaded." + + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen" + + "\nsince requests can only be made for ids that the client has already sent us", + HandleRebakeAppearanceCommand); } private void HandleSendAppearanceCommand(string module, string[] cmd) @@ -210,6 +220,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance } } } - } + } + + private void HandleRebakeAppearanceCommand(string module, string[] cmd) + { + if (cmd.Length != 4) + { + MainConsole.Instance.OutputFormat("Usage: appearance rebake "); + return; + } + + string firstname = cmd[2]; + string lastname = cmd[3]; + + lock (m_scenes) + { + foreach (Scene scene in m_scenes.Values) + { + ScenePresence sp = scene.GetScenePresence(firstname, lastname); + if (sp != null && !sp.IsChildAgent) + { + MainConsole.Instance.OutputFormat( + "Requesting rebake of uploaded textures for {0}", + sp.Name, scene.RegionInfo.RegionName); + + scene.AvatarFactory.RequestRebake(sp, false); + } + } + } + } } } \ No newline at end of file -- cgit v1.1