Documentation
¶
Overview ¶
Package GLTFState provides methods for working with GLTFState object instances.
Index ¶
- type Advanced
- type Any
- type BinaryHandler
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) Accessors() []GLTFAccessor.Instance
- func (self Instance) AddUsedExtension(extension_name string, required bool)
- func (self Instance) Animations() []GLTFAnimation.Instance
- func (self Instance) AppendDataToBuffers(data []byte, deduplication bool) int
- func (self Instance) AppendGltfNode(gltf_node GLTFNode.Instance, godot_scene_node Node.Instance, ...) int
- func (self Instance) AsGLTFState() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) BakeFps() Float.X
- func (self Instance) BasePath() string
- func (self Instance) BufferViews() []GLTFBufferView.Instance
- func (self Instance) Buffers() [][]byte
- func (self Instance) Cameras() []GLTFCamera.Instance
- func (self Instance) Copyright() string
- func (self Instance) CreateAnimations() bool
- func (self Instance) Filename() string
- func (self Instance) GetAdditionalData(extension_name string) any
- func (self Instance) GetAnimationPlayer(idx int) AnimationPlayer.Instance
- func (self Instance) GetAnimationPlayersCount(idx int) int
- func (self Instance) GetNodeIndex(scene_node Node.Instance) int
- func (self Instance) GetSceneNode(idx int) Node.Instance
- func (self Instance) GetSceneNodePath(peer GLTFNode.Instance) string
- func (self Instance) GlbData() []byte
- func (self Instance) HandleBinaryImage() BinaryHandler
- func (self Instance) ID() ID
- func (self Instance) Images() []Texture2D.Instance
- func (self Instance) ImportAsSkeletonBones() bool
- func (self Instance) Json() map[any]any
- func (self Instance) Lights() []GLTFLight.Instance
- func (self Instance) LoadBufferViewData(peer GLTFBufferView.Instance) []byte
- func (self Instance) MajorVersion() int
- func (self Instance) Materials() []Material.Instance
- func (self Instance) Meshes() []GLTFMesh.Instance
- func (self Instance) MinorVersion() int
- func (self Instance) Nodes() []GLTFNode.Instance
- func (self Instance) RootNodes() []int32
- func (self Instance) SceneName() string
- func (self Instance) SetAccessors(value []GLTFAccessor.Instance)
- func (self Instance) SetAdditionalData(extension_name string, additional_data any)
- func (self Instance) SetAnimations(value []GLTFAnimation.Instance)
- func (self Instance) SetBakeFps(value Float.X)
- func (self Instance) SetBasePath(value string)
- func (self Instance) SetBufferViews(value []GLTFBufferView.Instance)
- func (self Instance) SetBuffers(value [][]byte)
- func (self Instance) SetCameras(value []GLTFCamera.Instance)
- func (self Instance) SetCopyright(value string)
- func (self Instance) SetCreateAnimations(value bool)
- func (self Instance) SetFilename(value string)
- func (self Instance) SetGlbData(value []byte)
- func (self Instance) SetHandleBinaryImage(value BinaryHandler)
- func (self Instance) SetImages(value []Texture2D.Instance)
- func (self Instance) SetImportAsSkeletonBones(value bool)
- func (self Instance) SetJson(value map[any]any)
- func (self Instance) SetLights(value []GLTFLight.Instance)
- func (self Instance) SetMajorVersion(value int)
- func (self Instance) SetMaterials(value []Material.Instance)
- func (self Instance) SetMeshes(value []GLTFMesh.Instance)
- func (self Instance) SetMinorVersion(value int)
- func (self Instance) SetNodes(value []GLTFNode.Instance)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetRootNodes(value []int32)
- func (self Instance) SetSceneName(value string)
- func (self Instance) SetSkeletons(value []GLTFSkeleton.Instance)
- func (self Instance) SetSkins(value []GLTFSkin.Instance)
- func (self Instance) SetTextureSamplers(value []GLTFTextureSampler.Instance)
- func (self Instance) SetTextures(value []GLTFTexture.Instance)
- func (self Instance) SetUniqueAnimationNames(value []string)
- func (self Instance) SetUniqueNames(value []string)
- func (self Instance) SetUseNamedSkinBinds(value bool)
- func (self Instance) Skeletons() []GLTFSkeleton.Instance
- func (self Instance) Skins() []GLTFSkin.Instance
- func (self Instance) TextureSamplers() []GLTFTextureSampler.Instance
- func (self Instance) Textures() []GLTFTexture.Instance
- func (self Instance) UniqueAnimationNames() []string
- func (self Instance) UniqueNames() []string
- func (self Instance) UseNamedSkinBinds() bool
- func (self Instance) Virtual(name string) reflect.Value
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 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 ¶
func (Expanded) GetSceneNodePath ¶
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 ¶
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 (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type 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.
type Instance ¶
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 (Instance) Accessors ¶
func (self Instance) Accessors() []GLTFAccessor.Instance
func (Instance) AddUsedExtension ¶
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 ¶
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 (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) BufferViews ¶
func (self Instance) BufferViews() []GLTFBufferView.Instance
func (Instance) Cameras ¶
func (self Instance) Cameras() []GLTFCamera.Instance
func (Instance) CreateAnimations ¶
func (Instance) GetAdditionalData ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) HandleBinaryImage ¶
func (self Instance) HandleBinaryImage() BinaryHandler
func (Instance) ImportAsSkeletonBones ¶
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 (Instance) MinorVersion ¶
func (Instance) SetAccessors ¶
func (self Instance) SetAccessors(value []GLTFAccessor.Instance)
func (Instance) SetAdditionalData ¶
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 (Instance) SetBasePath ¶
func (Instance) SetBufferViews ¶
func (self Instance) SetBufferViews(value []GLTFBufferView.Instance)
func (Instance) SetBuffers ¶
func (Instance) SetCameras ¶
func (self Instance) SetCameras(value []GLTFCamera.Instance)
func (Instance) SetCopyright ¶
func (Instance) SetCreateAnimations ¶
func (Instance) SetFilename ¶
func (Instance) SetGlbData ¶
func (Instance) SetHandleBinaryImage ¶
func (self Instance) SetHandleBinaryImage(value BinaryHandler)
func (Instance) SetImportAsSkeletonBones ¶
func (Instance) SetMajorVersion ¶
func (Instance) SetMaterials ¶
func (Instance) SetMinorVersion ¶
func (Instance) SetRootNodes ¶
func (Instance) SetSceneName ¶
func (Instance) SetSkeletons ¶
func (self Instance) SetSkeletons(value []GLTFSkeleton.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 (Instance) SetUniqueNames ¶
func (Instance) SetUseNamedSkinBinds ¶
func (Instance) Skeletons ¶
func (self Instance) Skeletons() []GLTFSkeleton.Instance
func (Instance) TextureSamplers ¶
func (self Instance) TextureSamplers() []GLTFTextureSampler.Instance
func (Instance) Textures ¶
func (self Instance) Textures() []GLTFTexture.Instance