GLTFState

package
v0.0.0-...-5dcec5f Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package GLTFState provides methods for working with GLTFState object instances.

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
	AsGLTFState() Instance
}

type BinaryHandler

type BinaryHandler int
const HandleBinaryDiscardTextures BinaryHandler = 0 //gd:GLTFState.HANDLE_BINARY_DISCARD_TEXTURES
const HandleBinaryEmbedAsBasisu BinaryHandler = 2 //gd:GLTFState.HANDLE_BINARY_EMBED_AS_BASISU
const HandleBinaryEmbedAsUncompressed BinaryHandler = 3 //gd:GLTFState.HANDLE_BINARY_EMBED_AS_UNCOMPRESSED
const HandleBinaryExtractTextures BinaryHandler = 1 //gd:GLTFState.HANDLE_BINARY_EXTRACT_TEXTURES

type Expanded

type Expanded [1]gdclass.GLTFState

func (Expanded) GetSceneNodePath

func (self Expanded) GetSceneNodePath(peer GLTFNode.Instance, handle_skeletons bool) string

Returns the [NodePath] that this GLTF node will have in the Godot scene tree after being imported. This is useful when importing glTF object model pointers with [GLTFObjectModelProperty], for handling extensions such as [code]KHR_animation_pointer[/code] or [code]KHR_interactivity[/code]. If [param handle_skeletons] is [code]true[/code], paths to skeleton bone glTF nodes will be resolved properly. For example, a path that would be [code]^"A/B/C/Bone1/Bone2/Bone3"[/code] if [code]false[/code] will become [code]^"A/B/C/Skeleton3D:Bone3"[/code].

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]) AsGLTFState

func (self *Extension[T]) AsGLTFState() 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

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

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.GLTFState

Contains all nodes and resources of a glTF file. This is used by [GLTFDocument] as data storage, which allows [GLTFDocument] and all [GLTFDocumentExtension] classes to remain stateless. GLTFState can be populated by [GLTFDocument] reading a file or by converting a Godot scene. Then the data can either be used to create a Godot scene or save to a glTF file. The code that converts to/from a Godot scene can be intercepted at arbitrary points by [GLTFDocumentExtension] classes. This allows for custom data to be stored in the glTF file or for custom data to be converted to/from Godot nodes.

var Nil Instance

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

func New

func New() Instance

func (Instance) Accessors

func (self Instance) Accessors() []GLTFAccessor.Instance

func (Instance) AddUsedExtension

func (self Instance) AddUsedExtension(extension_name string, required bool)

Appends an extension to the list of extensions used by this glTF file during serialization. If [param required] is [code]true[/code], the extension will also be added to the list of required extensions. Do not run this in [method GLTFDocumentExtension._export_post], as that stage is too late to add extensions. The final list is sorted alphabetically.

func (Instance) Animations

func (self Instance) Animations() []GLTFAnimation.Instance

func (Instance) AppendDataToBuffers

func (self Instance) AppendDataToBuffers(data []byte, deduplication bool) int

Appends the given byte array data to the buffers and creates a [GLTFBufferView] for it. The index of the destination [GLTFBufferView] is returned. If [param deduplication] is [code]true[/code], the buffers will first be searched for duplicate data, otherwise new bytes will always be appended.

func (Instance) AppendGltfNode

func (self Instance) AppendGltfNode(gltf_node GLTFNode.Instance, godot_scene_node Node.Instance, parent_node_index int) int

Append the given [GLTFNode] to the state, and return its new index. This can be used to export one Godot node as multiple glTF nodes, or inject new glTF nodes at import time. On import, this must be called before [method GLTFDocumentExtension._generate_scene_node] finishes for the parent node. On export, this must be called before [method GLTFDocumentExtension._export_node] runs for the parent node. The [param godot_scene_node] parameter is the Godot scene node that corresponds to this glTF node. This is highly recommended to be set to a valid node, but may be [code]null[/code] if there is no corresponding Godot scene node. One Godot scene node may be used for multiple glTF nodes, so if exporting multiple glTF nodes for one Godot scene node, use the same Godot scene node for each. The [param parent_node_index] parameter is the index of the parent [GLTFNode] in the state. If [code]-1[/code], the node will be a root node, otherwise the new node will be added to the parent's list of children. The index will also be written to the [member GLTFNode.parent] property of the new node.

