Panda3D
|
Inherits direct::showbase::DirectObject::DirectObject.
Public Member Functions | |
def | __init__ |
def | __repr__ |
def | __str__ |
def | addState |
def | conditional_request |
def | enterInitialState |
def | forceTransition |
def | getCurrentState |
def | getFinalState |
def | getInitialState |
def | getName |
def | getStateNamed |
def | getStates |
def | hasStateNamed |
def | isInternalStateInFlux |
def | request |
def | requestFinalState |
def | setFinalState |
def | setInitialState |
def | setName |
def | setStates |
def | view |
Public Attributes | |
inspecting | |
onUndefTransition | |
Static Public Attributes | |
int | ALLOW = 0 |
int | DISALLOW = 1 |
int | DISALLOW_VERBOSE = 2 |
int | ERROR = 3 |
tuple | notify = directNotify.newCategory("ClassicFSM") |
Finite State Machine class. This module and class exist only for backward compatibility with existing code. New code should use the FSM class instead.
def __init__ | ( | self, | |
name, | |||
states = [] , |
|||
initialStateName = None , |
|||
finalStateName = None , |
|||
onUndefTransition = DISALLOW_VERBOSE |
|||
) |
__init__(self, string, State[], string, string, int) ClassicFSM constructor: takes name, list of states, initial state and final state as: fsm = ClassicFSM.ClassicFSM('stopLight', [State.State('red', enterRed, exitRed, ['green']), State.State('yellow', enterYellow, exitYellow, ['red']), State.State('green', enterGreen, exitGreen, ['yellow'])], 'red', 'red') each state's last argument, a list of allowed state transitions, is optional; if left out (or explicitly specified to be State.State.Any) then any transition from the state is 'defined' and allowed 'onUndefTransition' flag determines behavior when undefined transition is requested; see flag definitions above
def __repr__ | ( | self | ) |
def __str__ | ( | self | ) |
Print out something useful about the fsm
def addState | ( | self, | |
state | |||
) |
def conditional_request | ( | self, | |
aStateName, | |||
enterArgList = [] , |
|||
exitArgList = [] |
|||
) |
'if this transition is defined, do it' Attempt transition from currentState to given one, if it exists. Return true if transition exists to given state, false otherwise. It is NOT an error/warning to attempt a cond_request if the transition doesn't exist. This lets people be sloppy about ClassicFSM transitions, letting the same fn be used for different states that may not have the same out transitions.
def enterInitialState | ( | self, | |
argList = [] |
|||
) |
def forceTransition | ( | self, | |
aStateName, | |||
enterArgList = [] , |
|||
exitArgList = [] |
|||
) |
force a transition -- for debugging ONLY
def getCurrentState | ( | self | ) |
def getFinalState | ( | self | ) |
def getInitialState | ( | self | ) |
def getName | ( | self | ) |
def getStateNamed | ( | self, | |
stateName | |||
) |
Return the state with given name if found, issue warning otherwise
def getStates | ( | self | ) |
def hasStateNamed | ( | self, | |
stateName | |||
) |
Return True if stateName is a valid state, False otherwise.
def isInternalStateInFlux | ( | self | ) |
def request | ( | self, | |
aStateName, | |||
enterArgList = [] , |
|||
exitArgList = [] , |
|||
force = 0 |
|||
) |
Attempt transition from currentState to given one. Return true is transition exists to given state, false otherwise.
def requestFinalState | ( | self | ) |
def setFinalState | ( | self, | |
finalStateName | |||
) |
def setInitialState | ( | self, | |
initialStateName | |||
) |
def setName | ( | self, | |
name | |||
) |
def setStates | ( | self, | |
states | |||
) |
setStates(self, State[])
def view | ( | self | ) |
int ALLOW = 0 [static] |
int DISALLOW = 1 [static] |
int DISALLOW_VERBOSE = 2 [static] |
int ERROR = 3 [static] |
tuple notify = directNotify.newCategory("ClassicFSM") [static] |