From 04a195266bd68f8c62129246a98aefb3201c90f1 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 13 Feb 2012 13:21:42 -0800 Subject: short circuit the expensive parts of the permission checking code if the current user is the owner of an object. none of the later checks can reverse the outcome. --- OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index cdecd2f..f3c6a30 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -707,7 +707,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions // Object owners should be able to edit their own content if (currentUser == objectOwner) { - permission = true; + // there is no way that later code can change this back to false + // so just return true immediately and short circuit the more + // expensive group checks + return true; + + //permission = true; } else if (group.IsAttachment) { -- cgit v1.1 From 2ebb421331c4e6c4f57e0cc1bab79cea70937172 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 14 Feb 2012 17:20:34 -0800 Subject: Refactor appearance saving for NPC to use AvatarFactoryModule interface. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 40 +++++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 8d503bd..c7f4c20 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -111,6 +111,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory #region IAvatarFactoryModule + /// + /// + /// + /// + public void SetAppearance(IScenePresence sp, AvatarAppearance appearance) + { + SetAppearance(sp, appearance.Texture, appearance.VisualParams); + } + /// /// Set appearance data (texture asset IDs and slider settings) /// @@ -156,14 +165,23 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; // WriteBakedTexturesReport(sp, m_log.DebugFormat); - if (!ValidateBakedTextureCache(sp)) + + // If bake textures are missing and this is not an NPC, request a rebake from client + if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) RequestRebake(sp, true); // This appears to be set only in the final stage of the appearance // update transaction. In theory, we should be able to do an immediate // appearance send and save here. } - + + // NPC should send to clients immediately and skip saving appearance + if (((ScenePresence)sp).PresenceType == PresenceType.Npc) + { + SendAppearance((ScenePresence)sp); + return; + } + // save only if there were changes, send no matter what (doesn't hurt to send twice) if (changed) QueueAppearanceSave(sp.ControllingClient.AgentId); @@ -174,6 +192,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); } + private void SendAppearance(ScenePresence sp) + { + // Send the appearance to everyone in the scene + sp.SendAppearanceToAllOtherAgents(); + + // Send animations back to the avatar as well + sp.Animator.SendAnimPack(); + } + public bool SendAppearance(UUID agentId) { // m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); @@ -185,12 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return false; } - // Send the appearance to everyone in the scene - sp.SendAppearanceToAllOtherAgents(); - - // Send animations back to the avatar as well - sp.Animator.SendAnimPack(); - + SendAppearance(sp); return true; } @@ -626,4 +648,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); } } -} \ No newline at end of file +} -- cgit v1.1