func (Instance) AsGLTFState

func (self Instance) AsGLTFState() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) BakeFps

func (self Instance) BakeFps() Float.X

func (Instance) BasePath

func (self Instance) BasePath() string

func (Instance) BufferViews

func (self Instance) BufferViews() []GLTFBufferView.Instance

func (Instance) Buffers

func (self Instance) Buffers() [][]byte

func (Instance) Cameras

func (self Instance) Cameras() []GLTFCamera.Instance

func (Instance) Copyright

func (self Instance) Copyright() string

func (Instance) CreateAnimations

func (self Instance) CreateAnimations() bool

func (Instance) Filename

func (self Instance) Filename() string

func (Instance) GetAdditionalData

func (self Instance) GetAdditionalData(extension_name string) any

Gets additional arbitrary data in this [GLTFState] instance. This can be used to keep per-file state data in [GLTFDocumentExtension] classes, which is important because they are stateless. The argument should be the [GLTFDocumentExtension] name (does not have to match the extension name in the glTF file), and the return value can be anything you set. If nothing was set, the return value is [code]null[/code].

func (Instance) GetAnimationPlayer

func (self Instance) GetAnimationPlayer(idx int) AnimationPlayer.Instance

Returns the [AnimationPlayer] node with the given index. These nodes are only used during the export process when converting Godot [AnimationPlayer] nodes to glTF animations.

func (Instance) GetAnimationPlayersCount

func (self Instance) GetAnimationPlayersCount(idx int) int

Returns the number of [AnimationPlayer] nodes in this [GLTFState]. These nodes are only used during the export process when converting Godot [AnimationPlayer] nodes to glTF animations.

func (Instance) GetNodeIndex

func (self Instance) GetNodeIndex(scene_node Node.Instance) int

Returns the index of the [GLTFNode] corresponding to this Godot scene node. This is the inverse of [method get_scene_node]. Useful during the export process. [b]Note:[/b] Not every Godot scene node will have a corresponding [GLTFNode], and not every [GLTFNode] will have a scene node generated. If there is no [GLTFNode] index for this scene node, [code]-1[/code] is returned.

func (Instance) GetSceneNode

func (self Instance) GetSceneNode(idx int) Node.Instance

Returns the Godot scene node that corresponds to the same index as the [GLTFNode] it was generated from. This is the inverse of [method get_node_index]. Useful during the import process. [b]Note:[/b] Not every [GLTFNode] will have a scene node generated, and not every generated scene node will have a corresponding [GLTFNode]. If there is no scene node for this [GLTFNode] index, [code]null[/code] is returned.

func (Instance) GetSceneNodePath

func (self Instance) GetSceneNodePath(peer GLTFNode.Instance) string

Returns the [NodePath] that this GLTF node will have in the Godot scene tree after being imported. This is useful when importing glTF object model pointers with [GLTFObjectModelProperty], for handling extensions such as [code]KHR_animation_pointer[/code] or [code]KHR_interactivity[/code]. If [param handle_skeletons] is [code]true[/code], paths to skeleton bone glTF nodes will be resolved properly. For example, a path that would be [code]^"A/B/C/Bone1/Bone2/Bone3"[/code] if [code]false[/code] will become [code]^"A/B/C/Skeleton3D:Bone3"[/code].

func (Instance) GlbData

func (self Instance) GlbData() []byte

func (Instance) HandleBinaryImage

func (self Instance) HandleBinaryImage() BinaryHandler

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Images

func (self Instance) Images() []Texture2D.Instance

func (Instance) ImportAsSkeletonBones

func (self Instance) ImportAsSkeletonBones() bool

func (Instance) Json

func (self Instance) Json() map[any]any

func (Instance) Lights

func (self Instance) Lights() []GLTFLight.Instance

func (Instance) LoadBufferViewData

func (self Instance) LoadBufferViewData(peer GLTFBufferView.Instance) []byte

Loads the buffer view data from the buffer referenced by this buffer view in the given [GLTFState]. Interleaved data with a byte stride is not yet supported by this method. The data is returned as a [PackedByteArray].

func (Instance) MajorVersion

func (self Instance) MajorVersion() int

func (Instance) Materials

func (self Instance) Materials() []Material.Instance

