Events
- class tissue_forge.event.Event(invokeExecutor: EventPyInvokePyExecutor, predicateExecutor: EventPyPredicatePyExecutor | None = None)
- invoke() HRESULT
What occurs during an event. Typically, this invokes an underlying specialized method returns 0 if OK and 1 on error.
- property last_fired
Record of last time fired
- predicate() HRESULT
Evaluates an event predicate, returns 0 if the event should not fire, 1 if the event should, and a negative value on error. A predicate without a defined predicate method always returns 0
- remove() void
Designates event for removal
- property thisown
The membership flag
- property times_fired
Record of how many times fired
- tissue_forge.event.on_event(invoke_method, predicate_method=None)
Creates and registers an event using prescribed invoke and predicate python function executors
- Parameters:
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
event.Event
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
Event
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwise
- class tissue_forge.event.TimeEvent(period: FloatP_t const &, invokeExecutor: TimeEventPyInvokePyExecutor, predicateExecutor: TimeEventPyPredicatePyExecutor = None, nextTimeSetter: TissueForge::event::TimeEventNextTimeSetter * = None, start_time: FloatP_t const & = 0, end_time: FloatP_t const & = -1)
- property end_time
End time of evaluations
- eval(time: FloatP_t const &) HRESULT
- property flags
- invoke() HRESULT
What occurs during an event. Typically, this invokes an underlying specialized method returns 0 if OK and 1 on error.
- property last_fired
Record of last time fired
- property next_time
Next time of evaluation
- property period
Period of evaluation
- predicate() HRESULT
Evaluates an event predicate, returns 0 if the event should not fire, 1 if the event should, and a negative value on error. A predicate without a defined predicate method always returns 0
- remove() void
Designates event for removal
- property start_time
Start time of evaluations
- property thisown
The membership flag
- property times_fired
Record of how many times fired
- tissue_forge.event.on_time(period, invoke_method, predicate_method=None, distribution='default', start_time=0.0, end_time=-1.0)
Like
on_event
, but for an event that occurs at regular intervals.- Parameters:
period (float) – period of event
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
TimeEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
TimeEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwisedistribution (str) – distribution by which the next event time is selected
start_time (float) – time after which the event can occur
end_time (float) – time before which the event can occur; a negative value is interpreted as until ‘forever’
- class tissue_forge.event.ParticleEvent(*args)
- eval(time: FloatP_t const &) HRESULT
- property flags
- invoke() HRESULT
What occurs during an event. Typically, this invokes an underlying specialized method returns 0 if OK and 1 on error.
- property last_fired
Record of last time fired
- predicate() HRESULT
Evaluates an event predicate, returns 0 if the event should not fire, 1 if the event should, and a negative value on error. A predicate without a defined predicate method always returns 0
- remove() void
Designates event for removal
- setParticleEventParticleSelector(*args) HRESULT
- property targetParticle
Target particle of an event evaluation
- property targetType
Target particle type of this event
- property thisown
The membership flag
- property times_fired
Record of how many times fired
- tissue_forge.event.on_particle(ptype, invoke_method, predicate_method=None, selector='default', single: bool = False)
Like
on_event
, but for a particle of a particular particle type.- Parameters:
ptype (ParticleType) – the type of particle to select
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
ParticleEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
ParticleEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwiseselector (str) – name of particle selector
single (bool) – flag to only trigger event once and then return
- class tissue_forge.event.ParticleTimeEvent(*args)
- property end_time
Time at which evaluations stop
- eval(time: FloatP_t const &) HRESULT
- property flags
- invoke() HRESULT
What occurs during an event. Typically, this invokes an underlying specialized method returns 0 if OK and 1 on error.
- property last_fired
Record of last time fired
- property next_time
Next time at which an evaluation occurs
- property period
Period of event evaluations
- predicate() HRESULT
Evaluates an event predicate, returns 0 if the event should not fire, 1 if the event should, and a negative value on error. A predicate without a defined predicate method always returns 0
- remove() void
Designates event for removal
- property start_time
Time at which evaluations begin
- property targetParticle
Target particle of an event evaluation
- property targetType
Target particle type of this event
- property thisown
The membership flag
- property times_fired
Record of how many times fired
- tissue_forge.event.on_particletime(ptype, period, invoke_method, predicate_method=None, distribution='default', start_time=0.0, end_time=-1.0, selector='default')
A combination of
on_time
andon_particle
.- Parameters:
ptype (ParticleType) – the type of particle to select
period (float) – period of event
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
TimeEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
TimeEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwisedistribution (str) – distribution by which the next event time is selected
start_time (str) – time after which the event can occur
end_time (float) – time before which the event can occur; a negative value is interpreted as until ‘forever’
selector (str) – name of particle selector
- class tissue_forge.event.KeyEvent(glfw_event: Magnum::Platform::GlfwApplication::KeyEvent * = None)
- static addDelegate(_delegate: TissueForge::event::KeyEventDelegateType *) TissueForge::event::KeyEventDelegateHandle
Adds an event delegate
- Parameters:
_delegate (int) – delegate to add
- Return type:
int
- Returns:
handle for future getting and removing
- static addHandler(_handler: TissueForge::event::KeyEventHandlerType *) TissueForge::event::KeyEventHandlerHandle
Adds an event handler
- Parameters:
_handler (int) – handler to add
- Return type:
int
- Returns:
handle for future getting and removing
- static getDelegate(handle: TissueForge::event::KeyEventDelegateHandle const &) TissueForge::event::KeyEventDelegateType *
Get an event delegate
- Parameters:
handle (int) – delegate handle
- Return type:
int
- Returns:
delegate if handle is valid, otherwise NULL
- static getHandler(handle: TissueForge::event::KeyEventHandlerHandle const &) TissueForge::event::KeyEventHandlerType *
Get an event handler
- Parameters:
handle (int) – handler handle
- Return type:
int
- Returns:
handler if handle is valid, otherwise NULL
- property glfw_event
- static invoke(*args) HRESULT
- keyAlt() bool
- keyCtrl() bool
- keyName() std::string
- keyShift() bool
- property key_alt: bool
Flag for whether Alt key is pressed
- property key_ctrl: bool
Flag for whether Ctrl key is pressed
- property key_name: str
Key pressed for this event
- property key_shift: bool
Flag for whether Shift key is pressed
- static removeDelegate(handle: TissueForge::event::KeyEventDelegateHandle const &) bool
Remove an event delegate
- Parameters:
handle (int) – delegate handle
- Return type:
boolean
- Returns:
true when delegate is removed
- Return type:
boolean
- Returns:
false when handle is invalid
- static removeHandler(handle: TissueForge::event::KeyEventHandlerHandle const &) bool
Remove an event handler
- Parameters:
handle (int) – handler handle
- Return type:
boolean
- Returns:
true when handler is removed
- Return type:
boolean
- Returns:
false when handle is invalid
- property thisown
The membership flag