diff options
Diffstat (limited to 'linden/indra/newview/rlvhelper.cpp')
-rw-r--r-- | linden/indra/newview/rlvhelper.cpp | 374 |
1 files changed, 181 insertions, 193 deletions
diff --git a/linden/indra/newview/rlvhelper.cpp b/linden/indra/newview/rlvhelper.cpp index 429a527..f495384 100644 --- a/linden/indra/newview/rlvhelper.cpp +++ b/linden/indra/newview/rlvhelper.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "llviewerprecompiledheaders.h" | 1 | #include "llviewerprecompiledheaders.h" |
2 | #include "llagent.h" | 2 | #include "llagent.h" |
3 | #include "llfloaterwindlight.h" | ||
3 | #include "llviewerobject.h" | 4 | #include "llviewerobject.h" |
4 | #include "llviewerstats.h" | 5 | #include "llviewerstats.h" |
5 | #include "llviewerwindow.h" | 6 | #include "llviewerwindow.h" |
@@ -14,31 +15,33 @@ | |||
14 | // Static variable initialization | 15 | // Static variable initialization |
15 | // | 16 | // |
16 | 17 | ||
17 | RlvMultiStringSearch RlvCommand::m_BhvrLookup; | 18 | RlvCommand::RlvBhvrTable RlvCommand::m_BhvrMap; |
18 | 19 | ||
19 | // ============================================================================ | 20 | // ============================================================================ |
21 | // RlvCommmand | ||
22 | // | ||
20 | 23 | ||
21 | // Checked: | 24 | // Checked: 2009-09-10 (RLVa-1.0.3a) | Modified: RLVa-1.0.3a |
22 | RlvCommand::RlvCommand(const std::string& strCommand) | 25 | RlvCommand::RlvCommand(const std::string& strCommand) |
23 | : m_eBehaviour(RLV_BHVR_UNKNOWN), m_eParamType(RLV_TYPE_UNKNOWN) | 26 | : m_eBehaviour(RLV_BHVR_UNKNOWN), m_eParamType(RLV_TYPE_UNKNOWN) |
24 | { | 27 | { |
25 | if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam))) | 28 | if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam))) |
26 | { | 29 | { |
30 | S32 nTemp = 0; | ||
27 | if ( ("n" == m_strParam) || ("add" == m_strParam) ) | 31 | if ( ("n" == m_strParam) || ("add" == m_strParam) ) |
28 | m_eParamType = RLV_TYPE_ADD; | 32 | m_eParamType = RLV_TYPE_ADD; |
29 | else if ( ("y" == m_strParam) || ("rem" == m_strParam) ) | 33 | else if ( ("y" == m_strParam) || ("rem" == m_strParam) ) |
30 | m_eParamType = RLV_TYPE_REMOVE; | 34 | m_eParamType = RLV_TYPE_REMOVE; |
31 | else if ("force" == m_strParam) | 35 | else if ("force" == m_strParam) |
32 | m_eParamType = RLV_TYPE_FORCE; | 36 | m_eParamType = RLV_TYPE_FORCE; |
37 | else if (LLStringUtil::convertToS32(m_strParam, nTemp)) // Assume it's a reply command if we can convert <param> to an S32 | ||
38 | m_eParamType = RLV_TYPE_REPLY; | ||
39 | else if (m_strBehaviour == "clear") // clear is the odd one out so just make it its own type | ||
40 | m_eParamType = RLV_TYPE_CLEAR; | ||
33 | else | 41 | else |
34 | { | 42 | { |
35 | m_eParamType = RLV_TYPE_REPLY; // Assume it's a reply command until we encounter a non-digit | 43 | m_eParamType = RLV_TYPE_UNKNOWN; |
36 | 44 | m_fValid = false; | |
37 | if ( (m_strParam.empty()) || (-1 != m_strParam.find_first_not_of("0123456789")) ) | ||
38 | { | ||
39 | m_eParamType = RLV_TYPE_UNKNOWN; | ||
40 | m_fValid = ("clear" == m_strBehaviour); | ||
41 | } | ||
42 | } | 45 | } |
43 | } | 46 | } |
44 | 47 | ||
@@ -48,50 +51,16 @@ RlvCommand::RlvCommand(const std::string& strCommand) | |||
48 | return; | 51 | return; |
49 | } | 52 | } |
50 | 53 | ||
51 | U16 nBehaviour; | 54 | RlvBhvrTable::const_iterator itBhvr = m_BhvrMap.find(m_strBehaviour); |
52 | if (m_BhvrLookup.getExactMatchParam(m_strBehaviour, nBehaviour)) | 55 | if (itBhvr != m_BhvrMap.end()) |
53 | { | 56 | m_eBehaviour = itBhvr->second; |
54 | m_eBehaviour = (ERlvBehaviour)nBehaviour; | ||
55 | } | ||
56 | } | 57 | } |
57 | 58 | ||
58 | RlvCommand::RlvCommand(const RlvCommand& rlvCmd) | ||
59 | : m_fValid(rlvCmd.m_fValid), | ||
60 | m_strBehaviour(rlvCmd.m_strBehaviour), m_eBehaviour(rlvCmd.m_eBehaviour), | ||
61 | m_strOption(rlvCmd.m_strOption), | ||
62 | m_strParam(rlvCmd.m_strParam), m_eParamType(rlvCmd.m_eParamType) | ||
63 | { | ||
64 | } | ||
65 | 59 | ||
66 | // ============================================================================ | 60 | bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam) |
67 | |||
68 | /* | ||
69 | * ------------------------------ | ||
70 | * Command | RLV | RLVa | ||
71 | * ------------------------------ | ||
72 | * : | F | F (missing behaviour) | ||
73 | * :option | F | F (missing behaviour) | ||
74 | * := | T | F (missing behaviour) | ||
75 | * :option= | T | F (missing behaviour) | ||
76 | * :option=param | T | F (missing behaviour) | ||
77 | * = | T | F (missing behaviour) | ||
78 | * =param | T | F (missing behaviour) | ||
79 | * cmd | F | F (missing param) [T if <behaviour> == "clear"] | ||
80 | * cmd: | F | F (missing param) | ||
81 | * cmd:option | F | F (missing param) | ||
82 | * cmd:= | T | F (missing param) [1] | ||
83 | * cmd:option= | T | F (missing param) [1] | ||
84 | * cmd= | T | F (missing param) [1] | ||
85 | * cmd:option=param | T | T | ||
86 | * cmd=param | T | T | ||
87 | * cmd:=param | T | T | ||
88 | * | ||
89 | * [1] 'clear:=', 'clear:option=' and 'clear=' are "valid" variations of 'clear' | ||
90 | */ | ||
91 | |||
92 | BOOL RlvCommand::parseCommand(/*[in]*/ const std::string& strCommand, | ||
93 | /*[out]*/ std::string& strBehaviour, /*[out]*/ std::string& strOption, /*[out]*/ std::string& strParam) | ||
94 | { | 61 | { |
62 | // (See behaviour notes for the command parsing truth table) | ||
63 | |||
95 | // Format: <behaviour>[:<option>]=<param> | 64 | // Format: <behaviour>[:<option>]=<param> |
96 | int idxParam = strCommand.find('='); | 65 | int idxParam = strCommand.find('='); |
97 | int idxOption = (idxParam > 0) ? strCommand.find(':') : -1; | 66 | int idxOption = (idxParam > 0) ? strCommand.find(':') : -1; |
@@ -100,7 +69,7 @@ BOOL RlvCommand::parseCommand(/*[in]*/ const std::string& strCommand, | |||
100 | 69 | ||
101 | // If <behaviour> is missing it's always an improperly formatted command | 70 | // If <behaviour> is missing it's always an improperly formatted command |
102 | if ( (0 == idxOption) || (0 == idxParam) ) | 71 | if ( (0 == idxOption) || (0 == idxParam) ) |
103 | return FALSE; | 72 | return false; |
104 | 73 | ||
105 | strBehaviour = strCommand.substr(0, (-1 != idxOption) ? idxOption : idxParam); | 74 | strBehaviour = strCommand.substr(0, (-1 != idxOption) ? idxOption : idxParam); |
106 | strOption = strParam = ""; | 75 | strOption = strParam = ""; |
@@ -111,15 +80,15 @@ BOOL RlvCommand::parseCommand(/*[in]*/ const std::string& strCommand, | |||
111 | // Unless "<behaviour> == "clear" AND (idxOption == 0)" | 80 | // Unless "<behaviour> == "clear" AND (idxOption == 0)" |
112 | // OR <behaviour> == "clear" AND (idxParam != 0) [see table above] | 81 | // OR <behaviour> == "clear" AND (idxParam != 0) [see table above] |
113 | if ( ("clear" == strBehaviour) && ( (!idxOption) || (idxParam) ) ) | 82 | if ( ("clear" == strBehaviour) && ( (!idxOption) || (idxParam) ) ) |
114 | return TRUE; | 83 | return true; |
115 | return FALSE; | 84 | return false; |
116 | } | 85 | } |
117 | 86 | ||
118 | if ( (-1 != idxOption) && (idxOption + 1 != idxParam) ) | 87 | if ( (-1 != idxOption) && (idxOption + 1 != idxParam) ) |
119 | strOption = strCommand.substr(idxOption + 1, idxParam - idxOption - 1); | 88 | strOption = strCommand.substr(idxOption + 1, idxParam - idxOption - 1); |
120 | strParam = strCommand.substr(idxParam + 1); | 89 | strParam = strCommand.substr(idxParam + 1); |
121 | 90 | ||
122 | return TRUE; | 91 | return true; |
123 | } | 92 | } |
124 | 93 | ||
125 | void RlvCommand::initLookupTable() | 94 | void RlvCommand::initLookupTable() |
@@ -127,57 +96,61 @@ void RlvCommand::initLookupTable() | |||
127 | static bool fInitialized = false; | 96 | static bool fInitialized = false; |
128 | if (!fInitialized) | 97 | if (!fInitialized) |
129 | { | 98 | { |
130 | // NOTE: keep this match with the enumeration at all times | 99 | // NOTE: keep this matched with the enumeration at all times |
131 | std::string arBehaviours[RLV_BHVR_COUNT] = | 100 | std::string arBehaviours[RLV_BHVR_COUNT] = |
132 | { | 101 | { |
133 | "version", "detach", "redirchat", "rediremote", "sendim", "recvchat", "recvemote", "recvim", "tploc", "tplure", | 102 | "version", "detach", "sendchat", "emote", "chatshout", "chatnormal", "chatwhisper", "redirchat", "rediremote", |
134 | "sittp", "edit", "rez", "addoutfit", "remoutfit", "getoutfit", "getattach", "showinv", "unsit", "sit", | 103 | "sendim", "recvchat", "recvemote", "recvim", "tplm", "tploc", "tplure", "sittp", "edit", "rez", "addoutfit", |
135 | "getstatus", "getstatusall", "getinv", "getinvworn", "findfolder", "findfolders", "attach", "attachall", "detachall", | 104 | "remoutfit", "getoutfit", "getattach", "showinv", "viewnote", "unsit", "sit", "sendchannel", "getstatus", "getstatusall", |
136 | "getpath", "attachthis", "attachallthis", "detachthis", "detachallthis", "fartouch", "showworldmap", "showminimap", | 105 | "getinv", "getinvworn", "findfolder", "findfolders", "attach", "attachall", "detachall", "getpath", "attachthis", |
137 | "showloc", "tpto", "accepttp", "shownames", "fly", "getsitid", "setdebug", "setenv", "detachme", | 106 | "attachallthis", "detachthis", "detachallthis", "fartouch", "showworldmap", "showminimap", "showloc", "tpto", "accepttp", |
138 | "showhovertextall", "showhovertextworld", "showhovertexthud", "showhovertext", "notify" | 107 | "shownames", "fly", "getsitid", "setdebug", "setenv", "detachme", "showhovertextall", "showhovertextworld", |
108 | "showhovertexthud", "showhovertext", "notify" | ||
139 | }; | 109 | }; |
140 | 110 | ||
141 | for (int idxBvhr = 0; idxBvhr < RLV_BHVR_COUNT; idxBvhr++) | 111 | for (int idxBvhr = 0; idxBvhr < RLV_BHVR_COUNT; idxBvhr++) |
142 | m_BhvrLookup.addKeyword(arBehaviours[idxBvhr], idxBvhr); | 112 | m_BhvrMap.insert(std::pair<std::string, ERlvBehaviour>(arBehaviours[idxBvhr], (ERlvBehaviour)idxBvhr)); |
143 | 113 | ||
144 | fInitialized = true; | 114 | fInitialized = true; |
145 | } | 115 | } |
146 | } | 116 | } |
147 | 117 | ||
148 | // Checked: 2009-06-07 (RLVa-0.2.1c) | 118 | // ========================================================================= |
149 | std::string RlvCommand::asString() const | 119 | // RlvObject |
120 | // | ||
121 | |||
122 | RlvObject::RlvObject(const LLUUID& idObj) : m_UUID(idObj), m_nLookupMisses(0) | ||
150 | { | 123 | { |
151 | return (!m_strOption.empty()) ? (std::string(m_strBehaviour)).append(":").append(m_strOption) : (std::string(m_strBehaviour)); | 124 | LLViewerObject* pObj = gObjectList.findObject(idObj); |
125 | m_fLookup = (NULL != pObj); | ||
126 | m_idxAttachPt = (pObj) ? ATTACHMENT_ID_FROM_STATE(pObj->getState()) : 0; | ||
152 | } | 127 | } |
153 | 128 | ||
154 | // ========================================================================= | 129 | bool RlvObject::addCommand(const RlvCommand& rlvCmd) |
155 | |||
156 | BOOL RlvObject::addCommand(const RlvCommand& rlvCmd) | ||
157 | { | 130 | { |
158 | // Sanity checking | 131 | // Sanity checking |
159 | if (RLV_TYPE_ADD != rlvCmd.getParamType()) | 132 | if (RLV_TYPE_ADD != rlvCmd.getParamType()) |
160 | return FALSE; | 133 | return false; |
161 | 134 | ||
162 | // Don't add duplicate commands for this object (ie @detach=n followed by another @detach=n later on) | 135 | // Don't add duplicate commands for this object (ie @detach=n followed by another @detach=n later on) |
163 | BOOL fDuplicate = | 136 | bool fDuplicate = |
164 | (RLV_BHVR_UNKNOWN != rlvCmd.getBehaviourType()) | 137 | (RLV_BHVR_UNKNOWN != rlvCmd.getBehaviourType()) |
165 | ? hasBehaviour(rlvCmd.getBehaviourType(), rlvCmd.getOption()) | 138 | ? hasBehaviour(rlvCmd.getBehaviourType(), rlvCmd.getOption()) |
166 | : hasBehaviour(rlvCmd.getBehaviour(), rlvCmd.getOption()); | 139 | : hasBehaviour(rlvCmd.getBehaviour(), rlvCmd.getOption()); |
167 | if (fDuplicate) | 140 | if (fDuplicate) |
168 | return FALSE; | 141 | return false; |
169 | 142 | ||
170 | // Now that we know it's not a duplicate, add it to the end of the list | 143 | // Now that we know it's not a duplicate, add it to the end of the list |
171 | m_Commands.push_back(rlvCmd); | 144 | m_Commands.push_back(rlvCmd); |
172 | 145 | ||
173 | return TRUE; | 146 | return true; |
174 | } | 147 | } |
175 | 148 | ||
176 | BOOL RlvObject::removeCommand(const RlvCommand& rlvCmd) | 149 | bool RlvObject::removeCommand(const RlvCommand& rlvCmd) |
177 | { | 150 | { |
178 | // Sanity checking | 151 | // Sanity checking |
179 | if (RLV_TYPE_REMOVE != rlvCmd.getParamType()) | 152 | if (RLV_TYPE_REMOVE != rlvCmd.getParamType()) |
180 | return FALSE; | 153 | return false; |
181 | 154 | ||
182 | for (rlv_command_list_t::iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) | 155 | for (rlv_command_list_t::iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) |
183 | { | 156 | { |
@@ -185,42 +158,42 @@ BOOL RlvObject::removeCommand(const RlvCommand& rlvCmd) | |||
185 | if ( (itCmd->getBehaviour() == rlvCmd.getBehaviour()) && (itCmd->getOption() == rlvCmd.getOption()) ) | 158 | if ( (itCmd->getBehaviour() == rlvCmd.getBehaviour()) && (itCmd->getOption() == rlvCmd.getOption()) ) |
186 | { | 159 | { |
187 | m_Commands.erase(itCmd); | 160 | m_Commands.erase(itCmd); |
188 | return TRUE; | 161 | return true; |
189 | } | 162 | } |
190 | } | 163 | } |
191 | return FALSE; // Command was never added so nothing to remove now | 164 | return false; // Command was never added so nothing to remove now |
192 | } | 165 | } |
193 | 166 | ||
194 | BOOL RlvObject::hasBehaviour(ERlvBehaviour eBehaviour) const | 167 | bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour) const |
195 | { | 168 | { |
196 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) | 169 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) |
197 | if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption().empty()) ) | 170 | if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption().empty()) ) |
198 | return TRUE; | 171 | return true; |
199 | return FALSE; | 172 | return false; |
200 | } | 173 | } |
201 | 174 | ||
202 | BOOL RlvObject::hasBehaviour(const std::string& strBehaviour) const | 175 | bool RlvObject::hasBehaviour(const std::string& strBehaviour) const |
203 | { | 176 | { |
204 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) | 177 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) |
205 | if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption().empty()) ) | 178 | if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption().empty()) ) |
206 | return TRUE; | 179 | return true; |
207 | return FALSE; | 180 | return false; |
208 | } | 181 | } |
209 | 182 | ||
210 | BOOL RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const | 183 | bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const |
211 | { | 184 | { |
212 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) | 185 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) |
213 | if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption() == strOption) ) | 186 | if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption() == strOption) ) |
214 | return TRUE; | 187 | return true; |
215 | return FALSE; | 188 | return false; |
216 | } | 189 | } |
217 | 190 | ||
218 | BOOL RlvObject::hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const | 191 | bool RlvObject::hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const |
219 | { | 192 | { |
220 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) | 193 | for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) |
221 | if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption() == strOption) ) | 194 | if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption() == strOption) ) |
222 | return TRUE; | 195 | return true; |
223 | return FALSE; | 196 | return false; |
224 | } | 197 | } |
225 | 198 | ||
226 | // Checked: 2009-06-07 (RLVa-0.2.1c) | 199 | // Checked: 2009-06-07 (RLVa-0.2.1c) |
@@ -242,31 +215,9 @@ std::string RlvObject::getStatusString(const std::string& strMatch) const | |||
242 | return strStatus; | 215 | return strStatus; |
243 | } | 216 | } |
244 | 217 | ||
245 | // ========================================================================= | 218 | // ============================================================================ |
246 | /* | 219 | // RlvWearableItemCollector |
247 | * Various helper classes/timers/functors | 220 | // |
248 | * | ||
249 | */ | ||
250 | |||
251 | // Checked: 2009-05-26 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d | ||
252 | S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type) | ||
253 | { | ||
254 | S32 cntType = 0; | ||
255 | if (pFolder) | ||
256 | { | ||
257 | LLInventoryModel::cat_array_t* pFolders; | ||
258 | LLInventoryModel::item_array_t* pItems; | ||
259 | gInventory.getDirectDescendentsOf(pFolder->getUUID(), pFolders, pItems); | ||
260 | |||
261 | if (pItems) | ||
262 | { | ||
263 | for (S32 idxItem = 0, cntItem = pItems->count(); idxItem < cntItem; idxItem++) | ||
264 | if (pItems->get(idxItem)->getType() == type) | ||
265 | cntType++; | ||
266 | } | ||
267 | } | ||
268 | return cntType; | ||
269 | } | ||
270 | 221 | ||
271 | // Checked: 2009-05-30 (RLVa-0.2.0e) | Added: RLVa-0.2.0e | 222 | // Checked: 2009-05-30 (RLVa-0.2.0e) | Added: RLVa-0.2.0e |
272 | const LLUUID& RlvWearableItemCollector::getFoldedParent(const LLUUID& idFolder) const | 223 | const LLUUID& RlvWearableItemCollector::getFoldedParent(const LLUUID& idFolder) const |
@@ -365,56 +316,72 @@ bool RlvWearableItemCollector::operator()(LLInventoryCategory* pFolder, LLInvent | |||
365 | return (pFolder) ? onCollectFolder(pFolder) : ( (pItem) ? onCollectItem(pItem) : false ); | 316 | return (pFolder) ? onCollectFolder(pFolder) : ( (pItem) ? onCollectItem(pItem) : false ); |
366 | } | 317 | } |
367 | 318 | ||
368 | // Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0f | 319 | // ============================================================================ |
369 | bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode) | 320 | // RlvWLSnapshot |
370 | { | 321 | // |
371 | return (pNode->getObject()) ? !gRlvHandler.isDetachable(pNode->getObject()) : false; | ||
372 | } | ||
373 | |||
374 | // Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0f | ||
375 | bool RlvSelectIsOwnedByOrGroupOwned::apply(LLSelectNode* pNode) | ||
376 | { | ||
377 | return (pNode->mPermissions->isGroupOwned()) || (pNode->mPermissions->getOwner() == m_idAgent); | ||
378 | } | ||
379 | 322 | ||
380 | // Checked: 2009-05-31 (RLVa-0.2.0f) | Modified: RLVa-0.2.0f | 323 | // Checked: 2009-06-03 (RLVa-0.2.0h) | Added: RLVa-0.2.0h |
381 | bool RlvSelectIsSittingOn::apply(LLSelectNode* pNode) | 324 | void RlvWLSnapshot::restoreSnapshot(const RlvWLSnapshot* pWLSnapshot) |
382 | { | 325 | { |
383 | return (pNode->getObject()) && (pNode->getObject()->getRootEdit() == m_pObject); | 326 | LLWLParamManager* pWLParams = LLWLParamManager::instance(); |
327 | if ( (pWLSnapshot) && (pWLParams) ) | ||
328 | { | ||
329 | pWLParams->mAnimator.mIsRunning = pWLSnapshot->fIsRunning; | ||
330 | pWLParams->mAnimator.mUseLindenTime = pWLSnapshot->fUseLindenTime; | ||
331 | pWLParams->mCurParams = pWLSnapshot->WLParams; | ||
332 | pWLParams->propagateParameters(); | ||
333 | } | ||
384 | } | 334 | } |
385 | 335 | ||
386 | // Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0g | 336 | // Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c |
387 | bool rlvCanDeleteOrReturn() | 337 | RlvWLSnapshot* RlvWLSnapshot::takeSnapshot() |
388 | { | 338 | { |
389 | bool fIsAllowed = true; | 339 | // HACK: see RlvExtGetSet::onGetEnv |
390 | 340 | if (!LLFloaterWindLight::isOpen()) | |
391 | if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) | ||
392 | { | 341 | { |
393 | // We'll allow if none of the prims are owned by the avie or group owned | 342 | LLFloaterWindLight::instance()->close(); |
394 | LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); | 343 | LLFloaterWindLight::instance()->syncMenu(); |
395 | RlvSelectIsOwnedByOrGroupOwned func(gAgent.getID()); | ||
396 | if ( (handleSel.notNull()) && ((0 == handleSel->getRootObjectCount()) || (NULL != handleSel->getFirstRootNode(&func, FALSE))) ) | ||
397 | fIsAllowed = false; | ||
398 | } | 344 | } |
399 | 345 | ||
400 | if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) ) | 346 | RlvWLSnapshot* pWLSnapshot = NULL; |
347 | LLWLParamManager* pWLParams = LLWLParamManager::instance(); | ||
348 | if (pWLParams) | ||
401 | { | 349 | { |
402 | // We'll allow if the avie isn't sitting on any of the selected objects | 350 | pWLSnapshot = new RlvWLSnapshot(); |
403 | LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); | 351 | pWLSnapshot->fIsRunning = pWLParams->mAnimator.mIsRunning; |
404 | RlvSelectIsSittingOn func(gAgent.getAvatarObject()->getRoot()); | 352 | pWLSnapshot->fUseLindenTime = pWLParams->mAnimator.mUseLindenTime; |
405 | if ( (handleSel.notNull()) && (handleSel->getFirstRootNode(&func, TRUE)) ) | 353 | pWLSnapshot->WLParams = pWLParams->mCurParams; |
406 | fIsAllowed = false; | ||
407 | } | 354 | } |
408 | 355 | return pWLSnapshot; | |
409 | return fIsAllowed; | ||
410 | } | 356 | } |
411 | 357 | ||
412 | // Checked: 2009-09-08 (RLVa-1.0.2c) | Modified: RLVa-1.0.2c | 358 | // ========================================================================= |
413 | BOOL rlvAttachToEnabler(void* pParam) | 359 | // RlvSettings |
414 | { | 360 | // |
415 | // Enables/disables an option on the "Attach to (HUD)" submenu depending on whether it is (un)detachable | 361 | |
416 | return gRlvHandler.isDetachable((LLViewerJointAttachment*)pParam); | 362 | BOOL RlvSettings::fShowNameTags = FALSE; |
417 | } | 363 | |
364 | #ifdef RLV_EXTENSION_STARTLOCATION | ||
365 | // Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1d | ||
366 | void RlvSettings::updateLoginLastLocation() | ||
367 | { | ||
368 | if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) | ||
369 | { | ||
370 | BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || | ||
371 | ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && | ||
372 | (gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->mIsSitting) ); | ||
373 | if (gSavedPerAccountSettings.getBOOL(RLV_SETTING_LOGINLASTLOCATION) != fValue) | ||
374 | { | ||
375 | gSavedPerAccountSettings.setBOOL(RLV_SETTING_LOGINLASTLOCATION, fValue); | ||
376 | gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); | ||
377 | } | ||
378 | } | ||
379 | } | ||
380 | #endif // RLV_EXTENSION_STARTLOCATION | ||
381 | |||
382 | // ========================================================================= | ||
383 | // Various helper classes/timers/functors | ||
384 | // | ||
418 | 385 | ||
419 | BOOL RlvGCTimer::tick() | 386 | BOOL RlvGCTimer::tick() |
420 | { | 387 | { |
@@ -453,63 +420,84 @@ void RlvCurrentlyWorn::fetchWorn() | |||
453 | f.fetchItems(idItems); | 420 | f.fetchItems(idItems); |
454 | } | 421 | } |
455 | 422 | ||
456 | // ========================================================================= | 423 | // Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0f |
424 | bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode) | ||
425 | { | ||
426 | return (pNode->getObject()) ? !gRlvHandler.isDetachable(pNode->getObject()) : false; | ||
427 | } | ||
457 | 428 | ||
458 | // Checked: 2009-06-03 (RLVa-0.2.0h) | Added: RLVa-0.2.0h | 429 | // Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0f |
459 | void RlvWLSnapshot::restoreSnapshot(const RlvWLSnapshot* pWLSnapshot) | 430 | bool RlvSelectIsOwnedByOrGroupOwned::apply(LLSelectNode* pNode) |
460 | { | 431 | { |
461 | LLWLParamManager* pWLParams = LLWLParamManager::instance(); | 432 | return (pNode->mPermissions->isGroupOwned()) || (pNode->mPermissions->getOwner() == m_idAgent); |
462 | if ( (pWLSnapshot) && (pWLParams) ) | ||
463 | { | ||
464 | pWLParams->mAnimator.mIsRunning = pWLSnapshot->fIsRunning; | ||
465 | pWLParams->mAnimator.mUseLindenTime = pWLSnapshot->fUseLindenTime; | ||
466 | pWLParams->mCurParams = pWLSnapshot->WLParams; | ||
467 | pWLParams->propagateParameters(); | ||
468 | } | ||
469 | } | 433 | } |
470 | 434 | ||
471 | // Checked: 2009-06-03 (RLVa-0.2.0h) | Added: RLVa-0.2.0h | 435 | // Checked: 2009-05-31 (RLVa-0.2.0f) | Modified: RLVa-0.2.0f |
472 | RlvWLSnapshot* RlvWLSnapshot::takeSnapshot() | 436 | bool RlvSelectIsSittingOn::apply(LLSelectNode* pNode) |
473 | { | 437 | { |
474 | RlvWLSnapshot* pWLSnapshot = NULL; | 438 | return (pNode->getObject()) && (pNode->getObject()->getRootEdit() == m_pObject); |
475 | LLWLParamManager* pWLParams = LLWLParamManager::instance(); | 439 | } |
476 | if (pWLParams) | 440 | |
441 | // ============================================================================ | ||
442 | // Various helper functions | ||
443 | // | ||
444 | |||
445 | // Checked: 2009-09-08 (RLVa-1.0.2c) | Modified: RLVa-1.0.2c | ||
446 | BOOL rlvAttachToEnabler(void* pParam) | ||
447 | { | ||
448 | // Enables/disables an option on the "Attach to (HUD)" submenu depending on whether it is (un)detachable | ||
449 | return gRlvHandler.isDetachable((LLViewerJointAttachment*)pParam); | ||
450 | } | ||
451 | |||
452 | // Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0g | ||
453 | bool rlvCanDeleteOrReturn() | ||
454 | { | ||
455 | bool fIsAllowed = true; | ||
456 | |||
457 | if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) | ||
477 | { | 458 | { |
478 | pWLSnapshot = new RlvWLSnapshot(); | 459 | // We'll allow if none of the prims are owned by the avie or group owned |
479 | pWLSnapshot->fIsRunning = pWLParams->mAnimator.mIsRunning; | 460 | LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); |
480 | pWLSnapshot->fUseLindenTime = pWLParams->mAnimator.mUseLindenTime; | 461 | RlvSelectIsOwnedByOrGroupOwned func(gAgent.getID()); |
481 | pWLSnapshot->WLParams = pWLParams->mCurParams; | 462 | if ( (handleSel.notNull()) && ((0 == handleSel->getRootObjectCount()) || (NULL != handleSel->getFirstRootNode(&func, FALSE))) ) |
463 | fIsAllowed = false; | ||
482 | } | 464 | } |
483 | return pWLSnapshot; | ||
484 | } | ||
485 | 465 | ||
486 | // ========================================================================= | 466 | if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) ) |
467 | { | ||
468 | // We'll allow if the avie isn't sitting on any of the selected objects | ||
469 | LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); | ||
470 | RlvSelectIsSittingOn func(gAgent.getAvatarObject()->getRoot()); | ||
471 | if ( (handleSel.notNull()) && (handleSel->getFirstRootNode(&func, TRUE)) ) | ||
472 | fIsAllowed = false; | ||
473 | } | ||
487 | 474 | ||
488 | BOOL RlvSettings::fShowNameTags = FALSE; | 475 | return fIsAllowed; |
476 | } | ||
489 | 477 | ||
490 | #ifdef RLV_EXTENSION_STARTLOCATION | 478 | // Checked: 2009-05-26 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d |
491 | // Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1d | 479 | S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type) |
492 | void RlvSettings::updateLoginLastLocation() | 480 | { |
481 | S32 cntType = 0; | ||
482 | if (pFolder) | ||
493 | { | 483 | { |
494 | if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) | 484 | LLInventoryModel::cat_array_t* pFolders; |
485 | LLInventoryModel::item_array_t* pItems; | ||
486 | gInventory.getDirectDescendentsOf(pFolder->getUUID(), pFolders, pItems); | ||
487 | |||
488 | if (pItems) | ||
495 | { | 489 | { |
496 | BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || | 490 | for (S32 idxItem = 0, cntItem = pItems->count(); idxItem < cntItem; idxItem++) |
497 | ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && | 491 | if (pItems->get(idxItem)->getType() == type) |
498 | (gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->mIsSitting) ); | 492 | cntType++; |
499 | if (gSavedPerAccountSettings.getBOOL(RLV_SETTING_LOGINLASTLOCATION) != fValue) | ||
500 | { | ||
501 | gSavedPerAccountSettings.setBOOL(RLV_SETTING_LOGINLASTLOCATION, fValue); | ||
502 | gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); | ||
503 | } | ||
504 | } | 493 | } |
505 | } | 494 | } |
506 | #endif // RLV_EXTENSION_STARTLOCATION | 495 | return cntType; |
507 | 496 | } | |
508 | // ========================================================================= | ||
509 | 497 | ||
510 | #ifdef RLV_ADVANCED_TOGGLE_RLVA | 498 | #ifdef RLV_ADVANCED_TOGGLE_RLVA |
511 | // Checked: 2009-07-12 (RLVa-1.0.0h) | Modified: RLVa-1.0.0h | 499 | // Checked: 2009-07-12 (RLVa-1.0.0h) | Modified: RLVa-1.0.0h |
512 | void rlvDbgToggleEnabled(void*) | 500 | void rlvToggleEnabled(void*) |
513 | { | 501 | { |
514 | gSavedSettings.setBOOL(RLV_SETTING_MAIN, !rlv_handler_t::isEnabled()); | 502 | gSavedSettings.setBOOL(RLV_SETTING_MAIN, !rlv_handler_t::isEnabled()); |
515 | 503 | ||
@@ -526,7 +514,7 @@ BOOL RlvSettings::fShowNameTags = FALSE; | |||
526 | #endif | 514 | #endif |
527 | } | 515 | } |
528 | // Checked: 2009-07-08 (RLVa-1.0.0e) | 516 | // Checked: 2009-07-08 (RLVa-1.0.0e) |
529 | BOOL rlvDbgGetEnabled(void*) | 517 | BOOL rlvGetEnabled(void*) |
530 | { | 518 | { |
531 | return rlv_handler_t::isEnabled(); | 519 | return rlv_handler_t::isEnabled(); |
532 | } | 520 | } |
@@ -568,7 +556,7 @@ void rlvSendBusyMessage(const LLUUID& idTo, const std::string& strMsg, const LLU | |||
568 | // Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e | 556 | // Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e |
569 | bool rlvSendChatReply(S32 nChannel, const std::string& strReply) | 557 | bool rlvSendChatReply(S32 nChannel, const std::string& strReply) |
570 | { | 558 | { |
571 | if (!rlvIsValidChannel(nChannel)) | 559 | if (!rlvIsValidReplyChannel(nChannel)) |
572 | return false; | 560 | return false; |
573 | 561 | ||
574 | // Copy/paste from send_chat_from_viewer() | 562 | // Copy/paste from send_chat_from_viewer() |