diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llgesturemgr.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llgesturemgr.h')
-rw-r--r-- | linden/indra/newview/llgesturemgr.h | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/linden/indra/newview/llgesturemgr.h b/linden/indra/newview/llgesturemgr.h new file mode 100644 index 0000000..1351e3a --- /dev/null +++ b/linden/indra/newview/llgesturemgr.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /** | ||
2 | * @file llgesturemgr.h | ||
3 | * @brief Manager for playing gestures on the viewer | ||
4 | * | ||
5 | * Copyright (c) 2004-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLGESTUREMGR_H | ||
29 | #define LL_LLGESTUREMGR_H | ||
30 | |||
31 | #include <map> | ||
32 | #include <string> | ||
33 | #include <vector> | ||
34 | |||
35 | #include "llassetstorage.h" // LLAssetType | ||
36 | #include "llviewerinventory.h" | ||
37 | |||
38 | class LLMultiGesture; | ||
39 | class LLGestureStep; | ||
40 | class LLUUID; | ||
41 | class LLVFS; | ||
42 | |||
43 | class LLGestureManagerObserver | ||
44 | { | ||
45 | public: | ||
46 | virtual ~LLGestureManagerObserver() { }; | ||
47 | virtual void changed() = 0; | ||
48 | }; | ||
49 | |||
50 | class LLGestureManager | ||
51 | { | ||
52 | public: | ||
53 | LLGestureManager(); | ||
54 | ~LLGestureManager(); | ||
55 | |||
56 | void init(); | ||
57 | |||
58 | // Call once per frame to manage gestures | ||
59 | void update(); | ||
60 | |||
61 | // Loads a gesture out of inventory into the in-memory active form | ||
62 | // Note that the inventory item must exist, so we can look up the | ||
63 | // asset id. | ||
64 | void activateGesture(const LLUUID& item_id); | ||
65 | |||
66 | // Activate a list of gestures | ||
67 | void activateGestures(LLViewerInventoryItem::item_array_t& items); | ||
68 | |||
69 | // If you change a gesture, you need to build a new multigesture | ||
70 | // and call this method. | ||
71 | void replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id); | ||
72 | |||
73 | // Load gesture into in-memory active form. | ||
74 | // Can be called even if the inventory item isn't loaded yet. | ||
75 | // inform_server TRUE will send message upstream to update database | ||
76 | // user_gesture_active table, which isn't necessary on login. | ||
77 | // deactivate_similar will cause other gestures with the same trigger phrase | ||
78 | // or keybinding to be deactivated. | ||
79 | void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar); | ||
80 | |||
81 | // Takes gesture out of active list and deletes it. | ||
82 | void deactivateGesture(const LLUUID& item_id); | ||
83 | |||
84 | // Deactivates all gestures that match either this trigger phrase, | ||
85 | // or this hot key. | ||
86 | void deactivateSimilarGestures(LLMultiGesture* gesture, const LLUUID& in_item_id); | ||
87 | |||
88 | BOOL isGestureActive(const LLUUID& item_id); | ||
89 | |||
90 | BOOL isGesturePlaying(const LLUUID& item_id); | ||
91 | |||
92 | // Force a gesture to be played, for example, if it is being | ||
93 | // previewed. | ||
94 | void playGesture(LLMultiGesture* gesture); | ||
95 | void playGesture(const LLUUID& item_id); | ||
96 | |||
97 | // Stop all requested or playing anims for this gesture | ||
98 | // Also remove from playing list | ||
99 | void stopGesture(LLMultiGesture* gesture); | ||
100 | void stopGesture(const LLUUID& item_id); | ||
101 | |||
102 | // Trigger the first gesture that matches this key. | ||
103 | // Returns TRUE if it finds a gesture bound to that key. | ||
104 | BOOL triggerGesture(KEY key, MASK mask); | ||
105 | |||
106 | // Trigger all gestures referenced as substrings in this string | ||
107 | BOOL triggerAndReviseString(const std::string &str, std::string *revised_string); | ||
108 | |||
109 | // Does some gesture have this key bound? | ||
110 | BOOL isKeyBound(KEY key, MASK mask); | ||
111 | |||
112 | S32 getPlayingCount() const; | ||
113 | |||
114 | void addObserver(LLGestureManagerObserver* observer); | ||
115 | void removeObserver(LLGestureManagerObserver* observer); | ||
116 | void notifyObservers(); | ||
117 | |||
118 | BOOL matchPrefix(const std::string& in_str, std::string* out_str); | ||
119 | |||
120 | // Copy item ids into the vector | ||
121 | void getItemIDs(std::vector<LLUUID>* ids); | ||
122 | |||
123 | protected: | ||
124 | // Handle the processing of a single gesture | ||
125 | void stepGesture(LLMultiGesture* gesture); | ||
126 | |||
127 | // Do a single step in a gesture | ||
128 | void runStep(LLMultiGesture* gesture, LLGestureStep* step); | ||
129 | |||
130 | // Used by loadGesture | ||
131 | static void onLoadComplete(LLVFS *vfs, | ||
132 | const LLUUID& asset_uuid, | ||
133 | LLAssetType::EType type, | ||
134 | void* user_data, S32 status); | ||
135 | |||
136 | public: | ||
137 | BOOL mValid; | ||
138 | std::vector<LLMultiGesture*> mPlaying; | ||
139 | |||
140 | // Maps inventory item_id to gesture | ||
141 | typedef std::map<LLUUID, LLMultiGesture*> item_map_t; | ||
142 | |||
143 | // Active gestures. | ||
144 | // NOTE: The gesture pointer CAN BE NULL. This means that | ||
145 | // there is a gesture with that item_id, but the asset data | ||
146 | // is still on its way down from the server. | ||
147 | item_map_t mActive; | ||
148 | |||
149 | S32 mLoadingCount; | ||
150 | std::string mDeactivateSimilarNames; | ||
151 | |||
152 | std::vector<LLGestureManagerObserver*> mObservers; | ||
153 | }; | ||
154 | |||
155 | extern LLGestureManager gGestureManager; | ||
156 | |||
157 | #endif | ||