From 784263f5e334aeda15effee599efc8bf546aa010 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 17 Feb 2012 13:43:14 -0800 Subject: Added the TriggerAvatarAppearanceChanged to EventManager. It's triggered by AvatarFactoryModule after an avatar's appearance has been succesfully changed and persisted (if the persist option is set). --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 ++++ OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index c7f4c20..b0cee03 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -496,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory SetAppearanceAssets(sp.UUID, sp.Appearance); m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); + + // Trigger this here because it's the final step in the set/queue/save process for appearance setting. + // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes). + m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); } private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d31d380..6586437 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -173,6 +173,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; + public delegate void AvatarAppearanceChange(ScenePresence avatar); + public event AvatarAppearanceChange OnAvatarAppearanceChange; + public event Action OnSignificantClientMovement; public delegate void IncomingInstantMessage(GridInstantMessage message); @@ -1238,6 +1241,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerAvatarAppearanceChanged(ScenePresence avatar) + { + AvatarAppearanceChange handler = OnAvatarAppearanceChange; + if (handler != null) + { + foreach (AvatarAppearanceChange d in handler.GetInvocationList()) + { + try + { + d(avatar); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerIncomingInstantMessage(GridInstantMessage message) { IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; -- cgit v1.1