gdext.internal.register

Members list

Type members

Classlikes

final case class ClassDescriptor(className: String, parentClassName: String, factory: () => GodotScriptClass, overriddenVirtuals: Set[String], isRuntime: Boolean = ...)

Static description of one registered class: its Godot name, its parent engine class, the factory that builds a fresh Scala instance, and which engine virtuals the subclass overrides (by Godot method name, e.g. "_process").

Static description of one registered class: its Godot name, its parent engine class, the factory that builds a fresh Scala instance, and which engine virtuals the subclass overrides (by Godot method name, e.g. "_process").

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Registers a user-defined Scala class with Godot's ClassDB.

Registers a user-defined Scala class with Godot's ClassDB.

This is the explicit builder substrate the macro layer (and hand-written code) targets. It fills a GDExtensionClassCreationInfo4 with static trampolines — the GDExtension callbacks cannot capture closures — that defer all per-class/per-instance behaviour to ClassRegistry via integer tokens (see Tokens).

Lifecycle wired here:

  • create: construct the parent engine object, build the Scala instance, link them with object_set_instance, and return the engine handle.
  • free: drop the Scala instance from the registry.
  • get_virtual: report which engine virtuals (_ready/_process/ _physics_process) the subclass overrides, handing Godot the matching static dispatcher.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ClassRegistry

Process-global registry backing the static GDExtension class callbacks.

Process-global registry backing the static GDExtension class callbacks.

GDExtension callbacks are C function pointers and cannot capture Scala closures, so all per-class and per-instance state lives here and is reached from the static trampolines via opaque tokens:

  • class token: a small integer passed to Godot as class_userdata. The create/get-virtual callbacks use it to find the ClassDescriptor.
  • instance token: a small integer handed to object_set_instance as the instance pointer. The free/virtual-call callbacks use it to find the live GodotScriptClass.

Using integer tokens (rather than raw object addresses) keeps the GC from ever seeing a disguised pointer to a managed object — the Scala instances are held alive by strong references in instances until explicitly freed.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object CompEnum

Enumeration helpers + the AsRef projection. Each helper takes the comp already projected to its bare wrapper type E and returns the option names; a null/unassigned comp yields Seq("") so the resulting ENUM has a single valid empty entry rather than a malformed empty hint string.

Enumeration helpers + the AsRef projection. Each helper takes the comp already projected to its bare wrapper type E and returns the option names; a null/unassigned comp yields Seq("") so the resulting ENUM has a single valid empty entry rather than a malformed empty hint string.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
CompEnum.type

Runtime backing for the component-reference dropdown annotations (exportBoneName / exportAnimation / exportSpriteAnimation / exportAnimationProperty).

Runtime backing for the component-reference dropdown annotations (exportBoneName / exportAnimation / exportSpriteAnimation / exportAnimationProperty).

The Register macro registers, for each annotated String property, a builder closure keyed by (className, propName). The closure reads the sibling comp's current value off the live instance and enumerates the option names. At inspect time ClassRegistration's validate_property trampoline looks the builder up and rewrites the property to an ENUM with those options.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait DefaultValue[A]

The "zero value" for an exportable type — what a registered class's constructor parameter is initialised to when the user does not write an explicit default. Godot constructs instances with no arguments, so every primary-ctor param needs some value; this typeclass supplies the natural empty/null one per type, so a game class can declare

The "zero value" for an exportable type — what a registered class's constructor parameter is initialised to when the user does not write an explicit default. Godot constructs instances with no arguments, so every primary-ctor param needs some value; this typeclass supplies the natural empty/null one per type, so a game class can declare

 final class Player(var projectile: Projectile) extends Node2D 

with no = null. The @gdexport macro's instance factory summons a DefaultValue[A] for any param lacking a user default (see Register.scala); an explicit = ... always takes precedence. Mirrors the supported export types in ExportType / RefLeaf.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object DefaultValue

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
final case class ExportHint(hint: Int, hintString: String = ..., usageExtra: Int = ...)

