diff options
Avatar Appearance refactoring /changes. Added a AvatarAppearance class, each ScenePresence "has" a AvatarAppearance object. All the ScenePresences in a opensim related to one user (so a user's various ScenePresence's in all the regions in that instance) share the same AvatarAppearance object. This means that a user's avatar should appear correctly (to both that user and other users) no matter what border crossing or teleporting they have done.
Note: this mainly improves Standalone mode, as in grid mode the appearance data isn't passed between region servers. Although people should notice a improvement when moving between regions in the same instance.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | 63 |
1 files changed, 15 insertions, 48 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs index edaad82..4f9aa2a 100644 --- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | |||
@@ -12,26 +12,27 @@ namespace OpenSim.Region.Environment.Modules | |||
12 | public class AvatarFactoryModule : IAvatarFactory | 12 | public class AvatarFactoryModule : IAvatarFactory |
13 | { | 13 | { |
14 | private Scene m_scene = null; | 14 | private Scene m_scene = null; |
15 | private Dictionary<LLUUID, AvatarAppearance> m_avatarsClothes = new Dictionary<LLUUID, AvatarAppearance>(); | 15 | private Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>(); |
16 | 16 | ||
17 | public bool TryGetInitialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, | 17 | public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) |
18 | out byte[] visualParams) | ||
19 | { | 18 | { |
20 | if (m_avatarsClothes.ContainsKey(avatarId)) | 19 | if (m_avatarsAppearance.ContainsKey(avatarId)) |
21 | { | 20 | { |
22 | visualParams = GetDefaultVisualParams(); | 21 | appearance = m_avatarsAppearance[avatarId]; |
23 | wearables = m_avatarsClothes[avatarId].IsWearing; | ||
24 | return true; | 22 | return true; |
25 | } | 23 | } |
26 | else | 24 | else |
27 | { | 25 | { |
26 | AvatarWearable[] wearables; | ||
27 | byte[] visualParams; | ||
28 | GetDefaultAvatarAppearance(out wearables, out visualParams); | 28 | GetDefaultAvatarAppearance(out wearables, out visualParams); |
29 | AvatarAppearance wearing = new AvatarAppearance(wearables); | 29 | appearance = new AvatarAppearance(avatarId, wearables, visualParams); |
30 | m_avatarsClothes[avatarId] = wearing; | 30 | m_avatarsAppearance[avatarId] = appearance; |
31 | return true; | 31 | return true; |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | |||
35 | public void Initialise(Scene scene, IConfigSource source) | 36 | public void Initialise(Scene scene, IConfigSource source) |
36 | { | 37 | { |
37 | scene.RegisterModuleInterface<IAvatarFactory>(this); | 38 | scene.RegisterModuleInterface<IAvatarFactory>(this); |
@@ -92,11 +93,12 @@ namespace OpenSim.Region.Environment.Modules | |||
92 | { | 93 | { |
93 | assetId = baseItem.assetID; | 94 | assetId = baseItem.assetID; |
94 | //temporary dictionary storage. This should be storing to a database | 95 | //temporary dictionary storage. This should be storing to a database |
95 | if (m_avatarsClothes.ContainsKey(clientView.AgentId)) | 96 | |
97 | if (m_avatarsAppearance.ContainsKey(clientView.AgentId)) | ||
96 | { | 98 | { |
97 | AvatarAppearance avWearing = m_avatarsClothes[clientView.AgentId]; | 99 | AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId]; |
98 | avWearing.IsWearing[wear.Type].AssetID = assetId; | 100 | avatAppearance.Wearables[wear.Type].AssetID = assetId; |
99 | avWearing.IsWearing[wear.Type].ItemID = wear.ItemID; | 101 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
100 | } | 102 | } |
101 | } | 103 | } |
102 | 104 | ||
@@ -123,41 +125,6 @@ namespace OpenSim.Region.Environment.Modules | |||
123 | return visualParams; | 125 | return visualParams; |
124 | } | 126 | } |
125 | 127 | ||
126 | public class AvatarAppearance | 128 | |
127 | { | ||
128 | public AvatarWearable[] IsWearing; | ||
129 | public byte[] VisualParams; | ||
130 | |||
131 | public AvatarAppearance() | ||
132 | { | ||
133 | IsWearing = new AvatarWearable[13]; | ||
134 | for (int i = 0; i < 13; i++) | ||
135 | { | ||
136 | IsWearing[i] = new AvatarWearable(); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public AvatarAppearance(AvatarWearable[] wearing) | ||
141 | { | ||
142 | if (wearing.Length == 13) | ||
143 | { | ||
144 | IsWearing = new AvatarWearable[13]; | ||
145 | for (int i = 0; i < 13; i++) | ||
146 | { | ||
147 | IsWearing[i] = new AvatarWearable(); | ||
148 | IsWearing[i].AssetID = wearing[i].AssetID; | ||
149 | IsWearing[i].ItemID = wearing[i].ItemID; | ||
150 | } | ||
151 | } | ||
152 | else | ||
153 | { | ||
154 | IsWearing = new AvatarWearable[13]; | ||
155 | for (int i = 0; i < 13; i++) | ||
156 | { | ||
157 | IsWearing[i] = new AvatarWearable(); | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | 129 | } |
163 | } | 130 | } |