llanimationstates.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /**
  2. * @file llanimationstates.h
  3. * @brief Implementation of animation state support.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLANIMATIONSTATES_H
  33. #define LL_LLANIMATIONSTATES_H
  34. #include "hbfastmap.h"
  35. #include "llstringtable.h"
  36. #include "lluuid.h"
  37. //-----------------------------------------------------------------------------
  38. // These bit flags are generally used to track the animation state of
  39. // characters. The simulator and viewer share these flags to interpret the
  40. // Animation name/value attribute on agents.
  41. //-----------------------------------------------------------------------------
  42. constexpr S32 MAX_CONCURRENT_ANIMS = 16;
  43. // Agent Animation State
  44. extern const LLUUID ANIM_AGENT_AFRAID;
  45. extern const LLUUID ANIM_AGENT_AIM_BAZOOKA_R;
  46. extern const LLUUID ANIM_AGENT_AIM_BOW_L;
  47. extern const LLUUID ANIM_AGENT_AIM_HANDGUN_R;
  48. extern const LLUUID ANIM_AGENT_AIM_RIFLE_R;
  49. extern const LLUUID ANIM_AGENT_ANGRY;
  50. extern const LLUUID ANIM_AGENT_AWAY;
  51. extern const LLUUID ANIM_AGENT_BACKFLIP;
  52. extern const LLUUID ANIM_AGENT_BELLY_LAUGH;
  53. extern const LLUUID ANIM_AGENT_BLOW_KISS;
  54. extern const LLUUID ANIM_AGENT_BORED;
  55. extern const LLUUID ANIM_AGENT_BOW;
  56. extern const LLUUID ANIM_AGENT_BRUSH;
  57. extern const LLUUID ANIM_AGENT_BUSY;
  58. extern const LLUUID ANIM_AGENT_CLAP;
  59. extern const LLUUID ANIM_AGENT_COURTBOW;
  60. extern const LLUUID ANIM_AGENT_CROUCH;
  61. extern const LLUUID ANIM_AGENT_CROUCHWALK;
  62. extern const LLUUID ANIM_AGENT_CRY;
  63. extern const LLUUID ANIM_AGENT_CUSTOMIZE;
  64. extern const LLUUID ANIM_AGENT_CUSTOMIZE_DONE;
  65. extern const LLUUID ANIM_AGENT_DANCE1;
  66. extern const LLUUID ANIM_AGENT_DANCE2;
  67. extern const LLUUID ANIM_AGENT_DANCE3;
  68. extern const LLUUID ANIM_AGENT_DANCE4;
  69. extern const LLUUID ANIM_AGENT_DANCE5;
  70. extern const LLUUID ANIM_AGENT_DANCE6;
  71. extern const LLUUID ANIM_AGENT_DANCE7;
  72. extern const LLUUID ANIM_AGENT_DANCE8;
  73. extern const LLUUID ANIM_AGENT_DEAD;
  74. extern const LLUUID ANIM_AGENT_DRINK;
  75. extern const LLUUID ANIM_AGENT_EMBARRASSED;
  76. extern const LLUUID ANIM_AGENT_EXPRESS_AFRAID;
  77. extern const LLUUID ANIM_AGENT_EXPRESS_ANGER;
  78. extern const LLUUID ANIM_AGENT_EXPRESS_BORED;
  79. extern const LLUUID ANIM_AGENT_EXPRESS_CRY;
  80. extern const LLUUID ANIM_AGENT_EXPRESS_DISDAIN;
  81. extern const LLUUID ANIM_AGENT_EXPRESS_EMBARRASSED;
  82. extern const LLUUID ANIM_AGENT_EXPRESS_FROWN;
  83. extern const LLUUID ANIM_AGENT_EXPRESS_KISS;
  84. extern const LLUUID ANIM_AGENT_EXPRESS_LAUGH;
  85. extern const LLUUID ANIM_AGENT_EXPRESS_OPEN_MOUTH;
  86. extern const LLUUID ANIM_AGENT_EXPRESS_REPULSED;
  87. extern const LLUUID ANIM_AGENT_EXPRESS_SAD;
  88. extern const LLUUID ANIM_AGENT_EXPRESS_SHRUG;
  89. extern const LLUUID ANIM_AGENT_EXPRESS_SMILE;
  90. extern const LLUUID ANIM_AGENT_EXPRESS_SURPRISE;
  91. extern const LLUUID ANIM_AGENT_EXPRESS_TONGUE_OUT;
  92. extern const LLUUID ANIM_AGENT_EXPRESS_TOOTHSMILE;
  93. extern const LLUUID ANIM_AGENT_EXPRESS_WINK;
  94. extern const LLUUID ANIM_AGENT_EXPRESS_WORRY;
  95. extern const LLUUID ANIM_AGENT_FALLDOWN;
  96. extern const LLUUID ANIM_AGENT_FEMALE_LAND;
  97. extern const LLUUID ANIM_AGENT_FEMALE_RUN_NEW;
  98. extern const LLUUID ANIM_AGENT_FEMALE_WALK;
  99. extern const LLUUID ANIM_AGENT_FEMALE_WALK_NEW;
  100. extern const LLUUID ANIM_AGENT_FINGER_WAG;
  101. extern const LLUUID ANIM_AGENT_FIST_PUMP;
  102. extern const LLUUID ANIM_AGENT_FLY;
  103. extern const LLUUID ANIM_AGENT_FLYSLOW;
  104. extern const LLUUID ANIM_AGENT_HELLO;
  105. extern const LLUUID ANIM_AGENT_HOLD_BAZOOKA_R;
  106. extern const LLUUID ANIM_AGENT_HOLD_BOW_L;
  107. extern const LLUUID ANIM_AGENT_HOLD_HANDGUN_R;
  108. extern const LLUUID ANIM_AGENT_HOLD_RIFLE_R;
  109. extern const LLUUID ANIM_AGENT_HOLD_THROW_R;
  110. extern const LLUUID ANIM_AGENT_HOVER;
  111. extern const LLUUID ANIM_AGENT_HOVER_DOWN;
  112. extern const LLUUID ANIM_AGENT_HOVER_UP;
  113. extern const LLUUID ANIM_AGENT_IMPATIENT;
  114. extern const LLUUID ANIM_AGENT_JUMP;
  115. extern const LLUUID ANIM_AGENT_JUMP_FOR_JOY;
  116. extern const LLUUID ANIM_AGENT_KISS_MY_BUTT;
  117. extern const LLUUID ANIM_AGENT_LAND;
  118. extern const LLUUID ANIM_AGENT_LAUGH_SHORT;
  119. extern const LLUUID ANIM_AGENT_MEDIUM_LAND;
  120. extern const LLUUID ANIM_AGENT_MOTORCYCLE_SIT;
  121. extern const LLUUID ANIM_AGENT_MUSCLE_BEACH;
  122. extern const LLUUID ANIM_AGENT_NO;
  123. extern const LLUUID ANIM_AGENT_NO_UNHAPPY;
  124. extern const LLUUID ANIM_AGENT_NYAH_NYAH;
  125. extern const LLUUID ANIM_AGENT_ONETWO_PUNCH;
  126. extern const LLUUID ANIM_AGENT_PEACE;
  127. extern const LLUUID ANIM_AGENT_POINT_ME;
  128. extern const LLUUID ANIM_AGENT_POINT_YOU;
  129. extern const LLUUID ANIM_AGENT_PRE_JUMP;
  130. extern const LLUUID ANIM_AGENT_PUNCH_LEFT;
  131. extern const LLUUID ANIM_AGENT_PUNCH_RIGHT;
  132. extern const LLUUID ANIM_AGENT_REPULSED;
  133. extern const LLUUID ANIM_AGENT_ROUNDHOUSE_KICK;
  134. extern const LLUUID ANIM_AGENT_RPS_COUNTDOWN;
  135. extern const LLUUID ANIM_AGENT_RPS_PAPER;
  136. extern const LLUUID ANIM_AGENT_RPS_ROCK;
  137. extern const LLUUID ANIM_AGENT_RPS_SCISSORS;
  138. extern const LLUUID ANIM_AGENT_RUN;
  139. extern const LLUUID ANIM_AGENT_RUN_NEW;
  140. extern const LLUUID ANIM_AGENT_SAD;
  141. extern const LLUUID ANIM_AGENT_SALUTE;
  142. extern const LLUUID ANIM_AGENT_SHOOT_BOW_L;
  143. extern const LLUUID ANIM_AGENT_SHOUT;
  144. extern const LLUUID ANIM_AGENT_SHRUG;
  145. extern const LLUUID ANIM_AGENT_SIT;
  146. extern const LLUUID ANIM_AGENT_SIT_FEMALE;
  147. extern const LLUUID ANIM_AGENT_SIT_GENERIC;
  148. extern const LLUUID ANIM_AGENT_SIT_GROUND;
  149. extern const LLUUID ANIM_AGENT_SIT_GROUND_CONSTRAINED;
  150. extern const LLUUID ANIM_AGENT_SIT_TO_STAND;
  151. extern const LLUUID ANIM_AGENT_SLEEP;
  152. extern const LLUUID ANIM_AGENT_SMOKE_IDLE;
  153. extern const LLUUID ANIM_AGENT_SMOKE_INHALE;
  154. extern const LLUUID ANIM_AGENT_SMOKE_THROW_DOWN;
  155. extern const LLUUID ANIM_AGENT_SNAPSHOT;
  156. extern const LLUUID ANIM_AGENT_STAND;
  157. extern const LLUUID ANIM_AGENT_STANDUP;
  158. extern const LLUUID ANIM_AGENT_STAND_1;
  159. extern const LLUUID ANIM_AGENT_STAND_2;
  160. extern const LLUUID ANIM_AGENT_STAND_3;
  161. extern const LLUUID ANIM_AGENT_STAND_4;
  162. extern const LLUUID ANIM_AGENT_STRETCH;
  163. extern const LLUUID ANIM_AGENT_STRIDE;
  164. extern const LLUUID ANIM_AGENT_SURF;
  165. extern const LLUUID ANIM_AGENT_SURPRISE;
  166. extern const LLUUID ANIM_AGENT_SWORD_STRIKE;
  167. extern const LLUUID ANIM_AGENT_TALK;
  168. extern const LLUUID ANIM_AGENT_TANTRUM;
  169. extern const LLUUID ANIM_AGENT_THROW_R;
  170. extern const LLUUID ANIM_AGENT_TRYON_SHIRT;
  171. extern const LLUUID ANIM_AGENT_TURNLEFT;
  172. extern const LLUUID ANIM_AGENT_TURNRIGHT;
  173. extern const LLUUID ANIM_AGENT_TYPE;
  174. extern const LLUUID ANIM_AGENT_WALK;
  175. extern const LLUUID ANIM_AGENT_WALK_NEW;
  176. extern const LLUUID ANIM_AGENT_WHISPER;
  177. extern const LLUUID ANIM_AGENT_WHISTLE;
  178. extern const LLUUID ANIM_AGENT_WINK;
  179. extern const LLUUID ANIM_AGENT_WINK_HOLLYWOOD;
  180. extern const LLUUID ANIM_AGENT_WORRY;
  181. extern const LLUUID ANIM_AGENT_YES;
  182. extern const LLUUID ANIM_AGENT_YES_HAPPY;
  183. extern const LLUUID ANIM_AGENT_YOGA_FLOAT;
  184. // These used to be in llvoavatar.h, but they are better here, so that we can
  185. // add them to the gAnimLibrary in llanimationstates.cpp instead of in
  186. // llvoavatar.cpp... HB
  187. extern const LLUUID ANIM_AGENT_BODY_NOISE;
  188. extern const LLUUID ANIM_AGENT_BREATHE_ROT;
  189. extern const LLUUID ANIM_AGENT_PHYSICS_MOTION;
  190. #if LL_PUPPETRY
  191. extern const LLUUID ANIM_AGENT_PUPPET_MOTION;
  192. #endif
  193. extern const LLUUID ANIM_AGENT_EDITING;
  194. extern const LLUUID ANIM_AGENT_EYE;
  195. extern const LLUUID ANIM_AGENT_FLY_ADJUST;
  196. extern const LLUUID ANIM_AGENT_HAND_MOTION;
  197. extern const LLUUID ANIM_AGENT_HEAD_ROT;
  198. extern const LLUUID ANIM_AGENT_PELVIS_FIX;
  199. extern const LLUUID ANIM_AGENT_TARGET;
  200. extern const LLUUID ANIM_AGENT_WALK_ADJUST;
  201. // Zero priority Bento joints default/idle animation.
  202. extern const LLUUID ANIM_AGENT_BENTO_IDLE;
  203. extern LLUUID AGENT_WALK_ANIMS[];
  204. extern S32 NUM_AGENT_WALK_ANIMS;
  205. extern LLUUID AGENT_GUN_HOLD_ANIMS[];
  206. extern S32 NUM_AGENT_GUN_HOLD_ANIMS;
  207. extern LLUUID AGENT_GUN_AIM_ANIMS[];
  208. extern S32 NUM_AGENT_GUN_AIM_ANIMS;
  209. extern LLUUID AGENT_NO_ROTATE_ANIMS[];
  210. extern S32 NUM_AGENT_NO_ROTATE_ANIMS;
  211. extern LLUUID AGENT_STAND_ANIMS[];
  212. extern S32 NUM_AGENT_STAND_ANIMS;
  213. class LLAnimationLibrary
  214. {
  215. private:
  216. LLStringTable mAnimStringTable;
  217. typedef fast_hmap<LLUUID, char*> anim_name_map_t;
  218. anim_name_map_t mAnimMap;
  219. public:
  220. LLAnimationLibrary();
  221. // Returns the text name of a single animation state, or NULL if the state
  222. // is invalid
  223. const char* animStateToString(const LLUUID& state);
  224. // Returns the animation state for the given name or NULL if the name is
  225. // invalid.
  226. LLUUID stringToAnimState(const std::string& name, bool allow_ids = true);
  227. // Returns the animation state for the given name or the UUID is not found.
  228. std::string animationName(const LLUUID& id);
  229. };
  230. struct LLAnimStateEntry
  231. {
  232. LLAnimStateEntry(const char* name, const LLUUID& id)
  233. : mName(name),
  234. mID(id)
  235. {
  236. // LABELS:
  237. // Look to newview/LLAnimStateLabels.* for how to get the labels.
  238. // The labels should no longer be stored in this structure. The server
  239. // should not care about the local friendly name of an animation, and
  240. // this is common code.
  241. }
  242. const char* mName;
  243. const LLUUID mID;
  244. };
  245. // Animation states that the user can trigger
  246. extern const LLAnimStateEntry gUserAnimStates[];
  247. extern const S32 gUserAnimStatesCount;
  248. extern LLAnimationLibrary gAnimLibrary;
  249. #endif // LL_LLANIMATIONSTATES_H