PageRenderTime 56ms CodeModel.GetById 30ms app.highlight 21ms RepoModel.GetById 2ms 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
  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
 27#ifndef LL_LLANIMATIONSTATES_H
 28#define LL_LLANIMATIONSTATES_H
 29
 30#include <map>
 31
 32#include "string_table.h"
 33#include "lluuid.h"
 34
 35//-----------------------------------------------------------------------------
 36// These bit flags are generally used to track the animation state
 37// of characters.  The simulator and viewer share these flags to interpret
 38// the Animation name/value attribute on agents.
 39//-----------------------------------------------------------------------------
 40
 41//-----------------------------------------------------------------------------
 42// Agent Animation State
 43//-----------------------------------------------------------------------------
 44const S32 MAX_CONCURRENT_ANIMS = 16;
 45
 46extern const LLUUID ANIM_AGENT_AFRAID;
 47extern const LLUUID ANIM_AGENT_AIM_BAZOOKA_R;
 48extern const LLUUID ANIM_AGENT_AIM_BOW_L;
 49extern const LLUUID ANIM_AGENT_AIM_HANDGUN_R;
 50extern const LLUUID ANIM_AGENT_AIM_RIFLE_R;
 51extern const LLUUID ANIM_AGENT_ANGRY;
 52extern const LLUUID ANIM_AGENT_AWAY;
 53extern const LLUUID ANIM_AGENT_BACKFLIP;
 54extern const LLUUID ANIM_AGENT_BELLY_LAUGH;
 55extern const LLUUID ANIM_AGENT_BLOW_KISS;
 56extern const LLUUID ANIM_AGENT_BORED;
 57extern const LLUUID ANIM_AGENT_BOW;
 58extern const LLUUID ANIM_AGENT_BRUSH;
 59extern const LLUUID ANIM_AGENT_BUSY;
 60extern const LLUUID ANIM_AGENT_CLAP;
 61extern const LLUUID ANIM_AGENT_COURTBOW;
 62extern const LLUUID ANIM_AGENT_CROUCH;
 63extern const LLUUID ANIM_AGENT_CROUCHWALK;
 64extern const LLUUID ANIM_AGENT_CRY;
 65extern const LLUUID ANIM_AGENT_CUSTOMIZE;
 66extern const LLUUID ANIM_AGENT_CUSTOMIZE_DONE;
 67extern const LLUUID ANIM_AGENT_DANCE1;
 68extern const LLUUID ANIM_AGENT_DANCE2;
 69extern const LLUUID ANIM_AGENT_DANCE3;
 70extern const LLUUID ANIM_AGENT_DANCE4;
 71extern const LLUUID ANIM_AGENT_DANCE5;
 72extern const LLUUID ANIM_AGENT_DANCE6;
 73extern const LLUUID ANIM_AGENT_DANCE7;
 74extern const LLUUID ANIM_AGENT_DANCE8;
 75extern const LLUUID ANIM_AGENT_DEAD;
 76extern const LLUUID ANIM_AGENT_DRINK;
 77extern const LLUUID ANIM_AGENT_EMBARRASSED;
 78extern const LLUUID ANIM_AGENT_EXPRESS_AFRAID;
 79extern const LLUUID ANIM_AGENT_EXPRESS_ANGER;
 80extern const LLUUID ANIM_AGENT_EXPRESS_BORED;
 81extern const LLUUID ANIM_AGENT_EXPRESS_CRY;
 82extern const LLUUID ANIM_AGENT_EXPRESS_DISDAIN;
 83extern const LLUUID ANIM_AGENT_EXPRESS_EMBARRASSED;
 84extern const LLUUID ANIM_AGENT_EXPRESS_FROWN;
 85extern const LLUUID ANIM_AGENT_EXPRESS_KISS;
 86extern const LLUUID ANIM_AGENT_EXPRESS_LAUGH;
 87extern const LLUUID ANIM_AGENT_EXPRESS_OPEN_MOUTH;
 88extern const LLUUID ANIM_AGENT_EXPRESS_REPULSED;
 89extern const LLUUID ANIM_AGENT_EXPRESS_SAD;
 90extern const LLUUID ANIM_AGENT_EXPRESS_SHRUG;
 91extern const LLUUID ANIM_AGENT_EXPRESS_SMILE;
 92extern const LLUUID ANIM_AGENT_EXPRESS_SURPRISE;
 93extern const LLUUID ANIM_AGENT_EXPRESS_TONGUE_OUT;
 94extern const LLUUID ANIM_AGENT_EXPRESS_TOOTHSMILE;
 95extern const LLUUID ANIM_AGENT_EXPRESS_WINK;
 96extern const LLUUID ANIM_AGENT_EXPRESS_WORRY;
 97extern const LLUUID ANIM_AGENT_FALLDOWN;
 98extern const LLUUID ANIM_AGENT_FEMALE_RUN_NEW;
 99extern const LLUUID ANIM_AGENT_FEMALE_WALK;
