diff options
author | Dan Lake | 2012-02-17 13:43:14 -0800 |
---|---|---|
committer | Dan Lake | 2012-02-17 13:45:45 -0800 |
commit | 784263f5e334aeda15effee599efc8bf546aa010 (patch) | |
tree | f8a42eeb59461af845479f88a50f36335b2dba56 | |
parent | Refactor appearance saving for NPC to use AvatarFactoryModule interface. (diff) | |
download | opensim-SC_OLD-784263f5e334aeda15effee599efc8bf546aa010.zip opensim-SC_OLD-784263f5e334aeda15effee599efc8bf546aa010.tar.gz opensim-SC_OLD-784263f5e334aeda15effee599efc8bf546aa010.tar.bz2 opensim-SC_OLD-784263f5e334aeda15effee599efc8bf546aa010.tar.xz |
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).
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 24 |
2 files changed, 28 insertions, 0 deletions
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 | |||
496 | SetAppearanceAssets(sp.UUID, sp.Appearance); | 496 | SetAppearanceAssets(sp.UUID, sp.Appearance); |
497 | 497 | ||
498 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); | 498 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); |
499 | |||
500 | // Trigger this here because it's the final step in the set/queue/save process for appearance setting. | ||
501 | // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes). | ||
502 | m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); | ||
499 | } | 503 | } |
500 | 504 | ||
501 | private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) | 505 | 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 | |||
173 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); | 173 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); |
174 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 174 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
175 | 175 | ||
176 | public delegate void AvatarAppearanceChange(ScenePresence avatar); | ||
177 | public event AvatarAppearanceChange OnAvatarAppearanceChange; | ||
178 | |||
176 | public event Action<ScenePresence> OnSignificantClientMovement; | 179 | public event Action<ScenePresence> OnSignificantClientMovement; |
177 | 180 | ||
178 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 181 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
@@ -1238,6 +1241,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1238 | } | 1241 | } |
1239 | } | 1242 | } |
1240 | 1243 | ||
1244 | public void TriggerAvatarAppearanceChanged(ScenePresence avatar) | ||
1245 | { | ||
1246 | AvatarAppearanceChange handler = OnAvatarAppearanceChange; | ||
1247 | if (handler != null) | ||
1248 | { | ||
1249 | foreach (AvatarAppearanceChange d in handler.GetInvocationList()) | ||
1250 | { | ||
1251 | try | ||
1252 | { | ||
1253 | d(avatar); | ||
1254 | } | ||
1255 | catch (Exception e) | ||
1256 | { | ||
1257 | m_log.ErrorFormat( | ||
1258 | "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", | ||
1259 | e.Message, e.StackTrace); | ||
1260 | } | ||
1261 | } | ||
1262 | } | ||
1263 | } | ||
1264 | |||
1241 | public void TriggerIncomingInstantMessage(GridInstantMessage message) | 1265 | public void TriggerIncomingInstantMessage(GridInstantMessage message) |
1242 | { | 1266 | { |
1243 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; | 1267 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; |