An inspector hint override for an exported property — the analogue of GDScript's @export_range, @export_file, @export_multiline, … . Passed as the argument to gdexport (@gdexport(ExportHint.range(0, 100)) var hp: Int).

An inspector hint override for an exported property — the analogue of GDScript's @export_range, @export_file, @export_multiline, … . Passed as the argument to gdexport (@gdexport(ExportHint.range(0, 100)) var hp: Int).

It overrides the hint / hint_string an ExportType would otherwise emit and ORs usageExtra into the property usage. The value is plain runtime data; the Register macro just forwards it into PropertyRegistration.registerExport.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ExportHint

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ExportHint.type
trait ExportType[A]

The single seam the @gdexport macro summons. Bundles Variant marshalling with the inspector metadata (hint / hint_string / class_name / usage) for one exportable field type. Per-type logic therefore lives in ordinary givens here (not in the macro); the macro only reads the field type, summons ExportType[A], and wires the get/set lambdas.

The single seam the @gdexport macro summons. Bundles Variant marshalling with the inspector metadata (hint / hint_string / class_name / usage) for one exportable field type. Per-type logic therefore lives in ordinary givens here (not in the macro); the macro only reads the field type, summons ExportType[A], and wires the get/set lambdas.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ExportType

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ExportType.type
abstract class GodotScriptClass

Root base for everything in the engine class hierarchy.

Root base for everything in the engine class hierarchy.

Generated engine classes extend this (transitively via Object), and user classes extend an engine class (class Player extends Node2D). It carries the engine-object handle every instance is backed by, the lifetime operations (free/unref/reference/cast), the overridable engine virtuals, and the small plumbing the generated wrappers and registration use.

Since every wrapper IS a handle-carrying object, there is no separate smart pointer: you hold an engine object as its plain wrapper type (Node2D, PlayerStats) and call these methods directly on it. A null reference is the absent / failed-cast sentinel.

Two ways an instance gets its handle:

  • a user class is constructed by Godot via the create callback, which calls setHostObject;
  • a wrapper around a fetched object (e.g. from a ClassMeta.fromHandle or a singleton) is built then handed a handle via withHost.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Object
