Added AIFetchInventoryFolder and more.
Added a new statemachine AIFetchInventoryFolder, which can be used to fetch the contents of a folder by name or UUID. Also added AIEvent (and one event, AIEvent::LLInventoryModel_mIsAgentInvUsable_true, which is needed for AIFetchInventoryFolder). Fixed LLInventoryModel::sBackgroundFetchActive to correctly reflect whether or not LLInventoryModel::backgroundFetch is added to gIdleCallbacks. Avoid duplicated entries in sFetchQueue. Reset sFullFetchStarted in LLInventoryModel::stopBackgroundFetch to allow for a renewed full fetch when some single-folder fetch stops it. Added AIStateMachine::mQueued to make calling 'cont()' more robust: calling cont() / idle() / cont() on a row would otherwise add a statemachine twice to the active list, which would cause a crash when it's killed.
This commit is contained in:
78
indra/newview/statemachine/aievent.h
Normal file
78
indra/newview/statemachine/aievent.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file aievent.h
|
||||
* @brief Collect viewer events for statemachines.
|
||||
*
|
||||
* Copyright (c) 2011, Aleric Inglewood.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 19/05/2011
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*/
|
||||
|
||||
#ifndef AIEVENT_H
|
||||
#define AIEVENT_H
|
||||
|
||||
class AIStateMachine;
|
||||
|
||||
class AIEvent {
|
||||
public:
|
||||
enum AIEvents {
|
||||
LLInventoryModel_mIsAgentInvUsable_true, // LLInventoryModel::mIsAgentInvUsable was set to true.
|
||||
number_of_events
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a statemachine for the given event.
|
||||
*
|
||||
* If the event happens then statemachine->cont() is called.
|
||||
*
|
||||
* @param event the event that we want to be notified of.
|
||||
* @param statemachine the statemachine.
|
||||
* @param one_shot if true then AIEvent::Unregister is called automatically when the event occured once.
|
||||
*/
|
||||
static void Register(AIEvents event, AIStateMachine* statemachine, bool one_shot = true);
|
||||
|
||||
/**
|
||||
* Unregister a previously registered event.
|
||||
*
|
||||
* This may be called for already unregistered events.
|
||||
* This should be called from the destructor of a statemachine for any event it registers,
|
||||
* as well as when it doesn't need the event anymore (in the case on non- one shot events).
|
||||
*
|
||||
* @param event the event we want to no longer be notified off.
|
||||
* @param statemachine the statemachine.
|
||||
*/
|
||||
static void Unregister(AIEvents event, AIStateMachine* statemachine);
|
||||
|
||||
/**
|
||||
* Trigger the event.
|
||||
*
|
||||
* This is called by the viewer code when the event happens and
|
||||
* causes statemachine->cont() to be called for every registered
|
||||
* statemachine.
|
||||
*
|
||||
* @param event the event that just happened.
|
||||
*/
|
||||
static void trigger(AIEvents event);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user