Public Member Functions | List of all members
ComponentInstance Class Reference

#include <component.h>

Public Member Functions

 ComponentInstance (EntityInstance &entity, Component &resource)
virtual void update (double deltaTime)
nap::EntityInstancegetEntityInstance () const
nap::ComponentgetComponent () const
template<typename T >
T * getComponent () const
virtual bool init (utility::ErrorState &errorState)
virtual bool init (utility::ErrorState &errorState)
- Public Member Functions inherited from Object
 Object ()
virtual ~Object ()
virtual void onDestroy ()
 Object (Object &)=delete
Objectoperator= (const Object &)=delete
 Object (Object &&)=delete
Objectoperator= (Object &&)=delete

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...


Runtime version of a Component. Adds behavior to an entity and allows for operations on a per frame basis. Override the init and update methods in derived classes Every runtime version of a component receives on construction the resource it was created from and the entity instance it belongs to.

Inheritance diagram for ComponentInstance:
Collaboration diagram for ComponentInstance:

Constructor & Destructor Documentation

◆ ComponentInstance()

ComponentInstance ( EntityInstance entity,
Component resource 


entityinstance the entity this component instance belongs to
resourcethe resource this component was created from

Member Function Documentation

◆ getComponent() [1/2]

nap::Component* getComponent ( ) const
the resource this component was created from

◆ getComponent() [2/2]

T * getComponent
the resource this component was created from as type T This will return a nullptr if the component is not derived from T

◆ getEntityInstance()

nap::EntityInstance* getEntityInstance ( ) const
the entity this component belongs to

◆ init() [1/2]

virtual bool init

Override this method to initialize the object after de-serialization. When called it is safe to assume that all dependencies have been resolved up to this point.

errorStateshould contain the error message when initialization fails.
if initialization succeeded or failed.

◆ init() [2/2]

virtual bool init ( utility::ErrorState errorState)

◆ update()

virtual void update ( double  deltaTime)

Update this component

deltaTimethe time in between cooks in seconds

Reimplemented in ParameterBlendComponentInstance, RotateComponentInstance, PythonScriptComponentInstance, PlaybackComponentInstance, FirstPersonControllerInstance, and CalendarComponentInstance.