class AudioServer
class CameraServer
class ClassDB
class EditorPaths
class Engine
class Geometry2D
class Geometry3D
class IP
class Input
class InputMap
class JNISingleton
class JSONRPC
class MainLoop
class SceneTree
class Marshalls
class MovieWriter
class NativeMenu
class Node
class CanvasItem
class Control
class BaseButton
class Button
class CheckBox
class CheckButton
class MenuButton
class OptionButton
class LinkButton
class ColorRect
class Container
class BoxContainer
class ColorPicker
class GraphElement
class GraphFrame
class GraphNode
class EditorDock
class ScriptEditor
class TabContainer
class GraphEdit
class ItemList
class Label
class LineEdit
class MenuBar
class Panel
class Range
class ProgressBar
class ScrollBar
class HScrollBar
class VScrollBar
class Slider
class HSlider
class VSlider
class SpinBox
class Separator
class HSeparator
class VSeparator
class TabBar
class TextEdit
class CodeEdit
class TextureRect
class Tree
class Node2D
class Bone2D
class Camera2D
class CanvasGroup
class Area2D
class RigidBody2D
class StaticBody2D
class Joint2D
class PinJoint2D
class Light2D
class PointLight2D
class Line2D
class Marker2D
class Parallax2D
class Path2D
class PathFollow2D
class Polygon2D
class RayCast2D
class ShapeCast2D
class Skeleton2D
class Sprite2D
class TileMap
class TileMapLayer
class CanvasLayer
class EditorPlugin
class HTTPRequest
class MissingNode
class Node3D
class Camera3D
class XRCamera3D
class Area3D
class RigidBody3D
class StaticBody3D
class GridMap
class Joint3D
class HingeJoint3D
class PinJoint3D
class Marker3D
class OpenXRHand
class Path3D
class PathFollow3D
class RayCast3D
class ShapeCast3D
class Skeleton3D
class IKModifier3D
class ChainIK3D
class IterateIK3D
class CCDIK3D
class FABRIK3D
class JacobianIK3D
class SplineIK3D
class TwoBoneIK3D
class SkeletonIK3D
class SpringArm3D
class Decal
class FogVolume
class CSGShape3D
class CSGBox3D
class CSGMesh3D
class CSGPolygon3D
class CSGSphere3D
class CSGTorus3D
class Label3D
class SoftBody3D
class SpriteBase3D
class Sprite3D
class Light3D
class OmniLight3D
class SpotLight3D
class LightmapGI
class VoxelGI
class XRNode3D
class XRAnchor3D
class XROrigin3D
class Timer
class Viewport
class SubViewport
class Window
class AcceptDialog
class FileDialog
class Popup
class PopupMenu
class PopupPanel
class OS
class Performance
class RefCounted
class AESContext
class AStar2D
class AStar3D
class AStarGrid2D
class AudioSample
class CameraFeed
class ConfigFile
class Crypto
class DTLSServer
class DirAccess
class EditorScript
class Expression
class FileAccess
class HMACContext
class HTTPClient
class JavaClass
class JavaObject
class Lightmapper
class Logger
class MeshDataTool
class Mutex
class Node3DGizmo
class PCKPacker
class PacketPeer
class RDUniform
class RegEx
class RegExMatch
class Resource
class Animation
class AudioEffect
class AudioStream
class BitMap
class BoneMap
class ButtonGroup
class ColorPalette
class Compositor
class CryptoKey
class Curve
class Curve2D
class Curve3D
class Environment
class Font
class FontFile
class SystemFont
class GDExtension
class GLTFAccessor
class GLTFCamera
class GLTFDocument
class FBXDocument
class GLTFLight
class GLTFMesh
class GLTFNode
class GLTFSkeleton
class GLTFSkin
class GLTFState
class FBXState
class GLTFTexture
class Gradient
class Image
class ImporterMesh
class InputEvent
class JSON
class Material
class FogMaterial
class Mesh
class ArrayMesh
class BoxMesh
class CapsuleMesh
class CylinderMesh
class PlaneMesh
class QuadMesh
class PointMesh
class PrismMesh
class SphereMesh
class TextMesh
class TorusMesh
class MeshLibrary
class MultiMesh
class Noise
class Occluder3D
class OpenXRAction
class PackedScene
class RDShaderFile
class Script
class GDScript
class Shader
class VisualShader
class Shape2D
class Shape3D
class BoxShape3D
class Shortcut
class Skin
class Sky
class SpriteFrames
class StyleBox
class StyleBoxFlat
class StyleBoxLine
class Texture
class Texture2D
class AtlasTexture
class CurveTexture
class DPITexture
class ImageTexture
class MeshTexture
class Texture2DRD
class Texture3D
class Texture3DRD
class Cubemap
class CubemapArray
class Theme
class TileSet
class Translation
class VideoStream
class VoxelGIData
class World2D
class World3D
class SceneState
class Semaphore
class SocketServer
class TCPServer
class UDSServer
class StreamPeer
class SurfaceTool
class TLSOptions
class TextLine
class TextServer
class Thread
class TriangleMesh
class Tween
class Tweener
class UDPServer
class UPNP
class UPNPDevice
class WeakRef
class XMLParser
class XRInterface
class XRPose
class XRTracker
class ZIPPacker
class ZIPReader
class RenderData
class RenderDataRD
class ResourceUID
class ThemeDB
class TileData
class Time
class TreeItem
class UndoRedo
class XRServer
class XRVRS
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Registers Scala methods on a registered class so they are callable from GDScript / the engine (the #[func] analogue), and provides the getter/ setter methods that property (@export) registration links together.

Registers Scala methods on a registered class so they are callable from GDScript / the engine (the #[func] analogue), and provides the getter/ setter methods that property (@export) registration links together.

Dispatch goes through the Variant call_func path: the trampoline finds the instance and the method dispatcher by their tokens, then invokes the dispatcher with the raw argument Variants and the return Variant slot. A dispatcher reads its args via the Phase 1 FromVariant seam and writes its result via ToVariant. All argument/return marshalling reuses that seam, so any builtin-convertible type is supported.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object PropertyHint

Godot PropertyHint values (subset we emit), pinned from extension_api.json global_enums for Godot 4.6.1. The inspector uses these (with hint_string) to choose the editing widget for an exported property.

Godot PropertyHint values (subset we emit), pinned from extension_api.json global_enums for Godot 4.6.1. The inspector uses these (with hint_string) to choose the editing widget for an exported property.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Registers an @export-style property on a registered class.

Registers an @export-style property on a registered class.

Godot models a property as a name plus a setter and getter method (by name). So this registers a set_<name> and get_<name> method pair (via MethodRegistration) and then links them with classdb_register_extension_class_property. The property then appears in the inspector and is readable/writable from GDScript.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object PropertyUsage

Godot PropertyUsageFlags (subset).

Godot PropertyUsageFlags (subset).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait RefLeaf[A]

A reference "leaf": how a node/resource/scene wrapper marshals to/from a raw engine handle, plus its inspector hint metadata. ExportType derives the Option/Required/bare variants from this. The givens live here (RefLeaf's companion) so implicit search for RefLeaf[Tres[T]] etc. finds them.

A reference "leaf": how a node/resource/scene wrapper marshals to/from a raw engine handle, plus its inspector hint metadata. ExportType derives the Option/Required/bare variants from this. The givens live here (RefLeaf's companion) so implicit search for RefLeaf[Tres[T]] etc. finds them.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object RefLeaf

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
RefLeaf.type
object Register

Automatic, annotation-driven class registration — the gdext #[derive(GodotClass)] analogue.

Automatic, annotation-driven class registration — the gdext #[derive(GodotClass)] analogue.

Register.auto[Player]() scans Player at compile time and emits all the registration calls: the class itself (Godot base derived from the superclass, with auto-detected virtual overrides), every @func method, every @gdexport property, and every @signal. Game code therefore writes zero registration boilerplate — it only extends an engine class and annotates members.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Register.type

Records, per (className, propertyName), the required scene root node type of a Tscn[T] export. Godot has no native hint to filter a PackedScene picker by root-node type, so the editor inspector plugin (Phase E) reads this registry to know which scenes a given property may accept.

Records, per (className, propertyName), the required scene root node type of a Tscn[T] export. Godot has no native hint to filter a PackedScene picker by root-node type, so the editor inspector plugin (Phase E) reads this registry to know which scenes a given property may accept.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Registers signals on a registered class and emits them.

Registers signals on a registered class and emits them.

Registration uses classdb_register_extension_class_signal. Emission goes through Object.emit_signal, which is a vararg method, so it uses the Variant call path (object_method_bind_call) with the signal name as the first Variant argument followed by the signal's payload Variants.

This first cut covers the most common case — a no-argument signal — which is enough to prove registration + connect + emit end to end. Adding typed payload arguments is a matter of extending the argument-info array and the emit arg list.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Tokens

Encodes the small integer tokens that ClassRegistry hands to Godot as opaque CVoidPtrs (class_userdata, instance pointer) and back.

Encodes the small integer tokens that ClassRegistry hands to Godot as opaque CVoidPtrs (class_userdata, instance pointer) and back.

We deliberately stuff an integer id into the pointer slot rather than a real Scala-object address: the Scala objects are kept alive by the registry, and the GC never has to chase a fabricated pointer. Conversion is via the Scala Native intrinsics for raw-pointer/word casts.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Tokens.type
trait VariantTypeOf[A]

Maps a Scala type to its Godot Variant type tag, for registration info.

Maps a Scala type to its Godot Variant type tag, for registration info.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object VariantTypeOf

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type