#include <pythonscriptcomponent.h>
Public Member Functions | |
PythonScriptComponentInstance (EntityInstance &entity, Component &resource) | |
~PythonScriptComponentInstance () | |
virtual void | update (double deltaTime) override |
bool | init (utility::ErrorState &errorState) override |
template<typename ReturnType , typename ... Args> | |
bool | get (const std::string &identifier, utility::ErrorState &errorState, ReturnType &returnValue, Args &&... args) |
template<typename ... Args> | |
bool | call (const std::string &identifier, utility::ErrorState &errorState, Args &&... args) |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
The instance part of the PythonScriptComponent. Allows for running a python script inside a NAP application. The python script has to implement a class with the name of the ClassName property. The class should implement:
PythonScriptComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
bool call | ( | const std::string & | identifier, |
utility::ErrorState & | errorState, | ||
Args &&... | args | ||
) |
Tries to call a method in the python script with the specified number of input arguments. The identifier is the name of the python method to call. If the call fails the error will be logged in errorState.
identifier | python method to call |
errorState | contains the error if the call fails |
args | variable number of input arguments. |
bool get | ( | const std::string & | identifier, |
utility::ErrorState & | errorState, | ||
ReturnType & | returnValue, | ||
Args &&... | args | ||
) |
Tries to call a method that returns a value in the python script with the specified number of input arguments. The return value will be stored in returnValue, the identifier is the name of the python method to call. If the call fails the error will be logged in errorState.
identifier | python method to call. |
errorState | contains the error if the call fails. |
returnValue | the populated return value |
args | variable number of input arguments. |
|
overridevirtual |
Initializes this component based on it's resource.
errorState | contains the error when initialization fails. |
Reimplemented from ComponentInstance.
|
overridevirtual |
Update this component
deltaTime | the time in between cooks in seconds |
Reimplemented from ComponentInstance.