Table of Contents

Class GltfObjectModelProperty

Namespace
Godot
Assembly
GodotSharp.dll

GLTFObjectModelProperty defines a mapping between a property in the glTF object model and a NodePath in the Godot scene tree. This can be used to animate properties in a glTF file using the KHR_animation_pointer extension, or to access them through an engine-agnostic script such as a behavior graph as defined by the KHR_interactivity extension.

The glTF property is identified by JSON pointer(s) stored in JsonPointers, while the Godot property it maps to is defined by NodePaths. In most cases JsonPointers and NodePaths will each only have one item, but in some cases a single glTF JSON pointer will map to multiple Godot properties, or a single Godot property will be mapped to multiple glTF JSON pointers, or it might be a many-to-many relationship.

Expression objects can be used to define conversions between the data, such as when glTF defines an angle in radians and Godot uses degrees. The ObjectModelType property defines the type of data stored in the glTF file as defined by the object model, see GltfObjectModelProperty.GltfObjectModelType for possible values.

[GodotClassName("GLTFObjectModelProperty")]
public class GltfObjectModelProperty : RefCounted, IDisposable
Inheritance
GltfObjectModelProperty
Implements
Inherited Members

Constructors

GltfObjectModelProperty()

public GltfObjectModelProperty()

Properties

GltfToGodotExpression

If set, this Expression will be used to convert the property value from the glTF object model to the value expected by the Godot property. This is useful when the glTF object model uses a different unit system, or when the data needs to be transformed in some way. If null, the value will be copied as-is.

public Expression GltfToGodotExpression { get; set; }

Property Value

Expression

GodotToGltfExpression

If set, this Expression will be used to convert the property value from the Godot property to the value expected by the glTF object model. This is useful when the glTF object model uses a different unit system, or when the data needs to be transformed in some way. If null, the value will be copied as-is.

public Expression GodotToGltfExpression { get; set; }

Property Value

Expression

JsonPointers

The glTF object model JSON pointers used to identify the property in the glTF object model. In most cases, there will be only one item in this array, but niche cases may require multiple pointers. The items are themselves arrays which represent the JSON pointer split into its components.

public Array<string[]> JsonPointers { get; set; }

Property Value

Array<string[]>

NodePaths

An array of NodePaths that point to a property, or multiple properties, in the Godot scene tree. On import, this will either be set by GltfDocument, or by a GltfDocumentExtension class. For simple cases, use AppendPathToProperty(NodePath, StringName) to add properties to this array.

In most cases NodePaths will only have one item, but in some cases a single glTF JSON pointer will map to multiple Godot properties. For example, a GltfCamera or GltfLight used on multiple glTF nodes will be represented by multiple Godot nodes.

public Array<NodePath> NodePaths { get; set; }

Property Value

Array<NodePath>

ObjectModelType

The type of data stored in the glTF file as defined by the object model. This is a superset of the available accessor types, and determines the accessor type. See GltfObjectModelProperty.GltfObjectModelType for possible values.

public GltfObjectModelProperty.GltfObjectModelType ObjectModelType { get; set; }

Property Value

GltfObjectModelProperty.GltfObjectModelType

VariantType

The type of data stored in the Godot property. This is the type of the property that the NodePaths point to.

public Variant.Type VariantType { get; set; }

Property Value

Variant.Type

Methods

AppendNodePath(NodePath)

Appends a NodePath to NodePaths. This can be used by GltfDocumentExtension classes to define how a glTF object model property maps to a Godot property, or multiple Godot properties. Prefer using AppendPathToProperty(NodePath, StringName) for simple cases. Be sure to also call SetTypes(Type, GltfObjectModelType) once (the order does not matter).

public void AppendNodePath(NodePath nodePath)

Parameters

nodePath NodePath

AppendPathToProperty(NodePath, StringName)

High-level wrapper over AppendNodePath(NodePath) that handles the most common cases. It constructs a new NodePath using nodePath as a base and appends propName to the subpath. Be sure to also call SetTypes(Type, GltfObjectModelType) once (the order does not matter).

public void AppendPathToProperty(NodePath nodePath, StringName propName)

Parameters

nodePath NodePath
propName StringName

GetAccessorType()

The GLTF accessor type associated with this property's ObjectModelType. See AccessorType for possible values, and see GltfObjectModelProperty.GltfObjectModelType for how the object model type maps to accessor types.

public GltfAccessor.GltfAccessorType GetAccessorType()

Returns

GltfAccessor.GltfAccessorType

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

HasJsonPointers()

Returns true if JsonPointers is not empty. This is used during export to determine if a GltfObjectModelProperty can handle converting a Godot property to a glTF object model property.

public bool HasJsonPointers()

Returns

bool

HasNodePaths()

Returns true if NodePaths is not empty. This is used during import to determine if a GltfObjectModelProperty can handle converting a glTF object model property to a Godot property.

public bool HasNodePaths()

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

SetTypes(Type, GltfObjectModelType)

Sets the VariantType and ObjectModelType properties. This is a convenience method to set both properties at once, since they are almost always known at the same time. This method should be called once. Calling it again with the same values will have no effect.

public void SetTypes(Variant.Type variantType, GltfObjectModelProperty.GltfObjectModelType objModelType)

Parameters

variantType Variant.Type
objModelType GltfObjectModelProperty.GltfObjectModelType