Class GLTFObjectModelProperty
Describes how to access a property as defined in the glTF object model.
- Inheritance
-
GLTFObjectModelProperty
Remarks
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 json_pointers, while the Godot property it maps to is defined by node_paths. In most cases json_pointers and node_paths 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 object_model_type property defines the type of data stored in the glTF file as defined by the object model, see GLTFObjectModelType for possible values.
See Also
Properties
gltf_to_godot_expression
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.
var gltf_to_godot_expression : Expression
Property Value
Remarks
- void set_gltf_to_godot_expression(Expression value)
- Expression get_gltf_to_godot_expression
godot_to_gltf_expression
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.
var godot_to_gltf_expression : Expression
Property Value
Remarks
- void set_godot_to_gltf_expression(Expression value)
- Expression get_godot_to_gltf_expression
json_pointers
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.
var json_pointers : PackedStringArray[] = []
Property Value
- PackedStringArray[]
Remarks
- void set_json_pointers(PackedStringArray[] value)
- PackedStringArray[] get_json_pointers
node_paths
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 GLTFObjectModelProperty.append_path_to_property to add properties to this array.
In most cases node_paths 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.
var node_paths : NodePath[] = []
Property Value
- NodePath[]
Remarks
- void set_node_paths(NodePath[] value)
- NodePath[] get_node_paths
object_model_type
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 GLTFObjectModelType for possible values.
var object_model_type : int = 0
Property Value
Remarks
variant_type
The type of data stored in the Godot property. This is the type of the property that the node_paths point to.
var variant_type : int = 0
Property Value
Remarks
Methods
append_node_path(NodePath)
Appends a NodePath to node_paths. 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 GLTFObjectModelProperty.append_path_to_property for simple cases. Be sure to also call GLTFObjectModelProperty.set_types once (the order does not matter).
void append_node_path(NodePath node_path)
Parameters
node_path
NodePath
append_path_to_property(NodePath, StringName)
High-level wrapper over GLTFObjectModelProperty.append_node_path that handles the most common cases. It constructs a new NodePath using node_path
as a base and appends prop_name
to the subpath. Be sure to also call GLTFObjectModelProperty.set_types once (the order does not matter).
void append_path_to_property(NodePath node_path, StringName prop_name)
Parameters
node_path
NodePathprop_name
StringName
get_accessor_type
Qualifiers: const
The GLTF accessor type associated with this property's object_model_type. See accessor_type for possible values, and see GLTFObjectModelType for how the object model type maps to accessor types.
int get_accessor_type
has_json_pointers
Qualifiers: const
Returns true
if json_pointers 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.
bool has_json_pointers
has_node_paths
Qualifiers: const
Returns true
if node_paths 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.
bool has_node_paths
set_types(int, int)
Sets the variant_type and object_model_type 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.
void set_types(int variant_type, int obj_model_type)