This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Field Class

Describes the Field methods of the Entity.

The Field class implementation can found in the data/framework/game/fields.h file.

Field Class

Members


Field (variable instance)

Constructor. Creates a new Field class instance.

Arguments

  • variable instance - A user class instance with fields methods or a user class name.

int getSetterId ()

Returns a setter function ID.

Return value

ID of the setter function.

void setSetter (string func_name)

Sets a setter function.

Arguments

  • string func_name - Setter function name.

int getGetterId ()

Returns a getter function ID.

Return value

ID of the getter function.

void setGetter (string func_name)

Sets a getter function.

Arguments

  • string func_name - Getter function name.

string getGetterName ()

Returns a getter function name.

Return value

Getter function name.

string getSetterName ()

Returns a setter function name.

Return value

Setter function name.

string getName ()

Returns a field name.

Return value

Field name.

void setName (string name)

Sets a field name.

Arguments

  • string name - Field name.

int getType ()

Returns one of the FIELD_* types.

Return value

Field type.

void setType (int type)

Sets one of the FIELD_* types.

Arguments

  • int type - Field type.

string getClassName ()

Returns a field class name.

Return value

Field class name.

void setClassName (string name)

Sets a field class name.

Arguments

  • string name - Field class name.

int getNumSwitchItems ()

Returns the number of switch items in the Field.

Return value

Number of switch items. If the field type is not FIELD_SWITCH, then function returns 0.

string getSwitchItem (int i)

Returns a switch item name by its number.

Arguments

  • int i - Switch item number.

Return value

Switch item name. If the field type is not FIELD_SWITCH, then function returns an empty string ("").

void setSwitchItems (string items)

Sets switch items for the field.

Arguments

  • string items - Comma-separated switch items.

int getSwitchDefault ()

Returns the default switch value.

Return value

Default switch value.

void setSwitchDefault (int value)

Sets the default switch value.

Arguments

  • int value - Default switch value.

int FIELD_INT

Description

Integer field type.

int FIELD_FLOAT

Description

Float field type.

int FIELD_DOUBLE

Description

Double field type.

int FIELD_STRING

Description

String field type.

int FIELD_VEC3

Description

Vec3 field type.

int FIELD_VEC4

Description

Vec4 field type.

int FIELD_COLOR

Description

Color field type.

int FIELD_SWITCH

Description

Switch field type.

int FIELD_TOGGLE

Description

Toggle field type.
Last update: 2017-07-03
Build: ()