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). --- .../Framework/Interfaces/IAvatarFactoryModule.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'OpenSim/Region/Framework') 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 97ba3c93467e865d0434c0b2f0f775efdc0c354a Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 5 Jan 2012 08:11:52 +0000 Subject: Small fix to GetWorldPosition to get closer to Avination sit behavior --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index aea47e6..51d3586 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1960,19 +1960,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 GetWorldPosition() { Quaternion parentRot = ParentGroup.RootPart.RotationOffset; - Vector3 axPos = OffsetPosition; - axPos *= parentRot; Vector3 translationOffsetPosition = axPos; - -// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); - - Vector3 worldPos = GroupPosition + translationOffsetPosition; - -// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); - - return worldPos; + if(_parentID == 0) + return GroupPosition; + else + return ParentGroup.AbsolutePosition + translationOffsetPosition; } /// -- cgit v1.1 From c201b54b8524033310c59fe353616e84616a542e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 19:40:54 +0000 Subject: Improve "app rebake" command to return a better message if no uploaded texture ids were available for the rebake request --- OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs index 04df9c3..39a760c 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs @@ -82,7 +82,10 @@ namespace OpenSim.Region.Framework.Interfaces /// 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); + /// + /// Number of rebake requests made. This will depend upon whether we've previously received texture IDs. + /// + int RequestRebake(IScenePresence sp, bool missingTexturesOnly); void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); -- cgit v1.1 From 5ea9740f1b2cc98601cfb15c19e190471c4c42ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 22:40:49 +0000 Subject: Add a "j2k decode" region console command that allows a manual request for a JPEG2000 decode of an asset For debugging purposes. --- OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs index 856eb11..0964276 100644 --- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs +++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs @@ -35,6 +35,13 @@ namespace OpenSim.Region.Framework.Interfaces public interface IJ2KDecoder { void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback); - void Decode(UUID assetID, byte[] j2kData); + + /// + /// Provides a synchronous decode so that caller can be assured that this executes before the next line + /// + /// + /// + /// true if decode was successful. false otherwise. + bool Decode(UUID assetID, byte[] j2kData); } } -- cgit v1.1 From b86e7715a8d8f081fa9452d92a9d8f6d52867a12 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 22:54:33 +0000 Subject: Improve "j2k decode" command to tell us how many layers and components were decoded, instead of just success/failure --- OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs index 0964276..46d03b3 100644 --- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs +++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs @@ -43,5 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces /// /// true if decode was successful. false otherwise. bool Decode(UUID assetID, byte[] j2kData); + + /// + /// Provides a synchronous decode so that caller can be assured that this executes before the next line + /// + /// + /// + /// layer data + /// number of components + /// true if decode was successful. false otherwise. + bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components); } } -- cgit v1.1 From f8c15d38a614ca7fcfc78a0c2883831ea6cf8137 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 17:43:35 +0000 Subject: If dragging a script that is no copy from prim inventory into agent inventory, stop it first in scene. If deleting from prims, move to trash rather then making it poof. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 55 +++++++++++++++------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b62023b..2444367 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -979,25 +979,40 @@ namespace OpenSim.Region.Framework.Scenes public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) { SceneObjectPart part = GetSceneObjectPart(localID); - if (part == null) - return; + SceneObjectGroup group = null; + if (part != null) + { + group = part.ParentGroup; + } + if (part != null && group != null) + { + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) + return; - SceneObjectGroup group = part.ParentGroup; - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) - return; - - TaskInventoryItem item = group.GetInventoryItem(localID, itemID); - if (item == null) - return; + TaskInventoryItem item = group.GetInventoryItem(localID, itemID); + if (item == null) + return; - if (item.Type == 10) - { - part.RemoveScriptEvents(itemID); - EventManager.TriggerRemoveScript(localID, itemID); + InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); + + // Move the item to trash. If this is a copiable item, only + // a copy will be moved and we will still need to delete + // the item from the prim. If it was no copy, is will be + // deleted by this method. + MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); + + if (group.GetInventoryItem(localID, itemID) != null) + { + if (item.Type == 10) + { + part.RemoveScriptEvents(itemID); + EventManager.TriggerRemoveScript(localID, itemID); + } + + group.RemoveInventoryItem(localID, itemID); + } + part.SendPropertiesToClient(remoteClient); } - - group.RemoveInventoryItem(localID, itemID); - part.SendPropertiesToClient(remoteClient); } private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) @@ -1058,7 +1073,15 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + { + if (taskItem.Type == 10) + { + part.RemoveScriptEvents(itemId); + EventManager.TriggerRemoveScript(part.LocalId, itemId); + } + part.Inventory.RemoveInventoryItem(itemId); + } } return agentItem; -- cgit v1.1 From 7518b075b76fea062971a9e5fb716118130ebe43 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 22:35:06 +0000 Subject: Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results. --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index b65f82c..cac8479 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// The avatar appearance to use for the new NPC. /// The UUID of the ScenePresence created. - UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance); + UUID CreateNPC(string firstname, string lastname, Vector3 position, UUID owner, Scene scene, AvatarAppearance appearance); /// /// Check if the agent is an NPC. @@ -117,6 +117,13 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool DeleteNPC(UUID agentID, Scene scene); + bool DeleteNPC(UUID agentID, UUID CallerID, Scene scene); + + /// + /// Get the owner of a NPC + /// + /// The UUID of the NPC + /// UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC + UUID GetOwner(UUID agentID); } -} \ No newline at end of file +} -- cgit v1.1 From c5c079f6aa731ae6505299c11792f4d1d6ea3e88 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Jan 2012 00:17:40 +0000 Subject: Fix bug where tapping home to stop falling would stop any avatar movement other than falling again. Addresses http://opensimulator.org/mantis/view.php?id=5839 --- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 13 ++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index eda085f..ff5f731 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -223,7 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animTickFall = 0; m_animTickJump = 0; m_jumping = false; - m_falling = true; + m_falling = false; m_jumpVelocity = 0f; actor.Selected = false; m_fallHeight = actor.Position.Z; // save latest flying height @@ -238,10 +238,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation } else if (move.Z < 0f) { - if (actor != null && actor.IsColliding) - { + if (actor != null && actor.IsColliding) return "LAND"; - } else return "HOVER_DOWN"; } @@ -260,7 +258,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation float fallElapsed = (float)(Environment.TickCount - m_animTickFall); float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f; - if (!m_jumping && (fallVelocity < -3.0f) ) m_falling = true; + if (!m_jumping && (fallVelocity < -3.0f)) + m_falling = true; if (m_animTickFall == 0 || (fallVelocity >= 0.0f)) { @@ -297,9 +296,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation return "PREJUMP"; } - if(m_jumping) + if (m_jumping) { - if ( (jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding) + if ((jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding) { // end jumping m_jumping = false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 42cd4be..8ebb7a6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1274,8 +1274,8 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) { // m_log.DebugFormat( -// "[SCENE PRESENCE]: In {0} received agent update from {1}", -// Scene.RegionInfo.RegionName, remoteClient.Name); +// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", +// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); if (IsChildAgent) { @@ -2312,6 +2312,8 @@ namespace OpenSim.Region.Framework.Scenes /// The vector in which to move. This is relative to the rotation argument public void AddNewMovement(Vector3 vec) { +// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); + Vector3 direc = vec * Rotation; direc.Normalize(); -- cgit v1.1 From ba163ab05b2f05bf9a316a5f209f64992d4f9a22 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Jan 2012 00:29:55 +0000 Subject: Add method doc to SPA.Falling and use automatic private get property --- .../Scenes/Animation/ScenePresenceAnimator.cs | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index ff5f731..3584cda 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -61,11 +61,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation public bool m_jumping = false; public float m_jumpVelocity = 0f; // private int m_landing = 0; - public bool Falling - { - get { return m_falling; } - } - private bool m_falling = false; + + /// + /// Is the avatar falling? + /// + public bool Falling { get; private set; } + private float m_fallHeight; /// @@ -223,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animTickFall = 0; m_animTickJump = 0; m_jumping = false; - m_falling = false; + Falling = false; m_jumpVelocity = 0f; actor.Selected = false; m_fallHeight = actor.Position.Z; // save latest flying height @@ -259,7 +260,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f; if (!m_jumping && (fallVelocity < -3.0f)) - m_falling = true; + Falling = true; if (m_animTickFall == 0 || (fallVelocity >= 0.0f)) { @@ -289,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // Start jumping, prejump m_animTickFall = 0; m_jumping = true; - m_falling = false; + Falling = false; actor.Selected = true; // borrowed for jumping flag m_animTickJump = Environment.TickCount; m_jumpVelocity = 0.35f; @@ -302,7 +303,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation { // end jumping m_jumping = false; - m_falling = false; + Falling = false; actor.Selected = false; // borrowed for jumping flag m_jumpVelocity = 0f; m_animTickFall = Environment.TickCount; @@ -329,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (CurrentMovementAnimation == "FALLDOWN") { - m_falling = false; + Falling = false; m_animTickFall = Environment.TickCount; // TODO: SOFT_LAND support float fallHeight = m_fallHeight - actor.Position.Z; @@ -363,7 +364,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (move.X != 0f || move.Y != 0f) { m_fallHeight = actor.Position.Z; // save latest flying height - m_falling = false; + Falling = false; // Walking / crouchwalking / running if (move.Z < 0f) return "CROUCHWALK"; @@ -374,7 +375,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation } else if (!m_jumping) { - m_falling = false; + Falling = false; // Not walking if (move.Z < 0) return "CROUCH"; @@ -387,7 +388,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation } #endregion Ground Movement - m_falling = false; + Falling = false; return CurrentMovementAnimation; } -- cgit v1.1 From 266167f5a390e089f7f79d73bdaad4c853d04daa Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 8 Jan 2012 17:41:47 -0500 Subject: Fix teleport routing Route non-owner avatars according to land settings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ebb7a6..afd4813 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1180,6 +1180,23 @@ namespace OpenSim.Region.Framework.Scenes client.Name, Scene.RegionInfo.RegionName, AbsolutePosition); Vector3 look = Velocity; + + // Place avatar according to parcel owner teleport routing... + ILandObject land = Scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); + + if (land != null) + { + // Land owner should be able to land anywhere, others honor settings + if (land.LandData.OwnerID != client.AgentId) + { + if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) + { + AbsolutePosition = land.LandData.UserLocation; + look = land.LandData.UserLookAt; + } + } + } + if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) { look = new Vector3(0.99f, 0.042f, 0); -- cgit v1.1 From 44cde8d5c6dbb2a7dc55bc13d55264241e7cfa81 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Jan 2012 23:36:49 +0000 Subject: Update teleport routing to match Avination --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 74 +++++++++++++++++++----- 1 file changed, 58 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afd4813..b861c28 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -892,6 +892,8 @@ namespace OpenSim.Region.Framework.Scenes pos.Y = crossedBorder.BorderLine.Z - 1; } + CheckAndAdjustLandingPoint(ref pos); + if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) { m_log.WarnFormat( @@ -1056,6 +1058,7 @@ namespace OpenSim.Region.Framework.Scenes bool isFlying = Flying; RemoveFromPhysicalScene(); Velocity = Vector3.Zero; + CheckLandingPoint(ref pos); AbsolutePosition = pos; AddToPhysicalScene(isFlying); @@ -1066,6 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes { bool isFlying = Flying; RemoveFromPhysicalScene(); + CheckLandingPoint(ref pos); AbsolutePosition = pos; AddToPhysicalScene(isFlying); @@ -1181,22 +1185,6 @@ namespace OpenSim.Region.Framework.Scenes Vector3 look = Velocity; - // Place avatar according to parcel owner teleport routing... - ILandObject land = Scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); - - if (land != null) - { - // Land owner should be able to land anywhere, others honor settings - if (land.LandData.OwnerID != client.AgentId) - { - if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) - { - AbsolutePosition = land.LandData.UserLocation; - look = land.LandData.UserLookAt; - } - } - } - if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) { look = new Vector3(0.99f, 0.042f, 0); @@ -3820,5 +3808,59 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritization_called = false; } } + + private void CheckLandingPoint(ref Vector3 pos) + { + // Never constrain lures + if ((TeleportFlags & TeleportFlags.ViaLure) != 0) + return; + + if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) + return; + + ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); + + if (land.LandData.LandingType == (byte)LandingType.LandingPoint && + land.LandData.UserLocation != Vector3.Zero && + land.LandData.OwnerID != m_uuid && + (!m_scene.Permissions.IsGod(m_uuid)) && + (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) + { + float curr = Vector3.Distance(AbsolutePosition, pos); + if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) + pos = land.LandData.UserLocation; + else + ControllingClient.SendAlertMessage("Can't teleport closer to destination"); + } + } + + private void CheckAndAdjustLandingPoint(ref Vector3 pos) + { + ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); + if (land != null) + { + // If we come in via login, landmark or map, we want to + // honor landing points. If we come in via Lure, we want + // to ignore them. + if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || + (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0) + { + // Don't restrict gods, estate managers, or land owners to + // the TP point. This behaviour mimics agni. + if (land.LandData.LandingType == (byte)LandingType.LandingPoint && + land.LandData.UserLocation != Vector3.Zero && + GodLevel < 200 && + ((land.LandData.OwnerID != m_uuid && + (!m_scene.Permissions.IsGod(m_uuid)) && + (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0)) + { + pos = land.LandData.UserLocation; + } + } + + land.SendLandUpdateToClient(ControllingClient); + } + } } } -- cgit v1.1 From 1ebd79e4134f524f02f9c51f6b143b081eae60f4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 9 Jan 2012 00:54:59 +0000 Subject: Add the HG case to landing point checks --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b861c28..164833c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3842,7 +3842,7 @@ namespace OpenSim.Region.Framework.Scenes // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. - if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || + if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID) || (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || (m_teleportFlags & TeleportFlags.ViaLocation) != 0) { -- cgit v1.1 From 0e855fea7c8fa6e193bc840bc1710a7ff1947625 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 9 Jan 2012 01:05:19 +0000 Subject: Fix a build break --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 164833c..5695c08 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3842,7 +3842,7 @@ namespace OpenSim.Region.Framework.Scenes // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. - if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID) || + if ((m_teleportFlags & (TeleportFlags.ViaLogin | (TeleportFlags)Constants.TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | (TeleportFlags)Constants.TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID) || (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || (m_teleportFlags & TeleportFlags.ViaLocation) != 0) { -- cgit v1.1 From 34c42cdab026e5931ebad139b0b4fd959b99bf00 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 01:37:28 -0500 Subject: Fix HG teleport routing Needed to breakout the ViaHGLogin check to it's own section. For some reason it would not factor in when combined with the other teleport flag types. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5695c08..6990be1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3842,9 +3842,11 @@ namespace OpenSim.Region.Framework.Scenes // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. - if ((m_teleportFlags & (TeleportFlags.ViaLogin | (TeleportFlags)Constants.TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | (TeleportFlags)Constants.TeleportFlags.ViaHGLogin | TeleportFlags.ViaRegionID) || + if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == + (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || - (m_teleportFlags & TeleportFlags.ViaLocation) != 0) + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + ((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin)) { // Don't restrict gods, estate managers, or land owners to // the TP point. This behaviour mimics agni. -- cgit v1.1 From 43145c7f673fa038b7e3bfec468e229064c909b7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 13:07:02 -0500 Subject: Debugging HG teleport routing Add some temporary debugging to the teleport routing to get a better view of what happens when HG jumps are made. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6990be1..e3a7f3b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3836,6 +3836,24 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAndAdjustLandingPoint(ref Vector3 pos) { + // Some debugging help to show all the TeleportFlags we have... + bool HG = false; + if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) + HG = true; + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + + for (uint i = 0; i <= 30 ; i++) + { + if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) + if (HG == false) + m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); + else + m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); + } + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { -- cgit v1.1 From 3640afdd955e971502437b5663fe09199ba9ba5d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 14:31:22 -0500 Subject: Fix teleport routing for incoming HG+Owner Incoming HG owner/estate manager, etc. is routed according to the rules defined for teleports within the local grid. Left some commented debugging code inside so we can test other cases. Will remove when tings are settled in. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 37 ++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e3a7f3b..8a49f2c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3836,23 +3836,23 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAndAdjustLandingPoint(ref Vector3 pos) { - // Some debugging help to show all the TeleportFlags we have... - bool HG = false; - if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) - HG = true; - - m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); - - for (uint i = 0; i <= 30 ; i++) - { - if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) - if (HG == false) - m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); - else - m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); - } - - m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); +// // Some temporary debugging help to show all the TeleportFlags we have... +// bool HG = false; +// if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) +// HG = true; +// +// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); +// +// for (uint i = 0; i <= 30 ; i++) +// { +// if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) +// if (HG == false) +// m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); +// else +// m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); +// } +// +// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) @@ -3873,7 +3873,8 @@ namespace OpenSim.Region.Framework.Scenes GodLevel < 200 && ((land.LandData.OwnerID != m_uuid && (!m_scene.Permissions.IsGod(m_uuid)) && - (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0)) + (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0) || + ((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin)) { pos = land.LandData.UserLocation; } -- cgit v1.1 From 95345521f0316fb1800b7579c65a535ee1d8f495 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 17:04:34 -0500 Subject: TP Routing debug Fix test to checking against bitfield instead of int --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8a49f2c..0837679 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3836,15 +3836,18 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAndAdjustLandingPoint(ref Vector3 pos) { -// // Some temporary debugging help to show all the TeleportFlags we have... + // Some temporary debugging help to show all the TeleportFlags we have... // bool HG = false; // if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) // HG = true; // // m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); // -// for (uint i = 0; i <= 30 ; i++) +// uint i = 0u; +// for (int x = 0; x <= 30 ; x++, i = 1u << x) // { +// i = 1u << x; +// // if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) // if (HG == false) // m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); -- cgit v1.1 From b3a12167d6dd9cbd21c57ca103d8c3f60ba93e73 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 17:54:35 -0500 Subject: Use our TeleportFlags Switch to our TeleportFlags enum instead of LibOMV because we need to define a type for HG Logins. Also moved some debugging in ScenePresence into a function to make it simpler to enable/disable. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 48 ++++++++++++++---------- 2 files changed, 30 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 027ec96..5e1c768 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2528,7 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); m_eventManager.TriggerOnNewPresence(sp); - sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; + sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; // The first agent upon login is a root agent by design. // For this agent we will have to rez the attachments. @@ -3333,7 +3333,7 @@ namespace OpenSim.Region.Framework.Scenes { // Let the SP know how we got here. This has a lot of interesting // uses down the line. - sp.TeleportFlags = (TeleportFlags)teleportFlags; + sp.TeleportFlags = (TPFlags)teleportFlags; if (sp.IsChildAgent) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0837679..d58484e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -40,6 +40,7 @@ using OpenSim.Region.Framework.Scenes.Types; using OpenSim.Region.Physics.Manager; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; +using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; namespace OpenSim.Region.Framework.Scenes { @@ -3836,30 +3837,11 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAndAdjustLandingPoint(ref Vector3 pos) { - // Some temporary debugging help to show all the TeleportFlags we have... -// bool HG = false; -// if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) -// HG = true; -// -// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); -// -// uint i = 0u; -// for (int x = 0; x <= 30 ; x++, i = 1u << x) -// { -// i = 1u << x; -// -// if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) -// if (HG == false) -// m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); -// else -// m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); -// } -// -// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { + TeleportFlagsDebug(); // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. @@ -3886,5 +3868,31 @@ namespace OpenSim.Region.Framework.Scenes land.SendLandUpdateToClient(ControllingClient); } } + + private void TeleportFlagsDebug() { + + // Some temporary debugging help to show all the TeleportFlags we have... + bool HG = false; + if((m_teleportFlags & TeleportFlags.ViaHGLogin) == TeleportFlags.ViaHGLogin) + HG = true; + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + + uint i = 0u; + for (int x = 0; x <= 30 ; x++, i = 1u << x) + { + i = 1u << x; + + if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) + if (HG == false) + m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); + else + m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); + } + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + + } + } } -- cgit v1.1 From 707c8c6f2b7671c0a439a28921daeac8e7219639 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 9 Jan 2012 18:19:55 -0500 Subject: Add some run-time debugging support Add configuration option - DEBUG to enable debugging methods. This is temporary for helping users testing teleport routing be able to report back the data with the test cases. We can remove when finished with this, or leave it if it proves to be useful. Users: set DEBUG = true in OpenSim.ini to get more information from teleport routing. The default is false. It presently prints the TeleportFlags value. --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5e1c768..ed6f68a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,6 +65,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; + public bool DEBUG = false; public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; @@ -650,6 +651,8 @@ namespace OpenSim.Region.Framework.Scenes // IConfig startupConfig = m_config.Configs["Startup"]; + DEBUG = startupConfig.GetBoolean("DEBUG", false); + m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); if (!m_useBackup) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d58484e..1869417 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3841,7 +3841,9 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { - TeleportFlagsDebug(); + if (Scene.DEBUG) + TeleportFlagsDebug(); + // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. -- cgit v1.1 From 3deb52d3996b45228c2301ecc7445514099f3b13 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 10 Jan 2012 13:41:35 -0500 Subject: Teleport Debugging Move setting from ini to existing facitilies - thanks justincc toggle with console command: debug teleport --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ed6f68a..f03c345 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -651,8 +651,6 @@ namespace OpenSim.Region.Framework.Scenes // IConfig startupConfig = m_config.Configs["Startup"]; - DEBUG = startupConfig.GetBoolean("DEBUG", false); - m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); if (!m_useBackup) -- cgit v1.1 From 7b84942f868a0c0d54a9ccb3627434cbf0e91417 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Jan 2012 11:10:47 -0800 Subject: HG landing points: this hopefully fixes some confusion that was making HG avies always land in 0,0 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1869417..3c9bde8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3851,17 +3851,18 @@ namespace OpenSim.Region.Framework.Scenes (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || - ((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin)) + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) { // Don't restrict gods, estate managers, or land owners to // the TP point. This behaviour mimics agni. if (land.LandData.LandingType == (byte)LandingType.LandingPoint && land.LandData.UserLocation != Vector3.Zero && GodLevel < 200 && - ((land.LandData.OwnerID != m_uuid && - (!m_scene.Permissions.IsGod(m_uuid)) && - (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0) || - ((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin)) + ((land.LandData.OwnerID != m_uuid && + !m_scene.Permissions.IsGod(m_uuid) && + !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) { pos = land.LandData.UserLocation; } -- cgit v1.1 From 38db87475528f48752623fcb7e8b40ef728f50e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Jan 2012 14:33:26 +0000 Subject: If deserializing a scene object fails during IAR load then ignore the object rather than halting the IAR load with an exception. --- OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index bca49f7..38d1231 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// Deserialize a scene object from the original xml format /// /// - /// + /// The scene object deserialized. Null on failure. public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) { //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); -- cgit v1.1 From 8bdd80abfa3830142b16615d97d555dad417e08d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 12 Jan 2012 09:56:35 -0800 Subject: HG: normalize all externalized user ULRs to be the Home URL, i.e. the location of the user's UAS. This corrects an earlier design which had some cases pointing to the profile server. WARNING: CONFIGURATION CHANGES in both the sims (*Common.ini) and the Robust configs (Robust.HG.ini). Please check diff of the example files, but basically all vars that were pointing to profile should point to the UAS instead and should be called HomeURI. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 51d3586..e9c33eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes private string m_creatorData = string.Empty; /// - /// Data about the creator in the form profile_url;name + /// Data about the creator in the form home_url;name /// public string CreatorData { @@ -405,7 +405,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Used by the DB layer to retrieve / store the entire user identification. /// The identification can either be a simple UUID or a string of the form - /// uuid[;profile_url[;name]] + /// uuid[;home_url[;name]] /// public string CreatorIdentification { diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 38d1231..7c60ddd 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1134,12 +1134,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (sop.CreatorData != null && sop.CreatorData != string.Empty) writer.WriteElementString("CreatorData", sop.CreatorData); - else if (options.ContainsKey("profile")) + else if (options.ContainsKey("home")) { if (m_UserManagement == null) m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface(); string name = m_UserManagement.GetUserName(sop.CreatorID); - writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); + writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); } WriteUUID(writer, "FolderID", sop.FolderID, options); @@ -1282,12 +1282,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (item.CreatorData != null && item.CreatorData != string.Empty) writer.WriteElementString("CreatorData", item.CreatorData); - else if (options.ContainsKey("profile")) + else if (options.ContainsKey("home")) { if (m_UserManagement == null) m_UserManagement = scene.RequestModuleInterface(); string name = m_UserManagement.GetUserName(item.CreatorID); - writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); + writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); } writer.WriteElementString("Description", item.Description); -- cgit v1.1 From b47c0d7e51bdb4d4bfa34f0952593f94c657d19c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jan 2012 18:14:19 +0000 Subject: refactor: Move existing npc owner checks to NPCModule.CheckPermissions() methods and expose on interface for external calls. --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index cac8479..3ec1bda 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -53,6 +53,14 @@ namespace OpenSim.Region.Framework.Interfaces bool IsNPC(UUID agentID, Scene scene); /// + /// Check if the caller has permission to manipulate the given NPC. + /// + /// + /// + /// true if they do, false if they don't or if there's no NPC with the given ID. + bool CheckPermissions(UUID npcID, UUID callerID); + + /// /// Set the appearance for an NPC. /// /// -- cgit v1.1 From cadd645076eacd6bd0b70a665ed3f5157cd6e5d3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 12 Jan 2012 10:22:52 -0800 Subject: Renamed one var and deleted commented code. No functional changes. --- OpenSim/Region/Framework/Interfaces/IUserManagement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 54dfaf4..4f62e28 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void AddUser(UUID uuid, string firstName, string lastName, string profileURL); + void AddUser(UUID uuid, string firstName, string lastName, string homeURL); bool IsLocalGridUser(UUID uuid); } -- cgit v1.1 From ba3491c76e2d7cc7187a025dccd782790929f0b7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jan 2012 19:06:46 +0000 Subject: Add permissions checks for owned avatars to all other osNpc* functions. This is being done outside the npc module since the check is meaningless for region module callers, who can fake any id that they like. --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 3ec1bda..c50e734 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool DeleteNPC(UUID agentID, UUID CallerID, Scene scene); + bool DeleteNPC(UUID agentID, Scene scene); /// /// Get the owner of a NPC -- cgit v1.1 From d40ec1c346d4b5f5999218bf1cbffe9cee1ea992 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 12 Jan 2012 20:49:50 -0500 Subject: Move some interfaces to a more apropriate place --- .../Region/Framework/Interfaces/IProfileModule.cs | 37 ++++++++++++++++++++++ .../Region/Framework/Interfaces/ISearchModule.cs | 36 +++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 OpenSim/Region/Framework/Interfaces/IProfileModule.cs create mode 100644 OpenSim/Region/Framework/Interfaces/ISearchModule.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IProfileModule.cs b/OpenSim/Region/Framework/Interfaces/IProfileModule.cs new file mode 100644 index 0000000..ef03d4a --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IProfileModule.cs @@ -0,0 +1,37 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface IProfileModule + { + void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID); + + } +} diff --git a/OpenSim/Region/Framework/Interfaces/ISearchModule.cs b/OpenSim/Region/Framework/Interfaces/ISearchModule.cs new file mode 100644 index 0000000..64bf72c --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISearchModule.cs @@ -0,0 +1,36 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface ISearchModule + { + + } +} -- cgit v1.1 From c5594e839e55beb72f9132ebe29a877f62f99138 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 12 Jan 2012 21:19:31 -0500 Subject: Undo some prior work Move some added fuctions out of core into the addon module to keep things clean --- OpenSim/Region/Framework/Interfaces/IUserManagement.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 4f62e28..bfb8369 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -14,9 +14,6 @@ namespace OpenSim.Region.Framework.Interfaces string GetUserHomeURL(UUID uuid); string GetUserUUI(UUID uuid); string GetUserServerURL(UUID uuid, string serverType); - int GetUserFlags(UUID userID); - int GetUserCreated(UUID userID); - string GetUserTitle(UUID userID); /// /// Add a user. -- cgit v1.1 From 57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 13 Jan 2012 11:35:44 -0500 Subject: Update RegionReadyModule Fix triggering of alerts when rezzing first script to an empty region, add login disable when loading oars. --- .../Framework/Interfaces/IRegionReadyModule.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs new file mode 100644 index 0000000..aa4a757 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs @@ -0,0 +1,38 @@ +/* + * 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; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IRegionReadyModule + { + void OarLoadingAlert(string msg); + } +} + -- cgit v1.1 From e1a2c44ebe8f10cf00a14578e44b000ff16b68df Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 13 Jan 2012 14:48:56 -0800 Subject: Cleaned up the LookAt code in SOP and SOG. Added support for incrementally rotating physical objects. This does not use physics. Currently the rate of change is determined as 1 / (PI * Strength). --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 6 -- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 69 ++++++++++------------ 2 files changed, 30 insertions(+), 45 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8860764..cad09b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1613,12 +1613,6 @@ namespace OpenSim.Region.Framework.Scenes RootPart.PhysActor.PIDActive = false; } - public void stopLookAt() - { - if (RootPart.PhysActor != null) - RootPart.PhysActor.APIDActive = false; - } - /// /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e9c33eb..ad3bcd5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -217,11 +217,10 @@ namespace OpenSim.Region.Framework.Scenes public Quaternion SpinOldOrientation = Quaternion.Identity; - public Quaternion m_APIDTarget = Quaternion.Identity; - - public float m_APIDDamp = 0; - - public float m_APIDStrength = 0; + protected int m_APIDIterations = 0; + protected Quaternion m_APIDTarget = Quaternion.Identity; + protected float m_APIDDamp = 0; + protected float m_APIDStrength = 0; /// /// This part's inventory @@ -563,22 +562,21 @@ namespace OpenSim.Region.Framework.Scenes } } - - public Quaternion APIDTarget + protected Quaternion APIDTarget { get { return m_APIDTarget; } set { m_APIDTarget = value; } } - public float APIDDamp + protected float APIDDamp { get { return m_APIDDamp; } set { m_APIDDamp = value; } } - public float APIDStrength + protected float APIDStrength { get { return m_APIDStrength; } set { m_APIDStrength = value; } @@ -2697,11 +2695,6 @@ namespace OpenSim.Region.Framework.Scenes public void RotLookAt(Quaternion target, float strength, float damping) { - rotLookAt(target, strength, damping); - } - - public void rotLookAt(Quaternion target, float strength, float damping) - { if (ParentGroup.IsAttachment) { /* @@ -2716,17 +2709,26 @@ namespace OpenSim.Region.Framework.Scenes APIDDamp = damping; APIDStrength = strength; APIDTarget = target; + + if (APIDStrength <= 0) + { + m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength); + return; + } + + m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); } + + // Necessary to get the lookat deltas applied + ParentGroup.QueueForUpdateCheck(); } - public void startLookAt(Quaternion rot, float damp, float strength) + public void StartLookAt(Quaternion target, float strength, float damping) { - APIDDamp = damp; - APIDStrength = strength; - APIDTarget = rot; + RotLookAt(target,strength,damping); } - public void stopLookAt() + public void StopLookAt() { APIDTarget = Quaternion.Identity; } @@ -3417,13 +3419,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void StopLookAt() - { - ParentGroup.stopLookAt(); - - ParentGroup.ScheduleGroupForTerseUpdate(); - } - /// /// Set the text displayed for this part. /// @@ -4731,24 +4726,20 @@ namespace OpenSim.Region.Framework.Scenes { if (APIDTarget != Quaternion.Identity) { - if (Single.IsNaN(APIDTarget.W) == true) + if (m_APIDIterations <= 1) { + UpdateRotation(APIDTarget); APIDTarget = Quaternion.Identity; return; } - Quaternion rot = RotationOffset; - Quaternion dir = (rot - APIDTarget); - float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); - if (dir.Z > speed) - { - rot.Z -= speed; - } - if (dir.Z < -speed) - { - rot.Z += speed; - } - rot.Normalize(); + + Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); UpdateRotation(rot); + + m_APIDIterations--; + + // This ensures that we'll check this object on the next iteration + ParentGroup.QueueForUpdateCheck(); } } catch (Exception ex) -- cgit v1.1 From b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 14 Jan 2012 00:23:11 +0000 Subject: Register the UrlModule for script engine events OnScriptRemoved and OnObjectRemoved just once in the UrlModule itself, rather than repeatedly for every script. Doing this in every script is unnecessary since the event trigger is parameterized by the item id. All that would happen is 2000 scripts would trigger 1999 unnecessary calls, and a large number of initialized scripts may eventually trigger a StackOverflowException. Registration moved to UrlModule so that the handler is registered for all script engine implementations. This required moving the OnScriptRemoved and OnObjectRemoved events (only used by UrlModule in core) from IScriptEngine to IScriptModule to avoid circular references. --- OpenSim/Region/Framework/Interfaces/IScriptModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 950e4b0..18c45dd 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs @@ -31,8 +31,21 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { + public delegate void ScriptRemoved(UUID script); + public delegate void ObjectRemoved(UUID prim); + public interface IScriptModule: INonSharedRegionModule { + /// + /// Triggered when a script is removed from the script module. + /// + event ScriptRemoved OnScriptRemoved; + + /// + /// Triggered when an object is removed via the script module. + /// + event ObjectRemoved OnObjectRemoved; + string ScriptEngineName { get; } string GetXMLState(UUID itemID); -- cgit v1.1 From 82ad9d4e04867b23b4c824c4eca7402bf476f0b7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Jan 2012 22:58:58 +0000 Subject: Remove monocov and other obsolete nant build targets. monocov was a code coverage attempt 3 years ago which no longer works. other removed targets have been commented out or unused for a very long time --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3c9bde8..230cf91 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Framework.Scenes m_callbackURI = null; } - //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); + m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ValidateAndSendAppearanceAndAgentData(); -- cgit v1.1 From 59a0c50d48100527d00ea87935fdc24055249ba5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Jan 2012 23:04:08 +0000 Subject: Comment out noisy log lines I accidentally included in the nant build target adjustment commit. Left in the method doc. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 230cf91..c66f30e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Framework.Scenes m_callbackURI = null; } - m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); +// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ValidateAndSendAppearanceAndAgentData(); -- cgit v1.1 From 855d3a3ba5cdbd45997abac0f744488854583443 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 04:06:37 +0000 Subject: Teleport routing, part 1 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c66f30e..5c56150 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3835,8 +3835,61 @@ namespace OpenSim.Region.Framework.Scenes } } + private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) + { + if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == + (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || + (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) + { + if (GodLevel < 200 && + ((!m_scene.Permissions.IsGod(m_uuid) && + !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) + { + SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); + if (spawnPoints.Length == 0) + return; + + float distance = 9999; + int closest = -1; + + for (int i = 0 ; i < spawnPoints.Length ; i++) + { + Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + Vector3 offset = spawnPosition - pos; + float d = Vector3.Mag(offset); + if (d >= distance) + continue; + ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); + if (land == null) + continue; + if (land.IsEitherBannedOrRestricted(UUID)) + continue; + distance = d; + closest = i; + } + if (closest == -1) + return; + + pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + } + } + private void CheckAndAdjustLandingPoint(ref Vector3 pos) { + SceneObjectGroup telehub = null; + if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) + { + if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) + { + CheckAndAdjustTelehub(telehub, ref pos); + return; + } + } ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) -- cgit v1.1 From 488fe0ae9c8cadd1abe4a643f61a6a9c7e18e34d Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 24 Jan 2012 13:41:26 -0800 Subject: Removed unused events in SceneGraph: OnObjectCreate, OnObjectRemove, OnObjectDuplicate --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1e2901b..1af8346 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -60,10 +60,6 @@ namespace OpenSim.Region.Framework.Scenes protected internal event PhysicsCrash UnRecoverableError; private PhysicsCrash handlerPhysicsCrash = null; - public event ObjectDuplicateDelegate OnObjectDuplicate; - public event ObjectCreateDelegate OnObjectCreate; - public event ObjectDeleteDelegate OnObjectRemove; - #endregion #region Fields @@ -404,9 +400,6 @@ namespace OpenSim.Region.Framework.Scenes if (attachToBackup) sceneObject.AttachToBackup(); - if (OnObjectCreate != null) - OnObjectCreate(sceneObject); - lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; @@ -455,9 +448,6 @@ namespace OpenSim.Region.Framework.Scenes if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) RemovePhysicalPrim(grp.PrimCount); } - - if (OnObjectRemove != null) - OnObjectRemove(Entities[uuid]); lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID.Remove(grp.UUID); @@ -1979,9 +1969,6 @@ namespace OpenSim.Region.Framework.Scenes // required for physics to update it's position copy.AbsolutePosition = copy.AbsolutePosition; - if (OnObjectDuplicate != null) - OnObjectDuplicate(original, copy); - return copy; } } -- cgit v1.1 From 3d1f43046dd4d33c54e31ab103cd0866c8f417ac Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 24 Jan 2012 17:05:53 -0800 Subject: Removed unused delegates in SceneGraph: ObjectDuplicateDelegate, ObjectCreateDelegate, ObjectDeleteDelegate --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1af8346..7f18140 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -41,12 +41,6 @@ namespace OpenSim.Region.Framework.Scenes { public delegate void PhysicsCrash(); - public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone); - - public delegate void ObjectCreateDelegate(EntityBase obj); - - public delegate void ObjectDeleteDelegate(EntityBase obj); - /// /// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components /// should be migrated out over time. -- cgit v1.1 From 2de3a1b9dad25855cb18a29f2c43ad67cfb0730c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jan 2012 23:22:07 +0000 Subject: refactor: decompose most of RezScript() into RezScriptFromAgentInventory(), RezNewScript() and rename one RezScript() to RezScriptFromPrim() --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 174 +++++++++++---------- 1 file changed, 95 insertions(+), 79 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2444367..f4f37ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1560,104 +1560,120 @@ namespace OpenSim.Region.Framework.Scenes /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory /// /// - /// + /// + /// /// public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) { - UUID itemID = itemBase.ID; + if (itemBase.ID != UUID.Zero) + RezScriptFromAgentInventory(remoteClient, itemBase.ID, localID); + else + RezNewScript(remoteClient, itemBase); + } + + /// + /// Rez a script into a prim from an agent inventory. + /// + /// + /// + /// + public void RezScriptFromAgentInventory(IClientAPI remoteClient, UUID fromItemID, uint localID) + { UUID copyID = UUID.Random(); + InventoryItemBase item = new InventoryItemBase(fromItemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); - if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory + // Try library + // XXX clumsy, possibly should be one call + if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) { - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); - - // Try library - // XXX clumsy, possibly should be one call - if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) - { - item = LibraryService.LibraryRootFolder.FindItem(itemID); - } + item = LibraryService.LibraryRootFolder.FindItem(fromItemID); + } - if (item != null) + if (item != null) + { + SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null) { - SceneObjectPart part = GetSceneObjectPart(localID); - if (part != null) - { - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) - return; + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) + return; - part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); - // TODO: switch to posting on_rez here when scripts - // have state in inventory - part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); + part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); + // TODO: switch to posting on_rez here when scripts + // have state in inventory + part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); - // m_log.InfoFormat("[PRIMINVENTORY]: " + - // "Rezzed script {0} into prim local ID {1} for user {2}", - // item.inventoryName, localID, remoteClient.Name); - part.SendPropertiesToClient(remoteClient); - part.ParentGroup.ResumeScripts(); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Could not rez script {0} into prim local ID {1} for user {2}" - + " because the prim could not be found in the region!", - item.Name, localID, remoteClient.Name); - } + // m_log.InfoFormat("[PRIMINVENTORY]: " + + // "Rezzed script {0} into prim local ID {1} for user {2}", + // item.inventoryName, localID, remoteClient.Name); + part.SendPropertiesToClient(remoteClient); + part.ParentGroup.ResumeScripts(); } else { m_log.ErrorFormat( - "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", - itemID, remoteClient.Name); + "[PRIM INVENTORY]: " + + "Could not rez script {0} into prim local ID {1} for user {2}" + + " because the prim could not be found in the region!", + item.Name, localID, remoteClient.Name); } } - else // script has been rezzed directly into a prim's inventory + else { - SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); - if (part == null) - return; + m_log.ErrorFormat( + "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", + fromItemID, remoteClient.Name); + } + } - if (!Permissions.CanCreateObjectInventory( - itemBase.InvType, part.UUID, remoteClient.AgentId)) - return; + /// + /// Rez a new script from nothing. + /// + /// + /// + public void RezNewScript(IClientAPI remoteClient, InventoryItemBase itemBase) + { + SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); + if (part == null) + return; - AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, - Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), - remoteClient.AgentId); - AssetService.Store(asset); - - TaskInventoryItem taskItem = new TaskInventoryItem(); - - taskItem.ResetIDs(itemBase.Folder); - taskItem.ParentID = itemBase.Folder; - taskItem.CreationDate = (uint)itemBase.CreationDate; - taskItem.Name = itemBase.Name; - taskItem.Description = itemBase.Description; - taskItem.Type = itemBase.AssetType; - taskItem.InvType = itemBase.InvType; - taskItem.OwnerID = itemBase.Owner; - taskItem.CreatorID = itemBase.CreatorIdAsUuid; - taskItem.BasePermissions = itemBase.BasePermissions; - taskItem.CurrentPermissions = itemBase.CurrentPermissions; - taskItem.EveryonePermissions = itemBase.EveryOnePermissions; - taskItem.GroupPermissions = itemBase.GroupPermissions; - taskItem.NextPermissions = itemBase.NextPermissions; - taskItem.GroupID = itemBase.GroupID; - taskItem.GroupPermissions = 0; - taskItem.Flags = itemBase.Flags; - taskItem.PermsGranter = UUID.Zero; - taskItem.PermsMask = 0; - taskItem.AssetID = asset.FullID; - - part.Inventory.AddInventoryItem(taskItem, false); - part.SendPropertiesToClient(remoteClient); + if (!Permissions.CanCreateObjectInventory( + itemBase.InvType, part.UUID, remoteClient.AgentId)) + return; - part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); - part.ParentGroup.ResumeScripts(); - } + AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, + Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), + remoteClient.AgentId); + AssetService.Store(asset); + + TaskInventoryItem taskItem = new TaskInventoryItem(); + + taskItem.ResetIDs(itemBase.Folder); + taskItem.ParentID = itemBase.Folder; + taskItem.CreationDate = (uint)itemBase.CreationDate; + taskItem.Name = itemBase.Name; + taskItem.Description = itemBase.Description; + taskItem.Type = itemBase.AssetType; + taskItem.InvType = itemBase.InvType; + taskItem.OwnerID = itemBase.Owner; + taskItem.CreatorID = itemBase.CreatorIdAsUuid; + taskItem.BasePermissions = itemBase.BasePermissions; + taskItem.CurrentPermissions = itemBase.CurrentPermissions; + taskItem.EveryonePermissions = itemBase.EveryOnePermissions; + taskItem.GroupPermissions = itemBase.GroupPermissions; + taskItem.NextPermissions = itemBase.NextPermissions; + taskItem.GroupID = itemBase.GroupID; + taskItem.GroupPermissions = 0; + taskItem.Flags = itemBase.Flags; + taskItem.PermsGranter = UUID.Zero; + taskItem.PermsMask = 0; + taskItem.AssetID = asset.FullID; + + part.Inventory.AddInventoryItem(taskItem, false); + part.SendPropertiesToClient(remoteClient); + + part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); + part.ParentGroup.ResumeScripts(); } /// @@ -1666,7 +1682,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) + public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) { TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); -- cgit v1.1 From 55c6cbabfd04599030548983f376f60acdf607e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Jan 2012 00:10:37 +0000 Subject: refactor: change RezScriptFromAgentInventory(), RezNewScript() and AddInventoryItem() to accept an agent id rather than a full IClientAPI. This stops some code having to make spurious client == null checks and reduces regression test complexity. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 50 +++++++++++++--------- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 15 ++----- 2 files changed, 34 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f4f37ac..9293aeb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1444,7 +1444,7 @@ namespace OpenSim.Region.Framework.Scenes // If we've found the item in the user's inventory or in the library if (item != null) { - part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); + part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); m_log.InfoFormat( "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", item.Name, primLocalID, remoteClient.Name); @@ -1565,22 +1565,28 @@ namespace OpenSim.Region.Framework.Scenes /// public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) { + SceneObjectPart partWhereRezzed; + if (itemBase.ID != UUID.Zero) - RezScriptFromAgentInventory(remoteClient, itemBase.ID, localID); + partWhereRezzed = RezScriptFromAgentInventory(remoteClient.AgentId, itemBase.ID, localID); else - RezNewScript(remoteClient, itemBase); + partWhereRezzed = RezNewScript(remoteClient.AgentId, itemBase); + + if (partWhereRezzed != null) + partWhereRezzed.SendPropertiesToClient(remoteClient); } /// /// Rez a script into a prim from an agent inventory. /// - /// + /// /// /// - public void RezScriptFromAgentInventory(IClientAPI remoteClient, UUID fromItemID, uint localID) + /// The part where the script was rezzed if successful. False otherwise. + public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID) { UUID copyID = UUID.Random(); - InventoryItemBase item = new InventoryItemBase(fromItemID, remoteClient.AgentId); + InventoryItemBase item = new InventoryItemBase(fromItemID, agentID); item = InventoryService.GetItem(item); // Try library @@ -1595,10 +1601,10 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) { - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) - return; + if (!Permissions.CanEditObjectInventory(part.UUID, agentID)) + return null; - part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); + part.ParentGroup.AddInventoryItem(agentID, localID, item, copyID); // TODO: switch to posting on_rez here when scripts // have state in inventory part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); @@ -1606,8 +1612,9 @@ namespace OpenSim.Region.Framework.Scenes // m_log.InfoFormat("[PRIMINVENTORY]: " + // "Rezzed script {0} into prim local ID {1} for user {2}", // item.inventoryName, localID, remoteClient.Name); - part.SendPropertiesToClient(remoteClient); part.ParentGroup.ResumeScripts(); + + return part; } else { @@ -1615,15 +1622,17 @@ namespace OpenSim.Region.Framework.Scenes "[PRIM INVENTORY]: " + "Could not rez script {0} into prim local ID {1} for user {2}" + " because the prim could not be found in the region!", - item.Name, localID, remoteClient.Name); + item.Name, localID, agentID); } } else { m_log.ErrorFormat( "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", - fromItemID, remoteClient.Name); + fromItemID, agentID); } + + return null; } /// @@ -1631,19 +1640,20 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void RezNewScript(IClientAPI remoteClient, InventoryItemBase itemBase) + /// The part where the script was rezzed if successful. False otherwise. + public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) { + // The part ID is the folder ID! SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); if (part == null) - return; + return null; - if (!Permissions.CanCreateObjectInventory( - itemBase.InvType, part.UUID, remoteClient.AgentId)) - return; + if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID)) + return null; AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), - remoteClient.AgentId); + agentID); AssetService.Store(asset); TaskInventoryItem taskItem = new TaskInventoryItem(); @@ -1670,10 +1680,10 @@ namespace OpenSim.Region.Framework.Scenes taskItem.AssetID = asset.FullID; part.Inventory.AddInventoryItem(taskItem, false); - part.SendPropertiesToClient(remoteClient); - part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); part.ParentGroup.ResumeScripts(); + + return part; } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 905ecc9..f173c95 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -83,13 +83,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// Add an inventory item from a user's inventory to a prim in this scene object. /// - /// The client adding the item. + /// The agent adding the item. /// The local ID of the part receiving the add. /// The user inventory item being added. /// The item UUID that should be used by the new item. /// - public bool AddInventoryItem(IClientAPI remoteClient, uint localID, - InventoryItemBase item, UUID copyItemID) + public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID) { // m_log.DebugFormat( // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", @@ -111,9 +110,7 @@ namespace OpenSim.Region.Framework.Scenes taskItem.Type = item.AssetType; taskItem.InvType = item.InvType; - if (remoteClient != null && - remoteClient.AgentId != part.OwnerID && - m_scene.Permissions.PropagatePermissions()) + if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) { taskItem.BasePermissions = item.BasePermissions & item.NextPermissions; @@ -148,11 +145,7 @@ namespace OpenSim.Region.Framework.Scenes // taskItem.SaleType = item.SaleType; taskItem.CreationDate = (uint)item.CreationDate; - bool addFromAllowedDrop = false; - if (remoteClient != null) - { - addFromAllowedDrop = remoteClient.AgentId != part.OwnerID; - } + bool addFromAllowedDrop = agentID != part.OwnerID; part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); -- cgit v1.1 From 093469c33c2e2ac10d41cf4daadac3c7fd7ff40c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Jan 2012 01:16:03 +0000 Subject: Add basic TestAddScript() regression test --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 11 ++++ .../Scenes/Tests/SceneObjectScriptTests.cs | 76 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9293aeb..f344dcc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1646,10 +1646,21 @@ namespace OpenSim.Region.Framework.Scenes // The part ID is the folder ID! SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); if (part == null) + { +// m_log.DebugFormat( +// "[SCENE INVENTORY]: Could not find part with id {0} for {1} to rez new script", +// itemBase.Folder, agentID); + return null; + } if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID)) + { +// m_log.DebugFormat( +// "[SCENE INVENTORY]: No permission to create new script in {0} for {1}", part.Name, agentID); + return null; + } AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs new file mode 100644 index 0000000..6f99abd --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs @@ -0,0 +1,76 @@ +/* + * 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 System.Reflection; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + [TestFixture] + public class SceneObjectScriptTests + { + [Test] + public void TestAddScript() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = TestHelpers.ParseTail(0x1); + UUID itemId = TestHelpers.ParseTail(0x2); + string itemName = "Test Script Item"; + + Scene scene = SceneHelpers.SetupScene(); + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + scene.AddNewSceneObject(so, true); + + InventoryItemBase itemTemplate = new InventoryItemBase(); + itemTemplate.Name = itemName; + itemTemplate.Folder = so.UUID; + itemTemplate.InvType = (int)InventoryType.LSL; + + SceneObjectPart partWhereScriptAdded = scene.RezNewScript(userId, itemTemplate); + + Assert.That(partWhereScriptAdded, Is.Not.Null); + + IEntityInventory primInventory = partWhereScriptAdded.Inventory; + Assert.That(primInventory.GetInventoryList().Count, Is.EqualTo(1)); + Assert.That(primInventory.ContainsScripts(), Is.True); + + IList primItems = primInventory.GetInventoryItems(itemName); + Assert.That(primItems.Count, Is.EqualTo(1)); + } + } +} \ No newline at end of file -- cgit v1.1 From da720ce9be7d050ad2ff26c97490ebd4e17be2cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 26 Jan 2012 10:21:45 +0000 Subject: Support rejecting a teleport if a user is banned in all parcels that have spawn points --- OpenSim/Region/Framework/Scenes/Scene.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f03c345..984058c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5067,6 +5067,36 @@ namespace OpenSim.Region.Framework.Scenes } } + if (position == Vector3.Zero) // Teleport + { + if (!RegionInfo.EstateSettings.AllowDirectTeleport) + { + SceneObjectGroup telehub; + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject)) != null) + { + List spawnPoints = RegionInfo.RegionSettings.SpawnPoints(); + bool banned = true; + foreach (SpawnPoint sp in spawnPoints) + { + Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); + if (land == null) + continue; + if (land.IsEitherBannedOrRestricted(agentID)) + continue; + banned = false; + break; + } + + if (banned) + { + reason = "No suitable landing point found"; + return false; + } + } + } + } + reason = String.Empty; return true; } -- cgit v1.1 From 9939f94f08b33e3dd9eeea65b730f0ddc80275a5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Jan 2012 23:05:48 +0000 Subject: Implement osNpcGetOwner(key npc):key. This returns the owner for an 'owned' NPC, the npc's own key for an 'unowned' NPC and NULL_KEY is the input key was not an npc. llGetOwnerKey() could also be extended but this does not allow one to distinguish between an unowned NPC and some other result (e.g. 'no such object' if NULL_KEY is the return. Also, any future extensions to LSL functions by Linden Lab are unpredictable and OpenSim-specific extensions could clash. --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index c50e734..b428c40 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -134,4 +134,4 @@ namespace OpenSim.Region.Framework.Interfaces /// UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC UUID GetOwner(UUID agentID); } -} +} \ No newline at end of file -- cgit v1.1 From 7837c611fb483dc776b531306d3d791e8f177aab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Jan 2012 00:00:12 +0000 Subject: Add OS_NPC_SENSE_AS_AGENT option to osNpcCreate(). This allows NPCs to be sensed as agents by LSL sensors rather than as a specific NPC type (which is currently an OpenSimulator-only extension). Wiki doc on this and other recent NPC functions will follow soon --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 34 ++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index b428c40..2731291 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -31,6 +31,19 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces { + /// + /// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than + /// controlling purely through module level interface calls (e.g. sit/stand). + /// + public interface INPC + { + /// + /// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user) + /// rather than an OpenSim specific NPC extension? + /// + bool SenseAsAgent { get; } + } + public interface INPCModule { /// @@ -39,10 +52,21 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// + /// + /// Make the NPC show up as an agent on LSL sensors. The default is that they + /// show up as the NPC type instead, but this is currently an OpenSim-only extension. + /// /// /// The avatar appearance to use for the new NPC. /// The UUID of the ScenePresence created. - UUID CreateNPC(string firstname, string lastname, Vector3 position, UUID owner, Scene scene, AvatarAppearance appearance); + UUID CreateNPC( + string firstname, + string lastname, + Vector3 position, + UUID owner, + bool senseAsAgent, + Scene scene, + AvatarAppearance appearance); /// /// Check if the agent is an NPC. @@ -53,6 +77,14 @@ namespace OpenSim.Region.Framework.Interfaces bool IsNPC(UUID agentID, Scene scene); /// + /// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface + /// + /// + /// + /// The NPC. null if it does not exist. + INPC GetNPC(UUID agentID, Scene scene); + + /// /// Check if the caller has permission to manipulate the given NPC. /// /// -- cgit v1.1 From deeb7287a204af34caa24e7b221222de2fb3583b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Jan 2012 00:39:53 +0000 Subject: Comment out xfer section in Scene.UpdateTaskInventory() which was causing spurious errors and "script saved" messages when script properties were changed. Viewers since at least Linden Lab 1.23 use the script upload capability to save script changes. It's unknown whether the commented out code was working for very old viewers or not. Code is commented out to reduce complexity and so that useful error messages don't need to be removed. If there is a substantial population using extremely old viewers that can't upgrade to a newer version 1 viewer (e.g. 1.23) or similar TPV then this can be revisited. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f344dcc..dd3208a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1472,20 +1472,27 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", // currentItem.Name, part.Name); - - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); - if (agentTransactions != null) - { - agentTransactions.HandleTaskItemUpdateFromTransaction( - remoteClient, part, transactionID, currentItem); - if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) - remoteClient.SendAgentAlertMessage("Notecard saved", false); - else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) - remoteClient.SendAgentAlertMessage("Script saved", false); - else - remoteClient.SendAgentAlertMessage("Item saved", false); - } + // Viewers from at least Linden Lab 1.23 onwards use a capability to update script contents rather + // than UDP. With viewers from at least 1.23 onwards, changing properties on scripts (e.g. renaming) causes + // this to spew spurious errors and "thing saved" messages. + // Rather than retaining complexity in the code and removing useful error messages, I'm going to + // comment this section out. If this was still working for very old viewers and there is + // a large population using them which cannot upgrade to 1.23 or derivatives then we can revisit + // this - justincc +// IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); +// if (agentTransactions != null) +// { +// agentTransactions.HandleTaskItemUpdateFromTransaction( +// remoteClient, part, transactionID, currentItem); +// +// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) +// remoteClient.SendAgentAlertMessage("Notecard saved", false); +// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) +// remoteClient.SendAgentAlertMessage("Script saved", false); +// else +// remoteClient.SendAgentAlertMessage("Item saved", false); +// } // Base ALWAYS has move currentItem.BasePermissions |= (uint)PermissionMask.Move; -- cgit v1.1 From 154ba0124aaf0836ee50bce81a3441be6d11f06a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Jan 2012 02:21:41 +0000 Subject: Add experimental --publish option to "save oar" so that OARs reloaded to the same grid don't have the publisher as owner. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++++ .../Scenes/Serialization/SceneObjectSerializer.cs | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index cad09b8..739c5fa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -441,6 +441,12 @@ namespace OpenSim.Region.Framework.Scenes } } + public UUID LastOwnerID + { + get { return m_rootPart.LastOwnerID; } + set { m_rootPart.LastOwnerID = value; } + } + public UUID OwnerID { get { return m_rootPart.OwnerID; } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7c60ddd..3a08271 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1192,8 +1192,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); WriteUUID(writer, "GroupID", sop.GroupID, options); - WriteUUID(writer, "OwnerID", sop.OwnerID, options); - WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options); + + UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; + WriteUUID(writer, "OwnerID", ownerID, options); + + UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; + WriteUUID(writer, "LastOwnerID", lastOwnerID, options); + writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); @@ -1277,7 +1282,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); writer.WriteElementString("CreationDate", item.CreationDate.ToString()); - WriteUUID(writer, "CreatorID", item.CreatorID, options); if (item.CreatorData != null && item.CreatorData != string.Empty) @@ -1298,10 +1302,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("InvType", item.InvType.ToString()); WriteUUID(writer, "ItemID", item.ItemID, options); WriteUUID(writer, "OldItemID", item.OldItemID, options); - WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options); + + UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID; + WriteUUID(writer, "LastOwnerID", lastOwnerID, options); + writer.WriteElementString("Name", item.Name); writer.WriteElementString("NextPermissions", item.NextPermissions.ToString()); - WriteUUID(writer, "OwnerID", item.OwnerID, options); + + UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID; + WriteUUID(writer, "OwnerID", ownerID, options); + writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString()); WriteUUID(writer, "ParentID", item.ParentID, options); WriteUUID(writer, "ParentPartID", item.ParentPartID, options); -- cgit v1.1 From 2ef9fd05fa7abaf06f971f0e0945cbcbe828f318 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Jan 2012 02:45:13 +0000 Subject: Add an overloaded SceneObjectPart.UpdateTextureEntry(Primitive.TextureEntry texEntry) for region modules --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ad3bcd5..36d3588 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4520,10 +4520,18 @@ namespace OpenSim.Region.Framework.Scenes /// /// Update the texture entry for this part. /// - /// - public void UpdateTextureEntry(byte[] textureEntry) + /// + public void UpdateTextureEntry(byte[] serializedTextureEntry) + { + UpdateTextureEntry(new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length)); + } + + /// + /// Update the texture entry for this part. + /// + /// + public void UpdateTextureEntry(Primitive.TextureEntry newTex) { - Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length); Primitive.TextureEntry oldTex = Shape.Textures; Changed changeFlags = 0; @@ -4555,7 +4563,7 @@ namespace OpenSim.Region.Framework.Scenes break; } - m_shape.TextureEntry = textureEntry; + m_shape.TextureEntry = newTex.GetBytes(); if (changeFlags != 0) TriggerScriptChangedEvent(changeFlags); UpdateFlag = UpdateRequired.FULL; -- cgit v1.1 From 9d93c4808e0a0171bcb43fc551f3fb37b684c499 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 30 Jan 2012 19:21:58 +0000 Subject: lock SceneObjectGroupsByFullID in SceneGraph.ForEachSOG() to stop failure if SceneObjectGroupsByFullID is updated elsewhere at the same time. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 7f18140..36a454e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1137,8 +1137,10 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void ForEachSOG(Action action) { - // FIXME: Need to lock here, really. - List objlist = new List(SceneObjectGroupsByFullID.Values); + List objlist; + lock (SceneObjectGroupsByFullID) + objlist = new List(SceneObjectGroupsByFullID.Values); + foreach (SceneObjectGroup obj in objlist) { try @@ -1147,7 +1149,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - // Catch it and move on. This includes situations where splist has inconsistent info + // Catch it and move on. This includes situations where objlist has inconsistent info m_log.WarnFormat( "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); } @@ -1382,10 +1384,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// Update the texture entry of the given prim. /// - /// + /// /// A texture entry is an object that contains details of all the textures of the prim's face. In this case, /// the texture is given in its byte serialized form. - /// + /// /// /// /// -- cgit v1.1 From f3780b9eaeae8834c49f6e2f6045ef922916924d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 19:56:37 +0000 Subject: Add torture tests to test adding 10,000, 100,000 and 200,000 single prim scene objects. These can be run using the "nant torture" target. They are not part of "nant test" due to their long-run future nature. Such tests are designed to do some testing of extreme situations and give some feedback on memory usage, etc. However, data can be inconsistent due to different machine circumstances and virtual machine actions. This area is under development. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 984058c..975d769 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1943,6 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes /// If true, the object is made persistent into the scene. /// If false, the object will not persist over server restarts /// + /// true if the object was added. false if not public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) { return AddNewSceneObject(sceneObject, attachToBackup, true); @@ -1960,6 +1961,7 @@ namespace OpenSim.Region.Framework.Scenes /// If true, updates for the new scene object are sent to all viewers in range. /// If false, it is left to the caller to schedule the update /// + /// true if the object was added. false if not public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) { if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 36a454e..006f9c6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -357,7 +357,13 @@ namespace OpenSim.Region.Framework.Scenes return false; if (Entities.ContainsKey(sceneObject.UUID)) + { +// m_log.DebugFormat( +// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", +// m_parentScene.RegionInfo.RegionName, sceneObject.UUID); + return false; + } // m_log.DebugFormat( // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", -- cgit v1.1 From 10b9348071094122d5e2dd636f7cce9c0b25f0a9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 20:30:30 +0000 Subject: Remove scene object null check on SceneGraph.AddSceneObject(). Complain explicitly if there's an attempt to add any object with a zero UUID. Callers themselves need to check that they're not attempting to add a null scene object. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 006f9c6..06de72f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -353,8 +353,14 @@ namespace OpenSim.Region.Framework.Scenes /// protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) { - if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero) + if (sceneObject.UUID == UUID.Zero) + { + m_log.ErrorFormat( + "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", + sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); + return false; + } if (Entities.ContainsKey(sceneObject.UUID)) { -- cgit v1.1 From 9bd02b5da19ae758bfb7a543976b26ced0cd1ba2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 21:57:45 +0000 Subject: Move object delete commands into a commands region module, in preparation for adding similar show commands. --- OpenSim/Region/Framework/Scenes/Scene.cs | 104 ------------------------------- 1 file changed, 104 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 975d769..df6c88f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -600,23 +600,6 @@ namespace OpenSim.Region.Framework.Scenes "reload estate", "Reload the estate data", HandleReloadEstate); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", - "delete object owner ", - "Delete object by owner", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", - "delete object creator ", - "Delete object by creator", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", - "delete object uuid ", - "Delete object by uuid", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", - "delete object name ", - "Delete object by name", HandleDeleteObject); - - MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", - "delete object outside", - "Delete all objects outside boundaries", HandleDeleteObject); - //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); @@ -4860,93 +4843,6 @@ namespace OpenSim.Region.Framework.Scenes } } - private void HandleDeleteObject(string module, string[] cmd) - { - if (cmd.Length < 3) - return; - - string mode = cmd[2]; - string o = ""; - - if (mode != "outside") - { - if (cmd.Length < 4) - return; - - o = cmd[3]; - } - - List deletes = new List(); - - UUID match; - - switch (mode) - { - case "owner": - if (!UUID.TryParse(o, out match)) - return; - ForEachSOG(delegate (SceneObjectGroup g) - { - if (g.OwnerID == match && !g.IsAttachment) - deletes.Add(g); - }); - break; - case "creator": - if (!UUID.TryParse(o, out match)) - return; - ForEachSOG(delegate (SceneObjectGroup g) - { - if (g.RootPart.CreatorID == match && !g.IsAttachment) - deletes.Add(g); - }); - break; - case "uuid": - if (!UUID.TryParse(o, out match)) - return; - ForEachSOG(delegate (SceneObjectGroup g) - { - if (g.UUID == match && !g.IsAttachment) - deletes.Add(g); - }); - break; - case "name": - ForEachSOG(delegate (SceneObjectGroup g) - { - if (g.RootPart.Name == o && !g.IsAttachment) - deletes.Add(g); - }); - break; - case "outside": - ForEachSOG(delegate (SceneObjectGroup g) - { - SceneObjectPart rootPart = g.RootPart; - bool delete = false; - - if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) - { - delete = true; - } - else - { - ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); - - if (parcel == null || parcel.LandData.Name == "NO LAND") - delete = true; - } - - if (delete && !g.IsAttachment && !deletes.Contains(g)) - deletes.Add(g); - }); - break; - } - - foreach (SceneObjectGroup g in deletes) - { - m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); - DeleteSceneObject(g, false); - } - } - private void HandleReloadEstate(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene == null || -- cgit v1.1 From ab89adfaefb7c2858cb2f90f783c010157d980a7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 23:03:39 +0000 Subject: Implement "show object uuid " console command. This will show details about a part with the given uuid if it's found. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 739c5fa..e7f2fdb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -264,6 +264,12 @@ namespace OpenSim.Region.Framework.Scenes set { RootPart.Name = value; } } + public string Description + { + get { return RootPart.Description; } + set { RootPart.Description = value; } + } + /// /// Added because the Parcel code seems to use it /// but not sure a object should have this -- cgit v1.1 From fcc1fa2c32af3df8962e470150b641dda036a8ab Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 1 Feb 2012 09:36:14 +0000 Subject: Straighten out some attachment mess. Don't save attachment states for HG visitors at all. On Leaving a sim, save only the changed ones. Don't save all scripted stuff when leaving a sim. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index df6c88f..34d1151 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3104,7 +3104,17 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) - AttachmentsModule.SaveChangedAttachments(avatar); + { + IUserManagement uMan = m_aScene.RequestModuleInterface(); + // Don't save attachments for HG visitors, it + // messes up their inventory. When a HG visitor logs + // out on a foreign grid, their attachments will be + // reloaded in the state they were in when they left + // the home grid. This is best anyway as the visited + // grid may use an incompatible script engine. + if (uMan == null || uMan.IsLocalGridUser(id)) + AttachmentsModule.SaveChangedAttachments(avatar, false); + } ForEachClient( delegate(IClientAPI client) -- cgit v1.1 From 241ddd031f36eda9f1339398ae30d52c1b9e83e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 1 Feb 2012 09:45:15 +0000 Subject: Fix copy/paste errors --- OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index e668dae..eb07165 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Save the attachments that have change on this presence. /// /// - void SaveChangedAttachments(IScenePresence sp); + void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted); /// /// Delete all the presence's attachments from the scene diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 34d1151..2af4a1c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3105,14 +3105,14 @@ namespace OpenSim.Region.Framework.Scenes if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) { - IUserManagement uMan = m_aScene.RequestModuleInterface(); + IUserManagement uMan = RequestModuleInterface(); // Don't save attachments for HG visitors, it // messes up their inventory. When a HG visitor logs // out on a foreign grid, their attachments will be // reloaded in the state they were in when they left // the home grid. This is best anyway as the visited // grid may use an incompatible script engine. - if (uMan == null || uMan.IsLocalGridUser(id)) + if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) AttachmentsModule.SaveChangedAttachments(avatar, false); } -- cgit v1.1 From 003bd9f1b3a774141d53282d3b3c13a7e121f0a4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 1 Feb 2012 10:05:04 +0000 Subject: Small optimization to last commit --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2af4a1c..23fee4e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3056,11 +3056,11 @@ namespace OpenSim.Region.Framework.Scenes public override void RemoveClient(UUID agentID, bool closeChildAgents) { CheckHeartbeat(); - bool childagentYN = false; + bool isChildAgent = false; ScenePresence avatar = GetScenePresence(agentID); if (avatar != null) { - childagentYN = avatar.IsChildAgent; + isChildAgent = avatar.IsChildAgent; if (avatar.ParentID != 0) { @@ -3071,9 +3071,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.DebugFormat( "[SCENE]: Removing {0} agent {1} from region {2}", - (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); + (isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName); - m_sceneGraph.removeUserCount(!childagentYN); + m_sceneGraph.removeUserCount(!isChildAgent); // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI @@ -3103,7 +3103,7 @@ namespace OpenSim.Region.Framework.Scenes { m_eventManager.TriggerOnRemovePresence(agentID); - if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) + if (AttachmentsModule != null && !isChildAgent && avatar.PresenceType != PresenceType.Npc) { IUserManagement uMan = RequestModuleInterface(); // Don't save attachments for HG visitors, it -- cgit v1.1