Component

Inherited: Object

Description

The Component class is a base class for each aspect of the actor, and how it interacts with the world.

Note: This class must be a superclass only and shouldn’t be created manually.

Public Methods

Actor *

actor () const

Component *

component (const std::string type)

void

drawGizmos ()

void

drawGizmosSelected ()

bool

isEnabled () const

Scene *

scene () const

void

setEnabled (bool enabled)

std::string

tr (const std::string source)

Transform *

transform () const

Static Methods

None

Methods Description

:ref:`Actor<api_Actor>`* Component::actor () const

Returns an Actor which the Component is attached to.


:ref:`Component<api_Component>`* Component::component (std::string type)

Returns a component with type attached to the same Actor. If no such component with this type returns nullptr.


void Component::drawGizmos ()

Implement drawGizmos if you want to draw gizmos that are always drawn.


void Component::drawGizmosSelected ()

Implement drawGizmosSelected to draw a gizmo if the object is selected.


bool Component::isEnabled () const

Returns true if the component is enabled; otherwise returns false.


:ref:`Scene<api_Scene>`* Component::scene () const

Returns a Scene which the Component is attached to.


void Component::setEnabled (bool enabled)

Sets current state of component to enabled or disabled.

Note: The disabled component will be created but not affect the Actor. For example, MeshRender component will not draw a mesh.

See also isEnabled().


std::string Component::tr (std::string source)

Returns a translated version of source text; otherwise returns source text if no appropriate translated string is available.


:ref:`Transform<api_Transform>`* Component::transform () const

Returns a transform attached to this Actor.