diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs | 83 |
3 files changed, 58 insertions, 38 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 231c0dc..729fd9a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1801,8 +1801,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1801 | !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) | 1801 | !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) |
1802 | { | 1802 | { |
1803 | // not found Appearance | 1803 | // not found Appearance |
1804 | m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); | 1804 | m_log.Warn("[APPEARANCE]: Appearance not found, creating default"); |
1805 | appearance = new AvatarAppearance(); | ||
1806 | } | 1805 | } |
1807 | } | 1806 | } |
1808 | 1807 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 1aa800a..0dbd6dd 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1466,11 +1466,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1466 | { | 1466 | { |
1467 | m_log.Info("[APPEARANCE] Sending Own Appearance"); | 1467 | m_log.Info("[APPEARANCE] Sending Own Appearance"); |
1468 | ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | 1468 | ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); |
1469 | ControllingClient.SendAppearance( | 1469 | // ControllingClient.SendAppearance( |
1470 | m_appearance.Owner, | 1470 | // m_appearance.Owner, |
1471 | m_appearance.VisualParams, | 1471 | // m_appearance.VisualParams, |
1472 | m_appearance.Texture.ToBytes() | 1472 | // m_appearance.Texture.ToBytes() |
1473 | ); | 1473 | // ); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | /// <summary> | 1476 | /// <summary> |
diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index 4b8eee7..e66113d 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -46,20 +46,25 @@ namespace OpenSim.Region.Modules.AvatarFactory | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private Scene m_scene = null; | 48 | private Scene m_scene = null; |
49 | private static readonly AvatarAppearance def = new AvatarAppearance(); | ||
49 | 50 | ||
50 | public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) | 51 | public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) |
51 | { | 52 | { |
52 | appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); | 53 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(avatarId); |
53 | if (appearance != null) | 54 | if ((profile != null) && (profile.RootFolder != null)) |
54 | { | 55 | { |
55 | m_log.InfoFormat("[APPEARANCE] found : {0}", appearance.ToString()); | 56 | appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); |
56 | return true; | 57 | if (appearance != null) |
57 | } | 58 | { |
58 | else | 59 | SetAppearanceAssets(profile, ref appearance); |
59 | { | 60 | m_log.InfoFormat("[APPEARANCE] found : {0}", appearance.ToString()); |
60 | m_log.InfoFormat("[APPEARANCE] appearance not found for {0}", avatarId.ToString()); | 61 | return true; |
61 | return false; | 62 | } |
62 | } | 63 | } |
64 | |||
65 | appearance = CreateDefault(avatarId); | ||
66 | m_log.InfoFormat("[APPEARANCE] appearance not found for {0}, creating default", avatarId.ToString()); | ||
67 | return false; | ||
63 | } | 68 | } |
64 | 69 | ||
65 | private AvatarAppearance CreateDefault(LLUUID avatarId) | 70 | private AvatarAppearance CreateDefault(LLUUID avatarId) |
@@ -113,6 +118,41 @@ namespace OpenSim.Region.Modules.AvatarFactory | |||
113 | // client.OnAvatarNowWearing -= AvatarIsWearing; | 118 | // client.OnAvatarNowWearing -= AvatarIsWearing; |
114 | } | 119 | } |
115 | 120 | ||
121 | |||
122 | public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance) | ||
123 | { | ||
124 | if (profile.RootFolder != null) | ||
125 | { | ||
126 | for (int i = 0; i < 13; i++) | ||
127 | { | ||
128 | if (appearance.Wearables[i].ItemID == LLUUID.Zero) | ||
129 | { | ||
130 | appearance.Wearables[i].AssetID = LLUUID.Zero; | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | LLUUID assetId; | ||
135 | |||
136 | InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); | ||
137 | |||
138 | if (baseItem != null) | ||
139 | { | ||
140 | appearance.Wearables[i].AssetID = baseItem.AssetID; | ||
141 | } | ||
142 | else | ||
143 | { | ||
144 | m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID); | ||
145 | appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | m_log.Error("[APPEARANCE] you have no inventory, appearance stuff isn't going to work"); | ||
153 | } | ||
154 | } | ||
155 | |||
116 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) | 156 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) |
117 | { | 157 | { |
118 | IClientAPI clientView = (IClientAPI)sender; | 158 | IClientAPI clientView = (IClientAPI)sender; |
@@ -138,30 +178,11 @@ namespace OpenSim.Region.Modules.AvatarFactory | |||
138 | { | 178 | { |
139 | if (wear.Type < 13) | 179 | if (wear.Type < 13) |
140 | { | 180 | { |
141 | if (wear.ItemID == LLUUID.Zero) | 181 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
142 | { | ||
143 | avatAppearance.Wearables[wear.Type].ItemID = LLUUID.Zero; | ||
144 | avatAppearance.Wearables[wear.Type].AssetID = LLUUID.Zero; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | LLUUID assetId; | ||
149 | |||
150 | InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID); | ||
151 | |||
152 | if (baseItem != null) | ||
153 | { | ||
154 | assetId = baseItem.AssetID; | ||
155 | avatAppearance.Wearables[wear.Type].AssetID = assetId; | ||
156 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID); | ||
161 | } | ||
162 | } | ||
163 | } | 182 | } |
164 | } | 183 | } |
184 | SetAppearanceAssets(profile, ref avatAppearance); | ||
185 | |||
165 | m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); | 186 | m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); |
166 | avatar.Appearance = avatAppearance; | 187 | avatar.Appearance = avatAppearance; |
167 | } | 188 | } |