PageRenderTime 103ms CodeModel.GetById 12ms app.highlight 82ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcharacter/llanimationstates.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 496 lines | 420 code | 28 blank | 48 comment | 10 complexity | ee51a8bcdf347b50d940e7d5e4a9ef37 MD5 | raw file
  1/** 
  2 * @file llanimationstates.cpp
  3 * @brief Implementation of animation state related functions.
  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
 27//-----------------------------------------------------------------------------
 28// Agent Animation State
 29//-----------------------------------------------------------------------------
 30
 31#include "linden_common.h"
 32
 33#include "llanimationstates.h"
 34#include "llstring.h"
 35
 36LLUUID const ANIM_AGENT_AFRAID                ("6b61c8e8-4747-0d75-12d7-e49ff207a4ca");
 37LLUUID const ANIM_AGENT_AIM_BAZOOKA_R         ("b5b4a67d-0aee-30d2-72cd-77b333e932ef");
 38LLUUID const ANIM_AGENT_AIM_BOW_L             ("46bb4359-de38-4ed8-6a22-f1f52fe8f506");
 39LLUUID const ANIM_AGENT_AIM_HANDGUN_R         ("3147d815-6338-b932-f011-16b56d9ac18b");
 40LLUUID const ANIM_AGENT_AIM_RIFLE_R           ("ea633413-8006-180a-c3ba-96dd1d756720");
 41LLUUID const ANIM_AGENT_ANGRY                 ("5747a48e-073e-c331-f6f3-7c2149613d3e");
 42LLUUID const ANIM_AGENT_AWAY                  ("fd037134-85d4-f241-72c6-4f42164fedee");
 43LLUUID const ANIM_AGENT_BACKFLIP              ("c4ca6188-9127-4f31-0158-23c4e2f93304");
 44LLUUID const ANIM_AGENT_BELLY_LAUGH           ("18b3a4b5-b463-bd48-e4b6-71eaac76c515");
 45LLUUID const ANIM_AGENT_BLOW_KISS             ("db84829b-462c-ee83-1e27-9bbee66bd624");
 46LLUUID const ANIM_AGENT_BORED                 ("b906c4ba-703b-1940-32a3-0c7f7d791510");
 47LLUUID const ANIM_AGENT_BOW                   ("82e99230-c906-1403-4d9c-3889dd98daba");
 48LLUUID const ANIM_AGENT_BRUSH                 ("349a3801-54f9-bf2c-3bd0-1ac89772af01");
 49LLUUID const ANIM_AGENT_BUSY                  ("efcf670c-2d18-8128-973a-034ebc806b67");
 50LLUUID const ANIM_AGENT_CLAP                  ("9b0c1c4e-8ac7-7969-1494-28c874c4f668");
 51LLUUID const ANIM_AGENT_COURTBOW              ("9ba1c942-08be-e43a-fb29-16ad440efc50");
 52LLUUID const ANIM_AGENT_CROUCH                ("201f3fdf-cb1f-dbec-201f-7333e328ae7c");
 53LLUUID const ANIM_AGENT_CROUCHWALK            ("47f5f6fb-22e5-ae44-f871-73aaaf4a6022");
 54LLUUID const ANIM_AGENT_CRY                   ("92624d3e-1068-f1aa-a5ec-8244585193ed");
 55LLUUID const ANIM_AGENT_CUSTOMIZE             ("038fcec9-5ebd-8a8e-0e2e-6e71a0a1ac53");
 56LLUUID const ANIM_AGENT_CUSTOMIZE_DONE        ("6883a61a-b27b-5914-a61e-dda118a9ee2c");
 57LLUUID const ANIM_AGENT_DANCE1                ("b68a3d7c-de9e-fc87-eec8-543d787e5b0d");
 58LLUUID const ANIM_AGENT_DANCE2                ("928cae18-e31d-76fd-9cc9-2f55160ff818");
 59LLUUID const ANIM_AGENT_DANCE3                ("30047778-10ea-1af7-6881-4db7a3a5a114");
 60LLUUID const ANIM_AGENT_DANCE4                ("951469f4-c7b2-c818-9dee-ad7eea8c30b7");
 61LLUUID const ANIM_AGENT_DANCE5                ("4bd69a1d-1114-a0b4-625f-84e0a5237155");
 62LLUUID const ANIM_AGENT_DANCE6                ("cd28b69b-9c95-bb78-3f94-8d605ff1bb12");
 63LLUUID const ANIM_AGENT_DANCE7                ("a54d8ee2-28bb-80a9-7f0c-7afbbe24a5d6");
 64LLUUID const ANIM_AGENT_DANCE8                ("b0dc417c-1f11-af36-2e80-7e7489fa7cdc");
 65LLUUID const ANIM_AGENT_DEAD                  ("57abaae6-1d17-7b1b-5f98-6d11a6411276");
 66LLUUID const ANIM_AGENT_DRINK                 ("0f86e355-dd31-a61c-fdb0-3a96b9aad05f");
 67LLUUID const ANIM_AGENT_EMBARRASSED           ("514af488-9051-044a-b3fc-d4dbf76377c6");
 68LLUUID const ANIM_AGENT_EXPRESS_AFRAID        ("aa2df84d-cf8f-7218-527b-424a52de766e");
 69LLUUID const ANIM_AGENT_EXPRESS_ANGER         ("1a03b575-9634-b62a-5767-3a679e81f4de");
 70LLUUID const ANIM_AGENT_EXPRESS_BORED         ("214aa6c1-ba6a-4578-f27c-ce7688f61d0d");
 71LLUUID const ANIM_AGENT_EXPRESS_CRY           ("d535471b-85bf-3b4d-a542-93bea4f59d33");
 72LLUUID const ANIM_AGENT_EXPRESS_DISDAIN       ("d4416ff1-09d3-300f-4183-1b68a19b9fc1");
 73LLUUID const ANIM_AGENT_EXPRESS_EMBARRASSED   ("0b8c8211-d78c-33e8-fa28-c51a9594e424");
 74LLUUID const ANIM_AGENT_EXPRESS_FROWN         ("fee3df48-fa3d-1015-1e26-a205810e3001");
 75LLUUID const ANIM_AGENT_EXPRESS_KISS          ("1e8d90cc-a84e-e135-884c-7c82c8b03a14");
 76LLUUID const ANIM_AGENT_EXPRESS_LAUGH         ("62570842-0950-96f8-341c-809e65110823");
 77LLUUID const ANIM_AGENT_EXPRESS_OPEN_MOUTH    ("d63bc1f9-fc81-9625-a0c6-007176d82eb7");
 78LLUUID const ANIM_AGENT_EXPRESS_REPULSED      ("f76cda94-41d4-a229-2872-e0296e58afe1");
 79LLUUID const ANIM_AGENT_EXPRESS_SAD           ("eb6ebfb2-a4b3-a19c-d388-4dd5c03823f7");
 80LLUUID const ANIM_AGENT_EXPRESS_SHRUG         ("a351b1bc-cc94-aac2-7bea-a7e6ebad15ef");
 81LLUUID const ANIM_AGENT_EXPRESS_SMILE         ("b7c7c833-e3d3-c4e3-9fc0-131237446312");
 82LLUUID const ANIM_AGENT_EXPRESS_SURPRISE      ("728646d9-cc79-08b2-32d6-937f0a835c24");
 83LLUUID const ANIM_AGENT_EXPRESS_TONGUE_OUT    ("835965c6-7f2f-bda2-5deb-2478737f91bf");
 84LLUUID const ANIM_AGENT_EXPRESS_TOOTHSMILE    ("b92ec1a5-e7ce-a76b-2b05-bcdb9311417e");
 85LLUUID const ANIM_AGENT_EXPRESS_WINK          ("da020525-4d94-59d6-23d7-81fdebf33148");
 86LLUUID const ANIM_AGENT_EXPRESS_WORRY         ("9c05e5c7-6f07-6ca4-ed5a-b230390c3950");
 87LLUUID const ANIM_AGENT_FALLDOWN              ("666307d9-a860-572d-6fd4-c3ab8865c094");
 88LLUUID const ANIM_AGENT_FEMALE_RUN_NEW        ("85995026-eade-5d78-d364-94a64512cb66");
 89LLUUID const ANIM_AGENT_FEMALE_WALK           ("f5fc7433-043d-e819-8298-f519a119b688");
 90LLUUID const ANIM_AGENT_FEMALE_WALK_NEW       ("d60c41d2-7c24-7074-d3fa-6101cea22a51");
 91LLUUID const ANIM_AGENT_FINGER_WAG            ("c1bc7f36-3ba0-d844-f93c-93be945d644f");
 92LLUUID const ANIM_AGENT_FIST_PUMP             ("7db00ccd-f380-f3ee-439d-61968ec69c8a");
 93LLUUID const ANIM_AGENT_FLY                   ("aec4610c-757f-bc4e-c092-c6e9caf18daf");
 94LLUUID const ANIM_AGENT_FLYSLOW               ("2b5a38b2-5e00-3a97-a495-4c826bc443e6");
 95LLUUID const ANIM_AGENT_HELLO                 ("9b29cd61-c45b-5689-ded2-91756b8d76a9");
 96LLUUID const ANIM_AGENT_HOLD_BAZOOKA_R        ("ef62d355-c815-4816-2474-b1acc21094a6");
 97LLUUID const ANIM_AGENT_HOLD_BOW_L            ("8b102617-bcba-037b-86c1-b76219f90c88");
 98LLUUID const ANIM_AGENT_HOLD_HANDGUN_R        ("efdc1727-8b8a-c800-4077-975fc27ee2f2");
 99LLUUID const ANIM_AGENT_HOLD_RIFLE_R          ("3d94bad0-c55b-7dcc-8763-033c59405d33");
100LLUUID const ANIM_AGENT_HOLD_THROW_R          ("7570c7b5-1f22-56dd-56ef-a9168241bbb6");
101LLUUID const ANIM_AGENT_HOVER                 ("4ae8016b-31b9-03bb-c401-b1ea941db41d");
102LLUUID const ANIM_AGENT_HOVER_DOWN            ("20f063ea-8306-2562-0b07-5c853b37b31e");
103LLUUID const ANIM_AGENT_HOVER_UP              ("62c5de58-cb33-5743-3d07-9e4cd4352864");
104LLUUID const ANIM_AGENT_IMPATIENT             ("5ea3991f-c293-392e-6860-91dfa01278a3");
105LLUUID const ANIM_AGENT_JUMP                  ("2305bd75-1ca9-b03b-1faa-b176b8a8c49e");
106LLUUID const ANIM_AGENT_JUMP_FOR_JOY          ("709ea28e-1573-c023-8bf8-520c8bc637fa");
107LLUUID const ANIM_AGENT_KISS_MY_BUTT          ("19999406-3a3a-d58c-a2ac-d72e555dcf51");
108LLUUID const ANIM_AGENT_LAND                  ("7a17b059-12b2-41b1-570a-186368b6aa6f");
109LLUUID const ANIM_AGENT_LAUGH_SHORT           ("ca5b3f14-3194-7a2b-c894-aa699b718d1f");
110LLUUID const ANIM_AGENT_MEDIUM_LAND           ("f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57");
111LLUUID const ANIM_AGENT_MOTORCYCLE_SIT        ("08464f78-3a8e-2944-cba5-0c94aff3af29");
112LLUUID const ANIM_AGENT_MUSCLE_BEACH          ("315c3a41-a5f3-0ba4-27da-f893f769e69b");
113LLUUID const ANIM_AGENT_NO                    ("5a977ed9-7f72-44e9-4c4c-6e913df8ae74");
114LLUUID const ANIM_AGENT_NO_UNHAPPY            ("d83fa0e5-97ed-7eb2-e798-7bd006215cb4");
115LLUUID const ANIM_AGENT_NYAH_NYAH             ("f061723d-0a18-754f-66ee-29a44795a32f");
116LLUUID const ANIM_AGENT_ONETWO_PUNCH          ("eefc79be-daae-a239-8c04-890f5d23654a");
117LLUUID const ANIM_AGENT_PEACE                 ("b312b10e-65ab-a0a4-8b3c-1326ea8e3ed9");
118LLUUID const ANIM_AGENT_POINT_ME              ("17c024cc-eef2-f6a0-3527-9869876d7752");
119LLUUID const ANIM_AGENT_POINT_YOU             ("ec952cca-61ef-aa3b-2789-4d1344f016de");
120LLUUID const ANIM_AGENT_PRE_JUMP              ("7a4e87fe-de39-6fcb-6223-024b00893244");
121LLUUID const ANIM_AGENT_PUNCH_LEFT            ("f3300ad9-3462-1d07-2044-0fef80062da0");
122LLUUID const ANIM_AGENT_PUNCH_RIGHT           ("c8e42d32-7310-6906-c903-cab5d4a34656");
123LLUUID const ANIM_AGENT_REPULSED              ("36f81a92-f076-5893-dc4b-7c3795e487cf");
124LLUUID const ANIM_AGENT_ROUNDHOUSE_KICK       ("49aea43b-5ac3-8a44-b595-96100af0beda");
125LLUUID const ANIM_AGENT_RPS_COUNTDOWN         ("35db4f7e-28c2-6679-cea9-3ee108f7fc7f");
126LLUUID const ANIM_AGENT_RPS_PAPER             ("0836b67f-7f7b-f37b-c00a-460dc1521f5a");
127LLUUID const ANIM_AGENT_RPS_ROCK              ("42dd95d5-0bc6-6392-f650-777304946c0f");
128LLUUID const ANIM_AGENT_RPS_SCISSORS          ("16803a9f-5140-e042-4d7b-d28ba247c325");
129LLUUID const ANIM_AGENT_RUN                   ("05ddbff8-aaa9-92a1-2b74-8fe77a29b445");
130LLUUID const ANIM_AGENT_RUN_NEW               ("1ab1b236-cd08-21e6-0cbc-0d923fc6eca2");
131LLUUID const ANIM_AGENT_SAD                   ("0eb702e2-cc5a-9a88-56a5-661a55c0676a");
132LLUUID const ANIM_AGENT_SALUTE                ("cd7668a6-7011-d7e2-ead8-fc69eff1a104");
133LLUUID const ANIM_AGENT_SHOOT_BOW_L           ("e04d450d-fdb5-0432-fd68-818aaf5935f8");
134LLUUID const ANIM_AGENT_SHOUT                 ("6bd01860-4ebd-127a-bb3d-d1427e8e0c42");
135LLUUID const ANIM_AGENT_SHRUG                 ("70ea714f-3a97-d742-1b01-590a8fcd1db5");
136LLUUID const ANIM_AGENT_SIT                   ("1a5fe8ac-a804-8a5d-7cbd-56bd83184568");
137LLUUID const ANIM_AGENT_SIT_FEMALE            ("b1709c8d-ecd3-54a1-4f28-d55ac0840782");
138LLUUID const ANIM_AGENT_SIT_GENERIC           ("245f3c54-f1c0-bf2e-811f-46d8eeb386e7");
139LLUUID const ANIM_AGENT_SIT_GROUND            ("1c7600d6-661f-b87b-efe2-d7421eb93c86");
140LLUUID const ANIM_AGENT_SIT_GROUND_CONSTRAINED("1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e");
141LLUUID const ANIM_AGENT_SIT_TO_STAND          ("a8dee56f-2eae-9e7a-05a2-6fb92b97e21e");
142LLUUID const ANIM_AGENT_SLEEP                 ("f2bed5f9-9d44-39af-b0cd-257b2a17fe40");
143LLUUID const ANIM_AGENT_SMOKE_IDLE            ("d2f2ee58-8ad1-06c9-d8d3-3827ba31567a");
144LLUUID const ANIM_AGENT_SMOKE_INHALE          ("6802d553-49da-0778-9f85-1599a2266526");
145LLUUID const ANIM_AGENT_SMOKE_THROW_DOWN      ("0a9fb970-8b44-9114-d3a9-bf69cfe804d6");
146LLUUID const ANIM_AGENT_SNAPSHOT              ("eae8905b-271a-99e2-4c0e-31106afd100c");
147LLUUID const ANIM_AGENT_STAND                 ("2408fe9e-df1d-1d7d-f4ff-1384fa7b350f");
148LLUUID const ANIM_AGENT_STANDUP               ("3da1d753-028a-5446-24f3-9c9b856d9422");
149LLUUID const ANIM_AGENT_STAND_1               ("15468e00-3400-bb66-cecc-646d7c14458e");
150LLUUID const ANIM_AGENT_STAND_2               ("370f3a20-6ca6-9971-848c-9a01bc42ae3c");
151LLUUID const ANIM_AGENT_STAND_3               ("42b46214-4b44-79ae-deb8-0df61424ff4b");
152LLUUID const ANIM_AGENT_STAND_4               ("f22fed8b-a5ed-2c93-64d5-bdd8b93c889f");
153LLUUID const ANIM_AGENT_STRETCH               ("80700431-74ec-a008-14f8-77575e73693f");
154LLUUID const ANIM_AGENT_STRIDE                ("1cb562b0-ba21-2202-efb3-30f82cdf9595");
155LLUUID const ANIM_AGENT_SURF                  ("41426836-7437-7e89-025d-0aa4d10f1d69");
156LLUUID const ANIM_AGENT_SURPRISE              ("313b9881-4302-73c0-c7d0-0e7a36b6c224");
157LLUUID const ANIM_AGENT_SWORD_STRIKE          ("85428680-6bf9-3e64-b489-6f81087c24bd");
158LLUUID const ANIM_AGENT_TALK                  ("5c682a95-6da4-a463-0bf6-0f5b7be129d1");
159LLUUID const ANIM_AGENT_TANTRUM               ("11000694-3f41-adc2-606b-eee1d66f3724");
160LLUUID const ANIM_AGENT_THROW_R               ("aa134404-7dac-7aca-2cba-435f9db875ca");
161LLUUID const ANIM_AGENT_TRYON_SHIRT           ("83ff59fe-2346-f236-9009-4e3608af64c1");
162LLUUID const ANIM_AGENT_TURNLEFT              ("56e0ba0d-4a9f-7f27-6117-32f2ebbf6135");
163LLUUID const ANIM_AGENT_TURNRIGHT             ("2d6daa51-3192-6794-8e2e-a15f8338ec30");
164LLUUID const ANIM_AGENT_TYPE                  ("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9");
165LLUUID const ANIM_AGENT_WALK                  ("6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0");
166LLUUID const ANIM_AGENT_WALK_NEW              ("33339176-7ddc-9397-94a4-bf3403cbc8f5");
167LLUUID const ANIM_AGENT_WHISPER               ("7693f268-06c7-ea71-fa21-2b30d6533f8f");
168LLUUID const ANIM_AGENT_WHISTLE               ("b1ed7982-c68e-a982-7561-52a88a5298c0");
169LLUUID const ANIM_AGENT_WINK                  ("869ecdad-a44b-671e-3266-56aef2e3ac2e");
170LLUUID const ANIM_AGENT_WINK_HOLLYWOOD        ("c0c4030f-c02b-49de-24ba-2331f43fe41c");
171LLUUID const ANIM_AGENT_WORRY                 ("9f496bd2-589a-709f-16cc-69bf7df1d36c");
172LLUUID const ANIM_AGENT_YES                   ("15dd911d-be82-2856-26db-27659b142875");
173LLUUID const ANIM_AGENT_YES_HAPPY             ("b8c8b2a3-9008-1771-3bfc-90924955ab2d");
174LLUUID const ANIM_AGENT_YOGA_FLOAT            ("42ecd00b-9947-a97c-400a-bbc9174c7aeb");
175
176LLUUID AGENT_WALK_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_CROUCHWALK, ANIM_AGENT_TURNLEFT, ANIM_AGENT_TURNRIGHT};
177S32 NUM_AGENT_WALK_ANIMS = LL_ARRAY_SIZE(AGENT_WALK_ANIMS);
178
179LLUUID AGENT_GUN_HOLD_ANIMS[] = {ANIM_AGENT_HOLD_RIFLE_R, ANIM_AGENT_HOLD_HANDGUN_R, ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_AGENT_HOLD_BOW_L};
180S32 NUM_AGENT_GUN_HOLD_ANIMS = LL_ARRAY_SIZE(AGENT_GUN_HOLD_ANIMS);
181
182LLUUID AGENT_GUN_AIM_ANIMS[] = {ANIM_AGENT_AIM_RIFLE_R, ANIM_AGENT_AIM_HANDGUN_R, ANIM_AGENT_AIM_BAZOOKA_R, ANIM_AGENT_AIM_BOW_L};
183S32 NUM_AGENT_GUN_AIM_ANIMS = LL_ARRAY_SIZE(AGENT_GUN_AIM_ANIMS);
184
185LLUUID AGENT_NO_ROTATE_ANIMS[] = {ANIM_AGENT_SIT_GROUND, ANIM_AGENT_SIT_GROUND_CONSTRAINED, ANIM_AGENT_STANDUP};
186S32 NUM_AGENT_NO_ROTATE_ANIMS = LL_ARRAY_SIZE(AGENT_NO_ROTATE_ANIMS);
187
188LLUUID AGENT_STAND_ANIMS[] = {ANIM_AGENT_STAND, ANIM_AGENT_STAND_1, ANIM_AGENT_STAND_2, ANIM_AGENT_STAND_3, ANIM_AGENT_STAND_4};
189S32 NUM_AGENT_STAND_ANIMS = LL_ARRAY_SIZE(AGENT_STAND_ANIMS);
190
191
192LLAnimationLibrary gAnimLibrary;
193
194//-----------------------------------------------------------------------------
195// LLAnimationLibrary()
196//-----------------------------------------------------------------------------
197LLAnimationLibrary::LLAnimationLibrary() :
198	mAnimStringTable(16384)
199{
200	//add animation names to animmap
201	mAnimMap[ANIM_AGENT_AFRAID]=			mAnimStringTable.addString("express_afraid");
202	mAnimMap[ANIM_AGENT_AIM_BAZOOKA_R]=		mAnimStringTable.addString("aim_r_bazooka");
203	mAnimMap[ANIM_AGENT_AIM_BOW_L]=   		mAnimStringTable.addString("aim_l_bow");
204	mAnimMap[ANIM_AGENT_AIM_HANDGUN_R]=		mAnimStringTable.addString("aim_r_handgun");
205	mAnimMap[ANIM_AGENT_AIM_RIFLE_R]=		mAnimStringTable.addString("aim_r_rifle");
206	mAnimMap[ANIM_AGENT_ANGRY]=				mAnimStringTable.addString("express_anger");
207	mAnimMap[ANIM_AGENT_AWAY]=				mAnimStringTable.addString("away");
208	mAnimMap[ANIM_AGENT_BACKFLIP]=			mAnimStringTable.addString("backflip");
209	mAnimMap[ANIM_AGENT_BELLY_LAUGH]=		mAnimStringTable.addString("express_laugh");
210	mAnimMap[ANIM_AGENT_BLOW_KISS]=			mAnimStringTable.addString("blowkiss");
211	mAnimMap[ANIM_AGENT_BORED]=				mAnimStringTable.addString("express_bored");
212	mAnimMap[ANIM_AGENT_BOW]=				mAnimStringTable.addString("bow");
213	mAnimMap[ANIM_AGENT_BRUSH]=				mAnimStringTable.addString("brush");
214	mAnimMap[ANIM_AGENT_BUSY]=				mAnimStringTable.addString("busy");
215	mAnimMap[ANIM_AGENT_CLAP]=				mAnimStringTable.addString("clap");
216	mAnimMap[ANIM_AGENT_COURTBOW]=			mAnimStringTable.addString("courtbow");
217	mAnimMap[ANIM_AGENT_CROUCH]=			mAnimStringTable.addString("crouch");
218	mAnimMap[ANIM_AGENT_CROUCHWALK]=		mAnimStringTable.addString("crouchwalk");
219	mAnimMap[ANIM_AGENT_CRY]=				mAnimStringTable.addString("express_cry");
220	mAnimMap[ANIM_AGENT_CUSTOMIZE]=			mAnimStringTable.addString("turn_180");
221	mAnimMap[ANIM_AGENT_CUSTOMIZE_DONE]=	mAnimStringTable.addString("turnback_180");
222	mAnimMap[ANIM_AGENT_DANCE1]=			mAnimStringTable.addString("dance1");
223	mAnimMap[ANIM_AGENT_DANCE2]=			mAnimStringTable.addString("dance2");
224	mAnimMap[ANIM_AGENT_DANCE3]=			mAnimStringTable.addString("dance3");
225	mAnimMap[ANIM_AGENT_DANCE4]=			mAnimStringTable.addString("dance4");
226	mAnimMap[ANIM_AGENT_DANCE5]=			mAnimStringTable.addString("dance5");
227	mAnimMap[ANIM_AGENT_DANCE6]=			mAnimStringTable.addString("dance6");
228	mAnimMap[ANIM_AGENT_DANCE7]=			mAnimStringTable.addString("dance7");
229	mAnimMap[ANIM_AGENT_DANCE8]=			mAnimStringTable.addString("dance8");
230	mAnimMap[ANIM_AGENT_DEAD]=				mAnimStringTable.addString("dead");
231	mAnimMap[ANIM_AGENT_DRINK]=				mAnimStringTable.addString("drink");
232	mAnimMap[ANIM_AGENT_EMBARRASSED]=		mAnimStringTable.addString("express_embarrased");
233	mAnimMap[ANIM_AGENT_EXPRESS_AFRAID]=	mAnimStringTable.addString("express_afraid_emote");
234	mAnimMap[ANIM_AGENT_EXPRESS_ANGER]=		mAnimStringTable.addString("express_anger_emote");
235	mAnimMap[ANIM_AGENT_EXPRESS_BORED]=		mAnimStringTable.addString("express_bored_emote");
236	mAnimMap[ANIM_AGENT_EXPRESS_CRY]=		mAnimStringTable.addString("express_cry_emote");
237	mAnimMap[ANIM_AGENT_EXPRESS_DISDAIN]=	mAnimStringTable.addString("express_disdain");
238	mAnimMap[ANIM_AGENT_EXPRESS_EMBARRASSED]=	mAnimStringTable.addString("express_embarrassed_emote");
239	mAnimMap[ANIM_AGENT_EXPRESS_FROWN]=			mAnimStringTable.addString("express_frown");
240	mAnimMap[ANIM_AGENT_EXPRESS_KISS]=			mAnimStringTable.addString("express_kiss");
241	mAnimMap[ANIM_AGENT_EXPRESS_LAUGH]=			mAnimStringTable.addString("express_laugh_emote");
242	mAnimMap[ANIM_AGENT_EXPRESS_OPEN_MOUTH]=	mAnimStringTable.addString("express_open_mouth");
243	mAnimMap[ANIM_AGENT_EXPRESS_REPULSED]=		mAnimStringTable.addString("express_repulsed_emote");
244	mAnimMap[ANIM_AGENT_EXPRESS_SAD]=			mAnimStringTable.addString("express_sad_emote");
245	mAnimMap[ANIM_AGENT_EXPRESS_SHRUG]=			mAnimStringTable.addString("express_shrug_emote");
246	mAnimMap[ANIM_AGENT_EXPRESS_SMILE]=			mAnimStringTable.addString("express_smile");
247	mAnimMap[ANIM_AGENT_EXPRESS_SURPRISE]=		mAnimStringTable.addString("express_surprise_emote");
248	mAnimMap[ANIM_AGENT_EXPRESS_TONGUE_OUT]=	mAnimStringTable.addString("express_tongue_out");
249	mAnimMap[ANIM_AGENT_EXPRESS_TOOTHSMILE]=	mAnimStringTable.addString("express_toothsmile");
250	mAnimMap[ANIM_AGENT_EXPRESS_WINK]=			mAnimStringTable.addString("express_wink_emote");
251	mAnimMap[ANIM_AGENT_EXPRESS_WORRY]=			mAnimStringTable.addString("express_worry_emote");
252	mAnimMap[ANIM_AGENT_FALLDOWN]=				mAnimStringTable.addString("falldown");
253	mAnimMap[ANIM_AGENT_FEMALE_RUN_NEW]=		mAnimStringTable.addString("female_run_new");
254	mAnimMap[ANIM_AGENT_FEMALE_WALK]=			mAnimStringTable.addString("female_walk");
255	mAnimMap[ANIM_AGENT_FEMALE_WALK_NEW]=		mAnimStringTable.addString("female_walk_new");
256	mAnimMap[ANIM_AGENT_FINGER_WAG]=			mAnimStringTable.addString("angry_fingerwag");
257	mAnimMap[ANIM_AGENT_FIST_PUMP]=				mAnimStringTable.addString("fist_pump");
258	mAnimMap[ANIM_AGENT_FLY]=					mAnimStringTable.addString("fly");
259	mAnimMap[ANIM_AGENT_FLYSLOW]=				mAnimStringTable.addString("flyslow");
260	mAnimMap[ANIM_AGENT_HELLO]=					mAnimStringTable.addString("hello");
261	mAnimMap[ANIM_AGENT_HOLD_BAZOOKA_R]=		mAnimStringTable.addString("hold_r_bazooka");
262	mAnimMap[ANIM_AGENT_HOLD_BOW_L]=			mAnimStringTable.addString("hold_l_bow");
263	mAnimMap[ANIM_AGENT_HOLD_HANDGUN_R]=		mAnimStringTable.addString("hold_r_handgun");
264	mAnimMap[ANIM_AGENT_HOLD_RIFLE_R]=			mAnimStringTable.addString("hold_r_rifle");
265	mAnimMap[ANIM_AGENT_HOLD_THROW_R]=			mAnimStringTable.addString("hold_throw_r");
266	mAnimMap[ANIM_AGENT_HOVER]=					mAnimStringTable.addString("hover");
267	mAnimMap[ANIM_AGENT_HOVER_DOWN]=			mAnimStringTable.addString("hover_down");
268	mAnimMap[ANIM_AGENT_HOVER_UP]=				mAnimStringTable.addString("hover_up");
269	mAnimMap[ANIM_AGENT_IMPATIENT]=				mAnimStringTable.addString("impatient");
270	mAnimMap[ANIM_AGENT_JUMP]=					mAnimStringTable.addString("jump");
271	mAnimMap[ANIM_AGENT_JUMP_FOR_JOY]=			mAnimStringTable.addString("jumpforjoy");
272	mAnimMap[ANIM_AGENT_KISS_MY_BUTT]=			mAnimStringTable.addString("kissmybutt");
273	mAnimMap[ANIM_AGENT_LAND]=					mAnimStringTable.addString("land");
274	mAnimMap[ANIM_AGENT_LAUGH_SHORT]=			mAnimStringTable.addString("laugh_short");
275	mAnimMap[ANIM_AGENT_MEDIUM_LAND]=			mAnimStringTable.addString("soft_land");
276	mAnimMap[ANIM_AGENT_MOTORCYCLE_SIT]=		mAnimStringTable.addString("motorcycle_sit");
277	mAnimMap[ANIM_AGENT_MUSCLE_BEACH]=			mAnimStringTable.addString("musclebeach");
278	mAnimMap[ANIM_AGENT_NO]=					mAnimStringTable.addString("no_head");
279	mAnimMap[ANIM_AGENT_NO_UNHAPPY]=			mAnimStringTable.addString("no_unhappy");
280	mAnimMap[ANIM_AGENT_NYAH_NYAH]=				mAnimStringTable.addString("nyanya");
281	mAnimMap[ANIM_AGENT_ONETWO_PUNCH]=			mAnimStringTable.addString("punch_onetwo");
282	mAnimMap[ANIM_AGENT_PEACE]=					mAnimStringTable.addString("peace");
283	mAnimMap[ANIM_AGENT_POINT_ME]=				mAnimStringTable.addString("point_me");
284	mAnimMap[ANIM_AGENT_POINT_YOU]=				mAnimStringTable.addString("point_you");
285	mAnimMap[ANIM_AGENT_PRE_JUMP]=				mAnimStringTable.addString("prejump");
286	mAnimMap[ANIM_AGENT_PUNCH_LEFT]=			mAnimStringTable.addString("punch_l");
287	mAnimMap[ANIM_AGENT_PUNCH_RIGHT]=			mAnimStringTable.addString("punch_r");
288	mAnimMap[ANIM_AGENT_REPULSED]=				mAnimStringTable.addString("express_repulsed");
289	mAnimMap[ANIM_AGENT_ROUNDHOUSE_KICK]=		mAnimStringTable.addString("kick_roundhouse_r");
290	mAnimMap[ANIM_AGENT_RPS_COUNTDOWN]=			mAnimStringTable.addString("rps_countdown");
291	mAnimMap[ANIM_AGENT_RPS_PAPER]=				mAnimStringTable.addString("rps_paper");
292	mAnimMap[ANIM_AGENT_RPS_ROCK]=				mAnimStringTable.addString("rps_rock");
293	mAnimMap[ANIM_AGENT_RPS_SCISSORS]=			mAnimStringTable.addString("rps_scissors");
294	mAnimMap[ANIM_AGENT_RUN]=					mAnimStringTable.addString("run");
295	mAnimMap[ANIM_AGENT_RUN_NEW]=				mAnimStringTable.addString("run_new");
296	mAnimMap[ANIM_AGENT_SAD]=					mAnimStringTable.addString("express_sad");
297	mAnimMap[ANIM_AGENT_SALUTE]=				mAnimStringTable.addString("salute");
298	mAnimMap[ANIM_AGENT_SHOOT_BOW_L]=			mAnimStringTable.addString("shoot_l_bow");
299	mAnimMap[ANIM_AGENT_SHOUT]=					mAnimStringTable.addString("shout");
300	mAnimMap[ANIM_AGENT_SHRUG]=					mAnimStringTable.addString("express_shrug");
301	mAnimMap[ANIM_AGENT_SIT]=					mAnimStringTable.addString("sit");
302	mAnimMap[ANIM_AGENT_SIT_FEMALE]=			mAnimStringTable.addString("sit_female");
303	mAnimMap[ANIM_AGENT_SIT_GROUND]=			mAnimStringTable.addString("sit_ground");
304	mAnimMap[ANIM_AGENT_SIT_GROUND_CONSTRAINED]=	mAnimStringTable.addString("sit_ground_constrained");
305	mAnimMap[ANIM_AGENT_SIT_GENERIC]=			mAnimStringTable.addString("sit_generic");
306	mAnimMap[ANIM_AGENT_SIT_TO_STAND]=			mAnimStringTable.addString("sit_to_stand");
307	mAnimMap[ANIM_AGENT_SLEEP]=					mAnimStringTable.addString("sleep");
308	mAnimMap[ANIM_AGENT_SMOKE_IDLE]=			mAnimStringTable.addString("smoke_idle");
309	mAnimMap[ANIM_AGENT_SMOKE_INHALE]=			mAnimStringTable.addString("smoke_inhale");
310	mAnimMap[ANIM_AGENT_SMOKE_THROW_DOWN]=		mAnimStringTable.addString("smoke_throw_down");
311	mAnimMap[ANIM_AGENT_SNAPSHOT]=				mAnimStringTable.addString("snapshot");
312	mAnimMap[ANIM_AGENT_STAND]=					mAnimStringTable.addString("stand");
313	mAnimMap[ANIM_AGENT_STANDUP]=				mAnimStringTable.addString("standup");
314	mAnimMap[ANIM_AGENT_STAND_1]=				mAnimStringTable.addString("stand_1");
315	mAnimMap[ANIM_AGENT_STAND_2]=				mAnimStringTable.addString("stand_2");
316	mAnimMap[ANIM_AGENT_STAND_3]=				mAnimStringTable.addString("stand_3");
317	mAnimMap[ANIM_AGENT_STAND_4]=				mAnimStringTable.addString("stand_4");
318	mAnimMap[ANIM_AGENT_STRETCH]=				mAnimStringTable.addString("stretch");
319	mAnimMap[ANIM_AGENT_STRIDE]=				mAnimStringTable.addString("stride");
320	mAnimMap[ANIM_AGENT_SURF]=					mAnimStringTable.addString("surf");
321	mAnimMap[ANIM_AGENT_SURPRISE]=				mAnimStringTable.addString("express_surprise");
322	mAnimMap[ANIM_AGENT_SWORD_STRIKE]=			mAnimStringTable.addString("sword_strike_r");
323	mAnimMap[ANIM_AGENT_TALK]=					mAnimStringTable.addString("talk");
324	mAnimMap[ANIM_AGENT_TANTRUM]=				mAnimStringTable.addString("angry_tantrum");
325	mAnimMap[ANIM_AGENT_THROW_R]=				mAnimStringTable.addString("throw_r");
326	mAnimMap[ANIM_AGENT_TRYON_SHIRT]=			mAnimStringTable.addString("tryon_shirt");
327	mAnimMap[ANIM_AGENT_TURNLEFT]=				mAnimStringTable.addString("turnleft");
328	mAnimMap[ANIM_AGENT_TURNRIGHT]=				mAnimStringTable.addString("turnright");
329	mAnimMap[ANIM_AGENT_TYPE]=					mAnimStringTable.addString("type");
330	mAnimMap[ANIM_AGENT_WALK]=					mAnimStringTable.addString("walk");
331	mAnimMap[ANIM_AGENT_WALK_NEW]=				mAnimStringTable.addString("walk_new");
332	mAnimMap[ANIM_AGENT_WHISPER]=				mAnimStringTable.addString("whisper");
333	mAnimMap[ANIM_AGENT_WHISTLE]=				mAnimStringTable.addString("whistle");
334	mAnimMap[ANIM_AGENT_WINK]=					mAnimStringTable.addString("express_wink");
335	mAnimMap[ANIM_AGENT_WINK_HOLLYWOOD]=		mAnimStringTable.addString("wink_hollywood");
336	mAnimMap[ANIM_AGENT_WORRY]=					mAnimStringTable.addString("express_worry");
337	mAnimMap[ANIM_AGENT_YES]=					mAnimStringTable.addString("yes_head");
338	mAnimMap[ANIM_AGENT_YES_HAPPY]=				mAnimStringTable.addString("yes_happy");
339	mAnimMap[ANIM_AGENT_YOGA_FLOAT]=			mAnimStringTable.addString("yoga_float");
340}
341	
342//-----------------------------------------------------------------------------
343// ~LLAnimationLibrary()
344//-----------------------------------------------------------------------------
345LLAnimationLibrary::~LLAnimationLibrary()
346{
347}
348
349//-----------------------------------------------------------------------------
350// Return the text name of an animation state
351//-----------------------------------------------------------------------------
352const char *LLAnimationLibrary::animStateToString( const LLUUID& state )
353{
354	if (state.isNull())
355	{
356		return NULL;
357	}
358	if (mAnimMap.count(state))
359	{
360		return mAnimMap[state];
361	}
362
363	return NULL;
364}
365
366
367//-----------------------------------------------------------------------------
368// Return the animation state for a given name
369//-----------------------------------------------------------------------------
370LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allow_ids )
371{
372	std::string lower_case_name(name);
373	LLStringUtil::toLower(lower_case_name);
374
375	char *true_name = mAnimStringTable.checkString(lower_case_name.c_str());
376
377	LLUUID id;
378	id.setNull();
379
380	if (true_name)
381	{
382		for (anim_map_t::iterator iter = mAnimMap.begin();
383			 iter != mAnimMap.end(); iter++)
384		{
385			if (iter->second == true_name)
386			{
387				id = iter->first;
388				break;
389			}
390		}
391	}
392	else if (allow_ids)
393	{
394		// try to convert string to LLUUID
395		id.set(name, FALSE);
396	}
397
398	return id;
399}
400
401//-----------------------------------------------------------------------------
402// Associate an anim state with a name
403//-----------------------------------------------------------------------------
404void LLAnimationLibrary::animStateSetString( const LLUUID& state, const std::string& name)
405{
406	mAnimMap[state] = mAnimStringTable.addString(name);
407}
408
409std::string LLAnimationLibrary::animationName( const LLUUID& id ) const
410{
411	const char *cptr = gAnimLibrary.animStateToString(id); 
412	if (cptr)
413		return std::string(cptr);
414	else
415		return std::string("[") + id.asString() + std::string("]");
416}
417
418// Animation states that the user can trigger as part of a gesture
419// See struct LLAnimStateEntry in header for label location information
420const LLAnimStateEntry gUserAnimStates[] = {
421	LLAnimStateEntry("express_afraid",		ANIM_AGENT_AFRAID),
422	LLAnimStateEntry("express_anger",		ANIM_AGENT_ANGRY),
423	LLAnimStateEntry("away",					ANIM_AGENT_AWAY),
424	LLAnimStateEntry("backflip",				ANIM_AGENT_BACKFLIP),
425	LLAnimStateEntry("express_laugh",		ANIM_AGENT_BELLY_LAUGH),
426	LLAnimStateEntry("express_toothsmile",	ANIM_AGENT_EXPRESS_TOOTHSMILE),
427	LLAnimStateEntry("blowkiss",				ANIM_AGENT_BLOW_KISS),
428	LLAnimStateEntry("express_bored",		ANIM_AGENT_BORED),
429	LLAnimStateEntry("bow",					ANIM_AGENT_BOW),
430	LLAnimStateEntry("clap",					ANIM_AGENT_CLAP),
431	LLAnimStateEntry("courtbow",				ANIM_AGENT_COURTBOW),
432	LLAnimStateEntry("express_cry",			ANIM_AGENT_CRY),
433	LLAnimStateEntry("dance1",				ANIM_AGENT_DANCE1),
434	LLAnimStateEntry("dance2",				ANIM_AGENT_DANCE2),
435	LLAnimStateEntry("dance3",				ANIM_AGENT_DANCE3),
436	LLAnimStateEntry("dance4",				ANIM_AGENT_DANCE4),
437	LLAnimStateEntry("dance5",				ANIM_AGENT_DANCE5),
438	LLAnimStateEntry("dance6",				ANIM_AGENT_DANCE6),
439	LLAnimStateEntry("dance7",				ANIM_AGENT_DANCE7),
440	LLAnimStateEntry("dance8",				ANIM_AGENT_DANCE8),
441	LLAnimStateEntry("express_disdain",		ANIM_AGENT_EXPRESS_DISDAIN),
442	LLAnimStateEntry("drink",				ANIM_AGENT_DRINK),
443	LLAnimStateEntry("express_embarrased",	ANIM_AGENT_EMBARRASSED),
444	LLAnimStateEntry("angry_fingerwag",		ANIM_AGENT_FINGER_WAG),
445	LLAnimStateEntry("fist_pump",			ANIM_AGENT_FIST_PUMP),
446	LLAnimStateEntry("yoga_float",			ANIM_AGENT_YOGA_FLOAT),
447	LLAnimStateEntry("express_frown",		ANIM_AGENT_EXPRESS_FROWN),
448	LLAnimStateEntry("impatient",			ANIM_AGENT_IMPATIENT),
449	LLAnimStateEntry("jumpforjoy",			ANIM_AGENT_JUMP_FOR_JOY),
450	LLAnimStateEntry("kissmybutt",			ANIM_AGENT_KISS_MY_BUTT),
451	LLAnimStateEntry("express_kiss",			ANIM_AGENT_EXPRESS_KISS),
452	LLAnimStateEntry("laugh_short",			ANIM_AGENT_LAUGH_SHORT),
453	LLAnimStateEntry("musclebeach",			ANIM_AGENT_MUSCLE_BEACH),
454	LLAnimStateEntry("no_unhappy",			ANIM_AGENT_NO_UNHAPPY),
455	LLAnimStateEntry("no_head",				ANIM_AGENT_NO),
456	LLAnimStateEntry("nyanya",				ANIM_AGENT_NYAH_NYAH),
457	LLAnimStateEntry("punch_onetwo",			ANIM_AGENT_ONETWO_PUNCH),
458	LLAnimStateEntry("express_open_mouth",	ANIM_AGENT_EXPRESS_OPEN_MOUTH),
459	LLAnimStateEntry("peace",				ANIM_AGENT_PEACE),
460	LLAnimStateEntry("point_you",			ANIM_AGENT_POINT_YOU),
461	LLAnimStateEntry("point_me",				ANIM_AGENT_POINT_ME),
462	LLAnimStateEntry("punch_l",				ANIM_AGENT_PUNCH_LEFT),
463	LLAnimStateEntry("punch_r",				ANIM_AGENT_PUNCH_RIGHT),
464	LLAnimStateEntry("rps_countdown",		ANIM_AGENT_RPS_COUNTDOWN),
465	LLAnimStateEntry("rps_paper",			ANIM_AGENT_RPS_PAPER),
466	LLAnimStateEntry("rps_rock",				ANIM_AGENT_RPS_ROCK),
467	LLAnimStateEntry("rps_scissors",			ANIM_AGENT_RPS_SCISSORS),
468	LLAnimStateEntry("express_repulsed",		ANIM_AGENT_EXPRESS_REPULSED),
469	LLAnimStateEntry("kick_roundhouse_r",	ANIM_AGENT_ROUNDHOUSE_KICK),
470	LLAnimStateEntry("express_sad",			ANIM_AGENT_SAD),
471	LLAnimStateEntry("salute",				ANIM_AGENT_SALUTE),
472	LLAnimStateEntry("shout",				ANIM_AGENT_SHOUT),
473	LLAnimStateEntry("express_shrug",		ANIM_AGENT_SHRUG),
474	LLAnimStateEntry("express_smile",		ANIM_AGENT_EXPRESS_SMILE),
475	LLAnimStateEntry("smoke_idle",			ANIM_AGENT_SMOKE_IDLE),
476	LLAnimStateEntry("smoke_inhale",			ANIM_AGENT_SMOKE_INHALE),
477	LLAnimStateEntry("smoke_throw_down",		ANIM_AGENT_SMOKE_THROW_DOWN),
478	LLAnimStateEntry("express_surprise",		ANIM_AGENT_SURPRISE),
479	LLAnimStateEntry("sword_strike_r",		ANIM_AGENT_SWORD_STRIKE),
480	LLAnimStateEntry("angry_tantrum",		ANIM_AGENT_TANTRUM),
481	LLAnimStateEntry("express_tongue_out",	ANIM_AGENT_EXPRESS_TONGUE_OUT),
482	LLAnimStateEntry("hello",				ANIM_AGENT_HELLO),
483	LLAnimStateEntry("whisper",				ANIM_AGENT_WHISPER),
484	LLAnimStateEntry("whistle",				ANIM_AGENT_WHISTLE),
485	LLAnimStateEntry("express_wink",			ANIM_AGENT_WINK),
486	LLAnimStateEntry("wink_hollywood",		ANIM_AGENT_WINK_HOLLYWOOD),
487	LLAnimStateEntry("express_worry",		ANIM_AGENT_EXPRESS_WORRY),
488	LLAnimStateEntry("yes_happy",			ANIM_AGENT_YES_HAPPY),
489	LLAnimStateEntry("yes_head",				ANIM_AGENT_YES),
490};
491
492const S32 gUserAnimStatesCount = LL_ARRAY_SIZE(gUserAnimStates);
493
494
495// End
496