100extern const LLUUID ANIM_AGENT_FEMALE_WALK_NEW;
101extern const LLUUID ANIM_AGENT_FINGER_WAG;
102extern const LLUUID ANIM_AGENT_FIST_PUMP;
103extern const LLUUID ANIM_AGENT_FLY;
104extern const LLUUID ANIM_AGENT_FLYSLOW;
105extern const LLUUID ANIM_AGENT_HELLO;
106extern const LLUUID ANIM_AGENT_HOLD_BAZOOKA_R;
107extern const LLUUID ANIM_AGENT_HOLD_BOW_L;
108extern const LLUUID ANIM_AGENT_HOLD_HANDGUN_R;
109extern const LLUUID ANIM_AGENT_HOLD_RIFLE_R;
110extern const LLUUID ANIM_AGENT_HOLD_THROW_R;
111extern const LLUUID ANIM_AGENT_HOVER;
112extern const LLUUID ANIM_AGENT_HOVER_DOWN;
113extern const LLUUID ANIM_AGENT_HOVER_UP;
114extern const LLUUID ANIM_AGENT_IMPATIENT;
115extern const LLUUID ANIM_AGENT_JUMP;
116extern const LLUUID ANIM_AGENT_JUMP_FOR_JOY;
117extern const LLUUID ANIM_AGENT_KISS_MY_BUTT;
118extern const LLUUID ANIM_AGENT_LAND;
119extern const LLUUID ANIM_AGENT_LAUGH_SHORT;
120extern const LLUUID ANIM_AGENT_MEDIUM_LAND;
121extern const LLUUID ANIM_AGENT_MOTORCYCLE_SIT;
122extern const LLUUID ANIM_AGENT_MUSCLE_BEACH;
123extern const LLUUID ANIM_AGENT_NO;
124extern const LLUUID ANIM_AGENT_NO_UNHAPPY;
125extern const LLUUID ANIM_AGENT_NYAH_NYAH;
126extern const LLUUID ANIM_AGENT_ONETWO_PUNCH;
127extern const LLUUID ANIM_AGENT_PEACE;
128extern const LLUUID ANIM_AGENT_POINT_ME;
129extern const LLUUID ANIM_AGENT_POINT_YOU;
130extern const LLUUID ANIM_AGENT_PRE_JUMP;
131extern const LLUUID ANIM_AGENT_PUNCH_LEFT;
132extern const LLUUID ANIM_AGENT_PUNCH_RIGHT;
133extern const LLUUID ANIM_AGENT_REPULSED;
134extern const LLUUID ANIM_AGENT_ROUNDHOUSE_KICK;
135extern const LLUUID ANIM_AGENT_RPS_COUNTDOWN;
136extern const LLUUID ANIM_AGENT_RPS_PAPER;
137extern const LLUUID ANIM_AGENT_RPS_ROCK;
138extern const LLUUID ANIM_AGENT_RPS_SCISSORS;
139extern const LLUUID ANIM_AGENT_RUN;
140extern const LLUUID ANIM_AGENT_RUN_NEW;
141extern const LLUUID ANIM_AGENT_SAD;
142extern const LLUUID ANIM_AGENT_SALUTE;
143extern const LLUUID ANIM_AGENT_SHOOT_BOW_L;
144extern const LLUUID ANIM_AGENT_SHOUT;
145extern const LLUUID ANIM_AGENT_SHRUG;
146extern const LLUUID ANIM_AGENT_SIT;
147extern const LLUUID ANIM_AGENT_SIT_FEMALE;
148extern const LLUUID ANIM_AGENT_SIT_GENERIC;
149extern const LLUUID ANIM_AGENT_SIT_GROUND;
150extern const LLUUID ANIM_AGENT_SIT_GROUND_CONSTRAINED;
151extern const LLUUID ANIM_AGENT_SIT_TO_STAND;
152extern const LLUUID ANIM_AGENT_SLEEP;
153extern const LLUUID ANIM_AGENT_SMOKE_IDLE;
154extern const LLUUID ANIM_AGENT_SMOKE_INHALE;
155extern const LLUUID ANIM_AGENT_SMOKE_THROW_DOWN;
156extern const LLUUID ANIM_AGENT_SNAPSHOT;
157extern const LLUUID ANIM_AGENT_STAND;
158extern const LLUUID ANIM_AGENT_STANDUP;
159extern const LLUUID ANIM_AGENT_STAND_1;
160extern const LLUUID ANIM_AGENT_STAND_2;
161extern const LLUUID ANIM_AGENT_STAND_3;
162extern const LLUUID ANIM_AGENT_STAND_4;
163extern const LLUUID ANIM_AGENT_STRETCH;
164extern const LLUUID ANIM_AGENT_STRIDE;
165extern const LLUUID ANIM_AGENT_SURF;
166extern const LLUUID ANIM_AGENT_SURPRISE;
167extern const LLUUID ANIM_AGENT_SWORD_STRIKE;
168extern const LLUUID ANIM_AGENT_TALK;
169extern const LLUUID ANIM_AGENT_TANTRUM;
170extern const LLUUID ANIM_AGENT_THROW_R;
171extern const LLUUID ANIM_AGENT_TRYON_SHIRT;
172extern const LLUUID ANIM_AGENT_TURNLEFT;
173extern const LLUUID ANIM_AGENT_TURNRIGHT;
174extern const LLUUID ANIM_AGENT_TYPE;
175extern const LLUUID ANIM_AGENT_WALK;
176extern const LLUUID ANIM_AGENT_WALK_NEW;
177extern const LLUUID ANIM_AGENT_WHISPER;
178extern const LLUUID ANIM_AGENT_WHISTLE;
179extern const LLUUID ANIM_AGENT_WINK;
180extern const LLUUID ANIM_AGENT_WINK_HOLLYWOOD;
181extern const LLUUID ANIM_AGENT_WORRY;
182extern const LLUUID ANIM_AGENT_YES;
183extern const LLUUID ANIM_AGENT_YES_HAPPY;
184extern const LLUUID ANIM_AGENT_YOGA_FLOAT;
185
186extern LLUUID AGENT_WALK_ANIMS[];
187extern S32 NUM_AGENT_WALK_ANIMS;
188
189extern LLUUID AGENT_GUN_HOLD_ANIMS[];
190extern S32 NUM_AGENT_GUN_HOLD_ANIMS;
191
192extern LLUUID AGENT_GUN_AIM_ANIMS[];
193extern S32 NUM_AGENT_GUN_AIM_ANIMS;
194
195extern LLUUID AGENT_NO_ROTATE_ANIMS[];
196extern S32 NUM_AGENT_NO_ROTATE_ANIMS;
197
198extern LLUUID AGENT_STAND_ANIMS[];
199extern S32 NUM_AGENT_STAND_ANIMS;
200
201class LLAnimationLibrary
202{
203private:
204	LLStringTable mAnimStringTable;
205
206	typedef std::map<LLUUID, char *> anim_map_t;
207	anim_map_t mAnimMap;
208
209public:
210	LLAnimationLibrary();
211	~LLAnimationLibrary();
212
213	//-----------------------------------------------------------------------------
214	// Return the text name of a single animation state,
215	// Return NULL if the state is invalid
216	//-----------------------------------------------------------------------------
217	const char *animStateToString( const LLUUID& state );
218
219	//-----------------------------------------------------------------------------
220	// Return the animation state for the given name.
221	// Retun NULL if the name is invalid.
222	//-----------------------------------------------------------------------------
223	LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE );
224
225	//-----------------------------------------------------------------------------
226	// Associate an anim state with a name
227	//-----------------------------------------------------------------------------
228	void animStateSetString( const LLUUID& state, const std::string& name);
229
230	//-----------------------------------------------------------------------------
231	// Find the name for a given animation, or UUID string if none defined.
232	//-----------------------------------------------------------------------------
233	std::string animationName( const LLUUID& id ) const;
234};
235
236struct LLAnimStateEntry
237{
238	LLAnimStateEntry(const char* name, const LLUUID& id) :
239		mName(name),
240		mID(id)
241	{ 
242		// LABELS:
243		// Look to newview/LLAnimStateLabels.* for how to get the labels.
244		// The labels should no longer be stored in this structure. The server
245		// shouldn't care about the local friendly name of an animation, and
246		// this is common code.
247	}
248
249
250	const char* mName;
251	const LLUUID mID;
252};
253
254// Animation states that the user can trigger
255extern const LLAnimStateEntry gUserAnimStates[];
256extern const S32 gUserAnimStatesCount;
257extern LLAnimationLibrary gAnimLibrary;
258
259#endif // LL_LLANIMATIONSTATES_H
260
261
262