PageRenderTime 75ms CodeModel.GetById 62ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcharacter/llanimationstates.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 262 lines | 183 code | 26 blank | 53 comment | 0 complexity | e5b87dd0ac3a82e0a63c22b67cdea656 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llanimationstates.h
  3. * @brief Implementation of animation state support.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLANIMATIONSTATES_H
  27. #define LL_LLANIMATIONSTATES_H
  28. #include <map>
  29. #include "string_table.h"
  30. #include "lluuid.h"
  31. //-----------------------------------------------------------------------------
  32. // These bit flags are generally used to track the animation state
  33. // of characters. The simulator and viewer share these flags to interpret
  34. // the Animation name/value attribute on agents.
  35. //-----------------------------------------------------------------------------
  36. //-----------------------------------------------------------------------------
  37. // Agent Animation State
  38. //-----------------------------------------------------------------------------
  39. const S32 MAX_CONCURRENT_ANIMS = 16;
  40. extern const LLUUID ANIM_AGENT_AFRAID;
  41. extern const LLUUID ANIM_AGENT_AIM_BAZOOKA_R;
  42. extern const LLUUID ANIM_AGENT_AIM_BOW_L;
  43. extern const LLUUID ANIM_AGENT_AIM_HANDGUN_R;
  44. extern const LLUUID ANIM_AGENT_AIM_RIFLE_R;
  45. extern const LLUUID ANIM_AGENT_ANGRY;
  46. extern const LLUUID ANIM_AGENT_AWAY;
  47. extern const LLUUID ANIM_AGENT_BACKFLIP;
  48. extern const LLUUID ANIM_AGENT_BELLY_LAUGH;
  49. extern const LLUUID ANIM_AGENT_BLOW_KISS;
  50. extern const LLUUID ANIM_AGENT_BORED;
  51. extern const LLUUID ANIM_AGENT_BOW;
  52. extern const LLUUID ANIM_AGENT_BRUSH;
  53. extern const LLUUID ANIM_AGENT_BUSY;
  54. extern const LLUUID ANIM_AGENT_CLAP;
  55. extern const LLUUID ANIM_AGENT_COURTBOW;
  56. extern const LLUUID ANIM_AGENT_CROUCH;
  57. extern const LLUUID ANIM_AGENT_CROUCHWALK;
  58. extern const LLUUID ANIM_AGENT_CRY;
  59. extern const LLUUID ANIM_AGENT_CUSTOMIZE;
  60. extern const LLUUID ANIM_AGENT_CUSTOMIZE_DONE;
  61. extern const LLUUID ANIM_AGENT_DANCE1;
  62. extern const LLUUID ANIM_AGENT_DANCE2;
  63. extern const LLUUID ANIM_AGENT_DANCE3;
  64. extern const LLUUID ANIM_AGENT_DANCE4;
  65. extern const LLUUID ANIM_AGENT_DANCE5;
  66. extern const LLUUID ANIM_AGENT_DANCE6;
  67. extern const LLUUID ANIM_AGENT_DANCE7;
  68. extern const LLUUID ANIM_AGENT_DANCE8;
  69. extern const LLUUID ANIM_AGENT_DEAD;
  70. extern const LLUUID ANIM_AGENT_DRINK;
  71. extern const LLUUID ANIM_AGENT_EMBARRASSED;
  72. extern const LLUUID ANIM_AGENT_EXPRESS_AFRAID;
  73. extern const LLUUID ANIM_AGENT_EXPRESS_ANGER;
  74. extern const LLUUID ANIM_AGENT_EXPRESS_BORED;
  75. extern const LLUUID ANIM_AGENT_EXPRESS_CRY;
  76. extern const LLUUID ANIM_AGENT_EXPRESS_DISDAIN;
  77. extern const LLUUID ANIM_AGENT_EXPRESS_EMBARRASSED;
  78. extern const LLUUID ANIM_AGENT_EXPRESS_FROWN;
  79. extern const LLUUID ANIM_AGENT_EXPRESS_KISS;
  80. extern const LLUUID ANIM_AGENT_EXPRESS_LAUGH;
  81. extern const LLUUID ANIM_AGENT_EXPRESS_OPEN_MOUTH;
  82. extern const LLUUID ANIM_AGENT_EXPRESS_REPULSED;
  83. extern const LLUUID ANIM_AGENT_EXPRESS_SAD;
  84. extern const LLUUID ANIM_AGENT_EXPRESS_SHRUG;
  85. extern const LLUUID ANIM_AGENT_EXPRESS_SMILE;
  86. extern const LLUUID ANIM_AGENT_EXPRESS_SURPRISE;
  87. extern const LLUUID ANIM_AGENT_EXPRESS_TONGUE_OUT;
  88. extern const LLUUID ANIM_AGENT_EXPRESS_TOOTHSMILE;
  89. extern const LLUUID ANIM_AGENT_EXPRESS_WINK;
  90. extern const LLUUID ANIM_AGENT_EXPRESS_WORRY;
  91. extern const LLUUID ANIM_AGENT_FALLDOWN;
  92. extern const LLUUID ANIM_AGENT_FEMALE_RUN_NEW;
  93. extern const LLUUID ANIM_AGENT_FEMALE_WALK;
  94. extern const LLUUID ANIM_AGENT_FEMALE_WALK_NEW;
  95. extern const LLUUID ANIM_AGENT_FINGER_WAG;
  96. extern const LLUUID ANIM_AGENT_FIST_PUMP;
  97. extern const LLUUID ANIM_AGENT_FLY;
  98. extern const LLUUID ANIM_AGENT_FLYSLOW;
  99. extern const LLUUID ANIM_AGENT_HELLO;
  100. extern const LLUUID ANIM_AGENT_HOLD_BAZOOKA_R;
  101. extern const LLUUID ANIM_AGENT_HOLD_BOW_L;
  102. extern const LLUUID ANIM_AGENT_HOLD_HANDGUN_R;
  103. extern const LLUUID ANIM_AGENT_HOLD_RIFLE_R;
  104. extern const LLUUID ANIM_AGENT_HOLD_THROW_R;
  105. extern const LLUUID ANIM_AGENT_HOVER;
  106. extern const LLUUID ANIM_AGENT_HOVER_DOWN;
  107. extern const LLUUID ANIM_AGENT_HOVER_UP;
  108. extern const LLUUID ANIM_AGENT_IMPATIENT;
  109. extern const LLUUID ANIM_AGENT_JUMP;
  110. extern const LLUUID ANIM_AGENT_JUMP_FOR_JOY;
  111. extern const LLUUID ANIM_AGENT_KISS_MY_BUTT;
  112. extern const LLUUID ANIM_AGENT_LAND;
  113. extern const LLUUID ANIM_AGENT_LAUGH_SHORT;
  114. extern const LLUUID ANIM_AGENT_MEDIUM_LAND;
  115. extern const LLUUID ANIM_AGENT_MOTORCYCLE_SIT;
  116. extern const LLUUID ANIM_AGENT_MUSCLE_BEACH;
  117. extern const LLUUID ANIM_AGENT_NO;
  118. extern const LLUUID ANIM_AGENT_NO_UNHAPPY;
  119. extern const LLUUID ANIM_AGENT_NYAH_NYAH;
  120. extern const LLUUID ANIM_AGENT_ONETWO_PUNCH;
  121. extern const LLUUID ANIM_AGENT_PEACE;
  122. extern const LLUUID ANIM_AGENT_POINT_ME;
  123. extern const LLUUID ANIM_AGENT_POINT_YOU;
  124. extern const LLUUID ANIM_AGENT_PRE_JUMP;
  125. extern const LLUUID ANIM_AGENT_PUNCH_LEFT;
  126. extern const LLUUID ANIM_AGENT_PUNCH_RIGHT;
  127. extern const LLUUID ANIM_AGENT_REPULSED;
  128. extern const LLUUID ANIM_AGENT_ROUNDHOUSE_KICK;
  129. extern const LLUUID ANIM_AGENT_RPS_COUNTDOWN;
  130. extern const LLUUID ANIM_AGENT_RPS_PAPER;
  131. extern const LLUUID ANIM_AGENT_RPS_ROCK;
  132. extern const LLUUID ANIM_AGENT_RPS_SCISSORS;
  133. extern const LLUUID ANIM_AGENT_RUN;
  134. extern const LLUUID ANIM_AGENT_RUN_NEW;
  135. extern const LLUUID ANIM_AGENT_SAD;
  136. extern const LLUUID ANIM_AGENT_SALUTE;
  137. extern const LLUUID ANIM_AGENT_SHOOT_BOW_L;
  138. extern const LLUUID ANIM_AGENT_SHOUT;
  139. extern const LLUUID ANIM_AGENT_SHRUG;
  140. extern const LLUUID ANIM_AGENT_SIT;
  141. extern const LLUUID ANIM_AGENT_SIT_FEMALE;
  142. extern const LLUUID ANIM_AGENT_SIT_GENERIC;
  143. extern const LLUUID ANIM_AGENT_SIT_GROUND;
  144. extern const LLUUID ANIM_AGENT_SIT_GROUND_CONSTRAINED;
  145. extern const LLUUID ANIM_AGENT_SIT_TO_STAND;
  146. extern const LLUUID ANIM_AGENT_SLEEP;
  147. extern const LLUUID ANIM_AGENT_SMOKE_IDLE;
  148. extern const LLUUID ANIM_AGENT_SMOKE_INHALE;
  149. extern const LLUUID ANIM_AGENT_SMOKE_THROW_DOWN;
  150. extern const LLUUID ANIM_AGENT_SNAPSHOT;
  151. extern const LLUUID ANIM_AGENT_STAND;
  152. extern const LLUUID ANIM_AGENT_STANDUP;
  153. extern const LLUUID ANIM_AGENT_STAND_1;
  154. extern const LLUUID ANIM_AGENT_STAND_2;
  155. extern const LLUUID ANIM_AGENT_STAND_3;
  156. extern const LLUUID ANIM_AGENT_STAND_4;
  157. extern const LLUUID ANIM_AGENT_STRETCH;
  158. extern const LLUUID ANIM_AGENT_STRIDE;
  159. extern const LLUUID ANIM_AGENT_SURF;
  160. extern const LLUUID ANIM_AGENT_SURPRISE;
  161. extern const LLUUID ANIM_AGENT_SWORD_STRIKE;
  162. extern const LLUUID ANIM_AGENT_TALK;
  163. extern const LLUUID ANIM_AGENT_TANTRUM;
  164. extern const LLUUID ANIM_AGENT_THROW_R;
  165. extern const LLUUID ANIM_AGENT_TRYON_SHIRT;
  166. extern const LLUUID ANIM_AGENT_TURNLEFT;
  167. extern const LLUUID ANIM_AGENT_TURNRIGHT;
  168. extern const LLUUID ANIM_AGENT_TYPE;
  169. extern const LLUUID ANIM_AGENT_WALK;
  170. extern const LLUUID ANIM_AGENT_WALK_NEW;
  171. extern const LLUUID ANIM_AGENT_WHISPER;
  172. extern const LLUUID ANIM_AGENT_WHISTLE;
  173. extern const LLUUID ANIM_AGENT_WINK;
  174. extern const LLUUID ANIM_AGENT_WINK_HOLLYWOOD;
  175. extern const LLUUID ANIM_AGENT_WORRY;
  176. extern const LLUUID ANIM_AGENT_YES;
  177. extern const LLUUID ANIM_AGENT_YES_HAPPY;
  178. extern const LLUUID ANIM_AGENT_YOGA_FLOAT;
  179. extern LLUUID AGENT_WALK_ANIMS[];
  180. extern S32 NUM_AGENT_WALK_ANIMS;
  181. extern LLUUID AGENT_GUN_HOLD_ANIMS[];
  182. extern S32 NUM_AGENT_GUN_HOLD_ANIMS;
  183. extern LLUUID AGENT_GUN_AIM_ANIMS[];
  184. extern S32 NUM_AGENT_GUN_AIM_ANIMS;
  185. extern LLUUID AGENT_NO_ROTATE_ANIMS[];
  186. extern S32 NUM_AGENT_NO_ROTATE_ANIMS;
  187. extern LLUUID AGENT_STAND_ANIMS[];
  188. extern S32 NUM_AGENT_STAND_ANIMS;
  189. class LLAnimationLibrary
  190. {
  191. private:
  192. LLStringTable mAnimStringTable;
  193. typedef std::map<LLUUID, char *> anim_map_t;
  194. anim_map_t mAnimMap;
  195. public:
  196. LLAnimationLibrary();
  197. ~LLAnimationLibrary();
  198. //-----------------------------------------------------------------------------
  199. // Return the text name of a single animation state,
  200. // Return NULL if the state is invalid
  201. //-----------------------------------------------------------------------------
  202. const char *animStateToString( const LLUUID& state );
  203. //-----------------------------------------------------------------------------
  204. // Return the animation state for the given name.
  205. // Retun NULL if the name is invalid.
  206. //-----------------------------------------------------------------------------
  207. LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE );
  208. //-----------------------------------------------------------------------------
  209. // Associate an anim state with a name
  210. //-----------------------------------------------------------------------------
  211. void animStateSetString( const LLUUID& state, const std::string& name);
  212. //-----------------------------------------------------------------------------
  213. // Find the name for a given animation, or UUID string if none defined.
  214. //-----------------------------------------------------------------------------
  215. std::string animationName( const LLUUID& id ) const;
  216. };
  217. struct LLAnimStateEntry
  218. {
  219. LLAnimStateEntry(const char* name, const LLUUID& id) :
  220. mName(name),
  221. mID(id)
  222. {
  223. // LABELS:
  224. // Look to newview/LLAnimStateLabels.* for how to get the labels.
  225. // The labels should no longer be stored in this structure. The server
  226. // shouldn't care about the local friendly name of an animation, and
  227. // this is common code.
  228. }
  229. const char* mName;
  230. const LLUUID mID;
  231. };
  232. // Animation states that the user can trigger
  233. extern const LLAnimStateEntry gUserAnimStates[];
  234. extern const S32 gUserAnimStatesCount;
  235. extern LLAnimationLibrary gAnimLibrary;
  236. #endif // LL_LLANIMATIONSTATES_H