Annotation of /trunk/indra/llcharacter/llmultigesture.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llmultigesture.h | ||
| 3 : | * @brief Gestures that are asset-based and can have multiple steps. | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2004&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2004-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 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 : | |||
| 33 : | #ifndef LL_LLMULTIGESTURE_H | ||
| 34 : | #define LL_LLMULTIGESTURE_H | ||
| 35 : | |||
| 36 : | #include <set> | ||
| 37 : | #include <string> | ||
| 38 : | #include <vector> | ||
| 39 : | |||
| 40 : | #include "lluuid.h" | ||
| 41 : | #include "llframetimer.h" | ||
| 42 : | |||
| 43 : | class LLDataPacker; | ||
| 44 : | class LLGestureStep; | ||
| 45 : | |||
| 46 : | class LLMultiGesture | ||
| 47 : | { | ||
| 48 : | public: | ||
| 49 : | LLMultiGesture(); | ||
| 50 : | virtual ~LLMultiGesture(); | ||
| 51 : | |||
| 52 : | // Maximum number of bytes this could hold once serialized. | ||
| 53 : | S32 getMaxSerialSize() const; | ||
| 54 : | |||
| 55 : | BOOL serialize(LLDataPacker& dp) const; | ||
| 56 : | BOOL deserialize(LLDataPacker& dp); | ||
| 57 : | |||
| 58 : | void dump(); | ||
| 59 : | |||
| 60 : | void reset(); | ||
| 61 : | |||
| 62 : | const std::string& getTrigger() const { return mTrigger; } | ||
| 63 : | protected: | ||
| 64 : | LLMultiGesture(const LLMultiGesture& gest); | ||
| 65 : | const LLMultiGesture& operator=(const LLMultiGesture& rhs); | ||
| 66 : | |||
| 67 : | public: | ||
| 68 : | // name is stored at asset level | ||
| 69 : | // desc is stored at asset level | ||
| 70 : | KEY mKey; | ||
| 71 : | MASK mMask; | ||
| 72 : | |||
| 73 : | // String, like "/foo" or "hello" that makes it play | ||
| 74 : | std::string mTrigger; | ||
| 75 : | |||
| 76 : | // Replaces the trigger substring with this text | ||
| 77 : | std::string mReplaceText; | ||
| 78 : | |||
| 79 : | std::vector<LLGestureStep*> mSteps; | ||
| 80 : | |||
| 81 : | // Is the gesture currently playing? | ||
| 82 : | BOOL mPlaying; | ||
| 83 : | |||
| 84 : | // "instruction pointer" for steps | ||
| 85 : | S32 mCurrentStep; | ||
| 86 : | |||
| 87 : | // We're waiting for triggered animations to stop playing | ||
| 88 : | BOOL mWaitingAnimations; | ||
| 89 : | |||
| 90 : | // We're waiting a fixed amount of time | ||
| 91 : | BOOL mWaitingTimer; | ||
| 92 : | |||
| 93 : | // Waiting after the last step played for all animations to complete | ||
| 94 : | BOOL mWaitingAtEnd; | ||
| 95 : | |||
| 96 : | // Timer for waiting | ||
| 97 : | LLFrameTimer mWaitTimer; | ||
| 98 : | |||
| 99 : | void (*mDoneCallback)(LLMultiGesture* gesture, void* data); | ||
| 100 : | void* mCallbackData; | ||
| 101 : | |||
| 102 : | // Animations that we requested to start | ||
| 103 : | std::set<LLUUID> mRequestedAnimIDs; | ||
| 104 : | |||
| 105 : | // Once the animation starts playing (sim says to start playing) | ||
| 106 : | // the ID is moved from mRequestedAnimIDs to here. | ||
| 107 : | std::set<LLUUID> mPlayingAnimIDs; | ||
| 108 : | }; | ||
| 109 : | |||
| 110 : | |||
| 111 : | // Order must match the library_list in floater_preview_gesture.xml! | ||
| 112 : | |||
| 113 : | enum EStepType | ||
| 114 : | { | ||
| 115 : | STEP_ANIMATION = 0, | ||
| 116 : | STEP_SOUND = 1, | ||
| 117 : | STEP_CHAT = 2, | ||
| 118 : | STEP_WAIT = 3, | ||
| 119 : | |||
| 120 : | STEP_EOF = 4 | ||
| 121 : | }; | ||
| 122 : | |||
| 123 : | |||
| 124 : | class LLGestureStep | ||
| 125 : | { | ||
| 126 : | public: | ||
| 127 : | LLGestureStep() {} | ||
| 128 : | virtual ~LLGestureStep() {} | ||
| 129 : | |||
| 130 : | virtual EStepType getType() = 0; | ||
| 131 : | |||
| 132 : | // Return a user-readable label for this step | ||
| 133 : | virtual std::string getLabel() const = 0; | ||
| 134 : | |||
| 135 : | virtual S32 getMaxSerialSize() const = 0; | ||
| 136 : | virtual BOOL serialize(LLDataPacker& dp) const = 0; | ||
| 137 : | virtual BOOL deserialize(LLDataPacker& dp) = 0; | ||
| 138 : | |||
| 139 : | virtual void dump() = 0; | ||
| 140 : | }; | ||
| 141 : | |||
| 142 : | |||
| 143 : | // By default, animation steps start animations. | ||
| 144 : | // If the least significant bit is 1, it will stop animations. | ||
| 145 : | const U32 ANIM_FLAG_STOP = 0x01; | ||
| 146 : | |||
| 147 : | class LLGestureStepAnimation : public LLGestureStep | ||
| 148 : | { | ||
| 149 : | public: | ||
| 150 : | LLGestureStepAnimation(); | ||
| 151 : | virtual ~LLGestureStepAnimation(); | ||
| 152 : | |||
| 153 : | virtual EStepType getType() { return STEP_ANIMATION; } | ||
| 154 : | |||
| 155 : | virtual std::string getLabel() const; | ||
| 156 : | |||
| 157 : | virtual S32 getMaxSerialSize() const; | ||
| 158 : | virtual BOOL serialize(LLDataPacker& dp) const; | ||
| 159 : | virtual BOOL deserialize(LLDataPacker& dp); | ||
| 160 : | |||
| 161 : | virtual void dump(); | ||
| 162 : | |||
| 163 : | public: | ||
| 164 : | std::string mAnimName; | ||
| 165 : | LLUUID mAnimAssetID; | ||
| 166 : | U32 mFlags; | ||
| 167 : | }; | ||
| 168 : | |||
| 169 : | |||
| 170 : | class LLGestureStepSound : public LLGestureStep | ||
| 171 : | { | ||
| 172 : | public: | ||
| 173 : | LLGestureStepSound(); | ||
| 174 : | virtual ~LLGestureStepSound(); | ||
| 175 : | |||
| 176 : | virtual EStepType getType() { return STEP_SOUND; } | ||
| 177 : | |||
| 178 : | virtual std::string getLabel() const; | ||
| 179 : | |||
| 180 : | virtual S32 getMaxSerialSize() const; | ||
| 181 : | virtual BOOL serialize(LLDataPacker& dp) const; | ||
| 182 : | virtual BOOL deserialize(LLDataPacker& dp); | ||
| 183 : | |||
| 184 : | virtual void dump(); | ||
| 185 : | |||
| 186 : | public: | ||
| 187 : | std::string mSoundName; | ||
| 188 : | LLUUID mSoundAssetID; | ||
| 189 : | U32 mFlags; | ||
| 190 : | }; | ||
| 191 : | |||
| 192 : | |||
| 193 : | class LLGestureStepChat : public LLGestureStep | ||
| 194 : | { | ||
| 195 : | public: | ||
| 196 : | LLGestureStepChat(); | ||
| 197 : | virtual ~LLGestureStepChat(); | ||
| 198 : | |||
| 199 : | virtual EStepType getType() { return STEP_CHAT; } | ||
| 200 : | |||
| 201 : | virtual std::string getLabel() const; | ||
| 202 : | |||
| 203 : | virtual S32 getMaxSerialSize() const; | ||
| 204 : | virtual BOOL serialize(LLDataPacker& dp) const; | ||
| 205 : | virtual BOOL deserialize(LLDataPacker& dp); | ||
| 206 : | |||
| 207 : | virtual void dump(); | ||
| 208 : | |||
| 209 : | public: | ||
| 210 : | std::string mChatText; | ||
| 211 : | U32 mFlags; | ||
| 212 : | }; | ||
| 213 : | |||
| 214 : | |||
| 215 : | const U32 WAIT_FLAG_TIME = 0x01; | ||
| 216 : | const U32 WAIT_FLAG_ALL_ANIM = 0x02; | ||
| 217 : | |||
| 218 : | class LLGestureStepWait : public LLGestureStep | ||
| 219 : | { | ||
| 220 : | public: | ||
| 221 : | LLGestureStepWait(); | ||
| 222 : | virtual ~LLGestureStepWait(); | ||
| 223 : | |||
| 224 : | virtual EStepType getType() { return STEP_WAIT; } | ||
| 225 : | |||
| 226 : | virtual std::string getLabel() const; | ||
| 227 : | |||
| 228 : | virtual S32 getMaxSerialSize() const; | ||
| 229 : | virtual BOOL serialize(LLDataPacker& dp) const; | ||
| 230 : | virtual BOOL deserialize(LLDataPacker& dp); | ||
| 231 : | |||
| 232 : | virtual void dump(); | ||
| 233 : | |||
| 234 : | public: | ||
| 235 : | F32 mWaitSeconds; | ||
| 236 : | U32 mFlags; | ||
| 237 : | }; | ||
| 238 : | |||
| 239 : | #endif |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