func (Instance) Meshes

func (self Instance) Meshes() []GLTFMesh.Instance

func (Instance) MinorVersion

func (self Instance) MinorVersion() int

func (Instance) Nodes

func (self Instance) Nodes() []GLTFNode.Instance

func (Instance) RootNodes

func (self Instance) RootNodes() []int32

func (Instance) SceneName

func (self Instance) SceneName() string

func (Instance) SetAccessors

func (self Instance) SetAccessors(value []GLTFAccessor.Instance)

func (Instance) SetAdditionalData

func (self Instance) SetAdditionalData(extension_name string, additional_data any)

Sets additional arbitrary data in this [GLTFState] instance. This can be used to keep per-file state data in [GLTFDocumentExtension] classes, which is important because they are stateless. The first argument should be the [GLTFDocumentExtension] name (does not have to match the extension name in the glTF file), and the second argument can be anything you want.

func (Instance) SetAnimations

func (self Instance) SetAnimations(value []GLTFAnimation.Instance)

func (Instance) SetBakeFps

func (self Instance) SetBakeFps(value Float.X)

func (Instance) SetBasePath

func (self Instance) SetBasePath(value string)

func (Instance) SetBufferViews

func (self Instance) SetBufferViews(value []GLTFBufferView.Instance)

func (Instance) SetBuffers

func (self Instance) SetBuffers(value [][]byte)

func (Instance) SetCameras

func (self Instance) SetCameras(value []GLTFCamera.Instance)

func (Instance) SetCopyright

func (self Instance) SetCopyright(value string)

func (Instance) SetCreateAnimations

func (self Instance) SetCreateAnimations(value bool)

func (Instance) SetFilename

func (self Instance) SetFilename(value string)

func (Instance) SetGlbData

func (self Instance) SetGlbData(value []byte)

func (Instance) SetHandleBinaryImage

func (self Instance) SetHandleBinaryImage(value BinaryHandler)

func (Instance) SetImages

func (self Instance) SetImages(value []Texture2D.Instance)

func (Instance) SetImportAsSkeletonBones

func (self Instance) SetImportAsSkeletonBones(value bool)

func (Instance) SetJson

func (self Instance) SetJson(value map[any]any)

func (Instance) SetLights

func (self Instance) SetLights(value []GLTFLight.Instance)

func (Instance) SetMajorVersion

func (self Instance) SetMajorVersion(value int)

func (Instance) SetMaterials

func (self Instance) SetMaterials(value []Material.Instance)

func (Instance) SetMeshes

func (self Instance) SetMeshes(value []GLTFMesh.Instance)

func (Instance) SetMinorVersion

func (self Instance) SetMinorVersion(value int)

func (Instance) SetNodes

func (self Instance) SetNodes(value []GLTFNode.Instance)

func (*Instance) SetObject

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

func (Instance) SetRootNodes

func (self Instance) SetRootNodes(value []int32)

func (Instance) SetSceneName

func (self Instance) SetSceneName(value string)

func (Instance) SetSkeletons

func (self Instance) SetSkeletons(value []GLTFSkeleton.Instance)

func (Instance) SetSkins

func (self Instance) SetSkins(value []GLTFSkin.Instance)

func (Instance) SetTextureSamplers

func (self Instance) SetTextureSamplers(value []GLTFTextureSampler.Instance)

func (Instance) SetTextures

func (self Instance) SetTextures(value []GLTFTexture.Instance)

func (Instance) SetUniqueAnimationNames

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

func (Instance) SetUniqueNames

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

func (Instance) SetUseNamedSkinBinds

func (self Instance) SetUseNamedSkinBinds(value bool)

func (Instance) Skeletons

func (self Instance) Skeletons() []GLTFSkeleton.Instance

func (Instance) Skins

func (self Instance) Skins() []GLTFSkin.Instance

func (Instance) TextureSamplers

func (self Instance) TextureSamplers() []GLTFTextureSampler.Instance

func (Instance) Textures

func (self Instance) Textures() []GLTFTexture.Instance

func (Instance) UniqueAnimationNames

func (self Instance) UniqueAnimationNames() []string

func (Instance) UniqueNames

func (self Instance) UniqueNames() []string

func (Instance) UseNamedSkinBinds

func (self Instance) UseNamedSkinBinds() bool

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