GODOT_PROPERTY

Usage

GODOT_PROPERTY();
int some_property = 0;

Mark the following field as an exposed property. The field type must be a Godot Variant compatible type.

Binding custom or computed properties is done by providing the property as well as getter and setter names within the attribute arguments.

GODOT_PROPERTY("property", GetSet("get_property", "set_property"));
int get_property() const;
void set_property(const int& p_value);

You can also define the name of the property as a string literal when using auto generated getters and setters if your property name should differ from the backing fields name.

GODOT_PROPERTY("exposed_name");
int internal_name = 0;

You can emit signals on property change by using additional generator options.

GODOT_PROPERTY(EmitChanged()); // create signal emitted_changed()
int emitted = 0;

GODOT_PROPERTY(EmitChangedValue()); // create signal emitted_changed(int emitted)
int emitted = 0;

GODOT_PROPERTY(EmitChanged("changed")); // do not create signal, emit changed()
int emitted = 0;

GODOT_PROPERTY(EmitChangedValue("changed")); // do not create signal, emit changed(int value)
int emitted = 0;

Available Parameter Types

GOC_CustomPropertyGetSet

The parameter is used to provide the getters and setters used with the property attribute it is defined in.

The following values are available:

Value

Description

AutoGetSet

Auto generate the getters and setters used for this property. This is the default value.

GetSet

Used to provide the getter and setter function names to be used by this property.

GOC_PropertyGetAccessSpecifier

This parameter type is used to set the generated getters access specifier within the GODOT_PROPERTY macro parameters.

The following values are available:

Value

Description

PrivateGet

Make the generated getter for this property private within the extension.

ProtectedGet

Make the generated getter for this property protected within the extension.

PublicGet

Make the generated getter for this property public within the extension.

GOC_PropertySetAccessSpecifier

This parameter type is used to set the generated setters access specifier within the GODOT_PROPERTY macro parameters.

The following values are available:

Value

Description

PrivateSet

Make the generated setter for this property private within the extension.

ProtectedSet

Make the generated setter for this property protected within the extension.

PublicSet

Make the generated setter for this property public within the extension.

GOC_PropertyGeneratorOptions

Additional options.

The following values are available:

Value

Description

PropertyGeneratorOptionsDefault

No additional generator options. This is the default value.

EmitChanged

Emit signal with no arguments identified by the provided name when this property is changed. If no name is provided, a signal named “<property_name>_changed” is bound.

EmitChangedValue

Emit signal with the properties new value identified by the provided name when this property is changed. If no name is provided, a signal named “<property_name>_changed” is bound.

GOC_VariantType

This parameter type is used to set the properties variant type within the GODOT_PROPERTY macros parameters. This should be added automatically in all cases.

The following values are available:

Value

Description

VariantTypeNil

No documentation available

VariantTypeBool

No documentation available

VariantTypeInt

No documentation available

VariantTypeFloat

No documentation available

VariantTypeString

No documentation available

VariantTypeVector2

No documentation available

VariantTypeVector2i

No documentation available

VariantTypeRect2

No documentation available

VariantTypeRect2i

No documentation available

VariantTypeVector3

No documentation available

VariantTypeVector3i

No documentation available

VariantTypeTransform2d

No documentation available

VariantTypeVector4

No documentation available

VariantTypeVector4i

No documentation available

VariantTypePlane

No documentation available

VariantTypeQuaternion

No documentation available

VariantTypeAabb

No documentation available

VariantTypeBasis

No documentation available

VariantTypeTransform3d

No documentation available

VariantTypeProjection

No documentation available

VariantTypeColor

No documentation available

VariantTypeStringName

No documentation available

VariantTypeNodePath

No documentation available

VariantTypeRid

No documentation available

VariantTypeObject

No documentation available

VariantTypeCallable

No documentation available

VariantTypeSignal

No documentation available

VariantTypeDictionary

No documentation available

VariantTypeArray

No documentation available

VariantTypePackedByteArray

No documentation available

VariantTypePackedInt32Array

No documentation available

VariantTypePackedInt64Array

No documentation available

VariantTypePackedFloat32Array

No documentation available

VariantTypePackedFloat64Array

No documentation available

VariantTypePackedStringArray

No documentation available

VariantTypePackedVector2Array

No documentation available

VariantTypePackedVector3Array

No documentation available

VariantTypePackedColorArray

No documentation available

VariantTypePackedVector4Array

No documentation available

VariantTypeMax

No documentation available

GOC_PropertyHint

This parameter type is used to set the properties hint and hint string within the GODOT_PROPERTY macro parameters.

The following values are available:

Value

Description

HintNone

No documentation available

HintRange

No documentation available

HintEnum

No documentation available

HintEnumSuggestion

No documentation available

HintExpEasing

No documentation available

HintLink

No documentation available

HintFlags

No documentation available

HintLayers2dRender

No documentation available

HintLayers2dPhysics

No documentation available

HintLayers2dNavigation

No documentation available

HintLayers3dRender

No documentation available

HintLayers3dPhysics

No documentation available

HintLayers3dNavigation

No documentation available

HintLayersAvoidance

No documentation available

HintFile

No documentation available

HintDir

No documentation available

HintGlobalFile

No documentation available

HintGlobalDir

No documentation available

HintResourceType

No documentation available

HintMultilineText

No documentation available

HintExpression

No documentation available

HintPlaceholderText

No documentation available

HintColorNoAlpha

No documentation available

HintObjectId

No documentation available

HintTypeString

No documentation available

HintNodePathToEditedNode

No documentation available

HintObjectTooBig

No documentation available

HintNodePathValidTypes

No documentation available

HintSaveFile

No documentation available

HintGlobalSaveFile

No documentation available

HintIntIsObjectid

No documentation available

HintIntIsPointer

No documentation available

HintArrayType

No documentation available

HintDictionaryType

No documentation available

HintLocaleId

No documentation available

HintLocalizableString

No documentation available

HintNodeType

No documentation available

HintHideQuaternionEdit

No documentation available

HintPassword

No documentation available

HintToolButton

No documentation available

HintOneshot

No documentation available

HintMax

No documentation available

GOC_PropertyUsageFlags

This parameter type is used to set the property usage flags within the GODOT_PROPERTY macro parameters.

The following values are available:

Value

Description

UsageNone

No documentation available

UsageStorage

No documentation available

UsageEditor

No documentation available

UsageInternal

No documentation available

UsageCheckable

No documentation available

UsageChecked

No documentation available

UsageGroup

No documentation available

UsageCategory

No documentation available

UsageSubgroup

No documentation available

UsageClassIsBitfield

No documentation available

UsageNoInstanceState

No documentation available

UsageRestartIfChanged

No documentation available

UsageScriptVariable

No documentation available

UsageStoreIfNull

No documentation available

UsageUpdateAllIfModified

No documentation available

UsageScriptDefaultValue

No documentation available

UsageClassIsEnum

No documentation available

UsageNilIsVariant

No documentation available

UsageArray

No documentation available

UsageAlwaysDuplicate

No documentation available

UsageNeverDuplicate

No documentation available

UsageHighEndGfx

No documentation available

UsageNodePathFromSceneRoot

No documentation available

UsageResourceNotPersistent

No documentation available

UsageKeyingIncrements

No documentation available

UsageDeferredSetResource

No documentation available

UsageEditorInstantiateObject

No documentation available

UsageEditorBasicSetting

No documentation available

UsageReadOnly

No documentation available

UsageSecret

No documentation available

UsageDefault

No documentation available

UsageNoEditor

No documentation available