GLTFObjectModelProperty

package
v0.0.0-...-fe0704e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

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 GLTFObjectModelType for possible values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsGLTFObjectModelProperty() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsGLTFObjectModelProperty

func (self *Extension[T]) AsGLTFObjectModelProperty() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type GLTFObjectModelType

type GLTFObjectModelType int //gd:GLTFObjectModelProperty.GLTFObjectModelType
const (
	// Unknown or not set object model type. If the object model type is set to this value, the real type still needs to be determined.
	GltfObjectModelTypeUnknown GLTFObjectModelType = 0
	// Object model type "bool". Represented in the glTF JSON as a boolean, and encoded in a [GLTFAccessor] as "SCALAR". When encoded in an accessor, a value of 0 is false, and any other value is true.
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeBool GLTFObjectModelType = 1
	// Object model type "float". Represented in the glTF JSON as a number, and encoded in a [GLTFAccessor] as "SCALAR".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat GLTFObjectModelType = 2
	// Object model type "float[]". Represented in the glTF JSON as an array of numbers, and encoded in a [GLTFAccessor] as "SCALAR".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloatArray GLTFObjectModelType = 3
	// Object model type "float2". Represented in the glTF JSON as an array of two numbers, and encoded in a [GLTFAccessor] as "VEC2".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat2 GLTFObjectModelType = 4
	// Object model type "float3". Represented in the glTF JSON as an array of three numbers, and encoded in a [GLTFAccessor] as "VEC3".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat3 GLTFObjectModelType = 5
	// Object model type "float4". Represented in the glTF JSON as an array of four numbers, and encoded in a [GLTFAccessor] as "VEC4".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat4 GLTFObjectModelType = 6
	// Object model type "float2x2". Represented in the glTF JSON as an array of four numbers, and encoded in a [GLTFAccessor] as "MAT2".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat2x2 GLTFObjectModelType = 7
	// Object model type "float3x3". Represented in the glTF JSON as an array of nine numbers, and encoded in a [GLTFAccessor] as "MAT3".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat3x3 GLTFObjectModelType = 8
	// Object model type "float4x4". Represented in the glTF JSON as an array of sixteen numbers, and encoded in a [GLTFAccessor] as "MAT4".
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeFloat4x4 GLTFObjectModelType = 9
	// Object model type "int". Represented in the glTF JSON as a number, and encoded in a [GLTFAccessor] as "SCALAR". The range of values is limited to signed integers. For KHR_interactivity, only 32-bit integers are supported.
	//
	// [GLTFAccessor]: https://pkg.go.dev/graphics.gd/classdb/GLTFAccessor
	GltfObjectModelTypeInt GLTFObjectModelType = 10
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.GLTFObjectModelProperty

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AppendNodePath

func (self Instance) AppendNodePath(node_path string)

Appends a node path 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 for simple cases. Be sure to also call SetTypes once (the order does not matter).

func (Instance) AppendPathToProperty

func (self Instance) AppendPathToProperty(node_path string, prop_name string)

High-level wrapper over AppendNodePath that handles the most common cases. It constructs a new node path using 'node_path' as a base and appends 'prop_name' to the subpath. Be sure to also call SetTypes once (the order does not matter).

func (Instance) AsGLTFObjectModelProperty

func (self Instance) AsGLTFObjectModelProperty() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) GetAccessorType

func (self Instance) GetAccessorType() GLTFAccessor.GLTFAccessorType

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

func (Instance) GltfToGodotExpression

func (self Instance) GltfToGodotExpression() Expression.Instance

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.

func (Instance) GodotToGltfExpression

func (self Instance) GodotToGltfExpression() Expression.Instance

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.

func (Instance) HasJsonPointers

func (self Instance) HasJsonPointers() bool

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.

func (Instance) HasNodePaths

func (self Instance) HasNodePaths() bool

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.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) JsonPointers

func (self Instance) JsonPointers() [][]string

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 specific cases may require multiple pointers. The items are themselves arrays which represent the JSON pointer split into its components.

func (Instance) NodePaths

func (self Instance) NodePaths() []string

An array of node paths 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 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.

func (Instance) ObjectModelType

func (self Instance) ObjectModelType() GLTFObjectModelType

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.

func (Instance) SetGltfToGodotExpression

func (self Instance) SetGltfToGodotExpression(value Expression.Instance)

SetGltfToGodotExpression sets the property returned by [GetGltfToGodotExpression].

func (Instance) SetGodotToGltfExpression

func (self Instance) SetGodotToGltfExpression(value Expression.Instance)

SetGodotToGltfExpression sets the property returned by [GetGodotToGltfExpression].

func (Instance) SetJsonPointers

func (self Instance) SetJsonPointers(value [][]string)

SetJsonPointers sets the property returned by [GetJsonPointers].

func (Instance) SetNodePaths

func (self Instance) SetNodePaths(value []string)

SetNodePaths sets the property returned by [GetNodePaths].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetObjectModelType

func (self Instance) SetObjectModelType(value GLTFObjectModelType)

SetObjectModelType sets the property returned by [GetObjectModelType].

func (Instance) SetTypes

func (self Instance) SetTypes(variant_type variant.Type, obj_model_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.

func (Instance) SetVariantType

func (self Instance) SetVariantType(value variant.Type)

SetVariantType sets the property returned by [GetVariantType].

func (Instance) VariantType

func (self Instance) VariantType() variant.Type

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

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL