diff options
author | Dr Scofield | 2009-05-12 11:51:19 +0000 |
---|---|---|
committer | Dr Scofield | 2009-05-12 11:51:19 +0000 |
commit | 13de24f707ecc515965ab851f3d862d03d8febf7 (patch) | |
tree | cbe3042a8d503d78fd787f31682f3936cd235444 /OpenSim/ApplicationPlugins/RemoteController | |
parent | Thank you kindly, Patnad, for a patch that: (diff) | |
download | opensim-SC_OLD-13de24f707ecc515965ab851f3d862d03d8febf7.zip opensim-SC_OLD-13de24f707ecc515965ab851f3d862d03d8febf7.tar.gz opensim-SC_OLD-13de24f707ecc515965ab851f3d862d03d8febf7.tar.bz2 opensim-SC_OLD-13de24f707ecc515965ab851f3d862d03d8febf7.tar.xz |
partially fixing avatar appearance code
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 120 |
1 files changed, 62 insertions, 58 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 15f4308..83a1916 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1135,7 +1135,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1135 | // establish "Default Female". Specifying a specific model can | 1135 | // establish "Default Female". Specifying a specific model can |
1136 | // establish a specific appearance without regard for gender. | 1136 | // establish a specific appearance without regard for gender. |
1137 | 1137 | ||
1138 | updateUserAppearance(responseData, requestData, userProfile.ID); | 1138 | // TODO: need to add code to do this only when |
1139 | // requested | ||
1140 | if (requestData.ContainsKey("model")) | ||
1141 | updateUserAppearance(responseData, requestData, userProfile.ID); | ||
1139 | 1142 | ||
1140 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1143 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) |
1141 | throw new Exception("did not manage to update user profile"); | 1144 | throw new Exception("did not manage to update user profile"); |
@@ -1177,39 +1180,40 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1177 | 1180 | ||
1178 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1181 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1179 | 1182 | ||
1180 | string dmale = m_config.GetString("default_male", "Default Male"); | 1183 | // string dmale = m_config.GetString("default_male", "Default Male"); |
1181 | string dfemale = m_config.GetString("default_female", "Default Female"); | 1184 | // string dfemale = m_config.GetString("default_female", "Default Female"); |
1182 | string dneut = m_config.GetString("default_female", "Default Default"); | 1185 | // string dneut = m_config.GetString("default_female", "Default Default"); |
1183 | string dmodel = dneut; | 1186 | // string dmodel = dneut; |
1184 | string model = dneut; | 1187 | // string model = dneut; |
1188 | // string dmodel = String.Empty; | ||
1189 | string model = String.Empty; | ||
1185 | 1190 | ||
1186 | // Has a gender preference been supplied? | 1191 | // Has a gender preference been supplied? |
1187 | 1192 | ||
1188 | if (requestData.Contains("gender")) | 1193 | // if (requestData.Contains("gender")) |
1189 | { | 1194 | // { |
1190 | if ((string)requestData["gender"] == "f") | 1195 | // if ((string)requestData["gender"] == "f") |
1191 | dmodel = dmale; | 1196 | // dmodel = dmale; |
1192 | else | 1197 | // else |
1193 | dmodel = dfemale; | 1198 | // dmodel = dfemale; |
1194 | } | 1199 | // } |
1195 | else | 1200 | // else |
1196 | dmodel = dneut; | 1201 | // dmodel = dneut; |
1197 | 1202 | ||
1198 | // Has an explicit model been specified? | 1203 | // Has an explicit model been specified? |
1199 | 1204 | ||
1200 | if (requestData.Contains("model")) | 1205 | if (!requestData.Contains("model")) |
1201 | model = (string)requestData["model"]; | 1206 | return; |
1202 | else | 1207 | model = (string)requestData["model"]; |
1203 | model = dmodel; | ||
1204 | 1208 | ||
1205 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); | 1209 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); |
1206 | 1210 | ||
1207 | string[] nomens = model.Split(); | 1211 | string[] nomens = model.Split(); |
1208 | if (nomens.Length != 2) | 1212 | if (nomens.Length != 2) |
1209 | { | 1213 | { |
1210 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", | 1214 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1211 | userid, model); | 1215 | // nomens = dmodel.Split(); |
1212 | nomens = dmodel.Split(); | 1216 | return; |
1213 | } | 1217 | } |
1214 | 1218 | ||
1215 | UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); | 1219 | UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); |
@@ -1217,39 +1221,34 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1217 | // Is this the first time one of the default models has been used? Create it if that is the case | 1221 | // Is this the first time one of the default models has been used? Create it if that is the case |
1218 | // otherwise default to male. | 1222 | // otherwise default to male. |
1219 | 1223 | ||
1220 | if (mprof == null) | 1224 | // if (mprof == null) |
1221 | { | 1225 | // { |
1222 | if(model != dmale && model != dfemale) | 1226 | // if (model != dmale && model != dfemale) |
1223 | { | 1227 | // { |
1224 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Default appearance assumed", | 1228 | // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Default appearance assumed", |
1225 | model); | 1229 | // model); |
1226 | nomens = dmodel.Split(); | 1230 | // nomens = dmodel.Split(); |
1227 | } | 1231 | // } |
1228 | if (createDefaultAvatars()) | 1232 | // if (createDefaultAvatars()) |
1229 | { | 1233 | // { |
1230 | mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); | 1234 | // mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); |
1231 | } | 1235 | // } |
1232 | } | 1236 | // } |
1233 | 1237 | ||
1234 | if (mprof == null) | 1238 | if (mprof == null) |
1235 | { | 1239 | { |
1236 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Model avatar not found : <{1}>", | 1240 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Model avatar not found : <{1}>", userid, model); |
1237 | userid, model); | 1241 | return; |
1238 | } | ||
1239 | else | ||
1240 | { | ||
1241 | |||
1242 | // Set current user's appearance. This bit is easy. The appearance structure is populated with | ||
1243 | // actual asset ids, however to complete the magic we need to populate the inventory with the | ||
1244 | // assets in question. | ||
1245 | |||
1246 | establishAppearance(userid, mprof.ID); | ||
1247 | |||
1248 | } | 1242 | } |
1249 | 1243 | ||
1244 | // Set current user's appearance. This bit is easy. The appearance structure is populated with | ||
1245 | // actual asset ids, however to complete the magic we need to populate the inventory with the | ||
1246 | // assets in question. | ||
1247 | |||
1248 | establishAppearance(userid, mprof.ID); | ||
1249 | |||
1250 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1250 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1251 | userid, model); | 1251 | userid, model); |
1252 | |||
1253 | } | 1252 | } |
1254 | 1253 | ||
1255 | /// <summary> | 1254 | /// <summary> |
@@ -1258,7 +1257,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1258 | /// is known to exist, as is the target avatar. | 1257 | /// is known to exist, as is the target avatar. |
1259 | /// </summary> | 1258 | /// </summary> |
1260 | 1259 | ||
1261 | private AvatarAppearance establishAppearance(UUID dest, UUID srca) | 1260 | private void establishAppearance(UUID dest, UUID srca) |
1262 | { | 1261 | { |
1263 | 1262 | ||
1264 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); | 1263 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); |
@@ -1267,10 +1266,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1267 | 1266 | ||
1268 | // If the model has no associated appearance we're done. | 1267 | // If the model has no associated appearance we're done. |
1269 | 1268 | ||
1270 | if (ava == null) | 1269 | // if (ava == null) |
1271 | { | 1270 | // { |
1272 | return new AvatarAppearance(); | 1271 | // return new AvatarAppearance(); |
1273 | } | 1272 | // } |
1273 | |||
1274 | if (ava == null) | ||
1275 | return; | ||
1274 | 1276 | ||
1275 | UICallback sic = new UICallback(); | 1277 | UICallback sic = new UICallback(); |
1276 | UICallback dic = new UICallback(); | 1278 | UICallback dic = new UICallback(); |
@@ -1358,12 +1360,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1358 | catch (Exception e) | 1360 | catch (Exception e) |
1359 | { | 1361 | { |
1360 | m_log.WarnFormat("[RADMIN] Error transferring inventory for {0} : {1}", | 1362 | m_log.WarnFormat("[RADMIN] Error transferring inventory for {0} : {1}", |
1361 | dest, e.Message); | 1363 | dest, e.Message); |
1362 | return new AvatarAppearance(); | 1364 | // return new AvatarAppearance(); |
1365 | return; | ||
1363 | } | 1366 | } |
1364 | 1367 | ||
1365 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); | 1368 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); |
1366 | return ava; | 1369 | // return ava; |
1370 | return; | ||
1367 | 1371 | ||
1368 | } | 1372 | } |
1369 | 1373 | ||