AvatarAppearance.cs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Reflection;
  29. using System.Collections;
  30. using System.Collections.Generic;
  31. using OpenMetaverse;
  32. using OpenMetaverse.StructuredData;
  33. using log4net;
  34. namespace OpenSim.Framework
  35. {
  36. /// <summary>
  37. /// Contains the Avatar's Appearance and methods to manipulate the appearance.
  38. /// </summary>
  39. public class AvatarAppearance
  40. {
  41. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  42. public readonly static int VISUALPARAM_COUNT = 218;
  43. public readonly static int TEXTURE_COUNT = 21;
  44. public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
  45. protected int m_serial = 0;
  46. protected byte[] m_visualparams;
  47. protected Primitive.TextureEntry m_texture;
  48. protected AvatarWearable[] m_wearables;
  49. protected Dictionary<int, List<AvatarAttachment>> m_attachments;
  50. protected float m_avatarHeight = 0;
  51. protected UUID[] m_texturehashes;
  52. public virtual int Serial
  53. {
  54. get { return m_serial; }
  55. set { m_serial = value; }
  56. }
  57. public virtual byte[] VisualParams
  58. {
  59. get { return m_visualparams; }
  60. set { m_visualparams = value; }
  61. }
  62. public virtual Primitive.TextureEntry Texture
  63. {
  64. get { return m_texture; }
  65. set
  66. {
  67. // m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value);
  68. m_texture = value;
  69. }
  70. }
  71. public virtual AvatarWearable[] Wearables
  72. {
  73. get { return m_wearables; }
  74. set { m_wearables = value; }
  75. }
  76. public virtual float AvatarHeight
  77. {
  78. get { return m_avatarHeight; }
  79. set { m_avatarHeight = value; }
  80. }
  81. public AvatarAppearance()
  82. {
  83. // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
  84. m_serial = 0;
  85. SetDefaultWearables();
  86. SetDefaultTexture();
  87. SetDefaultParams();
  88. SetHeight();
  89. m_attachments = new Dictionary<int, List<AvatarAttachment>>();
  90. ResetTextureHashes();
  91. }
  92. public AvatarAppearance(OSDMap map)
  93. {
  94. // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
  95. Unpack(map);
  96. SetHeight();
  97. }
  98. public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true)
  99. {
  100. }
  101. public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
  102. {
  103. // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
  104. if (appearance == null)
  105. {
  106. m_serial = 0;
  107. SetDefaultWearables();
  108. SetDefaultTexture();
  109. SetDefaultParams();
  110. SetHeight();
  111. m_attachments = new Dictionary<int, List<AvatarAttachment>>();
  112. ResetTextureHashes();
  113. return;
  114. }
  115. m_serial = appearance.Serial;
  116. m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
  117. for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
  118. m_wearables[i] = new AvatarWearable();
  119. if (copyWearables && (appearance.Wearables != null))
  120. {
  121. for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
  122. SetWearable(i,appearance.Wearables[i]);
  123. }
  124. m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
  125. for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  126. m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]);
  127. m_texture = null;
  128. if (appearance.Texture != null)
  129. {
  130. byte[] tbytes = appearance.Texture.GetBytes();
  131. m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
  132. }
  133. m_visualparams = null;
  134. if (appearance.VisualParams != null)
  135. m_visualparams = (byte[])appearance.VisualParams.Clone();
  136. m_avatarHeight = appearance.m_avatarHeight;
  137. // Copy the attachment, force append mode since that ensures consistency
  138. m_attachments = new Dictionary<int, List<AvatarAttachment>>();
  139. foreach (AvatarAttachment attachment in appearance.GetAttachments())
  140. AppendAttachment(new AvatarAttachment(attachment));
  141. }
  142. public void GetAssetsFrom(AvatarAppearance app)
  143. {
  144. for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
  145. {
  146. for (int j = 0; j < m_wearables[i].Count; j++)
  147. {
  148. UUID itemID = m_wearables[i][j].ItemID;
  149. UUID assetID = app.Wearables[i].GetAsset(itemID);
  150. if (assetID != UUID.Zero)
  151. m_wearables[i].Add(itemID, assetID);
  152. }
  153. }
  154. }
  155. public void ResetTextureHashes()
  156. {
  157. m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
  158. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  159. m_texturehashes[i] = UUID.Zero;
  160. }
  161. public UUID GetTextureHash(int textureIndex)
  162. {
  163. return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)];
  164. }
  165. public void SetTextureHash(int textureIndex, UUID textureHash)
  166. {
  167. m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash);
  168. }
  169. /// <summary>
  170. /// Normalizes the texture index to the actual bake index, this is done to
  171. /// accommodate older viewers that send the BAKE_INDICES index rather than
  172. /// the actual texture index
  173. /// </summary>
  174. private int NormalizeBakedTextureIndex(int textureIndex)
  175. {
  176. // Earlier viewer send the index into the baked index array, just trying to be careful here
  177. if (textureIndex < BAKE_INDICES.Length)
  178. return BAKE_INDICES[textureIndex];
  179. return textureIndex;
  180. }
  181. public void ClearWearables()
  182. {
  183. m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
  184. for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
  185. m_wearables[i] = new AvatarWearable();
  186. }
  187. protected virtual void SetDefaultWearables()
  188. {
  189. m_wearables = AvatarWearable.DefaultWearables;
  190. }
  191. /// <summary>
  192. /// Invalidate all of the baked textures in the appearance, useful
  193. /// if you know that none are valid
  194. /// </summary>
  195. public virtual void ResetAppearance()
  196. {
  197. // m_log.WarnFormat("[AVATAR APPEARANCE]: Reset appearance");
  198. m_serial = 0;
  199. SetDefaultTexture();
  200. ResetTextureHashes();
  201. }
  202. protected virtual void SetDefaultParams()
  203. {
  204. m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 };
  205. // for (int i = 0; i < VISUALPARAM_COUNT; i++)
  206. // {
  207. // m_visualparams[i] = 150;
  208. // }
  209. }
  210. protected virtual void SetDefaultTexture()
  211. {
  212. m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
  213. // for (uint i = 0; i < TEXTURE_COUNT; i++)
  214. // m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
  215. }
  216. /// <summary>
  217. /// Set up appearance texture ids.
  218. /// </summary>
  219. /// <returns>
  220. /// True if any existing texture id was changed by the new data.
  221. /// False if there were no changes or no existing texture ids.
  222. /// </returns>
  223. public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry)
  224. {
  225. if (textureEntry == null)
  226. return false;
  227. // There are much simpler versions of this copy that could be
  228. // made. We determine if any of the textures actually
  229. // changed to know if the appearance should be saved later
  230. bool changed = false;
  231. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  232. {
  233. Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i];
  234. Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i];
  235. if (newface == null)
  236. {
  237. if (oldface == null)
  238. continue;
  239. }
  240. else
  241. {
  242. if (oldface != null && oldface.TextureID == newface.TextureID)
  243. continue;
  244. }
  245. changed = true;
  246. }
  247. m_texture = textureEntry;
  248. return changed;
  249. }
  250. /// <summary>
  251. /// Set up visual parameters for the avatar and refresh the avatar height
  252. /// </summary>
  253. /// <returns>
  254. /// True if any existing visual parameter was changed by the new data.
  255. /// False if there were no changes or no existing visual parameters.
  256. /// </returns>
  257. public virtual bool SetVisualParams(byte[] visualParams)
  258. {
  259. if (visualParams == null)
  260. return false;
  261. // There are much simpler versions of this copy that could be
  262. // made. We determine if any of the visual parameters actually
  263. // changed to know if the appearance should be saved later
  264. bool changed = false;
  265. for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++)
  266. {
  267. if (visualParams[i] != m_visualparams[i])
  268. {
  269. // DEBUG ON
  270. // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
  271. // i,m_visualparams[i],visualParams[i]);
  272. // DEBUG OFF
  273. m_visualparams[i] = visualParams[i];
  274. changed = true;
  275. }
  276. }
  277. // Reset the height if the visual parameters actually changed
  278. if (changed)
  279. SetHeight();
  280. return changed;
  281. }
  282. public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
  283. {
  284. SetTextureEntries(textureEntry);
  285. SetVisualParams(visualParams);
  286. }
  287. /// <summary>
  288. /// Set avatar height by a calculation based on their visual parameters.
  289. /// </summary>
  290. public virtual void SetHeight()
  291. {
  292. // Start with shortest possible female avatar height
  293. m_avatarHeight = 1.14597f;
  294. // Add offset for male avatars
  295. if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0)
  296. m_avatarHeight += 0.0848f;
  297. // Add offsets for visual params
  298. m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f
  299. + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f
  300. + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f
  301. + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f
  302. + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f
  303. + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f;
  304. }
  305. public virtual void SetWearable(int wearableId, AvatarWearable wearable)
  306. {
  307. // DEBUG ON
  308. // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
  309. // DEBUG OFF
  310. m_wearables[wearableId].Clear();
  311. for (int i = 0; i < wearable.Count; i++)
  312. m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
  313. }
  314. // DEBUG ON
  315. public override String ToString()
  316. {
  317. String s = "";
  318. s += String.Format("Serial: {0}\n",m_serial);
  319. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  320. if (m_texture.FaceTextures[i] != null)
  321. s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID);
  322. foreach (AvatarWearable awear in m_wearables)
  323. {
  324. for (int i = 0; i < awear.Count; i++)
  325. s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID);
  326. }
  327. s += "Visual Params: ";
  328. for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
  329. s += String.Format("{0},",m_visualparams[j]);
  330. s += "\n";
  331. return s;
  332. }
  333. // DEBUG OFF
  334. /// <summary>
  335. /// Get a list of the attachments.
  336. /// </summary>
  337. /// <remarks>
  338. /// There may be duplicate attachpoints
  339. /// </remarks>
  340. public List<AvatarAttachment> GetAttachments()
  341. {
  342. List<AvatarAttachment> alist = new List<AvatarAttachment>();
  343. lock (m_attachments)
  344. {
  345. foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
  346. {
  347. foreach (AvatarAttachment attach in kvp.Value)
  348. alist.Add(new AvatarAttachment(attach));
  349. }
  350. }
  351. return alist;
  352. }
  353. internal void AppendAttachment(AvatarAttachment attach)
  354. {
  355. // m_log.DebugFormat(
  356. // "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}",
  357. // attach.ItemID, attach.AssetID, attach.AttachPoint);
  358. lock (m_attachments)
  359. {
  360. if (!m_attachments.ContainsKey(attach.AttachPoint))
  361. m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
  362. m_attachments[attach.AttachPoint].Add(attach);
  363. }
  364. }
  365. internal void ReplaceAttachment(AvatarAttachment attach)
  366. {
  367. // m_log.DebugFormat(
  368. // "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}",
  369. // attach.ItemID, attach.AssetID, attach.AttachPoint);
  370. lock (m_attachments)
  371. {
  372. m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
  373. m_attachments[attach.AttachPoint].Add(attach);
  374. }
  375. }
  376. /// <summary>
  377. /// Set an attachment
  378. /// </summary>
  379. /// <remarks>
  380. /// If the attachpoint has the
  381. /// 0x80 bit set then we assume this is an append
  382. /// operation otherwise we replace whatever is
  383. /// currently attached at the attachpoint
  384. /// </remarks>
  385. /// <param name="attachpoint"></param>
  386. /// <param name="item">If UUID.Zero, then an any attachment at the attachpoint is removed.</param>
  387. /// <param name="asset"></param>
  388. /// <returns>
  389. /// return true if something actually changed
  390. /// </returns>
  391. public bool SetAttachment(int attachpoint, UUID item, UUID asset)
  392. {
  393. // m_log.DebugFormat(
  394. // "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
  395. // attachpoint, item, asset);
  396. if (attachpoint == 0)
  397. return false;
  398. lock (m_attachments)
  399. {
  400. if (item == UUID.Zero)
  401. {
  402. if (m_attachments.ContainsKey(attachpoint))
  403. {
  404. m_attachments.Remove(attachpoint);
  405. return true;
  406. }
  407. return false;
  408. }
  409. // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However,
  410. // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If
  411. // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments
  412. // later fail unless the attachment is detached and reattached.
  413. //
  414. // Therefore, we will carry on with the set if the existing attachment has no asset id.
  415. AvatarAttachment existingAttachment = GetAttachmentForItem(item);
  416. if (existingAttachment != null)
  417. {
  418. // m_log.DebugFormat(
  419. // "[AVATAR APPEARANCE]: Found existing attachment for {0}, asset {1} at point {2}",
  420. // existingAttachment.ItemID, existingAttachment.AssetID, existingAttachment.AttachPoint);
  421. if (existingAttachment.AssetID != UUID.Zero && existingAttachment.AttachPoint == (attachpoint & 0x7F))
  422. {
  423. m_log.DebugFormat(
  424. "[AVATAR APPEARANCE]: Ignoring attempt to attach an already attached item {0} at point {1}",
  425. item, attachpoint);
  426. return false;
  427. }
  428. else
  429. {
  430. // Remove it here so that the later append does not add a second attachment but we still update
  431. // the assetID
  432. DetachAttachment(existingAttachment.ItemID);
  433. }
  434. }
  435. // check if this is an append or a replace, 0x80 marks it as an append
  436. if ((attachpoint & 0x80) > 0)
  437. {
  438. // strip the append bit
  439. int point = attachpoint & 0x7F;
  440. AppendAttachment(new AvatarAttachment(point, item, asset));
  441. }
  442. else
  443. {
  444. ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
  445. }
  446. }
  447. return true;
  448. }
  449. /// <summary>
  450. /// If the item is already attached, return it.
  451. /// </summary>
  452. /// <param name="itemID"></param>
  453. /// <returns>Returns null if this item is not attached.</returns>
  454. public AvatarAttachment GetAttachmentForItem(UUID itemID)
  455. {
  456. lock (m_attachments)
  457. {
  458. foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
  459. {
  460. int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
  461. if (index >= 0)
  462. return kvp.Value[index];
  463. }
  464. }
  465. return null;
  466. }
  467. public int GetAttachpoint(UUID itemID)
  468. {
  469. lock (m_attachments)
  470. {
  471. foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
  472. {
  473. int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
  474. if (index >= 0)
  475. return kvp.Key;
  476. }
  477. }
  478. return 0;
  479. }
  480. public bool DetachAttachment(UUID itemID)
  481. {
  482. lock (m_attachments)
  483. {
  484. foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
  485. {
  486. int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
  487. if (index >= 0)
  488. {
  489. // m_log.DebugFormat(
  490. // "[AVATAR APPEARANCE]: Detaching attachment {0}, index {1}, point {2}",
  491. // m_attachments[kvp.Key][index].ItemID, index, m_attachments[kvp.Key][index].AttachPoint);
  492. // Remove it from the list of attachments at that attach point
  493. m_attachments[kvp.Key].RemoveAt(index);
  494. // And remove the list if there are no more attachments here
  495. if (m_attachments[kvp.Key].Count == 0)
  496. m_attachments.Remove(kvp.Key);
  497. return true;
  498. }
  499. }
  500. }
  501. return false;
  502. }
  503. public void ClearAttachments()
  504. {
  505. lock (m_attachments)
  506. m_attachments.Clear();
  507. }
  508. #region Packing Functions
  509. /// <summary>
  510. /// Create an OSDMap from the appearance data
  511. /// </summary>
  512. public OSDMap Pack()
  513. {
  514. OSDMap data = new OSDMap();
  515. data["serial"] = OSD.FromInteger(m_serial);
  516. data["height"] = OSD.FromReal(m_avatarHeight);
  517. // Hashes
  518. OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
  519. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  520. hashes.Add(OSD.FromUUID(m_texturehashes[i]));
  521. data["hashes"] = hashes;
  522. // Wearables
  523. OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
  524. for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
  525. wears.Add(m_wearables[i].Pack());
  526. data["wearables"] = wears;
  527. // Avatar Textures
  528. OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
  529. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  530. {
  531. if (m_texture.FaceTextures[i] != null)
  532. textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
  533. else
  534. textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
  535. }
  536. data["textures"] = textures;
  537. // Visual Parameters
  538. OSDBinary visualparams = new OSDBinary(m_visualparams);
  539. data["visualparams"] = visualparams;
  540. // Attachments
  541. List<AvatarAttachment> attachments = GetAttachments();
  542. OSDArray attachs = new OSDArray(attachments.Count);
  543. foreach (AvatarAttachment attach in GetAttachments())
  544. attachs.Add(attach.Pack());
  545. data["attachments"] = attachs;
  546. return data;
  547. }
  548. /// <summary>
  549. /// Unpack and OSDMap and initialize the appearance
  550. /// from it
  551. /// </summary>
  552. public void Unpack(OSDMap data)
  553. {
  554. if ((data != null) && (data["serial"] != null))
  555. m_serial = data["serial"].AsInteger();
  556. if ((data != null) && (data["height"] != null))
  557. m_avatarHeight = (float)data["height"].AsReal();
  558. try
  559. {
  560. // Hashes
  561. m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
  562. if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array)
  563. {
  564. OSDArray hashes = (OSDArray)(data["hashes"]);
  565. for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  566. {
  567. UUID hashID = UUID.Zero;
  568. if (i < hashes.Count && hashes[i] != null)
  569. hashID = hashes[i].AsUUID();
  570. m_texturehashes[i] = hashID;
  571. }
  572. }
  573. else
  574. {
  575. for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
  576. m_texturehashes[i] = UUID.Zero;
  577. }
  578. // Wearables
  579. SetDefaultWearables();
  580. if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
  581. {
  582. OSDArray wears = (OSDArray)(data["wearables"]);
  583. for (int i = 0; i < wears.Count; i++)
  584. m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
  585. }
  586. else
  587. {
  588. m_log.Warn("[AVATAR APPEARANCE]: failed to unpack wearables");
  589. }
  590. // Avatar Textures
  591. SetDefaultTexture();
  592. if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
  593. {
  594. OSDArray textures = (OSDArray)(data["textures"]);
  595. for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
  596. {
  597. UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
  598. if (textures[i] != null)
  599. textureID = textures[i].AsUUID();
  600. m_texture.CreateFace((uint)i).TextureID = new UUID(textureID);
  601. }
  602. }
  603. else
  604. {
  605. m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
  606. }
  607. // Visual Parameters
  608. SetDefaultParams();
  609. if ((data != null) && (data["visualparams"] != null))
  610. {
  611. if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array))
  612. m_visualparams = data["visualparams"].AsBinary();
  613. }
  614. else
  615. {
  616. m_log.Warn("[AVATAR APPEARANCE]: failed to unpack visual parameters");
  617. }
  618. // Attachments
  619. m_attachments = new Dictionary<int, List<AvatarAttachment>>();
  620. if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
  621. {
  622. OSDArray attachs = (OSDArray)(data["attachments"]);
  623. for (int i = 0; i < attachs.Count; i++)
  624. {
  625. AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
  626. AppendAttachment(att);
  627. // m_log.DebugFormat(
  628. // "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}",
  629. // att.ItemID, att.AssetID, att.AttachPoint);
  630. }
  631. }
  632. }
  633. catch (Exception e)
  634. {
  635. m_log.ErrorFormat("[AVATAR APPEARANCE]: unpack failed badly: {0}{1}", e.Message, e.StackTrace);
  636. }
  637. }
  638. #endregion
  639. #region VPElement
  640. /// <summary>
  641. /// Viewer Params Array Element for AgentSetAppearance
  642. /// Generated from LibOMV's Visual Params list
  643. /// </summary>
  644. public enum VPElement : int
  645. {
  646. /// <summary>
  647. /// Brow Size - Small 0--+255 Large
  648. /// </summary>
  649. SHAPE_BIG_BROW = 0,
  650. /// <summary>
  651. /// Nose Size - Small 0--+255 Large
  652. /// </summary>
  653. SHAPE_NOSE_BIG_OUT = 1,
  654. /// <summary>
  655. /// Nostril Width - Narrow 0--+255 Broad
  656. /// </summary>
  657. SHAPE_BROAD_NOSTRILS = 2,
  658. /// <summary>
  659. /// Chin Cleft - Round 0--+255 Cleft
  660. /// </summary>
  661. SHAPE_CLEFT_CHIN = 3,
  662. /// <summary>
  663. /// Nose Tip Shape - Pointy 0--+255 Bulbous
  664. /// </summary>
  665. SHAPE_BULBOUS_NOSE_TIP = 4,
  666. /// <summary>
  667. /// Chin Angle - Chin Out 0--+255 Chin In
  668. /// </summary>
  669. SHAPE_WEAK_CHIN = 5,
  670. /// <summary>
  671. /// Chin-Neck - Tight Chin 0--+255 Double Chin
  672. /// </summary>
  673. SHAPE_DOUBLE_CHIN = 6,
  674. /// <summary>
  675. /// Lower Cheeks - Well-Fed 0--+255 Sunken
  676. /// </summary>
  677. SHAPE_SUNKEN_CHEEKS = 7,
  678. /// <summary>
  679. /// Upper Bridge - Low 0--+255 High
  680. /// </summary>
  681. SHAPE_NOBLE_NOSE_BRIDGE = 8,
  682. /// <summary>
  683. /// - Less 0--+255 More
  684. /// </summary>
  685. SHAPE_JOWLS = 9,
  686. /// <summary>
  687. /// Upper Chin Cleft - Round 0--+255 Cleft
  688. /// </summary>
  689. SHAPE_CLEFT_CHIN_UPPER = 10,
  690. /// <summary>
  691. /// Cheek Bones - Low 0--+255 High
  692. /// </summary>
  693. SHAPE_HIGH_CHEEK_BONES = 11,
  694. /// <summary>
  695. /// Ear Angle - In 0--+255 Out
  696. /// </summary>
  697. SHAPE_EARS_OUT = 12,
  698. /// <summary>
  699. /// Eyebrow Points - Smooth 0--+255 Pointy
  700. /// </summary>
  701. HAIR_POINTY_EYEBROWS = 13,
  702. /// <summary>
  703. /// Jaw Shape - Pointy 0--+255 Square
  704. /// </summary>
  705. SHAPE_SQUARE_JAW = 14,
  706. /// <summary>
  707. /// Upper Cheeks - Thin 0--+255 Puffy
  708. /// </summary>
  709. SHAPE_PUFFY_UPPER_CHEEKS = 15,
  710. /// <summary>
  711. /// Nose Tip Angle - Downturned 0--+255 Upturned
  712. /// </summary>
  713. SHAPE_UPTURNED_NOSE_TIP = 16,
  714. /// <summary>
  715. /// Nose Thickness - Thin Nose 0--+255 Bulbous Nose
  716. /// </summary>
  717. SHAPE_BULBOUS_NOSE = 17,
  718. /// <summary>
  719. /// Upper Eyelid Fold - Uncreased 0--+255 Creased
  720. /// </summary>
  721. SHAPE_UPPER_EYELID_FOLD = 18,
  722. /// <summary>
  723. /// Attached Earlobes - Unattached 0--+255 Attached
  724. /// </summary>
  725. SHAPE_ATTACHED_EARLOBES = 19,
  726. /// <summary>
  727. /// Eye Bags - Smooth 0--+255 Baggy
  728. /// </summary>
  729. SHAPE_BAGGY_EYES = 20,
  730. /// <summary>
  731. /// Eye Opening - Narrow 0--+255 Wide
  732. /// </summary>
  733. SHAPE_WIDE_EYES = 21,
  734. /// <summary>
  735. /// Lip Cleft - Narrow 0--+255 Wide
  736. /// </summary>
  737. SHAPE_WIDE_LIP_CLEFT = 22,
  738. /// <summary>
  739. /// Bridge Width - Narrow 0--+255 Wide
  740. /// </summary>
  741. SHAPE_WIDE_NOSE_BRIDGE = 23,
  742. /// <summary>
  743. /// Eyebrow Arc - Flat 0--+255 Arced
  744. /// </summary>
  745. HAIR_ARCED_EYEBROWS = 24,
  746. /// <summary>
  747. /// Height - Short 0--+255 Tall
  748. /// </summary>
  749. SHAPE_HEIGHT = 25,
  750. /// <summary>
  751. /// Body Thickness - Body Thin 0--+255 Body Thick
  752. /// </summary>
  753. SHAPE_THICKNESS = 26,
  754. /// <summary>
  755. /// Ear Size - Small 0--+255 Large
  756. /// </summary>
  757. SHAPE_BIG_EARS = 27,
  758. /// <summary>
  759. /// Shoulders - Narrow 0--+255 Broad
  760. /// </summary>
  761. SHAPE_SHOULDERS = 28,
  762. /// <summary>
  763. /// Hip Width - Narrow 0--+255 Wide
  764. /// </summary>
  765. SHAPE_HIP_WIDTH = 29,
  766. /// <summary>
  767. /// - Short Torso 0--+255 Long Torso
  768. /// </summary>
  769. SHAPE_TORSO_LENGTH = 30,
  770. SHAPE_MALE = 31,
  771. /// <summary>
  772. /// - Short 0--+255 Long
  773. /// </summary>
  774. GLOVES_GLOVE_LENGTH = 32,
  775. /// <summary>
  776. /// - Darker 0--+255 Lighter
  777. /// </summary>
  778. EYES_EYE_LIGHTNESS = 33,
  779. /// <summary>
  780. /// - Natural 0--+255 Unnatural
  781. /// </summary>
  782. EYES_EYE_COLOR = 34,
  783. /// <summary>
  784. /// - Small 0--+255 Large
  785. /// </summary>
  786. SHAPE_BREAST_SIZE = 35,
  787. /// <summary>
  788. /// - None 0--+255 Wild
  789. /// </summary>
  790. SKIN_RAINBOW_COLOR = 36,
  791. /// <summary>
  792. /// Ruddiness - Pale 0--+255 Ruddy
  793. /// </summary>
  794. SKIN_RED_SKIN = 37,
  795. /// <summary>
  796. /// - Light 0--+255 Dark
  797. /// </summary>
  798. SKIN_PIGMENT = 38,
  799. HAIR_RAINBOW_COLOR_39 = 39,
  800. /// <summary>
  801. /// - No Red 0--+255 Very Red
  802. /// </summary>
  803. HAIR_RED_HAIR = 40,
  804. /// <summary>
  805. /// - Black 0--+255 Blonde
  806. /// </summary>
  807. HAIR_BLONDE_HAIR = 41,
  808. /// <summary>
  809. /// - No White 0--+255 All White
  810. /// </summary>
  811. HAIR_WHITE_HAIR = 42,
  812. /// <summary>
  813. /// - Less Rosy 0--+255 More Rosy
  814. /// </summary>
  815. SKIN_ROSY_COMPLEXION = 43,
  816. /// <summary>
  817. /// - Darker 0--+255 Pinker
  818. /// </summary>
  819. SKIN_LIP_PINKNESS = 44,
  820. /// <summary>
  821. /// - Thin Eyebrows 0--+255 Bushy Eyebrows
  822. /// </summary>
  823. HAIR_EYEBROW_SIZE = 45,
  824. /// <summary>
  825. /// - Short 0--+255 Long
  826. /// </summary>
  827. HAIR_FRONT_FRINGE = 46,
  828. /// <summary>
  829. /// - Short 0--+255 Long
  830. /// </summary>
  831. HAIR_SIDE_FRINGE = 47,
  832. /// <summary>
  833. /// - Short 0--+255 Long
  834. /// </summary>
  835. HAIR_BACK_FRINGE = 48,
  836. /// <summary>
  837. /// - Short 0--+255 Long
  838. /// </summary>
  839. HAIR_HAIR_FRONT = 49,
  840. /// <summary>
  841. /// - Short 0--+255 Long
  842. /// </summary>
  843. HAIR_HAIR_SIDES = 50,
  844. /// <summary>
  845. /// - Short 0--+255 Long
  846. /// </summary>
  847. HAIR_HAIR_BACK = 51,
  848. /// <summary>
  849. /// - Sweep Forward 0--+255 Sweep Back
  850. /// </summary>
  851. HAIR_HAIR_SWEEP = 52,
  852. /// <summary>
  853. /// - Left 0--+255 Right
  854. /// </summary>
  855. HAIR_HAIR_TILT = 53,
  856. /// <summary>
  857. /// Middle Part - No Part 0--+255 Part
  858. /// </summary>
  859. HAIR_HAIR_PART_MIDDLE = 54,
  860. /// <summary>
  861. /// Right Part - No Part 0--+255 Part
  862. /// </summary>
  863. HAIR_HAIR_PART_RIGHT = 55,
  864. /// <summary>
  865. /// Left Part - No Part 0--+255 Part
  866. /// </summary>
  867. HAIR_HAIR_PART_LEFT = 56,
  868. /// <summary>
  869. /// Full Hair Sides - Mowhawk 0--+255 Full Sides
  870. /// </summary>
  871. HAIR_HAIR_SIDES_FULL = 57,
  872. /// <summary>
  873. /// - Less 0--+255 More
  874. /// </summary>
  875. SKIN_BODY_DEFINITION = 58,
  876. /// <summary>
  877. /// Lip Width - Narrow Lips 0--+255 Wide Lips
  878. /// </summary>
  879. SHAPE_LIP_WIDTH = 59,
  880. /// <summary>
  881. /// - Small 0--+255 Big
  882. /// </summary>
  883. SHAPE_BELLY_SIZE = 60,
  884. /// <summary>
  885. /// - Less 0--+255 More
  886. /// </summary>
  887. SKIN_FACIAL_DEFINITION = 61,
  888. /// <summary>
  889. /// - Less 0--+255 More
  890. /// </summary>
  891. SKIN_WRINKLES = 62,
  892. /// <summary>
  893. /// - Less 0--+255 More
  894. /// </summary>
  895. SKIN_FRECKLES = 63,
  896. /// <summary>
  897. /// - Short Sideburns 0--+255 Mutton Chops
  898. /// </summary>
  899. HAIR_SIDEBURNS = 64,
  900. /// <summary>
  901. /// - Chaplin 0--+255 Handlebars
  902. /// </summary>
  903. HAIR_MOUSTACHE = 65,
  904. /// <summary>
  905. /// - Less soul 0--+255 More soul
  906. /// </summary>
  907. HAIR_SOULPATCH = 66,
  908. /// <summary>
  909. /// - Less Curtains 0--+255 More Curtains
  910. /// </summary>
  911. HAIR_CHIN_CURTAINS = 67,
  912. /// <summary>
  913. /// Rumpled Hair - Smooth Hair 0--+255 Rumpled Hair
  914. /// </summary>
  915. HAIR_HAIR_RUMPLED = 68,
  916. /// <summary>
  917. /// Big Hair Front - Less 0--+255 More
  918. /// </summary>
  919. HAIR_HAIR_BIG_FRONT = 69,
  920. /// <summary>
  921. /// Big Hair Top - Less 0--+255 More
  922. /// </summary>
  923. HAIR_HAIR_BIG_TOP = 70,
  924. /// <summary>
  925. /// Big Hair Back - Less 0--+255 More
  926. /// </summary>
  927. HAIR_HAIR_BIG_BACK = 71,
  928. /// <summary>
  929. /// Spiked Hair - No Spikes 0--+255 Big Spikes
  930. /// </summary>
  931. HAIR_HAIR_SPIKED = 72,
  932. /// <summary>
  933. /// Chin Depth - Shallow 0--+255 Deep
  934. /// </summary>
  935. SHAPE_DEEP_CHIN = 73,
  936. /// <summary>
  937. /// Part Bangs - No Part 0--+255 Part Bangs
  938. /// </summary>
  939. HAIR_BANGS_PART_MIDDLE = 74,
  940. /// <summary>
  941. /// Head Shape - More Square 0--+255 More Round
  942. /// </summary>
  943. SHAPE_HEAD_SHAPE = 75,
  944. /// <summary>
  945. /// Eye Spacing - Close Set Eyes 0--+255 Far Set Eyes
  946. /// </summary>
  947. SHAPE_EYE_SPACING = 76,
  948. /// <summary>
  949. /// - Low Heels 0--+255 High Heels
  950. /// </summary>
  951. SHOES_HEEL_HEIGHT = 77,
  952. /// <summary>
  953. /// - Low Platforms 0--+255 High Platforms
  954. /// </summary>
  955. SHOES_PLATFORM_HEIGHT = 78,
  956. /// <summary>
  957. /// - Thin Lips 0--+255 Fat Lips
  958. /// </summary>
  959. SHAPE_LIP_THICKNESS = 79,
  960. /// <summary>
  961. /// Mouth Position - High 0--+255 Low
  962. /// </summary>
  963. SHAPE_MOUTH_HEIGHT = 80,
  964. /// <summary>
  965. /// Breast Buoyancy - Less Gravity 0--+255 More Gravity
  966. /// </summary>
  967. SHAPE_BREAST_GRAVITY = 81,
  968. /// <summary>
  969. /// Platform Width - Narrow 0--+255 Wide
  970. /// </summary>
  971. SHOES_SHOE_PLATFORM_WIDTH = 82,
  972. /// <summary>
  973. /// - Pointy Heels 0--+255 Thick Heels
  974. /// </summary>
  975. SHOES_HEEL_SHAPE = 83,
  976. /// <summary>
  977. /// - Pointy 0--+255 Square
  978. /// </summary>
  979. SHOES_TOE_SHAPE = 84,
  980. /// <summary>
  981. /// Foot Size - Small 0--+255 Big
  982. /// </summary>
  983. SHAPE_FOOT_SIZE = 85,
  984. /// <summary>
  985. /// Nose Width - Narrow 0--+255 Wide
  986. /// </summary>
  987. SHAPE_WIDE_NOSE = 86,
  988. /// <summary>
  989. /// Eyelash Length - Short 0--+255 Long
  990. /// </summary>
  991. SHAPE_EYELASHES_LONG = 87,
  992. /// <summary>
  993. /// - Short 0--+255 Long
  994. /// </summary>
  995. UNDERSHIRT_SLEEVE_LENGTH = 88,
  996. /// <summary>
  997. /// - Short 0--+255 Long
  998. /// </summary>
  999. UNDERSHIRT_BOTTOM = 89,
  1000. /// <summary>
  1001. /// - Low 0--+255 High
  1002. /// </summary>
  1003. UNDERSHIRT_COLLAR_FRONT = 90,
  1004. JACKET_SLEEVE_LENGTH_91 = 91,
  1005. JACKET_COLLAR_FRONT_92 = 92,
  1006. /// <summary>
  1007. /// Jacket Length - Short 0--+255 Long
  1008. /// </summary>
  1009. JACKET_BOTTOM_LENGTH_LOWER = 93,
  1010. /// <summary>
  1011. /// Open Front - Open 0--+255 Closed
  1012. /// </summary>
  1013. JACKET_OPEN_JACKET = 94,
  1014. /// <summary>
  1015. /// - Short 0--+255 Tall
  1016. /// </summary>
  1017. SHOES_SHOE_HEIGHT = 95,
  1018. /// <summary>
  1019. /// - Short 0--+255 Long
  1020. /// </summary>
  1021. SOCKS_SOCKS_LENGTH = 96,
  1022. /// <summary>
  1023. /// - Short 0--+255 Long
  1024. /// </summary>
  1025. UNDERPANTS_PANTS_LENGTH = 97,
  1026. /// <summary>
  1027. /// - Low 0--+255 High
  1028. /// </summary>
  1029. UNDERPANTS_PANTS_WAIST = 98,
  1030. /// <summary>
  1031. /// Cuff Flare - Tight Cuffs 0--+255 Flared Cuffs
  1032. /// </summary>
  1033. PANTS_LEG_PANTFLAIR = 99,
  1034. /// <summary>
  1035. /// - More Vertical 0--+255 More Sloped
  1036. /// </summary>
  1037. SHAPE_FOREHEAD_ANGLE = 100,
  1038. /// <summary>
  1039. /// - Less Body Fat 0--+255 More Body Fat
  1040. /// </summary>
  1041. SHAPE_BODY_FAT = 101,
  1042. /// <summary>
  1043. /// Pants Crotch - High and Tight 0--+255 Low and Loose
  1044. /// </summary>
  1045. PANTS_LOW_CROTCH = 102,
  1046. /// <summary>
  1047. /// Egg Head - Chin Heavy 0--+255 Forehead Heavy
  1048. /// </summary>
  1049. SHAPE_EGG_HEAD = 103,
  1050. /// <summary>
  1051. /// Head Stretch - Squash Head 0--+255 Stretch Head
  1052. /// </summary>
  1053. SHAPE_SQUASH_STRETCH_HEAD = 104,
  1054. /// <summary>
  1055. /// Torso Muscles - Less Muscular 0--+255 More Muscular
  1056. /// </summary>
  1057. SHAPE_TORSO_MUSCLES = 105,
  1058. /// <summary>
  1059. /// Outer Eye Corner - Corner Down 0--+255 Corner Up
  1060. /// </summary>
  1061. SHAPE_EYELID_CORNER_UP = 106,
  1062. /// <summary>
  1063. /// - Less Muscular 0--+255 More Muscular
  1064. /// </summary>
  1065. SHAPE_LEG_MUSCLES = 107,
  1066. /// <summary>
  1067. /// Lip Fullness - Less Full 0--+255 More Full
  1068. /// </summary>
  1069. SHAPE_TALL_LIPS = 108,
  1070. /// <summary>
  1071. /// Toe Thickness - Flat Toe 0--+255 Thick Toe
  1072. /// </summary>
  1073. SHOES_SHOE_TOE_THICK = 109,
  1074. /// <summary>
  1075. /// Crooked Nose - Nose Left 0--+255 Nose Right
  1076. /// </summary>
  1077. SHAPE_CROOKED_NOSE = 110,
  1078. /// <summary>
  1079. /// - Corner Down 0--+255 Corner Up
  1080. /// </summary>
  1081. SHAPE_MOUTH_CORNER = 111,
  1082. /// <summary>
  1083. /// - Shear Right Up 0--+255 Shear Left Up
  1084. /// </summary>
  1085. SHAPE_FACE_SHEAR = 112,
  1086. /// <summary>
  1087. /// Shift Mouth - Shift Left 0--+255 Shift Right
  1088. /// </summary>
  1089. SHAPE_SHIFT_MOUTH = 113,
  1090. /// <summary>
  1091. /// Eye Pop - Pop Right Eye 0--+255 Pop Left Eye
  1092. /// </summary>
  1093. SHAPE_POP_EYE = 114,
  1094. /// <summary>
  1095. /// Jaw Jut - Overbite 0--+255 Underbite
  1096. /// </summary>
  1097. SHAPE_JAW_JUT = 115,
  1098. /// <summary>
  1099. /// Shear Back - Full Back 0--+255 Sheared Back
  1100. /// </summary>
  1101. HAIR_HAIR_SHEAR_BACK = 116,
  1102. /// <summary>
  1103. /// - Small Hands 0--+255 Large Hands
  1104. /// </summary>
  1105. SHAPE_HAND_SIZE = 117,
  1106. /// <summary>
  1107. /// Love Handles - Less Love 0--+255 More Love
  1108. /// </summary>
  1109. SHAPE_LOVE_HANDLES = 118,
  1110. SHAPE_TORSO_MUSCLES_119 = 119,
  1111. /// <summary>
  1112. /// Head Size - Small Head 0--+255 Big Head
  1113. /// </summary>
  1114. SHAPE_HEAD_SIZE = 120,
  1115. /// <summary>
  1116. /// - Skinny Neck 0--+255 Thick Neck
  1117. /// </summary>
  1118. SHAPE_NECK_THICKNESS = 121,
  1119. /// <summary>
  1120. /// Breast Cleavage - Separate 0--+255 Join
  1121. /// </summary>
  1122. SHAPE_BREAST_FEMALE_CLEAVAGE = 122,
  1123. /// <summary>
  1124. /// Pectorals - Big Pectorals 0--+255 Sunken Chest
  1125. /// </summary>
  1126. SHAPE_CHEST_MALE_NO_PECS = 123,
  1127. /// <summary>
  1128. /// Eye Size - Beady Eyes 0--+255 Anime Eyes
  1129. /// </summary>
  1130. SHAPE_EYE_SIZE = 124,
  1131. /// <summary>
  1132. /// - Short Legs 0--+255 Long Legs
  1133. /// </summary>
  1134. SHAPE_LEG_LENGTH = 125,
  1135. /// <summary>
  1136. /// - Short Arms 0--+255 Long arms
  1137. /// </summary>
  1138. SHAPE_ARM_LENGTH = 126,
  1139. /// <summary>
  1140. /// - Pink 0--+255 Black
  1141. /// </summary>
  1142. SKIN_LIPSTICK_COLOR = 127,
  1143. /// <summary>
  1144. /// - No Lipstick 0--+255 More Lipstick
  1145. /// </summary>
  1146. SKIN_LIPSTICK = 128,
  1147. /// <summary>
  1148. /// - No Lipgloss 0--+255 Glossy
  1149. /// </summary>
  1150. SKIN_LIPGLOSS = 129,
  1151. /// <summary>
  1152. /// - No Eyeliner 0--+255 Full Eyeliner
  1153. /// </summary>
  1154. SKIN_EYELINER = 130,
  1155. /// <summary>
  1156. /// - No Blush 0--+255 More Blush
  1157. /// </summary>
  1158. SKIN_BLUSH = 131,
  1159. /// <summary>
  1160. /// - Pink 0--+255 Orange
  1161. /// </summary>
  1162. SKIN_BLUSH_COLOR = 132,
  1163. /// <summary>
  1164. /// - Clear 0--+255 Opaque
  1165. /// </summary>
  1166. SKIN_OUT_SHDW_OPACITY = 133,
  1167. /// <summary>
  1168. /// - No Eyeshadow 0--+255 More Eyeshadow
  1169. /// </summary>
  1170. SKIN_OUTER_SHADOW = 134,
  1171. /// <summary>
  1172. /// - Light 0--+255 Dark
  1173. /// </summary>
  1174. SKIN_OUT_SHDW_COLOR = 135,
  1175. /// <summary>
  1176. /// - No Eyeshadow 0--+255 More Eyeshadow
  1177. /// </summary>
  1178. SKIN_INNER_SHADOW = 136,
  1179. /// <summary>
  1180. /// - No Polish 0--+255 Painted Nails
  1181. /// </summary>
  1182. SKIN_NAIL_POLISH = 137,
  1183. /// <summary>
  1184. /// - Clear 0--+255 Opaque
  1185. /// </summary>
  1186. SKIN_BLUSH_OPACITY = 138,
  1187. /// <summary>
  1188. /// - Light 0--+255 Dark
  1189. /// </summary>
  1190. SKIN_IN_SHDW_COLOR = 139,
  1191. /// <summary>
  1192. /// - Clear 0--+255 Opaque
  1193. /// </summary>
  1194. SKIN_IN_SHDW_OPACITY = 140,
  1195. /// <summary>
  1196. /// - Dark Green 0--+255 Black
  1197. /// </summary>
  1198. SKIN_EYELINER_COLOR = 141,
  1199. /// <summary>
  1200. /// - Pink 0--+255 Black
  1201. /// </summary>
  1202. SKIN_NAIL_POLISH_COLOR = 142,
  1203. /// <summary>
  1204. /// - Sparse 0--+255 Dense
  1205. /// </summary>
  1206. HAIR_EYEBROW_DENSITY = 143,
  1207. /// <summary>
  1208. /// - 5 O'Clock Shadow 0--+255 Bushy Hair
  1209. /// </summary>
  1210. HAIR_HAIR_THICKNESS = 144,
  1211. /// <summary>
  1212. /// Saddle Bags - Less Saddle 0--+255 More Saddle
  1213. /// </summary>
  1214. SHAPE_SADDLEBAGS = 145,
  1215. /// <summary>
  1216. /// Taper Back - Wide Back 0--+255 Narrow Back
  1217. /// </summary>
  1218. HAIR_HAIR_TAPER_BACK = 146,
  1219. /// <summary>
  1220. /// Taper Front - Wide Front 0--+255 Narrow Front
  1221. /// </summary>
  1222. HAIR_HAIR_TAPER_FRONT = 147,
  1223. /// <summary>
  1224. /// - Short Neck 0--+255 Long Neck
  1225. /// </summary>
  1226. SHAPE_NECK_LENGTH = 148,
  1227. /// <summary>
  1228. /// Eyebrow Height - Higher 0--+255 Lower
  1229. /// </summary>
  1230. HAIR_LOWER_EYEBROWS = 149,
  1231. /// <summary>
  1232. /// Lower Bridge - Low 0--+255 High
  1233. /// </summary>
  1234. SHAPE_LOWER_BRIDGE_NOSE = 150,
  1235. /// <summary>
  1236. /// Nostril Division - High 0--+255 Low
  1237. /// </summary>
  1238. SHAPE_LOW_SEPTUM_NOSE = 151,
  1239. /// <summary>
  1240. /// Jaw Angle - Low Jaw 0--+255 High Jaw
  1241. /// </summary>
  1242. SHAPE_JAW_ANGLE = 152,
  1243. /// <summary>
  1244. /// Shear Front - Full Front 0--+255 Sheared Front
  1245. /// </summary>
  1246. HAIR_HAIR_SHEAR_FRONT = 153,
  1247. /// <summary>
  1248. /// - Less Volume 0--+255 More Volume
  1249. /// </summary>
  1250. HAIR_HAIR_VOLUME = 154,
  1251. /// <summary>
  1252. /// Lip Cleft Depth - Shallow 0--+255 Deep
  1253. /// </summary>
  1254. SHAPE_LIP_CLEFT_DEEP = 155,
  1255. /// <summary>
  1256. /// Puffy Eyelids - Flat 0--+255 Puffy
  1257. /// </summary>
  1258. SHAPE_PUFFY_LOWER_LIDS = 156,
  1259. /// <summary>
  1260. /// - Sunken Eyes 0--+255 Bugged Eyes
  1261. /// </summary>
  1262. SHAPE_EYE_DEPTH = 157,
  1263. /// <summary>
  1264. /// - Flat Head 0--+255 Long Head
  1265. /// </summary>
  1266. SHAPE_HEAD_LENGTH = 158,
  1267. /// <summary>
  1268. /// - Less Freckles 0--+255 More Freckles
  1269. /// </summary>
  1270. SKIN_BODY_FRECKLES = 159,
  1271. /// <summary>
  1272. /// - Low 0--+255 High
  1273. /// </summary>
  1274. UNDERSHIRT_COLLAR_BACK = 160,
  1275. JACKET_COLLAR_BACK_161 = 161,
  1276. SHIRT_COLLAR_BACK_162 = 162,
  1277. /// <summary>
  1278. /// - Short Pigtails 0--+255 Long Pigtails
  1279. /// </summary>
  1280. HAIR_PIGTAILS = 163,
  1281. /// <summary>
  1282. /// - Short Ponytail 0--+255 Long Ponytail
  1283. /// </summary>
  1284. HAIR_PONYTAIL = 164,
  1285. /// <summary>
  1286. /// Butt Size - Flat Butt 0--+255 Big Butt
  1287. /// </summary>
  1288. SHAPE_BUTT_SIZE = 165,
  1289. /// <summary>
  1290. /// Ear Tips - Flat 0--+255 Pointy
  1291. /// </summary>
  1292. SHAPE_POINTY_EARS = 166,
  1293. /// <summary>
  1294. /// Lip Ratio - More Upper Lip 0--+255 More Lower Lip
  1295. /// </summary>
  1296. SHAPE_LIP_RATIO = 167,
  1297. SHIRT_SLEEVE_LENGTH_168 = 168,
  1298. /// <summary>
  1299. /// - Short 0--+255 Long
  1300. /// </summary>
  1301. SHIRT_SHIRT_BOTTOM = 169,
  1302. SHIRT_COLLAR_FRONT_170 = 170,
  1303. SHIRT_SHIRT_RED = 171,
  1304. SHIRT_SHIRT_GREEN = 172,
  1305. SHIRT_SHIRT_BLUE = 173,
  1306. PANTS_PANTS_RED = 174,
  1307. PANTS_PANTS_GREEN = 175,
  1308. PANTS_PANTS_BLUE = 176,
  1309. SHOES_SHOES_RED = 177,
  1310. SHOES_SHOES_GREEN = 178,
  1311. /// <summary>
  1312. /// - Low 0--+255 High
  1313. /// </summary>
  1314. PANTS_WAIST_HEIGHT = 179,
  1315. PANTS_PANTS_LENGTH_180 = 180,
  1316. /// <summary>
  1317. /// Pants Fit - Tight Pants 0--+255 Loose Pants
  1318. /// </summary>
  1319. PANTS_LOOSE_LOWER_CLOTHING = 181,
  1320. SHOES_SHOES_BLUE = 182,
  1321. SOCKS_SOCKS_RED = 183,
  1322. SOCKS_SOCKS_GREEN = 184,
  1323. SOCKS_SOCKS_BLUE = 185,
  1324. UNDERSHIRT_UNDERSHIRT_RED = 186,
  1325. UNDERSHIRT_UNDERSHIRT_GREEN = 187,
  1326. UNDERSHIRT_UNDERSHIRT_BLUE = 188,
  1327. UNDERPANTS_UNDERPANTS_RED = 189,
  1328. UNDERPANTS_UNDERPANTS_GREEN = 190,
  1329. UNDERPANTS_UNDERPANTS_BLUE = 191,
  1330. GLOVES_GLOVES_RED = 192,
  1331. /// <summary>
  1332. /// Shirt Fit - Tight Shirt 0--+255 Loose Shirt
  1333. /// </summary>
  1334. SHIRT_LOOSE_UPPER_CLOTHING = 193,
  1335. GLOVES_GLOVES_GREEN = 194,
  1336. GLOVES_GLOVES_BLUE = 195,
  1337. JACKET_JACKET_RED = 196,
  1338. JACKET_JACKET_GREEN = 197,
  1339. JACKET_JACKET_BLUE = 198,
  1340. /// <summary>
  1341. /// Sleeve Looseness - Tight Sleeves 0--+255 Loose Sleeves
  1342. /// </summary>
  1343. SHIRT_SHIRTSLEEVE_FLAIR = 199,
  1344. /// <summary>
  1345. /// Knee Angle - Knock Kneed 0--+255 Bow Legged
  1346. /// </summary>
  1347. SHAPE_BOWED_LEGS = 200,
  1348. /// <summary>
  1349. /// - Short hips 0--+255 Long Hips
  1350. /// </summary>
  1351. SHAPE_HIP_LENGTH = 201,
  1352. /// <summary>
  1353. /// - Fingerless 0--+255 Fingers
  1354. /// </summary>
  1355. GLOVES_GLOVE_FINGERS = 202,
  1356. /// <summary>
  1357. /// bustle skirt - no bustle 0--+255 more bustle
  1358. /// </summary>
  1359. SKIRT_SKIRT_BUSTLE = 203,
  1360. /// <summary>
  1361. /// - Short 0--+255 Long
  1362. /// </summary>
  1363. SKIRT_SKIRT_LENGTH = 204,
  1364. /// <summary>
  1365. /// - Open Front 0--+255 Closed Front
  1366. /// </summary>
  1367. SKIRT_SLIT_FRONT = 205,
  1368. /// <summary>
  1369. /// - Open Back 0--+255 Closed Back
  1370. /// </summary>
  1371. SKIRT_SLIT_BACK = 206,
  1372. /// <summary>
  1373. /// - Open Left 0--+255 Closed Left
  1374. /// </summary>
  1375. SKIRT_SLIT_LEFT = 207,
  1376. /// <summary>
  1377. /// - Open Right 0--+255 Closed Right
  1378. /// </summary>
  1379. SKIRT_SLIT_RIGHT = 208,
  1380. /// <summary>
  1381. /// Skirt Fit - Tight Skirt 0--+255 Poofy Skirt
  1382. /// </summary>
  1383. SKIRT_SKIRT_LOOSENESS = 209,
  1384. SHIRT_SHIRT_WRINKLES = 210,
  1385. PANTS_PANTS_WRINKLES = 211,
  1386. /// <summary>
  1387. /// Jacket Wrinkles - No Wrinkles 0--+255 Wrinkles
  1388. /// </summary>
  1389. JACKET_JACKET_WRINKLES = 212,
  1390. /// <summary>
  1391. /// Package - Coin Purse 0--+255 Duffle Bag
  1392. /// </summary>
  1393. SHAPE_MALE_PACKAGE = 213,
  1394. /// <summary>
  1395. /// Inner Eye Corner - Corner Down 0--+255 Corner Up
  1396. /// </summary>
  1397. SHAPE_EYELID_INNER_CORNER_UP = 214,
  1398. SKIRT_SKIRT_RED = 215,
  1399. SKIRT_SKIRT_GREEN = 216,
  1400. SKIRT_SKIRT_BLUE = 217
  1401. }
  1402. #endregion
  1403. }
  1404. }