This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Initial commit: character project with Live2D Cubism + Godot miniview

Godot 4.5 project with gd_cubism addon for Live2D model rendering,
openvt integration scripts, and GDExtension test probes.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>

author
nandi
co-author
Letta Code
date (May 25, 2026, 9:10 PM -0700) commit 33c95550
+17460
+13
.gitignore
··· 1 + node_modules 2 + .env 3 + .env.* 4 + .tmp 5 + .DS_Store 6 + .devenv 7 + bin/*.zip 8 + bin/Godot_* 9 + vendor/cubism-sdk-native-*/ 10 + vendor/CubismSdkForNative-*.zip 11 + vendor/open-vt 12 + *.log 13 + .sconsign.dblite
+47
.letta/.lettaignore
··· 1 + # .lettaignore — Letta Code file index exclusions 2 + # 3 + # Files and directories matching these patterns are excluded from the @ file 4 + # search index and disk scan fallback. Comment out or remove a line to bring 5 + # it back into search results. Add new patterns to exclude more. 6 + # 7 + # Syntax: one pattern per line, supports globs (e.g. *.log, src/generated/**) 8 + # Lines starting with # are comments. 9 + # 10 + # --- Dependency directories --- 11 + node_modules 12 + bower_components 13 + vendor 14 + 15 + # --- Build outputs --- 16 + dist 17 + build 18 + out 19 + coverage 20 + target 21 + .next 22 + .nuxt 23 + 24 + # --- Python --- 25 + venv 26 + .venv 27 + __pycache__ 28 + .tox 29 + 30 + # --- Version control & tooling --- 31 + .git 32 + .cache 33 + .letta 34 + 35 + # --- Lock files --- 36 + package-lock.json 37 + yarn.lock 38 + pnpm-lock.yaml 39 + poetry.lock 40 + Cargo.lock 41 + 42 + # --- Logs --- 43 + *.log 44 + 45 + # --- OS artifacts --- 46 + .DS_Store 47 + Thumbs.db
+13
.letta/settings.local.json
··· 1 + { 2 + "lastAgent": "agent-bc21f9dc-83b1-4826-b9af-999f7c6b6053", 3 + "sessionsByServer": { 4 + "api.letta.com": { 5 + "agentId": "agent-bc21f9dc-83b1-4826-b9af-999f7c6b6053", 6 + "conversationId": "conv-9c23aca6-982b-497e-9fd3-c8b95fe448fa" 7 + } 8 + }, 9 + "lastSession": { 10 + "agentId": "agent-bc21f9dc-83b1-4826-b9af-999f7c6b6053", 11 + "conversationId": "conv-9c23aca6-982b-497e-9fd3-c8b95fe448fa" 12 + } 13 + }
+68
README.md
··· 1 + # character 2 + 3 + CLI-first prototype for a headless chat-reactive VTuber that connects to stream.place. 4 + 5 + ## Goal 6 + 7 + Take chat messages from stream.place, generate spoken replies, and drive a VTuber/avatar output stream with: 8 + 9 + - chat intake 10 + - LLM response generation 11 + - TTS audio output 12 + - avatar motion/expression events 13 + - video/audio composition suitable for live streaming 14 + 15 + ## Architecture sketch 16 + 17 + ```text 18 + stream.place chat (Jetstream / ATProto) 19 + -> bot runtime 20 + -> reply planner 21 + -> TTS provider 22 + -> avatar controller 23 + -> ffmpeg compositor / scene renderer 24 + -> WHIP/RTMP uplink 25 + ``` 26 + 27 + ## Current direction 28 + 29 + This repo starts with a headless-friendly prototype: 30 + 31 + - TypeScript runtime via bun 32 + - stream.place chat adapter stub 33 + - Gemini Live-compatible TTS/voice adapter interface 34 + - avatar event bus for motion/expression cues 35 + - local dev scripts for simulation and testing 36 + 37 + ## Open questions 38 + 39 + - best headless avatar renderer on Linux 40 + - whether to use browser-based canvas capture or native renderer 41 + - whether Gemini Live should handle both reply generation and speech output 42 + - whether stream.place posting should use ATProto OAuth directly or a simpler bot identity path 43 + 44 + ## OpenVT path 45 + 46 + This repo now includes a simple OpenVT-oriented setup path: 47 + 48 + - `scripts/openvt-setup.sh` clones upstream OpenVT and initializes submodules 49 + - `docs/openvt-setup.md` explains the constraints and manual steps 50 + - `scripts/openvt-run-notes.sh` prints the expected local streaming workflow 51 + 52 + Run: 53 + 54 + ```bash 55 + chmod +x scripts/openvt-setup.sh scripts/openvt-run-notes.sh 56 + ./scripts/openvt-setup.sh 57 + ./scripts/openvt-run-notes.sh 58 + ``` 59 + 60 + ## Wayland / WayVNC launch 61 + 62 + If the machine already has a remote Wayland session, launch OpenVT into that session with: 63 + 64 + ```bash 65 + devenv shell -- ./scripts/openvt-wayland-launch.sh 66 + ``` 67 + 68 + See `docs/wayvnc-openvt.md`.
+65
devenv.lock
··· 1 + { 2 + "nodes": { 3 + "devenv": { 4 + "locked": { 5 + "dir": "src/modules", 6 + "lastModified": 1779749056, 7 + "narHash": "sha256-AtocdrunzuxTvSDn+82RntEhrs6TicM6Z4/zNQS9KKg=", 8 + "owner": "cachix", 9 + "repo": "devenv", 10 + "rev": "099ac65fcef79e88127bdc06adbd1ea94255274a", 11 + "type": "github" 12 + }, 13 + "original": { 14 + "dir": "src/modules", 15 + "owner": "cachix", 16 + "repo": "devenv", 17 + "type": "github" 18 + } 19 + }, 20 + "nixpkgs": { 21 + "inputs": { 22 + "nixpkgs-src": "nixpkgs-src" 23 + }, 24 + "locked": { 25 + "lastModified": 1778507786, 26 + "narHash": "sha256-HzSQCKMsMr8r55LwM1JuzIOB+8bzk0FEv6sItKvsfoY=", 27 + "owner": "cachix", 28 + "repo": "devenv-nixpkgs", 29 + "rev": "8f24a228a782e24576b155d1e39f0d914b380691", 30 + "type": "github" 31 + }, 32 + "original": { 33 + "owner": "cachix", 34 + "ref": "rolling", 35 + "repo": "devenv-nixpkgs", 36 + "type": "github" 37 + } 38 + }, 39 + "nixpkgs-src": { 40 + "flake": false, 41 + "locked": { 42 + "lastModified": 1778274207, 43 + "narHash": "sha256-I4puXmX1iovcCHZlRmztO3vW0mAbbRvq4F8wgIMQ1MM=", 44 + "owner": "NixOS", 45 + "repo": "nixpkgs", 46 + "rev": "b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7", 47 + "type": "github" 48 + }, 49 + "original": { 50 + "owner": "NixOS", 51 + "ref": "nixpkgs-unstable", 52 + "repo": "nixpkgs", 53 + "type": "github" 54 + } 55 + }, 56 + "root": { 57 + "inputs": { 58 + "devenv": "devenv", 59 + "nixpkgs": "nixpkgs" 60 + } 61 + } 62 + }, 63 + "root": "root", 64 + "version": 7 65 + }
+38
devenv.nix
··· 1 + { pkgs, ... }: 2 + { 3 + env = { 4 + LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.lib.makeLibraryPath [ pkgs.libxkbcommon pkgs.wayland pkgs.libGL pkgs.vulkan-loader pkgs.alsa-lib pkgs.pulseaudio pkgs.udev ]}:$LD_LIBRARY_PATH"; 5 + DRI_PRIME = "1"; 6 + }; 7 + 8 + languages.javascript = { 9 + enable = true; 10 + bun.enable = true; 11 + }; 12 + 13 + packages = with pkgs; [ 14 + ffmpeg 15 + jq 16 + git 17 + curl 18 + godot_4 19 + obs-studio 20 + python311 21 + python311Packages.virtualenv 22 + python313 23 + python313Packages.pip 24 + scons 25 + pkg-config 26 + rustc 27 + cargo 28 + rustup 29 + systemd.dev 30 + pkgsCross.mingwW64.stdenv.cc 31 + ]; 32 + 33 + enterShell = '' 34 + echo "character dev env" 35 + echo "- bun available" 36 + echo "- ffmpeg available" 37 + ''; 38 + }
+81
docs/architecture.md
··· 1 + # Headless VTuber architecture notes 2 + 3 + ## Recommended first build 4 + 5 + Use a split architecture: 6 + 7 + 1. Chat/runtime process on the headless machine 8 + 2. Avatar renderer as either: 9 + - a headless browser scene with sprite layers and viseme/expression animation, or 10 + - a Linux-native VTuber renderer if one exposes remote control hooks 11 + 3. ffmpeg composition and push to stream.place via WHIP or RTMP 12 + 13 + ## Why not start with a full Live2D rig? 14 + 15 + Live2D-on-Linux headless is possible but likely slows iteration. First prove: 16 + 17 + - incoming chat 18 + - generated reply 19 + - synthesized audio 20 + - deterministic motion/expression events 21 + - continuous video stream 22 + 23 + Then swap the renderer. 24 + 25 + ## Recommended prototype phases 26 + 27 + ### Phase 1 28 + 29 + - simulate stream.place chat locally 30 + - generate reply text 31 + - synthesize or stub audio 32 + - emit avatar actions like `talk:start`, `emotion:happy`, `head:nod` 33 + - render a simple animated scene to a test stream or file 34 + 35 + ### Phase 2 36 + 37 + - connect real stream.place chat feed 38 + - post replies back to chat 39 + - map reply prosody/emotion to avatar events 40 + 41 + ### Phase 3 42 + 43 + - replace simple avatar scene with a real VTuber rig 44 + - add interrupt handling, queueing, moderation, and pacing 45 + 46 + ## Candidate render paths 47 + 48 + ### Path A: Browser/canvas renderer 49 + 50 + Pros: 51 + 52 + - easiest to automate from CLI 53 + - easy websocket control 54 + - easy capture with Chromium or ffmpeg from a virtual display 55 + - good enough for a first expressive avatar 56 + 57 + Cons: 58 + 59 + - not a full Live2D rig 60 + 61 + ### Path B: OpenVT or custom Godot scene 62 + 63 + Pros: 64 + 65 + - closer to real VTuber motion 66 + - Linux-native 67 + 68 + Cons: 69 + 70 + - more integration work 71 + - remote-control API may need custom glue 72 + 73 + ### Path C: OBS scene graph on another machine 74 + 75 + Pros: 76 + 77 + - simplest if final stream production happens elsewhere 78 + 79 + Cons: 80 + 81 + - not fully headless/self-contained
+22
docs/miniview.md
··· 1 + # Minimal Cubism Viewer 2 + 3 + This bypasses the broken OpenVT studio shell and runs the upstream `gd_cubism` demo viewer against the Haru sample model. 4 + 5 + ## Launch 6 + 7 + ```bash 8 + cd /home/nandi/code/character 9 + devenv shell -- ./scripts/miniview-launch.sh 10 + ``` 11 + 12 + ## What it does 13 + 14 + - opens a tiny Godot project in `miniview/` 15 + - copies the upstream `gd_cubism` demo addon into the mini project 16 + - copies the built linux addon binary and Cubism core `.so` 17 + - copies the Haru sample model into the demo viewer's expected search path 18 + - launches the upstream demo viewer scene 19 + 20 + ## Purpose 21 + 22 + This is the shortest path to answer the real question: can this machine/session render a Live2D Cubism model at all using the addon author's own demo path?
+72
docs/openvt-setup.md
··· 1 + # OpenVT streaming setup 2 + 3 + This setup is for a simple Linux-first OpenVT pipeline that is ready to render a model window for capture/streaming. 4 + 5 + ## Reality check 6 + 7 + OpenVT is not a trivial single-binary install: 8 + 9 + - it is built in Godot 10 + - it uses third-party dependencies and submodules 11 + - full Live2D functionality depends on proprietary Live2D Cubism components 12 + - for face tracking, OpenSeeFace is a separate executable 13 + 14 + So the first goal here is not full unattended bot control. The first goal is a reproducible local setup path that gets OpenVT rendering and capturable for streaming. 15 + 16 + ## Recommended first streaming path 17 + 18 + 1. Run OpenVT locally on Linux 19 + 2. Load a compatible model 20 + 3. Use transparent window capture in OBS 21 + 4. Stream from OBS to stream.place via WHIP/RTMP 22 + 5. Add bot/chat/TTS control afterward 23 + 24 + ## Requirements 25 + 26 + - Godot 4.6+ according to the project docs 27 + - OpenVT source tree 28 + - built third-party dependencies 29 + - optional: OpenSeeFace for webcam tracking 30 + - optional: OBS for local production 31 + 32 + ## Local build notes for this repo 33 + 34 + This repo includes a helper for building as far as possible in a Nix/dev shell environment: 35 + 36 + ```bash 37 + devenv shell -- ./scripts/openvt-build-local.sh 38 + ``` 39 + 40 + It works around some upstream assumptions: 41 + 42 + - upstream expects `pyenv` 43 + - upstream tries to `pip install` tools globally 44 + - upstream keylogger build wants Rust targets and `libudev` 45 + 46 + This still does not bypass the Cubism SDK requirement. 47 + 48 + ## Notes from upstream docs 49 + 50 + - OpenVT focuses on Linux availability 51 + - supported trackers: OpenSeeFace and VTubeStudio mobile TCP over Wi-Fi 52 + - transparent window support is one of its key streaming features 53 + - hotkey capture on Linux may require the `input` group 54 + 55 + ## Hotkey note 56 + 57 + If OpenVT hotkeys do not work under Linux while unfocused, upstream says you may need: 58 + 59 + ```bash 60 + sudo -g input -u "$USER" open_vt.x86_64 61 + ``` 62 + 63 + Or to permanently add the user to the `input` group. 64 + 65 + ## Next integration step 66 + 67 + Once OpenVT is rendering reliably, we can layer on: 68 + 69 + - chat-triggered expressions 70 + - TTS-driven mouth movement heuristics 71 + - stream.place chat read/write 72 + - autonomous reply logic
+24
docs/test-cubism.md
··· 1 + # Cubism Test Harness 2 + 3 + Run: 4 + 5 + ```bash 6 + cd /home/nandi/code/character 7 + devenv shell -- ./scripts/test-cubism.sh 8 + ``` 9 + 10 + What it checks: 11 + 12 + - `gd_cubism.gdextension` exists 13 + - addon binaries exist 14 + - `ldd` resolves shared library dependencies 15 + - Haru model file exists 16 + - Godot probe project reports whether: 17 + - `GDCubismUserModel` class is registered 18 + - `GDCubismModelLoader` class is registered 19 + - class instantiation works 20 + - model initializes after assigning `assets` 21 + 22 + Probe output lines start with: 23 + 24 + - `PROBE key=value`
+49
docs/wayvnc-openvt.md
··· 1 + # OpenVT with WayVNC / existing Wayland session 2 + 3 + This setup should use the already-running sway/Wayland session instead of fake headless rendering. 4 + 5 + ## What we found 6 + 7 + - sway is running 8 + - a Wayland socket exists at `/run/user/1000/wayland-1` 9 + - current shell is not inside that graphical environment by default 10 + - `wayvnc.service` is currently inactive and had previously exited when the compositor went away 11 + 12 + ## Launch strategy 13 + 14 + Run OpenVT inside the existing Wayland session environment: 15 + 16 + ```bash 17 + devenv shell -- ./scripts/openvt-wayland-launch.sh 18 + ``` 19 + 20 + The launcher defaults to: 21 + 22 + - `XDG_RUNTIME_DIR=/run/user/$(id -u)` 23 + - `WAYLAND_DISPLAY=wayland-1` 24 + 25 + Override if needed: 26 + 27 + ```bash 28 + XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1 devenv shell -- ./scripts/openvt-wayland-launch.sh 29 + ``` 30 + 31 + ## Notes 32 + 33 + - This is not true graphics-headless. It uses the existing remote Wayland desktop session. 34 + - If OpenVT starts but a plugin complains, the remaining likely issue is the optional keylogger plugin. 35 + - If the project window appears over WayVNC, we are on the right path. 36 + 37 + ## Current addon state 38 + 39 + Built: 40 + 41 + - `addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so` 42 + - `addons/gd_cubism/bin/linux/x86_64/libLive2DCubismCore.so` 43 + - `addons/gd-virtualcamera/linux/libgd-virtualcamera.linux.template_debug.x86_64.so` 44 + 45 + Not fully built: 46 + 47 + - `addons/keylogger` native library 48 + 49 + That means global hotkeys may not work yet, but model rendering may still be usable.
+2
miniview/addons/gd_cubism/bin/.gitignore
··· 1 + * 2 + !.gitignore
+52
miniview/addons/gd_cubism/cs/gd_cubism_effect_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismEffectCS : Node 10 + { 11 + private static readonly StringName NativeName = "GDCubismEffect"; 12 + 13 + protected Node InternalObject = null; 14 + 15 + public GDCubismEffectCS() 16 + { 17 + this.InternalObject = (SubViewport)Godot.ClassDB.Instantiate(NativeName); 18 + } 19 + 20 + public GDCubismEffectCS(Node o) 21 + { 22 + this.InternalObject = o; 23 + } 24 + 25 + public Node GetInternalObject() 26 + { 27 + return this.InternalObject; 28 + } 29 + 30 + public void Attach(Node o) 31 + { 32 + this.InternalObject = o; 33 + } 34 + 35 + public Node Detach() 36 + { 37 + Node o = this.InternalObject; 38 + this.InternalObject = null; 39 + return o; 40 + } 41 + 42 + // ------------------------------------------------------------ Property(s) 43 + 44 + public bool Active 45 + { 46 + set { this.InternalObject.Call("set_active", (bool)value); } 47 + get { return (bool)this.InternalObject.Call("get_active"); } 48 + } 49 + 50 + // -------------------------------------------------------------- Method(s) 51 + // -------------------------------------------------------------- Signal(s) 52 + }
+108
miniview/addons/gd_cubism/cs/gd_cubism_effect_custom_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using Godot.NativeInterop; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectCustomCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectCustom"; 13 + 14 + public GDCubismEffectCustomCS(Node o) : base(o) { } 15 + 16 + public static readonly StringName CubismEpilogueName = "cubism_epilogue"; 17 + public static readonly StringName CubismInitName = "cubism_init"; 18 + public static readonly StringName CubismProcessName = "cubism_process"; 19 + public static readonly StringName CubismPrologueName = "cubism_prologue"; 20 + public static readonly StringName CubismTermName = "cubism_term"; 21 + 22 + // ------------------------------------------------------------ Property(s) 23 + // -------------------------------------------------------------- Method(s) 24 + // -------------------------------------------------------------- Signal(s) 25 + 26 + public delegate void CubismEpilogueEventHandler(Node2D value, double delta); 27 + 28 + private static void CubismEpilogueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 29 + { 30 + ((CubismEpilogueEventHandler)delegateObj)( 31 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 32 + VariantUtils.ConvertToFloat32(args[1]) 33 + ); 34 + ret = default; 35 + } 36 + 37 + public unsafe event CubismEpilogueEventHandler CubismEpilogue 38 + { 39 + add => this.InternalObject.Connect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline)); 40 + remove => this.InternalObject.Disconnect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline)); 41 + } 42 + 43 + public delegate void CubismInitEventHandler(Node2D value); 44 + 45 + private static void CubismInitrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 46 + { 47 + ((CubismInitEventHandler)delegateObj)( 48 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D 49 + ); 50 + ret = default; 51 + } 52 + 53 + public unsafe event CubismInitEventHandler CubismInit 54 + { 55 + add => this.InternalObject.Connect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline)); 56 + remove => this.InternalObject.Disconnect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline)); 57 + } 58 + 59 + public delegate void CubsimPrologueEventHandler(Node2D value, double delta); 60 + 61 + private static void CubismPrologueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 62 + { 63 + ((CubsimPrologueEventHandler)delegateObj)( 64 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 65 + VariantUtils.ConvertToFloat32(args[1]) 66 + ); 67 + ret = default; 68 + } 69 + 70 + public unsafe event CubsimPrologueEventHandler CubismPrologue 71 + { 72 + add => this.InternalObject.Connect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline)); 73 + remove => this.InternalObject.Disconnect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline)); 74 + } 75 + 76 + public delegate void CubismProcessEventHandler(Node2D value, double delta); 77 + 78 + private static void CubismProcessTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 79 + { 80 + ((CubismProcessEventHandler)delegateObj)( 81 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 82 + VariantUtils.ConvertToFloat32(args[1]) 83 + ); 84 + ret = default; 85 + } 86 + 87 + public unsafe event CubismProcessEventHandler CubismProcess 88 + { 89 + add => this.InternalObject.Connect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline)); 90 + remove => this.InternalObject.Disconnect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline)); 91 + } 92 + 93 + public delegate void CubismTermEventHandler(Node2D value); 94 + 95 + private static void CubismTermrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 96 + { 97 + ((CubismTermEventHandler)delegateObj)( 98 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D 99 + ); 100 + ret = default; 101 + } 102 + 103 + public unsafe event CubismTermEventHandler CubismTerm 104 + { 105 + add => this.InternalObject.Connect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline)); 106 + remove => this.InternalObject.Disconnect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline)); 107 + } 108 + }
+42
miniview/addons/gd_cubism/cs/gd_cubism_effect_hit_area_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectHitAreaCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectHitArea"; 13 + 14 + public GDCubismEffectHitAreaCS(Node o) : base(o) { } 15 + 16 + // ------------------------------------------------------------ Property(s) 17 + 18 + public bool Monitoring 19 + { 20 + set { this.InternalObject.Call("set_monitoring", (bool)value); } 21 + get { return (bool)this.InternalObject.Call("set_monitoring"); } 22 + } 23 + 24 + // -------------------------------------------------------------- Method(s) 25 + 26 + public void SetTarget(Vector2 v) 27 + { 28 + this.InternalObject.Call("set_target", v); 29 + } 30 + 31 + public Vector2 GetTarget() 32 + { 33 + return (Vector2)this.InternalObject.Call("get_target"); 34 + } 35 + 36 + public Godot.Collections.Dictionary GetDetail(GDCubismUserModelCS model, String id) 37 + { 38 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_detail", model.GetInternalObject(), id); 39 + } 40 + 41 + // -------------------------------------------------------------- Signal(s) 42 + }
+85
miniview/addons/gd_cubism/cs/gd_cubism_effect_target_point_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectTargetPointCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectTargetPoint"; 13 + 14 + public GDCubismEffectTargetPointCS(Node o) : base(o) { } 15 + 16 + // ------------------------------------------------------------ Property(s) 17 + 18 + public String HeadAngleX 19 + { 20 + set { this.InternalObject.Call("set_head_angle_x", (String)value); } 21 + get { return (String)this.InternalObject.Call("get_head_angle_x"); } 22 + } 23 + 24 + public String HeadAngleY 25 + { 26 + set { this.InternalObject.Call("set_head_angle_y", (String)value); } 27 + get { return (String)this.InternalObject.Call("get_head_angle_y"); } 28 + } 29 + 30 + public String HeadAngleZ 31 + { 32 + set { this.InternalObject.Call("set_head_angle_z", (String)value); } 33 + get { return (String)this.InternalObject.Call("get_head_angle_z"); } 34 + } 35 + 36 + public float HeadRange 37 + { 38 + set { this.InternalObject.Call("set_head_range", (float)value); } 39 + get { return (float)this.InternalObject.Call("get_head_range"); } 40 + } 41 + 42 + public String BodyAngleX 43 + { 44 + set { this.InternalObject.Call("set_body_angle_x", (String)value); } 45 + get { return (String)this.InternalObject.Call("get_body_angle_x"); } 46 + } 47 + 48 + public float BodyRange 49 + { 50 + set { this.InternalObject.Call("set_body_range", (float)value); } 51 + get { return (float)this.InternalObject.Call("get_body_range"); } 52 + } 53 + 54 + public String EyesAngleX 55 + { 56 + set { this.InternalObject.Call("set_eyes_angle_x", (String)value); } 57 + get { return (String)this.InternalObject.Call("get_eyes_angle_x"); } 58 + } 59 + 60 + public String EyesAngleY 61 + { 62 + set { this.InternalObject.Call("set_eyes_angle_y", (String)value); } 63 + get { return (String)this.InternalObject.Call("get_eyes_angle_y"); } 64 + } 65 + 66 + public float EyesRange 67 + { 68 + set { this.InternalObject.Call("set_eyes_range", (float)value); } 69 + get { return (float)this.InternalObject.Call("get_eyes_range"); } 70 + } 71 + 72 + // -------------------------------------------------------------- Method(s) 73 + 74 + public void SetTarget(Vector2 v) 75 + { 76 + this.InternalObject.Call("set_target", v); 77 + } 78 + 79 + public Vector2 GetTarget() 80 + { 81 + return (Vector2)this.InternalObject.Call("get_target"); 82 + } 83 + 84 + // -------------------------------------------------------------- Signal(s) 85 + }
+34
miniview/addons/gd_cubism/cs/gd_cubism_parameter_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismParameterCS : GDCubismValueAbsCS 10 + { 11 + // private static readonly StringName NativeName = "GDCubismParameter"; 12 + 13 + public GDCubismParameterCS(GodotObject o) : base(o) { } 14 + 15 + // ------------------------------------------------------------ Property(s) 16 + 17 + public float DefaultValue 18 + { 19 + get { return (float)this.InternalObject.Call("get_default_value"); } 20 + } 21 + 22 + public float MaximumValue 23 + { 24 + get { return (float)this.InternalObject.Call("get_maximum_value"); } 25 + } 26 + 27 + public float MinimumValue 28 + { 29 + get { return (float)this.InternalObject.Call("get_minimum_value"); } 30 + } 31 + 32 + // -------------------------------------------------------------- Method(s) 33 + // -------------------------------------------------------------- Signal(s) 34 + }
+18
miniview/addons/gd_cubism/cs/gd_cubism_part_opacity_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismPartOpacityCS : GDCubismValueAbsCS 10 + { 11 + // private static readonly StringName NativeName = "GDCubismPartOpacity"; 12 + 13 + public GDCubismPartOpacityCS(GodotObject o) : base(o) { } 14 + 15 + // ------------------------------------------------------------ Property(s) 16 + // -------------------------------------------------------------- Method(s) 17 + // -------------------------------------------------------------- Signal(s) 18 + }
+510
miniview/addons/gd_cubism/cs/gd_cubism_user_model_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + using Godot.NativeInterop; 6 + 7 + 8 + #pragma warning disable CA1050 9 + 10 + 11 + public partial class GDCubismUserModelCS : GodotObject 12 + { 13 + public enum Moc3FileFormatVersionEnum : long 14 + { 15 + /// <summary>Unknown or failed to load.</summary> 16 + CSM_MOC_VERSION_UNKNOWN = 0, 17 + /// <summary>moc3 file version 3.0.00 - 3.2.07</summary> 18 + CSM_MOC_VERSION_30 = 1, 19 + /// <summary>moc3 file version 3.3.00 - 3.3.03</summary> 20 + CSM_MOC_VERSION_33 = 2, 21 + /// <summary>moc3 file version 4.0.00 - 4.1.05</summary> 22 + CSM_MOC_VERSION_40 = 3, 23 + /// <summary>moc3 file version 4.2.00 - 4.2.02</summary> 24 + CSM_MOC_VERSION_42 = 4, 25 + /// <summary>moc3 file version 5.0.00 -</summary> 26 + CSM_MOC_VERSION_50 = 5 27 + } 28 + 29 + public enum PriorityEnum : long 30 + { 31 + PriorityNone = 0, 32 + PriorityIdle = 1, 33 + PriorityNormal = 2, 34 + PriorityForce = 3 35 + } 36 + 37 + public enum ParameterModeEnum : long 38 + { 39 + FullParameter = 0, 40 + NoneParameter = 1 41 + } 42 + 43 + public enum MotionProcessCallbackEnum : long 44 + { 45 + /// <summary> 46 + /// The animation update process is performed within the <c>_physics_process</c> function. 47 + /// This is used when you want to interact with physical simulations. 48 + /// </summary> 49 + Physics = 0, 50 + /// <summary> 51 + /// The animation update process is performed within the _process function. 52 + /// </summary> 53 + Idle = 1, 54 + /// <summary> 55 + /// No animation update process is performed. Use the <c>advance</c> function to process the animation. 56 + /// </summary> 57 + Manual = 2 58 + } 59 + 60 + private static readonly StringName NativeName = "GDCubismUserModel"; 61 + public static readonly StringName MotionEventName = "motion_event"; 62 + public static readonly StringName MotionFinishedName = "motion_finished"; 63 + 64 + protected Node2D InternalObject = null; 65 + 66 + public GDCubismUserModelCS() 67 + { 68 + this.InternalObject = (Node2D)Godot.ClassDB.Instantiate(NativeName); 69 + } 70 + 71 + public GDCubismUserModelCS(Node2D o) 72 + { 73 + this.InternalObject = o; 74 + } 75 + 76 + public Node2D GetInternalObject() 77 + { 78 + return this.InternalObject; 79 + } 80 + 81 + public void Attach(Node2D o) 82 + { 83 + this.InternalObject = o; 84 + } 85 + 86 + public Node2D Detach() 87 + { 88 + Node2D o = this.InternalObject; 89 + this.InternalObject = null; 90 + return o; 91 + } 92 + 93 + // ------------------------------------------------------------ Property(s) 94 + 95 + /// <value> 96 + /// Property <c>Assets</c> 97 + /// <br /> 98 + /// You can load a Live2D model by specifying a file with the *.model3.json extension. 99 + /// The file is loaded immediately upon specification. 100 + /// <br /> 101 + /// if you want to switch the Live2D model, you can do so simply by specifying a new file. 102 + /// </value> 103 + public String Assets 104 + { 105 + set { this.InternalObject.Call("set_assets", value); } 106 + get { return (String)this.InternalObject.Call("get_assets"); } 107 + } 108 + 109 + /// <value> 110 + /// Property <c>LoadExpressions</c> 111 + /// <br /> 112 + /// If set to <c>false</c>, it will not load _Expressions_ when loading the Live2D Model. 113 + /// </value> 114 + public bool LoadExpressions 115 + { 116 + set { this.InternalObject.Call("set_load_expressions", value); } 117 + get { return (bool)this.InternalObject.Call("get_load_expressions"); } 118 + } 119 + 120 + /// <value> 121 + /// Property <c>LoadMotions</c> 122 + /// <br /> 123 + /// If set to <c>false</c>, it will not load _Motions_ when loading the Live2D Model. 124 + /// </value> 125 + public bool LoadMotions 126 + { 127 + set { this.InternalObject.Call("set_load_motions", value); } 128 + get { return (bool)this.InternalObject.Call("get_load_motions"); } 129 + } 130 + 131 + /// <value> 132 + /// Property <c>MaskViewportSize</c> 133 + /// <br /> 134 + /// Specify the maximum resolution for any individual mask required for the Live2D model. 135 + /// <br /> 136 + /// If set to 0, size of the mask will be relative to the source pixel resolution of the model's canvas. 137 + /// <br /> 138 + /// Mask resolution is also dynamically resized relative to the model's scale within its viewport. 139 + /// <br /> 140 + /// <br /> 141 + /// Reducing the resolution can help conserve GPU memory, however reducing resolution too far can cause visual issues where masks are applied. 142 + /// <br /> 143 + /// For many, it's best to leave this at default and rely solely on the automatic scaling. 144 + /// </value> 145 + public int MaskViewportSize 146 + { 147 + set { this.InternalObject.Call("set_mask_viewport_size", value); } 148 + get { return (int)this.InternalObject.Call("get_mask_viewport_size"); } 149 + } 150 + 151 + /// <value> 152 + /// Property <c>ParameterMode</c> 153 + /// <br /> 154 + /// Specifies the control method for the currently held Live2D model. 155 + /// </value> 156 + public ParameterModeEnum ParameterMode 157 + { 158 + set { this.InternalObject.Call("set_parameter_mode", (int)value); } 159 + get 160 + { 161 + int value = (int)this.InternalObject.Call("get_parameter_mode"); 162 + return (ParameterModeEnum)Enum.ToObject(typeof(ParameterModeEnum), value); 163 + } 164 + } 165 + 166 + /// <value> 167 + /// Property <c>PhysicsEvaluate</c> 168 + /// <br /> 169 + /// Setting this parameter to `false` disables physical calculations. 170 + /// </value> 171 + public bool PhysicsEvaluate 172 + { 173 + set { this.InternalObject.Call("set_physics_evaluate", value); } 174 + get { return (bool)this.InternalObject.Call("get_physics_evaluate"); } 175 + } 176 + 177 + /// <value> 178 + /// Property <c>PlaybackProcessMode</c> 179 + /// <br /> 180 + /// Specifies the playback method for the currently held Live2D model. 181 + /// </value> 182 + public MotionProcessCallbackEnum PlaybackProcessMode 183 + { 184 + set { this.InternalObject.Call("set_process_callback", (int)value); } 185 + get 186 + { 187 + int value = (int)this.InternalObject.Call("get_process_callback"); 188 + return (MotionProcessCallbackEnum)Enum.ToObject(typeof(MotionProcessCallbackEnum), value); 189 + } 190 + } 191 + 192 + /// <value> 193 + /// Property <c>PoseUpdate</c> 194 + /// <br /> 195 + /// Setting this parameter to `false` disables transparency calculations between drawing parts specified in the pose group. 196 + /// If you want to manually handle all transparency calculations, set this parameter to `false`. 197 + /// </value> 198 + public bool PoseUpdate 199 + { 200 + set { this.InternalObject.Call("set_pose_update", value); } 201 + get { return (bool)this.InternalObject.Call("get_pose_update"); } 202 + } 203 + 204 + public Shader ShaderAdd 205 + { 206 + set { this.InternalObject.Call("set_shader_add", (Shader)value); } 207 + get { return (Shader)this.InternalObject.Call("get_shader_add"); } 208 + } 209 + 210 + public Shader ShaderMix 211 + { 212 + set { this.InternalObject.Call("set_shader_mix", (Shader)value); } 213 + get { return (Shader)this.InternalObject.Call("get_shader_mix"); } 214 + } 215 + 216 + public Shader ShaderMul 217 + { 218 + set { this.InternalObject.Call("set_shader_mul", (Shader)value); } 219 + get { return (Shader)this.InternalObject.Call("get_shader_mul"); } 220 + } 221 + 222 + public Shader ShaderMask 223 + { 224 + set { this.InternalObject.Call("set_shader_mask", (Shader)value); } 225 + get { return (Shader)this.InternalObject.Call("get_shader_mask"); } 226 + } 227 + 228 + public Shader ShaderMaskAdd 229 + { 230 + set { this.InternalObject.Call("set_shader_mask_add", (Shader)value); } 231 + get { return (Shader)this.InternalObject.Call("get_shader_mask_add"); } 232 + } 233 + 234 + public Shader ShaderMaskAddInv 235 + { 236 + set { this.InternalObject.Call("set_shader_mask_add_inv", (Shader)value); } 237 + get { return (Shader)this.InternalObject.Call("get_shader_mask_add_inv"); } 238 + } 239 + 240 + public Shader ShaderMaskMix 241 + { 242 + set { this.InternalObject.Call("set_shader_mask_mix", (Shader)value); } 243 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mix"); } 244 + } 245 + 246 + public Shader ShaderMaskMixInv 247 + { 248 + set { this.InternalObject.Call("set_shader_mask_mix_inv", (Shader)value); } 249 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mix_inv"); } 250 + } 251 + 252 + public Shader ShaderMaskMul 253 + { 254 + set { this.InternalObject.Call("set_shader_mask_mul", (Shader)value); } 255 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mul"); } 256 + } 257 + 258 + public Shader ShaderMaskMulInv 259 + { 260 + set { this.InternalObject.Call("set_shader_mask_mul_inv", (Shader)value); } 261 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mul_inv"); } 262 + } 263 + 264 + /// <value> 265 + /// Property <c>SpeedScale</c> 266 + /// <br /> 267 + /// Specifies the playback speed for the currently held Live2D model. 268 + /// </value> 269 + public float SpeedScale 270 + { 271 + set { this.InternalObject.Call("set_speed_scale", (float)value); } 272 + get { return (float)this.InternalObject.Call("get_speed_scale"); } 273 + } 274 + 275 + // -------------------------------------------------------------- Method(s) 276 + 277 + /// <summary> 278 + /// Advances the animation by the specified <paramref name="delta">delta</paramref> time (in seconds). 279 + /// Please specify a value of 0.0 or more for delta. 280 + /// </summary> 281 + /// <param name="delta">The time to progress the animation.</param> 282 + public void Advance(double delta) 283 + { 284 + this.InternalObject.Call("advance", delta); 285 + } 286 + 287 + /// <summary> 288 + /// Returns the latest file version that GDCubismUserModel can load. 289 + /// </summary> 290 + /// <returns>Moc3FileFormatVersionEnum</returns> 291 + public Moc3FileFormatVersionEnum CsmGetLatestMocVersion() 292 + { 293 + long value = (long)this.InternalObject.Call("csm_get_latest_moc_version"); 294 + return (Moc3FileFormatVersionEnum)Enum.ToObject(typeof(Moc3FileFormatVersionEnum), value); 295 + } 296 + 297 + /// <summary> 298 + /// Returns the version of the loaded moc3 file. 299 + /// </summary> 300 + /// <returns>Moc3FileFormatVersionEnum</returns> 301 + public Moc3FileFormatVersionEnum CsmGetMocVersion() 302 + { 303 + long value = (long)this.InternalObject.Call("csm_get_moc_version"); 304 + return (Moc3FileFormatVersionEnum)Enum.ToObject(typeof(Moc3FileFormatVersionEnum), value); 305 + } 306 + 307 + /// <summary> 308 + /// Returns the version number of the Cubism Native SDK Core used by GDCubism in <c>Dictionary</c> format 309 + /// <list type="bullet"> 310 + /// <item> 311 + /// <term>version</term> 312 + /// <description>int: The value returned by the csmVersion function is stored as is.</description> 313 + /// </item> 314 + /// <item> 315 + /// <term>major</term> 316 + /// <description>int: Only the major version is extracted from the version and stored.</description> 317 + /// </item> 318 + /// <item> 319 + /// <term>minor</term> 320 + /// <description>int: Only the minor version is extracted from the version and stored.</description> 321 + /// </item> 322 + /// <item> 323 + /// <term>patch</term> 324 + /// <description>int: Only the patch number is extracted from the version and stored.</description> 325 + /// </item> 326 + /// </list> 327 + /// </summary> 328 + /// <returns>Godot.Collections.Dictionary</returns> 329 + public Godot.Collections.Dictionary CsmGetVersion() 330 + { 331 + return (Godot.Collections.Dictionary)this.InternalObject.Call("csm_get_version"); 332 + } 333 + 334 + /// <summary> 335 + /// Returns the following information in <c>Dictionary</c> format. 336 + /// <list type="bullet"> 337 + /// <item> 338 + /// <term>size_in_pixels</term> 339 + /// <description>Vector2: Returns the width and height of the canvas of the loaded Live2D model in pixels.</description> 340 + /// </item> 341 + /// <item> 342 + /// <term>origin_in_pixels</term> 343 + /// <description>Vector2: Returns the center position of the loaded Live2D model in pixels.</description> 344 + /// </item> 345 + /// <item> 346 + /// <term>ixels_per_unit</term> 347 + /// <description>float: Returns the pixelsPerUnit of the loaded Live2D model.</description> 348 + /// </item> 349 + /// </list> 350 + /// </summary> 351 + /// <returns>Godot.Collections.Dictionary</returns> 352 + public Godot.Collections.Dictionary GetCanvasInfo() 353 + { 354 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_canvas_info"); 355 + } 356 + 357 + /// <summary> 358 + /// Returns the information of the <c>Motion</c> currently being played. 359 + /// </summary> 360 + /// <returns>Godot.Collections.Array</returns> 361 + public Godot.Collections.Array GetCubismMotionQueueEntries() 362 + { 363 + return (Godot.Collections.Array)this.InternalObject.Call("get_cubism_motion_queue_entries"); 364 + } 365 + 366 + /// <summary> 367 + /// Returns a list of Expressions from the currently held Live2D model. 368 + /// The information obtained can be used as an argument for the <c>start_expression</c> function. 369 + /// </summary> 370 + /// <returns>Godot.Collections.Array</returns> 371 + public Godot.Collections.Array<String> GetExpressions() 372 + { 373 + return (Godot.Collections.Array<String>)this.InternalObject.Call("get_expressions"); 374 + } 375 + 376 + public Godot.Collections.Array GetHitAreas() 377 + { 378 + return (Godot.Collections.Array)this.InternalObject.Call("get_hit_areas"); 379 + } 380 + 381 + /// <summary> 382 + /// Retrieves the <c>ArrayMesh</c> information of the <c>MeshInstance</c> used in the current Motion state. 383 + /// The keys held by this <c>Dictionary</c> are identical to the names of the <c>MeshInstance</c> generated by <c>GDCubismUserModel</c>. 384 + /// <br /> 385 + /// The information that can be obtained is the <c>ArrayMesh</c> used internally. 386 + /// <br /> 387 + /// CAUTION<br /> 388 + /// get_meshes is an experimental function added in v0.1. Please be aware that the specifications may change or be removed in the future. 389 + /// </summary> 390 + /// <returns>Godot.Collections.Dictionary</returns> 391 + public Godot.Collections.Dictionary GetMeshes() 392 + { 393 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_meshes"); 394 + } 395 + 396 + /// <summary> 397 + /// Returns a list of <c>Motions</c> from the currently held Live2D model. 398 + /// The returned <c>Dictionary</c> is the <c>group</c> and the number of motions it contains. 399 + /// </summary> 400 + /// <returns>Godot.Collections.Dictionary</returns> 401 + public Godot.Collections.Dictionary<String, int> GetMotions() 402 + { 403 + return (Godot.Collections.Dictionary<String, int>)this.InternalObject.Call("get_motions"); 404 + } 405 + 406 + /// <summary> 407 + /// Retrieves the controller class for operating the currently held Live2D model. 408 + /// </summary> 409 + /// <returns>Godot.Collections.Array</returns> 410 + public Godot.Collections.Array<GDCubismParameterCS> GetParameters() 411 + { 412 + Godot.Collections.Array<GodotObject> ary = (Godot.Collections.Array<GodotObject>)this.InternalObject.Call("get_parameters"); 413 + Godot.Collections.Array<GDCubismParameterCS> ary_result = new(); 414 + foreach (GodotObject o in ary) 415 + { 416 + ary_result.Add(new GDCubismParameterCS(o)); 417 + } 418 + 419 + return ary_result; 420 + } 421 + 422 + /// <summary> 423 + /// Retrieves the controller class for operating the transparency of the parts of the currently held Live2D model. 424 + /// </summary> 425 + /// <returns>Godot.Collections.Array</returns> 426 + public Godot.Collections.Array<GDCubismPartOpacityCS> GetPartOpacities() 427 + { 428 + Godot.Collections.Array<GodotObject> ary = (Godot.Collections.Array<GodotObject>)this.InternalObject.Call("get_part_opacities"); 429 + Godot.Collections.Array<GDCubismPartOpacityCS> ary_result = new(); 430 + foreach (GodotObject o in ary) 431 + { 432 + ary_result.Add(new GDCubismPartOpacityCS(o)); 433 + } 434 + 435 + return ary_result; 436 + } 437 + 438 + /// <summary> 439 + /// Plays the specified <paramref name="expression_id">expression_id</paramref>. 440 + /// </summary> 441 + /// <param name="expression_id"></param> 442 + public void StartExpression(String expression_id) 443 + { 444 + this.InternalObject.Call("start_expression", expression_id); 445 + } 446 + 447 + /// <summary> 448 + /// Plays the specified <paramref name="grp_name">group</paramref> and <paramref name="no">no</paramref>. 449 + /// </summary> 450 + /// <param name="grp_name"></param> 451 + /// <param name="no"></param> 452 + /// <param name="priority"></param> 453 + public void StartMotion(String grp_name, int no, PriorityEnum priority) 454 + { 455 + this.InternalObject.Call("start_motion", grp_name, no, (int)priority); 456 + } 457 + 458 + /// <summary> 459 + /// Plays the specified <paramref name="grp_name">group</paramref> and <paramref name="no">no</paramref>. 460 + /// If you want to play it repeatedly, specify it. 461 + /// If the loop argument is <c>false</c>, it will behave the same as the <c>start_motion</c> function. 462 + /// </summary> 463 + /// <param name="grp_name"></param> 464 + /// <param name="no"></param> 465 + /// <param name="priority"></param> 466 + /// <param name="loop"></param> 467 + /// <param name="loop_in_fade"></param> 468 + public void StartMotionLoop(String grp_name, int no, PriorityEnum priority, bool loop, bool loop_in_fade) 469 + { 470 + this.InternalObject.Call("start_motion_loop", grp_name, no, (int)priority, loop, loop_in_fade); 471 + } 472 + 473 + /// <summary> 474 + /// It stops the currently playing <c>Expression</c>. 475 + /// </summary> 476 + public void StopExpression() 477 + { 478 + this.InternalObject.Call("stop_expression"); 479 + } 480 + 481 + /// <summary> 482 + /// It stops the currently playing <c>Motion</c>. 483 + /// </summary> 484 + public void StopMotion() 485 + { 486 + this.InternalObject.Call("stop_motion"); 487 + } 488 + 489 + // -------------------------------------------------------------- Signal(s) 490 + 491 + public delegate void MotionEventEventHandler(string value); 492 + 493 + private static void MotionEventTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 494 + { 495 + ((MotionEventEventHandler)delegateObj)(VariantUtils.ConvertTo<string>(args[0])); 496 + ret = default; 497 + } 498 + 499 + public unsafe event MotionEventEventHandler MotionEvent 500 + { 501 + add => this.InternalObject.Connect(MotionEventName, Callable.CreateWithUnsafeTrampoline(value, &MotionEventTrampoline)); 502 + remove => this.InternalObject.Disconnect(MotionEventName, Callable.CreateWithUnsafeTrampoline(value, &MotionEventTrampoline)); 503 + } 504 + 505 + public event Action MotionFinished 506 + { 507 + add => this.InternalObject.Connect(MotionFinishedName, Callable.From(value)); 508 + remove => this.InternalObject.Disconnect(MotionFinishedName, Callable.From(value)); 509 + } 510 + }
+58
miniview/addons/gd_cubism/cs/gd_cubism_value_abs_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismValueAbsCS : GodotObject 11 + { 12 + private static readonly StringName NativeName = "GDCubismValueAbs"; 13 + 14 + protected GodotObject InternalObject = null; 15 + 16 + public GDCubismValueAbsCS() 17 + { 18 + this.InternalObject = (SubViewport)Godot.ClassDB.Instantiate(NativeName); 19 + } 20 + 21 + public GDCubismValueAbsCS(GodotObject o) 22 + { 23 + this.InternalObject = o; 24 + } 25 + 26 + public GodotObject GetInternalObject() 27 + { 28 + return this.InternalObject; 29 + } 30 + 31 + public void Attach(GodotObject o) 32 + { 33 + this.InternalObject = o; 34 + } 35 + 36 + public GodotObject Detach() 37 + { 38 + GodotObject o = this.InternalObject; 39 + this.InternalObject = null; 40 + return o; 41 + } 42 + 43 + // ------------------------------------------------------------ Property(s) 44 + 45 + public String Id 46 + { 47 + get { return (String)this.InternalObject.Call("get_id"); } 48 + } 49 + 50 + public float Value 51 + { 52 + set { this.InternalObject.Call("set_value", (float)value); } 53 + get { return (float)this.InternalObject.Call("get_value"); } 54 + } 55 + 56 + // -------------------------------------------------------------- Method(s) 57 + // -------------------------------------------------------------- Signal(s) 58 + }
+80
miniview/addons/gd_cubism/example/demo_effect_custom_01.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable CA1050 8 + #pragma warning disable IDE1006 9 + 10 + 11 + public partial class demo_effect_custom_01 : Node2D 12 + { 13 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 14 + 15 + private GDCubismUserModelCS cubism_model; 16 + private GDCubismEffectCustomCS cubism_efx; 17 + 18 + private enum E_PARAM_MODE { 19 + PROCESS, 20 + SIGNAL 21 + } 22 + 23 + private bool param_valid = false; 24 + private E_PARAM_MODE param_mode = E_PARAM_MODE.PROCESS; 25 + private GDCubismParameterCS l_eye; 26 + private GDCubismParameterCS r_eye; 27 + 28 + 29 + private void recalc_model_position(GDCubismUserModelCS model) 30 + { 31 + if(model.Assets == "") return; 32 + 33 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 34 + 35 + if(canvas_info.Count > 0) 36 + { 37 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 38 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 39 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 40 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 41 + model.GetInternalObject().Scale = new(scale, scale); 42 + } 43 + } 44 + 45 + // Called when the node enters the scene tree for the first time. 46 + public override void _Ready() 47 + { 48 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 49 + // this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 50 + // this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 51 + // this.cubism_efx.CubismInit += this._on_cubism_init; 52 + // this.cubism_efx.CubismTerm += this._on_cubism_term; 53 + // this.cubism_efx.CubismProcess += this._on_cubism_process; 54 + 55 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 56 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 57 + } 58 + 59 + // Called every frame. 'delta' is the elapsed time since the previous frame. 60 + public override void _Process(double delta) 61 + { 62 + recalc_model_position(this.cubism_model); 63 + 64 + if (this.param_mode == E_PARAM_MODE.PROCESS) { 65 + 66 + Godot.Collections.Array<GDCubismParameterCS> ary_param = this.cubism_model.GetParameters(); 67 + 68 + foreach (GDCubismParameterCS o in this.cubism_model.GetParameters()) 69 + { 70 + if (o.Id == "ParamEyeLOpen") { 71 + o.Value = 0.0f; 72 + } 73 + 74 + if (o.Id == "ParamEyeROpen") { 75 + o.Value = 0.0f; 76 + } 77 + } 78 + } 79 + } 80 + }
+90
miniview/addons/gd_cubism/example/demo_effect_custom_01.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var cubism_model: GDCubismUserModel 9 + var cubism_efx: GDCubismEffectCustom 10 + 11 + enum E_PARAM_MODE { 12 + PROCESS, 13 + SIGNAL 14 + } 15 + 16 + var param_valid: bool = false 17 + var param_mode: E_PARAM_MODE = E_PARAM_MODE.PROCESS 18 + var l_eye: GDCubismParameter 19 + var r_eye: GDCubismParameter 20 + 21 + 22 + func recalc_model_position(model: GDCubismUserModel): 23 + if model.assets == "": 24 + return 25 + 26 + var canvas_info: Dictionary = model.get_canvas_info() 27 + 28 + if canvas_info.is_empty() != true: 29 + var vct_viewport_size = Vector2(get_viewport_rect().size) 30 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 31 + model.position = vct_viewport_size / 2.0 32 + model.scale = Vector2(scale, scale) 33 + 34 + 35 + func _ready(): 36 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 37 + self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 38 + self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 39 + self.cubism_efx.connect("cubism_init", self._on_cubism_init) 40 + self.cubism_efx.connect("cubism_term", self._on_cubism_term) 41 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 42 + 43 + self.cubism_model = $GDCubismUserModel 44 + if self.cubism_model.assets == "": 45 + self.cubism_model.assets = DEFAULT_ASSET; 46 + 47 + 48 + func _process(delta): 49 + recalc_model_position($GDCubismUserModel) 50 + 51 + if param_mode == E_PARAM_MODE.PROCESS: 52 + var model: GDCubismUserModel = $GDCubismUserModel 53 + 54 + for _o in self.cubism_model.get_parameters(): 55 + var o: GDCubismParameter = _o 56 + if o.id == "ParamEyeLOpen": 57 + o.value = 0.0 58 + if o.id == "ParamEyeROpen": 59 + o.value = 0.0 60 + 61 + 62 + func _on_cubism_init(model: GDCubismUserModel): 63 + if param_mode == E_PARAM_MODE.SIGNAL: 64 + for _o in model.get_parameters(): 65 + var o: GDCubismParameter = _o 66 + if o.id == "ParamEyeLOpen": 67 + l_eye = o 68 + if o.id == "ParamEyeROpen": 69 + r_eye = o 70 + param_valid = true 71 + 72 + 73 + func _on_cubism_term(model: GDCubismUserModel): 74 + if param_mode == E_PARAM_MODE.SIGNAL: 75 + param_valid = false 76 + 77 + 78 + func _on_cubism_prologue(model: GDCubismUserModel, delta: float): 79 + pass # Replace with function body. 80 + 81 + 82 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 83 + if param_mode == E_PARAM_MODE.SIGNAL: 84 + if param_valid == true: 85 + l_eye.value = 0.0 86 + r_eye.value = 0.0 87 + 88 + 89 + func _on_cubism_epilogue(model: GDCubismUserModel, delta: float): 90 + pass # Replace with function body.
+12
miniview/addons/gd_cubism/example/demo_effect_custom_01.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://0sa003phknvv"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_01.gd" id="1_uudij"] 4 + 5 + [node name="demo_effect_custom_01" type="Node2D"] 6 + script = ExtResource("1_uudij") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + position = Vector2(640, 360) 10 + scale = Vector2(0.075, 0.075) 11 + 12 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"]
+107
miniview/addons/gd_cubism/example/demo_effect_custom_02.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using Godot.NativeInterop; 5 + using System; 6 + 7 + #pragma warning disable CA1050 8 + #pragma warning disable IDE1006 9 + 10 + 11 + public partial class demo_effect_custom_02 : Node2D 12 + { 13 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 14 + 15 + private GDCubismUserModelCS cubism_model; 16 + private GDCubismEffectCustomCS cubism_efx; 17 + 18 + private bool first_time = true; 19 + private float counter = 0.0f; 20 + private Vector2 base_vct; 21 + private Vector2 base_scale; 22 + 23 + [Export] 24 + private String art_mesh_name = "ArtMesh278"; 25 + [Export] 26 + private int vector_index_0 = 0; 27 + [Export] 28 + private int vector_index_1 = 1; 29 + 30 + 31 + private void recalc_model_position(GDCubismUserModelCS model) 32 + { 33 + if(model.Assets == "") return; 34 + 35 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 36 + 37 + if(canvas_info.Count > 0) 38 + { 39 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 40 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 41 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 42 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 43 + model.GetInternalObject().Scale = new(scale, scale); 44 + } 45 + } 46 + 47 + public override void _Ready() 48 + { 49 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 50 + // this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 51 + // this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 52 + // this.cubism_efx.CubismInit += this._on_cubism_init; 53 + // this.cubism_efx.CubismTerm += this._on_cubism_term; 54 + this.cubism_efx.CubismProcess += this._on_cubism_process; 55 + 56 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 57 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 58 + 59 + Godot.Collections.Dictionary<String, int> dict_motion = this.cubism_model.GetMotions(); 60 + 61 + foreach (var (k, item_count) in dict_motion) 62 + { 63 + this.cubism_model.StartMotionLoop(k, 0, GDCubismUserModelCS.PriorityEnum.PriorityForce, true, true); 64 + break; 65 + } 66 + } 67 + 68 + public override void _Process(double delta) 69 + { 70 + recalc_model_position(this.cubism_model); 71 + } 72 + 73 + private void _on_cubism_process(Node2D model, double delta) 74 + { 75 + const int ARRAY_VERTEX = (int)ArrayMesh.ArrayType.Vertex; 76 + 77 + var ref_sprite = GetNode<Sprite2D>("GDCubismUserModel/GDCubismEffectCustom/Sprite2D"); 78 + 79 + Godot.Collections.Dictionary dict_mesh = this.cubism_model.GetMeshes(); 80 + 81 + if (dict_mesh.ContainsKey(this.art_mesh_name) == false) return; 82 + 83 + MeshInstance2D ary_mesh = (dict_mesh[this.art_mesh_name]).AsGodotObject() as MeshInstance2D; 84 + Godot.Collections.Array ary_surface = ary_mesh.Mesh.SurfaceGetArrays(0); 85 + Godot.Collections.Array<Vector2> mesh_vertex = (Godot.Collections.Array<Vector2>)ary_surface[ARRAY_VERTEX]; 86 + 87 + if (this.first_time == true) 88 + { 89 + var _fr = mesh_vertex[this.vector_index_0]; 90 + var _to = mesh_vertex[this.vector_index_1]; 91 + 92 + this.base_vct = (_to - _fr); 93 + this.base_scale = ref_sprite.Scale; 94 + this.first_time = false; 95 + } 96 + 97 + var fr = mesh_vertex[this.vector_index_0]; 98 + var to = mesh_vertex[this.vector_index_1]; 99 + 100 + var calc_vct = (to - fr); 101 + var scale = calc_vct.Length() / base_vct.Length(); 102 + 103 + ref_sprite.Position = this.cubism_model.GetInternalObject().ToGlobal(fr); 104 + ref_sprite.Rotation = base_vct.Normalized().Cross(calc_vct.Normalized()); 105 + ref_sprite.Scale = base_scale * scale; 106 + } 107 + }
+81
miniview/addons/gd_cubism/example/demo_effect_custom_02.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 7 + 8 + var cubism_model: GDCubismUserModel 9 + var cubism_efx: GDCubismEffectCustom 10 + 11 + var first_time: bool = true 12 + var counter: float = 0.0 13 + var base_vct: Vector2 14 + var base_scale: Vector2 15 + @export var art_mesh_name: String = "ArtMesh278" 16 + @export var vector_index_0: int = 0 17 + @export var vector_index_1: int = 1 18 + 19 + 20 + func recalc_model_position(model: GDCubismUserModel) -> void: 21 + if model.assets == "": 22 + return 23 + 24 + var canvas_info: Dictionary = model.get_canvas_info() 25 + 26 + if canvas_info.is_empty() != true: 27 + var vct_viewport_size = Vector2(get_viewport_rect().size) 28 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 29 + model.position = vct_viewport_size / 2.0 30 + model.scale = Vector2(scale, scale) 31 + 32 + 33 + func _ready() -> void: 34 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 35 + # self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 36 + # self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 37 + # self.cubism_efx.connect("cubism_init", self._on_cubism_init) 38 + # self.cubism_efx.connect("cubism_term", self._on_cubism_term) 39 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 40 + 41 + self.cubism_model = $GDCubismUserModel 42 + if self.cubism_model.assets == "": 43 + self.cubism_model.assets = DEFAULT_ASSET; 44 + 45 + var dict_motion: Dictionary = self.cubism_model.get_motions() 46 + 47 + for k in dict_motion.keys(): 48 + self.cubism_model.start_motion_loop(k, 0, GDCubismUserModel.PRIORITY_FORCE, true, true); 49 + break 50 + 51 + 52 + func _process(delta: float) -> void: 53 + self.recalc_model_position(self.cubism_model) 54 + 55 + 56 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 57 + var ref_sprite: Sprite2D = $GDCubismUserModel/GDCubismEffectCustom/Sprite2D 58 + var dict_mesh: Dictionary = model.get_meshes() 59 + 60 + if dict_mesh.has(art_mesh_name) == false: 61 + return 62 + 63 + var ary_mesh: MeshInstance2D = dict_mesh[self.art_mesh_name] 64 + var ary_surface: Array = ary_mesh.mesh.surface_get_arrays(0) 65 + var mesh_vertex: PackedVector2Array = ary_surface[ArrayMesh.ARRAY_VERTEX] 66 + 67 + if self.first_time == true: 68 + var fr = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_0] 69 + var to = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_1] 70 + self.base_vct = (to - fr) 71 + self.base_scale = ref_sprite.scale 72 + self.first_time = false 73 + 74 + var fr = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_0] 75 + var to = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_1] 76 + var calc_vct = (to - fr) 77 + var scale: float = calc_vct.length() / base_vct.length() 78 + 79 + ref_sprite.position = model.to_global(fr) 80 + ref_sprite.rotation = base_vct.normalized().cross(calc_vct.normalized()) 81 + ref_sprite.scale = base_scale * scale
+16
miniview/addons/gd_cubism/example/demo_effect_custom_02.tscn
··· 1 + [gd_scene load_steps=3 format=3 uid="uid://drt0184vymus2"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_02.gd" id="1_oi5ow"] 4 + [ext_resource type="Texture2D" uid="uid://c8o4yd28cp3jy" path="res://icon.svg" id="2_0d7x8"] 5 + 6 + [node name="demo_effect_custom_02" type="Node2D"] 7 + script = ExtResource("1_oi5ow") 8 + 9 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 10 + 11 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"] 12 + 13 + [node name="Sprite2D" type="Sprite2D" parent="GDCubismUserModel/GDCubismEffectCustom"] 14 + z_index = 1024 15 + scale = Vector2(0.5, 0.5) 16 + texture = ExtResource("2_0d7x8")
+136
miniview/addons/gd_cubism/example/demo_effect_custom_03.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + #pragma warning disable CA1050 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_custom_03 : Node2D 11 + { 12 + private const String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + private GDCubismEffectCustomCS cubism_efx; 16 + 17 + private String param_mouth_name = "ParamMouthA"; 18 + [Export] 19 + private float min_db = 60.0f; 20 + [Export] 21 + private int min_voice_freq = 0; 22 + [Export] 23 + private int max_voice_freq = 3200; 24 + [Export] 25 + private int history_size = 6; 26 + 27 + [ExportCategory("Audio")] 28 + [Export] 29 + private String audio_bus_name = "Voice"; 30 + [Export] 31 + private int audio_efx_index = 0; 32 + 33 + private AudioEffectSpectrumAnalyzerInstance spectrum; 34 + private GDCubismParameterCS param_mouth; 35 + private Godot.Collections.Array<float> ary_volume_history; 36 + private int history_position = 0; 37 + private bool lipsync_ready = false; 38 + 39 + private void array_rebuild() 40 + { 41 + if (this.history_size != this.ary_volume_history.Count) 42 + { 43 + this.ary_volume_history.Resize(this.history_size); 44 + this.ary_volume_history.Fill(0.0f); 45 + } 46 + } 47 + 48 + private void recalc_model_position(GDCubismUserModelCS model) 49 + { 50 + if(model.Assets == "") return; 51 + 52 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 53 + 54 + if(canvas_info.Count > 0) 55 + { 56 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 57 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 58 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 59 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 60 + model.GetInternalObject().Scale = new(scale, scale); 61 + } 62 + } 63 + 64 + public override void _Ready() 65 + { 66 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 67 + this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 68 + this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 69 + this.cubism_efx.CubismInit += this._on_cubism_init; 70 + this.cubism_efx.CubismTerm += this._on_cubism_term; 71 + this.cubism_efx.CubismProcess += this._on_cubism_process; 72 + 73 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 74 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 75 + } 76 + 77 + public override void _Process(double delta) 78 + { 79 + this.recalc_model_position(this.cubism_model); 80 + } 81 + 82 + private float array_avg() 83 + { 84 + float sum_v = 0.0f; 85 + foreach (float v in this.ary_volume_history) 86 + { 87 + sum_v += v; 88 + } 89 + return sum_v / this.ary_volume_history.Count; 90 + } 91 + 92 + private void _on_cubism_prologue(Node2D _model, float v) {} 93 + private void _on_cubism_epilogue(Node2D _model, float v) {} 94 + private void _on_cubism_init(Node2D _model) {} 95 + 96 + private void _on_cubism_term(Node2D _model) 97 + { 98 + this.lipsync_ready = false; 99 + this.param_mouth = null; 100 + this.ary_volume_history.Clear(); 101 + this.history_position = 0; 102 + } 103 + 104 + private void _on_cubism_process(Node2D _model, double delta) 105 + { 106 + if (this.lipsync_ready == false) return; 107 + 108 + this.array_rebuild(); 109 + 110 + float m = this.spectrum.GetMagnitudeForFrequencyRange( 111 + this.min_voice_freq, 112 + this.max_voice_freq 113 + ).Length(); 114 + 115 + var v = Math.Clamp((min_db + Mathf.LinearToDb(m)) / this.min_db, 0.0f, 1.0f); 116 + 117 + this.ary_volume_history[this.history_position] = v; 118 + this.history_position += 1; 119 + 120 + if (this.history_position >= this.ary_volume_history.Count) 121 + { 122 + this.history_position = 0; 123 + } 124 + 125 + float avg_v = this.array_avg(); 126 + 127 + if (this.param_mouth != null) 128 + { 129 + this.param_mouth.Value = Math.Max(this.param_mouth.Value - 0.2f, 0.0f); 130 + if (avg_v > 0.1f) 131 + { 132 + this.param_mouth.Value = 1.0f; 133 + } 134 + } 135 + } 136 + }
+122
miniview/addons/gd_cubism/example/demo_effect_custom_03.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + 7 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 8 + 9 + var cubism_model: GDCubismUserModel 10 + var cubism_efx: GDCubismEffectCustom 11 + 12 + @export var param_mouth_name: String = "ParamMouthA" 13 + @export var min_db: float = 60.0 14 + @export var min_voice_freq: int = 0 15 + @export var max_voice_freq: int = 3200 16 + @export var history_size: int = 6 17 + 18 + @export_category("Audio") 19 + @export var audio_bus_name: String = "Voice" 20 + @export var audio_efx_index: int = 0 21 + 22 + var spectrum: AudioEffectSpectrumAnalyzerInstance 23 + var param_mouth: GDCubismParameter 24 + var ary_volume_history: Array 25 + var history_position: int = 0 26 + var lipsync_ready: bool = false 27 + 28 + 29 + func array_rebuild(): 30 + if history_size != ary_volume_history.size(): 31 + ary_volume_history.resize(history_size) 32 + ary_volume_history.fill(0.0) 33 + 34 + 35 + func array_avg() -> float: 36 + var sum_v: float = 0.0 37 + for v in ary_volume_history: 38 + sum_v += v 39 + return sum_v / ary_volume_history.size() 40 + 41 + 42 + func recalc_model_position(model: GDCubismUserModel) -> void: 43 + if model.assets == "": 44 + return 45 + 46 + var canvas_info: Dictionary = model.get_canvas_info() 47 + 48 + if canvas_info.is_empty() != true: 49 + var vct_viewport_size = Vector2(get_viewport_rect().size) 50 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 51 + model.position = vct_viewport_size / 2.0 52 + model.scale = Vector2(scale, scale) 53 + 54 + 55 + func _ready() -> void: 56 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 57 + # self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 58 + # self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 59 + # self.cubism_efx.connect("cubism_init", self._on_cubism_init) 60 + # self.cubism_efx.connect("cubism_term", self._on_cubism_term) 61 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 62 + 63 + self.cubism_model = $GDCubismUserModel 64 + if self.cubism_model.assets == "": 65 + self.cubism_model.assets = DEFAULT_ASSET 66 + 67 + 68 + func _process(delta: float) -> void: 69 + self.recalc_model_position(self.cubism_model) 70 + 71 + 72 + func _on_cubism_init(model: GDCubismUserModel): 73 + param_mouth = null 74 + ary_volume_history.clear() 75 + history_position = 0 76 + 77 + var ary_param = model.get_parameters() 78 + 79 + for param in ary_param: 80 + if param.id == param_mouth_name: 81 + param_mouth = param 82 + 83 + var bus_index = AudioServer.get_bus_index(audio_bus_name) 84 + spectrum = AudioServer.get_bus_effect_instance(bus_index, audio_efx_index) 85 + 86 + if spectrum == null: 87 + lipsync_ready = false 88 + else: 89 + lipsync_ready = true 90 + 91 + 92 + func _on_cubism_term(model: GDCubismUserModel): 93 + lipsync_ready = false 94 + param_mouth = null 95 + ary_volume_history.clear() 96 + history_position = 0 97 + 98 + 99 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 100 + if lipsync_ready == false: 101 + return 102 + 103 + array_rebuild() 104 + 105 + var m: float = spectrum.get_magnitude_for_frequency_range( 106 + min_voice_freq, 107 + max_voice_freq 108 + ).length() 109 + var v = clamp((min_db + linear_to_db(m)) / min_db, 0.0, 1.0) 110 + 111 + ary_volume_history[history_position] = v 112 + history_position += 1 113 + 114 + if history_position >= ary_volume_history.size(): 115 + history_position = 0 116 + 117 + var avg_v: float = array_avg() 118 + 119 + if param_mouth != null: 120 + param_mouth.value = max(param_mouth.value - 0.2, 0.0) 121 + if avg_v > 0.1: 122 + param_mouth.value = 1.0
+14
miniview/addons/gd_cubism/example/demo_effect_custom_03.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://xk7rqvf532rj"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_03.gd" id="1_g4xfj"] 4 + 5 + [node name="demo_effect_custom_03" type="Node2D"] 6 + script = ExtResource("1_g4xfj") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"] 11 + 12 + [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] 13 + autoplay = true 14 + bus = &"Voice"
+144
miniview/addons/gd_cubism/example/demo_effect_hit_area.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_hit_area : Node2D 11 + { 12 + const String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + 16 + private bool pressed = false; 17 + private Vector2 local_pos = new(0.0f, 0.0f); 18 + private Vector2 adjust_pos = new(0.0f, 0.0f); 19 + private Godot.Collections.Dictionary dict_detail = new(); 20 + private Godot.Collections.Dictionary dict_pickup = new(); 21 + private String id_mesh = ""; 22 + 23 + 24 + private void recalc_model_position(GDCubismUserModelCS model) 25 + { 26 + if(model.Assets == "") return; 27 + 28 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 29 + 30 + if(canvas_info.Count > 0) 31 + { 32 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 33 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 34 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 35 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 36 + model.GetInternalObject().Scale = new(scale, scale); 37 + } 38 + } 39 + 40 + public override void _Ready() 41 + { 42 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 43 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 44 + 45 + GetNode<ItemList>("Control/ItemList").Clear(); 46 + Godot.Collections.Dictionary dict_meshes = this.cubism_model.GetMeshes(); 47 + foreach (var id in dict_meshes.Keys) 48 + { 49 + GetNode<ItemList>("Control/ItemList").AddItem(id.AsString()); 50 + } 51 + } 52 + 53 + public override void _Process(double delta) 54 + { 55 + this.recalc_model_position(this.cubism_model); 56 + 57 + GDCubismEffectHitAreaCS hit_area = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectHitArea")); 58 + 59 + if (this.pressed == true) 60 + { 61 + hit_area.SetTarget(this.local_pos); 62 + } 63 + 64 + GetNode<Label>("Control/lbl_mouse_x").Text = String.Format("{0:######.000}", this.local_pos.X); 65 + GetNode<Label>("Control/lbl_mouse_y").Text = String.Format("{0:######.000}", this.local_pos.Y); 66 + 67 + if (this.id_mesh != "") 68 + { 69 + this.dict_pickup = hit_area.GetDetail(this.cubism_model, this.id_mesh); 70 + } 71 + 72 + GetNode<CanvasItem>("Canvas").QueueRedraw(); 73 + 74 + base._Process(delta); 75 + } 76 + 77 + public override void _Input(InputEvent @event) 78 + { 79 + if (@event is InputEventMouseButton mouseButton) 80 + { 81 + this.pressed = mouseButton.IsPressed(); 82 + } 83 + 84 + if (@event is InputEventMouseMotion mouseMotion) 85 + { 86 + this.local_pos = this.cubism_model.GetInternalObject().ToLocal(mouseMotion.Position) + this.adjust_pos; 87 + } 88 + 89 + base._Input(@event); 90 + } 91 + 92 + private void mark_hit_area(Godot.Collections.Dictionary dict_hit_area, Color color_box, Color color_tri) 93 + { 94 + if (dict_hit_area.Count > 0) 95 + { 96 + Rect2 rect = (Rect2)dict_hit_area["rect"]; 97 + 98 + Rect2 r = new( 99 + (rect.Position - this.adjust_pos) * this.cubism_model.GetInternalObject().Scale, 100 + rect.Size * this.cubism_model.GetInternalObject().Scale 101 + ); 102 + GetNode<CanvasItem>("Canvas").DrawRect(r, color_box, false, 5); 103 + 104 + if (dict_hit_area.ContainsKey("vertices") == true) 105 + { 106 + Godot.Collections.Array<Vector2> vtx = (Godot.Collections.Array<Vector2>)dict_hit_area["vertices"]; 107 + 108 + Godot.Collections.Array<Vector2> v = new(); 109 + v.Add(vtx[0] * this.cubism_model.GetInternalObject().Scale); 110 + v.Add(vtx[1] * this.cubism_model.GetInternalObject().Scale); 111 + v.Add(vtx[2] * this.cubism_model.GetInternalObject().Scale); 112 + 113 + GetNode<CanvasItem>("Canvas").DrawLine(v[0] - this.adjust_pos, v[1] - adjust_pos, color_tri, 3); 114 + GetNode<CanvasItem>("Canvas").DrawLine(v[1] - this.adjust_pos, v[2] - adjust_pos, color_tri, 3); 115 + GetNode<CanvasItem>("Canvas").DrawLine(v[2] - this.adjust_pos, v[0] - adjust_pos, color_tri, 3); 116 + } 117 + } 118 + } 119 + 120 + private void _on_gd_cubism_effect_hit_area_hit_area_entered(Node2D _model, String id) 121 + { 122 + GDCubismEffectHitAreaCS hit_area = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectHitArea")); 123 + 124 + this.dict_detail = hit_area.GetDetail(this.cubism_model, id); 125 + GetNode<Label>("Control/lbl_id").Text = id; 126 + } 127 + 128 + private void _on_gd_cubism_effect_hit_area_hit_area_exited(Node2D _model, String id) 129 + { 130 + this.dict_detail = new(); 131 + GetNode<Label>("Control/lbl_id").Text = ""; 132 + } 133 + 134 + private void _on_canvas_draw() 135 + { 136 + this.mark_hit_area(this.dict_detail, new Color(0.0f, 1.0f, 0.0f), new Color(1.0f, 0.0f, 0.0f)); 137 + this.mark_hit_area(this.dict_pickup, new Color(0.0f, 0.0f, 1.0f), new Color(1.0f, 0.0f, 0.0f)); 138 + } 139 + 140 + private void _on_item_list_item_selected(long index) 141 + { 142 + this.id_mesh = GetNode<ItemList>("Control/ItemList").GetItemText((int)index); 143 + } 144 + }
+99
miniview/addons/gd_cubism/example/demo_effect_hit_area.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var pressed: bool = false 9 + var local_pos: Vector2 = Vector2.ZERO 10 + var adjust_pos: Vector2 = Vector2.ZERO 11 + var dict_detail: Dictionary 12 + var dict_pickup: Dictionary 13 + var id_mesh: String = "" 14 + 15 + 16 + func recalc_model_position(model: GDCubismUserModel): 17 + if model.assets == "": 18 + return 19 + 20 + var canvas_info: Dictionary = model.get_canvas_info() 21 + 22 + if canvas_info.is_empty() != true: 23 + var vct_viewport_size = Vector2(get_viewport_rect().size) 24 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 25 + model.position = vct_viewport_size / 2.0 26 + model.scale = Vector2(scale, scale) 27 + 28 + 29 + func _ready(): 30 + if $GDCubismUserModel.assets == "": 31 + $GDCubismUserModel.assets = DEFAULT_ASSET 32 + 33 + $Control/ItemList.clear() 34 + for id in $GDCubismUserModel.get_meshes(): 35 + $Control/ItemList.add_item(id) 36 + 37 + 38 + func _process(delta): 39 + recalc_model_position($GDCubismUserModel) 40 + 41 + if pressed == true: 42 + $GDCubismUserModel/GDCubismEffectHitArea.set_target(local_pos) 43 + 44 + $Control/lbl_mouse_x.text = "%6.3f" % local_pos.x 45 + $Control/lbl_mouse_y.text = "%6.3f" % local_pos.y 46 + 47 + if id_mesh != "": 48 + dict_pickup = $GDCubismUserModel/GDCubismEffectHitArea.get_detail( 49 + $GDCubismUserModel, 50 + id_mesh 51 + ) 52 + 53 + $Canvas.queue_redraw() 54 + 55 + 56 + func _input(event): 57 + if event as InputEventMouseButton: 58 + pressed = event.is_pressed() 59 + 60 + if event as InputEventMouseMotion: 61 + local_pos = $GDCubismUserModel.to_local(event.position) 62 + 63 + 64 + func mark_hit_area(dict_hit_area: Dictionary, color_box: Color, color_tri: Color): 65 + if dict_hit_area.is_empty() == false: 66 + var r: Rect2 = Rect2( 67 + (dict_hit_area.rect.position - adjust_pos) * $GDCubismUserModel.scale, 68 + dict_hit_area.rect.size * $GDCubismUserModel.scale 69 + ) 70 + $Canvas.draw_rect(r, color_box, false, 5) 71 + 72 + if dict_hit_area.has("vertices") == true: 73 + var v: Array[Vector2] = [ 74 + dict_hit_area.vertices[0] * $GDCubismUserModel.scale, 75 + dict_hit_area.vertices[1] * $GDCubismUserModel.scale, 76 + dict_hit_area.vertices[2] * $GDCubismUserModel.scale 77 + ] 78 + $Canvas.draw_line(v[0] - adjust_pos, v[1] - adjust_pos, color_tri, 3) 79 + $Canvas.draw_line(v[1] - adjust_pos, v[2] - adjust_pos, color_tri, 3) 80 + $Canvas.draw_line(v[2] - adjust_pos, v[0] - adjust_pos, color_tri, 3) 81 + 82 + 83 + func _on_gd_cubism_effect_hit_area_hit_area_entered(model, id): 84 + dict_detail = $GDCubismUserModel/GDCubismEffectHitArea.get_detail(model, id) 85 + $Control/lbl_id.text = id 86 + 87 + 88 + func _on_gd_cubism_effect_hit_area_hit_area_exited(model, id): 89 + dict_detail = {} 90 + $Control/lbl_id.text = "" 91 + 92 + 93 + func _on_canvas_draw(): 94 + mark_hit_area(dict_detail, Color.GREEN, Color.RED) 95 + mark_hit_area(dict_pickup, Color.BLUE, Color.RED) 96 + 97 + 98 + func _on_item_list_item_selected(index): 99 + id_mesh = $Control/ItemList.get_item_text(index)
+87
miniview/addons/gd_cubism/example/demo_effect_hit_area.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://bgus7rihdnj0q"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_hit_area.gd" id="1_v15iy"] 4 + 5 + [node name="demo_effect_hit_area" type="Node2D"] 6 + script = ExtResource("1_v15iy") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectHitArea" type="GDCubismEffectHitArea" parent="GDCubismUserModel"] 11 + 12 + [node name="Canvas" type="Control" parent="."] 13 + z_index = 1024 14 + layout_mode = 3 15 + anchors_preset = 0 16 + offset_left = 640.0 17 + offset_top = 360.0 18 + offset_right = 640.0 19 + offset_bottom = 360.0 20 + 21 + [node name="Control" type="Control" parent="."] 22 + layout_mode = 3 23 + anchors_preset = 15 24 + anchor_right = 1.0 25 + anchor_bottom = 1.0 26 + offset_right = 1280.0 27 + offset_bottom = 720.0 28 + grow_horizontal = 2 29 + grow_vertical = 2 30 + metadata/_edit_use_anchors_ = true 31 + 32 + [node name="lbl_mouse_x" type="Label" parent="Control"] 33 + layout_mode = 1 34 + anchors_preset = 1 35 + anchor_left = 1.0 36 + anchor_right = 1.0 37 + offset_left = -256.0 38 + offset_top = 16.0 39 + offset_right = -128.0 40 + offset_bottom = 48.0 41 + grow_horizontal = 0 42 + text = "0" 43 + horizontal_alignment = 1 44 + vertical_alignment = 1 45 + 46 + [node name="lbl_mouse_y" type="Label" parent="Control"] 47 + layout_mode = 1 48 + anchors_preset = 1 49 + anchor_left = 1.0 50 + anchor_right = 1.0 51 + offset_left = -128.0 52 + offset_top = 16.0 53 + offset_bottom = 48.0 54 + grow_horizontal = 0 55 + text = "0" 56 + horizontal_alignment = 1 57 + vertical_alignment = 1 58 + 59 + [node name="lbl_id" type="Label" parent="Control"] 60 + layout_mode = 1 61 + anchors_preset = 5 62 + anchor_left = 0.5 63 + anchor_right = 0.5 64 + offset_left = -64.0 65 + offset_right = 64.0 66 + offset_bottom = 32.0 67 + grow_horizontal = 2 68 + horizontal_alignment = 1 69 + vertical_alignment = 1 70 + 71 + [node name="ItemList" type="ItemList" parent="Control"] 72 + layout_mode = 1 73 + anchors_preset = 11 74 + anchor_left = 1.0 75 + anchor_right = 1.0 76 + anchor_bottom = 1.0 77 + offset_left = -208.0 78 + offset_top = 64.0 79 + offset_right = -16.0 80 + offset_bottom = -32.0 81 + grow_horizontal = 0 82 + grow_vertical = 2 83 + 84 + [connection signal="hit_area_entered" from="GDCubismUserModel/GDCubismEffectHitArea" to="." method="_on_gd_cubism_effect_hit_area_hit_area_entered"] 85 + [connection signal="hit_area_exited" from="GDCubismUserModel/GDCubismEffectHitArea" to="." method="_on_gd_cubism_effect_hit_area_hit_area_exited"] 86 + [connection signal="draw" from="Canvas" to="." method="_on_canvas_draw"] 87 + [connection signal="item_selected" from="Control/ItemList" to="." method="_on_item_list_item_selected"]
+70
miniview/addons/gd_cubism/example/demo_effect_target_point.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2025 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_target_point : Node2D 11 + { 12 + const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + private GDCubismEffectTargetPointCS cubism_efx; 16 + 17 + private bool pressed = false; 18 + 19 + 20 + private void recalc_model_position(GDCubismUserModelCS model) 21 + { 22 + if(model.Assets == "") return; 23 + 24 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 25 + 26 + if(canvas_info.Count > 0) 27 + { 28 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 29 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 30 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 31 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 32 + model.GetInternalObject().Scale = new(scale, scale); 33 + } 34 + } 35 + 36 + public override void _Ready() 37 + { 38 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 39 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 40 + 41 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectTargetPoint")); 42 + } 43 + 44 + public override void _Process(double delta) 45 + { 46 + this.recalc_model_position(this.cubism_model); 47 + base._Process(delta); 48 + } 49 + 50 + public override void _Input(InputEvent @event) 51 + { 52 + if (@event is InputEventMouseButton evt_mouse_button) 53 + { 54 + this.pressed = evt_mouse_button.IsPressed(); 55 + } 56 + 57 + if (@event is InputEventMouseMotion evt_mouse_motion) 58 + { 59 + if (this.pressed == true) 60 + { 61 + Vector2 calc_pos = this.cubism_model.GetInternalObject().ToLocal(evt_mouse_motion.Position) * new Vector2(1.0f, -1.0f); 62 + this.cubism_efx.SetTarget(calc_pos.Normalized()); 63 + } else { 64 + this.cubism_efx.SetTarget(Vector2.Zero); 65 + } 66 + } 67 + 68 + base._Input(@event); 69 + } 70 + }
+42
miniview/addons/gd_cubism/example/demo_effect_target_point.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var pressed: bool = false 9 + 10 + 11 + func recalc_model_position(model: GDCubismUserModel): 12 + if model.assets == "": 13 + return 14 + 15 + var canvas_info: Dictionary = model.get_canvas_info() 16 + 17 + if canvas_info.is_empty() != true: 18 + var vct_viewport_size = Vector2(get_viewport_rect().size) 19 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 20 + model.position = vct_viewport_size / 2.0 21 + model.scale = Vector2(scale, scale) 22 + 23 + 24 + func _ready(): 25 + if $GDCubismUserModel.assets == "": 26 + $GDCubismUserModel.assets = DEFAULT_ASSET 27 + 28 + 29 + func _process(delta): 30 + self.recalc_model_position($GDCubismUserModel) 31 + 32 + 33 + func _input(event): 34 + if event as InputEventMouseButton: 35 + pressed = event.is_pressed() 36 + 37 + if event as InputEventMouseMotion: 38 + if pressed == true: 39 + var calc_pos: Vector2 = $GDCubismUserModel.to_local(event.position) * Vector2(1, -1) 40 + $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(calc_pos.normalized()) 41 + else: 42 + $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(Vector2.ZERO)
+10
miniview/addons/gd_cubism/example/demo_effect_target_point.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://dhfu0rwvwpprc"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_target_point.gd" id="1_j4tk3"] 4 + 5 + [node name="demo_effect_target_point" type="Node2D"] 6 + script = ExtResource("1_j4tk3") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectTargetPoint" type="GDCubismEffectTargetPoint" parent="GDCubismUserModel"]
+67
miniview/addons/gd_cubism/example/demo_fade.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_fade : Node2D 11 + { 12 + const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + GDCubismUserModelCS cubism_model; 15 + GDCubismUserModelCS cubism_model_sv; 16 + 17 + double color_h; 18 + 19 + 20 + private void recalc_model_position(GDCubismUserModelCS model) 21 + { 22 + if(model.Assets == "") return; 23 + 24 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 25 + 26 + if(canvas_info.Count > 0) 27 + { 28 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 29 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 30 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 31 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 32 + model.GetInternalObject().Scale = new(scale, scale); 33 + } 34 + } 35 + 36 + public override void _Ready() 37 + { 38 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 39 + if (this.cubism_model.Assets == "") 40 + { 41 + this.cubism_model.Assets = DEFAULT_ASSET; 42 + } 43 + 44 + this.cubism_model_sv = new(GetNode<Node2D>("Sprite2D/SubViewport/GDCubismUserModel")); 45 + if (this.cubism_model_sv.Assets == "") 46 + { 47 + this.cubism_model_sv.Assets = DEFAULT_ASSET; 48 + } 49 + 50 + this.color_h = GetNode<HSlider>("HSlider").Value; 51 + } 52 + 53 + public override void _Process(double delta) 54 + { 55 + this.color_h += (delta * 0.25); 56 + 57 + if (this.color_h > 360.0) 58 + { 59 + this.color_h -= 360.0; 60 + } 61 + 62 + Color color = Color.FromHsv((float)this.color_h, 1.0f, 1.0f, (float)GetNode<HSlider>("HSlider").Value / 100.0f); 63 + 64 + this.cubism_model.GetInternalObject().Modulate = color; 65 + GetNode<Sprite2D>("Sprite2D").Modulate = color; 66 + } 67 + }
+41
miniview/addons/gd_cubism/example/demo_fade.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2025 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var color_h: float = 0.0 9 + 10 + 11 + func recalc_model_position(model: GDCubismUserModel): 12 + if model.assets == "": 13 + return 14 + 15 + var canvas_info: Dictionary = model.get_canvas_info() 16 + 17 + if canvas_info.is_empty() != true: 18 + var vct_viewport_size = Vector2(get_viewport_rect().size) 19 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 20 + model.position = vct_viewport_size / 2.0 21 + model.scale = Vector2(scale, scale) 22 + 23 + 24 + func _ready() -> void: 25 + if $GDCubismUserModel.assets == "": 26 + $GDCubismUserModel.assets = DEFAULT_ASSET 27 + 28 + if $Sprite2D/SubViewport/GDCubismUserModel.assets == "": 29 + $Sprite2D/SubViewport/GDCubismUserModel.assets = DEFAULT_ASSET 30 + 31 + 32 + func _process(delta: float) -> void: 33 + color_h += (delta * 0.25); 34 + 35 + if color_h > 360.0: 36 + color_h -= 360.0 37 + 38 + var color: Color = Color.from_hsv(color_h, 1.0, 1.0, $HSlider.value / 100.0) 39 + 40 + $GDCubismUserModel.modulate = color 41 + $Sprite2D.modulate = color
+52
miniview/addons/gd_cubism/example/demo_fade.tscn
··· 1 + [gd_scene load_steps=3 format=3 uid="uid://rdteqxrmttct"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_fade.gd" id="1_3vqxl"] 4 + 5 + [sub_resource type="ViewportTexture" id="ViewportTexture_nt5uq"] 6 + viewport_path = NodePath("Sprite2D/SubViewport") 7 + 8 + [node name="demo_fade" type="Node2D"] 9 + script = ExtResource("1_3vqxl") 10 + metadata/_edit_vertical_guides_ = [640.0, 320.0, 960.0] 11 + metadata/_edit_horizontal_guides_ = [640.0] 12 + 13 + [node name="Label1" type="Label" parent="."] 14 + offset_top = 640.0 15 + offset_right = 640.0 16 + offset_bottom = 704.0 17 + text = "Direct Rendering" 18 + horizontal_alignment = 1 19 + vertical_alignment = 2 20 + 21 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 22 + position = Vector2(320, 360) 23 + scale = Vector2(0.075, 0.075) 24 + 25 + [node name="Label2" type="Label" parent="."] 26 + offset_left = 640.0 27 + offset_top = 640.0 28 + offset_right = 1280.0 29 + offset_bottom = 703.0 30 + text = "SubViewport" 31 + horizontal_alignment = 1 32 + vertical_alignment = 2 33 + 34 + [node name="Sprite2D" type="Sprite2D" parent="."] 35 + position = Vector2(960, 512) 36 + texture = SubResource("ViewportTexture_nt5uq") 37 + 38 + [node name="SubViewport" type="SubViewport" parent="Sprite2D"] 39 + disable_3d = true 40 + transparent_bg = true 41 + size = Vector2i(512, 1024) 42 + 43 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="Sprite2D/SubViewport"] 44 + position = Vector2(256, 360) 45 + scale = Vector2(0.075, 0.075) 46 + 47 + [node name="HSlider" type="HSlider" parent="."] 48 + offset_left = 16.0 49 + offset_top = 16.0 50 + offset_right = 1264.0 51 + offset_bottom = 48.0 52 + value = 100.0
+11
miniview/addons/gd_cubism/example/demo_simple.tscn
··· 1 + [gd_scene format=3 uid="uid://dab25molfpkce"] 2 + 3 + [node name="simple" type="Node2D"] 4 + 5 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 6 + position = Vector2(640, 360) 7 + scale = Vector2(0.075, 0.075) 8 + 9 + [node name="GDCubismEffectEyeBlink" type="GDCubismEffectEyeBlink" parent="GDCubismUserModel"] 10 + 11 + [node name="GDCubismEffectBreath" type="GDCubismEffectBreath" parent="GDCubismUserModel"]
+237
miniview/addons/gd_cubism/example/demo_transparent.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_transparent : Node2D 11 + { 12 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + 16 + private System.String[] CONVEX_MESH_SRC = { 17 + "ArtMesh121", 18 + "ArtMesh122", 19 + "ArtMesh135", 20 + "ArtMesh146", 21 + "ArtMesh147", 22 + "ArtMesh231", 23 + "ArtMesh278" 24 + }; 25 + private bool order_window_position = false; 26 + private bool mouse_button_pressed = false; 27 + private Vector2I window_position; 28 + private Vector2 mouse_position; 29 + 30 + private bool enable_transparent = false; 31 + private Godot.Collections.Array<System.String> ary_character_expression = new(); 32 + private Godot.Collections.Array ary_character_motion = new(); 33 + 34 + private Polygon2D polygon_2d; 35 + 36 + 37 + // ----------------------------------------------------------------- ported 38 + // I have ported the code for check_cross and convex_hull to GDScript. 39 + // * https://tjkendev.github.io/procon-library/ 40 + // * https://tjkendev.github.io/procon-library/cpp/geometry/graham_scan.html 41 + 42 + private static bool check_cross(Godot.Collections.Array<Vector2> ary_check, Vector2 vtx) 43 + { 44 + Vector2 va = ary_check[^2]; 45 + Vector2 vb = ary_check[^1]; 46 + 47 + return (((vb.X - va.X) * (vtx.Y - va.Y)) - ((vb.Y - va.Y) * (vtx.X - va.X))) > 0; 48 + } 49 + 50 + private static Godot.Collections.Array<Vector2> convex_hull(Godot.Collections.Array<Vector2> ary_vertex) 51 + { 52 + ary_vertex.Sort(); 53 + 54 + Godot.Collections.Array<Vector2> ary_result = new(); 55 + int n = ary_vertex.Count; 56 + 57 + foreach (Vector2 vtx in ary_vertex) 58 + { 59 + while (ary_result.Count > 1 && check_cross(ary_result, vtx)) 60 + { 61 + ary_result.RemoveAt(ary_result.Count - 1); 62 + } 63 + ary_result.Insert(ary_result.Count, vtx); 64 + } 65 + 66 + int t = ary_result.Count; 67 + 68 + int i = n - 2; 69 + while (i >= 0) 70 + { 71 + Vector2 vtx = ary_vertex[i]; 72 + while (ary_result.Count > t && check_cross(ary_result, vtx)) 73 + { 74 + ary_result.RemoveAt(ary_result.Count - 1); 75 + } 76 + ary_result.Insert(ary_result.Count, vtx); 77 + 78 + i--; 79 + } 80 + 81 + ary_result.RemoveAt(ary_result.Count - 1); 82 + 83 + return ary_result; 84 + } 85 + 86 + private void recalc_model_position(GDCubismUserModelCS model) 87 + { 88 + if(model.Assets == "") return; 89 + 90 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 91 + 92 + if(canvas_info.Count > 0) 93 + { 94 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 95 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 96 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 97 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 98 + model.GetInternalObject().Scale = new(scale, scale); 99 + } 100 + } 101 + 102 + public override void _Ready() 103 + { 104 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 105 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 106 + 107 + this.recalc_model_position(this.cubism_model); 108 + this.polygon_2d = GetNode<Polygon2D>("Polygon2D"); 109 + 110 + this.ary_character_expression = this.cubism_model.GetExpressions(); 111 + 112 + Godot.Collections.Dictionary<System.String, int> dict_motion = this.cubism_model.GetMotions(); 113 + 114 + foreach (var (k, item_count) in dict_motion) 115 + { 116 + for (int no = 0; no < item_count; no++) 117 + { 118 + this.ary_character_motion.Add( 119 + new Godot.Collections.Dictionary { { "group", k }, { "no", no } } 120 + ); 121 + } 122 + } 123 + } 124 + 125 + public override void _Process(double delta) 126 + { 127 + if (this.order_window_position == true) 128 + { 129 + DisplayServer.WindowSetPosition(new Vector2I(this.window_position.X, this.window_position.Y)); 130 + this.order_window_position = false; 131 + } 132 + 133 + Godot.Collections.Dictionary dict_mesh = this.cubism_model.GetMeshes(); 134 + Godot.Collections.Array<Vector2> ary = new(); 135 + 136 + foreach (System.String name in CONVEX_MESH_SRC) 137 + { 138 + Godot.Collections.Array<Vector2> ary_vtx = (Godot.Collections.Array<Vector2>)((MeshInstance2D)dict_mesh[name]).Mesh.SurfaceGetArrays(0)[(int)Mesh.ArrayType.Vertex]; 139 + ary += ary_vtx; 140 + } 141 + 142 + Godot.Collections.Array<Vector2> ary_polygon = convex_hull(ary); 143 + 144 + if (ary_polygon.Count > 2) 145 + { 146 + Vector2[] region = System.Array.Empty<Vector2>(); 147 + 148 + foreach (Vector2 _v in ary_polygon) 149 + { 150 + Vector2 v = _v; 151 + v *= this.cubism_model.GetInternalObject().Scale; 152 + v += this.cubism_model.GetInternalObject().Position; 153 + System.Array.Resize(ref region, region.Length + 1); 154 + region[^1] = v; 155 + } 156 + 157 + this.polygon_2d.Polygon = region; 158 + } 159 + } 160 + 161 + public override void _Input(InputEvent @event) 162 + { 163 + if (@event is InputEventKey inputKey) 164 + { 165 + if (inputKey.IsPressed() == true) 166 + { 167 + if (inputKey.Keycode == Key.Escape) 168 + { 169 + GetTree().Quit(); 170 + } 171 + 172 + if (inputKey.Keycode == Key.Space) 173 + { 174 + var random = new RandomNumberGenerator(); 175 + 176 + Godot.Collections.Dictionary motion = (Godot.Collections.Dictionary)ary_character_motion[random.RandiRange(0, ary_character_motion.Count - 1)]; 177 + this.cubism_model.StartMotionLoop( 178 + (System.String)motion["group"], 179 + (int)motion["no"], 180 + GDCubismUserModelCS.PriorityEnum.PriorityForce, 181 + true, 182 + true 183 + ); 184 + } 185 + 186 + if (inputKey.Keycode == Key.Tab) 187 + { 188 + if (this.enable_transparent == true) 189 + { 190 + this.enable_transparent = false; 191 + DisplayServer.WindowSetMousePassthrough(System.Array.Empty<Vector2>()); 192 + } 193 + else 194 + { 195 + this.enable_transparent = true; 196 + DisplayServer.WindowSetMousePassthrough(this.polygon_2d.Polygon); 197 + } 198 + GetTree().Root.TransparentBg = this.enable_transparent; 199 + DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.Transparent, this.enable_transparent); 200 + DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.AlwaysOnTop, true); 201 + } 202 + 203 + if (inputKey.Keycode >= Key.Key0 && inputKey.Keycode <= Key.Key9) 204 + { 205 + long index = inputKey.Keycode - Key.Key0; 206 + if (index < this.ary_character_expression.Count) 207 + { 208 + this.cubism_model.StartExpression(this.ary_character_expression[(int)index]); 209 + } 210 + } 211 + } 212 + } 213 + 214 + if (@event is InputEventMouseButton eventMouseButton) 215 + { 216 + if (eventMouseButton.Pressed == true) 217 + { 218 + this.window_position = DisplayServer.WindowGetPosition(); 219 + this.mouse_position = GetViewport().GetMousePosition(); 220 + } 221 + else 222 + { 223 + GetViewport().WarpMouse(this.mouse_position); 224 + } 225 + this.mouse_button_pressed = eventMouseButton.Pressed; 226 + } 227 + 228 + if (@event is InputEventMouseMotion inputMouseMotion) 229 + { 230 + if (this.mouse_button_pressed == true) 231 + { 232 + this.order_window_position = true; 233 + this.window_position += new Vector2I((int)inputMouseMotion.Relative.X, (int)inputMouseMotion.Relative.Y); 234 + } 235 + } 236 + } 237 + }
+165
miniview/addons/gd_cubism/example/demo_transparent.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + const CONVEX_MESH_SRC: Array[String] = [ 9 + "ArtMesh121", 10 + "ArtMesh122", 11 + "ArtMesh135", 12 + "ArtMesh146", 13 + "ArtMesh147", 14 + "ArtMesh231", 15 + "ArtMesh278" 16 + ] 17 + var order_window_position: bool = false 18 + var mouse_button_pressed: bool = false 19 + var window_position: Vector2i 20 + var mouse_position: Vector2 21 + 22 + var enable_transparent: bool = false 23 + var ary_character_expression: Array 24 + var ary_character_motion: Array 25 + 26 + 27 + # ---------------------------------------------------------------------- ported 28 + # I have ported the code for check_cross and convex_hull to GDScript. 29 + # * https://tjkendev.github.io/procon-library/ 30 + # * https://tjkendev.github.io/procon-library/cpp/geometry/graham_scan.html 31 + 32 + func check_cross(ary_check: Array, vtx: Vector2) -> bool: 33 + var va: Vector2 = ary_check[ary_check.size() - 2] 34 + var vb: Vector2 = ary_check[ary_check.size() - 1] 35 + 36 + return (((vb.x - va.x) * (vtx.y - va.y)) - ((vb.y - va.y) * (vtx.x - va.x))) > 0 37 + 38 + 39 + func convex_hull(ary_vertex: Array[Vector2]) -> Array: 40 + ary_vertex.sort() 41 + 42 + var ary_result: Array 43 + var n: int = ary_vertex.size() 44 + 45 + for vtx in ary_vertex: 46 + while ary_result.size() > 1 and check_cross(ary_result, vtx): 47 + ary_result.pop_back() 48 + ary_result.push_back(vtx) 49 + 50 + var t: int = ary_result.size() 51 + 52 + var i: int = n - 2 53 + while i >= 0: 54 + var vtx: Vector2 = ary_vertex[i] 55 + while ary_result.size() > t and check_cross(ary_result, vtx): 56 + ary_result.pop_back() 57 + ary_result.push_back(vtx) 58 + 59 + i -= 1 60 + 61 + ary_result.pop_back() 62 + 63 + return ary_result 64 + 65 + # ---------------------------------------------------------------------- ported 66 + 67 + 68 + func recalc_model_position(model: GDCubismUserModel): 69 + if model.assets == "": 70 + return 71 + 72 + var canvas_info: Dictionary = model.get_canvas_info() 73 + 74 + if canvas_info.is_empty() != true: 75 + var vct_viewport_size = Vector2(get_viewport_rect().size) 76 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 77 + model.position = vct_viewport_size / 2.0 78 + model.scale = Vector2(scale, scale) 79 + 80 + 81 + func _ready(): 82 + if $GDCubismUserModel.assets == "": 83 + $GDCubismUserModel.assets = DEFAULT_ASSET 84 + 85 + recalc_model_position($GDCubismUserModel) 86 + 87 + ary_character_expression = $GDCubismUserModel.get_expressions() 88 + 89 + var dict_motion = $GDCubismUserModel.get_motions() 90 + for group in dict_motion.keys(): 91 + for no in range(dict_motion[group]): 92 + ary_character_motion.append({"group": group, "no": no}) 93 + 94 + 95 + func _process(delta): 96 + if order_window_position == true: 97 + DisplayServer.window_set_position(Vector2i(window_position)) 98 + order_window_position = false 99 + 100 + var dict_mesh = $GDCubismUserModel.get_meshes() 101 + var ary: PackedVector2Array 102 + 103 + for name in CONVEX_MESH_SRC: 104 + ary += dict_mesh[name].get_mesh().surface_get_arrays(0)[Mesh.ARRAY_VERTEX] 105 + 106 + var ary_polygon = convex_hull(ary) 107 + 108 + if ary_polygon.size() > 2: 109 + var region: PackedVector2Array 110 + var adjust: Vector2 = get_viewport_rect().size 111 + 112 + for v in ary_polygon: 113 + v *= $GDCubismUserModel.scale 114 + v += $GDCubismUserModel.position 115 + region.append(v) 116 + 117 + $Polygon2D.polygon = PackedVector2Array(region) 118 + 119 + 120 + func _input(event): 121 + if event is InputEventKey: 122 + if event.is_pressed() == true: 123 + 124 + if event.keycode == KEY_ESCAPE: 125 + get_tree().quit() 126 + 127 + if event.keycode == KEY_SPACE: 128 + var motion = ary_character_motion[randi_range(0, ary_character_motion.size() - 1)] 129 + $GDCubismUserModel.start_motion_loop( 130 + motion.group, 131 + motion.no, 132 + GDCubismUserModel.PRIORITY_FORCE, 133 + true, 134 + true 135 + ) 136 + if event.keycode == KEY_TAB: 137 + if enable_transparent == true: 138 + enable_transparent = false 139 + DisplayServer.window_set_mouse_passthrough([]) 140 + else: 141 + enable_transparent = true 142 + DisplayServer.window_set_mouse_passthrough($Polygon2D.polygon) 143 + get_tree().root.transparent_bg = enable_transparent 144 + DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, enable_transparent, 0) 145 + DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_ALWAYS_ON_TOP, true, 0) 146 + 147 + if event.keycode >= KEY_0 and event.keycode <= KEY_9: 148 + var index: int = event.keycode - KEY_0 149 + if index < ary_character_expression.size(): 150 + $GDCubismUserModel.start_expression( 151 + ary_character_expression[index] 152 + ) 153 + 154 + if event is InputEventMouseButton: 155 + if event.pressed == true: 156 + window_position = DisplayServer.window_get_position() 157 + mouse_position = get_viewport().get_mouse_position() 158 + else: 159 + get_viewport().warp_mouse(mouse_position) 160 + mouse_button_pressed = event.pressed 161 + 162 + if event is InputEventMouseMotion: 163 + if mouse_button_pressed == true: 164 + order_window_position = true 165 + window_position += Vector2i(event.relative)
+28
miniview/addons/gd_cubism/example/demo_transparent.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://7hglgm6o0ou4"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_transparent.gd" id="1_v7gdn"] 4 + 5 + [node name="demo_transparent" type="Node2D"] 6 + script = ExtResource("1_v7gdn") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectBreath" type="GDCubismEffectBreath" parent="GDCubismUserModel"] 11 + 12 + [node name="GDCubismEffectEyeBlink" type="GDCubismEffectEyeBlink" parent="GDCubismUserModel"] 13 + 14 + [node name="Polygon2D" type="Polygon2D" parent="."] 15 + z_index = 1024 16 + color = Color(1, 0, 0, 0.498039) 17 + 18 + [node name="lbl_usage" type="Label" parent="."] 19 + offset_left = 960.0 20 + offset_top = 16.0 21 + offset_right = 1262.0 22 + offset_bottom = 146.0 23 + text = "TAB Key: Window transparent. 24 + SPACE Key: Change motion. 25 + 0 - 9 Key: Change expression. 26 + 27 + Mouse buttn drag: Window move." 28 + horizontal_alignment = 2
+2
miniview/addons/gd_cubism/example/res/live2d/.gitignore
··· 1 + * 2 + !.gitignore
+137
miniview/addons/gd_cubism/example/viewer.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class viewer : Control 11 + { 12 + const bool ENABLE_MOTION_FINISHED = true; 13 + 14 + GDCubismUserModelCS cubism_model; 15 + Godot.Collections.Dictionary last_motion; 16 + 17 + private void recalc_model_position(GDCubismUserModelCS model) 18 + { 19 + if(model.Assets == "") return; 20 + 21 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 22 + 23 + if(canvas_info.Count > 0) 24 + { 25 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 26 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 27 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 28 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 29 + model.GetInternalObject().Scale = new(scale, scale); 30 + } 31 + } 32 + 33 + public void Setup(String pathname) 34 + { 35 + this.cubism_model.Assets = pathname; 36 + 37 + this.recalc_model_position(this.cubism_model); 38 + 39 + int idx = 0; 40 + Godot.Collections.Dictionary<String, int> dict_motion = this.cubism_model.GetMotions(); 41 + GetNode<ItemList>("UI/ItemListMotion").Clear(); 42 + foreach (var (k, item_count) in dict_motion) 43 + { 44 + for (int v = 0; v < item_count; v++) 45 + { 46 + GetNode<ItemList>("UI/ItemListMotion").AddItem($"{k}_{v}"); 47 + GetNode<ItemList>("UI/ItemListMotion").SetItemMetadata( 48 + idx, 49 + new Godot.Collections.Dictionary { { "group", k }, { "no", v } } 50 + ); 51 + idx++; 52 + } 53 + } 54 + 55 + GetNode<ItemList>("UI/ItemListExpression").Clear(); 56 + Godot.Collections.Array<String> ary_item = this.cubism_model.GetExpressions(); 57 + foreach (var item in ary_item) 58 + { 59 + GetNode<ItemList>("UI/ItemListExpression").AddItem($"{item}"); 60 + } 61 + 62 + this.cubism_model.PlaybackProcessMode = GDCubismUserModelCS.MotionProcessCallbackEnum.Idle; 63 + } 64 + 65 + public void Model3Search(String dirname) 66 + { 67 + DirAccess dir = DirAccess.Open(dirname); 68 + if (dir == null) return; 69 + 70 + dir.ListDirBegin(); 71 + var name = dir.GetNext(); 72 + 73 + while (name != "") 74 + { 75 + if (dir.CurrentIsDir()) 76 + { 77 + Model3Search(dirname.PathJoin(name)); 78 + } 79 + else 80 + { 81 + if (name.EndsWith(".model3.json")) 82 + { 83 + GD.Print(dirname.PathJoin(name)); 84 + GetNode<OptionButton>("UI/OptModel").AddItem(dirname.PathJoin(name)); 85 + } 86 + } 87 + name = dir.GetNext(); 88 + } 89 + } 90 + 91 + public override void _Ready() 92 + { 93 + this.cubism_model = new GDCubismUserModelCS(); 94 + this.AddChild(this.cubism_model.GetInternalObject()); 95 + 96 + if (ENABLE_MOTION_FINISHED == true) 97 + { 98 + this.cubism_model.MotionFinished += this._on_motion_finished; 99 + } 100 + 101 + GetNode<OptionButton>("UI/OptModel").Clear(); 102 + GetNode<OptionButton>("UI/OptModel").AddItem(""); 103 + Model3Search("res://addons/gd_cubism/example/res/live2d"); 104 + } 105 + 106 + private void _on_motion_finished() 107 + { 108 + this.cubism_model.StartMotion( 109 + (String)this.last_motion["group"], 110 + (int)this.last_motion["no"], 111 + GDCubismUserModelCS.PriorityEnum.PriorityForce 112 + ); 113 + } 114 + 115 + public void _on_opt_model_item_selected(long index) 116 + { 117 + Setup(GetNode<OptionButton>("UI/OptModel").GetItemText((int)index)); 118 + } 119 + 120 + private void _on_item_list_motion_item_selected(long index) 121 + { 122 + var _motion = GetNode<ItemList>("UI/ItemListMotion").GetItemMetadata((int)index); 123 + Godot.Collections.Dictionary motion = (Godot.Collections.Dictionary)_motion; 124 + this.cubism_model.StartMotion( 125 + (String)motion["group"], 126 + (int)motion["no"], 127 + GDCubismUserModelCS.PriorityEnum.PriorityForce 128 + ); 129 + this.last_motion = motion; 130 + } 131 + 132 + public void _on_item_list_expression_item_selected(long index) 133 + { 134 + var _expression_id = GetNode<ItemList>("UI/ItemListExpression").GetItemText((int)index); 135 + this.cubism_model.StartExpression((String)_expression_id); 136 + } 137 + }
+96
miniview/addons/gd_cubism/example/viewer.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Control 4 + 5 + 6 + const ENABLE_MOTION_FINISHED := true 7 + 8 + var cubism_model: GDCubismUserModel 9 + var last_motion = null 10 + 11 + 12 + func recalc_model_position(model: GDCubismUserModel): 13 + if model.assets == "": 14 + return 15 + 16 + var canvas_info: Dictionary = model.get_canvas_info() 17 + 18 + if canvas_info.is_empty() != true: 19 + var vct_viewport_size = Vector2(get_viewport_rect().size) 20 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 21 + model.position = vct_viewport_size / 2.0 22 + model.scale = Vector2(scale, scale) 23 + 24 + 25 + func setup(pathname: String): 26 + cubism_model.assets = pathname 27 + 28 + recalc_model_position(cubism_model) 29 + 30 + var idx: int = 0 31 + var dict_motion = cubism_model.get_motions() 32 + $UI/ItemListMotion.clear() 33 + for k in dict_motion: 34 + for v in range(dict_motion[k]): 35 + $UI/ItemListMotion.add_item("{0}_{1}".format([k, v])) 36 + $UI/ItemListMotion.set_item_metadata(idx, {"group": k, "no": v}) 37 + idx += 1 38 + 39 + $UI/ItemListExpression.clear() 40 + for item in cubism_model.get_expressions(): 41 + $UI/ItemListExpression.add_item(item) 42 + 43 + cubism_model.playback_process_mode = GDCubismUserModel.IDLE 44 + 45 + 46 + func model3_search(dirname: String): 47 + 48 + var dir: DirAccess = DirAccess.open(dirname) 49 + if dir == null: 50 + return 51 + 52 + dir.list_dir_begin() 53 + var name = dir.get_next() 54 + while name != "": 55 + if dir.current_is_dir(): 56 + model3_search(dirname.path_join(name)) 57 + else: 58 + if name.ends_with(".model3.json"): 59 + print(dirname.path_join(name)) 60 + $UI/OptModel.add_item(dirname.path_join(name)) 61 + name = dir.get_next() 62 + 63 + 64 + func _ready(): 65 + cubism_model = GDCubismUserModel.new() 66 + self.add_child(cubism_model) 67 + 68 + if ENABLE_MOTION_FINISHED == true: 69 + cubism_model.motion_finished.connect(_on_motion_finished) 70 + 71 + $UI/OptModel.clear() 72 + $UI/OptModel.add_item("") 73 + model3_search("res://addons/gd_cubism/example/res/live2d") 74 + 75 + 76 + func _on_motion_finished(): 77 + cubism_model.start_motion( 78 + last_motion.group, 79 + last_motion.no, 80 + GDCubismUserModel.PRIORITY_FORCE 81 + ) 82 + 83 + 84 + func _on_opt_model_item_selected(index): 85 + setup($UI/OptModel.get_item_text(index)) 86 + 87 + 88 + func _on_item_list_motion_item_selected(index): 89 + var motion = $UI/ItemListMotion.get_item_metadata(index) 90 + var m = cubism_model.start_motion(motion.group, motion.no, GDCubismUserModel.PRIORITY_FORCE) 91 + last_motion = motion 92 + 93 + 94 + func _on_item_list_expression_item_selected(index): 95 + var expression_id = $UI/ItemListExpression.get_item_text(index) 96 + cubism_model.start_expression(expression_id)
+63
miniview/addons/gd_cubism/example/viewer.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://dy5erb1lkxh7t"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/viewer.gd" id="1_wysar"] 4 + 5 + [node name="viewer" type="Control"] 6 + layout_mode = 3 7 + anchors_preset = 15 8 + anchor_right = 1.0 9 + anchor_bottom = 1.0 10 + grow_horizontal = 2 11 + grow_vertical = 2 12 + script = ExtResource("1_wysar") 13 + metadata/_edit_lock_ = true 14 + 15 + [node name="UI" type="Control" parent="."] 16 + layout_mode = 1 17 + anchors_preset = 15 18 + anchor_right = 1.0 19 + anchor_bottom = 1.0 20 + grow_horizontal = 2 21 + grow_vertical = 2 22 + 23 + [node name="OptModel" type="OptionButton" parent="UI"] 24 + layout_mode = 1 25 + anchors_preset = 10 26 + anchor_right = 1.0 27 + offset_left = 16.0 28 + offset_top = 16.0 29 + offset_right = -16.0 30 + offset_bottom = 48.0 31 + grow_horizontal = 2 32 + 33 + [node name="ItemListMotion" type="ItemList" parent="UI"] 34 + layout_mode = 1 35 + anchors_preset = 3 36 + anchor_left = 1.0 37 + anchor_top = 1.0 38 + anchor_right = 1.0 39 + anchor_bottom = 1.0 40 + offset_left = -256.0 41 + offset_top = -392.0 42 + offset_right = -16.0 43 + offset_bottom = -201.0 44 + grow_horizontal = 0 45 + grow_vertical = 0 46 + 47 + [node name="ItemListExpression" type="ItemList" parent="UI"] 48 + layout_mode = 1 49 + anchors_preset = 3 50 + anchor_left = 1.0 51 + anchor_top = 1.0 52 + anchor_right = 1.0 53 + anchor_bottom = 1.0 54 + offset_left = -256.0 55 + offset_top = -184.0 56 + offset_right = -16.0 57 + offset_bottom = -57.0 58 + grow_horizontal = 0 59 + grow_vertical = 0 60 + 61 + [connection signal="item_selected" from="UI/OptModel" to="." method="_on_opt_model_item_selected"] 62 + [connection signal="item_selected" from="UI/ItemListMotion" to="." method="_on_item_list_motion_item_selected"] 63 + [connection signal="item_selected" from="UI/ItemListExpression" to="." method="_on_item_list_expression_item_selected"]
+18
miniview/addons/gd_cubism/gd_cubism.gdextension
··· 1 + [configuration] 2 + entry_symbol = "gd_cubism_library_init" 3 + compatibility_minimum = "4.4" 4 + 5 + [libraries] 6 + macos.debug = "res://addons/gd_cubism/bin/macos/libgd_cubism.macos.debug.framework" 7 + macos.release = "res://addons/gd_cubism/bin/macos/libgd_cubism.macos.release.framework" 8 + windows.debug.x86_64 = "res://addons/gd_cubism/bin/windows/x86_64/libgd_cubism.windows.debug.x86_64.dll" 9 + windows.release.x86_64 = "res://addons/gd_cubism/bin/windows/x86_64/libgd_cubism.windows.release.x86_64.dll" 10 + linux.debug.x86_64 = "res://addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" 11 + linux.release.x86_64 = "res://addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" 12 + ios.debug = "res://addons/gd_cubism/bin/ios/libgd_cubism.ios.debug.dylib" 13 + ios.release = "res://addons/gd_cubism/bin/ios/libgd_cubism.ios.release.dylib" 14 + android.debug.arm32 = "res://addons/gd_cubism/bin/android/arm32/libgd_cubism.android.debug.arm32.so" 15 + android.release.arm32 = "res://addons/gd_cubism/bin/android/arm32/libgd_cubism.android.release.arm32.so" 16 + android.debug.arm64 = "res://addons/gd_cubism/bin/android/arm64/libgd_cubism.android.debug.arm64.so" 17 + android.release.arm64 = "res://addons/gd_cubism/bin/android/arm64/libgd_cubism.android.release.arm64.so" 18 +
+10
miniview/addons/gd_cubism/res/shader/2d_cubism_mask.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mask 4 + shader_type canvas_item; 5 + render_mode blend_mix, unshaded; 6 + 7 + void fragment() { 8 + vec4 color_tex = texture(TEXTURE, UV); 9 + COLOR = vec4(0,0,0,color_tex.a); 10 + }
+33
miniview/addons/gd_cubism/res/shader/2d_cubism_norm_add.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_premul_alpha, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = (color_tex.rgb + color_screen.rgb) - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base) * modulate; 27 + COLOR = vec4(color_for_mask.rgb, 0.0); 28 + } else { 29 + // premul alpha 30 + vec4 color = color_tex * color_base * modulate; 31 + COLOR = vec4(color.rgb * color.a, 0.0); 32 + } 33 + }
+33
miniview/addons/gd_cubism/res/shader/2d_cubism_norm_mix.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_premul_alpha, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = (color_tex.rgb + color_screen.rgb) - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base); 27 + COLOR = color_for_mask * modulate; 28 + } else { 29 + // premul alpha 30 + vec4 color = color_tex * color_base * modulate; 31 + COLOR = vec4(color.rgb * color.a, color.a); 32 + } 33 + }
+38
miniview/addons/gd_cubism/res/shader/2d_cubism_norm_mul.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_mul, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = color_tex.rgb + color_screen.rgb - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base); 27 + COLOR = vec4( 28 + color_for_mask.r + (1.0 - color_for_mask.a), 29 + color_for_mask.g + (1.0 - color_for_mask.a), 30 + color_for_mask.b + (1.0 - color_for_mask.a), 31 + 1.0 32 + ) * modulate; 33 + } else { 34 + // premul alpha 35 + vec4 color = color_tex * color_base * modulate; 36 + COLOR = vec4(color.rgb * color.a, color.a); 37 + } 38 + }
+47
miniview/addons/gd_cubism/res/shader/cubism_mask.gdshaderinc
··· 1 + // masking 2 + instance uniform bool has_mask = false; 3 + instance uniform bool invert; 4 + uniform sampler2D tex_mask : filter_linear_mipmap, repeat_disable; 5 + uniform float mask_scale = 1.0; 6 + uniform vec2 canvas_size = vec2(2,2); 7 + uniform vec2 mesh_offset = vec2(0,0); 8 + 9 + varying vec2 MASK_UV; 10 + varying vec4 modulate; 11 + 12 + bool discard_mask() { 13 + if(has_mask) { 14 + if (MASK_UV.x > 1.0 || MASK_UV.y > 1.0 || MASK_UV.x < 0.0 || MASK_UV.y < 0.0) { 15 + return true; 16 + } 17 + } 18 + return false; 19 + } 20 + 21 + vec2 mask_uv(vec2 vtx) { 22 + if (!has_mask) { 23 + return vec2(0,0); 24 + } 25 + 26 + vec2 mask_size = vec2(textureSize(tex_mask, 0)) / mask_scale; 27 + vec2 mask_vtx = vtx - mesh_offset; 28 + return mask_vtx / mask_size; 29 + } 30 + 31 + vec4 sample_mask(vec4 color_tex, vec4 base) { 32 + vec4 color_for_mask = color_tex * base; 33 + color_for_mask.rgb = color_for_mask.rgb * color_for_mask.a; 34 + 35 + vec4 clip_mask = texture(tex_mask, MASK_UV) * vec4(0,0,0,1); 36 + 37 + float mask_val = clip_mask.r + clip_mask.g + clip_mask.b + clip_mask.a; 38 + if (invert) { 39 + mask_val = 1.0 - mask_val; 40 + } 41 + return color_for_mask * mask_val; 42 + } 43 + 44 + void vertex() { 45 + MASK_UV = mask_uv(VERTEX.xy); 46 + modulate = COLOR; 47 + }
+24
miniview/project.godot
··· 1 + ; Engine configuration file. 2 + ; Minimal Cubism viewer project. 3 + 4 + config_version=5 5 + 6 + [application] 7 + 8 + config/name="mini-cubism-viewer" 9 + run/main_scene="res://addons/gd_cubism/example/viewer.tscn" 10 + config/features=PackedStringArray("4.3", "Forward Plus") 11 + config/icon="res://addons/gd_cubism/example/icon.svg" 12 + 13 + [display] 14 + 15 + window/size/viewport_width=1280 16 + window/size/viewport_height=720 17 + window/stretch/mode="canvas_items" 18 + window/per_pixel_transparency/allowed=true 19 + 20 + [physics] 21 + 22 + common/physics_ticks_per_second=120 23 + 24 + [autoload]
+11
package.json
··· 1 + { 2 + "name": "character", 3 + "version": "0.0.1", 4 + "private": true, 5 + "type": "module", 6 + "scripts": { 7 + "dev": "bun run src/index.ts", 8 + "simulate": "bun run scripts/simulate-chat.ts", 9 + "check": "bun run src/index.ts --help" 10 + } 11 + }
+29
scripts/miniview-launch.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" 5 + VIEWER_DIR="$ROOT_DIR/miniview" 6 + OPENVT_DIR="$ROOT_DIR/vendor/open-vt" 7 + 8 + export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" 9 + export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}" 10 + 11 + if [ ! -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then 12 + echo "Wayland socket not found: $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" 13 + exit 1 14 + fi 15 + 16 + mkdir -p "$VIEWER_DIR/addons" 17 + 18 + rm -rf "$VIEWER_DIR/addons/gd_cubism" 19 + cp -R "$OPENVT_DIR/thirdparty/gd_cubism/demo/addons/gd_cubism" "$VIEWER_DIR/addons/gd_cubism" 20 + 21 + mkdir -p "$VIEWER_DIR/addons/gd_cubism/bin/linux/x86_64" 22 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" "$VIEWER_DIR/addons/gd_cubism/bin/linux/x86_64/" 23 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libLive2DCubismCore.so" "$VIEWER_DIR/addons/gd_cubism/bin/linux/x86_64/" 24 + 25 + mkdir -p "$VIEWER_DIR/addons/gd_cubism/example/res/live2d/Haru" 26 + rm -rf "$VIEWER_DIR/addons/gd_cubism/example/res/live2d/Haru" 27 + cp -R /home/nandi/.local/share/godot/app_userdata/open-vt/Live2DModels/Haru "$VIEWER_DIR/addons/gd_cubism/example/res/live2d/Haru" 28 + 29 + exec godot4 --path "$VIEWER_DIR"
+40
scripts/openvt-build-local.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" 5 + OPENVT_DIR="$ROOT_DIR/vendor/open-vt" 6 + 7 + if [ ! -d "$OPENVT_DIR" ]; then 8 + echo "OpenVT source not found at $OPENVT_DIR" 9 + echo "Run ./scripts/openvt-setup.sh first" 10 + exit 1 11 + fi 12 + 13 + cd "$OPENVT_DIR" 14 + 15 + echo "Building OpenVT dependencies with local, non-mutating environment shims" 16 + 17 + mkdir -p "$HOME/.local/bin" 18 + cat > "$HOME/.local/bin/pyenv" <<'EOF' 19 + #!/usr/bin/env bash 20 + exit 0 21 + EOF 22 + chmod +x "$HOME/.local/bin/pyenv" 23 + 24 + export PATH="$HOME/.local/bin:$PATH" 25 + export PIP_BREAK_SYSTEM_PACKAGES=1 26 + export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc 27 + export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++ 28 + export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc 29 + 30 + if command -v rustup >/dev/null 2>&1; then 31 + rustup target add x86_64-pc-windows-gnu || true 32 + fi 33 + 34 + mkdir -p addons/gd-virtualcamera addons/keylogger 35 + 36 + ./build_dependencies.sh || true 37 + 38 + echo 39 + echo "Post-build status:" 40 + find addons -maxdepth 3 -type f | sort
+29
scripts/openvt-run-notes.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + cat <<'EOF' 5 + Suggested simple streaming path: 6 + 7 + 1. Enter the dev shell 8 + devenv shell 9 + 10 + 2. Fetch OpenVT source 11 + ./scripts/openvt-setup.sh 12 + 13 + 3. Build upstream dependencies 14 + cd vendor/open-vt 15 + ./build_dependencies.sh 16 + 17 + 4. Open in Godot 4.6+ 18 + godot4 --path . 19 + 20 + 5. In OBS 21 + - add Window Capture for the OpenVT window 22 + - preserve transparency if available 23 + - add mic / TTS audio sources 24 + 25 + 6. Stream to stream.place 26 + - use WHIP if available in your setup 27 + - otherwise use the platform's supported ingest path 28 + 29 + EOF
+43
scripts/openvt-setup.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" 5 + VENDOR_DIR="$ROOT_DIR/vendor" 6 + OPENVT_DIR="$VENDOR_DIR/open-vt" 7 + 8 + mkdir -p "$VENDOR_DIR" 9 + 10 + if ! command -v git >/dev/null 2>&1; then 11 + echo "git is required" 12 + exit 1 13 + fi 14 + 15 + if ! command -v godot4 >/dev/null 2>&1 && ! command -v godot >/dev/null 2>&1; then 16 + echo "Godot 4 is required. Enter devenv or install godot_4 first." 17 + exit 1 18 + fi 19 + 20 + if [ ! -d "$OPENVT_DIR/.git" ]; then 21 + git clone https://github.com/erodozer/open-vt "$OPENVT_DIR" 22 + fi 23 + 24 + git -C "$OPENVT_DIR" submodule update --init --recursive 25 + 26 + cat <<'EOF' 27 + 28 + OpenVT source is present at: 29 + vendor/open-vt 30 + 31 + Next manual steps: 32 + 1. cd vendor/open-vt 33 + 2. inspect thirdparty/ readmes and licensing requirements 34 + 3. run ./build_dependencies.sh 35 + 4. open the project in Godot 4.6+ 36 + 5. load a model and verify local rendering 37 + 38 + Notes: 39 + - Full Live2D support may require proprietary Cubism components. 40 + - OpenSeeFace is separate if you want webcam tracking. 41 + - This script intentionally does not fake or skip upstream dependency steps. 42 + 43 + EOF
+27
scripts/openvt-wayland-launch.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" 5 + OPENVT_DIR="$ROOT_DIR/vendor/open-vt" 6 + 7 + export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" 8 + export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}" 9 + 10 + if [ ! -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then 11 + echo "Wayland socket not found: $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" 12 + echo "Make sure the sway/Wayland session is running before launching OpenVT." 13 + exit 1 14 + fi 15 + 16 + if [ ! -d "$OPENVT_DIR" ]; then 17 + echo "OpenVT checkout missing at $OPENVT_DIR" 18 + exit 1 19 + fi 20 + 21 + cd "$OPENVT_DIR" 22 + 23 + echo "Launching OpenVT in existing Wayland session" 24 + echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" 25 + echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY" 26 + 27 + exec godot4 --path "$OPENVT_DIR"
+10
scripts/simulate-chat.ts
··· 1 + import { handleMessage } from '../src/index'; 2 + 3 + const sample = { 4 + author: 'viewer1', 5 + text: 'hello little creature what do you think about decentralized streaming?', 6 + timestamp: new Date().toISOString() 7 + }; 8 + 9 + const result = handleMessage(sample); 10 + console.log(JSON.stringify({ input: sample, output: result }, null, 2));
+79
scripts/test-cubism.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" 5 + PROBE_DIR="$ROOT_DIR/tests/cubism-probe" 6 + CONTROL_DIR="$ROOT_DIR/tests/gdextension-control" 7 + OPENVT_DIR="$ROOT_DIR/vendor/open-vt" 8 + ADDON_DIR="$PROBE_DIR/addons/gd_cubism" 9 + LIB_DIR="$ADDON_DIR/bin/linux/x86_64" 10 + MODEL_PATH="/home/nandi/.local/share/godot/app_userdata/open-vt/Live2DModels/Haru/Haru.model3.json" 11 + 12 + export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" 13 + export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}" 14 + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}" 15 + 16 + pass() { echo "PASS: $1"; } 17 + fail() { echo "FAIL: $1"; } 18 + 19 + mkdir -p "$PROBE_DIR/addons" 20 + rm -rf "$ADDON_DIR" 21 + cp -R "$OPENVT_DIR/thirdparty/gd_cubism/demo/addons/gd_cubism" "$ADDON_DIR" 22 + mkdir -p "$LIB_DIR" 23 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" "$LIB_DIR/" 24 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libLive2DCubismCore.so" "$LIB_DIR/" 25 + 26 + if [ -f "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" ]; then 27 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" "$LIB_DIR/" 28 + else 29 + cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" "$LIB_DIR/libgd_cubism.linux.release.x86_64.so" 30 + fi 31 + 32 + test -f "$ADDON_DIR/gd_cubism.gdextension" && pass "gdextension file present" || fail "gdextension file missing" 33 + test -f "$LIB_DIR/libgd_cubism.linux.debug.x86_64.so" && pass "gd_cubism binary present" || fail "gd_cubism binary missing" 34 + test -f "$LIB_DIR/libgd_cubism.linux.release.x86_64.so" && pass "gd_cubism release binary present" || fail "gd_cubism release binary missing" 35 + test -f "$LIB_DIR/libLive2DCubismCore.so" && pass "Cubism core binary present" || fail "Cubism core binary missing" 36 + test -f "$MODEL_PATH" && pass "Haru model present" || fail "Haru model missing" 37 + 38 + echo "--- Control case ---" 39 + mkdir -p "$CONTROL_DIR/bin" 40 + cp "$ROOT_DIR/tests/gdextension-control-src/example.gdextension" "$CONTROL_DIR/example.gdextension" 41 + devenv shell -- bash -lc 'c++ -shared -fPIC -std=c++17 \ 42 + -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/include \ 43 + -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/gen/include \ 44 + -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/gdextension \ 45 + /home/nandi/code/character/tests/gdextension-control-src/example.cpp \ 46 + /home/nandi/code/character/tests/gdextension-control-src/register_types.cpp \ 47 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/godot.cpp \ 48 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/class_db.cpp \ 49 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/error_macros.cpp \ 50 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/memory.cpp \ 51 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/method_bind.cpp \ 52 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/object.cpp \ 53 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/variant/variant.cpp \ 54 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/print_string.cpp \ 55 + /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/variant/variant_internal.cpp \ 56 + -o /home/nandi/code/character/tests/gdextension-control/bin/libgdext_control.linux.template_debug.x86_64.so' 57 + cp "$CONTROL_DIR/bin/libgdext_control.linux.template_debug.x86_64.so" "$CONTROL_DIR/bin/libgdext_control.linux.template_release.x86_64.so" 58 + 59 + if ldd "$LIB_DIR/libgd_cubism.linux.debug.x86_64.so" | grep -q 'not found'; then 60 + fail "gd_cubism binary has missing shared library deps" 61 + else 62 + pass "gd_cubism binary shared library deps resolved" 63 + fi 64 + 65 + if ldd "$LIB_DIR/libLive2DCubismCore.so" | grep -q 'not found'; then 66 + fail "Cubism core binary has missing shared library deps" 67 + else 68 + pass "Cubism core shared library deps resolved" 69 + fi 70 + 71 + echo "--- Godot probe ---" 72 + echo "Using Godot binary: ${GODOT4_BIN:-godot4}" 73 + "${GODOT4_BIN:-godot4}" --headless --path "$PROBE_DIR" --quit-after 1 2>&1 | tee "$PROBE_DIR/probe.log" 74 + 75 + echo "--- GDExtension control probe ---" 76 + "${GODOT4_BIN:-godot4}" --headless --path "$CONTROL_DIR" --quit-after 1 2>&1 | tee "$CONTROL_DIR/probe.log" 77 + 78 + echo "--- Extension file sanity ---" 79 + grep -n . "$ADDON_DIR/gd_cubism.gdextension" | sed -n '1,120p'
+39
src/index.ts
··· 1 + type ChatMessage = { 2 + author: string; 3 + text: string; 4 + timestamp: string; 5 + }; 6 + 7 + type AvatarAction = 8 + | { type: 'talk:start' } 9 + | { type: 'talk:stop' } 10 + | { type: 'emotion'; value: 'neutral' | 'happy' | 'excited' | 'curious' } 11 + | { type: 'gesture'; value: 'nod' | 'wave' | 'tilt' }; 12 + 13 + function usage() { 14 + console.log(`character\n\nUsage:\n bun run src/index.ts\n bun run scripts/simulate-chat.ts`); 15 + } 16 + 17 + function planAvatarActions(reply: string): AvatarAction[] { 18 + const lower = reply.toLowerCase(); 19 + return [ 20 + { type: 'talk:start' }, 21 + { type: 'emotion', value: lower.includes('!') ? 'excited' : lower.includes('?') ? 'curious' : 'happy' }, 22 + { type: 'gesture', value: lower.includes('?') ? 'tilt' : 'nod' }, 23 + { type: 'talk:stop' } 24 + ]; 25 + } 26 + 27 + export function handleMessage(message: ChatMessage) { 28 + const reply = `Hey ${message.author} — I heard: ${message.text}`; 29 + const actions = planAvatarActions(reply); 30 + return { reply, actions }; 31 + } 32 + 33 + if (process.argv.includes('--help')) { 34 + usage(); 35 + process.exit(0); 36 + } 37 + 38 + console.log('character runtime scaffold ready'); 39 + console.log('next: wire stream.place chat, TTS, avatar renderer, and stream uplink');
+2
tests/cubism-probe/addons/gd_cubism/bin/.gitignore
··· 1 + * 2 + !.gitignore
+52
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_effect_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismEffectCS : Node 10 + { 11 + private static readonly StringName NativeName = "GDCubismEffect"; 12 + 13 + protected Node InternalObject = null; 14 + 15 + public GDCubismEffectCS() 16 + { 17 + this.InternalObject = (SubViewport)Godot.ClassDB.Instantiate(NativeName); 18 + } 19 + 20 + public GDCubismEffectCS(Node o) 21 + { 22 + this.InternalObject = o; 23 + } 24 + 25 + public Node GetInternalObject() 26 + { 27 + return this.InternalObject; 28 + } 29 + 30 + public void Attach(Node o) 31 + { 32 + this.InternalObject = o; 33 + } 34 + 35 + public Node Detach() 36 + { 37 + Node o = this.InternalObject; 38 + this.InternalObject = null; 39 + return o; 40 + } 41 + 42 + // ------------------------------------------------------------ Property(s) 43 + 44 + public bool Active 45 + { 46 + set { this.InternalObject.Call("set_active", (bool)value); } 47 + get { return (bool)this.InternalObject.Call("get_active"); } 48 + } 49 + 50 + // -------------------------------------------------------------- Method(s) 51 + // -------------------------------------------------------------- Signal(s) 52 + }
+108
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_effect_custom_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using Godot.NativeInterop; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectCustomCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectCustom"; 13 + 14 + public GDCubismEffectCustomCS(Node o) : base(o) { } 15 + 16 + public static readonly StringName CubismEpilogueName = "cubism_epilogue"; 17 + public static readonly StringName CubismInitName = "cubism_init"; 18 + public static readonly StringName CubismProcessName = "cubism_process"; 19 + public static readonly StringName CubismPrologueName = "cubism_prologue"; 20 + public static readonly StringName CubismTermName = "cubism_term"; 21 + 22 + // ------------------------------------------------------------ Property(s) 23 + // -------------------------------------------------------------- Method(s) 24 + // -------------------------------------------------------------- Signal(s) 25 + 26 + public delegate void CubismEpilogueEventHandler(Node2D value, double delta); 27 + 28 + private static void CubismEpilogueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 29 + { 30 + ((CubismEpilogueEventHandler)delegateObj)( 31 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 32 + VariantUtils.ConvertToFloat32(args[1]) 33 + ); 34 + ret = default; 35 + } 36 + 37 + public unsafe event CubismEpilogueEventHandler CubismEpilogue 38 + { 39 + add => this.InternalObject.Connect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline)); 40 + remove => this.InternalObject.Disconnect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline)); 41 + } 42 + 43 + public delegate void CubismInitEventHandler(Node2D value); 44 + 45 + private static void CubismInitrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 46 + { 47 + ((CubismInitEventHandler)delegateObj)( 48 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D 49 + ); 50 + ret = default; 51 + } 52 + 53 + public unsafe event CubismInitEventHandler CubismInit 54 + { 55 + add => this.InternalObject.Connect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline)); 56 + remove => this.InternalObject.Disconnect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline)); 57 + } 58 + 59 + public delegate void CubsimPrologueEventHandler(Node2D value, double delta); 60 + 61 + private static void CubismPrologueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 62 + { 63 + ((CubsimPrologueEventHandler)delegateObj)( 64 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 65 + VariantUtils.ConvertToFloat32(args[1]) 66 + ); 67 + ret = default; 68 + } 69 + 70 + public unsafe event CubsimPrologueEventHandler CubismPrologue 71 + { 72 + add => this.InternalObject.Connect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline)); 73 + remove => this.InternalObject.Disconnect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline)); 74 + } 75 + 76 + public delegate void CubismProcessEventHandler(Node2D value, double delta); 77 + 78 + private static void CubismProcessTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 79 + { 80 + ((CubismProcessEventHandler)delegateObj)( 81 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D, 82 + VariantUtils.ConvertToFloat32(args[1]) 83 + ); 84 + ret = default; 85 + } 86 + 87 + public unsafe event CubismProcessEventHandler CubismProcess 88 + { 89 + add => this.InternalObject.Connect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline)); 90 + remove => this.InternalObject.Disconnect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline)); 91 + } 92 + 93 + public delegate void CubismTermEventHandler(Node2D value); 94 + 95 + private static void CubismTermrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 96 + { 97 + ((CubismTermEventHandler)delegateObj)( 98 + VariantUtils.ConvertToGodotObject(args[0]) as Node2D 99 + ); 100 + ret = default; 101 + } 102 + 103 + public unsafe event CubismTermEventHandler CubismTerm 104 + { 105 + add => this.InternalObject.Connect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline)); 106 + remove => this.InternalObject.Disconnect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline)); 107 + } 108 + }
+42
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_effect_hit_area_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectHitAreaCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectHitArea"; 13 + 14 + public GDCubismEffectHitAreaCS(Node o) : base(o) { } 15 + 16 + // ------------------------------------------------------------ Property(s) 17 + 18 + public bool Monitoring 19 + { 20 + set { this.InternalObject.Call("set_monitoring", (bool)value); } 21 + get { return (bool)this.InternalObject.Call("set_monitoring"); } 22 + } 23 + 24 + // -------------------------------------------------------------- Method(s) 25 + 26 + public void SetTarget(Vector2 v) 27 + { 28 + this.InternalObject.Call("set_target", v); 29 + } 30 + 31 + public Vector2 GetTarget() 32 + { 33 + return (Vector2)this.InternalObject.Call("get_target"); 34 + } 35 + 36 + public Godot.Collections.Dictionary GetDetail(GDCubismUserModelCS model, String id) 37 + { 38 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_detail", model.GetInternalObject(), id); 39 + } 40 + 41 + // -------------------------------------------------------------- Signal(s) 42 + }
+85
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_effect_target_point_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismEffectTargetPointCS : GDCubismEffectCS 11 + { 12 + private static readonly StringName NativeName = "GDCubismEffectTargetPoint"; 13 + 14 + public GDCubismEffectTargetPointCS(Node o) : base(o) { } 15 + 16 + // ------------------------------------------------------------ Property(s) 17 + 18 + public String HeadAngleX 19 + { 20 + set { this.InternalObject.Call("set_head_angle_x", (String)value); } 21 + get { return (String)this.InternalObject.Call("get_head_angle_x"); } 22 + } 23 + 24 + public String HeadAngleY 25 + { 26 + set { this.InternalObject.Call("set_head_angle_y", (String)value); } 27 + get { return (String)this.InternalObject.Call("get_head_angle_y"); } 28 + } 29 + 30 + public String HeadAngleZ 31 + { 32 + set { this.InternalObject.Call("set_head_angle_z", (String)value); } 33 + get { return (String)this.InternalObject.Call("get_head_angle_z"); } 34 + } 35 + 36 + public float HeadRange 37 + { 38 + set { this.InternalObject.Call("set_head_range", (float)value); } 39 + get { return (float)this.InternalObject.Call("get_head_range"); } 40 + } 41 + 42 + public String BodyAngleX 43 + { 44 + set { this.InternalObject.Call("set_body_angle_x", (String)value); } 45 + get { return (String)this.InternalObject.Call("get_body_angle_x"); } 46 + } 47 + 48 + public float BodyRange 49 + { 50 + set { this.InternalObject.Call("set_body_range", (float)value); } 51 + get { return (float)this.InternalObject.Call("get_body_range"); } 52 + } 53 + 54 + public String EyesAngleX 55 + { 56 + set { this.InternalObject.Call("set_eyes_angle_x", (String)value); } 57 + get { return (String)this.InternalObject.Call("get_eyes_angle_x"); } 58 + } 59 + 60 + public String EyesAngleY 61 + { 62 + set { this.InternalObject.Call("set_eyes_angle_y", (String)value); } 63 + get { return (String)this.InternalObject.Call("get_eyes_angle_y"); } 64 + } 65 + 66 + public float EyesRange 67 + { 68 + set { this.InternalObject.Call("set_eyes_range", (float)value); } 69 + get { return (float)this.InternalObject.Call("get_eyes_range"); } 70 + } 71 + 72 + // -------------------------------------------------------------- Method(s) 73 + 74 + public void SetTarget(Vector2 v) 75 + { 76 + this.InternalObject.Call("set_target", v); 77 + } 78 + 79 + public Vector2 GetTarget() 80 + { 81 + return (Vector2)this.InternalObject.Call("get_target"); 82 + } 83 + 84 + // -------------------------------------------------------------- Signal(s) 85 + }
+34
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_parameter_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismParameterCS : GDCubismValueAbsCS 10 + { 11 + // private static readonly StringName NativeName = "GDCubismParameter"; 12 + 13 + public GDCubismParameterCS(GodotObject o) : base(o) { } 14 + 15 + // ------------------------------------------------------------ Property(s) 16 + 17 + public float DefaultValue 18 + { 19 + get { return (float)this.InternalObject.Call("get_default_value"); } 20 + } 21 + 22 + public float MaximumValue 23 + { 24 + get { return (float)this.InternalObject.Call("get_maximum_value"); } 25 + } 26 + 27 + public float MinimumValue 28 + { 29 + get { return (float)this.InternalObject.Call("get_minimum_value"); } 30 + } 31 + 32 + // -------------------------------------------------------------- Method(s) 33 + // -------------------------------------------------------------- Signal(s) 34 + }
+18
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_part_opacity_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + 5 + 6 + #pragma warning disable CA1050 7 + 8 + 9 + public partial class GDCubismPartOpacityCS : GDCubismValueAbsCS 10 + { 11 + // private static readonly StringName NativeName = "GDCubismPartOpacity"; 12 + 13 + public GDCubismPartOpacityCS(GodotObject o) : base(o) { } 14 + 15 + // ------------------------------------------------------------ Property(s) 16 + // -------------------------------------------------------------- Method(s) 17 + // -------------------------------------------------------------- Signal(s) 18 + }
+510
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_user_model_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + using Godot.NativeInterop; 6 + 7 + 8 + #pragma warning disable CA1050 9 + 10 + 11 + public partial class GDCubismUserModelCS : GodotObject 12 + { 13 + public enum Moc3FileFormatVersionEnum : long 14 + { 15 + /// <summary>Unknown or failed to load.</summary> 16 + CSM_MOC_VERSION_UNKNOWN = 0, 17 + /// <summary>moc3 file version 3.0.00 - 3.2.07</summary> 18 + CSM_MOC_VERSION_30 = 1, 19 + /// <summary>moc3 file version 3.3.00 - 3.3.03</summary> 20 + CSM_MOC_VERSION_33 = 2, 21 + /// <summary>moc3 file version 4.0.00 - 4.1.05</summary> 22 + CSM_MOC_VERSION_40 = 3, 23 + /// <summary>moc3 file version 4.2.00 - 4.2.02</summary> 24 + CSM_MOC_VERSION_42 = 4, 25 + /// <summary>moc3 file version 5.0.00 -</summary> 26 + CSM_MOC_VERSION_50 = 5 27 + } 28 + 29 + public enum PriorityEnum : long 30 + { 31 + PriorityNone = 0, 32 + PriorityIdle = 1, 33 + PriorityNormal = 2, 34 + PriorityForce = 3 35 + } 36 + 37 + public enum ParameterModeEnum : long 38 + { 39 + FullParameter = 0, 40 + NoneParameter = 1 41 + } 42 + 43 + public enum MotionProcessCallbackEnum : long 44 + { 45 + /// <summary> 46 + /// The animation update process is performed within the <c>_physics_process</c> function. 47 + /// This is used when you want to interact with physical simulations. 48 + /// </summary> 49 + Physics = 0, 50 + /// <summary> 51 + /// The animation update process is performed within the _process function. 52 + /// </summary> 53 + Idle = 1, 54 + /// <summary> 55 + /// No animation update process is performed. Use the <c>advance</c> function to process the animation. 56 + /// </summary> 57 + Manual = 2 58 + } 59 + 60 + private static readonly StringName NativeName = "GDCubismUserModel"; 61 + public static readonly StringName MotionEventName = "motion_event"; 62 + public static readonly StringName MotionFinishedName = "motion_finished"; 63 + 64 + protected Node2D InternalObject = null; 65 + 66 + public GDCubismUserModelCS() 67 + { 68 + this.InternalObject = (Node2D)Godot.ClassDB.Instantiate(NativeName); 69 + } 70 + 71 + public GDCubismUserModelCS(Node2D o) 72 + { 73 + this.InternalObject = o; 74 + } 75 + 76 + public Node2D GetInternalObject() 77 + { 78 + return this.InternalObject; 79 + } 80 + 81 + public void Attach(Node2D o) 82 + { 83 + this.InternalObject = o; 84 + } 85 + 86 + public Node2D Detach() 87 + { 88 + Node2D o = this.InternalObject; 89 + this.InternalObject = null; 90 + return o; 91 + } 92 + 93 + // ------------------------------------------------------------ Property(s) 94 + 95 + /// <value> 96 + /// Property <c>Assets</c> 97 + /// <br /> 98 + /// You can load a Live2D model by specifying a file with the *.model3.json extension. 99 + /// The file is loaded immediately upon specification. 100 + /// <br /> 101 + /// if you want to switch the Live2D model, you can do so simply by specifying a new file. 102 + /// </value> 103 + public String Assets 104 + { 105 + set { this.InternalObject.Call("set_assets", value); } 106 + get { return (String)this.InternalObject.Call("get_assets"); } 107 + } 108 + 109 + /// <value> 110 + /// Property <c>LoadExpressions</c> 111 + /// <br /> 112 + /// If set to <c>false</c>, it will not load _Expressions_ when loading the Live2D Model. 113 + /// </value> 114 + public bool LoadExpressions 115 + { 116 + set { this.InternalObject.Call("set_load_expressions", value); } 117 + get { return (bool)this.InternalObject.Call("get_load_expressions"); } 118 + } 119 + 120 + /// <value> 121 + /// Property <c>LoadMotions</c> 122 + /// <br /> 123 + /// If set to <c>false</c>, it will not load _Motions_ when loading the Live2D Model. 124 + /// </value> 125 + public bool LoadMotions 126 + { 127 + set { this.InternalObject.Call("set_load_motions", value); } 128 + get { return (bool)this.InternalObject.Call("get_load_motions"); } 129 + } 130 + 131 + /// <value> 132 + /// Property <c>MaskViewportSize</c> 133 + /// <br /> 134 + /// Specify the maximum resolution for any individual mask required for the Live2D model. 135 + /// <br /> 136 + /// If set to 0, size of the mask will be relative to the source pixel resolution of the model's canvas. 137 + /// <br /> 138 + /// Mask resolution is also dynamically resized relative to the model's scale within its viewport. 139 + /// <br /> 140 + /// <br /> 141 + /// Reducing the resolution can help conserve GPU memory, however reducing resolution too far can cause visual issues where masks are applied. 142 + /// <br /> 143 + /// For many, it's best to leave this at default and rely solely on the automatic scaling. 144 + /// </value> 145 + public int MaskViewportSize 146 + { 147 + set { this.InternalObject.Call("set_mask_viewport_size", value); } 148 + get { return (int)this.InternalObject.Call("get_mask_viewport_size"); } 149 + } 150 + 151 + /// <value> 152 + /// Property <c>ParameterMode</c> 153 + /// <br /> 154 + /// Specifies the control method for the currently held Live2D model. 155 + /// </value> 156 + public ParameterModeEnum ParameterMode 157 + { 158 + set { this.InternalObject.Call("set_parameter_mode", (int)value); } 159 + get 160 + { 161 + int value = (int)this.InternalObject.Call("get_parameter_mode"); 162 + return (ParameterModeEnum)Enum.ToObject(typeof(ParameterModeEnum), value); 163 + } 164 + } 165 + 166 + /// <value> 167 + /// Property <c>PhysicsEvaluate</c> 168 + /// <br /> 169 + /// Setting this parameter to `false` disables physical calculations. 170 + /// </value> 171 + public bool PhysicsEvaluate 172 + { 173 + set { this.InternalObject.Call("set_physics_evaluate", value); } 174 + get { return (bool)this.InternalObject.Call("get_physics_evaluate"); } 175 + } 176 + 177 + /// <value> 178 + /// Property <c>PlaybackProcessMode</c> 179 + /// <br /> 180 + /// Specifies the playback method for the currently held Live2D model. 181 + /// </value> 182 + public MotionProcessCallbackEnum PlaybackProcessMode 183 + { 184 + set { this.InternalObject.Call("set_process_callback", (int)value); } 185 + get 186 + { 187 + int value = (int)this.InternalObject.Call("get_process_callback"); 188 + return (MotionProcessCallbackEnum)Enum.ToObject(typeof(MotionProcessCallbackEnum), value); 189 + } 190 + } 191 + 192 + /// <value> 193 + /// Property <c>PoseUpdate</c> 194 + /// <br /> 195 + /// Setting this parameter to `false` disables transparency calculations between drawing parts specified in the pose group. 196 + /// If you want to manually handle all transparency calculations, set this parameter to `false`. 197 + /// </value> 198 + public bool PoseUpdate 199 + { 200 + set { this.InternalObject.Call("set_pose_update", value); } 201 + get { return (bool)this.InternalObject.Call("get_pose_update"); } 202 + } 203 + 204 + public Shader ShaderAdd 205 + { 206 + set { this.InternalObject.Call("set_shader_add", (Shader)value); } 207 + get { return (Shader)this.InternalObject.Call("get_shader_add"); } 208 + } 209 + 210 + public Shader ShaderMix 211 + { 212 + set { this.InternalObject.Call("set_shader_mix", (Shader)value); } 213 + get { return (Shader)this.InternalObject.Call("get_shader_mix"); } 214 + } 215 + 216 + public Shader ShaderMul 217 + { 218 + set { this.InternalObject.Call("set_shader_mul", (Shader)value); } 219 + get { return (Shader)this.InternalObject.Call("get_shader_mul"); } 220 + } 221 + 222 + public Shader ShaderMask 223 + { 224 + set { this.InternalObject.Call("set_shader_mask", (Shader)value); } 225 + get { return (Shader)this.InternalObject.Call("get_shader_mask"); } 226 + } 227 + 228 + public Shader ShaderMaskAdd 229 + { 230 + set { this.InternalObject.Call("set_shader_mask_add", (Shader)value); } 231 + get { return (Shader)this.InternalObject.Call("get_shader_mask_add"); } 232 + } 233 + 234 + public Shader ShaderMaskAddInv 235 + { 236 + set { this.InternalObject.Call("set_shader_mask_add_inv", (Shader)value); } 237 + get { return (Shader)this.InternalObject.Call("get_shader_mask_add_inv"); } 238 + } 239 + 240 + public Shader ShaderMaskMix 241 + { 242 + set { this.InternalObject.Call("set_shader_mask_mix", (Shader)value); } 243 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mix"); } 244 + } 245 + 246 + public Shader ShaderMaskMixInv 247 + { 248 + set { this.InternalObject.Call("set_shader_mask_mix_inv", (Shader)value); } 249 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mix_inv"); } 250 + } 251 + 252 + public Shader ShaderMaskMul 253 + { 254 + set { this.InternalObject.Call("set_shader_mask_mul", (Shader)value); } 255 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mul"); } 256 + } 257 + 258 + public Shader ShaderMaskMulInv 259 + { 260 + set { this.InternalObject.Call("set_shader_mask_mul_inv", (Shader)value); } 261 + get { return (Shader)this.InternalObject.Call("get_shader_mask_mul_inv"); } 262 + } 263 + 264 + /// <value> 265 + /// Property <c>SpeedScale</c> 266 + /// <br /> 267 + /// Specifies the playback speed for the currently held Live2D model. 268 + /// </value> 269 + public float SpeedScale 270 + { 271 + set { this.InternalObject.Call("set_speed_scale", (float)value); } 272 + get { return (float)this.InternalObject.Call("get_speed_scale"); } 273 + } 274 + 275 + // -------------------------------------------------------------- Method(s) 276 + 277 + /// <summary> 278 + /// Advances the animation by the specified <paramref name="delta">delta</paramref> time (in seconds). 279 + /// Please specify a value of 0.0 or more for delta. 280 + /// </summary> 281 + /// <param name="delta">The time to progress the animation.</param> 282 + public void Advance(double delta) 283 + { 284 + this.InternalObject.Call("advance", delta); 285 + } 286 + 287 + /// <summary> 288 + /// Returns the latest file version that GDCubismUserModel can load. 289 + /// </summary> 290 + /// <returns>Moc3FileFormatVersionEnum</returns> 291 + public Moc3FileFormatVersionEnum CsmGetLatestMocVersion() 292 + { 293 + long value = (long)this.InternalObject.Call("csm_get_latest_moc_version"); 294 + return (Moc3FileFormatVersionEnum)Enum.ToObject(typeof(Moc3FileFormatVersionEnum), value); 295 + } 296 + 297 + /// <summary> 298 + /// Returns the version of the loaded moc3 file. 299 + /// </summary> 300 + /// <returns>Moc3FileFormatVersionEnum</returns> 301 + public Moc3FileFormatVersionEnum CsmGetMocVersion() 302 + { 303 + long value = (long)this.InternalObject.Call("csm_get_moc_version"); 304 + return (Moc3FileFormatVersionEnum)Enum.ToObject(typeof(Moc3FileFormatVersionEnum), value); 305 + } 306 + 307 + /// <summary> 308 + /// Returns the version number of the Cubism Native SDK Core used by GDCubism in <c>Dictionary</c> format 309 + /// <list type="bullet"> 310 + /// <item> 311 + /// <term>version</term> 312 + /// <description>int: The value returned by the csmVersion function is stored as is.</description> 313 + /// </item> 314 + /// <item> 315 + /// <term>major</term> 316 + /// <description>int: Only the major version is extracted from the version and stored.</description> 317 + /// </item> 318 + /// <item> 319 + /// <term>minor</term> 320 + /// <description>int: Only the minor version is extracted from the version and stored.</description> 321 + /// </item> 322 + /// <item> 323 + /// <term>patch</term> 324 + /// <description>int: Only the patch number is extracted from the version and stored.</description> 325 + /// </item> 326 + /// </list> 327 + /// </summary> 328 + /// <returns>Godot.Collections.Dictionary</returns> 329 + public Godot.Collections.Dictionary CsmGetVersion() 330 + { 331 + return (Godot.Collections.Dictionary)this.InternalObject.Call("csm_get_version"); 332 + } 333 + 334 + /// <summary> 335 + /// Returns the following information in <c>Dictionary</c> format. 336 + /// <list type="bullet"> 337 + /// <item> 338 + /// <term>size_in_pixels</term> 339 + /// <description>Vector2: Returns the width and height of the canvas of the loaded Live2D model in pixels.</description> 340 + /// </item> 341 + /// <item> 342 + /// <term>origin_in_pixels</term> 343 + /// <description>Vector2: Returns the center position of the loaded Live2D model in pixels.</description> 344 + /// </item> 345 + /// <item> 346 + /// <term>ixels_per_unit</term> 347 + /// <description>float: Returns the pixelsPerUnit of the loaded Live2D model.</description> 348 + /// </item> 349 + /// </list> 350 + /// </summary> 351 + /// <returns>Godot.Collections.Dictionary</returns> 352 + public Godot.Collections.Dictionary GetCanvasInfo() 353 + { 354 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_canvas_info"); 355 + } 356 + 357 + /// <summary> 358 + /// Returns the information of the <c>Motion</c> currently being played. 359 + /// </summary> 360 + /// <returns>Godot.Collections.Array</returns> 361 + public Godot.Collections.Array GetCubismMotionQueueEntries() 362 + { 363 + return (Godot.Collections.Array)this.InternalObject.Call("get_cubism_motion_queue_entries"); 364 + } 365 + 366 + /// <summary> 367 + /// Returns a list of Expressions from the currently held Live2D model. 368 + /// The information obtained can be used as an argument for the <c>start_expression</c> function. 369 + /// </summary> 370 + /// <returns>Godot.Collections.Array</returns> 371 + public Godot.Collections.Array<String> GetExpressions() 372 + { 373 + return (Godot.Collections.Array<String>)this.InternalObject.Call("get_expressions"); 374 + } 375 + 376 + public Godot.Collections.Array GetHitAreas() 377 + { 378 + return (Godot.Collections.Array)this.InternalObject.Call("get_hit_areas"); 379 + } 380 + 381 + /// <summary> 382 + /// Retrieves the <c>ArrayMesh</c> information of the <c>MeshInstance</c> used in the current Motion state. 383 + /// The keys held by this <c>Dictionary</c> are identical to the names of the <c>MeshInstance</c> generated by <c>GDCubismUserModel</c>. 384 + /// <br /> 385 + /// The information that can be obtained is the <c>ArrayMesh</c> used internally. 386 + /// <br /> 387 + /// CAUTION<br /> 388 + /// get_meshes is an experimental function added in v0.1. Please be aware that the specifications may change or be removed in the future. 389 + /// </summary> 390 + /// <returns>Godot.Collections.Dictionary</returns> 391 + public Godot.Collections.Dictionary GetMeshes() 392 + { 393 + return (Godot.Collections.Dictionary)this.InternalObject.Call("get_meshes"); 394 + } 395 + 396 + /// <summary> 397 + /// Returns a list of <c>Motions</c> from the currently held Live2D model. 398 + /// The returned <c>Dictionary</c> is the <c>group</c> and the number of motions it contains. 399 + /// </summary> 400 + /// <returns>Godot.Collections.Dictionary</returns> 401 + public Godot.Collections.Dictionary<String, int> GetMotions() 402 + { 403 + return (Godot.Collections.Dictionary<String, int>)this.InternalObject.Call("get_motions"); 404 + } 405 + 406 + /// <summary> 407 + /// Retrieves the controller class for operating the currently held Live2D model. 408 + /// </summary> 409 + /// <returns>Godot.Collections.Array</returns> 410 + public Godot.Collections.Array<GDCubismParameterCS> GetParameters() 411 + { 412 + Godot.Collections.Array<GodotObject> ary = (Godot.Collections.Array<GodotObject>)this.InternalObject.Call("get_parameters"); 413 + Godot.Collections.Array<GDCubismParameterCS> ary_result = new(); 414 + foreach (GodotObject o in ary) 415 + { 416 + ary_result.Add(new GDCubismParameterCS(o)); 417 + } 418 + 419 + return ary_result; 420 + } 421 + 422 + /// <summary> 423 + /// Retrieves the controller class for operating the transparency of the parts of the currently held Live2D model. 424 + /// </summary> 425 + /// <returns>Godot.Collections.Array</returns> 426 + public Godot.Collections.Array<GDCubismPartOpacityCS> GetPartOpacities() 427 + { 428 + Godot.Collections.Array<GodotObject> ary = (Godot.Collections.Array<GodotObject>)this.InternalObject.Call("get_part_opacities"); 429 + Godot.Collections.Array<GDCubismPartOpacityCS> ary_result = new(); 430 + foreach (GodotObject o in ary) 431 + { 432 + ary_result.Add(new GDCubismPartOpacityCS(o)); 433 + } 434 + 435 + return ary_result; 436 + } 437 + 438 + /// <summary> 439 + /// Plays the specified <paramref name="expression_id">expression_id</paramref>. 440 + /// </summary> 441 + /// <param name="expression_id"></param> 442 + public void StartExpression(String expression_id) 443 + { 444 + this.InternalObject.Call("start_expression", expression_id); 445 + } 446 + 447 + /// <summary> 448 + /// Plays the specified <paramref name="grp_name">group</paramref> and <paramref name="no">no</paramref>. 449 + /// </summary> 450 + /// <param name="grp_name"></param> 451 + /// <param name="no"></param> 452 + /// <param name="priority"></param> 453 + public void StartMotion(String grp_name, int no, PriorityEnum priority) 454 + { 455 + this.InternalObject.Call("start_motion", grp_name, no, (int)priority); 456 + } 457 + 458 + /// <summary> 459 + /// Plays the specified <paramref name="grp_name">group</paramref> and <paramref name="no">no</paramref>. 460 + /// If you want to play it repeatedly, specify it. 461 + /// If the loop argument is <c>false</c>, it will behave the same as the <c>start_motion</c> function. 462 + /// </summary> 463 + /// <param name="grp_name"></param> 464 + /// <param name="no"></param> 465 + /// <param name="priority"></param> 466 + /// <param name="loop"></param> 467 + /// <param name="loop_in_fade"></param> 468 + public void StartMotionLoop(String grp_name, int no, PriorityEnum priority, bool loop, bool loop_in_fade) 469 + { 470 + this.InternalObject.Call("start_motion_loop", grp_name, no, (int)priority, loop, loop_in_fade); 471 + } 472 + 473 + /// <summary> 474 + /// It stops the currently playing <c>Expression</c>. 475 + /// </summary> 476 + public void StopExpression() 477 + { 478 + this.InternalObject.Call("stop_expression"); 479 + } 480 + 481 + /// <summary> 482 + /// It stops the currently playing <c>Motion</c>. 483 + /// </summary> 484 + public void StopMotion() 485 + { 486 + this.InternalObject.Call("stop_motion"); 487 + } 488 + 489 + // -------------------------------------------------------------- Signal(s) 490 + 491 + public delegate void MotionEventEventHandler(string value); 492 + 493 + private static void MotionEventTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) 494 + { 495 + ((MotionEventEventHandler)delegateObj)(VariantUtils.ConvertTo<string>(args[0])); 496 + ret = default; 497 + } 498 + 499 + public unsafe event MotionEventEventHandler MotionEvent 500 + { 501 + add => this.InternalObject.Connect(MotionEventName, Callable.CreateWithUnsafeTrampoline(value, &MotionEventTrampoline)); 502 + remove => this.InternalObject.Disconnect(MotionEventName, Callable.CreateWithUnsafeTrampoline(value, &MotionEventTrampoline)); 503 + } 504 + 505 + public event Action MotionFinished 506 + { 507 + add => this.InternalObject.Connect(MotionFinishedName, Callable.From(value)); 508 + remove => this.InternalObject.Disconnect(MotionFinishedName, Callable.From(value)); 509 + } 510 + }
+58
tests/cubism-probe/addons/gd_cubism/cs/gd_cubism_value_abs_cs.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable CA1050 8 + 9 + 10 + public partial class GDCubismValueAbsCS : GodotObject 11 + { 12 + private static readonly StringName NativeName = "GDCubismValueAbs"; 13 + 14 + protected GodotObject InternalObject = null; 15 + 16 + public GDCubismValueAbsCS() 17 + { 18 + this.InternalObject = (SubViewport)Godot.ClassDB.Instantiate(NativeName); 19 + } 20 + 21 + public GDCubismValueAbsCS(GodotObject o) 22 + { 23 + this.InternalObject = o; 24 + } 25 + 26 + public GodotObject GetInternalObject() 27 + { 28 + return this.InternalObject; 29 + } 30 + 31 + public void Attach(GodotObject o) 32 + { 33 + this.InternalObject = o; 34 + } 35 + 36 + public GodotObject Detach() 37 + { 38 + GodotObject o = this.InternalObject; 39 + this.InternalObject = null; 40 + return o; 41 + } 42 + 43 + // ------------------------------------------------------------ Property(s) 44 + 45 + public String Id 46 + { 47 + get { return (String)this.InternalObject.Call("get_id"); } 48 + } 49 + 50 + public float Value 51 + { 52 + set { this.InternalObject.Call("set_value", (float)value); } 53 + get { return (float)this.InternalObject.Call("get_value"); } 54 + } 55 + 56 + // -------------------------------------------------------------- Method(s) 57 + // -------------------------------------------------------------- Signal(s) 58 + }
+80
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_01.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable CA1050 8 + #pragma warning disable IDE1006 9 + 10 + 11 + public partial class demo_effect_custom_01 : Node2D 12 + { 13 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 14 + 15 + private GDCubismUserModelCS cubism_model; 16 + private GDCubismEffectCustomCS cubism_efx; 17 + 18 + private enum E_PARAM_MODE { 19 + PROCESS, 20 + SIGNAL 21 + } 22 + 23 + private bool param_valid = false; 24 + private E_PARAM_MODE param_mode = E_PARAM_MODE.PROCESS; 25 + private GDCubismParameterCS l_eye; 26 + private GDCubismParameterCS r_eye; 27 + 28 + 29 + private void recalc_model_position(GDCubismUserModelCS model) 30 + { 31 + if(model.Assets == "") return; 32 + 33 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 34 + 35 + if(canvas_info.Count > 0) 36 + { 37 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 38 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 39 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 40 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 41 + model.GetInternalObject().Scale = new(scale, scale); 42 + } 43 + } 44 + 45 + // Called when the node enters the scene tree for the first time. 46 + public override void _Ready() 47 + { 48 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 49 + // this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 50 + // this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 51 + // this.cubism_efx.CubismInit += this._on_cubism_init; 52 + // this.cubism_efx.CubismTerm += this._on_cubism_term; 53 + // this.cubism_efx.CubismProcess += this._on_cubism_process; 54 + 55 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 56 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 57 + } 58 + 59 + // Called every frame. 'delta' is the elapsed time since the previous frame. 60 + public override void _Process(double delta) 61 + { 62 + recalc_model_position(this.cubism_model); 63 + 64 + if (this.param_mode == E_PARAM_MODE.PROCESS) { 65 + 66 + Godot.Collections.Array<GDCubismParameterCS> ary_param = this.cubism_model.GetParameters(); 67 + 68 + foreach (GDCubismParameterCS o in this.cubism_model.GetParameters()) 69 + { 70 + if (o.Id == "ParamEyeLOpen") { 71 + o.Value = 0.0f; 72 + } 73 + 74 + if (o.Id == "ParamEyeROpen") { 75 + o.Value = 0.0f; 76 + } 77 + } 78 + } 79 + } 80 + }
+90
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_01.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var cubism_model: GDCubismUserModel 9 + var cubism_efx: GDCubismEffectCustom 10 + 11 + enum E_PARAM_MODE { 12 + PROCESS, 13 + SIGNAL 14 + } 15 + 16 + var param_valid: bool = false 17 + var param_mode: E_PARAM_MODE = E_PARAM_MODE.PROCESS 18 + var l_eye: GDCubismParameter 19 + var r_eye: GDCubismParameter 20 + 21 + 22 + func recalc_model_position(model: GDCubismUserModel): 23 + if model.assets == "": 24 + return 25 + 26 + var canvas_info: Dictionary = model.get_canvas_info() 27 + 28 + if canvas_info.is_empty() != true: 29 + var vct_viewport_size = Vector2(get_viewport_rect().size) 30 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 31 + model.position = vct_viewport_size / 2.0 32 + model.scale = Vector2(scale, scale) 33 + 34 + 35 + func _ready(): 36 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 37 + self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 38 + self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 39 + self.cubism_efx.connect("cubism_init", self._on_cubism_init) 40 + self.cubism_efx.connect("cubism_term", self._on_cubism_term) 41 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 42 + 43 + self.cubism_model = $GDCubismUserModel 44 + if self.cubism_model.assets == "": 45 + self.cubism_model.assets = DEFAULT_ASSET; 46 + 47 + 48 + func _process(delta): 49 + recalc_model_position($GDCubismUserModel) 50 + 51 + if param_mode == E_PARAM_MODE.PROCESS: 52 + var model: GDCubismUserModel = $GDCubismUserModel 53 + 54 + for _o in self.cubism_model.get_parameters(): 55 + var o: GDCubismParameter = _o 56 + if o.id == "ParamEyeLOpen": 57 + o.value = 0.0 58 + if o.id == "ParamEyeROpen": 59 + o.value = 0.0 60 + 61 + 62 + func _on_cubism_init(model: GDCubismUserModel): 63 + if param_mode == E_PARAM_MODE.SIGNAL: 64 + for _o in model.get_parameters(): 65 + var o: GDCubismParameter = _o 66 + if o.id == "ParamEyeLOpen": 67 + l_eye = o 68 + if o.id == "ParamEyeROpen": 69 + r_eye = o 70 + param_valid = true 71 + 72 + 73 + func _on_cubism_term(model: GDCubismUserModel): 74 + if param_mode == E_PARAM_MODE.SIGNAL: 75 + param_valid = false 76 + 77 + 78 + func _on_cubism_prologue(model: GDCubismUserModel, delta: float): 79 + pass # Replace with function body. 80 + 81 + 82 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 83 + if param_mode == E_PARAM_MODE.SIGNAL: 84 + if param_valid == true: 85 + l_eye.value = 0.0 86 + r_eye.value = 0.0 87 + 88 + 89 + func _on_cubism_epilogue(model: GDCubismUserModel, delta: float): 90 + pass # Replace with function body.
+12
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_01.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://0sa003phknvv"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_01.gd" id="1_uudij"] 4 + 5 + [node name="demo_effect_custom_01" type="Node2D"] 6 + script = ExtResource("1_uudij") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + position = Vector2(640, 360) 10 + scale = Vector2(0.075, 0.075) 11 + 12 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"]
+107
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_02.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using Godot.NativeInterop; 5 + using System; 6 + 7 + #pragma warning disable CA1050 8 + #pragma warning disable IDE1006 9 + 10 + 11 + public partial class demo_effect_custom_02 : Node2D 12 + { 13 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 14 + 15 + private GDCubismUserModelCS cubism_model; 16 + private GDCubismEffectCustomCS cubism_efx; 17 + 18 + private bool first_time = true; 19 + private float counter = 0.0f; 20 + private Vector2 base_vct; 21 + private Vector2 base_scale; 22 + 23 + [Export] 24 + private String art_mesh_name = "ArtMesh278"; 25 + [Export] 26 + private int vector_index_0 = 0; 27 + [Export] 28 + private int vector_index_1 = 1; 29 + 30 + 31 + private void recalc_model_position(GDCubismUserModelCS model) 32 + { 33 + if(model.Assets == "") return; 34 + 35 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 36 + 37 + if(canvas_info.Count > 0) 38 + { 39 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 40 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 41 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 42 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 43 + model.GetInternalObject().Scale = new(scale, scale); 44 + } 45 + } 46 + 47 + public override void _Ready() 48 + { 49 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 50 + // this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 51 + // this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 52 + // this.cubism_efx.CubismInit += this._on_cubism_init; 53 + // this.cubism_efx.CubismTerm += this._on_cubism_term; 54 + this.cubism_efx.CubismProcess += this._on_cubism_process; 55 + 56 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 57 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 58 + 59 + Godot.Collections.Dictionary<String, int> dict_motion = this.cubism_model.GetMotions(); 60 + 61 + foreach (var (k, item_count) in dict_motion) 62 + { 63 + this.cubism_model.StartMotionLoop(k, 0, GDCubismUserModelCS.PriorityEnum.PriorityForce, true, true); 64 + break; 65 + } 66 + } 67 + 68 + public override void _Process(double delta) 69 + { 70 + recalc_model_position(this.cubism_model); 71 + } 72 + 73 + private void _on_cubism_process(Node2D model, double delta) 74 + { 75 + const int ARRAY_VERTEX = (int)ArrayMesh.ArrayType.Vertex; 76 + 77 + var ref_sprite = GetNode<Sprite2D>("GDCubismUserModel/GDCubismEffectCustom/Sprite2D"); 78 + 79 + Godot.Collections.Dictionary dict_mesh = this.cubism_model.GetMeshes(); 80 + 81 + if (dict_mesh.ContainsKey(this.art_mesh_name) == false) return; 82 + 83 + MeshInstance2D ary_mesh = (dict_mesh[this.art_mesh_name]).AsGodotObject() as MeshInstance2D; 84 + Godot.Collections.Array ary_surface = ary_mesh.Mesh.SurfaceGetArrays(0); 85 + Godot.Collections.Array<Vector2> mesh_vertex = (Godot.Collections.Array<Vector2>)ary_surface[ARRAY_VERTEX]; 86 + 87 + if (this.first_time == true) 88 + { 89 + var _fr = mesh_vertex[this.vector_index_0]; 90 + var _to = mesh_vertex[this.vector_index_1]; 91 + 92 + this.base_vct = (_to - _fr); 93 + this.base_scale = ref_sprite.Scale; 94 + this.first_time = false; 95 + } 96 + 97 + var fr = mesh_vertex[this.vector_index_0]; 98 + var to = mesh_vertex[this.vector_index_1]; 99 + 100 + var calc_vct = (to - fr); 101 + var scale = calc_vct.Length() / base_vct.Length(); 102 + 103 + ref_sprite.Position = this.cubism_model.GetInternalObject().ToGlobal(fr); 104 + ref_sprite.Rotation = base_vct.Normalized().Cross(calc_vct.Normalized()); 105 + ref_sprite.Scale = base_scale * scale; 106 + } 107 + }
+81
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_02.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 7 + 8 + var cubism_model: GDCubismUserModel 9 + var cubism_efx: GDCubismEffectCustom 10 + 11 + var first_time: bool = true 12 + var counter: float = 0.0 13 + var base_vct: Vector2 14 + var base_scale: Vector2 15 + @export var art_mesh_name: String = "ArtMesh278" 16 + @export var vector_index_0: int = 0 17 + @export var vector_index_1: int = 1 18 + 19 + 20 + func recalc_model_position(model: GDCubismUserModel) -> void: 21 + if model.assets == "": 22 + return 23 + 24 + var canvas_info: Dictionary = model.get_canvas_info() 25 + 26 + if canvas_info.is_empty() != true: 27 + var vct_viewport_size = Vector2(get_viewport_rect().size) 28 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 29 + model.position = vct_viewport_size / 2.0 30 + model.scale = Vector2(scale, scale) 31 + 32 + 33 + func _ready() -> void: 34 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 35 + # self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 36 + # self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 37 + # self.cubism_efx.connect("cubism_init", self._on_cubism_init) 38 + # self.cubism_efx.connect("cubism_term", self._on_cubism_term) 39 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 40 + 41 + self.cubism_model = $GDCubismUserModel 42 + if self.cubism_model.assets == "": 43 + self.cubism_model.assets = DEFAULT_ASSET; 44 + 45 + var dict_motion: Dictionary = self.cubism_model.get_motions() 46 + 47 + for k in dict_motion.keys(): 48 + self.cubism_model.start_motion_loop(k, 0, GDCubismUserModel.PRIORITY_FORCE, true, true); 49 + break 50 + 51 + 52 + func _process(delta: float) -> void: 53 + self.recalc_model_position(self.cubism_model) 54 + 55 + 56 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 57 + var ref_sprite: Sprite2D = $GDCubismUserModel/GDCubismEffectCustom/Sprite2D 58 + var dict_mesh: Dictionary = model.get_meshes() 59 + 60 + if dict_mesh.has(art_mesh_name) == false: 61 + return 62 + 63 + var ary_mesh: MeshInstance2D = dict_mesh[self.art_mesh_name] 64 + var ary_surface: Array = ary_mesh.mesh.surface_get_arrays(0) 65 + var mesh_vertex: PackedVector2Array = ary_surface[ArrayMesh.ARRAY_VERTEX] 66 + 67 + if self.first_time == true: 68 + var fr = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_0] 69 + var to = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_1] 70 + self.base_vct = (to - fr) 71 + self.base_scale = ref_sprite.scale 72 + self.first_time = false 73 + 74 + var fr = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_0] 75 + var to = ary_surface[ArrayMesh.ARRAY_VERTEX][self.vector_index_1] 76 + var calc_vct = (to - fr) 77 + var scale: float = calc_vct.length() / base_vct.length() 78 + 79 + ref_sprite.position = model.to_global(fr) 80 + ref_sprite.rotation = base_vct.normalized().cross(calc_vct.normalized()) 81 + ref_sprite.scale = base_scale * scale
+16
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_02.tscn
··· 1 + [gd_scene load_steps=3 format=3 uid="uid://drt0184vymus2"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_02.gd" id="1_oi5ow"] 4 + [ext_resource type="Texture2D" uid="uid://c8o4yd28cp3jy" path="res://icon.svg" id="2_0d7x8"] 5 + 6 + [node name="demo_effect_custom_02" type="Node2D"] 7 + script = ExtResource("1_oi5ow") 8 + 9 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 10 + 11 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"] 12 + 13 + [node name="Sprite2D" type="Sprite2D" parent="GDCubismUserModel/GDCubismEffectCustom"] 14 + z_index = 1024 15 + scale = Vector2(0.5, 0.5) 16 + texture = ExtResource("2_0d7x8")
+136
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_03.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + #pragma warning disable CA1050 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_custom_03 : Node2D 11 + { 12 + private const String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + private GDCubismEffectCustomCS cubism_efx; 16 + 17 + private String param_mouth_name = "ParamMouthA"; 18 + [Export] 19 + private float min_db = 60.0f; 20 + [Export] 21 + private int min_voice_freq = 0; 22 + [Export] 23 + private int max_voice_freq = 3200; 24 + [Export] 25 + private int history_size = 6; 26 + 27 + [ExportCategory("Audio")] 28 + [Export] 29 + private String audio_bus_name = "Voice"; 30 + [Export] 31 + private int audio_efx_index = 0; 32 + 33 + private AudioEffectSpectrumAnalyzerInstance spectrum; 34 + private GDCubismParameterCS param_mouth; 35 + private Godot.Collections.Array<float> ary_volume_history; 36 + private int history_position = 0; 37 + private bool lipsync_ready = false; 38 + 39 + private void array_rebuild() 40 + { 41 + if (this.history_size != this.ary_volume_history.Count) 42 + { 43 + this.ary_volume_history.Resize(this.history_size); 44 + this.ary_volume_history.Fill(0.0f); 45 + } 46 + } 47 + 48 + private void recalc_model_position(GDCubismUserModelCS model) 49 + { 50 + if(model.Assets == "") return; 51 + 52 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 53 + 54 + if(canvas_info.Count > 0) 55 + { 56 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 57 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 58 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 59 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 60 + model.GetInternalObject().Scale = new(scale, scale); 61 + } 62 + } 63 + 64 + public override void _Ready() 65 + { 66 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectCustom")); 67 + this.cubism_efx.CubismPrologue += this._on_cubism_prologue; 68 + this.cubism_efx.CubismEpilogue += this._on_cubism_epilogue; 69 + this.cubism_efx.CubismInit += this._on_cubism_init; 70 + this.cubism_efx.CubismTerm += this._on_cubism_term; 71 + this.cubism_efx.CubismProcess += this._on_cubism_process; 72 + 73 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 74 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 75 + } 76 + 77 + public override void _Process(double delta) 78 + { 79 + this.recalc_model_position(this.cubism_model); 80 + } 81 + 82 + private float array_avg() 83 + { 84 + float sum_v = 0.0f; 85 + foreach (float v in this.ary_volume_history) 86 + { 87 + sum_v += v; 88 + } 89 + return sum_v / this.ary_volume_history.Count; 90 + } 91 + 92 + private void _on_cubism_prologue(Node2D _model, float v) {} 93 + private void _on_cubism_epilogue(Node2D _model, float v) {} 94 + private void _on_cubism_init(Node2D _model) {} 95 + 96 + private void _on_cubism_term(Node2D _model) 97 + { 98 + this.lipsync_ready = false; 99 + this.param_mouth = null; 100 + this.ary_volume_history.Clear(); 101 + this.history_position = 0; 102 + } 103 + 104 + private void _on_cubism_process(Node2D _model, double delta) 105 + { 106 + if (this.lipsync_ready == false) return; 107 + 108 + this.array_rebuild(); 109 + 110 + float m = this.spectrum.GetMagnitudeForFrequencyRange( 111 + this.min_voice_freq, 112 + this.max_voice_freq 113 + ).Length(); 114 + 115 + var v = Math.Clamp((min_db + Mathf.LinearToDb(m)) / this.min_db, 0.0f, 1.0f); 116 + 117 + this.ary_volume_history[this.history_position] = v; 118 + this.history_position += 1; 119 + 120 + if (this.history_position >= this.ary_volume_history.Count) 121 + { 122 + this.history_position = 0; 123 + } 124 + 125 + float avg_v = this.array_avg(); 126 + 127 + if (this.param_mouth != null) 128 + { 129 + this.param_mouth.Value = Math.Max(this.param_mouth.Value - 0.2f, 0.0f); 130 + if (avg_v > 0.1f) 131 + { 132 + this.param_mouth.Value = 1.0f; 133 + } 134 + } 135 + } 136 + }
+122
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_03.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + 7 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 8 + 9 + var cubism_model: GDCubismUserModel 10 + var cubism_efx: GDCubismEffectCustom 11 + 12 + @export var param_mouth_name: String = "ParamMouthA" 13 + @export var min_db: float = 60.0 14 + @export var min_voice_freq: int = 0 15 + @export var max_voice_freq: int = 3200 16 + @export var history_size: int = 6 17 + 18 + @export_category("Audio") 19 + @export var audio_bus_name: String = "Voice" 20 + @export var audio_efx_index: int = 0 21 + 22 + var spectrum: AudioEffectSpectrumAnalyzerInstance 23 + var param_mouth: GDCubismParameter 24 + var ary_volume_history: Array 25 + var history_position: int = 0 26 + var lipsync_ready: bool = false 27 + 28 + 29 + func array_rebuild(): 30 + if history_size != ary_volume_history.size(): 31 + ary_volume_history.resize(history_size) 32 + ary_volume_history.fill(0.0) 33 + 34 + 35 + func array_avg() -> float: 36 + var sum_v: float = 0.0 37 + for v in ary_volume_history: 38 + sum_v += v 39 + return sum_v / ary_volume_history.size() 40 + 41 + 42 + func recalc_model_position(model: GDCubismUserModel) -> void: 43 + if model.assets == "": 44 + return 45 + 46 + var canvas_info: Dictionary = model.get_canvas_info() 47 + 48 + if canvas_info.is_empty() != true: 49 + var vct_viewport_size = Vector2(get_viewport_rect().size) 50 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 51 + model.position = vct_viewport_size / 2.0 52 + model.scale = Vector2(scale, scale) 53 + 54 + 55 + func _ready() -> void: 56 + self.cubism_efx = $GDCubismUserModel/GDCubismEffectCustom 57 + # self.cubism_efx.connect("cubism_prologue", self._on_cubism_prologue) 58 + # self.cubism_efx.connect("cubism_epilogue", self._on_cubism_epilogue) 59 + # self.cubism_efx.connect("cubism_init", self._on_cubism_init) 60 + # self.cubism_efx.connect("cubism_term", self._on_cubism_term) 61 + self.cubism_efx.connect("cubism_process", self._on_cubism_process) 62 + 63 + self.cubism_model = $GDCubismUserModel 64 + if self.cubism_model.assets == "": 65 + self.cubism_model.assets = DEFAULT_ASSET 66 + 67 + 68 + func _process(delta: float) -> void: 69 + self.recalc_model_position(self.cubism_model) 70 + 71 + 72 + func _on_cubism_init(model: GDCubismUserModel): 73 + param_mouth = null 74 + ary_volume_history.clear() 75 + history_position = 0 76 + 77 + var ary_param = model.get_parameters() 78 + 79 + for param in ary_param: 80 + if param.id == param_mouth_name: 81 + param_mouth = param 82 + 83 + var bus_index = AudioServer.get_bus_index(audio_bus_name) 84 + spectrum = AudioServer.get_bus_effect_instance(bus_index, audio_efx_index) 85 + 86 + if spectrum == null: 87 + lipsync_ready = false 88 + else: 89 + lipsync_ready = true 90 + 91 + 92 + func _on_cubism_term(model: GDCubismUserModel): 93 + lipsync_ready = false 94 + param_mouth = null 95 + ary_volume_history.clear() 96 + history_position = 0 97 + 98 + 99 + func _on_cubism_process(model: GDCubismUserModel, delta: float): 100 + if lipsync_ready == false: 101 + return 102 + 103 + array_rebuild() 104 + 105 + var m: float = spectrum.get_magnitude_for_frequency_range( 106 + min_voice_freq, 107 + max_voice_freq 108 + ).length() 109 + var v = clamp((min_db + linear_to_db(m)) / min_db, 0.0, 1.0) 110 + 111 + ary_volume_history[history_position] = v 112 + history_position += 1 113 + 114 + if history_position >= ary_volume_history.size(): 115 + history_position = 0 116 + 117 + var avg_v: float = array_avg() 118 + 119 + if param_mouth != null: 120 + param_mouth.value = max(param_mouth.value - 0.2, 0.0) 121 + if avg_v > 0.1: 122 + param_mouth.value = 1.0
+14
tests/cubism-probe/addons/gd_cubism/example/demo_effect_custom_03.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://xk7rqvf532rj"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_custom_03.gd" id="1_g4xfj"] 4 + 5 + [node name="demo_effect_custom_03" type="Node2D"] 6 + script = ExtResource("1_g4xfj") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectCustom" type="GDCubismEffectCustom" parent="GDCubismUserModel"] 11 + 12 + [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] 13 + autoplay = true 14 + bus = &"Voice"
+144
tests/cubism-probe/addons/gd_cubism/example/demo_effect_hit_area.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_hit_area : Node2D 11 + { 12 + const String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + 16 + private bool pressed = false; 17 + private Vector2 local_pos = new(0.0f, 0.0f); 18 + private Vector2 adjust_pos = new(0.0f, 0.0f); 19 + private Godot.Collections.Dictionary dict_detail = new(); 20 + private Godot.Collections.Dictionary dict_pickup = new(); 21 + private String id_mesh = ""; 22 + 23 + 24 + private void recalc_model_position(GDCubismUserModelCS model) 25 + { 26 + if(model.Assets == "") return; 27 + 28 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 29 + 30 + if(canvas_info.Count > 0) 31 + { 32 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 33 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 34 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 35 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 36 + model.GetInternalObject().Scale = new(scale, scale); 37 + } 38 + } 39 + 40 + public override void _Ready() 41 + { 42 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 43 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 44 + 45 + GetNode<ItemList>("Control/ItemList").Clear(); 46 + Godot.Collections.Dictionary dict_meshes = this.cubism_model.GetMeshes(); 47 + foreach (var id in dict_meshes.Keys) 48 + { 49 + GetNode<ItemList>("Control/ItemList").AddItem(id.AsString()); 50 + } 51 + } 52 + 53 + public override void _Process(double delta) 54 + { 55 + this.recalc_model_position(this.cubism_model); 56 + 57 + GDCubismEffectHitAreaCS hit_area = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectHitArea")); 58 + 59 + if (this.pressed == true) 60 + { 61 + hit_area.SetTarget(this.local_pos); 62 + } 63 + 64 + GetNode<Label>("Control/lbl_mouse_x").Text = String.Format("{0:######.000}", this.local_pos.X); 65 + GetNode<Label>("Control/lbl_mouse_y").Text = String.Format("{0:######.000}", this.local_pos.Y); 66 + 67 + if (this.id_mesh != "") 68 + { 69 + this.dict_pickup = hit_area.GetDetail(this.cubism_model, this.id_mesh); 70 + } 71 + 72 + GetNode<CanvasItem>("Canvas").QueueRedraw(); 73 + 74 + base._Process(delta); 75 + } 76 + 77 + public override void _Input(InputEvent @event) 78 + { 79 + if (@event is InputEventMouseButton mouseButton) 80 + { 81 + this.pressed = mouseButton.IsPressed(); 82 + } 83 + 84 + if (@event is InputEventMouseMotion mouseMotion) 85 + { 86 + this.local_pos = this.cubism_model.GetInternalObject().ToLocal(mouseMotion.Position) + this.adjust_pos; 87 + } 88 + 89 + base._Input(@event); 90 + } 91 + 92 + private void mark_hit_area(Godot.Collections.Dictionary dict_hit_area, Color color_box, Color color_tri) 93 + { 94 + if (dict_hit_area.Count > 0) 95 + { 96 + Rect2 rect = (Rect2)dict_hit_area["rect"]; 97 + 98 + Rect2 r = new( 99 + (rect.Position - this.adjust_pos) * this.cubism_model.GetInternalObject().Scale, 100 + rect.Size * this.cubism_model.GetInternalObject().Scale 101 + ); 102 + GetNode<CanvasItem>("Canvas").DrawRect(r, color_box, false, 5); 103 + 104 + if (dict_hit_area.ContainsKey("vertices") == true) 105 + { 106 + Godot.Collections.Array<Vector2> vtx = (Godot.Collections.Array<Vector2>)dict_hit_area["vertices"]; 107 + 108 + Godot.Collections.Array<Vector2> v = new(); 109 + v.Add(vtx[0] * this.cubism_model.GetInternalObject().Scale); 110 + v.Add(vtx[1] * this.cubism_model.GetInternalObject().Scale); 111 + v.Add(vtx[2] * this.cubism_model.GetInternalObject().Scale); 112 + 113 + GetNode<CanvasItem>("Canvas").DrawLine(v[0] - this.adjust_pos, v[1] - adjust_pos, color_tri, 3); 114 + GetNode<CanvasItem>("Canvas").DrawLine(v[1] - this.adjust_pos, v[2] - adjust_pos, color_tri, 3); 115 + GetNode<CanvasItem>("Canvas").DrawLine(v[2] - this.adjust_pos, v[0] - adjust_pos, color_tri, 3); 116 + } 117 + } 118 + } 119 + 120 + private void _on_gd_cubism_effect_hit_area_hit_area_entered(Node2D _model, String id) 121 + { 122 + GDCubismEffectHitAreaCS hit_area = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectHitArea")); 123 + 124 + this.dict_detail = hit_area.GetDetail(this.cubism_model, id); 125 + GetNode<Label>("Control/lbl_id").Text = id; 126 + } 127 + 128 + private void _on_gd_cubism_effect_hit_area_hit_area_exited(Node2D _model, String id) 129 + { 130 + this.dict_detail = new(); 131 + GetNode<Label>("Control/lbl_id").Text = ""; 132 + } 133 + 134 + private void _on_canvas_draw() 135 + { 136 + this.mark_hit_area(this.dict_detail, new Color(0.0f, 1.0f, 0.0f), new Color(1.0f, 0.0f, 0.0f)); 137 + this.mark_hit_area(this.dict_pickup, new Color(0.0f, 0.0f, 1.0f), new Color(1.0f, 0.0f, 0.0f)); 138 + } 139 + 140 + private void _on_item_list_item_selected(long index) 141 + { 142 + this.id_mesh = GetNode<ItemList>("Control/ItemList").GetItemText((int)index); 143 + } 144 + }
+99
tests/cubism-probe/addons/gd_cubism/example/demo_effect_hit_area.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var pressed: bool = false 9 + var local_pos: Vector2 = Vector2.ZERO 10 + var adjust_pos: Vector2 = Vector2.ZERO 11 + var dict_detail: Dictionary 12 + var dict_pickup: Dictionary 13 + var id_mesh: String = "" 14 + 15 + 16 + func recalc_model_position(model: GDCubismUserModel): 17 + if model.assets == "": 18 + return 19 + 20 + var canvas_info: Dictionary = model.get_canvas_info() 21 + 22 + if canvas_info.is_empty() != true: 23 + var vct_viewport_size = Vector2(get_viewport_rect().size) 24 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 25 + model.position = vct_viewport_size / 2.0 26 + model.scale = Vector2(scale, scale) 27 + 28 + 29 + func _ready(): 30 + if $GDCubismUserModel.assets == "": 31 + $GDCubismUserModel.assets = DEFAULT_ASSET 32 + 33 + $Control/ItemList.clear() 34 + for id in $GDCubismUserModel.get_meshes(): 35 + $Control/ItemList.add_item(id) 36 + 37 + 38 + func _process(delta): 39 + recalc_model_position($GDCubismUserModel) 40 + 41 + if pressed == true: 42 + $GDCubismUserModel/GDCubismEffectHitArea.set_target(local_pos) 43 + 44 + $Control/lbl_mouse_x.text = "%6.3f" % local_pos.x 45 + $Control/lbl_mouse_y.text = "%6.3f" % local_pos.y 46 + 47 + if id_mesh != "": 48 + dict_pickup = $GDCubismUserModel/GDCubismEffectHitArea.get_detail( 49 + $GDCubismUserModel, 50 + id_mesh 51 + ) 52 + 53 + $Canvas.queue_redraw() 54 + 55 + 56 + func _input(event): 57 + if event as InputEventMouseButton: 58 + pressed = event.is_pressed() 59 + 60 + if event as InputEventMouseMotion: 61 + local_pos = $GDCubismUserModel.to_local(event.position) 62 + 63 + 64 + func mark_hit_area(dict_hit_area: Dictionary, color_box: Color, color_tri: Color): 65 + if dict_hit_area.is_empty() == false: 66 + var r: Rect2 = Rect2( 67 + (dict_hit_area.rect.position - adjust_pos) * $GDCubismUserModel.scale, 68 + dict_hit_area.rect.size * $GDCubismUserModel.scale 69 + ) 70 + $Canvas.draw_rect(r, color_box, false, 5) 71 + 72 + if dict_hit_area.has("vertices") == true: 73 + var v: Array[Vector2] = [ 74 + dict_hit_area.vertices[0] * $GDCubismUserModel.scale, 75 + dict_hit_area.vertices[1] * $GDCubismUserModel.scale, 76 + dict_hit_area.vertices[2] * $GDCubismUserModel.scale 77 + ] 78 + $Canvas.draw_line(v[0] - adjust_pos, v[1] - adjust_pos, color_tri, 3) 79 + $Canvas.draw_line(v[1] - adjust_pos, v[2] - adjust_pos, color_tri, 3) 80 + $Canvas.draw_line(v[2] - adjust_pos, v[0] - adjust_pos, color_tri, 3) 81 + 82 + 83 + func _on_gd_cubism_effect_hit_area_hit_area_entered(model, id): 84 + dict_detail = $GDCubismUserModel/GDCubismEffectHitArea.get_detail(model, id) 85 + $Control/lbl_id.text = id 86 + 87 + 88 + func _on_gd_cubism_effect_hit_area_hit_area_exited(model, id): 89 + dict_detail = {} 90 + $Control/lbl_id.text = "" 91 + 92 + 93 + func _on_canvas_draw(): 94 + mark_hit_area(dict_detail, Color.GREEN, Color.RED) 95 + mark_hit_area(dict_pickup, Color.BLUE, Color.RED) 96 + 97 + 98 + func _on_item_list_item_selected(index): 99 + id_mesh = $Control/ItemList.get_item_text(index)
+87
tests/cubism-probe/addons/gd_cubism/example/demo_effect_hit_area.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://bgus7rihdnj0q"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_hit_area.gd" id="1_v15iy"] 4 + 5 + [node name="demo_effect_hit_area" type="Node2D"] 6 + script = ExtResource("1_v15iy") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectHitArea" type="GDCubismEffectHitArea" parent="GDCubismUserModel"] 11 + 12 + [node name="Canvas" type="Control" parent="."] 13 + z_index = 1024 14 + layout_mode = 3 15 + anchors_preset = 0 16 + offset_left = 640.0 17 + offset_top = 360.0 18 + offset_right = 640.0 19 + offset_bottom = 360.0 20 + 21 + [node name="Control" type="Control" parent="."] 22 + layout_mode = 3 23 + anchors_preset = 15 24 + anchor_right = 1.0 25 + anchor_bottom = 1.0 26 + offset_right = 1280.0 27 + offset_bottom = 720.0 28 + grow_horizontal = 2 29 + grow_vertical = 2 30 + metadata/_edit_use_anchors_ = true 31 + 32 + [node name="lbl_mouse_x" type="Label" parent="Control"] 33 + layout_mode = 1 34 + anchors_preset = 1 35 + anchor_left = 1.0 36 + anchor_right = 1.0 37 + offset_left = -256.0 38 + offset_top = 16.0 39 + offset_right = -128.0 40 + offset_bottom = 48.0 41 + grow_horizontal = 0 42 + text = "0" 43 + horizontal_alignment = 1 44 + vertical_alignment = 1 45 + 46 + [node name="lbl_mouse_y" type="Label" parent="Control"] 47 + layout_mode = 1 48 + anchors_preset = 1 49 + anchor_left = 1.0 50 + anchor_right = 1.0 51 + offset_left = -128.0 52 + offset_top = 16.0 53 + offset_bottom = 48.0 54 + grow_horizontal = 0 55 + text = "0" 56 + horizontal_alignment = 1 57 + vertical_alignment = 1 58 + 59 + [node name="lbl_id" type="Label" parent="Control"] 60 + layout_mode = 1 61 + anchors_preset = 5 62 + anchor_left = 0.5 63 + anchor_right = 0.5 64 + offset_left = -64.0 65 + offset_right = 64.0 66 + offset_bottom = 32.0 67 + grow_horizontal = 2 68 + horizontal_alignment = 1 69 + vertical_alignment = 1 70 + 71 + [node name="ItemList" type="ItemList" parent="Control"] 72 + layout_mode = 1 73 + anchors_preset = 11 74 + anchor_left = 1.0 75 + anchor_right = 1.0 76 + anchor_bottom = 1.0 77 + offset_left = -208.0 78 + offset_top = 64.0 79 + offset_right = -16.0 80 + offset_bottom = -32.0 81 + grow_horizontal = 0 82 + grow_vertical = 2 83 + 84 + [connection signal="hit_area_entered" from="GDCubismUserModel/GDCubismEffectHitArea" to="." method="_on_gd_cubism_effect_hit_area_hit_area_entered"] 85 + [connection signal="hit_area_exited" from="GDCubismUserModel/GDCubismEffectHitArea" to="." method="_on_gd_cubism_effect_hit_area_hit_area_exited"] 86 + [connection signal="draw" from="Canvas" to="." method="_on_canvas_draw"] 87 + [connection signal="item_selected" from="Control/ItemList" to="." method="_on_item_list_item_selected"]
+70
tests/cubism-probe/addons/gd_cubism/example/demo_effect_target_point.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2025 MizunagiKB <mizukb@live.jp> 3 + using Godot; 4 + using System; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_effect_target_point : Node2D 11 + { 12 + const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + private GDCubismEffectTargetPointCS cubism_efx; 16 + 17 + private bool pressed = false; 18 + 19 + 20 + private void recalc_model_position(GDCubismUserModelCS model) 21 + { 22 + if(model.Assets == "") return; 23 + 24 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 25 + 26 + if(canvas_info.Count > 0) 27 + { 28 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 29 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 30 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 31 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 32 + model.GetInternalObject().Scale = new(scale, scale); 33 + } 34 + } 35 + 36 + public override void _Ready() 37 + { 38 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 39 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 40 + 41 + this.cubism_efx = new(GetNode<Node>("GDCubismUserModel/GDCubismEffectTargetPoint")); 42 + } 43 + 44 + public override void _Process(double delta) 45 + { 46 + this.recalc_model_position(this.cubism_model); 47 + base._Process(delta); 48 + } 49 + 50 + public override void _Input(InputEvent @event) 51 + { 52 + if (@event is InputEventMouseButton evt_mouse_button) 53 + { 54 + this.pressed = evt_mouse_button.IsPressed(); 55 + } 56 + 57 + if (@event is InputEventMouseMotion evt_mouse_motion) 58 + { 59 + if (this.pressed == true) 60 + { 61 + Vector2 calc_pos = this.cubism_model.GetInternalObject().ToLocal(evt_mouse_motion.Position) * new Vector2(1.0f, -1.0f); 62 + this.cubism_efx.SetTarget(calc_pos.Normalized()); 63 + } else { 64 + this.cubism_efx.SetTarget(Vector2.Zero); 65 + } 66 + } 67 + 68 + base._Input(@event); 69 + } 70 + }
+42
tests/cubism-probe/addons/gd_cubism/example/demo_effect_target_point.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var pressed: bool = false 9 + 10 + 11 + func recalc_model_position(model: GDCubismUserModel): 12 + if model.assets == "": 13 + return 14 + 15 + var canvas_info: Dictionary = model.get_canvas_info() 16 + 17 + if canvas_info.is_empty() != true: 18 + var vct_viewport_size = Vector2(get_viewport_rect().size) 19 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 20 + model.position = vct_viewport_size / 2.0 21 + model.scale = Vector2(scale, scale) 22 + 23 + 24 + func _ready(): 25 + if $GDCubismUserModel.assets == "": 26 + $GDCubismUserModel.assets = DEFAULT_ASSET 27 + 28 + 29 + func _process(delta): 30 + self.recalc_model_position($GDCubismUserModel) 31 + 32 + 33 + func _input(event): 34 + if event as InputEventMouseButton: 35 + pressed = event.is_pressed() 36 + 37 + if event as InputEventMouseMotion: 38 + if pressed == true: 39 + var calc_pos: Vector2 = $GDCubismUserModel.to_local(event.position) * Vector2(1, -1) 40 + $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(calc_pos.normalized()) 41 + else: 42 + $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(Vector2.ZERO)
+10
tests/cubism-probe/addons/gd_cubism/example/demo_effect_target_point.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://dhfu0rwvwpprc"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_effect_target_point.gd" id="1_j4tk3"] 4 + 5 + [node name="demo_effect_target_point" type="Node2D"] 6 + script = ExtResource("1_j4tk3") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectTargetPoint" type="GDCubismEffectTargetPoint" parent="GDCubismUserModel"]
+67
tests/cubism-probe/addons/gd_cubism/example/demo_fade.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_fade : Node2D 11 + { 12 + const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + GDCubismUserModelCS cubism_model; 15 + GDCubismUserModelCS cubism_model_sv; 16 + 17 + double color_h; 18 + 19 + 20 + private void recalc_model_position(GDCubismUserModelCS model) 21 + { 22 + if(model.Assets == "") return; 23 + 24 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 25 + 26 + if(canvas_info.Count > 0) 27 + { 28 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 29 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 30 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 31 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 32 + model.GetInternalObject().Scale = new(scale, scale); 33 + } 34 + } 35 + 36 + public override void _Ready() 37 + { 38 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 39 + if (this.cubism_model.Assets == "") 40 + { 41 + this.cubism_model.Assets = DEFAULT_ASSET; 42 + } 43 + 44 + this.cubism_model_sv = new(GetNode<Node2D>("Sprite2D/SubViewport/GDCubismUserModel")); 45 + if (this.cubism_model_sv.Assets == "") 46 + { 47 + this.cubism_model_sv.Assets = DEFAULT_ASSET; 48 + } 49 + 50 + this.color_h = GetNode<HSlider>("HSlider").Value; 51 + } 52 + 53 + public override void _Process(double delta) 54 + { 55 + this.color_h += (delta * 0.25); 56 + 57 + if (this.color_h > 360.0) 58 + { 59 + this.color_h -= 360.0; 60 + } 61 + 62 + Color color = Color.FromHsv((float)this.color_h, 1.0f, 1.0f, (float)GetNode<HSlider>("HSlider").Value / 100.0f); 63 + 64 + this.cubism_model.GetInternalObject().Modulate = color; 65 + GetNode<Sprite2D>("Sprite2D").Modulate = color; 66 + } 67 + }
+41
tests/cubism-probe/addons/gd_cubism/example/demo_fade.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2025 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + var color_h: float = 0.0 9 + 10 + 11 + func recalc_model_position(model: GDCubismUserModel): 12 + if model.assets == "": 13 + return 14 + 15 + var canvas_info: Dictionary = model.get_canvas_info() 16 + 17 + if canvas_info.is_empty() != true: 18 + var vct_viewport_size = Vector2(get_viewport_rect().size) 19 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 20 + model.position = vct_viewport_size / 2.0 21 + model.scale = Vector2(scale, scale) 22 + 23 + 24 + func _ready() -> void: 25 + if $GDCubismUserModel.assets == "": 26 + $GDCubismUserModel.assets = DEFAULT_ASSET 27 + 28 + if $Sprite2D/SubViewport/GDCubismUserModel.assets == "": 29 + $Sprite2D/SubViewport/GDCubismUserModel.assets = DEFAULT_ASSET 30 + 31 + 32 + func _process(delta: float) -> void: 33 + color_h += (delta * 0.25); 34 + 35 + if color_h > 360.0: 36 + color_h -= 360.0 37 + 38 + var color: Color = Color.from_hsv(color_h, 1.0, 1.0, $HSlider.value / 100.0) 39 + 40 + $GDCubismUserModel.modulate = color 41 + $Sprite2D.modulate = color
+52
tests/cubism-probe/addons/gd_cubism/example/demo_fade.tscn
··· 1 + [gd_scene load_steps=3 format=3 uid="uid://rdteqxrmttct"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_fade.gd" id="1_3vqxl"] 4 + 5 + [sub_resource type="ViewportTexture" id="ViewportTexture_nt5uq"] 6 + viewport_path = NodePath("Sprite2D/SubViewport") 7 + 8 + [node name="demo_fade" type="Node2D"] 9 + script = ExtResource("1_3vqxl") 10 + metadata/_edit_vertical_guides_ = [640.0, 320.0, 960.0] 11 + metadata/_edit_horizontal_guides_ = [640.0] 12 + 13 + [node name="Label1" type="Label" parent="."] 14 + offset_top = 640.0 15 + offset_right = 640.0 16 + offset_bottom = 704.0 17 + text = "Direct Rendering" 18 + horizontal_alignment = 1 19 + vertical_alignment = 2 20 + 21 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 22 + position = Vector2(320, 360) 23 + scale = Vector2(0.075, 0.075) 24 + 25 + [node name="Label2" type="Label" parent="."] 26 + offset_left = 640.0 27 + offset_top = 640.0 28 + offset_right = 1280.0 29 + offset_bottom = 703.0 30 + text = "SubViewport" 31 + horizontal_alignment = 1 32 + vertical_alignment = 2 33 + 34 + [node name="Sprite2D" type="Sprite2D" parent="."] 35 + position = Vector2(960, 512) 36 + texture = SubResource("ViewportTexture_nt5uq") 37 + 38 + [node name="SubViewport" type="SubViewport" parent="Sprite2D"] 39 + disable_3d = true 40 + transparent_bg = true 41 + size = Vector2i(512, 1024) 42 + 43 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="Sprite2D/SubViewport"] 44 + position = Vector2(256, 360) 45 + scale = Vector2(0.075, 0.075) 46 + 47 + [node name="HSlider" type="HSlider" parent="."] 48 + offset_left = 16.0 49 + offset_top = 16.0 50 + offset_right = 1264.0 51 + offset_bottom = 48.0 52 + value = 100.0
+11
tests/cubism-probe/addons/gd_cubism/example/demo_simple.tscn
··· 1 + [gd_scene format=3 uid="uid://dab25molfpkce"] 2 + 3 + [node name="simple" type="Node2D"] 4 + 5 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 6 + position = Vector2(640, 360) 7 + scale = Vector2(0.075, 0.075) 8 + 9 + [node name="GDCubismEffectEyeBlink" type="GDCubismEffectEyeBlink" parent="GDCubismUserModel"] 10 + 11 + [node name="GDCubismEffectBreath" type="GDCubismEffectBreath" parent="GDCubismUserModel"]
+237
tests/cubism-probe/addons/gd_cubism/example/demo_transparent.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class demo_transparent : Node2D 11 + { 12 + private const System.String DEFAULT_ASSET = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json"; 13 + 14 + private GDCubismUserModelCS cubism_model; 15 + 16 + private System.String[] CONVEX_MESH_SRC = { 17 + "ArtMesh121", 18 + "ArtMesh122", 19 + "ArtMesh135", 20 + "ArtMesh146", 21 + "ArtMesh147", 22 + "ArtMesh231", 23 + "ArtMesh278" 24 + }; 25 + private bool order_window_position = false; 26 + private bool mouse_button_pressed = false; 27 + private Vector2I window_position; 28 + private Vector2 mouse_position; 29 + 30 + private bool enable_transparent = false; 31 + private Godot.Collections.Array<System.String> ary_character_expression = new(); 32 + private Godot.Collections.Array ary_character_motion = new(); 33 + 34 + private Polygon2D polygon_2d; 35 + 36 + 37 + // ----------------------------------------------------------------- ported 38 + // I have ported the code for check_cross and convex_hull to GDScript. 39 + // * https://tjkendev.github.io/procon-library/ 40 + // * https://tjkendev.github.io/procon-library/cpp/geometry/graham_scan.html 41 + 42 + private static bool check_cross(Godot.Collections.Array<Vector2> ary_check, Vector2 vtx) 43 + { 44 + Vector2 va = ary_check[^2]; 45 + Vector2 vb = ary_check[^1]; 46 + 47 + return (((vb.X - va.X) * (vtx.Y - va.Y)) - ((vb.Y - va.Y) * (vtx.X - va.X))) > 0; 48 + } 49 + 50 + private static Godot.Collections.Array<Vector2> convex_hull(Godot.Collections.Array<Vector2> ary_vertex) 51 + { 52 + ary_vertex.Sort(); 53 + 54 + Godot.Collections.Array<Vector2> ary_result = new(); 55 + int n = ary_vertex.Count; 56 + 57 + foreach (Vector2 vtx in ary_vertex) 58 + { 59 + while (ary_result.Count > 1 && check_cross(ary_result, vtx)) 60 + { 61 + ary_result.RemoveAt(ary_result.Count - 1); 62 + } 63 + ary_result.Insert(ary_result.Count, vtx); 64 + } 65 + 66 + int t = ary_result.Count; 67 + 68 + int i = n - 2; 69 + while (i >= 0) 70 + { 71 + Vector2 vtx = ary_vertex[i]; 72 + while (ary_result.Count > t && check_cross(ary_result, vtx)) 73 + { 74 + ary_result.RemoveAt(ary_result.Count - 1); 75 + } 76 + ary_result.Insert(ary_result.Count, vtx); 77 + 78 + i--; 79 + } 80 + 81 + ary_result.RemoveAt(ary_result.Count - 1); 82 + 83 + return ary_result; 84 + } 85 + 86 + private void recalc_model_position(GDCubismUserModelCS model) 87 + { 88 + if(model.Assets == "") return; 89 + 90 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 91 + 92 + if(canvas_info.Count > 0) 93 + { 94 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 95 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 96 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 97 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 98 + model.GetInternalObject().Scale = new(scale, scale); 99 + } 100 + } 101 + 102 + public override void _Ready() 103 + { 104 + this.cubism_model = new(GetNode<Node2D>("GDCubismUserModel")); 105 + if (this.cubism_model.Assets == "") this.cubism_model.Assets = DEFAULT_ASSET; 106 + 107 + this.recalc_model_position(this.cubism_model); 108 + this.polygon_2d = GetNode<Polygon2D>("Polygon2D"); 109 + 110 + this.ary_character_expression = this.cubism_model.GetExpressions(); 111 + 112 + Godot.Collections.Dictionary<System.String, int> dict_motion = this.cubism_model.GetMotions(); 113 + 114 + foreach (var (k, item_count) in dict_motion) 115 + { 116 + for (int no = 0; no < item_count; no++) 117 + { 118 + this.ary_character_motion.Add( 119 + new Godot.Collections.Dictionary { { "group", k }, { "no", no } } 120 + ); 121 + } 122 + } 123 + } 124 + 125 + public override void _Process(double delta) 126 + { 127 + if (this.order_window_position == true) 128 + { 129 + DisplayServer.WindowSetPosition(new Vector2I(this.window_position.X, this.window_position.Y)); 130 + this.order_window_position = false; 131 + } 132 + 133 + Godot.Collections.Dictionary dict_mesh = this.cubism_model.GetMeshes(); 134 + Godot.Collections.Array<Vector2> ary = new(); 135 + 136 + foreach (System.String name in CONVEX_MESH_SRC) 137 + { 138 + Godot.Collections.Array<Vector2> ary_vtx = (Godot.Collections.Array<Vector2>)((MeshInstance2D)dict_mesh[name]).Mesh.SurfaceGetArrays(0)[(int)Mesh.ArrayType.Vertex]; 139 + ary += ary_vtx; 140 + } 141 + 142 + Godot.Collections.Array<Vector2> ary_polygon = convex_hull(ary); 143 + 144 + if (ary_polygon.Count > 2) 145 + { 146 + Vector2[] region = System.Array.Empty<Vector2>(); 147 + 148 + foreach (Vector2 _v in ary_polygon) 149 + { 150 + Vector2 v = _v; 151 + v *= this.cubism_model.GetInternalObject().Scale; 152 + v += this.cubism_model.GetInternalObject().Position; 153 + System.Array.Resize(ref region, region.Length + 1); 154 + region[^1] = v; 155 + } 156 + 157 + this.polygon_2d.Polygon = region; 158 + } 159 + } 160 + 161 + public override void _Input(InputEvent @event) 162 + { 163 + if (@event is InputEventKey inputKey) 164 + { 165 + if (inputKey.IsPressed() == true) 166 + { 167 + if (inputKey.Keycode == Key.Escape) 168 + { 169 + GetTree().Quit(); 170 + } 171 + 172 + if (inputKey.Keycode == Key.Space) 173 + { 174 + var random = new RandomNumberGenerator(); 175 + 176 + Godot.Collections.Dictionary motion = (Godot.Collections.Dictionary)ary_character_motion[random.RandiRange(0, ary_character_motion.Count - 1)]; 177 + this.cubism_model.StartMotionLoop( 178 + (System.String)motion["group"], 179 + (int)motion["no"], 180 + GDCubismUserModelCS.PriorityEnum.PriorityForce, 181 + true, 182 + true 183 + ); 184 + } 185 + 186 + if (inputKey.Keycode == Key.Tab) 187 + { 188 + if (this.enable_transparent == true) 189 + { 190 + this.enable_transparent = false; 191 + DisplayServer.WindowSetMousePassthrough(System.Array.Empty<Vector2>()); 192 + } 193 + else 194 + { 195 + this.enable_transparent = true; 196 + DisplayServer.WindowSetMousePassthrough(this.polygon_2d.Polygon); 197 + } 198 + GetTree().Root.TransparentBg = this.enable_transparent; 199 + DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.Transparent, this.enable_transparent); 200 + DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.AlwaysOnTop, true); 201 + } 202 + 203 + if (inputKey.Keycode >= Key.Key0 && inputKey.Keycode <= Key.Key9) 204 + { 205 + long index = inputKey.Keycode - Key.Key0; 206 + if (index < this.ary_character_expression.Count) 207 + { 208 + this.cubism_model.StartExpression(this.ary_character_expression[(int)index]); 209 + } 210 + } 211 + } 212 + } 213 + 214 + if (@event is InputEventMouseButton eventMouseButton) 215 + { 216 + if (eventMouseButton.Pressed == true) 217 + { 218 + this.window_position = DisplayServer.WindowGetPosition(); 219 + this.mouse_position = GetViewport().GetMousePosition(); 220 + } 221 + else 222 + { 223 + GetViewport().WarpMouse(this.mouse_position); 224 + } 225 + this.mouse_button_pressed = eventMouseButton.Pressed; 226 + } 227 + 228 + if (@event is InputEventMouseMotion inputMouseMotion) 229 + { 230 + if (this.mouse_button_pressed == true) 231 + { 232 + this.order_window_position = true; 233 + this.window_position += new Vector2I((int)inputMouseMotion.Relative.X, (int)inputMouseMotion.Relative.Y); 234 + } 235 + } 236 + } 237 + }
+165
tests/cubism-probe/addons/gd_cubism/example/demo_transparent.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Node2D 4 + 5 + 6 + const DEFAULT_ASSET: String = "res://addons/gd_cubism/example/res/live2d/mao_pro_jp/runtime/mao_pro.model3.json" 7 + 8 + const CONVEX_MESH_SRC: Array[String] = [ 9 + "ArtMesh121", 10 + "ArtMesh122", 11 + "ArtMesh135", 12 + "ArtMesh146", 13 + "ArtMesh147", 14 + "ArtMesh231", 15 + "ArtMesh278" 16 + ] 17 + var order_window_position: bool = false 18 + var mouse_button_pressed: bool = false 19 + var window_position: Vector2i 20 + var mouse_position: Vector2 21 + 22 + var enable_transparent: bool = false 23 + var ary_character_expression: Array 24 + var ary_character_motion: Array 25 + 26 + 27 + # ---------------------------------------------------------------------- ported 28 + # I have ported the code for check_cross and convex_hull to GDScript. 29 + # * https://tjkendev.github.io/procon-library/ 30 + # * https://tjkendev.github.io/procon-library/cpp/geometry/graham_scan.html 31 + 32 + func check_cross(ary_check: Array, vtx: Vector2) -> bool: 33 + var va: Vector2 = ary_check[ary_check.size() - 2] 34 + var vb: Vector2 = ary_check[ary_check.size() - 1] 35 + 36 + return (((vb.x - va.x) * (vtx.y - va.y)) - ((vb.y - va.y) * (vtx.x - va.x))) > 0 37 + 38 + 39 + func convex_hull(ary_vertex: Array[Vector2]) -> Array: 40 + ary_vertex.sort() 41 + 42 + var ary_result: Array 43 + var n: int = ary_vertex.size() 44 + 45 + for vtx in ary_vertex: 46 + while ary_result.size() > 1 and check_cross(ary_result, vtx): 47 + ary_result.pop_back() 48 + ary_result.push_back(vtx) 49 + 50 + var t: int = ary_result.size() 51 + 52 + var i: int = n - 2 53 + while i >= 0: 54 + var vtx: Vector2 = ary_vertex[i] 55 + while ary_result.size() > t and check_cross(ary_result, vtx): 56 + ary_result.pop_back() 57 + ary_result.push_back(vtx) 58 + 59 + i -= 1 60 + 61 + ary_result.pop_back() 62 + 63 + return ary_result 64 + 65 + # ---------------------------------------------------------------------- ported 66 + 67 + 68 + func recalc_model_position(model: GDCubismUserModel): 69 + if model.assets == "": 70 + return 71 + 72 + var canvas_info: Dictionary = model.get_canvas_info() 73 + 74 + if canvas_info.is_empty() != true: 75 + var vct_viewport_size = Vector2(get_viewport_rect().size) 76 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 77 + model.position = vct_viewport_size / 2.0 78 + model.scale = Vector2(scale, scale) 79 + 80 + 81 + func _ready(): 82 + if $GDCubismUserModel.assets == "": 83 + $GDCubismUserModel.assets = DEFAULT_ASSET 84 + 85 + recalc_model_position($GDCubismUserModel) 86 + 87 + ary_character_expression = $GDCubismUserModel.get_expressions() 88 + 89 + var dict_motion = $GDCubismUserModel.get_motions() 90 + for group in dict_motion.keys(): 91 + for no in range(dict_motion[group]): 92 + ary_character_motion.append({"group": group, "no": no}) 93 + 94 + 95 + func _process(delta): 96 + if order_window_position == true: 97 + DisplayServer.window_set_position(Vector2i(window_position)) 98 + order_window_position = false 99 + 100 + var dict_mesh = $GDCubismUserModel.get_meshes() 101 + var ary: PackedVector2Array 102 + 103 + for name in CONVEX_MESH_SRC: 104 + ary += dict_mesh[name].get_mesh().surface_get_arrays(0)[Mesh.ARRAY_VERTEX] 105 + 106 + var ary_polygon = convex_hull(ary) 107 + 108 + if ary_polygon.size() > 2: 109 + var region: PackedVector2Array 110 + var adjust: Vector2 = get_viewport_rect().size 111 + 112 + for v in ary_polygon: 113 + v *= $GDCubismUserModel.scale 114 + v += $GDCubismUserModel.position 115 + region.append(v) 116 + 117 + $Polygon2D.polygon = PackedVector2Array(region) 118 + 119 + 120 + func _input(event): 121 + if event is InputEventKey: 122 + if event.is_pressed() == true: 123 + 124 + if event.keycode == KEY_ESCAPE: 125 + get_tree().quit() 126 + 127 + if event.keycode == KEY_SPACE: 128 + var motion = ary_character_motion[randi_range(0, ary_character_motion.size() - 1)] 129 + $GDCubismUserModel.start_motion_loop( 130 + motion.group, 131 + motion.no, 132 + GDCubismUserModel.PRIORITY_FORCE, 133 + true, 134 + true 135 + ) 136 + if event.keycode == KEY_TAB: 137 + if enable_transparent == true: 138 + enable_transparent = false 139 + DisplayServer.window_set_mouse_passthrough([]) 140 + else: 141 + enable_transparent = true 142 + DisplayServer.window_set_mouse_passthrough($Polygon2D.polygon) 143 + get_tree().root.transparent_bg = enable_transparent 144 + DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, enable_transparent, 0) 145 + DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_ALWAYS_ON_TOP, true, 0) 146 + 147 + if event.keycode >= KEY_0 and event.keycode <= KEY_9: 148 + var index: int = event.keycode - KEY_0 149 + if index < ary_character_expression.size(): 150 + $GDCubismUserModel.start_expression( 151 + ary_character_expression[index] 152 + ) 153 + 154 + if event is InputEventMouseButton: 155 + if event.pressed == true: 156 + window_position = DisplayServer.window_get_position() 157 + mouse_position = get_viewport().get_mouse_position() 158 + else: 159 + get_viewport().warp_mouse(mouse_position) 160 + mouse_button_pressed = event.pressed 161 + 162 + if event is InputEventMouseMotion: 163 + if mouse_button_pressed == true: 164 + order_window_position = true 165 + window_position += Vector2i(event.relative)
+28
tests/cubism-probe/addons/gd_cubism/example/demo_transparent.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://7hglgm6o0ou4"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/demo_transparent.gd" id="1_v7gdn"] 4 + 5 + [node name="demo_transparent" type="Node2D"] 6 + script = ExtResource("1_v7gdn") 7 + 8 + [node name="GDCubismUserModel" type="GDCubismUserModel" parent="."] 9 + 10 + [node name="GDCubismEffectBreath" type="GDCubismEffectBreath" parent="GDCubismUserModel"] 11 + 12 + [node name="GDCubismEffectEyeBlink" type="GDCubismEffectEyeBlink" parent="GDCubismUserModel"] 13 + 14 + [node name="Polygon2D" type="Polygon2D" parent="."] 15 + z_index = 1024 16 + color = Color(1, 0, 0, 0.498039) 17 + 18 + [node name="lbl_usage" type="Label" parent="."] 19 + offset_left = 960.0 20 + offset_top = 16.0 21 + offset_right = 1262.0 22 + offset_bottom = 146.0 23 + text = "TAB Key: Window transparent. 24 + SPACE Key: Change motion. 25 + 0 - 9 Key: Change expression. 26 + 27 + Mouse buttn drag: Window move." 28 + horizontal_alignment = 2
+2
tests/cubism-probe/addons/gd_cubism/example/res/live2d/.gitignore
··· 1 + * 2 + !.gitignore
+137
tests/cubism-probe/addons/gd_cubism/example/viewer.cs
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + using System; 4 + using Godot; 5 + 6 + 7 + #pragma warning disable IDE1006 8 + 9 + 10 + public partial class viewer : Control 11 + { 12 + const bool ENABLE_MOTION_FINISHED = true; 13 + 14 + GDCubismUserModelCS cubism_model; 15 + Godot.Collections.Dictionary last_motion; 16 + 17 + private void recalc_model_position(GDCubismUserModelCS model) 18 + { 19 + if(model.Assets == "") return; 20 + 21 + Godot.Collections.Dictionary canvas_info = model.GetCanvasInfo(); 22 + 23 + if(canvas_info.Count > 0) 24 + { 25 + Vector2 vct_viewport_size = new(GetViewportRect().Size.X, GetViewportRect().Size.Y); 26 + Vector2 size_in_pixels = (Vector2)canvas_info["size_in_pixels"]; 27 + float scale = vct_viewport_size.Y / Math.Max(size_in_pixels.X, size_in_pixels.Y); 28 + model.GetInternalObject().Position = new(vct_viewport_size.X * 0.5f, vct_viewport_size.Y * 0.5f); 29 + model.GetInternalObject().Scale = new(scale, scale); 30 + } 31 + } 32 + 33 + public void Setup(String pathname) 34 + { 35 + this.cubism_model.Assets = pathname; 36 + 37 + this.recalc_model_position(this.cubism_model); 38 + 39 + int idx = 0; 40 + Godot.Collections.Dictionary<String, int> dict_motion = this.cubism_model.GetMotions(); 41 + GetNode<ItemList>("UI/ItemListMotion").Clear(); 42 + foreach (var (k, item_count) in dict_motion) 43 + { 44 + for (int v = 0; v < item_count; v++) 45 + { 46 + GetNode<ItemList>("UI/ItemListMotion").AddItem($"{k}_{v}"); 47 + GetNode<ItemList>("UI/ItemListMotion").SetItemMetadata( 48 + idx, 49 + new Godot.Collections.Dictionary { { "group", k }, { "no", v } } 50 + ); 51 + idx++; 52 + } 53 + } 54 + 55 + GetNode<ItemList>("UI/ItemListExpression").Clear(); 56 + Godot.Collections.Array<String> ary_item = this.cubism_model.GetExpressions(); 57 + foreach (var item in ary_item) 58 + { 59 + GetNode<ItemList>("UI/ItemListExpression").AddItem($"{item}"); 60 + } 61 + 62 + this.cubism_model.PlaybackProcessMode = GDCubismUserModelCS.MotionProcessCallbackEnum.Idle; 63 + } 64 + 65 + public void Model3Search(String dirname) 66 + { 67 + DirAccess dir = DirAccess.Open(dirname); 68 + if (dir == null) return; 69 + 70 + dir.ListDirBegin(); 71 + var name = dir.GetNext(); 72 + 73 + while (name != "") 74 + { 75 + if (dir.CurrentIsDir()) 76 + { 77 + Model3Search(dirname.PathJoin(name)); 78 + } 79 + else 80 + { 81 + if (name.EndsWith(".model3.json")) 82 + { 83 + GD.Print(dirname.PathJoin(name)); 84 + GetNode<OptionButton>("UI/OptModel").AddItem(dirname.PathJoin(name)); 85 + } 86 + } 87 + name = dir.GetNext(); 88 + } 89 + } 90 + 91 + public override void _Ready() 92 + { 93 + this.cubism_model = new GDCubismUserModelCS(); 94 + this.AddChild(this.cubism_model.GetInternalObject()); 95 + 96 + if (ENABLE_MOTION_FINISHED == true) 97 + { 98 + this.cubism_model.MotionFinished += this._on_motion_finished; 99 + } 100 + 101 + GetNode<OptionButton>("UI/OptModel").Clear(); 102 + GetNode<OptionButton>("UI/OptModel").AddItem(""); 103 + Model3Search("res://addons/gd_cubism/example/res/live2d"); 104 + } 105 + 106 + private void _on_motion_finished() 107 + { 108 + this.cubism_model.StartMotion( 109 + (String)this.last_motion["group"], 110 + (int)this.last_motion["no"], 111 + GDCubismUserModelCS.PriorityEnum.PriorityForce 112 + ); 113 + } 114 + 115 + public void _on_opt_model_item_selected(long index) 116 + { 117 + Setup(GetNode<OptionButton>("UI/OptModel").GetItemText((int)index)); 118 + } 119 + 120 + private void _on_item_list_motion_item_selected(long index) 121 + { 122 + var _motion = GetNode<ItemList>("UI/ItemListMotion").GetItemMetadata((int)index); 123 + Godot.Collections.Dictionary motion = (Godot.Collections.Dictionary)_motion; 124 + this.cubism_model.StartMotion( 125 + (String)motion["group"], 126 + (int)motion["no"], 127 + GDCubismUserModelCS.PriorityEnum.PriorityForce 128 + ); 129 + this.last_motion = motion; 130 + } 131 + 132 + public void _on_item_list_expression_item_selected(long index) 133 + { 134 + var _expression_id = GetNode<ItemList>("UI/ItemListExpression").GetItemText((int)index); 135 + this.cubism_model.StartExpression((String)_expression_id); 136 + } 137 + }
+96
tests/cubism-probe/addons/gd_cubism/example/viewer.gd
··· 1 + # SPDX-License-Identifier: MIT 2 + # SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + extends Control 4 + 5 + 6 + const ENABLE_MOTION_FINISHED := true 7 + 8 + var cubism_model: GDCubismUserModel 9 + var last_motion = null 10 + 11 + 12 + func recalc_model_position(model: GDCubismUserModel): 13 + if model.assets == "": 14 + return 15 + 16 + var canvas_info: Dictionary = model.get_canvas_info() 17 + 18 + if canvas_info.is_empty() != true: 19 + var vct_viewport_size = Vector2(get_viewport_rect().size) 20 + var scale: float = vct_viewport_size.y / max(canvas_info.size_in_pixels.x, canvas_info.size_in_pixels.y) 21 + model.position = vct_viewport_size / 2.0 22 + model.scale = Vector2(scale, scale) 23 + 24 + 25 + func setup(pathname: String): 26 + cubism_model.assets = pathname 27 + 28 + recalc_model_position(cubism_model) 29 + 30 + var idx: int = 0 31 + var dict_motion = cubism_model.get_motions() 32 + $UI/ItemListMotion.clear() 33 + for k in dict_motion: 34 + for v in range(dict_motion[k]): 35 + $UI/ItemListMotion.add_item("{0}_{1}".format([k, v])) 36 + $UI/ItemListMotion.set_item_metadata(idx, {"group": k, "no": v}) 37 + idx += 1 38 + 39 + $UI/ItemListExpression.clear() 40 + for item in cubism_model.get_expressions(): 41 + $UI/ItemListExpression.add_item(item) 42 + 43 + cubism_model.playback_process_mode = GDCubismUserModel.IDLE 44 + 45 + 46 + func model3_search(dirname: String): 47 + 48 + var dir: DirAccess = DirAccess.open(dirname) 49 + if dir == null: 50 + return 51 + 52 + dir.list_dir_begin() 53 + var name = dir.get_next() 54 + while name != "": 55 + if dir.current_is_dir(): 56 + model3_search(dirname.path_join(name)) 57 + else: 58 + if name.ends_with(".model3.json"): 59 + print(dirname.path_join(name)) 60 + $UI/OptModel.add_item(dirname.path_join(name)) 61 + name = dir.get_next() 62 + 63 + 64 + func _ready(): 65 + cubism_model = GDCubismUserModel.new() 66 + self.add_child(cubism_model) 67 + 68 + if ENABLE_MOTION_FINISHED == true: 69 + cubism_model.motion_finished.connect(_on_motion_finished) 70 + 71 + $UI/OptModel.clear() 72 + $UI/OptModel.add_item("") 73 + model3_search("res://addons/gd_cubism/example/res/live2d") 74 + 75 + 76 + func _on_motion_finished(): 77 + cubism_model.start_motion( 78 + last_motion.group, 79 + last_motion.no, 80 + GDCubismUserModel.PRIORITY_FORCE 81 + ) 82 + 83 + 84 + func _on_opt_model_item_selected(index): 85 + setup($UI/OptModel.get_item_text(index)) 86 + 87 + 88 + func _on_item_list_motion_item_selected(index): 89 + var motion = $UI/ItemListMotion.get_item_metadata(index) 90 + var m = cubism_model.start_motion(motion.group, motion.no, GDCubismUserModel.PRIORITY_FORCE) 91 + last_motion = motion 92 + 93 + 94 + func _on_item_list_expression_item_selected(index): 95 + var expression_id = $UI/ItemListExpression.get_item_text(index) 96 + cubism_model.start_expression(expression_id)
+63
tests/cubism-probe/addons/gd_cubism/example/viewer.tscn
··· 1 + [gd_scene load_steps=2 format=3 uid="uid://dy5erb1lkxh7t"] 2 + 3 + [ext_resource type="Script" path="res://addons/gd_cubism/example/viewer.gd" id="1_wysar"] 4 + 5 + [node name="viewer" type="Control"] 6 + layout_mode = 3 7 + anchors_preset = 15 8 + anchor_right = 1.0 9 + anchor_bottom = 1.0 10 + grow_horizontal = 2 11 + grow_vertical = 2 12 + script = ExtResource("1_wysar") 13 + metadata/_edit_lock_ = true 14 + 15 + [node name="UI" type="Control" parent="."] 16 + layout_mode = 1 17 + anchors_preset = 15 18 + anchor_right = 1.0 19 + anchor_bottom = 1.0 20 + grow_horizontal = 2 21 + grow_vertical = 2 22 + 23 + [node name="OptModel" type="OptionButton" parent="UI"] 24 + layout_mode = 1 25 + anchors_preset = 10 26 + anchor_right = 1.0 27 + offset_left = 16.0 28 + offset_top = 16.0 29 + offset_right = -16.0 30 + offset_bottom = 48.0 31 + grow_horizontal = 2 32 + 33 + [node name="ItemListMotion" type="ItemList" parent="UI"] 34 + layout_mode = 1 35 + anchors_preset = 3 36 + anchor_left = 1.0 37 + anchor_top = 1.0 38 + anchor_right = 1.0 39 + anchor_bottom = 1.0 40 + offset_left = -256.0 41 + offset_top = -392.0 42 + offset_right = -16.0 43 + offset_bottom = -201.0 44 + grow_horizontal = 0 45 + grow_vertical = 0 46 + 47 + [node name="ItemListExpression" type="ItemList" parent="UI"] 48 + layout_mode = 1 49 + anchors_preset = 3 50 + anchor_left = 1.0 51 + anchor_top = 1.0 52 + anchor_right = 1.0 53 + anchor_bottom = 1.0 54 + offset_left = -256.0 55 + offset_top = -184.0 56 + offset_right = -16.0 57 + offset_bottom = -57.0 58 + grow_horizontal = 0 59 + grow_vertical = 0 60 + 61 + [connection signal="item_selected" from="UI/OptModel" to="." method="_on_opt_model_item_selected"] 62 + [connection signal="item_selected" from="UI/ItemListMotion" to="." method="_on_item_list_motion_item_selected"] 63 + [connection signal="item_selected" from="UI/ItemListExpression" to="." method="_on_item_list_expression_item_selected"]
+18
tests/cubism-probe/addons/gd_cubism/gd_cubism.gdextension
··· 1 + [configuration] 2 + entry_symbol = "gd_cubism_library_init" 3 + compatibility_minimum = "4.4" 4 + 5 + [libraries] 6 + macos.debug = "res://addons/gd_cubism/bin/macos/libgd_cubism.macos.debug.framework" 7 + macos.release = "res://addons/gd_cubism/bin/macos/libgd_cubism.macos.release.framework" 8 + windows.debug.x86_64 = "res://addons/gd_cubism/bin/windows/x86_64/libgd_cubism.windows.debug.x86_64.dll" 9 + windows.release.x86_64 = "res://addons/gd_cubism/bin/windows/x86_64/libgd_cubism.windows.release.x86_64.dll" 10 + linux.debug.x86_64 = "res://addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" 11 + linux.release.x86_64 = "res://addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" 12 + ios.debug = "res://addons/gd_cubism/bin/ios/libgd_cubism.ios.debug.dylib" 13 + ios.release = "res://addons/gd_cubism/bin/ios/libgd_cubism.ios.release.dylib" 14 + android.debug.arm32 = "res://addons/gd_cubism/bin/android/arm32/libgd_cubism.android.debug.arm32.so" 15 + android.release.arm32 = "res://addons/gd_cubism/bin/android/arm32/libgd_cubism.android.release.arm32.so" 16 + android.debug.arm64 = "res://addons/gd_cubism/bin/android/arm64/libgd_cubism.android.debug.arm64.so" 17 + android.release.arm64 = "res://addons/gd_cubism/bin/android/arm64/libgd_cubism.android.release.arm64.so" 18 +
+10
tests/cubism-probe/addons/gd_cubism/res/shader/2d_cubism_mask.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mask 4 + shader_type canvas_item; 5 + render_mode blend_mix, unshaded; 6 + 7 + void fragment() { 8 + vec4 color_tex = texture(TEXTURE, UV); 9 + COLOR = vec4(0,0,0,color_tex.a); 10 + }
+33
tests/cubism-probe/addons/gd_cubism/res/shader/2d_cubism_norm_add.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_premul_alpha, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = (color_tex.rgb + color_screen.rgb) - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base) * modulate; 27 + COLOR = vec4(color_for_mask.rgb, 0.0); 28 + } else { 29 + // premul alpha 30 + vec4 color = color_tex * color_base * modulate; 31 + COLOR = vec4(color.rgb * color.a, 0.0); 32 + } 33 + }
+33
tests/cubism-probe/addons/gd_cubism/res/shader/2d_cubism_norm_mix.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_premul_alpha, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = (color_tex.rgb + color_screen.rgb) - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base); 27 + COLOR = color_for_mask * modulate; 28 + } else { 29 + // premul alpha 30 + vec4 color = color_tex * color_base * modulate; 31 + COLOR = vec4(color.rgb * color.a, color.a); 32 + } 33 + }
+38
tests/cubism-probe/addons/gd_cubism/res/shader/2d_cubism_norm_mul.gdshader
··· 1 + // SPDX-License-Identifier: MIT 2 + // SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp> 3 + // GDCubism shader: Mix 4 + shader_type canvas_item; 5 + render_mode blend_mul, unshaded; 6 + 7 + instance uniform vec4 color_base: source_color; 8 + instance uniform vec4 color_screen: source_color; 9 + instance uniform vec4 color_multiply: source_color; 10 + instance uniform bool color_override; 11 + 12 + #include "cubism_mask.gdshaderinc" 13 + 14 + void fragment() { 15 + if (discard_mask()) { 16 + discard; 17 + } 18 + 19 + vec4 color_tex = texture(TEXTURE, UV); 20 + color_tex.rgba = color_tex.rgba * color_multiply.rgba; 21 + 22 + // premul alpha 23 + color_tex.rgb = color_tex.rgb + color_screen.rgb - (color_tex.rgb * color_screen.rgb); 24 + 25 + if (has_mask) { 26 + vec4 color_for_mask = sample_mask(color_tex, color_base); 27 + COLOR = vec4( 28 + color_for_mask.r + (1.0 - color_for_mask.a), 29 + color_for_mask.g + (1.0 - color_for_mask.a), 30 + color_for_mask.b + (1.0 - color_for_mask.a), 31 + 1.0 32 + ) * modulate; 33 + } else { 34 + // premul alpha 35 + vec4 color = color_tex * color_base * modulate; 36 + COLOR = vec4(color.rgb * color.a, color.a); 37 + } 38 + }
+47
tests/cubism-probe/addons/gd_cubism/res/shader/cubism_mask.gdshaderinc
··· 1 + // masking 2 + instance uniform bool has_mask = false; 3 + instance uniform bool invert; 4 + uniform sampler2D tex_mask : filter_linear_mipmap, repeat_disable; 5 + uniform float mask_scale = 1.0; 6 + uniform vec2 canvas_size = vec2(2,2); 7 + uniform vec2 mesh_offset = vec2(0,0); 8 + 9 + varying vec2 MASK_UV; 10 + varying vec4 modulate; 11 + 12 + bool discard_mask() { 13 + if(has_mask) { 14 + if (MASK_UV.x > 1.0 || MASK_UV.y > 1.0 || MASK_UV.x < 0.0 || MASK_UV.y < 0.0) { 15 + return true; 16 + } 17 + } 18 + return false; 19 + } 20 + 21 + vec2 mask_uv(vec2 vtx) { 22 + if (!has_mask) { 23 + return vec2(0,0); 24 + } 25 + 26 + vec2 mask_size = vec2(textureSize(tex_mask, 0)) / mask_scale; 27 + vec2 mask_vtx = vtx - mesh_offset; 28 + return mask_vtx / mask_size; 29 + } 30 + 31 + vec4 sample_mask(vec4 color_tex, vec4 base) { 32 + vec4 color_for_mask = color_tex * base; 33 + color_for_mask.rgb = color_for_mask.rgb * color_for_mask.a; 34 + 35 + vec4 clip_mask = texture(tex_mask, MASK_UV) * vec4(0,0,0,1); 36 + 37 + float mask_val = clip_mask.r + clip_mask.g + clip_mask.b + clip_mask.a; 38 + if (invert) { 39 + mask_val = 1.0 - mask_val; 40 + } 41 + return color_for_mask * mask_val; 42 + } 43 + 44 + void vertex() { 45 + MASK_UV = mask_uv(VERTEX.xy); 46 + modulate = COLOR; 47 + }
+35
tests/cubism-probe/probe.gd
··· 1 + extends Node 2 + 3 + const MODEL_PATH = "/home/nandi/.local/share/godot/app_userdata/open-vt/Live2DModels/Haru/Haru.model3.json" 4 + 5 + func report(key: String, value) -> void: 6 + print("PROBE %s=%s" % [key, JSON.stringify(value)]) 7 + 8 + func _ready() -> void: 9 + report("engine_version", Engine.get_version_info()) 10 + report("model_exists", FileAccess.file_exists(MODEL_PATH)) 11 + report("class_exists", ClassDB.class_exists("GDCubismUserModel")) 12 + report("loader_exists", ClassDB.class_exists("GDCubismModelLoader")) 13 + 14 + if ClassDB.class_exists("GDCubismModelLoader"): 15 + var loader = ClassDB.instantiate("GDCubismModelLoader") 16 + report("instantiate_loader", loader != null) 17 + if loader != null and loader.has_method("load_model"): 18 + var shaders = [ 19 + load("res://addons/gd_cubism/res/shader/2d_cubism_norm_add.gdshader"), 20 + load("res://addons/gd_cubism/res/shader/2d_cubism_norm_mix.gdshader"), 21 + load("res://addons/gd_cubism/res/shader/2d_cubism_norm_mul.gdshader"), 22 + load("res://addons/gd_cubism/res/shader/2d_cubism_mask.gdshader"), 23 + ] 24 + report("shader_count", shaders.size()) 25 + var model = loader.load_model(MODEL_PATH, shaders, false) 26 + report("load_model_result", model != null) 27 + if model != null: 28 + report("instantiate_user_model", true) 29 + add_child(model) 30 + await get_tree().process_frame 31 + report("model_initialized", model.is_initialized() if model.has_method("is_initialized") else false) 32 + else: 33 + report("instantiate_loader", false) 34 + 35 + get_tree().quit()
+6
tests/cubism-probe/probe.tscn
··· 1 + [gd_scene load_steps=2 format=3] 2 + 3 + [ext_resource type="Script" path="res://probe.gd" id="1"] 4 + 5 + [node name="Probe" type="Node"] 6 + script = ExtResource("1")
+16
tests/cubism-probe/project.godot
··· 1 + config_version=5 2 + 3 + [application] 4 + 5 + config/name="cubism-probe" 6 + run/main_scene="res://probe.tscn" 7 + config/features=PackedStringArray("4.3", "Forward Plus") 8 + 9 + [autoload] 10 + 11 + _CubismProbeExtension="*res://addons/gd_cubism/gd_cubism.gdextension" 12 + 13 + [display] 14 + 15 + window/size/viewport_width=640 16 + window/size/viewport_height=360
+5
tests/gdextension-control-build/SConstruct
··· 1 + env = SConscript("/home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/SConstruct") 2 + env.Append(CPPPATH=["src/"]) 3 + sources = Glob("src/*.cpp") 4 + library = env.SharedLibrary("project/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]), source=sources) 5 + Default(library)
+43
tests/gdextension-control-build/project/example.gdextension
··· 1 + [configuration] 2 + 3 + entry_symbol = "example_library_init" 4 + compatibility_minimum = "4.1" 5 + 6 + [libraries] 7 + 8 + macos.debug = "res://bin/libgdexample.macos.template_debug.framework" 9 + macos.release = "res://bin/libgdexample.macos.template_release.framework" 10 + windows.debug.x86_32 = "res://bin/libgdexample.windows.template_debug.x86_32.dll" 11 + windows.release.x86_32 = "res://bin/libgdexample.windows.template_release.x86_32.dll" 12 + windows.debug.x86_64 = "res://bin/libgdexample.windows.template_debug.x86_64.dll" 13 + windows.release.x86_64 = "res://bin/libgdexample.windows.template_release.x86_64.dll" 14 + windows.debug.arm64 = "res://bin/libgdexample.windows.template_debug.arm64.dll" 15 + windows.release.arm64 = "res://bin/libgdexample.windows.template_release.arm64.dll" 16 + linux.debug.x86_32 = "res://bin/libgdexample.linux.template_debug.x86_32.so" 17 + linux.release.x86_32 = "res://bin/libgdexample.linux.template_release.x86_32.so" 18 + linux.debug.x86_64 = "res://bin/libgdexample.linux.template_debug.x86_64.so" 19 + linux.release.x86_64 = "res://bin/libgdexample.linux.template_release.x86_64.so" 20 + linux.debug.arm32 = "res://bin/libgdexample.linux.template_debug.arm32.so" 21 + linux.release.arm32 = "res://bin/libgdexample.linux.template_release.arm32.so" 22 + linux.debug.arm64 = "res://bin/libgdexample.linux.template_debug.arm64.so" 23 + linux.release.arm64 = "res://bin/libgdexample.linux.template_release.arm64.so" 24 + linux.debug.rv64 = "res://bin/libgdexample.linux.template_debug.rv64.so" 25 + linux.release.rv64 = "res://bin/libgdexample.linux.template_release.rv64.so" 26 + android.debug.x86_64 = "res://bin/libgdexample.android.template_debug.x86_64.so" 27 + android.release.x86_64 = "res://bin/libgdexample.android.template_release.x86_64.so" 28 + android.debug.arm64 = "res://bin/libgdexample.android.template_debug.arm64.so" 29 + android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so" 30 + ios.debug = "res://bin/libgdexample.ios.template_debug.xcframework" 31 + ios.release = "res://bin/libgdexample.ios.template_release.xcframework" 32 + web.debug.threads.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.wasm" 33 + web.release.threads.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.wasm" 34 + web.debug.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.nothreads.wasm" 35 + web.release.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.nothreads.wasm" 36 + 37 + [dependencies] 38 + ios.debug = { 39 + "res://bin/libgodot-cpp.ios.template_debug.xcframework": "" 40 + } 41 + ios.release = { 42 + "res://bin/libgodot-cpp.ios.template_release.xcframework": "" 43 + }
+781
tests/gdextension-control-build/src/example.cpp
··· 1 + /* godot-cpp integration testing project. 2 + * 3 + * This is free and unencumbered software released into the public domain. 4 + */ 5 + 6 + #include "example.h" 7 + 8 + #include <godot_cpp/core/class_db.hpp> 9 + 10 + #include <godot_cpp/classes/global_constants.hpp> 11 + #include <godot_cpp/classes/label.hpp> 12 + #include <godot_cpp/classes/multiplayer_api.hpp> 13 + #include <godot_cpp/classes/multiplayer_peer.hpp> 14 + #include <godot_cpp/classes/os.hpp> 15 + #include <godot_cpp/variant/typed_dictionary.hpp> 16 + #include <godot_cpp/variant/utility_functions.hpp> 17 + 18 + using namespace godot; 19 + 20 + class MyCallableCustom : public CallableCustom { 21 + public: 22 + virtual uint32_t hash() const { 23 + return 27; 24 + } 25 + 26 + virtual String get_as_text() const { 27 + return "<MyCallableCustom>"; 28 + } 29 + 30 + static bool compare_equal_func(const CallableCustom *p_a, const CallableCustom *p_b) { 31 + return p_a == p_b; 32 + } 33 + 34 + virtual CompareEqualFunc get_compare_equal_func() const { 35 + return &MyCallableCustom::compare_equal_func; 36 + } 37 + 38 + static bool compare_less_func(const CallableCustom *p_a, const CallableCustom *p_b) { 39 + return (void *)p_a < (void *)p_b; 40 + } 41 + 42 + virtual CompareLessFunc get_compare_less_func() const { 43 + return &MyCallableCustom::compare_less_func; 44 + } 45 + 46 + bool is_valid() const { 47 + return true; 48 + } 49 + 50 + virtual ObjectID get_object() const { 51 + return ObjectID(); 52 + } 53 + 54 + virtual int get_argument_count(bool &r_is_valid) const { 55 + r_is_valid = true; 56 + return 2; 57 + } 58 + 59 + virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, GDExtensionCallError &r_call_error) const { 60 + r_return_value = "Hi"; 61 + r_call_error.error = GDEXTENSION_CALL_OK; 62 + } 63 + }; 64 + 65 + void ExampleRef::set_id(int p_id) { 66 + id = p_id; 67 + } 68 + 69 + int ExampleRef::get_id() const { 70 + return id; 71 + } 72 + 73 + void ExampleRef::_notification(int p_what) { 74 + if (p_what == NOTIFICATION_POSTINITIALIZE) { 75 + post_initialized = true; 76 + } 77 + } 78 + 79 + void ExampleRef::_bind_methods() { 80 + ClassDB::bind_method(D_METHOD("set_id", "id"), &ExampleRef::set_id); 81 + ClassDB::bind_method(D_METHOD("get_id"), &ExampleRef::get_id); 82 + 83 + ClassDB::bind_method(D_METHOD("was_post_initialized"), &ExampleRef::was_post_initialized); 84 + 85 + ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id"); 86 + } 87 + 88 + ExampleRef::ExampleRef() { 89 + id = 0; 90 + } 91 + 92 + ExampleRef::~ExampleRef() { 93 + } 94 + 95 + int Example::test_static(int p_a, int p_b) { 96 + return p_a + p_b; 97 + } 98 + 99 + void Example::test_static2() { 100 + //UtilityFunctions::print(" void static"); 101 + } 102 + 103 + int Example::def_args(int p_a, int p_b) { 104 + return p_a + p_b; 105 + } 106 + 107 + void Example::_notification(int p_what) { 108 + if (p_what == NOTIFICATION_READY) { 109 + Dictionary opts; 110 + opts["rpc_mode"] = MultiplayerAPI::RPC_MODE_AUTHORITY; 111 + opts["transfer_mode"] = MultiplayerPeer::TRANSFER_MODE_RELIABLE; 112 + opts["call_local"] = true; 113 + opts["channel"] = 0; 114 + rpc_config("test_rpc", opts); 115 + } 116 + //UtilityFunctions::print("Notification: ", String::num(p_what)); 117 + } 118 + 119 + bool Example::_set(const StringName &p_name, const Variant &p_value) { 120 + String name = p_name; 121 + if (name.begins_with("dproperty")) { 122 + int64_t index = name.get_slicec('_', 1).to_int(); 123 + dprop[index] = p_value; 124 + return true; 125 + } 126 + if (name == "property_from_list") { 127 + property_from_list = p_value; 128 + return true; 129 + } 130 + return false; 131 + } 132 + 133 + bool Example::_get(const StringName &p_name, Variant &r_ret) const { 134 + String name = p_name; 135 + if (name.begins_with("dproperty")) { 136 + int64_t index = name.get_slicec('_', 1).to_int(); 137 + r_ret = dprop[index]; 138 + return true; 139 + } 140 + if (name == "property_from_list") { 141 + r_ret = property_from_list; 142 + return true; 143 + } 144 + return false; 145 + } 146 + 147 + String Example::_to_string() const { 148 + return "[ GDExtension::Example <--> Instance ID:" + uitos(get_instance_id()) + " ]"; 149 + } 150 + 151 + void Example::_get_property_list(List<PropertyInfo> *p_list) const { 152 + p_list->push_back(PropertyInfo(Variant::VECTOR3, "property_from_list")); 153 + for (int i = 0; i < 3; i++) { 154 + p_list->push_back(PropertyInfo(Variant::VECTOR2, "dproperty_" + itos(i))); 155 + } 156 + } 157 + 158 + bool Example::_property_can_revert(const StringName &p_name) const { 159 + if (p_name == StringName("property_from_list") && property_from_list != Vector3(42, 42, 42)) { 160 + return true; 161 + } else { 162 + return false; 163 + } 164 + }; 165 + 166 + bool Example::_property_get_revert(const StringName &p_name, Variant &r_property) const { 167 + if (p_name == StringName("property_from_list")) { 168 + r_property = Vector3(42, 42, 42); 169 + return true; 170 + } else { 171 + return false; 172 + } 173 + }; 174 + 175 + void Example::_validate_property(PropertyInfo &p_property) const { 176 + String name = p_property.name; 177 + // Test hiding the "mouse_filter" property from the editor. 178 + if (name == "mouse_filter") { 179 + p_property.usage = PROPERTY_USAGE_NO_EDITOR; 180 + } 181 + } 182 + 183 + void Example::_bind_methods() { 184 + // Methods. 185 + ClassDB::bind_method(D_METHOD("simple_func"), &Example::simple_func); 186 + ClassDB::bind_method(D_METHOD("simple_const_func"), &Example::simple_const_func); 187 + ClassDB::bind_method(D_METHOD("custom_ref_func", "ref"), &Example::custom_ref_func); 188 + ClassDB::bind_method(D_METHOD("custom_const_ref_func", "ref"), &Example::custom_const_ref_func); 189 + ClassDB::bind_method(D_METHOD("image_ref_func", "image"), &Example::image_ref_func); 190 + ClassDB::bind_method(D_METHOD("image_const_ref_func", "image"), &Example::image_const_ref_func); 191 + ClassDB::bind_method(D_METHOD("return_something"), &Example::return_something); 192 + ClassDB::bind_method(D_METHOD("return_something_const"), &Example::return_something_const); 193 + ClassDB::bind_method(D_METHOD("return_empty_ref"), &Example::return_empty_ref); 194 + ClassDB::bind_method(D_METHOD("return_extended_ref"), &Example::return_extended_ref); 195 + ClassDB::bind_method(D_METHOD("extended_ref_checks", "ref"), &Example::extended_ref_checks); 196 + 197 + ClassDB::bind_method(D_METHOD("is_object_binding_set_by_parent_constructor"), &Example::is_object_binding_set_by_parent_constructor); 198 + 199 + ClassDB::bind_method(D_METHOD("test_array"), &Example::test_array); 200 + ClassDB::bind_method(D_METHOD("test_tarray_arg", "array"), &Example::test_tarray_arg); 201 + ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray); 202 + ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); 203 + ClassDB::bind_method(D_METHOD("test_tdictionary_arg", "dictionary"), &Example::test_tdictionary_arg); 204 + ClassDB::bind_method(D_METHOD("test_tdictionary"), &Example::test_tdictionary); 205 + ClassDB::bind_method(D_METHOD("test_node_argument"), &Example::test_node_argument); 206 + ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops); 207 + ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility); 208 + ClassDB::bind_method(D_METHOD("test_string_is_forty_two"), &Example::test_string_is_forty_two); 209 + ClassDB::bind_method(D_METHOD("test_string_resize"), &Example::test_string_resize); 210 + ClassDB::bind_method(D_METHOD("test_typed_array_of_packed"), &Example::test_typed_array_of_packed); 211 + ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops); 212 + ClassDB::bind_method(D_METHOD("test_vector_init_list"), &Example::test_vector_init_list); 213 + 214 + ClassDB::bind_method(D_METHOD("test_object_cast_to_node", "object"), &Example::test_object_cast_to_node); 215 + ClassDB::bind_method(D_METHOD("test_object_cast_to_control", "object"), &Example::test_object_cast_to_control); 216 + ClassDB::bind_method(D_METHOD("test_object_cast_to_example", "object"), &Example::test_object_cast_to_example); 217 + 218 + ClassDB::bind_method(D_METHOD("test_variant_vector2i_conversion", "variant"), &Example::test_variant_vector2i_conversion); 219 + ClassDB::bind_method(D_METHOD("test_variant_int_conversion", "variant"), &Example::test_variant_int_conversion); 220 + ClassDB::bind_method(D_METHOD("test_variant_float_conversion", "variant"), &Example::test_variant_float_conversion); 221 + ClassDB::bind_method(D_METHOD("test_object_is_valid", "variant"), &Example::test_object_is_valid); 222 + 223 + ClassDB::bind_method(D_METHOD("test_add_child", "node"), &Example::test_add_child); 224 + ClassDB::bind_method(D_METHOD("test_set_tileset", "tilemap", "tileset"), &Example::test_set_tileset); 225 + 226 + ClassDB::bind_method(D_METHOD("test_variant_call", "variant"), &Example::test_variant_call); 227 + 228 + ClassDB::bind_method(D_METHOD("test_callable_mp"), &Example::test_callable_mp); 229 + ClassDB::bind_method(D_METHOD("test_callable_mp_ret"), &Example::test_callable_mp_ret); 230 + ClassDB::bind_method(D_METHOD("test_callable_mp_retc"), &Example::test_callable_mp_retc); 231 + ClassDB::bind_method(D_METHOD("test_callable_mp_static"), &Example::test_callable_mp_static); 232 + ClassDB::bind_method(D_METHOD("test_callable_mp_static_ret"), &Example::test_callable_mp_static_ret); 233 + ClassDB::bind_method(D_METHOD("test_custom_callable"), &Example::test_custom_callable); 234 + 235 + ClassDB::bind_method(D_METHOD("test_bitfield", "flags"), &Example::test_bitfield); 236 + 237 + ClassDB::bind_method(D_METHOD("test_variant_iterator", "input"), &Example::test_variant_iterator); 238 + 239 + ClassDB::bind_method(D_METHOD("test_rpc", "value"), &Example::test_rpc); 240 + ClassDB::bind_method(D_METHOD("test_send_rpc", "value"), &Example::test_send_rpc); 241 + ClassDB::bind_method(D_METHOD("return_last_rpc_arg"), &Example::return_last_rpc_arg); 242 + 243 + ClassDB::bind_method(D_METHOD("def_args", "a", "b"), &Example::def_args, DEFVAL(100), DEFVAL(200)); 244 + ClassDB::bind_method(D_METHOD("callable_bind"), &Example::callable_bind); 245 + ClassDB::bind_method(D_METHOD("test_post_initialize"), &Example::test_post_initialize); 246 + 247 + ClassDB::bind_method(D_METHOD("test_get_internal", "a"), &Example::test_get_internal); 248 + 249 + GDVIRTUAL_BIND(_do_something_virtual, "name", "value"); 250 + ClassDB::bind_method(D_METHOD("test_virtual_implemented_in_script"), &Example::test_virtual_implemented_in_script); 251 + GDVIRTUAL_BIND(_do_something_virtual_with_control, "control"); 252 + 253 + ClassDB::bind_method(D_METHOD("test_use_engine_singleton"), &Example::test_use_engine_singleton); 254 + 255 + ClassDB::bind_static_method("Example", D_METHOD("test_static", "a", "b"), &Example::test_static); 256 + ClassDB::bind_static_method("Example", D_METHOD("test_static2"), &Example::test_static2); 257 + 258 + ClassDB::bind_static_method("Example", D_METHOD("test_library_path"), &Example::test_library_path); 259 + 260 + { 261 + MethodInfo mi; 262 + mi.arguments.push_back(PropertyInfo(Variant::STRING, "some_argument")); 263 + mi.name = "varargs_func"; 264 + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "varargs_func", &Example::varargs_func, mi); 265 + } 266 + 267 + { 268 + MethodInfo mi; 269 + mi.arguments.push_back(PropertyInfo(Variant::STRING, "some_argument")); 270 + mi.name = "varargs_func_nv"; 271 + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "varargs_func_nv", &Example::varargs_func_nv, mi); 272 + } 273 + 274 + { 275 + MethodInfo mi; 276 + mi.arguments.push_back(PropertyInfo(Variant::STRING, "some_argument")); 277 + mi.name = "varargs_func_void"; 278 + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "varargs_func_void", &Example::varargs_func_void, mi); 279 + } 280 + 281 + // Properties. 282 + ADD_GROUP("Test group", "group_"); 283 + ADD_SUBGROUP("Test subgroup", "group_subgroup_"); 284 + 285 + ClassDB::bind_method(D_METHOD("get_custom_position"), &Example::get_custom_position); 286 + ClassDB::bind_method(D_METHOD("get_v4"), &Example::get_v4); 287 + ClassDB::bind_method(D_METHOD("set_custom_position", "position"), &Example::set_custom_position); 288 + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "group_subgroup_custom_position"), "set_custom_position", "get_custom_position"); 289 + 290 + // Signals. 291 + ADD_SIGNAL(MethodInfo("custom_signal", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::INT, "value"))); 292 + ClassDB::bind_method(D_METHOD("emit_custom_signal", "name", "value"), &Example::emit_custom_signal); 293 + 294 + // Constants. 295 + BIND_ENUM_CONSTANT(FIRST); 296 + BIND_ENUM_CONSTANT(ANSWER_TO_EVERYTHING); 297 + 298 + BIND_BITFIELD_FLAG(FLAG_ONE); 299 + BIND_BITFIELD_FLAG(FLAG_TWO); 300 + 301 + BIND_CONSTANT(CONSTANT_WITHOUT_ENUM); 302 + BIND_ENUM_CONSTANT(OUTSIDE_OF_CLASS); 303 + } 304 + 305 + bool Example::has_object_instance_binding() const { 306 + return internal::gdextension_interface_object_get_instance_binding(_owner, internal::token, nullptr); 307 + } 308 + 309 + Example::Example() : 310 + object_instance_binding_set_by_parent_constructor(has_object_instance_binding()) { 311 + // Test conversion, to ensure users can use all parent class functions at this time. 312 + // It would crash if instance binding still not be initialized. 313 + Variant v = Variant(this); 314 + Object *o = (Object *)v; 315 + 316 + //UtilityFunctions::print("Constructor."); 317 + } 318 + 319 + Example::~Example() { 320 + //UtilityFunctions::print("Destructor."); 321 + } 322 + 323 + // Methods. 324 + void Example::simple_func() { 325 + emit_custom_signal("simple_func", 3); 326 + } 327 + 328 + void Example::simple_const_func() const { 329 + ((Example *)this)->emit_custom_signal("simple_const_func", 4); 330 + } 331 + 332 + int Example::custom_ref_func(Ref<ExampleRef> p_ref) { 333 + return p_ref.is_valid() ? p_ref->get_id() : -1; 334 + } 335 + 336 + int Example::custom_const_ref_func(const Ref<ExampleRef> &p_ref) { 337 + return p_ref.is_valid() ? p_ref->get_id() : -1; 338 + } 339 + 340 + String Example::image_ref_func(Ref<Image> p_image) { 341 + return p_image.is_valid() ? String("valid") : String("invalid"); 342 + } 343 + 344 + String Example::image_const_ref_func(const Ref<Image> &p_image) { 345 + return p_image.is_valid() ? String("valid") : String("invalid"); 346 + } 347 + 348 + String Example::return_something(const String &base) { 349 + return base + String("42"); 350 + } 351 + 352 + Viewport *Example::return_something_const() const { 353 + if (is_inside_tree()) { 354 + Viewport *result = get_viewport(); 355 + return result; 356 + } 357 + return nullptr; 358 + } 359 + 360 + Ref<ExampleRef> Example::return_empty_ref() const { 361 + Ref<ExampleRef> ref; 362 + return ref; 363 + } 364 + 365 + ExampleRef *Example::return_extended_ref() const { 366 + // You can instance and return a refcounted object like this, but keep in mind that refcounting starts with the returned object 367 + // and it will be destroyed when all references are destroyed. If you store this pointer you run the risk of having a pointer 368 + // to a destroyed object. 369 + return memnew(ExampleRef()); 370 + } 371 + 372 + Ref<ExampleRef> Example::extended_ref_checks(Ref<ExampleRef> p_ref) const { 373 + // This is therefore the preferred way of instancing and returning a refcounted object: 374 + Ref<ExampleRef> ref; 375 + ref.instantiate(); 376 + return ref; 377 + } 378 + 379 + Variant Example::varargs_func(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) { 380 + return arg_count; 381 + } 382 + 383 + int Example::varargs_func_nv(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) { 384 + return 42 + arg_count; 385 + } 386 + 387 + void Example::varargs_func_void(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error) { 388 + emit_custom_signal("varargs_func_void", arg_count + 1); 389 + } 390 + 391 + void Example::emit_custom_signal(const String &name, int value) { 392 + emit_signal("custom_signal", name, value); 393 + } 394 + 395 + bool Example::is_object_binding_set_by_parent_constructor() const { 396 + return object_instance_binding_set_by_parent_constructor; 397 + } 398 + 399 + Array Example::test_array() const { 400 + Array arr; 401 + 402 + arr.resize(2); 403 + arr[0] = Variant(1); 404 + arr[1] = Variant(2); 405 + 406 + return arr; 407 + } 408 + 409 + String Example::test_string_ops() const { 410 + String s = String("A"); 411 + s += "B"; 412 + s += "C"; 413 + s += char32_t(0x010E); 414 + s = s + "E"; 415 + return s; 416 + } 417 + 418 + String Example::test_str_utility() const { 419 + return UtilityFunctions::str("Hello, ", "World", "! The answer is ", 42); 420 + } 421 + 422 + bool Example::test_string_is_forty_two(const String &p_string) const { 423 + return strcmp(p_string.utf8().ptr(), "forty two") == 0; 424 + } 425 + 426 + String Example::test_string_resize(String p_string) const { 427 + int orig_len = p_string.length(); 428 + p_string.resize(orig_len + 3); 429 + char32_t *data = p_string.ptrw(); 430 + data[orig_len + 0] = '!'; 431 + data[orig_len + 1] = '?'; 432 + data[orig_len + 2] = '\0'; 433 + return p_string; 434 + } 435 + 436 + TypedArray<PackedInt32Array> Example::test_typed_array_of_packed() const { 437 + TypedArray<PackedInt32Array> arr; 438 + PackedInt32Array packed_arr1; 439 + packed_arr1.push_back(1); 440 + packed_arr1.push_back(2); 441 + arr.push_back(packed_arr1); 442 + PackedInt32Array packed_arr2; 443 + packed_arr2.push_back(3); 444 + packed_arr2.push_back(4); 445 + arr.push_back(packed_arr2); 446 + return arr; 447 + } 448 + 449 + int Example::test_vector_ops() const { 450 + PackedInt32Array arr; 451 + arr.push_back(10); 452 + arr.push_back(20); 453 + arr.push_back(30); 454 + arr.push_back(45); 455 + int ret = 0; 456 + for (const int32_t &E : arr) { 457 + ret += E; 458 + } 459 + return ret; 460 + } 461 + 462 + int Example::test_vector_init_list() const { 463 + PackedInt32Array arr = { 10, 20, 30, 45 }; 464 + int ret = 0; 465 + for (const int32_t &E : arr) { 466 + ret += E; 467 + } 468 + return ret; 469 + } 470 + 471 + Callable Example::test_callable_mp() { 472 + return callable_mp(this, &Example::unbound_method1); 473 + } 474 + 475 + Callable Example::test_callable_mp_ret() { 476 + return callable_mp(this, &Example::unbound_method2); 477 + } 478 + 479 + Callable Example::test_callable_mp_retc() const { 480 + return callable_mp(this, &Example::unbound_method3); 481 + } 482 + 483 + Callable Example::test_callable_mp_static() const { 484 + return callable_mp_static(&Example::unbound_static_method1); 485 + } 486 + 487 + Callable Example::test_callable_mp_static_ret() const { 488 + return callable_mp_static(&Example::unbound_static_method2); 489 + } 490 + 491 + Callable Example::test_custom_callable() const { 492 + return Callable(memnew(MyCallableCustom)); 493 + } 494 + 495 + void Example::unbound_method1(Object *p_object, String p_string, int p_int) { 496 + String test = "unbound_method1: "; 497 + test += p_object->get_class(); 498 + test += " - " + p_string; 499 + emit_custom_signal(test, p_int); 500 + } 501 + 502 + String Example::unbound_method2(Object *p_object, String p_string, int p_int) { 503 + String test = "unbound_method2: "; 504 + test += p_object->get_class(); 505 + test += " - " + p_string; 506 + test += " - " + itos(p_int); 507 + return test; 508 + } 509 + 510 + String Example::unbound_method3(Object *p_object, String p_string, int p_int) const { 511 + String test = "unbound_method3: "; 512 + test += p_object->get_class(); 513 + test += " - " + p_string; 514 + test += " - " + itos(p_int); 515 + return test; 516 + } 517 + 518 + void Example::unbound_static_method1(Example *p_object, String p_string, int p_int) { 519 + String test = "unbound_static_method1: "; 520 + test += p_object->get_class(); 521 + test += " - " + p_string; 522 + p_object->emit_custom_signal(test, p_int); 523 + } 524 + 525 + String Example::unbound_static_method2(Object *p_object, String p_string, int p_int) { 526 + String test = "unbound_static_method2: "; 527 + test += p_object->get_class(); 528 + test += " - " + p_string; 529 + test += " - " + itos(p_int); 530 + return test; 531 + } 532 + 533 + int Example::test_tarray_arg(const TypedArray<int64_t> &p_array) { 534 + int sum = 0; 535 + for (int i = 0; i < p_array.size(); i++) { 536 + sum += (int)p_array[i]; 537 + } 538 + return sum; 539 + } 540 + 541 + TypedArray<Vector2> Example::test_tarray() const { 542 + TypedArray<Vector2> arr; 543 + 544 + arr.resize(2); 545 + arr[0] = Vector2(1, 2); 546 + arr[1] = Vector2(2, 3); 547 + 548 + return arr; 549 + } 550 + 551 + Dictionary Example::test_dictionary() const { 552 + Dictionary dict; 553 + 554 + dict["hello"] = "world"; 555 + dict["foo"] = "bar"; 556 + 557 + return dict; 558 + } 559 + 560 + int Example::test_tdictionary_arg(const TypedDictionary<String, int64_t> &p_dictionary) { 561 + int sum = 0; 562 + TypedArray<int64_t> values = p_dictionary.values(); 563 + for (int i = 0; i < p_dictionary.size(); i++) { 564 + sum += (int)values[i]; 565 + } 566 + return sum; 567 + } 568 + 569 + TypedDictionary<Vector2, Vector2i> Example::test_tdictionary() const { 570 + TypedDictionary<Vector2, Vector2i> dict; 571 + 572 + dict[Vector2(1, 2)] = Vector2i(2, 3); 573 + 574 + return dict; 575 + } 576 + 577 + Example *Example::test_node_argument(Example *p_node) const { 578 + return p_node; 579 + } 580 + 581 + bool Example::test_object_cast_to_node(Object *p_object) const { 582 + return Object::cast_to<Node>(p_object) != nullptr; 583 + } 584 + 585 + bool Example::test_object_cast_to_control(Object *p_object) const { 586 + return Object::cast_to<Control>(p_object) != nullptr; 587 + } 588 + 589 + bool Example::test_object_cast_to_example(Object *p_object) const { 590 + return Object::cast_to<Example>(p_object) != nullptr; 591 + } 592 + 593 + Vector2i Example::test_variant_vector2i_conversion(const Variant &p_variant) const { 594 + return p_variant; 595 + } 596 + 597 + int Example::test_variant_int_conversion(const Variant &p_variant) const { 598 + return p_variant; 599 + } 600 + 601 + float Example::test_variant_float_conversion(const Variant &p_variant) const { 602 + return p_variant; 603 + } 604 + 605 + bool Example::test_object_is_valid(const Variant &p_variant) const { 606 + return static_cast<bool>(p_variant.get_validated_object()); 607 + } 608 + 609 + void Example::test_add_child(Node *p_node) { 610 + add_child(p_node); 611 + } 612 + 613 + void Example::test_set_tileset(TileMap *p_tilemap, const Ref<TileSet> &p_tileset) const { 614 + p_tilemap->set_tileset(p_tileset); 615 + } 616 + 617 + Variant Example::test_variant_call(Variant p_variant) { 618 + return p_variant.call("test", "hello"); 619 + } 620 + 621 + BitField<Example::Flags> Example::test_bitfield(BitField<Flags> flags) { 622 + return flags; 623 + } 624 + 625 + Variant Example::test_variant_iterator(const Variant &p_input) { 626 + Array output; 627 + 628 + Variant iter; 629 + 630 + bool is_init_valid = true; 631 + if (!p_input.iter_init(iter, is_init_valid)) { 632 + if (!is_init_valid) { 633 + return "iter_init: not valid"; 634 + } 635 + return output; 636 + } 637 + 638 + bool is_iter_next_valid = true; 639 + bool is_iter_get_valid = true; 640 + do { 641 + if (!is_iter_next_valid) { 642 + return "iter_next: not valid"; 643 + } 644 + 645 + Variant value = p_input.iter_get(iter, is_iter_get_valid); 646 + if (!is_iter_get_valid) { 647 + return "iter_get: not valid"; 648 + } 649 + output.push_back(((int)value) + 5); 650 + 651 + } while (p_input.iter_next(iter, is_iter_next_valid)); 652 + 653 + if (!is_iter_next_valid) { 654 + return "iter_next: not valid"; 655 + } 656 + 657 + return output; 658 + } 659 + 660 + void Example::test_rpc(int p_value) { 661 + last_rpc_arg = p_value; 662 + } 663 + 664 + void Example::test_send_rpc(int p_value) { 665 + rpc("test_rpc", p_value); 666 + } 667 + 668 + int Example::return_last_rpc_arg() { 669 + return last_rpc_arg; 670 + } 671 + 672 + void Example::callable_bind() { 673 + Callable c = Callable(this, "emit_custom_signal").bind("bound", 11); 674 + c.call(); 675 + } 676 + 677 + // Properties. 678 + void Example::set_custom_position(const Vector2 &pos) { 679 + custom_position = pos; 680 + } 681 + 682 + Vector2 Example::get_custom_position() const { 683 + return custom_position; 684 + } 685 + 686 + Vector4 Example::get_v4() const { 687 + return Vector4(1.2, 3.4, 5.6, 7.8); 688 + } 689 + 690 + bool Example::test_post_initialize() const { 691 + Ref<ExampleRef> new_example_ref; 692 + new_example_ref.instantiate(); 693 + return new_example_ref->was_post_initialized(); 694 + } 695 + 696 + // Virtual function override. 697 + bool Example::_has_point(const Vector2 &point) const { 698 + Label *label = get_node<Label>("Label"); 699 + label->set_text("Got point: " + Variant(point).stringify()); 700 + 701 + return false; 702 + } 703 + 704 + void Example::_input(const Ref<InputEvent> &event) { 705 + const InputEventKey *key_event = Object::cast_to<const InputEventKey>(*event); 706 + if (key_event) { 707 + emit_custom_signal(String("_input: ") + key_event->get_key_label(), key_event->get_unicode()); 708 + } 709 + } 710 + 711 + void ExampleBase::_bind_methods() { 712 + ClassDB::bind_method(D_METHOD("get_value1"), &ExampleBase::get_value1); 713 + ClassDB::bind_method(D_METHOD("get_value2"), &ExampleBase::get_value2); 714 + } 715 + 716 + void ExampleBase::_notification(int p_what) { 717 + if (p_what == NOTIFICATION_ENTER_TREE) { 718 + value1 = 11; 719 + value2 = 22; 720 + } 721 + } 722 + 723 + void ExampleChild::_notification(int p_what) { 724 + if (p_what == NOTIFICATION_ENTER_TREE) { 725 + value2 = 33; 726 + } 727 + } 728 + 729 + String Example::test_virtual_implemented_in_script(const String &p_name, int p_value) { 730 + String ret; 731 + if (GDVIRTUAL_CALL(_do_something_virtual, p_name, p_value, ret)) { 732 + return ret; 733 + } 734 + return "Unimplemented"; 735 + } 736 + 737 + String Example::test_use_engine_singleton() const { 738 + return OS::get_singleton()->get_name(); 739 + } 740 + 741 + String Example::test_library_path() { 742 + String library_path; 743 + internal::gdextension_interface_get_library_path(internal::library, library_path._native_ptr()); 744 + return library_path; 745 + } 746 + 747 + int64_t Example::test_get_internal(const Variant &p_input) const { 748 + if (p_input.get_type() != Variant::INT) { 749 + return -1; 750 + } 751 + 752 + return *VariantInternal::get_int(&p_input); 753 + } 754 + 755 + void ExampleRuntime::_bind_methods() { 756 + ClassDB::bind_method(D_METHOD("set_prop_value", "value"), &ExampleRuntime::set_prop_value); 757 + ClassDB::bind_method(D_METHOD("get_prop_value"), &ExampleRuntime::get_prop_value); 758 + ADD_PROPERTY(PropertyInfo(Variant::INT, "prop_value"), "set_prop_value", "get_prop_value"); 759 + } 760 + 761 + void ExampleRuntime::set_prop_value(int p_prop_value) { 762 + prop_value = p_prop_value; 763 + } 764 + 765 + int ExampleRuntime::get_prop_value() const { 766 + return prop_value; 767 + } 768 + 769 + ExampleRuntime::ExampleRuntime() { 770 + } 771 + 772 + ExampleRuntime::~ExampleRuntime() { 773 + } 774 + 775 + void ExamplePrzykład::_bind_methods() { 776 + ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word); 777 + } 778 + 779 + String ExamplePrzykład::get_the_word() const { 780 + return U"słowo to przykład"; 781 + }
+293
tests/gdextension-control-build/src/example.h
··· 1 + /* godot-cpp integration testing project. 2 + * 3 + * This is free and unencumbered software released into the public domain. 4 + */ 5 + 6 + #ifndef EXAMPLE_CLASS_H 7 + #define EXAMPLE_CLASS_H 8 + 9 + // We don't need windows.h in this example plugin but many others do, and it can 10 + // lead to annoying situations due to the ton of macros it defines. 11 + // So we include it and make sure CI warns us if we use something that conflicts 12 + // with a Windows define. 13 + #ifdef WIN32 14 + #include <windows.h> 15 + #endif 16 + 17 + #include <godot_cpp/classes/control.hpp> 18 + #include <godot_cpp/classes/global_constants.hpp> 19 + #include <godot_cpp/classes/image.hpp> 20 + #include <godot_cpp/classes/input_event_key.hpp> 21 + #include <godot_cpp/classes/tile_map.hpp> 22 + #include <godot_cpp/classes/tile_set.hpp> 23 + #include <godot_cpp/classes/viewport.hpp> 24 + #include <godot_cpp/variant/typed_dictionary.hpp> 25 + #include <godot_cpp/variant/variant.hpp> 26 + #include <godot_cpp/variant/variant_internal.hpp> 27 + 28 + #include <godot_cpp/core/binder_common.hpp> 29 + #include <godot_cpp/core/gdvirtual.gen.inc> 30 + 31 + using namespace godot; 32 + 33 + class ExampleRef : public RefCounted { 34 + GDCLASS(ExampleRef, RefCounted); 35 + 36 + private: 37 + static int instance_count; 38 + static int last_id; 39 + 40 + int id; 41 + bool post_initialized = false; 42 + 43 + protected: 44 + static void _bind_methods(); 45 + 46 + void _notification(int p_what); 47 + 48 + public: 49 + ExampleRef(); 50 + ~ExampleRef(); 51 + 52 + void set_id(int p_id); 53 + int get_id() const; 54 + 55 + bool was_post_initialized() const { return post_initialized; } 56 + }; 57 + 58 + class ExampleMin : public Control { 59 + GDCLASS(ExampleMin, Control); 60 + 61 + protected: 62 + static void _bind_methods(){}; 63 + }; 64 + 65 + class Example : public Control { 66 + GDCLASS(Example, Control); 67 + 68 + protected: 69 + static void _bind_methods(); 70 + 71 + void _notification(int p_what); 72 + bool _set(const StringName &p_name, const Variant &p_value); 73 + bool _get(const StringName &p_name, Variant &r_ret) const; 74 + void _get_property_list(List<PropertyInfo> *p_list) const; 75 + bool _property_can_revert(const StringName &p_name) const; 76 + bool _property_get_revert(const StringName &p_name, Variant &r_property) const; 77 + void _validate_property(PropertyInfo &p_property) const; 78 + 79 + String _to_string() const; 80 + 81 + private: 82 + Vector2 custom_position; 83 + Vector3 property_from_list; 84 + Vector2 dprop[3]; 85 + int last_rpc_arg = 0; 86 + 87 + const bool object_instance_binding_set_by_parent_constructor; 88 + bool has_object_instance_binding() const; 89 + 90 + public: 91 + // Constants. 92 + enum Constants { 93 + FIRST, 94 + ANSWER_TO_EVERYTHING = 42, 95 + }; 96 + 97 + enum Flags { 98 + FLAG_ONE = 1, 99 + FLAG_TWO = 2, 100 + }; 101 + 102 + enum { 103 + CONSTANT_WITHOUT_ENUM = 314, 104 + }; 105 + 106 + Example(); 107 + ~Example(); 108 + 109 + // Functions. 110 + void simple_func(); 111 + void simple_const_func() const; 112 + int custom_ref_func(Ref<ExampleRef> p_ref); 113 + int custom_const_ref_func(const Ref<ExampleRef> &p_ref); 114 + String image_ref_func(Ref<Image> p_image); 115 + String image_const_ref_func(const Ref<Image> &p_image); 116 + String return_something(const String &base); 117 + Viewport *return_something_const() const; 118 + Ref<ExampleRef> return_ref() const; 119 + Ref<ExampleRef> return_empty_ref() const; 120 + ExampleRef *return_extended_ref() const; 121 + Ref<ExampleRef> extended_ref_checks(Ref<ExampleRef> p_ref) const; 122 + Variant varargs_func(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error); 123 + int varargs_func_nv(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error); 124 + void varargs_func_void(const Variant **args, GDExtensionInt arg_count, GDExtensionCallError &error); 125 + void emit_custom_signal(const String &name, int value); 126 + int def_args(int p_a = 100, int p_b = 200); 127 + 128 + bool is_object_binding_set_by_parent_constructor() const; 129 + 130 + Array test_array() const; 131 + int test_tarray_arg(const TypedArray<int64_t> &p_array); 132 + TypedArray<Vector2> test_tarray() const; 133 + Dictionary test_dictionary() const; 134 + int test_tdictionary_arg(const TypedDictionary<String, int64_t> &p_dictionary); 135 + TypedDictionary<Vector2, Vector2i> test_tdictionary() const; 136 + Example *test_node_argument(Example *p_node) const; 137 + String test_string_ops() const; 138 + String test_str_utility() const; 139 + bool test_string_is_forty_two(const String &p_str) const; 140 + String test_string_resize(String p_original) const; 141 + TypedArray<PackedInt32Array> test_typed_array_of_packed() const; 142 + int test_vector_ops() const; 143 + int test_vector_init_list() const; 144 + 145 + bool test_object_cast_to_node(Object *p_object) const; 146 + bool test_object_cast_to_control(Object *p_object) const; 147 + bool test_object_cast_to_example(Object *p_object) const; 148 + 149 + Vector2i test_variant_vector2i_conversion(const Variant &p_variant) const; 150 + int test_variant_int_conversion(const Variant &p_variant) const; 151 + float test_variant_float_conversion(const Variant &p_variant) const; 152 + bool test_object_is_valid(const Variant &p_variant) const; 153 + 154 + void test_add_child(Node *p_node); 155 + void test_set_tileset(TileMap *p_tilemap, const Ref<TileSet> &p_tileset) const; 156 + 157 + Variant test_variant_call(Variant p_variant); 158 + 159 + Callable test_callable_mp(); 160 + Callable test_callable_mp_ret(); 161 + Callable test_callable_mp_retc() const; 162 + Callable test_callable_mp_static() const; 163 + Callable test_callable_mp_static_ret() const; 164 + Callable test_custom_callable() const; 165 + 166 + void unbound_method1(Object *p_object, String p_string, int p_int); 167 + String unbound_method2(Object *p_object, String p_string, int p_int); 168 + String unbound_method3(Object *p_object, String p_string, int p_int) const; 169 + static void unbound_static_method1(Example *p_object, String p_string, int p_int); 170 + static String unbound_static_method2(Object *p_object, String p_string, int p_int); 171 + 172 + BitField<Flags> test_bitfield(BitField<Flags> flags); 173 + 174 + Variant test_variant_iterator(const Variant &p_input); 175 + 176 + // RPC 177 + void test_rpc(int p_value); 178 + void test_send_rpc(int p_value); 179 + int return_last_rpc_arg(); 180 + 181 + void callable_bind(); 182 + 183 + // Property. 184 + void set_custom_position(const Vector2 &pos); 185 + Vector2 get_custom_position() const; 186 + Vector4 get_v4() const; 187 + 188 + bool test_post_initialize() const; 189 + 190 + int64_t test_get_internal(const Variant &p_input) const; 191 + 192 + // Static method. 193 + static int test_static(int p_a, int p_b); 194 + static void test_static2(); 195 + 196 + // Virtual function override (no need to bind manually). 197 + virtual bool _has_point(const Vector2 &point) const override; 198 + virtual void _input(const Ref<InputEvent> &event) override; 199 + 200 + GDVIRTUAL2R(String, _do_something_virtual, String, int); 201 + String test_virtual_implemented_in_script(const String &p_name, int p_value); 202 + GDVIRTUAL1(_do_something_virtual_with_control, Control *); 203 + 204 + String test_use_engine_singleton() const; 205 + 206 + static String test_library_path(); 207 + }; 208 + 209 + VARIANT_ENUM_CAST(Example::Constants); 210 + VARIANT_BITFIELD_CAST(Example::Flags); 211 + 212 + enum EnumWithoutClass { 213 + OUTSIDE_OF_CLASS = 512 214 + }; 215 + VARIANT_ENUM_CAST(EnumWithoutClass); 216 + 217 + class ExampleVirtual : public Object { 218 + GDCLASS(ExampleVirtual, Object); 219 + 220 + protected: 221 + static void _bind_methods() {} 222 + }; 223 + 224 + class ExampleAbstractBase : public Object { 225 + GDCLASS(ExampleAbstractBase, Object); 226 + 227 + protected: 228 + static void _bind_methods() {} 229 + 230 + virtual int test_function() = 0; 231 + }; 232 + 233 + class ExampleConcrete : public ExampleAbstractBase { 234 + GDCLASS(ExampleConcrete, ExampleAbstractBase); 235 + 236 + protected: 237 + static void _bind_methods() {} 238 + 239 + virtual int test_function() override { return 25; } 240 + }; 241 + 242 + class ExampleBase : public Node { 243 + GDCLASS(ExampleBase, Node); 244 + 245 + protected: 246 + int value1 = 0; 247 + int value2 = 0; 248 + 249 + static void _bind_methods(); 250 + 251 + void _notification(int p_what); 252 + 253 + public: 254 + int get_value1() { return value1; } 255 + int get_value2() { return value2; } 256 + }; 257 + 258 + class ExampleChild : public ExampleBase { 259 + GDCLASS(ExampleChild, ExampleBase); 260 + 261 + protected: 262 + static void _bind_methods() {} 263 + 264 + void _notification(int p_what); 265 + }; 266 + 267 + class ExampleRuntime : public Node { 268 + GDCLASS(ExampleRuntime, Node); 269 + 270 + int prop_value = 12; 271 + 272 + protected: 273 + static void _bind_methods(); 274 + 275 + public: 276 + void set_prop_value(int p_prop_value); 277 + int get_prop_value() const; 278 + 279 + ExampleRuntime(); 280 + ~ExampleRuntime(); 281 + }; 282 + 283 + class ExamplePrzykład : public RefCounted { 284 + GDCLASS(ExamplePrzykład, RefCounted); 285 + 286 + protected: 287 + static void _bind_methods(); 288 + 289 + public: 290 + String get_the_word() const; 291 + }; 292 + 293 + #endif // EXAMPLE_CLASS_H
+53
tests/gdextension-control-build/src/register_types.cpp
··· 1 + /* godot-cpp integration testing project. 2 + * 3 + * This is free and unencumbered software released into the public domain. 4 + */ 5 + 6 + #include "register_types.h" 7 + 8 + #include <gdextension_interface.h> 9 + 10 + #include <godot_cpp/core/class_db.hpp> 11 + #include <godot_cpp/core/defs.hpp> 12 + #include <godot_cpp/godot.hpp> 13 + 14 + #include "example.h" 15 + #include "tests.h" 16 + 17 + using namespace godot; 18 + 19 + void initialize_example_module(ModuleInitializationLevel p_level) { 20 + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { 21 + return; 22 + } 23 + 24 + GDREGISTER_CLASS(ExampleRef); 25 + GDREGISTER_CLASS(ExampleMin); 26 + GDREGISTER_CLASS(Example); 27 + GDREGISTER_VIRTUAL_CLASS(ExampleVirtual); 28 + GDREGISTER_ABSTRACT_CLASS(ExampleAbstractBase); 29 + GDREGISTER_CLASS(ExampleConcrete); 30 + GDREGISTER_CLASS(ExampleBase); 31 + GDREGISTER_CLASS(ExampleChild); 32 + GDREGISTER_RUNTIME_CLASS(ExampleRuntime); 33 + GDREGISTER_CLASS(ExamplePrzykład); 34 + } 35 + 36 + void uninitialize_example_module(ModuleInitializationLevel p_level) { 37 + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { 38 + return; 39 + } 40 + } 41 + 42 + extern "C" { 43 + // Initialization. 44 + GDExtensionBool GDE_EXPORT example_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { 45 + godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); 46 + 47 + init_obj.register_initializer(initialize_example_module); 48 + init_obj.register_terminator(uninitialize_example_module); 49 + init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); 50 + 51 + return init_obj.init(); 52 + } 53 + }
+16
tests/gdextension-control-build/src/register_types.h
··· 1 + /* godot-cpp integration testing project. 2 + * 3 + * This is free and unencumbered software released into the public domain. 4 + */ 5 + 6 + #ifndef EXAMPLE_REGISTER_TYPES_H 7 + #define EXAMPLE_REGISTER_TYPES_H 8 + 9 + #include <godot_cpp/core/class_db.hpp> 10 + 11 + using namespace godot; 12 + 13 + void initialize_example_module(ModuleInitializationLevel p_level); 14 + void uninitialize_example_module(ModuleInitializationLevel p_level); 15 + 16 + #endif // EXAMPLE_REGISTER_TYPES_H
+29
tests/gdextension-control-build/src/tests.h
··· 1 + /* godot-cpp integration testing project. 2 + * 3 + * This is free and unencumbered software released into the public domain. 4 + */ 5 + 6 + #ifndef TESTS_H 7 + #define TESTS_H 8 + 9 + #include <godot_cpp/templates/cowdata.hpp> 10 + #include <godot_cpp/templates/hash_map.hpp> 11 + #include <godot_cpp/templates/hash_set.hpp> 12 + #include <godot_cpp/templates/hashfuncs.hpp> 13 + #include <godot_cpp/templates/list.hpp> 14 + #include <godot_cpp/templates/local_vector.hpp> 15 + #include <godot_cpp/templates/pair.hpp> 16 + #include <godot_cpp/templates/rb_map.hpp> 17 + #include <godot_cpp/templates/rb_set.hpp> 18 + #include <godot_cpp/templates/rid_owner.hpp> 19 + #include <godot_cpp/templates/safe_refcount.hpp> 20 + #include <godot_cpp/templates/search_array.hpp> 21 + #include <godot_cpp/templates/self_list.hpp> 22 + #include <godot_cpp/templates/sort_array.hpp> 23 + #include <godot_cpp/templates/spin_lock.hpp> 24 + #include <godot_cpp/templates/thread_work_pool.hpp> 25 + #include <godot_cpp/templates/vector.hpp> 26 + #include <godot_cpp/templates/vmap.hpp> 27 + #include <godot_cpp/templates/vset.hpp> 28 + 29 + #endif // TESTS_H
+1
tests/gdextension-control-src/example.cpp
··· 1 + #include "example.h"
+9
tests/gdextension-control-src/example.gdextension
··· 1 + [configuration] 2 + 3 + entry_symbol = "gdext_control_library_init" 4 + compatibility_minimum = "4.4" 5 + 6 + [libraries] 7 + 8 + linux.debug.x86_64 = "res://bin/libgdext_control.linux.template_debug.x86_64.so" 9 + linux.release.x86_64 = "res://bin/libgdext_control.linux.template_release.x86_64.so"
+17
tests/gdextension-control-src/example.h
··· 1 + #ifndef GDEXT_CONTROL_EXAMPLE_H 2 + #define GDEXT_CONTROL_EXAMPLE_H 3 + 4 + #include <godot_cpp/classes/node.hpp> 5 + 6 + namespace godot { 7 + 8 + class Example : public Node { 9 + GDCLASS(Example, Node) 10 + 11 + protected: 12 + static void _bind_methods() {} 13 + }; 14 + 15 + } 16 + 17 + #endif
+32
tests/gdextension-control-src/register_types.cpp
··· 1 + #include "register_types.h" 2 + 3 + #include <godot_cpp/godot.hpp> 4 + #include <gdextension_interface.h> 5 + 6 + #include "example.h" 7 + 8 + using namespace godot; 9 + 10 + void initialize_gdext_control_module(ModuleInitializationLevel p_level) { 11 + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { 12 + return; 13 + } 14 + 15 + GDREGISTER_CLASS(Example); 16 + } 17 + 18 + void uninitialize_gdext_control_module(ModuleInitializationLevel p_level) { 19 + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { 20 + return; 21 + } 22 + } 23 + 24 + extern "C" { 25 + GDExtensionBool GDE_EXPORT gdext_control_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { 26 + godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); 27 + init_obj.register_initializer(initialize_gdext_control_module); 28 + init_obj.register_terminator(uninitialize_gdext_control_module); 29 + init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); 30 + return init_obj.init(); 31 + } 32 + }
+9
tests/gdextension-control-src/register_types.h
··· 1 + #ifndef GDEXT_CONTROL_REGISTER_TYPES_H 2 + #define GDEXT_CONTROL_REGISTER_TYPES_H 3 + 4 + #include <godot_cpp/core/class_db.hpp> 5 + 6 + void initialize_gdext_control_module(godot::ModuleInitializationLevel p_level); 7 + void uninitialize_gdext_control_module(godot::ModuleInitializationLevel p_level); 8 + 9 + #endif
+1
tests/gdextension-control/.godot/.gdignore
··· 1 +
tests/gdextension-control/bin/libgdext_control.linux.template_debug.x86_64.so

This is a binary file and will not be displayed.

tests/gdextension-control/bin/libgdext_control.linux.template_release.x86_64.so

This is a binary file and will not be displayed.

+9
tests/gdextension-control/example.gdextension
··· 1 + [configuration] 2 + 3 + entry_symbol = "gdext_control_library_init" 4 + compatibility_minimum = "4.4" 5 + 6 + [libraries] 7 + 8 + linux.debug.x86_64 = "res://bin/libgdext_control.linux.template_debug.x86_64.so" 9 + linux.release.x86_64 = "res://bin/libgdext_control.linux.template_release.x86_64.so"
+9043
tests/gdextension-control/gdextension_interface.json
··· 1 + { 2 + "_copyright": [ 3 + "/**************************************************************************/", 4 + "/* This file is part of: */", 5 + "/* GODOT ENGINE */", 6 + "/* https://godotengine.org */", 7 + "/**************************************************************************/", 8 + "/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */", 9 + "/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */", 10 + "/* */", 11 + "/* Permission is hereby granted, free of charge, to any person obtaining */", 12 + "/* a copy of this software and associated documentation files (the */", 13 + "/* \"Software\"), to deal in the Software without restriction, including */", 14 + "/* without limitation the rights to use, copy, modify, merge, publish, */", 15 + "/* distribute, sublicense, and/or sell copies of the Software, and to */", 16 + "/* permit persons to whom the Software is furnished to do so, subject to */", 17 + "/* the following conditions: */", 18 + "/* */", 19 + "/* The above copyright notice and this permission notice shall be */", 20 + "/* included in all copies or substantial portions of the Software. */", 21 + "/* */", 22 + "/* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, */", 23 + "/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */", 24 + "/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */", 25 + "/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */", 26 + "/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */", 27 + "/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */", 28 + "/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */", 29 + "/**************************************************************************/" 30 + ], 31 + "$schema": "./gdextension_interface.schema.json", 32 + "format_version": 1, 33 + "types": [ 34 + { 35 + "name": "GDExtensionVariantType", 36 + "kind": "enum", 37 + "values": [ 38 + { 39 + "name": "GDEXTENSION_VARIANT_TYPE_NIL", 40 + "value": 0 41 + }, 42 + { 43 + "name": "GDEXTENSION_VARIANT_TYPE_BOOL", 44 + "value": 1 45 + }, 46 + { 47 + "name": "GDEXTENSION_VARIANT_TYPE_INT", 48 + "value": 2 49 + }, 50 + { 51 + "name": "GDEXTENSION_VARIANT_TYPE_FLOAT", 52 + "value": 3 53 + }, 54 + { 55 + "name": "GDEXTENSION_VARIANT_TYPE_STRING", 56 + "value": 4 57 + }, 58 + { 59 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR2", 60 + "value": 5 61 + }, 62 + { 63 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR2I", 64 + "value": 6 65 + }, 66 + { 67 + "name": "GDEXTENSION_VARIANT_TYPE_RECT2", 68 + "value": 7 69 + }, 70 + { 71 + "name": "GDEXTENSION_VARIANT_TYPE_RECT2I", 72 + "value": 8 73 + }, 74 + { 75 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR3", 76 + "value": 9 77 + }, 78 + { 79 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR3I", 80 + "value": 10 81 + }, 82 + { 83 + "name": "GDEXTENSION_VARIANT_TYPE_TRANSFORM2D", 84 + "value": 11 85 + }, 86 + { 87 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR4", 88 + "value": 12 89 + }, 90 + { 91 + "name": "GDEXTENSION_VARIANT_TYPE_VECTOR4I", 92 + "value": 13 93 + }, 94 + { 95 + "name": "GDEXTENSION_VARIANT_TYPE_PLANE", 96 + "value": 14 97 + }, 98 + { 99 + "name": "GDEXTENSION_VARIANT_TYPE_QUATERNION", 100 + "value": 15 101 + }, 102 + { 103 + "name": "GDEXTENSION_VARIANT_TYPE_AABB", 104 + "value": 16 105 + }, 106 + { 107 + "name": "GDEXTENSION_VARIANT_TYPE_BASIS", 108 + "value": 17 109 + }, 110 + { 111 + "name": "GDEXTENSION_VARIANT_TYPE_TRANSFORM3D", 112 + "value": 18 113 + }, 114 + { 115 + "name": "GDEXTENSION_VARIANT_TYPE_PROJECTION", 116 + "value": 19 117 + }, 118 + { 119 + "name": "GDEXTENSION_VARIANT_TYPE_COLOR", 120 + "value": 20 121 + }, 122 + { 123 + "name": "GDEXTENSION_VARIANT_TYPE_STRING_NAME", 124 + "value": 21 125 + }, 126 + { 127 + "name": "GDEXTENSION_VARIANT_TYPE_NODE_PATH", 128 + "value": 22 129 + }, 130 + { 131 + "name": "GDEXTENSION_VARIANT_TYPE_RID", 132 + "value": 23 133 + }, 134 + { 135 + "name": "GDEXTENSION_VARIANT_TYPE_OBJECT", 136 + "value": 24 137 + }, 138 + { 139 + "name": "GDEXTENSION_VARIANT_TYPE_CALLABLE", 140 + "value": 25 141 + }, 142 + { 143 + "name": "GDEXTENSION_VARIANT_TYPE_SIGNAL", 144 + "value": 26 145 + }, 146 + { 147 + "name": "GDEXTENSION_VARIANT_TYPE_DICTIONARY", 148 + "value": 27 149 + }, 150 + { 151 + "name": "GDEXTENSION_VARIANT_TYPE_ARRAY", 152 + "value": 28 153 + }, 154 + { 155 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY", 156 + "value": 29 157 + }, 158 + { 159 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY", 160 + "value": 30 161 + }, 162 + { 163 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY", 164 + "value": 31 165 + }, 166 + { 167 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY", 168 + "value": 32 169 + }, 170 + { 171 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY", 172 + "value": 33 173 + }, 174 + { 175 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY", 176 + "value": 34 177 + }, 178 + { 179 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY", 180 + "value": 35 181 + }, 182 + { 183 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY", 184 + "value": 36 185 + }, 186 + { 187 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY", 188 + "value": 37 189 + }, 190 + { 191 + "name": "GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR4_ARRAY", 192 + "value": 38 193 + }, 194 + { 195 + "name": "GDEXTENSION_VARIANT_TYPE_VARIANT_MAX", 196 + "value": 39 197 + } 198 + ] 199 + }, 200 + { 201 + "name": "GDExtensionVariantOperator", 202 + "kind": "enum", 203 + "values": [ 204 + { 205 + "name": "GDEXTENSION_VARIANT_OP_EQUAL", 206 + "value": 0 207 + }, 208 + { 209 + "name": "GDEXTENSION_VARIANT_OP_NOT_EQUAL", 210 + "value": 1 211 + }, 212 + { 213 + "name": "GDEXTENSION_VARIANT_OP_LESS", 214 + "value": 2 215 + }, 216 + { 217 + "name": "GDEXTENSION_VARIANT_OP_LESS_EQUAL", 218 + "value": 3 219 + }, 220 + { 221 + "name": "GDEXTENSION_VARIANT_OP_GREATER", 222 + "value": 4 223 + }, 224 + { 225 + "name": "GDEXTENSION_VARIANT_OP_GREATER_EQUAL", 226 + "value": 5 227 + }, 228 + { 229 + "name": "GDEXTENSION_VARIANT_OP_ADD", 230 + "value": 6 231 + }, 232 + { 233 + "name": "GDEXTENSION_VARIANT_OP_SUBTRACT", 234 + "value": 7 235 + }, 236 + { 237 + "name": "GDEXTENSION_VARIANT_OP_MULTIPLY", 238 + "value": 8 239 + }, 240 + { 241 + "name": "GDEXTENSION_VARIANT_OP_DIVIDE", 242 + "value": 9 243 + }, 244 + { 245 + "name": "GDEXTENSION_VARIANT_OP_NEGATE", 246 + "value": 10 247 + }, 248 + { 249 + "name": "GDEXTENSION_VARIANT_OP_POSITIVE", 250 + "value": 11 251 + }, 252 + { 253 + "name": "GDEXTENSION_VARIANT_OP_MODULE", 254 + "value": 12 255 + }, 256 + { 257 + "name": "GDEXTENSION_VARIANT_OP_POWER", 258 + "value": 13 259 + }, 260 + { 261 + "name": "GDEXTENSION_VARIANT_OP_SHIFT_LEFT", 262 + "value": 14 263 + }, 264 + { 265 + "name": "GDEXTENSION_VARIANT_OP_SHIFT_RIGHT", 266 + "value": 15 267 + }, 268 + { 269 + "name": "GDEXTENSION_VARIANT_OP_BIT_AND", 270 + "value": 16 271 + }, 272 + { 273 + "name": "GDEXTENSION_VARIANT_OP_BIT_OR", 274 + "value": 17 275 + }, 276 + { 277 + "name": "GDEXTENSION_VARIANT_OP_BIT_XOR", 278 + "value": 18 279 + }, 280 + { 281 + "name": "GDEXTENSION_VARIANT_OP_BIT_NEGATE", 282 + "value": 19 283 + }, 284 + { 285 + "name": "GDEXTENSION_VARIANT_OP_AND", 286 + "value": 20 287 + }, 288 + { 289 + "name": "GDEXTENSION_VARIANT_OP_OR", 290 + "value": 21 291 + }, 292 + { 293 + "name": "GDEXTENSION_VARIANT_OP_XOR", 294 + "value": 22 295 + }, 296 + { 297 + "name": "GDEXTENSION_VARIANT_OP_NOT", 298 + "value": 23 299 + }, 300 + { 301 + "name": "GDEXTENSION_VARIANT_OP_IN", 302 + "value": 24 303 + }, 304 + { 305 + "name": "GDEXTENSION_VARIANT_OP_MAX", 306 + "value": 25 307 + } 308 + ] 309 + }, 310 + { 311 + "name": "GDExtensionVariantPtr", 312 + "kind": "handle", 313 + "description": [ 314 + "In this API there are multiple functions which expect the caller to pass a pointer", 315 + "on return value as parameter.", 316 + "In order to make it clear if the caller should initialize the return value or not", 317 + "we have two flavor of types:", 318 + "- `GDExtensionXXXPtr` for pointer on an initialized value", 319 + "- `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value", 320 + "", 321 + "Notes:", 322 + "- Not respecting those requirements can seems harmless, but will lead to unexpected", 323 + "segfault or memory leak (for instance with a specific compiler/OS, or when two", 324 + "native extensions start doing ptrcall on each other).", 325 + "- Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`,", 326 + "zero-initializing the variable should not be considered a valid initialization method here !", 327 + "- Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for", 328 + "them it is always safe to skip the constructor for the return value if you are in a hurry ;-)" 329 + ] 330 + }, 331 + { 332 + "name": "GDExtensionConstVariantPtr", 333 + "kind": "handle", 334 + "parent": "GDExtensionVariantPtr", 335 + "is_const": true 336 + }, 337 + { 338 + "name": "GDExtensionUninitializedVariantPtr", 339 + "kind": "handle", 340 + "parent": "GDExtensionVariantPtr", 341 + "is_uninitialized": true 342 + }, 343 + { 344 + "name": "GDExtensionStringNamePtr", 345 + "kind": "handle" 346 + }, 347 + { 348 + "name": "GDExtensionConstStringNamePtr", 349 + "kind": "handle", 350 + "parent": "GDExtensionStringNamePtr", 351 + "is_const": true 352 + }, 353 + { 354 + "name": "GDExtensionUninitializedStringNamePtr", 355 + "kind": "handle", 356 + "parent": "GDExtensionStringNamePtr", 357 + "is_uninitialized": true 358 + }, 359 + { 360 + "name": "GDExtensionStringPtr", 361 + "kind": "handle" 362 + }, 363 + { 364 + "name": "GDExtensionConstStringPtr", 365 + "kind": "handle", 366 + "parent": "GDExtensionStringPtr", 367 + "is_const": true 368 + }, 369 + { 370 + "name": "GDExtensionUninitializedStringPtr", 371 + "kind": "handle", 372 + "parent": "GDExtensionStringPtr", 373 + "is_uninitialized": true 374 + }, 375 + { 376 + "name": "GDExtensionObjectPtr", 377 + "kind": "handle" 378 + }, 379 + { 380 + "name": "GDExtensionConstObjectPtr", 381 + "kind": "handle", 382 + "parent": "GDExtensionObjectPtr", 383 + "is_const": true 384 + }, 385 + { 386 + "name": "GDExtensionUninitializedObjectPtr", 387 + "kind": "handle", 388 + "parent": "GDExtensionObjectPtr", 389 + "is_uninitialized": true 390 + }, 391 + { 392 + "name": "GDExtensionTypePtr", 393 + "kind": "handle" 394 + }, 395 + { 396 + "name": "GDExtensionConstTypePtr", 397 + "kind": "handle", 398 + "parent": "GDExtensionTypePtr", 399 + "is_const": true 400 + }, 401 + { 402 + "name": "GDExtensionUninitializedTypePtr", 403 + "kind": "handle", 404 + "parent": "GDExtensionTypePtr", 405 + "is_uninitialized": true 406 + }, 407 + { 408 + "name": "GDExtensionMethodBindPtr", 409 + "kind": "handle", 410 + "is_const": true 411 + }, 412 + { 413 + "name": "GDExtensionInt", 414 + "kind": "alias", 415 + "type": "int64_t" 416 + }, 417 + { 418 + "name": "GDExtensionBool", 419 + "kind": "alias", 420 + "type": "uint8_t" 421 + }, 422 + { 423 + "name": "GDObjectInstanceID", 424 + "kind": "alias", 425 + "type": "uint64_t" 426 + }, 427 + { 428 + "name": "GDExtensionRefPtr", 429 + "kind": "handle" 430 + }, 431 + { 432 + "name": "GDExtensionConstRefPtr", 433 + "kind": "handle", 434 + "parent": "GDExtensionRefPtr", 435 + "is_const": true 436 + }, 437 + { 438 + "name": "GDExtensionCallErrorType", 439 + "kind": "enum", 440 + "values": [ 441 + { 442 + "name": "GDEXTENSION_CALL_OK", 443 + "value": 0 444 + }, 445 + { 446 + "name": "GDEXTENSION_CALL_ERROR_INVALID_METHOD", 447 + "value": 1 448 + }, 449 + { 450 + "name": "GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT", 451 + "value": 2, 452 + "description": [ 453 + "Expected a different variant type." 454 + ] 455 + }, 456 + { 457 + "name": "GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS", 458 + "value": 3, 459 + "description": [ 460 + "Expected lower number of arguments." 461 + ] 462 + }, 463 + { 464 + "name": "GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS", 465 + "value": 4, 466 + "description": [ 467 + "Expected higher number of arguments." 468 + ] 469 + }, 470 + { 471 + "name": "GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL", 472 + "value": 5 473 + }, 474 + { 475 + "name": "GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST", 476 + "value": 6, 477 + "description": [ 478 + "Used for const call." 479 + ] 480 + } 481 + ] 482 + }, 483 + { 484 + "name": "GDExtensionCallError", 485 + "kind": "struct", 486 + "members": [ 487 + { 488 + "name": "error", 489 + "type": "GDExtensionCallErrorType" 490 + }, 491 + { 492 + "name": "argument", 493 + "type": "int32_t" 494 + }, 495 + { 496 + "name": "expected", 497 + "type": "int32_t" 498 + } 499 + ] 500 + }, 501 + { 502 + "name": "GDExtensionVariantFromTypeConstructorFunc", 503 + "kind": "function", 504 + "arguments": [ 505 + { 506 + "type": "GDExtensionUninitializedVariantPtr" 507 + }, 508 + { 509 + "type": "GDExtensionTypePtr" 510 + } 511 + ] 512 + }, 513 + { 514 + "name": "GDExtensionTypeFromVariantConstructorFunc", 515 + "kind": "function", 516 + "arguments": [ 517 + { 518 + "type": "GDExtensionUninitializedTypePtr" 519 + }, 520 + { 521 + "type": "GDExtensionVariantPtr" 522 + } 523 + ] 524 + }, 525 + { 526 + "name": "GDExtensionVariantGetInternalPtrFunc", 527 + "kind": "function", 528 + "return_value": { 529 + "type": "void*" 530 + }, 531 + "arguments": [ 532 + { 533 + "type": "GDExtensionVariantPtr" 534 + } 535 + ] 536 + }, 537 + { 538 + "name": "GDExtensionPtrOperatorEvaluator", 539 + "kind": "function", 540 + "arguments": [ 541 + { 542 + "name": "p_left", 543 + "type": "GDExtensionConstTypePtr" 544 + }, 545 + { 546 + "name": "p_right", 547 + "type": "GDExtensionConstTypePtr" 548 + }, 549 + { 550 + "name": "r_result", 551 + "type": "GDExtensionTypePtr" 552 + } 553 + ] 554 + }, 555 + { 556 + "name": "GDExtensionPtrBuiltInMethod", 557 + "kind": "function", 558 + "arguments": [ 559 + { 560 + "name": "p_base", 561 + "type": "GDExtensionTypePtr" 562 + }, 563 + { 564 + "name": "p_args", 565 + "type": "const GDExtensionConstTypePtr*" 566 + }, 567 + { 568 + "name": "r_return", 569 + "type": "GDExtensionTypePtr" 570 + }, 571 + { 572 + "name": "p_argument_count", 573 + "type": "int32_t" 574 + } 575 + ] 576 + }, 577 + { 578 + "name": "GDExtensionPtrConstructor", 579 + "kind": "function", 580 + "arguments": [ 581 + { 582 + "name": "p_base", 583 + "type": "GDExtensionUninitializedTypePtr" 584 + }, 585 + { 586 + "name": "p_args", 587 + "type": "const GDExtensionConstTypePtr*" 588 + } 589 + ] 590 + }, 591 + { 592 + "name": "GDExtensionPtrDestructor", 593 + "kind": "function", 594 + "arguments": [ 595 + { 596 + "name": "p_base", 597 + "type": "GDExtensionTypePtr" 598 + } 599 + ] 600 + }, 601 + { 602 + "name": "GDExtensionPtrSetter", 603 + "kind": "function", 604 + "arguments": [ 605 + { 606 + "name": "p_base", 607 + "type": "GDExtensionTypePtr" 608 + }, 609 + { 610 + "name": "p_value", 611 + "type": "GDExtensionConstTypePtr" 612 + } 613 + ] 614 + }, 615 + { 616 + "name": "GDExtensionPtrGetter", 617 + "kind": "function", 618 + "arguments": [ 619 + { 620 + "name": "p_base", 621 + "type": "GDExtensionConstTypePtr" 622 + }, 623 + { 624 + "name": "r_value", 625 + "type": "GDExtensionTypePtr" 626 + } 627 + ] 628 + }, 629 + { 630 + "name": "GDExtensionPtrIndexedSetter", 631 + "kind": "function", 632 + "arguments": [ 633 + { 634 + "name": "p_base", 635 + "type": "GDExtensionTypePtr" 636 + }, 637 + { 638 + "name": "p_index", 639 + "type": "GDExtensionInt" 640 + }, 641 + { 642 + "name": "p_value", 643 + "type": "GDExtensionConstTypePtr" 644 + } 645 + ] 646 + }, 647 + { 648 + "name": "GDExtensionPtrIndexedGetter", 649 + "kind": "function", 650 + "arguments": [ 651 + { 652 + "name": "p_base", 653 + "type": "GDExtensionConstTypePtr" 654 + }, 655 + { 656 + "name": "p_index", 657 + "type": "GDExtensionInt" 658 + }, 659 + { 660 + "name": "r_value", 661 + "type": "GDExtensionTypePtr" 662 + } 663 + ] 664 + }, 665 + { 666 + "name": "GDExtensionPtrKeyedSetter", 667 + "kind": "function", 668 + "arguments": [ 669 + { 670 + "name": "p_base", 671 + "type": "GDExtensionTypePtr" 672 + }, 673 + { 674 + "name": "p_key", 675 + "type": "GDExtensionConstTypePtr" 676 + }, 677 + { 678 + "name": "p_value", 679 + "type": "GDExtensionConstTypePtr" 680 + } 681 + ] 682 + }, 683 + { 684 + "name": "GDExtensionPtrKeyedGetter", 685 + "kind": "function", 686 + "arguments": [ 687 + { 688 + "name": "p_base", 689 + "type": "GDExtensionConstTypePtr" 690 + }, 691 + { 692 + "name": "p_key", 693 + "type": "GDExtensionConstTypePtr" 694 + }, 695 + { 696 + "name": "r_value", 697 + "type": "GDExtensionTypePtr" 698 + } 699 + ] 700 + }, 701 + { 702 + "name": "GDExtensionPtrKeyedChecker", 703 + "kind": "function", 704 + "return_value": { 705 + "type": "uint32_t" 706 + }, 707 + "arguments": [ 708 + { 709 + "name": "p_base", 710 + "type": "GDExtensionConstVariantPtr" 711 + }, 712 + { 713 + "name": "p_key", 714 + "type": "GDExtensionConstVariantPtr" 715 + } 716 + ] 717 + }, 718 + { 719 + "name": "GDExtensionPtrUtilityFunction", 720 + "kind": "function", 721 + "arguments": [ 722 + { 723 + "name": "r_return", 724 + "type": "GDExtensionTypePtr" 725 + }, 726 + { 727 + "name": "p_args", 728 + "type": "const GDExtensionConstTypePtr*" 729 + }, 730 + { 731 + "name": "p_argument_count", 732 + "type": "int32_t" 733 + } 734 + ] 735 + }, 736 + { 737 + "name": "GDExtensionClassConstructor", 738 + "kind": "function", 739 + "return_value": { 740 + "type": "GDExtensionObjectPtr" 741 + }, 742 + "arguments": [] 743 + }, 744 + { 745 + "name": "GDExtensionInstanceBindingCreateCallback", 746 + "kind": "function", 747 + "return_value": { 748 + "type": "void*" 749 + }, 750 + "arguments": [ 751 + { 752 + "name": "p_token", 753 + "type": "void*" 754 + }, 755 + { 756 + "name": "p_instance", 757 + "type": "void*" 758 + } 759 + ] 760 + }, 761 + { 762 + "name": "GDExtensionInstanceBindingFreeCallback", 763 + "kind": "function", 764 + "arguments": [ 765 + { 766 + "name": "p_token", 767 + "type": "void*" 768 + }, 769 + { 770 + "name": "p_instance", 771 + "type": "void*" 772 + }, 773 + { 774 + "name": "p_binding", 775 + "type": "void*" 776 + } 777 + ] 778 + }, 779 + { 780 + "name": "GDExtensionInstanceBindingReferenceCallback", 781 + "kind": "function", 782 + "return_value": { 783 + "type": "GDExtensionBool" 784 + }, 785 + "arguments": [ 786 + { 787 + "name": "p_token", 788 + "type": "void*" 789 + }, 790 + { 791 + "name": "p_binding", 792 + "type": "void*" 793 + }, 794 + { 795 + "name": "p_reference", 796 + "type": "GDExtensionBool" 797 + } 798 + ] 799 + }, 800 + { 801 + "name": "GDExtensionInstanceBindingCallbacks", 802 + "kind": "struct", 803 + "members": [ 804 + { 805 + "name": "create_callback", 806 + "type": "GDExtensionInstanceBindingCreateCallback" 807 + }, 808 + { 809 + "name": "free_callback", 810 + "type": "GDExtensionInstanceBindingFreeCallback" 811 + }, 812 + { 813 + "name": "reference_callback", 814 + "type": "GDExtensionInstanceBindingReferenceCallback" 815 + } 816 + ] 817 + }, 818 + { 819 + "name": "GDExtensionClassInstancePtr", 820 + "kind": "handle" 821 + }, 822 + { 823 + "name": "GDExtensionClassSet", 824 + "kind": "function", 825 + "return_value": { 826 + "type": "GDExtensionBool" 827 + }, 828 + "arguments": [ 829 + { 830 + "name": "p_instance", 831 + "type": "GDExtensionClassInstancePtr" 832 + }, 833 + { 834 + "name": "p_name", 835 + "type": "GDExtensionConstStringNamePtr" 836 + }, 837 + { 838 + "name": "p_value", 839 + "type": "GDExtensionConstVariantPtr" 840 + } 841 + ] 842 + }, 843 + { 844 + "name": "GDExtensionClassGet", 845 + "kind": "function", 846 + "return_value": { 847 + "type": "GDExtensionBool" 848 + }, 849 + "arguments": [ 850 + { 851 + "name": "p_instance", 852 + "type": "GDExtensionClassInstancePtr" 853 + }, 854 + { 855 + "name": "p_name", 856 + "type": "GDExtensionConstStringNamePtr" 857 + }, 858 + { 859 + "name": "r_ret", 860 + "type": "GDExtensionVariantPtr" 861 + } 862 + ] 863 + }, 864 + { 865 + "name": "GDExtensionClassGetRID", 866 + "kind": "function", 867 + "return_value": { 868 + "type": "uint64_t" 869 + }, 870 + "arguments": [ 871 + { 872 + "name": "p_instance", 873 + "type": "GDExtensionClassInstancePtr" 874 + } 875 + ] 876 + }, 877 + { 878 + "name": "GDExtensionPropertyInfo", 879 + "kind": "struct", 880 + "members": [ 881 + { 882 + "name": "type", 883 + "type": "GDExtensionVariantType" 884 + }, 885 + { 886 + "name": "name", 887 + "type": "GDExtensionStringNamePtr" 888 + }, 889 + { 890 + "name": "class_name", 891 + "type": "GDExtensionStringNamePtr" 892 + }, 893 + { 894 + "name": "hint", 895 + "type": "uint32_t", 896 + "description": [ 897 + "Bitfield of `PropertyHint` (defined in `extension_api.json`)." 898 + ] 899 + }, 900 + { 901 + "name": "hint_string", 902 + "type": "GDExtensionStringPtr" 903 + }, 904 + { 905 + "name": "usage", 906 + "type": "uint32_t", 907 + "description": [ 908 + "Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`)." 909 + ] 910 + } 911 + ] 912 + }, 913 + { 914 + "name": "GDExtensionMethodInfo", 915 + "kind": "struct", 916 + "members": [ 917 + { 918 + "name": "name", 919 + "type": "GDExtensionStringNamePtr" 920 + }, 921 + { 922 + "name": "return_value", 923 + "type": "GDExtensionPropertyInfo" 924 + }, 925 + { 926 + "name": "flags", 927 + "type": "uint32_t", 928 + "description": [ 929 + "Bitfield of `GDExtensionClassMethodFlags`." 930 + ] 931 + }, 932 + { 933 + "name": "id", 934 + "type": "int32_t" 935 + }, 936 + { 937 + "name": "argument_count", 938 + "type": "uint32_t", 939 + "description": [ 940 + "Arguments: `default_arguments` is an array of size `argument_count`." 941 + ] 942 + }, 943 + { 944 + "name": "arguments", 945 + "type": "GDExtensionPropertyInfo*" 946 + }, 947 + { 948 + "name": "default_argument_count", 949 + "type": "uint32_t", 950 + "description": [ 951 + "Default arguments: `default_arguments` is an array of size `default_argument_count`." 952 + ] 953 + }, 954 + { 955 + "name": "default_arguments", 956 + "type": "GDExtensionVariantPtr*" 957 + } 958 + ] 959 + }, 960 + { 961 + "name": "GDExtensionClassGetPropertyList", 962 + "kind": "function", 963 + "return_value": { 964 + "type": "const GDExtensionPropertyInfo*" 965 + }, 966 + "arguments": [ 967 + { 968 + "name": "p_instance", 969 + "type": "GDExtensionClassInstancePtr" 970 + }, 971 + { 972 + "name": "r_count", 973 + "type": "uint32_t*" 974 + } 975 + ] 976 + }, 977 + { 978 + "name": "GDExtensionClassFreePropertyList", 979 + "kind": "function", 980 + "arguments": [ 981 + { 982 + "name": "p_instance", 983 + "type": "GDExtensionClassInstancePtr" 984 + }, 985 + { 986 + "name": "p_list", 987 + "type": "const GDExtensionPropertyInfo*" 988 + } 989 + ] 990 + }, 991 + { 992 + "name": "GDExtensionClassFreePropertyList2", 993 + "kind": "function", 994 + "arguments": [ 995 + { 996 + "name": "p_instance", 997 + "type": "GDExtensionClassInstancePtr" 998 + }, 999 + { 1000 + "name": "p_list", 1001 + "type": "const GDExtensionPropertyInfo*" 1002 + }, 1003 + { 1004 + "name": "p_count", 1005 + "type": "uint32_t" 1006 + } 1007 + ] 1008 + }, 1009 + { 1010 + "name": "GDExtensionClassPropertyCanRevert", 1011 + "kind": "function", 1012 + "return_value": { 1013 + "type": "GDExtensionBool" 1014 + }, 1015 + "arguments": [ 1016 + { 1017 + "name": "p_instance", 1018 + "type": "GDExtensionClassInstancePtr" 1019 + }, 1020 + { 1021 + "name": "p_name", 1022 + "type": "GDExtensionConstStringNamePtr" 1023 + } 1024 + ] 1025 + }, 1026 + { 1027 + "name": "GDExtensionClassPropertyGetRevert", 1028 + "kind": "function", 1029 + "return_value": { 1030 + "type": "GDExtensionBool" 1031 + }, 1032 + "arguments": [ 1033 + { 1034 + "name": "p_instance", 1035 + "type": "GDExtensionClassInstancePtr" 1036 + }, 1037 + { 1038 + "name": "p_name", 1039 + "type": "GDExtensionConstStringNamePtr" 1040 + }, 1041 + { 1042 + "name": "r_ret", 1043 + "type": "GDExtensionVariantPtr" 1044 + } 1045 + ] 1046 + }, 1047 + { 1048 + "name": "GDExtensionClassValidateProperty", 1049 + "kind": "function", 1050 + "return_value": { 1051 + "type": "GDExtensionBool" 1052 + }, 1053 + "arguments": [ 1054 + { 1055 + "name": "p_instance", 1056 + "type": "GDExtensionClassInstancePtr" 1057 + }, 1058 + { 1059 + "name": "p_property", 1060 + "type": "GDExtensionPropertyInfo*" 1061 + } 1062 + ] 1063 + }, 1064 + { 1065 + "name": "GDExtensionClassNotification", 1066 + "kind": "function", 1067 + "arguments": [ 1068 + { 1069 + "name": "p_instance", 1070 + "type": "GDExtensionClassInstancePtr" 1071 + }, 1072 + { 1073 + "name": "p_what", 1074 + "type": "int32_t" 1075 + } 1076 + ], 1077 + "deprecated": { 1078 + "since": "4.2", 1079 + "replace_with": "GDExtensionClassNotification2" 1080 + } 1081 + }, 1082 + { 1083 + "name": "GDExtensionClassNotification2", 1084 + "kind": "function", 1085 + "arguments": [ 1086 + { 1087 + "name": "p_instance", 1088 + "type": "GDExtensionClassInstancePtr" 1089 + }, 1090 + { 1091 + "name": "p_what", 1092 + "type": "int32_t" 1093 + }, 1094 + { 1095 + "name": "p_reversed", 1096 + "type": "GDExtensionBool" 1097 + } 1098 + ] 1099 + }, 1100 + { 1101 + "name": "GDExtensionClassToString", 1102 + "kind": "function", 1103 + "arguments": [ 1104 + { 1105 + "name": "p_instance", 1106 + "type": "GDExtensionClassInstancePtr" 1107 + }, 1108 + { 1109 + "name": "r_is_valid", 1110 + "type": "GDExtensionBool*" 1111 + }, 1112 + { 1113 + "name": "p_out", 1114 + "type": "GDExtensionStringPtr" 1115 + } 1116 + ] 1117 + }, 1118 + { 1119 + "name": "GDExtensionClassReference", 1120 + "kind": "function", 1121 + "arguments": [ 1122 + { 1123 + "name": "p_instance", 1124 + "type": "GDExtensionClassInstancePtr" 1125 + } 1126 + ] 1127 + }, 1128 + { 1129 + "name": "GDExtensionClassUnreference", 1130 + "kind": "function", 1131 + "arguments": [ 1132 + { 1133 + "name": "p_instance", 1134 + "type": "GDExtensionClassInstancePtr" 1135 + } 1136 + ] 1137 + }, 1138 + { 1139 + "name": "GDExtensionClassCallVirtual", 1140 + "kind": "function", 1141 + "arguments": [ 1142 + { 1143 + "name": "p_instance", 1144 + "type": "GDExtensionClassInstancePtr" 1145 + }, 1146 + { 1147 + "name": "p_args", 1148 + "type": "const GDExtensionConstTypePtr*" 1149 + }, 1150 + { 1151 + "name": "r_ret", 1152 + "type": "GDExtensionTypePtr" 1153 + } 1154 + ] 1155 + }, 1156 + { 1157 + "name": "GDExtensionClassCreateInstance", 1158 + "kind": "function", 1159 + "return_value": { 1160 + "type": "GDExtensionObjectPtr" 1161 + }, 1162 + "arguments": [ 1163 + { 1164 + "name": "p_class_userdata", 1165 + "type": "void*" 1166 + } 1167 + ] 1168 + }, 1169 + { 1170 + "name": "GDExtensionClassCreateInstance2", 1171 + "kind": "function", 1172 + "return_value": { 1173 + "type": "GDExtensionObjectPtr" 1174 + }, 1175 + "arguments": [ 1176 + { 1177 + "name": "p_class_userdata", 1178 + "type": "void*" 1179 + }, 1180 + { 1181 + "name": "p_notify_postinitialize", 1182 + "type": "GDExtensionBool" 1183 + } 1184 + ] 1185 + }, 1186 + { 1187 + "name": "GDExtensionClassFreeInstance", 1188 + "kind": "function", 1189 + "arguments": [ 1190 + { 1191 + "name": "p_class_userdata", 1192 + "type": "void*" 1193 + }, 1194 + { 1195 + "name": "p_instance", 1196 + "type": "GDExtensionClassInstancePtr" 1197 + } 1198 + ] 1199 + }, 1200 + { 1201 + "name": "GDExtensionClassRecreateInstance", 1202 + "kind": "function", 1203 + "return_value": { 1204 + "type": "GDExtensionClassInstancePtr" 1205 + }, 1206 + "arguments": [ 1207 + { 1208 + "name": "p_class_userdata", 1209 + "type": "void*" 1210 + }, 1211 + { 1212 + "name": "p_object", 1213 + "type": "GDExtensionObjectPtr" 1214 + } 1215 + ] 1216 + }, 1217 + { 1218 + "name": "GDExtensionClassGetVirtual", 1219 + "kind": "function", 1220 + "return_value": { 1221 + "type": "GDExtensionClassCallVirtual" 1222 + }, 1223 + "arguments": [ 1224 + { 1225 + "name": "p_class_userdata", 1226 + "type": "void*" 1227 + }, 1228 + { 1229 + "name": "p_name", 1230 + "type": "GDExtensionConstStringNamePtr" 1231 + } 1232 + ] 1233 + }, 1234 + { 1235 + "name": "GDExtensionClassGetVirtual2", 1236 + "kind": "function", 1237 + "return_value": { 1238 + "type": "GDExtensionClassCallVirtual" 1239 + }, 1240 + "arguments": [ 1241 + { 1242 + "name": "p_class_userdata", 1243 + "type": "void*" 1244 + }, 1245 + { 1246 + "name": "p_name", 1247 + "type": "GDExtensionConstStringNamePtr" 1248 + }, 1249 + { 1250 + "name": "p_hash", 1251 + "type": "uint32_t" 1252 + } 1253 + ] 1254 + }, 1255 + { 1256 + "name": "GDExtensionClassGetVirtualCallData", 1257 + "kind": "function", 1258 + "return_value": { 1259 + "type": "void*" 1260 + }, 1261 + "arguments": [ 1262 + { 1263 + "name": "p_class_userdata", 1264 + "type": "void*" 1265 + }, 1266 + { 1267 + "name": "p_name", 1268 + "type": "GDExtensionConstStringNamePtr" 1269 + } 1270 + ] 1271 + }, 1272 + { 1273 + "name": "GDExtensionClassGetVirtualCallData2", 1274 + "kind": "function", 1275 + "return_value": { 1276 + "type": "void*" 1277 + }, 1278 + "arguments": [ 1279 + { 1280 + "name": "p_class_userdata", 1281 + "type": "void*" 1282 + }, 1283 + { 1284 + "name": "p_name", 1285 + "type": "GDExtensionConstStringNamePtr" 1286 + }, 1287 + { 1288 + "name": "p_hash", 1289 + "type": "uint32_t" 1290 + } 1291 + ] 1292 + }, 1293 + { 1294 + "name": "GDExtensionClassCallVirtualWithData", 1295 + "kind": "function", 1296 + "arguments": [ 1297 + { 1298 + "name": "p_instance", 1299 + "type": "GDExtensionClassInstancePtr" 1300 + }, 1301 + { 1302 + "name": "p_name", 1303 + "type": "GDExtensionConstStringNamePtr" 1304 + }, 1305 + { 1306 + "name": "p_virtual_call_userdata", 1307 + "type": "void*" 1308 + }, 1309 + { 1310 + "name": "p_args", 1311 + "type": "const GDExtensionConstTypePtr*" 1312 + }, 1313 + { 1314 + "name": "r_ret", 1315 + "type": "GDExtensionTypePtr" 1316 + } 1317 + ] 1318 + }, 1319 + { 1320 + "name": "GDExtensionClassCreationInfo", 1321 + "kind": "struct", 1322 + "members": [ 1323 + { 1324 + "name": "is_virtual", 1325 + "type": "GDExtensionBool" 1326 + }, 1327 + { 1328 + "name": "is_abstract", 1329 + "type": "GDExtensionBool" 1330 + }, 1331 + { 1332 + "name": "set_func", 1333 + "type": "GDExtensionClassSet" 1334 + }, 1335 + { 1336 + "name": "get_func", 1337 + "type": "GDExtensionClassGet" 1338 + }, 1339 + { 1340 + "name": "get_property_list_func", 1341 + "type": "GDExtensionClassGetPropertyList" 1342 + }, 1343 + { 1344 + "name": "free_property_list_func", 1345 + "type": "GDExtensionClassFreePropertyList" 1346 + }, 1347 + { 1348 + "name": "property_can_revert_func", 1349 + "type": "GDExtensionClassPropertyCanRevert" 1350 + }, 1351 + { 1352 + "name": "property_get_revert_func", 1353 + "type": "GDExtensionClassPropertyGetRevert" 1354 + }, 1355 + { 1356 + "name": "notification_func", 1357 + "type": "GDExtensionClassNotification" 1358 + }, 1359 + { 1360 + "name": "to_string_func", 1361 + "type": "GDExtensionClassToString" 1362 + }, 1363 + { 1364 + "name": "reference_func", 1365 + "type": "GDExtensionClassReference" 1366 + }, 1367 + { 1368 + "name": "unreference_func", 1369 + "type": "GDExtensionClassUnreference" 1370 + }, 1371 + { 1372 + "name": "create_instance_func", 1373 + "type": "GDExtensionClassCreateInstance", 1374 + "description": [ 1375 + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." 1376 + ] 1377 + }, 1378 + { 1379 + "name": "free_instance_func", 1380 + "type": "GDExtensionClassFreeInstance", 1381 + "description": [ 1382 + "Destructor; mandatory." 1383 + ] 1384 + }, 1385 + { 1386 + "name": "get_virtual_func", 1387 + "type": "GDExtensionClassGetVirtual", 1388 + "description": [ 1389 + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." 1390 + ] 1391 + }, 1392 + { 1393 + "name": "get_rid_func", 1394 + "type": "GDExtensionClassGetRID" 1395 + }, 1396 + { 1397 + "name": "class_userdata", 1398 + "type": "void*", 1399 + "description": [ 1400 + "Per-class user data, later accessible in instance bindings." 1401 + ] 1402 + } 1403 + ], 1404 + "deprecated": { 1405 + "since": "4.2", 1406 + "replace_with": "GDExtensionClassCreationInfo4" 1407 + } 1408 + }, 1409 + { 1410 + "name": "GDExtensionClassCreationInfo2", 1411 + "kind": "struct", 1412 + "members": [ 1413 + { 1414 + "name": "is_virtual", 1415 + "type": "GDExtensionBool" 1416 + }, 1417 + { 1418 + "name": "is_abstract", 1419 + "type": "GDExtensionBool" 1420 + }, 1421 + { 1422 + "name": "is_exposed", 1423 + "type": "GDExtensionBool" 1424 + }, 1425 + { 1426 + "name": "set_func", 1427 + "type": "GDExtensionClassSet" 1428 + }, 1429 + { 1430 + "name": "get_func", 1431 + "type": "GDExtensionClassGet" 1432 + }, 1433 + { 1434 + "name": "get_property_list_func", 1435 + "type": "GDExtensionClassGetPropertyList" 1436 + }, 1437 + { 1438 + "name": "free_property_list_func", 1439 + "type": "GDExtensionClassFreePropertyList" 1440 + }, 1441 + { 1442 + "name": "property_can_revert_func", 1443 + "type": "GDExtensionClassPropertyCanRevert" 1444 + }, 1445 + { 1446 + "name": "property_get_revert_func", 1447 + "type": "GDExtensionClassPropertyGetRevert" 1448 + }, 1449 + { 1450 + "name": "validate_property_func", 1451 + "type": "GDExtensionClassValidateProperty" 1452 + }, 1453 + { 1454 + "name": "notification_func", 1455 + "type": "GDExtensionClassNotification2" 1456 + }, 1457 + { 1458 + "name": "to_string_func", 1459 + "type": "GDExtensionClassToString" 1460 + }, 1461 + { 1462 + "name": "reference_func", 1463 + "type": "GDExtensionClassReference" 1464 + }, 1465 + { 1466 + "name": "unreference_func", 1467 + "type": "GDExtensionClassUnreference" 1468 + }, 1469 + { 1470 + "name": "create_instance_func", 1471 + "type": "GDExtensionClassCreateInstance", 1472 + "description": [ 1473 + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." 1474 + ] 1475 + }, 1476 + { 1477 + "name": "free_instance_func", 1478 + "type": "GDExtensionClassFreeInstance", 1479 + "description": [ 1480 + "Destructor; mandatory." 1481 + ] 1482 + }, 1483 + { 1484 + "name": "recreate_instance_func", 1485 + "type": "GDExtensionClassRecreateInstance" 1486 + }, 1487 + { 1488 + "name": "get_virtual_func", 1489 + "type": "GDExtensionClassGetVirtual", 1490 + "description": [ 1491 + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." 1492 + ] 1493 + }, 1494 + { 1495 + "name": "get_virtual_call_data_func", 1496 + "type": "GDExtensionClassGetVirtualCallData", 1497 + "description": [ 1498 + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", 1499 + "need or benefit from extra data when calling virtual functions.", 1500 + "Returns user data that will be passed to `call_virtual_with_data_func`.", 1501 + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", 1502 + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", 1503 + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." 1504 + ] 1505 + }, 1506 + { 1507 + "name": "call_virtual_with_data_func", 1508 + "type": "GDExtensionClassCallVirtualWithData", 1509 + "description": [ 1510 + "Used to call virtual functions when `get_virtual_call_data_func` is not null." 1511 + ] 1512 + }, 1513 + { 1514 + "name": "get_rid_func", 1515 + "type": "GDExtensionClassGetRID" 1516 + }, 1517 + { 1518 + "name": "class_userdata", 1519 + "type": "void*", 1520 + "description": [ 1521 + "Per-class user data, later accessible in instance bindings." 1522 + ] 1523 + } 1524 + ], 1525 + "deprecated": { 1526 + "since": "4.3", 1527 + "replace_with": "GDExtensionClassCreationInfo4" 1528 + } 1529 + }, 1530 + { 1531 + "name": "GDExtensionClassCreationInfo3", 1532 + "kind": "struct", 1533 + "members": [ 1534 + { 1535 + "name": "is_virtual", 1536 + "type": "GDExtensionBool" 1537 + }, 1538 + { 1539 + "name": "is_abstract", 1540 + "type": "GDExtensionBool" 1541 + }, 1542 + { 1543 + "name": "is_exposed", 1544 + "type": "GDExtensionBool" 1545 + }, 1546 + { 1547 + "name": "is_runtime", 1548 + "type": "GDExtensionBool" 1549 + }, 1550 + { 1551 + "name": "set_func", 1552 + "type": "GDExtensionClassSet" 1553 + }, 1554 + { 1555 + "name": "get_func", 1556 + "type": "GDExtensionClassGet" 1557 + }, 1558 + { 1559 + "name": "get_property_list_func", 1560 + "type": "GDExtensionClassGetPropertyList" 1561 + }, 1562 + { 1563 + "name": "free_property_list_func", 1564 + "type": "GDExtensionClassFreePropertyList2" 1565 + }, 1566 + { 1567 + "name": "property_can_revert_func", 1568 + "type": "GDExtensionClassPropertyCanRevert" 1569 + }, 1570 + { 1571 + "name": "property_get_revert_func", 1572 + "type": "GDExtensionClassPropertyGetRevert" 1573 + }, 1574 + { 1575 + "name": "validate_property_func", 1576 + "type": "GDExtensionClassValidateProperty" 1577 + }, 1578 + { 1579 + "name": "notification_func", 1580 + "type": "GDExtensionClassNotification2" 1581 + }, 1582 + { 1583 + "name": "to_string_func", 1584 + "type": "GDExtensionClassToString" 1585 + }, 1586 + { 1587 + "name": "reference_func", 1588 + "type": "GDExtensionClassReference" 1589 + }, 1590 + { 1591 + "name": "unreference_func", 1592 + "type": "GDExtensionClassUnreference" 1593 + }, 1594 + { 1595 + "name": "create_instance_func", 1596 + "type": "GDExtensionClassCreateInstance", 1597 + "description": [ 1598 + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." 1599 + ] 1600 + }, 1601 + { 1602 + "name": "free_instance_func", 1603 + "type": "GDExtensionClassFreeInstance", 1604 + "description": [ 1605 + "Destructor; mandatory." 1606 + ] 1607 + }, 1608 + { 1609 + "name": "recreate_instance_func", 1610 + "type": "GDExtensionClassRecreateInstance" 1611 + }, 1612 + { 1613 + "name": "get_virtual_func", 1614 + "type": "GDExtensionClassGetVirtual", 1615 + "description": [ 1616 + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." 1617 + ] 1618 + }, 1619 + { 1620 + "name": "get_virtual_call_data_func", 1621 + "type": "GDExtensionClassGetVirtualCallData", 1622 + "description": [ 1623 + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", 1624 + "need or benefit from extra data when calling virtual functions.", 1625 + "Returns user data that will be passed to `call_virtual_with_data_func`.", 1626 + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", 1627 + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", 1628 + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." 1629 + ] 1630 + }, 1631 + { 1632 + "name": "call_virtual_with_data_func", 1633 + "type": "GDExtensionClassCallVirtualWithData", 1634 + "description": [ 1635 + "Used to call virtual functions when `get_virtual_call_data_func` is not null." 1636 + ] 1637 + }, 1638 + { 1639 + "name": "get_rid_func", 1640 + "type": "GDExtensionClassGetRID" 1641 + }, 1642 + { 1643 + "name": "class_userdata", 1644 + "type": "void*", 1645 + "description": [ 1646 + "Per-class user data, later accessible in instance bindings." 1647 + ] 1648 + } 1649 + ], 1650 + "deprecated": { 1651 + "since": "4.4", 1652 + "replace_with": "GDExtensionClassCreationInfo4" 1653 + } 1654 + }, 1655 + { 1656 + "name": "GDExtensionClassCreationInfo4", 1657 + "kind": "struct", 1658 + "members": [ 1659 + { 1660 + "name": "is_virtual", 1661 + "type": "GDExtensionBool" 1662 + }, 1663 + { 1664 + "name": "is_abstract", 1665 + "type": "GDExtensionBool" 1666 + }, 1667 + { 1668 + "name": "is_exposed", 1669 + "type": "GDExtensionBool" 1670 + }, 1671 + { 1672 + "name": "is_runtime", 1673 + "type": "GDExtensionBool" 1674 + }, 1675 + { 1676 + "name": "icon_path", 1677 + "type": "GDExtensionConstStringPtr" 1678 + }, 1679 + { 1680 + "name": "set_func", 1681 + "type": "GDExtensionClassSet" 1682 + }, 1683 + { 1684 + "name": "get_func", 1685 + "type": "GDExtensionClassGet" 1686 + }, 1687 + { 1688 + "name": "get_property_list_func", 1689 + "type": "GDExtensionClassGetPropertyList" 1690 + }, 1691 + { 1692 + "name": "free_property_list_func", 1693 + "type": "GDExtensionClassFreePropertyList2" 1694 + }, 1695 + { 1696 + "name": "property_can_revert_func", 1697 + "type": "GDExtensionClassPropertyCanRevert" 1698 + }, 1699 + { 1700 + "name": "property_get_revert_func", 1701 + "type": "GDExtensionClassPropertyGetRevert" 1702 + }, 1703 + { 1704 + "name": "validate_property_func", 1705 + "type": "GDExtensionClassValidateProperty" 1706 + }, 1707 + { 1708 + "name": "notification_func", 1709 + "type": "GDExtensionClassNotification2" 1710 + }, 1711 + { 1712 + "name": "to_string_func", 1713 + "type": "GDExtensionClassToString" 1714 + }, 1715 + { 1716 + "name": "reference_func", 1717 + "type": "GDExtensionClassReference" 1718 + }, 1719 + { 1720 + "name": "unreference_func", 1721 + "type": "GDExtensionClassUnreference" 1722 + }, 1723 + { 1724 + "name": "create_instance_func", 1725 + "type": "GDExtensionClassCreateInstance2", 1726 + "description": [ 1727 + "(Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract." 1728 + ] 1729 + }, 1730 + { 1731 + "name": "free_instance_func", 1732 + "type": "GDExtensionClassFreeInstance", 1733 + "description": [ 1734 + "Destructor; mandatory." 1735 + ] 1736 + }, 1737 + { 1738 + "name": "recreate_instance_func", 1739 + "type": "GDExtensionClassRecreateInstance" 1740 + }, 1741 + { 1742 + "name": "get_virtual_func", 1743 + "type": "GDExtensionClassGetVirtual2", 1744 + "description": [ 1745 + "Queries a virtual function by name and returns a callback to invoke the requested virtual function." 1746 + ] 1747 + }, 1748 + { 1749 + "name": "get_virtual_call_data_func", 1750 + "type": "GDExtensionClassGetVirtualCallData2", 1751 + "description": [ 1752 + "Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that", 1753 + "need or benefit from extra data when calling virtual functions.", 1754 + "Returns user data that will be passed to `call_virtual_with_data_func`.", 1755 + "Returning `NULL` from this function signals to Godot that the virtual function is not overridden.", 1756 + "Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.", 1757 + "You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`." 1758 + ] 1759 + }, 1760 + { 1761 + "name": "call_virtual_with_data_func", 1762 + "type": "GDExtensionClassCallVirtualWithData", 1763 + "description": [ 1764 + "Used to call virtual functions when `get_virtual_call_data_func` is not null." 1765 + ] 1766 + }, 1767 + { 1768 + "name": "class_userdata", 1769 + "type": "void*", 1770 + "description": [ 1771 + "Per-class user data, later accessible in instance bindings." 1772 + ] 1773 + } 1774 + ] 1775 + }, 1776 + { 1777 + "name": "GDExtensionClassCreationInfo5", 1778 + "kind": "alias", 1779 + "type": "GDExtensionClassCreationInfo4" 1780 + }, 1781 + { 1782 + "name": "GDExtensionClassLibraryPtr", 1783 + "kind": "handle" 1784 + }, 1785 + { 1786 + "name": "GDExtensionEditorGetClassesUsedCallback", 1787 + "kind": "function", 1788 + "arguments": [ 1789 + { 1790 + "name": "p_packed_string_array", 1791 + "type": "GDExtensionTypePtr" 1792 + } 1793 + ], 1794 + "description": [ 1795 + "Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension." 1796 + ] 1797 + }, 1798 + { 1799 + "name": "GDExtensionClassMethodFlags", 1800 + "kind": "enum", 1801 + "is_bitfield": true, 1802 + "values": [ 1803 + { 1804 + "name": "GDEXTENSION_METHOD_FLAG_NORMAL", 1805 + "value": 1 1806 + }, 1807 + { 1808 + "name": "GDEXTENSION_METHOD_FLAG_EDITOR", 1809 + "value": 2 1810 + }, 1811 + { 1812 + "name": "GDEXTENSION_METHOD_FLAG_CONST", 1813 + "value": 4 1814 + }, 1815 + { 1816 + "name": "GDEXTENSION_METHOD_FLAG_VIRTUAL", 1817 + "value": 8 1818 + }, 1819 + { 1820 + "name": "GDEXTENSION_METHOD_FLAG_VARARG", 1821 + "value": 16 1822 + }, 1823 + { 1824 + "name": "GDEXTENSION_METHOD_FLAG_STATIC", 1825 + "value": 32 1826 + }, 1827 + { 1828 + "name": "GDEXTENSION_METHOD_FLAG_VIRTUAL_REQUIRED", 1829 + "value": 128 1830 + }, 1831 + { 1832 + "name": "GDEXTENSION_METHOD_FLAGS_DEFAULT", 1833 + "value": 1 1834 + } 1835 + ] 1836 + }, 1837 + { 1838 + "name": "GDExtensionClassMethodArgumentMetadata", 1839 + "kind": "enum", 1840 + "values": [ 1841 + { 1842 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE", 1843 + "value": 0 1844 + }, 1845 + { 1846 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8", 1847 + "value": 1 1848 + }, 1849 + { 1850 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16", 1851 + "value": 2 1852 + }, 1853 + { 1854 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32", 1855 + "value": 3 1856 + }, 1857 + { 1858 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64", 1859 + "value": 4 1860 + }, 1861 + { 1862 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8", 1863 + "value": 5 1864 + }, 1865 + { 1866 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16", 1867 + "value": 6 1868 + }, 1869 + { 1870 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32", 1871 + "value": 7 1872 + }, 1873 + { 1874 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64", 1875 + "value": 8 1876 + }, 1877 + { 1878 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT", 1879 + "value": 9 1880 + }, 1881 + { 1882 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE", 1883 + "value": 10 1884 + }, 1885 + { 1886 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR16", 1887 + "value": 11 1888 + }, 1889 + { 1890 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR32", 1891 + "value": 12 1892 + }, 1893 + { 1894 + "name": "GDEXTENSION_METHOD_ARGUMENT_METADATA_OBJECT_IS_REQUIRED", 1895 + "value": 13 1896 + } 1897 + ] 1898 + }, 1899 + { 1900 + "name": "GDExtensionClassMethodCall", 1901 + "kind": "function", 1902 + "arguments": [ 1903 + { 1904 + "name": "method_userdata", 1905 + "type": "void*" 1906 + }, 1907 + { 1908 + "name": "p_instance", 1909 + "type": "GDExtensionClassInstancePtr" 1910 + }, 1911 + { 1912 + "name": "p_args", 1913 + "type": "const GDExtensionConstVariantPtr*" 1914 + }, 1915 + { 1916 + "name": "p_argument_count", 1917 + "type": "GDExtensionInt" 1918 + }, 1919 + { 1920 + "name": "r_return", 1921 + "type": "GDExtensionVariantPtr" 1922 + }, 1923 + { 1924 + "name": "r_error", 1925 + "type": "GDExtensionCallError*" 1926 + } 1927 + ] 1928 + }, 1929 + { 1930 + "name": "GDExtensionClassMethodValidatedCall", 1931 + "kind": "function", 1932 + "arguments": [ 1933 + { 1934 + "name": "method_userdata", 1935 + "type": "void*" 1936 + }, 1937 + { 1938 + "name": "p_instance", 1939 + "type": "GDExtensionClassInstancePtr" 1940 + }, 1941 + { 1942 + "name": "p_args", 1943 + "type": "const GDExtensionConstVariantPtr*" 1944 + }, 1945 + { 1946 + "name": "r_return", 1947 + "type": "GDExtensionVariantPtr" 1948 + } 1949 + ] 1950 + }, 1951 + { 1952 + "name": "GDExtensionClassMethodPtrCall", 1953 + "kind": "function", 1954 + "arguments": [ 1955 + { 1956 + "name": "method_userdata", 1957 + "type": "void*" 1958 + }, 1959 + { 1960 + "name": "p_instance", 1961 + "type": "GDExtensionClassInstancePtr" 1962 + }, 1963 + { 1964 + "name": "p_args", 1965 + "type": "const GDExtensionConstTypePtr*" 1966 + }, 1967 + { 1968 + "name": "r_ret", 1969 + "type": "GDExtensionTypePtr" 1970 + } 1971 + ] 1972 + }, 1973 + { 1974 + "name": "GDExtensionClassMethodInfo", 1975 + "kind": "struct", 1976 + "members": [ 1977 + { 1978 + "name": "name", 1979 + "type": "GDExtensionStringNamePtr" 1980 + }, 1981 + { 1982 + "name": "method_userdata", 1983 + "type": "void*" 1984 + }, 1985 + { 1986 + "name": "call_func", 1987 + "type": "GDExtensionClassMethodCall" 1988 + }, 1989 + { 1990 + "name": "ptrcall_func", 1991 + "type": "GDExtensionClassMethodPtrCall" 1992 + }, 1993 + { 1994 + "name": "method_flags", 1995 + "type": "uint32_t", 1996 + "description": [ 1997 + "Bitfield of `GDExtensionClassMethodFlags`." 1998 + ] 1999 + }, 2000 + { 2001 + "name": "has_return_value", 2002 + "type": "GDExtensionBool", 2003 + "description": [ 2004 + "If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored.", 2005 + "", 2006 + "@todo Consider dropping `has_return_value` and making the other two properties match `GDExtensionMethodInfo` and `GDExtensionClassVirtualMethod` for consistency in future version of this struct." 2007 + ] 2008 + }, 2009 + { 2010 + "name": "return_value_info", 2011 + "type": "GDExtensionPropertyInfo*" 2012 + }, 2013 + { 2014 + "name": "return_value_metadata", 2015 + "type": "GDExtensionClassMethodArgumentMetadata" 2016 + }, 2017 + { 2018 + "name": "argument_count", 2019 + "type": "uint32_t", 2020 + "description": [ 2021 + "Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`.", 2022 + "Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies.", 2023 + "", 2024 + "@todo Consider renaming `arguments_info` to `arguments` for consistency in future version of this struct." 2025 + ] 2026 + }, 2027 + { 2028 + "name": "arguments_info", 2029 + "type": "GDExtensionPropertyInfo*" 2030 + }, 2031 + { 2032 + "name": "arguments_metadata", 2033 + "type": "GDExtensionClassMethodArgumentMetadata*" 2034 + }, 2035 + { 2036 + "name": "default_argument_count", 2037 + "type": "uint32_t", 2038 + "description": [ 2039 + "Default arguments: `default_arguments` is an array of size `default_argument_count`." 2040 + ] 2041 + }, 2042 + { 2043 + "name": "default_arguments", 2044 + "type": "GDExtensionVariantPtr*" 2045 + } 2046 + ] 2047 + }, 2048 + { 2049 + "name": "GDExtensionClassVirtualMethodInfo", 2050 + "kind": "struct", 2051 + "members": [ 2052 + { 2053 + "name": "name", 2054 + "type": "GDExtensionStringNamePtr" 2055 + }, 2056 + { 2057 + "name": "method_flags", 2058 + "type": "uint32_t", 2059 + "description": [ 2060 + "Bitfield of `GDExtensionClassMethodFlags`." 2061 + ] 2062 + }, 2063 + { 2064 + "name": "return_value", 2065 + "type": "GDExtensionPropertyInfo" 2066 + }, 2067 + { 2068 + "name": "return_value_metadata", 2069 + "type": "GDExtensionClassMethodArgumentMetadata" 2070 + }, 2071 + { 2072 + "name": "argument_count", 2073 + "type": "uint32_t" 2074 + }, 2075 + { 2076 + "name": "arguments", 2077 + "type": "GDExtensionPropertyInfo*" 2078 + }, 2079 + { 2080 + "name": "arguments_metadata", 2081 + "type": "GDExtensionClassMethodArgumentMetadata*" 2082 + } 2083 + ] 2084 + }, 2085 + { 2086 + "name": "GDExtensionCallableCustomCall", 2087 + "kind": "function", 2088 + "arguments": [ 2089 + { 2090 + "name": "callable_userdata", 2091 + "type": "void*" 2092 + }, 2093 + { 2094 + "name": "p_args", 2095 + "type": "const GDExtensionConstVariantPtr*" 2096 + }, 2097 + { 2098 + "name": "p_argument_count", 2099 + "type": "GDExtensionInt" 2100 + }, 2101 + { 2102 + "name": "r_return", 2103 + "type": "GDExtensionVariantPtr" 2104 + }, 2105 + { 2106 + "name": "r_error", 2107 + "type": "GDExtensionCallError*" 2108 + } 2109 + ] 2110 + }, 2111 + { 2112 + "name": "GDExtensionCallableCustomIsValid", 2113 + "kind": "function", 2114 + "return_value": { 2115 + "type": "GDExtensionBool" 2116 + }, 2117 + "arguments": [ 2118 + { 2119 + "name": "callable_userdata", 2120 + "type": "void*" 2121 + } 2122 + ] 2123 + }, 2124 + { 2125 + "name": "GDExtensionCallableCustomFree", 2126 + "kind": "function", 2127 + "arguments": [ 2128 + { 2129 + "name": "callable_userdata", 2130 + "type": "void*" 2131 + } 2132 + ] 2133 + }, 2134 + { 2135 + "name": "GDExtensionCallableCustomHash", 2136 + "kind": "function", 2137 + "return_value": { 2138 + "type": "uint32_t" 2139 + }, 2140 + "arguments": [ 2141 + { 2142 + "name": "callable_userdata", 2143 + "type": "void*" 2144 + } 2145 + ] 2146 + }, 2147 + { 2148 + "name": "GDExtensionCallableCustomEqual", 2149 + "kind": "function", 2150 + "return_value": { 2151 + "type": "GDExtensionBool" 2152 + }, 2153 + "arguments": [ 2154 + { 2155 + "name": "callable_userdata_a", 2156 + "type": "void*" 2157 + }, 2158 + { 2159 + "name": "callable_userdata_b", 2160 + "type": "void*" 2161 + } 2162 + ] 2163 + }, 2164 + { 2165 + "name": "GDExtensionCallableCustomLessThan", 2166 + "kind": "function", 2167 + "return_value": { 2168 + "type": "GDExtensionBool" 2169 + }, 2170 + "arguments": [ 2171 + { 2172 + "name": "callable_userdata_a", 2173 + "type": "void*" 2174 + }, 2175 + { 2176 + "name": "callable_userdata_b", 2177 + "type": "void*" 2178 + } 2179 + ] 2180 + }, 2181 + { 2182 + "name": "GDExtensionCallableCustomToString", 2183 + "kind": "function", 2184 + "arguments": [ 2185 + { 2186 + "name": "callable_userdata", 2187 + "type": "void*" 2188 + }, 2189 + { 2190 + "name": "r_is_valid", 2191 + "type": "GDExtensionBool*" 2192 + }, 2193 + { 2194 + "name": "r_out", 2195 + "type": "GDExtensionStringPtr" 2196 + } 2197 + ] 2198 + }, 2199 + { 2200 + "name": "GDExtensionCallableCustomGetArgumentCount", 2201 + "kind": "function", 2202 + "return_value": { 2203 + "type": "GDExtensionInt" 2204 + }, 2205 + "arguments": [ 2206 + { 2207 + "name": "callable_userdata", 2208 + "type": "void*" 2209 + }, 2210 + { 2211 + "name": "r_is_valid", 2212 + "type": "GDExtensionBool*" 2213 + } 2214 + ] 2215 + }, 2216 + { 2217 + "name": "GDExtensionCallableCustomInfo", 2218 + "kind": "struct", 2219 + "members": [ 2220 + { 2221 + "name": "callable_userdata", 2222 + "type": "void*" 2223 + }, 2224 + { 2225 + "name": "token", 2226 + "type": "void*" 2227 + }, 2228 + { 2229 + "name": "object_id", 2230 + "type": "GDObjectInstanceID" 2231 + }, 2232 + { 2233 + "name": "call_func", 2234 + "type": "GDExtensionCallableCustomCall" 2235 + }, 2236 + { 2237 + "name": "is_valid_func", 2238 + "type": "GDExtensionCallableCustomIsValid" 2239 + }, 2240 + { 2241 + "name": "free_func", 2242 + "type": "GDExtensionCallableCustomFree" 2243 + }, 2244 + { 2245 + "name": "hash_func", 2246 + "type": "GDExtensionCallableCustomHash" 2247 + }, 2248 + { 2249 + "name": "equal_func", 2250 + "type": "GDExtensionCallableCustomEqual" 2251 + }, 2252 + { 2253 + "name": "less_than_func", 2254 + "type": "GDExtensionCallableCustomLessThan" 2255 + }, 2256 + { 2257 + "name": "to_string_func", 2258 + "type": "GDExtensionCallableCustomToString" 2259 + } 2260 + ], 2261 + "description": [ 2262 + "Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.", 2263 + "", 2264 + "`token` should point to an address that uniquely identifies the GDExtension (for example, the", 2265 + "`GDExtensionClassLibraryPtr` passed to the entry symbol function.", 2266 + "", 2267 + "`hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and", 2268 + "`callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.", 2269 + "", 2270 + "The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.", 2271 + "", 2272 + "`is_valid_func` is necessary if the validity of the callable can change before destruction.", 2273 + "", 2274 + "`free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed." 2275 + ], 2276 + "deprecated": { 2277 + "since": "4.3", 2278 + "replace_with": "GDExtensionCallableCustomInfo2" 2279 + } 2280 + }, 2281 + { 2282 + "name": "GDExtensionCallableCustomInfo2", 2283 + "kind": "struct", 2284 + "members": [ 2285 + { 2286 + "name": "callable_userdata", 2287 + "type": "void*" 2288 + }, 2289 + { 2290 + "name": "token", 2291 + "type": "void*" 2292 + }, 2293 + { 2294 + "name": "object_id", 2295 + "type": "GDObjectInstanceID" 2296 + }, 2297 + { 2298 + "name": "call_func", 2299 + "type": "GDExtensionCallableCustomCall" 2300 + }, 2301 + { 2302 + "name": "is_valid_func", 2303 + "type": "GDExtensionCallableCustomIsValid" 2304 + }, 2305 + { 2306 + "name": "free_func", 2307 + "type": "GDExtensionCallableCustomFree" 2308 + }, 2309 + { 2310 + "name": "hash_func", 2311 + "type": "GDExtensionCallableCustomHash" 2312 + }, 2313 + { 2314 + "name": "equal_func", 2315 + "type": "GDExtensionCallableCustomEqual" 2316 + }, 2317 + { 2318 + "name": "less_than_func", 2319 + "type": "GDExtensionCallableCustomLessThan" 2320 + }, 2321 + { 2322 + "name": "to_string_func", 2323 + "type": "GDExtensionCallableCustomToString" 2324 + }, 2325 + { 2326 + "name": "get_argument_count_func", 2327 + "type": "GDExtensionCallableCustomGetArgumentCount" 2328 + } 2329 + ], 2330 + "description": [ 2331 + "Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.", 2332 + "", 2333 + "`token` should point to an address that uniquely identifies the GDExtension (for example, the", 2334 + "`GDExtensionClassLibraryPtr` passed to the entry symbol function.", 2335 + "", 2336 + "`hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and", 2337 + "`callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.", 2338 + "", 2339 + "The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.", 2340 + "", 2341 + "`is_valid_func` is necessary if the validity of the callable can change before destruction.", 2342 + "", 2343 + "`free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed." 2344 + ] 2345 + }, 2346 + { 2347 + "name": "GDExtensionScriptInstanceDataPtr", 2348 + "kind": "handle", 2349 + "description": [ 2350 + "Pointer to custom ScriptInstance native implementation." 2351 + ] 2352 + }, 2353 + { 2354 + "name": "GDExtensionScriptInstanceSet", 2355 + "kind": "function", 2356 + "return_value": { 2357 + "type": "GDExtensionBool" 2358 + }, 2359 + "arguments": [ 2360 + { 2361 + "name": "p_instance", 2362 + "type": "GDExtensionScriptInstanceDataPtr" 2363 + }, 2364 + { 2365 + "name": "p_name", 2366 + "type": "GDExtensionConstStringNamePtr" 2367 + }, 2368 + { 2369 + "name": "p_value", 2370 + "type": "GDExtensionConstVariantPtr" 2371 + } 2372 + ] 2373 + }, 2374 + { 2375 + "name": "GDExtensionScriptInstanceGet", 2376 + "kind": "function", 2377 + "return_value": { 2378 + "type": "GDExtensionBool" 2379 + }, 2380 + "arguments": [ 2381 + { 2382 + "name": "p_instance", 2383 + "type": "GDExtensionScriptInstanceDataPtr" 2384 + }, 2385 + { 2386 + "name": "p_name", 2387 + "type": "GDExtensionConstStringNamePtr" 2388 + }, 2389 + { 2390 + "name": "r_ret", 2391 + "type": "GDExtensionVariantPtr" 2392 + } 2393 + ] 2394 + }, 2395 + { 2396 + "name": "GDExtensionScriptInstanceGetPropertyList", 2397 + "kind": "function", 2398 + "return_value": { 2399 + "type": "const GDExtensionPropertyInfo*" 2400 + }, 2401 + "arguments": [ 2402 + { 2403 + "name": "p_instance", 2404 + "type": "GDExtensionScriptInstanceDataPtr" 2405 + }, 2406 + { 2407 + "name": "r_count", 2408 + "type": "uint32_t*" 2409 + } 2410 + ] 2411 + }, 2412 + { 2413 + "name": "GDExtensionScriptInstanceFreePropertyList", 2414 + "kind": "function", 2415 + "arguments": [ 2416 + { 2417 + "name": "p_instance", 2418 + "type": "GDExtensionScriptInstanceDataPtr" 2419 + }, 2420 + { 2421 + "name": "p_list", 2422 + "type": "const GDExtensionPropertyInfo*" 2423 + } 2424 + ], 2425 + "deprecated": { 2426 + "since": "4.3", 2427 + "replace_with": "GDExtensionScriptInstanceFreePropertyList2" 2428 + } 2429 + }, 2430 + { 2431 + "name": "GDExtensionScriptInstanceFreePropertyList2", 2432 + "kind": "function", 2433 + "arguments": [ 2434 + { 2435 + "name": "p_instance", 2436 + "type": "GDExtensionScriptInstanceDataPtr" 2437 + }, 2438 + { 2439 + "name": "p_list", 2440 + "type": "const GDExtensionPropertyInfo*" 2441 + }, 2442 + { 2443 + "name": "p_count", 2444 + "type": "uint32_t" 2445 + } 2446 + ] 2447 + }, 2448 + { 2449 + "name": "GDExtensionScriptInstanceGetClassCategory", 2450 + "kind": "function", 2451 + "return_value": { 2452 + "type": "GDExtensionBool" 2453 + }, 2454 + "arguments": [ 2455 + { 2456 + "name": "p_instance", 2457 + "type": "GDExtensionScriptInstanceDataPtr" 2458 + }, 2459 + { 2460 + "name": "p_class_category", 2461 + "type": "GDExtensionPropertyInfo*" 2462 + } 2463 + ] 2464 + }, 2465 + { 2466 + "name": "GDExtensionScriptInstanceGetPropertyType", 2467 + "kind": "function", 2468 + "return_value": { 2469 + "type": "GDExtensionVariantType" 2470 + }, 2471 + "arguments": [ 2472 + { 2473 + "name": "p_instance", 2474 + "type": "GDExtensionScriptInstanceDataPtr" 2475 + }, 2476 + { 2477 + "name": "p_name", 2478 + "type": "GDExtensionConstStringNamePtr" 2479 + }, 2480 + { 2481 + "name": "r_is_valid", 2482 + "type": "GDExtensionBool*" 2483 + } 2484 + ] 2485 + }, 2486 + { 2487 + "name": "GDExtensionScriptInstanceValidateProperty", 2488 + "kind": "function", 2489 + "return_value": { 2490 + "type": "GDExtensionBool" 2491 + }, 2492 + "arguments": [ 2493 + { 2494 + "name": "p_instance", 2495 + "type": "GDExtensionScriptInstanceDataPtr" 2496 + }, 2497 + { 2498 + "name": "p_property", 2499 + "type": "GDExtensionPropertyInfo*" 2500 + } 2501 + ] 2502 + }, 2503 + { 2504 + "name": "GDExtensionScriptInstancePropertyCanRevert", 2505 + "kind": "function", 2506 + "return_value": { 2507 + "type": "GDExtensionBool" 2508 + }, 2509 + "arguments": [ 2510 + { 2511 + "name": "p_instance", 2512 + "type": "GDExtensionScriptInstanceDataPtr" 2513 + }, 2514 + { 2515 + "name": "p_name", 2516 + "type": "GDExtensionConstStringNamePtr" 2517 + } 2518 + ] 2519 + }, 2520 + { 2521 + "name": "GDExtensionScriptInstancePropertyGetRevert", 2522 + "kind": "function", 2523 + "return_value": { 2524 + "type": "GDExtensionBool" 2525 + }, 2526 + "arguments": [ 2527 + { 2528 + "name": "p_instance", 2529 + "type": "GDExtensionScriptInstanceDataPtr" 2530 + }, 2531 + { 2532 + "name": "p_name", 2533 + "type": "GDExtensionConstStringNamePtr" 2534 + }, 2535 + { 2536 + "name": "r_ret", 2537 + "type": "GDExtensionVariantPtr" 2538 + } 2539 + ] 2540 + }, 2541 + { 2542 + "name": "GDExtensionScriptInstanceGetOwner", 2543 + "kind": "function", 2544 + "return_value": { 2545 + "type": "GDExtensionObjectPtr" 2546 + }, 2547 + "arguments": [ 2548 + { 2549 + "name": "p_instance", 2550 + "type": "GDExtensionScriptInstanceDataPtr" 2551 + } 2552 + ] 2553 + }, 2554 + { 2555 + "name": "GDExtensionScriptInstancePropertyStateAdd", 2556 + "kind": "function", 2557 + "arguments": [ 2558 + { 2559 + "name": "p_name", 2560 + "type": "GDExtensionConstStringNamePtr" 2561 + }, 2562 + { 2563 + "name": "p_value", 2564 + "type": "GDExtensionConstVariantPtr" 2565 + }, 2566 + { 2567 + "name": "p_userdata", 2568 + "type": "void*" 2569 + } 2570 + ] 2571 + }, 2572 + { 2573 + "name": "GDExtensionScriptInstanceGetPropertyState", 2574 + "kind": "function", 2575 + "arguments": [ 2576 + { 2577 + "name": "p_instance", 2578 + "type": "GDExtensionScriptInstanceDataPtr" 2579 + }, 2580 + { 2581 + "name": "p_add_func", 2582 + "type": "GDExtensionScriptInstancePropertyStateAdd" 2583 + }, 2584 + { 2585 + "name": "p_userdata", 2586 + "type": "void*" 2587 + } 2588 + ] 2589 + }, 2590 + { 2591 + "name": "GDExtensionScriptInstanceGetMethodList", 2592 + "kind": "function", 2593 + "return_value": { 2594 + "type": "const GDExtensionMethodInfo*" 2595 + }, 2596 + "arguments": [ 2597 + { 2598 + "name": "p_instance", 2599 + "type": "GDExtensionScriptInstanceDataPtr" 2600 + }, 2601 + { 2602 + "name": "r_count", 2603 + "type": "uint32_t*" 2604 + } 2605 + ] 2606 + }, 2607 + { 2608 + "name": "GDExtensionScriptInstanceFreeMethodList", 2609 + "kind": "function", 2610 + "arguments": [ 2611 + { 2612 + "name": "p_instance", 2613 + "type": "GDExtensionScriptInstanceDataPtr" 2614 + }, 2615 + { 2616 + "name": "p_list", 2617 + "type": "const GDExtensionMethodInfo*" 2618 + } 2619 + ], 2620 + "deprecated": { 2621 + "since": "4.3", 2622 + "replace_with": "GDExtensionScriptInstanceFreeMethodList2" 2623 + } 2624 + }, 2625 + { 2626 + "name": "GDExtensionScriptInstanceFreeMethodList2", 2627 + "kind": "function", 2628 + "arguments": [ 2629 + { 2630 + "name": "p_instance", 2631 + "type": "GDExtensionScriptInstanceDataPtr" 2632 + }, 2633 + { 2634 + "name": "p_list", 2635 + "type": "const GDExtensionMethodInfo*" 2636 + }, 2637 + { 2638 + "name": "p_count", 2639 + "type": "uint32_t" 2640 + } 2641 + ] 2642 + }, 2643 + { 2644 + "name": "GDExtensionScriptInstanceHasMethod", 2645 + "kind": "function", 2646 + "return_value": { 2647 + "type": "GDExtensionBool" 2648 + }, 2649 + "arguments": [ 2650 + { 2651 + "name": "p_instance", 2652 + "type": "GDExtensionScriptInstanceDataPtr" 2653 + }, 2654 + { 2655 + "name": "p_name", 2656 + "type": "GDExtensionConstStringNamePtr" 2657 + } 2658 + ] 2659 + }, 2660 + { 2661 + "name": "GDExtensionScriptInstanceGetMethodArgumentCount", 2662 + "kind": "function", 2663 + "return_value": { 2664 + "type": "GDExtensionInt" 2665 + }, 2666 + "arguments": [ 2667 + { 2668 + "name": "p_instance", 2669 + "type": "GDExtensionScriptInstanceDataPtr" 2670 + }, 2671 + { 2672 + "name": "p_name", 2673 + "type": "GDExtensionConstStringNamePtr" 2674 + }, 2675 + { 2676 + "name": "r_is_valid", 2677 + "type": "GDExtensionBool*" 2678 + } 2679 + ] 2680 + }, 2681 + { 2682 + "name": "GDExtensionScriptInstanceCall", 2683 + "kind": "function", 2684 + "arguments": [ 2685 + { 2686 + "name": "p_self", 2687 + "type": "GDExtensionScriptInstanceDataPtr" 2688 + }, 2689 + { 2690 + "name": "p_method", 2691 + "type": "GDExtensionConstStringNamePtr" 2692 + }, 2693 + { 2694 + "name": "p_args", 2695 + "type": "const GDExtensionConstVariantPtr*" 2696 + }, 2697 + { 2698 + "name": "p_argument_count", 2699 + "type": "GDExtensionInt" 2700 + }, 2701 + { 2702 + "name": "r_return", 2703 + "type": "GDExtensionVariantPtr" 2704 + }, 2705 + { 2706 + "name": "r_error", 2707 + "type": "GDExtensionCallError*" 2708 + } 2709 + ] 2710 + }, 2711 + { 2712 + "name": "GDExtensionScriptInstanceNotification", 2713 + "kind": "function", 2714 + "arguments": [ 2715 + { 2716 + "name": "p_instance", 2717 + "type": "GDExtensionScriptInstanceDataPtr" 2718 + }, 2719 + { 2720 + "name": "p_what", 2721 + "type": "int32_t" 2722 + } 2723 + ], 2724 + "deprecated": { 2725 + "since": "4.2", 2726 + "replace_with": "GDExtensionScriptInstanceNotification2" 2727 + } 2728 + }, 2729 + { 2730 + "name": "GDExtensionScriptInstanceNotification2", 2731 + "kind": "function", 2732 + "arguments": [ 2733 + { 2734 + "name": "p_instance", 2735 + "type": "GDExtensionScriptInstanceDataPtr" 2736 + }, 2737 + { 2738 + "name": "p_what", 2739 + "type": "int32_t" 2740 + }, 2741 + { 2742 + "name": "p_reversed", 2743 + "type": "GDExtensionBool" 2744 + } 2745 + ] 2746 + }, 2747 + { 2748 + "name": "GDExtensionScriptInstanceToString", 2749 + "kind": "function", 2750 + "arguments": [ 2751 + { 2752 + "name": "p_instance", 2753 + "type": "GDExtensionScriptInstanceDataPtr" 2754 + }, 2755 + { 2756 + "name": "r_is_valid", 2757 + "type": "GDExtensionBool*" 2758 + }, 2759 + { 2760 + "name": "r_out", 2761 + "type": "GDExtensionStringPtr" 2762 + } 2763 + ] 2764 + }, 2765 + { 2766 + "name": "GDExtensionScriptInstanceRefCountIncremented", 2767 + "kind": "function", 2768 + "arguments": [ 2769 + { 2770 + "name": "p_instance", 2771 + "type": "GDExtensionScriptInstanceDataPtr" 2772 + } 2773 + ] 2774 + }, 2775 + { 2776 + "name": "GDExtensionScriptInstanceRefCountDecremented", 2777 + "kind": "function", 2778 + "return_value": { 2779 + "type": "GDExtensionBool" 2780 + }, 2781 + "arguments": [ 2782 + { 2783 + "name": "p_instance", 2784 + "type": "GDExtensionScriptInstanceDataPtr" 2785 + } 2786 + ] 2787 + }, 2788 + { 2789 + "name": "GDExtensionScriptInstanceGetScript", 2790 + "kind": "function", 2791 + "return_value": { 2792 + "type": "GDExtensionObjectPtr" 2793 + }, 2794 + "arguments": [ 2795 + { 2796 + "name": "p_instance", 2797 + "type": "GDExtensionScriptInstanceDataPtr" 2798 + } 2799 + ] 2800 + }, 2801 + { 2802 + "name": "GDExtensionScriptInstanceIsPlaceholder", 2803 + "kind": "function", 2804 + "return_value": { 2805 + "type": "GDExtensionBool" 2806 + }, 2807 + "arguments": [ 2808 + { 2809 + "name": "p_instance", 2810 + "type": "GDExtensionScriptInstanceDataPtr" 2811 + } 2812 + ] 2813 + }, 2814 + { 2815 + "name": "GDExtensionScriptLanguagePtr", 2816 + "kind": "handle" 2817 + }, 2818 + { 2819 + "name": "GDExtensionScriptInstanceGetLanguage", 2820 + "kind": "function", 2821 + "return_value": { 2822 + "type": "GDExtensionScriptLanguagePtr" 2823 + }, 2824 + "arguments": [ 2825 + { 2826 + "name": "p_instance", 2827 + "type": "GDExtensionScriptInstanceDataPtr" 2828 + } 2829 + ] 2830 + }, 2831 + { 2832 + "name": "GDExtensionScriptInstanceFree", 2833 + "kind": "function", 2834 + "arguments": [ 2835 + { 2836 + "name": "p_instance", 2837 + "type": "GDExtensionScriptInstanceDataPtr" 2838 + } 2839 + ] 2840 + }, 2841 + { 2842 + "name": "GDExtensionScriptInstancePtr", 2843 + "kind": "handle", 2844 + "description": [ 2845 + "Pointer to ScriptInstance." 2846 + ] 2847 + }, 2848 + { 2849 + "name": "GDExtensionScriptInstanceInfo", 2850 + "kind": "struct", 2851 + "members": [ 2852 + { 2853 + "name": "set_func", 2854 + "type": "GDExtensionScriptInstanceSet" 2855 + }, 2856 + { 2857 + "name": "get_func", 2858 + "type": "GDExtensionScriptInstanceGet" 2859 + }, 2860 + { 2861 + "name": "get_property_list_func", 2862 + "type": "GDExtensionScriptInstanceGetPropertyList" 2863 + }, 2864 + { 2865 + "name": "free_property_list_func", 2866 + "type": "GDExtensionScriptInstanceFreePropertyList" 2867 + }, 2868 + { 2869 + "name": "property_can_revert_func", 2870 + "type": "GDExtensionScriptInstancePropertyCanRevert" 2871 + }, 2872 + { 2873 + "name": "property_get_revert_func", 2874 + "type": "GDExtensionScriptInstancePropertyGetRevert" 2875 + }, 2876 + { 2877 + "name": "get_owner_func", 2878 + "type": "GDExtensionScriptInstanceGetOwner" 2879 + }, 2880 + { 2881 + "name": "get_property_state_func", 2882 + "type": "GDExtensionScriptInstanceGetPropertyState" 2883 + }, 2884 + { 2885 + "name": "get_method_list_func", 2886 + "type": "GDExtensionScriptInstanceGetMethodList" 2887 + }, 2888 + { 2889 + "name": "free_method_list_func", 2890 + "type": "GDExtensionScriptInstanceFreeMethodList" 2891 + }, 2892 + { 2893 + "name": "get_property_type_func", 2894 + "type": "GDExtensionScriptInstanceGetPropertyType" 2895 + }, 2896 + { 2897 + "name": "has_method_func", 2898 + "type": "GDExtensionScriptInstanceHasMethod" 2899 + }, 2900 + { 2901 + "name": "call_func", 2902 + "type": "GDExtensionScriptInstanceCall" 2903 + }, 2904 + { 2905 + "name": "notification_func", 2906 + "type": "GDExtensionScriptInstanceNotification" 2907 + }, 2908 + { 2909 + "name": "to_string_func", 2910 + "type": "GDExtensionScriptInstanceToString" 2911 + }, 2912 + { 2913 + "name": "refcount_incremented_func", 2914 + "type": "GDExtensionScriptInstanceRefCountIncremented" 2915 + }, 2916 + { 2917 + "name": "refcount_decremented_func", 2918 + "type": "GDExtensionScriptInstanceRefCountDecremented" 2919 + }, 2920 + { 2921 + "name": "get_script_func", 2922 + "type": "GDExtensionScriptInstanceGetScript" 2923 + }, 2924 + { 2925 + "name": "is_placeholder_func", 2926 + "type": "GDExtensionScriptInstanceIsPlaceholder" 2927 + }, 2928 + { 2929 + "name": "set_fallback_func", 2930 + "type": "GDExtensionScriptInstanceSet" 2931 + }, 2932 + { 2933 + "name": "get_fallback_func", 2934 + "type": "GDExtensionScriptInstanceGet" 2935 + }, 2936 + { 2937 + "name": "get_language_func", 2938 + "type": "GDExtensionScriptInstanceGetLanguage" 2939 + }, 2940 + { 2941 + "name": "free_func", 2942 + "type": "GDExtensionScriptInstanceFree" 2943 + } 2944 + ], 2945 + "deprecated": { 2946 + "since": "4.2", 2947 + "replace_with": "GDExtensionScriptInstanceInfo3" 2948 + } 2949 + }, 2950 + { 2951 + "name": "GDExtensionScriptInstanceInfo2", 2952 + "kind": "struct", 2953 + "members": [ 2954 + { 2955 + "name": "set_func", 2956 + "type": "GDExtensionScriptInstanceSet" 2957 + }, 2958 + { 2959 + "name": "get_func", 2960 + "type": "GDExtensionScriptInstanceGet" 2961 + }, 2962 + { 2963 + "name": "get_property_list_func", 2964 + "type": "GDExtensionScriptInstanceGetPropertyList" 2965 + }, 2966 + { 2967 + "name": "free_property_list_func", 2968 + "type": "GDExtensionScriptInstanceFreePropertyList" 2969 + }, 2970 + { 2971 + "name": "get_class_category_func", 2972 + "type": "GDExtensionScriptInstanceGetClassCategory", 2973 + "description": [ 2974 + "Optional. Set to NULL for the default behavior." 2975 + ] 2976 + }, 2977 + { 2978 + "name": "property_can_revert_func", 2979 + "type": "GDExtensionScriptInstancePropertyCanRevert" 2980 + }, 2981 + { 2982 + "name": "property_get_revert_func", 2983 + "type": "GDExtensionScriptInstancePropertyGetRevert" 2984 + }, 2985 + { 2986 + "name": "get_owner_func", 2987 + "type": "GDExtensionScriptInstanceGetOwner" 2988 + }, 2989 + { 2990 + "name": "get_property_state_func", 2991 + "type": "GDExtensionScriptInstanceGetPropertyState" 2992 + }, 2993 + { 2994 + "name": "get_method_list_func", 2995 + "type": "GDExtensionScriptInstanceGetMethodList" 2996 + }, 2997 + { 2998 + "name": "free_method_list_func", 2999 + "type": "GDExtensionScriptInstanceFreeMethodList" 3000 + }, 3001 + { 3002 + "name": "get_property_type_func", 3003 + "type": "GDExtensionScriptInstanceGetPropertyType" 3004 + }, 3005 + { 3006 + "name": "validate_property_func", 3007 + "type": "GDExtensionScriptInstanceValidateProperty" 3008 + }, 3009 + { 3010 + "name": "has_method_func", 3011 + "type": "GDExtensionScriptInstanceHasMethod" 3012 + }, 3013 + { 3014 + "name": "call_func", 3015 + "type": "GDExtensionScriptInstanceCall" 3016 + }, 3017 + { 3018 + "name": "notification_func", 3019 + "type": "GDExtensionScriptInstanceNotification2" 3020 + }, 3021 + { 3022 + "name": "to_string_func", 3023 + "type": "GDExtensionScriptInstanceToString" 3024 + }, 3025 + { 3026 + "name": "refcount_incremented_func", 3027 + "type": "GDExtensionScriptInstanceRefCountIncremented" 3028 + }, 3029 + { 3030 + "name": "refcount_decremented_func", 3031 + "type": "GDExtensionScriptInstanceRefCountDecremented" 3032 + }, 3033 + { 3034 + "name": "get_script_func", 3035 + "type": "GDExtensionScriptInstanceGetScript" 3036 + }, 3037 + { 3038 + "name": "is_placeholder_func", 3039 + "type": "GDExtensionScriptInstanceIsPlaceholder" 3040 + }, 3041 + { 3042 + "name": "set_fallback_func", 3043 + "type": "GDExtensionScriptInstanceSet" 3044 + }, 3045 + { 3046 + "name": "get_fallback_func", 3047 + "type": "GDExtensionScriptInstanceGet" 3048 + }, 3049 + { 3050 + "name": "get_language_func", 3051 + "type": "GDExtensionScriptInstanceGetLanguage" 3052 + }, 3053 + { 3054 + "name": "free_func", 3055 + "type": "GDExtensionScriptInstanceFree" 3056 + } 3057 + ], 3058 + "deprecated": { 3059 + "since": "4.3", 3060 + "replace_with": "GDExtensionScriptInstanceInfo3" 3061 + } 3062 + }, 3063 + { 3064 + "name": "GDExtensionScriptInstanceInfo3", 3065 + "kind": "struct", 3066 + "members": [ 3067 + { 3068 + "name": "set_func", 3069 + "type": "GDExtensionScriptInstanceSet" 3070 + }, 3071 + { 3072 + "name": "get_func", 3073 + "type": "GDExtensionScriptInstanceGet" 3074 + }, 3075 + { 3076 + "name": "get_property_list_func", 3077 + "type": "GDExtensionScriptInstanceGetPropertyList" 3078 + }, 3079 + { 3080 + "name": "free_property_list_func", 3081 + "type": "GDExtensionScriptInstanceFreePropertyList2" 3082 + }, 3083 + { 3084 + "name": "get_class_category_func", 3085 + "type": "GDExtensionScriptInstanceGetClassCategory", 3086 + "description": [ 3087 + "Optional. Set to NULL for the default behavior." 3088 + ] 3089 + }, 3090 + { 3091 + "name": "property_can_revert_func", 3092 + "type": "GDExtensionScriptInstancePropertyCanRevert" 3093 + }, 3094 + { 3095 + "name": "property_get_revert_func", 3096 + "type": "GDExtensionScriptInstancePropertyGetRevert" 3097 + }, 3098 + { 3099 + "name": "get_owner_func", 3100 + "type": "GDExtensionScriptInstanceGetOwner" 3101 + }, 3102 + { 3103 + "name": "get_property_state_func", 3104 + "type": "GDExtensionScriptInstanceGetPropertyState" 3105 + }, 3106 + { 3107 + "name": "get_method_list_func", 3108 + "type": "GDExtensionScriptInstanceGetMethodList" 3109 + }, 3110 + { 3111 + "name": "free_method_list_func", 3112 + "type": "GDExtensionScriptInstanceFreeMethodList2" 3113 + }, 3114 + { 3115 + "name": "get_property_type_func", 3116 + "type": "GDExtensionScriptInstanceGetPropertyType" 3117 + }, 3118 + { 3119 + "name": "validate_property_func", 3120 + "type": "GDExtensionScriptInstanceValidateProperty" 3121 + }, 3122 + { 3123 + "name": "has_method_func", 3124 + "type": "GDExtensionScriptInstanceHasMethod" 3125 + }, 3126 + { 3127 + "name": "get_method_argument_count_func", 3128 + "type": "GDExtensionScriptInstanceGetMethodArgumentCount" 3129 + }, 3130 + { 3131 + "name": "call_func", 3132 + "type": "GDExtensionScriptInstanceCall" 3133 + }, 3134 + { 3135 + "name": "notification_func", 3136 + "type": "GDExtensionScriptInstanceNotification2" 3137 + }, 3138 + { 3139 + "name": "to_string_func", 3140 + "type": "GDExtensionScriptInstanceToString" 3141 + }, 3142 + { 3143 + "name": "refcount_incremented_func", 3144 + "type": "GDExtensionScriptInstanceRefCountIncremented" 3145 + }, 3146 + { 3147 + "name": "refcount_decremented_func", 3148 + "type": "GDExtensionScriptInstanceRefCountDecremented" 3149 + }, 3150 + { 3151 + "name": "get_script_func", 3152 + "type": "GDExtensionScriptInstanceGetScript" 3153 + }, 3154 + { 3155 + "name": "is_placeholder_func", 3156 + "type": "GDExtensionScriptInstanceIsPlaceholder" 3157 + }, 3158 + { 3159 + "name": "set_fallback_func", 3160 + "type": "GDExtensionScriptInstanceSet" 3161 + }, 3162 + { 3163 + "name": "get_fallback_func", 3164 + "type": "GDExtensionScriptInstanceGet" 3165 + }, 3166 + { 3167 + "name": "get_language_func", 3168 + "type": "GDExtensionScriptInstanceGetLanguage" 3169 + }, 3170 + { 3171 + "name": "free_func", 3172 + "type": "GDExtensionScriptInstanceFree" 3173 + } 3174 + ] 3175 + }, 3176 + { 3177 + "name": "GDExtensionWorkerThreadPoolGroupTask", 3178 + "kind": "function", 3179 + "arguments": [ 3180 + { 3181 + "name": "", 3182 + "type": "void*" 3183 + }, 3184 + { 3185 + "type": "uint32_t" 3186 + } 3187 + ] 3188 + }, 3189 + { 3190 + "name": "GDExtensionWorkerThreadPoolTask", 3191 + "kind": "function", 3192 + "arguments": [ 3193 + { 3194 + "name": "", 3195 + "type": "void*" 3196 + } 3197 + ] 3198 + }, 3199 + { 3200 + "name": "GDExtensionInitializationLevel", 3201 + "kind": "enum", 3202 + "values": [ 3203 + { 3204 + "name": "GDEXTENSION_INITIALIZATION_CORE", 3205 + "value": 0 3206 + }, 3207 + { 3208 + "name": "GDEXTENSION_INITIALIZATION_SERVERS", 3209 + "value": 1 3210 + }, 3211 + { 3212 + "name": "GDEXTENSION_INITIALIZATION_SCENE", 3213 + "value": 2 3214 + }, 3215 + { 3216 + "name": "GDEXTENSION_INITIALIZATION_EDITOR", 3217 + "value": 3 3218 + }, 3219 + { 3220 + "name": "GDEXTENSION_MAX_INITIALIZATION_LEVEL", 3221 + "value": 4 3222 + } 3223 + ] 3224 + }, 3225 + { 3226 + "name": "GDExtensionInitializeCallback", 3227 + "kind": "function", 3228 + "arguments": [ 3229 + { 3230 + "name": "p_userdata", 3231 + "type": "void*" 3232 + }, 3233 + { 3234 + "name": "p_level", 3235 + "type": "GDExtensionInitializationLevel" 3236 + } 3237 + ] 3238 + }, 3239 + { 3240 + "name": "GDExtensionDeinitializeCallback", 3241 + "kind": "function", 3242 + "arguments": [ 3243 + { 3244 + "name": "p_userdata", 3245 + "type": "void*" 3246 + }, 3247 + { 3248 + "name": "p_level", 3249 + "type": "GDExtensionInitializationLevel" 3250 + } 3251 + ] 3252 + }, 3253 + { 3254 + "name": "GDExtensionInitialization", 3255 + "kind": "struct", 3256 + "members": [ 3257 + { 3258 + "name": "minimum_initialization_level", 3259 + "type": "GDExtensionInitializationLevel", 3260 + "description": [ 3261 + "Minimum initialization level required.", 3262 + "If Core or Servers, the extension needs editor or game restart to take effect" 3263 + ] 3264 + }, 3265 + { 3266 + "name": "userdata", 3267 + "type": "void*", 3268 + "description": [ 3269 + "Up to the user to supply when initializing" 3270 + ] 3271 + }, 3272 + { 3273 + "name": "initialize", 3274 + "type": "GDExtensionInitializeCallback", 3275 + "description": [ 3276 + "This function will be called multiple times for each initialization level." 3277 + ] 3278 + }, 3279 + { 3280 + "name": "deinitialize", 3281 + "type": "GDExtensionDeinitializeCallback" 3282 + } 3283 + ] 3284 + }, 3285 + { 3286 + "name": "GDExtensionInterfaceFunctionPtr", 3287 + "kind": "function", 3288 + "arguments": [] 3289 + }, 3290 + { 3291 + "name": "GDExtensionInterfaceGetProcAddress", 3292 + "kind": "function", 3293 + "return_value": { 3294 + "type": "GDExtensionInterfaceFunctionPtr" 3295 + }, 3296 + "arguments": [ 3297 + { 3298 + "name": "p_function_name", 3299 + "type": "const char*" 3300 + } 3301 + ] 3302 + }, 3303 + { 3304 + "name": "GDExtensionInitializationFunction", 3305 + "kind": "function", 3306 + "return_value": { 3307 + "type": "GDExtensionBool" 3308 + }, 3309 + "arguments": [ 3310 + { 3311 + "name": "p_get_proc_address", 3312 + "type": "GDExtensionInterfaceGetProcAddress" 3313 + }, 3314 + { 3315 + "name": "p_library", 3316 + "type": "GDExtensionClassLibraryPtr" 3317 + }, 3318 + { 3319 + "name": "r_initialization", 3320 + "type": "GDExtensionInitialization*" 3321 + } 3322 + ], 3323 + "description": [ 3324 + "Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction,", 3325 + "and export it so that it can be loaded via dlopen() or equivalent for the given platform.", 3326 + "", 3327 + "For example:", 3328 + "", 3329 + " GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);", 3330 + "", 3331 + "This function's name must be specified as the 'entry_symbol' in the .gdextension file.", 3332 + "", 3333 + "This makes it the entry point of the GDExtension and will be called on initialization.", 3334 + "", 3335 + "The GDExtension can then modify the r_initialization structure, setting the minimum initialization level,", 3336 + "and providing pointers to functions that will be called at various stages of initialization/shutdown.", 3337 + "", 3338 + "The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded", 3339 + "by calling p_get_proc_address(\"...\") with the name of the function.", 3340 + "", 3341 + "For example:", 3342 + "", 3343 + " GDExtensionInterfaceGetGodotVersion get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address(\"get_godot_version\");", 3344 + "", 3345 + "(Note that snippet may cause \"cast between incompatible function types\" on some compilers, you can", 3346 + "silence this by adding an intermediary `void*` cast.)", 3347 + "", 3348 + "You can then call it like a normal function:", 3349 + "", 3350 + " GDExtensionGodotVersion godot_version;", 3351 + " get_godot_version(&godot_version);", 3352 + " printf(\"Godot v%d.%d.%d\\n\", godot_version.major, godot_version.minor, godot_version.patch);", 3353 + "", 3354 + "All of these interface functions are described below, together with the name that's used to load it,", 3355 + "and the function pointer typedef that shows its signature." 3356 + ] 3357 + }, 3358 + { 3359 + "name": "GDExtensionGodotVersion", 3360 + "kind": "struct", 3361 + "members": [ 3362 + { 3363 + "name": "major", 3364 + "type": "uint32_t" 3365 + }, 3366 + { 3367 + "name": "minor", 3368 + "type": "uint32_t" 3369 + }, 3370 + { 3371 + "name": "patch", 3372 + "type": "uint32_t" 3373 + }, 3374 + { 3375 + "name": "string", 3376 + "type": "const char*" 3377 + } 3378 + ] 3379 + }, 3380 + { 3381 + "name": "GDExtensionGodotVersion2", 3382 + "kind": "struct", 3383 + "members": [ 3384 + { 3385 + "name": "major", 3386 + "type": "uint32_t" 3387 + }, 3388 + { 3389 + "name": "minor", 3390 + "type": "uint32_t" 3391 + }, 3392 + { 3393 + "name": "patch", 3394 + "type": "uint32_t" 3395 + }, 3396 + { 3397 + "name": "hex", 3398 + "type": "uint32_t", 3399 + "description": [ 3400 + "Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for \"3.1.12\" it would be 0x03010C)" 3401 + ] 3402 + }, 3403 + { 3404 + "name": "status", 3405 + "type": "const char*", 3406 + "description": [ 3407 + "(e.g. \"stable\", \"beta\", \"rc1\", \"rc2\")" 3408 + ] 3409 + }, 3410 + { 3411 + "name": "build", 3412 + "type": "const char*", 3413 + "description": [ 3414 + "(e.g. \"custom_build\")" 3415 + ] 3416 + }, 3417 + { 3418 + "name": "hash", 3419 + "type": "const char*", 3420 + "description": [ 3421 + "Full Git commit hash." 3422 + ] 3423 + }, 3424 + { 3425 + "name": "timestamp", 3426 + "type": "uint64_t", 3427 + "description": [ 3428 + "Git commit date UNIX timestamp in seconds, or 0 if unavailable." 3429 + ] 3430 + }, 3431 + { 3432 + "name": "string", 3433 + "type": "const char*", 3434 + "description": [ 3435 + "(e.g. \"Godot v3.1.4.stable.official.mono\")" 3436 + ] 3437 + } 3438 + ] 3439 + }, 3440 + { 3441 + "name": "GDExtensionMainLoopStartupCallback", 3442 + "kind": "function", 3443 + "arguments": [], 3444 + "description": [ 3445 + "Called when starting the main loop." 3446 + ] 3447 + }, 3448 + { 3449 + "name": "GDExtensionMainLoopShutdownCallback", 3450 + "kind": "function", 3451 + "arguments": [], 3452 + "description": [ 3453 + "Called when shutting down the main loop." 3454 + ] 3455 + }, 3456 + { 3457 + "name": "GDExtensionMainLoopFrameCallback", 3458 + "kind": "function", 3459 + "arguments": [], 3460 + "description": [ 3461 + "Called for every frame iteration of the main loop." 3462 + ] 3463 + }, 3464 + { 3465 + "name": "GDExtensionMainLoopCallbacks", 3466 + "kind": "struct", 3467 + "members": [ 3468 + { 3469 + "name": "startup_func", 3470 + "type": "GDExtensionMainLoopStartupCallback", 3471 + "description": [ 3472 + "Will be called after Godot is started and is fully initialized." 3473 + ] 3474 + }, 3475 + { 3476 + "name": "shutdown_func", 3477 + "type": "GDExtensionMainLoopShutdownCallback", 3478 + "description": [ 3479 + "Will be called before Godot is shutdown when it is still fully initialized." 3480 + ] 3481 + }, 3482 + { 3483 + "name": "frame_func", 3484 + "type": "GDExtensionMainLoopFrameCallback", 3485 + "description": [ 3486 + "Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`.", 3487 + "This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API." 3488 + ] 3489 + } 3490 + ] 3491 + } 3492 + ], 3493 + "interface": [ 3494 + { 3495 + "name": "get_godot_version", 3496 + "arguments": [ 3497 + { 3498 + "name": "r_godot_version", 3499 + "type": "GDExtensionGodotVersion*", 3500 + "description": [ 3501 + "A pointer to the structure to write the version information into." 3502 + ] 3503 + } 3504 + ], 3505 + "description": [ 3506 + "Gets the Godot version that the GDExtension was loaded into." 3507 + ], 3508 + "since": "4.1", 3509 + "deprecated": { 3510 + "since": "4.5", 3511 + "replace_with": "get_godot_version2" 3512 + } 3513 + }, 3514 + { 3515 + "name": "get_godot_version2", 3516 + "arguments": [ 3517 + { 3518 + "name": "r_godot_version", 3519 + "type": "GDExtensionGodotVersion2*", 3520 + "description": [ 3521 + "A pointer to the structure to write the version information into." 3522 + ] 3523 + } 3524 + ], 3525 + "description": [ 3526 + "Gets the Godot version that the GDExtension was loaded into." 3527 + ], 3528 + "since": "4.5" 3529 + }, 3530 + { 3531 + "name": "mem_alloc", 3532 + "return_value": { 3533 + "type": "void*", 3534 + "description": [ 3535 + "A pointer to the allocated memory, or NULL if unsuccessful." 3536 + ] 3537 + }, 3538 + "arguments": [ 3539 + { 3540 + "name": "p_bytes", 3541 + "type": "size_t", 3542 + "description": [ 3543 + "The amount of memory to allocate in bytes." 3544 + ] 3545 + } 3546 + ], 3547 + "description": [ 3548 + "Allocates memory." 3549 + ], 3550 + "since": "4.1", 3551 + "deprecated": { 3552 + "since": "4.6", 3553 + "message": "Does not allow explicitly requesting padding.", 3554 + "replace_with": "mem_alloc2" 3555 + } 3556 + }, 3557 + { 3558 + "name": "mem_realloc", 3559 + "return_value": { 3560 + "type": "void*", 3561 + "description": [ 3562 + "A pointer to the allocated memory, or NULL if unsuccessful." 3563 + ] 3564 + }, 3565 + "arguments": [ 3566 + { 3567 + "name": "p_ptr", 3568 + "type": "void*", 3569 + "description": [ 3570 + "A pointer to the previously allocated memory." 3571 + ] 3572 + }, 3573 + { 3574 + "name": "p_bytes", 3575 + "type": "size_t", 3576 + "description": [ 3577 + "The number of bytes to resize the memory block to." 3578 + ] 3579 + } 3580 + ], 3581 + "description": [ 3582 + "Reallocates memory." 3583 + ], 3584 + "since": "4.1", 3585 + "deprecated": { 3586 + "since": "4.6", 3587 + "message": "Does not allow explicitly requesting padding.", 3588 + "replace_with": "mem_realloc2" 3589 + } 3590 + }, 3591 + { 3592 + "name": "mem_free", 3593 + "arguments": [ 3594 + { 3595 + "name": "p_ptr", 3596 + "type": "void*", 3597 + "description": [ 3598 + "A pointer to the previously allocated memory." 3599 + ] 3600 + } 3601 + ], 3602 + "description": [ 3603 + "Frees memory." 3604 + ], 3605 + "since": "4.1", 3606 + "deprecated": { 3607 + "since": "4.6", 3608 + "message": "Does not allow explicitly requesting padding.", 3609 + "replace_with": "mem_free2" 3610 + } 3611 + }, 3612 + { 3613 + "name": "mem_alloc2", 3614 + "return_value": { 3615 + "type": "void*", 3616 + "description": [ 3617 + "A pointer to the allocated memory, or NULL if unsuccessful." 3618 + ] 3619 + }, 3620 + "arguments": [ 3621 + { 3622 + "name": "p_bytes", 3623 + "type": "size_t", 3624 + "description": [ 3625 + "The amount of memory to allocate in bytes." 3626 + ] 3627 + }, 3628 + { 3629 + "name": "p_pad_align", 3630 + "type": "GDExtensionBool", 3631 + "description": [ 3632 + "If true, the returned memory will have prepadding of at least 8 bytes." 3633 + ] 3634 + } 3635 + ], 3636 + "description": [ 3637 + "Allocates memory." 3638 + ], 3639 + "since": "4.6" 3640 + }, 3641 + { 3642 + "name": "mem_realloc2", 3643 + "return_value": { 3644 + "type": "void*", 3645 + "description": [ 3646 + "A pointer to the allocated memory, or NULL if unsuccessful." 3647 + ] 3648 + }, 3649 + "arguments": [ 3650 + { 3651 + "name": "p_ptr", 3652 + "type": "void*", 3653 + "description": [ 3654 + "A pointer to the previously allocated memory." 3655 + ] 3656 + }, 3657 + { 3658 + "name": "p_bytes", 3659 + "type": "size_t", 3660 + "description": [ 3661 + "The number of bytes to resize the memory block to." 3662 + ] 3663 + }, 3664 + { 3665 + "name": "p_pad_align", 3666 + "type": "GDExtensionBool", 3667 + "description": [ 3668 + "If true, the returned memory will have prepadding of at least 8 bytes." 3669 + ] 3670 + } 3671 + ], 3672 + "description": [ 3673 + "Reallocates memory." 3674 + ], 3675 + "since": "4.6" 3676 + }, 3677 + { 3678 + "name": "mem_free2", 3679 + "arguments": [ 3680 + { 3681 + "name": "p_ptr", 3682 + "type": "void*", 3683 + "description": [ 3684 + "A pointer to the previously allocated memory." 3685 + ] 3686 + }, 3687 + { 3688 + "name": "p_pad_align", 3689 + "type": "GDExtensionBool", 3690 + "description": [ 3691 + "If true, the given memory was allocated with prepadding." 3692 + ] 3693 + } 3694 + ], 3695 + "description": [ 3696 + "Frees memory." 3697 + ], 3698 + "since": "4.6" 3699 + }, 3700 + { 3701 + "name": "print_error", 3702 + "arguments": [ 3703 + { 3704 + "name": "p_description", 3705 + "type": "const char*", 3706 + "description": [ 3707 + "The code triggering the error." 3708 + ] 3709 + }, 3710 + { 3711 + "name": "p_function", 3712 + "type": "const char*", 3713 + "description": [ 3714 + "The function name where the error occurred." 3715 + ] 3716 + }, 3717 + { 3718 + "name": "p_file", 3719 + "type": "const char*", 3720 + "description": [ 3721 + "The file where the error occurred." 3722 + ] 3723 + }, 3724 + { 3725 + "name": "p_line", 3726 + "type": "int32_t", 3727 + "description": [ 3728 + "The line where the error occurred." 3729 + ] 3730 + }, 3731 + { 3732 + "name": "p_editor_notify", 3733 + "type": "GDExtensionBool", 3734 + "description": [ 3735 + "Whether or not to notify the editor." 3736 + ] 3737 + } 3738 + ], 3739 + "description": [ 3740 + "Logs an error to Godot's built-in debugger and to the OS terminal." 3741 + ], 3742 + "since": "4.1" 3743 + }, 3744 + { 3745 + "name": "print_error_with_message", 3746 + "arguments": [ 3747 + { 3748 + "name": "p_description", 3749 + "type": "const char*", 3750 + "description": [ 3751 + "The code triggering the error." 3752 + ] 3753 + }, 3754 + { 3755 + "name": "p_message", 3756 + "type": "const char*", 3757 + "description": [ 3758 + "The message to show along with the error." 3759 + ] 3760 + }, 3761 + { 3762 + "name": "p_function", 3763 + "type": "const char*", 3764 + "description": [ 3765 + "The function name where the error occurred." 3766 + ] 3767 + }, 3768 + { 3769 + "name": "p_file", 3770 + "type": "const char*", 3771 + "description": [ 3772 + "The file where the error occurred." 3773 + ] 3774 + }, 3775 + { 3776 + "name": "p_line", 3777 + "type": "int32_t", 3778 + "description": [ 3779 + "The line where the error occurred." 3780 + ] 3781 + }, 3782 + { 3783 + "name": "p_editor_notify", 3784 + "type": "GDExtensionBool", 3785 + "description": [ 3786 + "Whether or not to notify the editor." 3787 + ] 3788 + } 3789 + ], 3790 + "description": [ 3791 + "Logs an error with a message to Godot's built-in debugger and to the OS terminal." 3792 + ], 3793 + "since": "4.1" 3794 + }, 3795 + { 3796 + "name": "print_warning", 3797 + "arguments": [ 3798 + { 3799 + "name": "p_description", 3800 + "type": "const char*", 3801 + "description": [ 3802 + "The code triggering the warning." 3803 + ] 3804 + }, 3805 + { 3806 + "name": "p_function", 3807 + "type": "const char*", 3808 + "description": [ 3809 + "The function name where the warning occurred." 3810 + ] 3811 + }, 3812 + { 3813 + "name": "p_file", 3814 + "type": "const char*", 3815 + "description": [ 3816 + "The file where the warning occurred." 3817 + ] 3818 + }, 3819 + { 3820 + "name": "p_line", 3821 + "type": "int32_t", 3822 + "description": [ 3823 + "The line where the warning occurred." 3824 + ] 3825 + }, 3826 + { 3827 + "name": "p_editor_notify", 3828 + "type": "GDExtensionBool", 3829 + "description": [ 3830 + "Whether or not to notify the editor." 3831 + ] 3832 + } 3833 + ], 3834 + "description": [ 3835 + "Logs a warning to Godot's built-in debugger and to the OS terminal." 3836 + ], 3837 + "since": "4.1" 3838 + }, 3839 + { 3840 + "name": "print_warning_with_message", 3841 + "arguments": [ 3842 + { 3843 + "name": "p_description", 3844 + "type": "const char*", 3845 + "description": [ 3846 + "The code triggering the warning." 3847 + ] 3848 + }, 3849 + { 3850 + "name": "p_message", 3851 + "type": "const char*", 3852 + "description": [ 3853 + "The message to show along with the warning." 3854 + ] 3855 + }, 3856 + { 3857 + "name": "p_function", 3858 + "type": "const char*", 3859 + "description": [ 3860 + "The function name where the warning occurred." 3861 + ] 3862 + }, 3863 + { 3864 + "name": "p_file", 3865 + "type": "const char*", 3866 + "description": [ 3867 + "The file where the warning occurred." 3868 + ] 3869 + }, 3870 + { 3871 + "name": "p_line", 3872 + "type": "int32_t", 3873 + "description": [ 3874 + "The line where the warning occurred." 3875 + ] 3876 + }, 3877 + { 3878 + "name": "p_editor_notify", 3879 + "type": "GDExtensionBool", 3880 + "description": [ 3881 + "Whether or not to notify the editor." 3882 + ] 3883 + } 3884 + ], 3885 + "description": [ 3886 + "Logs a warning with a message to Godot's built-in debugger and to the OS terminal." 3887 + ], 3888 + "since": "4.1" 3889 + }, 3890 + { 3891 + "name": "print_script_error", 3892 + "arguments": [ 3893 + { 3894 + "name": "p_description", 3895 + "type": "const char*", 3896 + "description": [ 3897 + "The code triggering the error." 3898 + ] 3899 + }, 3900 + { 3901 + "name": "p_function", 3902 + "type": "const char*", 3903 + "description": [ 3904 + "The function name where the error occurred." 3905 + ] 3906 + }, 3907 + { 3908 + "name": "p_file", 3909 + "type": "const char*", 3910 + "description": [ 3911 + "The file where the error occurred." 3912 + ] 3913 + }, 3914 + { 3915 + "name": "p_line", 3916 + "type": "int32_t", 3917 + "description": [ 3918 + "The line where the error occurred." 3919 + ] 3920 + }, 3921 + { 3922 + "name": "p_editor_notify", 3923 + "type": "GDExtensionBool", 3924 + "description": [ 3925 + "Whether or not to notify the editor." 3926 + ] 3927 + } 3928 + ], 3929 + "description": [ 3930 + "Logs a script error to Godot's built-in debugger and to the OS terminal." 3931 + ], 3932 + "since": "4.1" 3933 + }, 3934 + { 3935 + "name": "print_script_error_with_message", 3936 + "arguments": [ 3937 + { 3938 + "name": "p_description", 3939 + "type": "const char*", 3940 + "description": [ 3941 + "The code triggering the error." 3942 + ] 3943 + }, 3944 + { 3945 + "name": "p_message", 3946 + "type": "const char*", 3947 + "description": [ 3948 + "The message to show along with the error." 3949 + ] 3950 + }, 3951 + { 3952 + "name": "p_function", 3953 + "type": "const char*", 3954 + "description": [ 3955 + "The function name where the error occurred." 3956 + ] 3957 + }, 3958 + { 3959 + "name": "p_file", 3960 + "type": "const char*", 3961 + "description": [ 3962 + "The file where the error occurred." 3963 + ] 3964 + }, 3965 + { 3966 + "name": "p_line", 3967 + "type": "int32_t", 3968 + "description": [ 3969 + "The line where the error occurred." 3970 + ] 3971 + }, 3972 + { 3973 + "name": "p_editor_notify", 3974 + "type": "GDExtensionBool", 3975 + "description": [ 3976 + "Whether or not to notify the editor." 3977 + ] 3978 + } 3979 + ], 3980 + "description": [ 3981 + "Logs a script error with a message to Godot's built-in debugger and to the OS terminal." 3982 + ], 3983 + "since": "4.1" 3984 + }, 3985 + { 3986 + "name": "get_native_struct_size", 3987 + "return_value": { 3988 + "type": "uint64_t", 3989 + "description": [ 3990 + "The size in bytes." 3991 + ] 3992 + }, 3993 + "arguments": [ 3994 + { 3995 + "name": "p_name", 3996 + "type": "GDExtensionConstStringNamePtr", 3997 + "description": [ 3998 + "A pointer to a StringName identifying the struct name." 3999 + ] 4000 + } 4001 + ], 4002 + "description": [ 4003 + "Gets the size of a native struct (ex. ObjectID) in bytes." 4004 + ], 4005 + "since": "4.1" 4006 + }, 4007 + { 4008 + "name": "variant_new_copy", 4009 + "arguments": [ 4010 + { 4011 + "name": "r_dest", 4012 + "type": "GDExtensionUninitializedVariantPtr", 4013 + "description": [ 4014 + "A pointer to the destination Variant." 4015 + ] 4016 + }, 4017 + { 4018 + "name": "p_src", 4019 + "type": "GDExtensionConstVariantPtr", 4020 + "description": [ 4021 + "A pointer to the source Variant." 4022 + ] 4023 + } 4024 + ], 4025 + "description": [ 4026 + "Copies one Variant into a another." 4027 + ], 4028 + "since": "4.1" 4029 + }, 4030 + { 4031 + "name": "variant_new_nil", 4032 + "arguments": [ 4033 + { 4034 + "name": "r_dest", 4035 + "type": "GDExtensionUninitializedVariantPtr", 4036 + "description": [ 4037 + "A pointer to the destination Variant." 4038 + ] 4039 + } 4040 + ], 4041 + "description": [ 4042 + "Creates a new Variant containing nil." 4043 + ], 4044 + "since": "4.1" 4045 + }, 4046 + { 4047 + "name": "variant_destroy", 4048 + "arguments": [ 4049 + { 4050 + "name": "p_self", 4051 + "type": "GDExtensionVariantPtr", 4052 + "description": [ 4053 + "A pointer to the Variant to destroy." 4054 + ] 4055 + } 4056 + ], 4057 + "description": [ 4058 + "Destroys a Variant." 4059 + ], 4060 + "since": "4.1" 4061 + }, 4062 + { 4063 + "name": "variant_call", 4064 + "arguments": [ 4065 + { 4066 + "name": "p_self", 4067 + "type": "GDExtensionVariantPtr", 4068 + "description": [ 4069 + "A pointer to the Variant." 4070 + ] 4071 + }, 4072 + { 4073 + "name": "p_method", 4074 + "type": "GDExtensionConstStringNamePtr", 4075 + "description": [ 4076 + "A pointer to a StringName identifying the method." 4077 + ] 4078 + }, 4079 + { 4080 + "name": "p_args", 4081 + "type": "const GDExtensionConstVariantPtr*", 4082 + "description": [ 4083 + "A pointer to a C array of Variant." 4084 + ] 4085 + }, 4086 + { 4087 + "name": "p_argument_count", 4088 + "type": "GDExtensionInt", 4089 + "description": [ 4090 + "The number of arguments." 4091 + ] 4092 + }, 4093 + { 4094 + "name": "r_return", 4095 + "type": "GDExtensionUninitializedVariantPtr", 4096 + "description": [ 4097 + "A pointer a Variant which will be assigned the return value." 4098 + ] 4099 + }, 4100 + { 4101 + "name": "r_error", 4102 + "type": "GDExtensionCallError*", 4103 + "description": [ 4104 + "A pointer the structure which will hold error information." 4105 + ] 4106 + } 4107 + ], 4108 + "description": [ 4109 + "Calls a method on a Variant." 4110 + ], 4111 + "since": "4.1", 4112 + "see": [ 4113 + "Variant::callp()" 4114 + ] 4115 + }, 4116 + { 4117 + "name": "variant_call_static", 4118 + "arguments": [ 4119 + { 4120 + "name": "p_type", 4121 + "type": "GDExtensionVariantType", 4122 + "description": [ 4123 + "The variant type." 4124 + ] 4125 + }, 4126 + { 4127 + "name": "p_method", 4128 + "type": "GDExtensionConstStringNamePtr", 4129 + "description": [ 4130 + "A pointer to a StringName identifying the method." 4131 + ] 4132 + }, 4133 + { 4134 + "name": "p_args", 4135 + "type": "const GDExtensionConstVariantPtr*", 4136 + "description": [ 4137 + "A pointer to a C array of Variant." 4138 + ] 4139 + }, 4140 + { 4141 + "name": "p_argument_count", 4142 + "type": "GDExtensionInt", 4143 + "description": [ 4144 + "The number of arguments." 4145 + ] 4146 + }, 4147 + { 4148 + "name": "r_return", 4149 + "type": "GDExtensionUninitializedVariantPtr", 4150 + "description": [ 4151 + "A pointer a Variant which will be assigned the return value." 4152 + ] 4153 + }, 4154 + { 4155 + "name": "r_error", 4156 + "type": "GDExtensionCallError*", 4157 + "description": [ 4158 + "A pointer the structure which will be updated with error information." 4159 + ] 4160 + } 4161 + ], 4162 + "description": [ 4163 + "Calls a static method on a Variant." 4164 + ], 4165 + "since": "4.1", 4166 + "see": [ 4167 + "Variant::call_static()" 4168 + ] 4169 + }, 4170 + { 4171 + "name": "variant_evaluate", 4172 + "arguments": [ 4173 + { 4174 + "name": "p_op", 4175 + "type": "GDExtensionVariantOperator", 4176 + "description": [ 4177 + "The operator to evaluate." 4178 + ] 4179 + }, 4180 + { 4181 + "name": "p_a", 4182 + "type": "GDExtensionConstVariantPtr", 4183 + "description": [ 4184 + "The first Variant." 4185 + ] 4186 + }, 4187 + { 4188 + "name": "p_b", 4189 + "type": "GDExtensionConstVariantPtr", 4190 + "description": [ 4191 + "The second Variant." 4192 + ] 4193 + }, 4194 + { 4195 + "name": "r_return", 4196 + "type": "GDExtensionUninitializedVariantPtr", 4197 + "description": [ 4198 + "A pointer a Variant which will be assigned the return value." 4199 + ] 4200 + }, 4201 + { 4202 + "name": "r_valid", 4203 + "type": "GDExtensionBool*", 4204 + "description": [ 4205 + "A pointer to a boolean which will be set to false if the operation is invalid." 4206 + ] 4207 + } 4208 + ], 4209 + "description": [ 4210 + "Evaluate an operator on two Variants." 4211 + ], 4212 + "since": "4.1", 4213 + "see": [ 4214 + "Variant::evaluate()" 4215 + ] 4216 + }, 4217 + { 4218 + "name": "variant_set", 4219 + "arguments": [ 4220 + { 4221 + "name": "p_self", 4222 + "type": "GDExtensionVariantPtr", 4223 + "description": [ 4224 + "A pointer to the Variant." 4225 + ] 4226 + }, 4227 + { 4228 + "name": "p_key", 4229 + "type": "GDExtensionConstVariantPtr", 4230 + "description": [ 4231 + "A pointer to a Variant representing the key." 4232 + ] 4233 + }, 4234 + { 4235 + "name": "p_value", 4236 + "type": "GDExtensionConstVariantPtr", 4237 + "description": [ 4238 + "A pointer to a Variant representing the value." 4239 + ] 4240 + }, 4241 + { 4242 + "name": "r_valid", 4243 + "type": "GDExtensionBool*", 4244 + "description": [ 4245 + "A pointer to a boolean which will be set to false if the operation is invalid." 4246 + ] 4247 + } 4248 + ], 4249 + "description": [ 4250 + "Sets a key on a Variant to a value." 4251 + ], 4252 + "since": "4.1", 4253 + "see": [ 4254 + "Variant::set()" 4255 + ] 4256 + }, 4257 + { 4258 + "name": "variant_set_named", 4259 + "arguments": [ 4260 + { 4261 + "name": "p_self", 4262 + "type": "GDExtensionVariantPtr", 4263 + "description": [ 4264 + "A pointer to the Variant." 4265 + ] 4266 + }, 4267 + { 4268 + "name": "p_key", 4269 + "type": "GDExtensionConstStringNamePtr", 4270 + "description": [ 4271 + "A pointer to a StringName representing the key." 4272 + ] 4273 + }, 4274 + { 4275 + "name": "p_value", 4276 + "type": "GDExtensionConstVariantPtr", 4277 + "description": [ 4278 + "A pointer to a Variant representing the value." 4279 + ] 4280 + }, 4281 + { 4282 + "name": "r_valid", 4283 + "type": "GDExtensionBool*", 4284 + "description": [ 4285 + "A pointer to a boolean which will be set to false if the operation is invalid." 4286 + ] 4287 + } 4288 + ], 4289 + "description": [ 4290 + "Sets a named key on a Variant to a value." 4291 + ], 4292 + "since": "4.1", 4293 + "see": [ 4294 + "Variant::set_named()" 4295 + ] 4296 + }, 4297 + { 4298 + "name": "variant_set_keyed", 4299 + "arguments": [ 4300 + { 4301 + "name": "p_self", 4302 + "type": "GDExtensionVariantPtr", 4303 + "description": [ 4304 + "A pointer to the Variant." 4305 + ] 4306 + }, 4307 + { 4308 + "name": "p_key", 4309 + "type": "GDExtensionConstVariantPtr", 4310 + "description": [ 4311 + "A pointer to a Variant representing the key." 4312 + ] 4313 + }, 4314 + { 4315 + "name": "p_value", 4316 + "type": "GDExtensionConstVariantPtr", 4317 + "description": [ 4318 + "A pointer to a Variant representing the value." 4319 + ] 4320 + }, 4321 + { 4322 + "name": "r_valid", 4323 + "type": "GDExtensionBool*", 4324 + "description": [ 4325 + "A pointer to a boolean which will be set to false if the operation is invalid." 4326 + ] 4327 + } 4328 + ], 4329 + "description": [ 4330 + "Sets a keyed property on a Variant to a value." 4331 + ], 4332 + "since": "4.1", 4333 + "see": [ 4334 + "Variant::set_keyed()" 4335 + ] 4336 + }, 4337 + { 4338 + "name": "variant_set_indexed", 4339 + "arguments": [ 4340 + { 4341 + "name": "p_self", 4342 + "type": "GDExtensionVariantPtr", 4343 + "description": [ 4344 + "A pointer to the Variant." 4345 + ] 4346 + }, 4347 + { 4348 + "name": "p_index", 4349 + "type": "GDExtensionInt", 4350 + "description": [ 4351 + "The index." 4352 + ] 4353 + }, 4354 + { 4355 + "name": "p_value", 4356 + "type": "GDExtensionConstVariantPtr", 4357 + "description": [ 4358 + "A pointer to a Variant representing the value." 4359 + ] 4360 + }, 4361 + { 4362 + "name": "r_valid", 4363 + "type": "GDExtensionBool*", 4364 + "description": [ 4365 + "A pointer to a boolean which will be set to false if the operation is invalid." 4366 + ] 4367 + }, 4368 + { 4369 + "name": "r_oob", 4370 + "type": "GDExtensionBool*", 4371 + "description": [ 4372 + "A pointer to a boolean which will be set to true if the index is out of bounds." 4373 + ] 4374 + } 4375 + ], 4376 + "description": [ 4377 + "Sets an index on a Variant to a value." 4378 + ], 4379 + "since": "4.1" 4380 + }, 4381 + { 4382 + "name": "variant_get", 4383 + "arguments": [ 4384 + { 4385 + "name": "p_self", 4386 + "type": "GDExtensionConstVariantPtr", 4387 + "description": [ 4388 + "A pointer to the Variant." 4389 + ] 4390 + }, 4391 + { 4392 + "name": "p_key", 4393 + "type": "GDExtensionConstVariantPtr", 4394 + "description": [ 4395 + "A pointer to a Variant representing the key." 4396 + ] 4397 + }, 4398 + { 4399 + "name": "r_ret", 4400 + "type": "GDExtensionUninitializedVariantPtr", 4401 + "description": [ 4402 + "A pointer to a Variant which will be assigned the value." 4403 + ] 4404 + }, 4405 + { 4406 + "name": "r_valid", 4407 + "type": "GDExtensionBool*", 4408 + "description": [ 4409 + "A pointer to a boolean which will be set to false if the operation is invalid." 4410 + ] 4411 + } 4412 + ], 4413 + "description": [ 4414 + "Gets the value of a key from a Variant." 4415 + ], 4416 + "since": "4.1" 4417 + }, 4418 + { 4419 + "name": "variant_get_named", 4420 + "arguments": [ 4421 + { 4422 + "name": "p_self", 4423 + "type": "GDExtensionConstVariantPtr", 4424 + "description": [ 4425 + "A pointer to the Variant." 4426 + ] 4427 + }, 4428 + { 4429 + "name": "p_key", 4430 + "type": "GDExtensionConstStringNamePtr", 4431 + "description": [ 4432 + "A pointer to a StringName representing the key." 4433 + ] 4434 + }, 4435 + { 4436 + "name": "r_ret", 4437 + "type": "GDExtensionUninitializedVariantPtr", 4438 + "description": [ 4439 + "A pointer to a Variant which will be assigned the value." 4440 + ] 4441 + }, 4442 + { 4443 + "name": "r_valid", 4444 + "type": "GDExtensionBool*", 4445 + "description": [ 4446 + "A pointer to a boolean which will be set to false if the operation is invalid." 4447 + ] 4448 + } 4449 + ], 4450 + "description": [ 4451 + "Gets the value of a named key from a Variant." 4452 + ], 4453 + "since": "4.1" 4454 + }, 4455 + { 4456 + "name": "variant_get_keyed", 4457 + "arguments": [ 4458 + { 4459 + "name": "p_self", 4460 + "type": "GDExtensionConstVariantPtr", 4461 + "description": [ 4462 + "A pointer to the Variant." 4463 + ] 4464 + }, 4465 + { 4466 + "name": "p_key", 4467 + "type": "GDExtensionConstVariantPtr", 4468 + "description": [ 4469 + "A pointer to a Variant representing the key." 4470 + ] 4471 + }, 4472 + { 4473 + "name": "r_ret", 4474 + "type": "GDExtensionUninitializedVariantPtr", 4475 + "description": [ 4476 + "A pointer to a Variant which will be assigned the value." 4477 + ] 4478 + }, 4479 + { 4480 + "name": "r_valid", 4481 + "type": "GDExtensionBool*", 4482 + "description": [ 4483 + "A pointer to a boolean which will be set to false if the operation is invalid." 4484 + ] 4485 + } 4486 + ], 4487 + "description": [ 4488 + "Gets the value of a keyed property from a Variant." 4489 + ], 4490 + "since": "4.1" 4491 + }, 4492 + { 4493 + "name": "variant_get_indexed", 4494 + "arguments": [ 4495 + { 4496 + "name": "p_self", 4497 + "type": "GDExtensionConstVariantPtr", 4498 + "description": [ 4499 + "A pointer to the Variant." 4500 + ] 4501 + }, 4502 + { 4503 + "name": "p_index", 4504 + "type": "GDExtensionInt", 4505 + "description": [ 4506 + "The index." 4507 + ] 4508 + }, 4509 + { 4510 + "name": "r_ret", 4511 + "type": "GDExtensionUninitializedVariantPtr", 4512 + "description": [ 4513 + "A pointer to a Variant which will be assigned the value." 4514 + ] 4515 + }, 4516 + { 4517 + "name": "r_valid", 4518 + "type": "GDExtensionBool*", 4519 + "description": [ 4520 + "A pointer to a boolean which will be set to false if the operation is invalid." 4521 + ] 4522 + }, 4523 + { 4524 + "name": "r_oob", 4525 + "type": "GDExtensionBool*", 4526 + "description": [ 4527 + "A pointer to a boolean which will be set to true if the index is out of bounds." 4528 + ] 4529 + } 4530 + ], 4531 + "description": [ 4532 + "Gets the value of an index from a Variant." 4533 + ], 4534 + "since": "4.1" 4535 + }, 4536 + { 4537 + "name": "variant_iter_init", 4538 + "return_value": { 4539 + "type": "GDExtensionBool", 4540 + "description": [ 4541 + "true if the operation is valid; otherwise false." 4542 + ] 4543 + }, 4544 + "arguments": [ 4545 + { 4546 + "name": "p_self", 4547 + "type": "GDExtensionConstVariantPtr", 4548 + "description": [ 4549 + "A pointer to the Variant." 4550 + ] 4551 + }, 4552 + { 4553 + "name": "r_iter", 4554 + "type": "GDExtensionUninitializedVariantPtr", 4555 + "description": [ 4556 + "A pointer to a Variant which will be assigned the iterator." 4557 + ] 4558 + }, 4559 + { 4560 + "name": "r_valid", 4561 + "type": "GDExtensionBool*", 4562 + "description": [ 4563 + "A pointer to a boolean which will be set to false if the operation is invalid." 4564 + ] 4565 + } 4566 + ], 4567 + "description": [ 4568 + "Initializes an iterator over a Variant." 4569 + ], 4570 + "since": "4.1", 4571 + "see": [ 4572 + "Variant::iter_init()" 4573 + ] 4574 + }, 4575 + { 4576 + "name": "variant_iter_next", 4577 + "return_value": { 4578 + "type": "GDExtensionBool", 4579 + "description": [ 4580 + "true if the operation is valid; otherwise false." 4581 + ] 4582 + }, 4583 + "arguments": [ 4584 + { 4585 + "name": "p_self", 4586 + "type": "GDExtensionConstVariantPtr", 4587 + "description": [ 4588 + "A pointer to the Variant." 4589 + ] 4590 + }, 4591 + { 4592 + "name": "r_iter", 4593 + "type": "GDExtensionVariantPtr", 4594 + "description": [ 4595 + "A pointer to a Variant which will be assigned the iterator." 4596 + ] 4597 + }, 4598 + { 4599 + "name": "r_valid", 4600 + "type": "GDExtensionBool*", 4601 + "description": [ 4602 + "A pointer to a boolean which will be set to false if the operation is invalid." 4603 + ] 4604 + } 4605 + ], 4606 + "description": [ 4607 + "Gets the next value for an iterator over a Variant." 4608 + ], 4609 + "since": "4.1", 4610 + "see": [ 4611 + "Variant::iter_next()" 4612 + ] 4613 + }, 4614 + { 4615 + "name": "variant_iter_get", 4616 + "arguments": [ 4617 + { 4618 + "name": "p_self", 4619 + "type": "GDExtensionConstVariantPtr", 4620 + "description": [ 4621 + "A pointer to the Variant." 4622 + ] 4623 + }, 4624 + { 4625 + "name": "r_iter", 4626 + "type": "GDExtensionVariantPtr", 4627 + "description": [ 4628 + "A pointer to a Variant which will be assigned the iterator." 4629 + ] 4630 + }, 4631 + { 4632 + "name": "r_ret", 4633 + "type": "GDExtensionUninitializedVariantPtr", 4634 + "description": [ 4635 + "A pointer to a Variant which will be assigned false if the operation is invalid." 4636 + ] 4637 + }, 4638 + { 4639 + "name": "r_valid", 4640 + "type": "GDExtensionBool*", 4641 + "description": [ 4642 + "A pointer to a boolean which will be set to false if the operation is invalid." 4643 + ] 4644 + } 4645 + ], 4646 + "description": [ 4647 + "Gets the next value for an iterator over a Variant." 4648 + ], 4649 + "since": "4.1", 4650 + "see": [ 4651 + "Variant::iter_get()" 4652 + ] 4653 + }, 4654 + { 4655 + "name": "variant_hash", 4656 + "return_value": { 4657 + "type": "GDExtensionInt", 4658 + "description": [ 4659 + "The hash value." 4660 + ] 4661 + }, 4662 + "arguments": [ 4663 + { 4664 + "name": "p_self", 4665 + "type": "GDExtensionConstVariantPtr", 4666 + "description": [ 4667 + "A pointer to the Variant." 4668 + ] 4669 + } 4670 + ], 4671 + "description": [ 4672 + "Gets the hash of a Variant." 4673 + ], 4674 + "since": "4.1", 4675 + "see": [ 4676 + "Variant::hash()" 4677 + ] 4678 + }, 4679 + { 4680 + "name": "variant_recursive_hash", 4681 + "return_value": { 4682 + "type": "GDExtensionInt", 4683 + "description": [ 4684 + "The hash value." 4685 + ] 4686 + }, 4687 + "arguments": [ 4688 + { 4689 + "name": "p_self", 4690 + "type": "GDExtensionConstVariantPtr", 4691 + "description": [ 4692 + "A pointer to the Variant." 4693 + ] 4694 + }, 4695 + { 4696 + "name": "p_recursion_count", 4697 + "type": "GDExtensionInt", 4698 + "description": [ 4699 + "The number of recursive loops so far." 4700 + ] 4701 + } 4702 + ], 4703 + "description": [ 4704 + "Gets the recursive hash of a Variant." 4705 + ], 4706 + "since": "4.1", 4707 + "see": [ 4708 + "Variant::recursive_hash()" 4709 + ] 4710 + }, 4711 + { 4712 + "name": "variant_hash_compare", 4713 + "return_value": { 4714 + "type": "GDExtensionBool", 4715 + "description": [ 4716 + "The hash value." 4717 + ] 4718 + }, 4719 + "arguments": [ 4720 + { 4721 + "name": "p_self", 4722 + "type": "GDExtensionConstVariantPtr", 4723 + "description": [ 4724 + "A pointer to the Variant." 4725 + ] 4726 + }, 4727 + { 4728 + "name": "p_other", 4729 + "type": "GDExtensionConstVariantPtr", 4730 + "description": [ 4731 + "A pointer to the other Variant to compare it to." 4732 + ] 4733 + } 4734 + ], 4735 + "description": [ 4736 + "Compares two Variants by their hash." 4737 + ], 4738 + "since": "4.1", 4739 + "see": [ 4740 + "Variant::hash_compare()" 4741 + ] 4742 + }, 4743 + { 4744 + "name": "variant_booleanize", 4745 + "return_value": { 4746 + "type": "GDExtensionBool", 4747 + "description": [ 4748 + "The boolean value of the Variant." 4749 + ] 4750 + }, 4751 + "arguments": [ 4752 + { 4753 + "name": "p_self", 4754 + "type": "GDExtensionConstVariantPtr", 4755 + "description": [ 4756 + "A pointer to the Variant." 4757 + ] 4758 + } 4759 + ], 4760 + "description": [ 4761 + "Converts a Variant to a boolean." 4762 + ], 4763 + "since": "4.1" 4764 + }, 4765 + { 4766 + "name": "variant_duplicate", 4767 + "arguments": [ 4768 + { 4769 + "name": "p_self", 4770 + "type": "GDExtensionConstVariantPtr", 4771 + "description": [ 4772 + "A pointer to the Variant." 4773 + ] 4774 + }, 4775 + { 4776 + "name": "r_ret", 4777 + "type": "GDExtensionVariantPtr", 4778 + "description": [ 4779 + "A pointer to a Variant to store the duplicated value." 4780 + ] 4781 + }, 4782 + { 4783 + "name": "p_deep", 4784 + "type": "GDExtensionBool", 4785 + "description": [ 4786 + "Whether or not to duplicate deeply (when supported by the Variant type)." 4787 + ] 4788 + } 4789 + ], 4790 + "description": [ 4791 + "Duplicates a Variant." 4792 + ], 4793 + "since": "4.1" 4794 + }, 4795 + { 4796 + "name": "variant_stringify", 4797 + "arguments": [ 4798 + { 4799 + "name": "p_self", 4800 + "type": "GDExtensionConstVariantPtr", 4801 + "description": [ 4802 + "A pointer to the Variant." 4803 + ] 4804 + }, 4805 + { 4806 + "name": "r_ret", 4807 + "type": "GDExtensionStringPtr", 4808 + "description": [ 4809 + "A pointer to a String to store the resulting value." 4810 + ] 4811 + } 4812 + ], 4813 + "description": [ 4814 + "Converts a Variant to a string." 4815 + ], 4816 + "since": "4.1" 4817 + }, 4818 + { 4819 + "name": "variant_get_type", 4820 + "return_value": { 4821 + "type": "GDExtensionVariantType", 4822 + "description": [ 4823 + "The variant type." 4824 + ] 4825 + }, 4826 + "arguments": [ 4827 + { 4828 + "name": "p_self", 4829 + "type": "GDExtensionConstVariantPtr", 4830 + "description": [ 4831 + "A pointer to the Variant." 4832 + ] 4833 + } 4834 + ], 4835 + "description": [ 4836 + "Gets the type of a Variant." 4837 + ], 4838 + "since": "4.1" 4839 + }, 4840 + { 4841 + "name": "variant_has_method", 4842 + "return_value": { 4843 + "type": "GDExtensionBool", 4844 + "description": [ 4845 + "true if the variant has the given method; otherwise false." 4846 + ] 4847 + }, 4848 + "arguments": [ 4849 + { 4850 + "name": "p_self", 4851 + "type": "GDExtensionConstVariantPtr", 4852 + "description": [ 4853 + "A pointer to the Variant." 4854 + ] 4855 + }, 4856 + { 4857 + "name": "p_method", 4858 + "type": "GDExtensionConstStringNamePtr", 4859 + "description": [ 4860 + "A pointer to a StringName with the method name." 4861 + ] 4862 + } 4863 + ], 4864 + "description": [ 4865 + "Checks if a Variant has the given method." 4866 + ], 4867 + "since": "4.1" 4868 + }, 4869 + { 4870 + "name": "variant_has_member", 4871 + "return_value": { 4872 + "type": "GDExtensionBool", 4873 + "description": [ 4874 + "true if the variant has the given method; otherwise false." 4875 + ] 4876 + }, 4877 + "arguments": [ 4878 + { 4879 + "name": "p_type", 4880 + "type": "GDExtensionVariantType", 4881 + "description": [ 4882 + "The Variant type." 4883 + ] 4884 + }, 4885 + { 4886 + "name": "p_member", 4887 + "type": "GDExtensionConstStringNamePtr", 4888 + "description": [ 4889 + "A pointer to a StringName with the member name." 4890 + ] 4891 + } 4892 + ], 4893 + "description": [ 4894 + "Checks if a type of Variant has the given member." 4895 + ], 4896 + "since": "4.1" 4897 + }, 4898 + { 4899 + "name": "variant_has_key", 4900 + "return_value": { 4901 + "type": "GDExtensionBool", 4902 + "description": [ 4903 + "true if the key exists; otherwise false." 4904 + ] 4905 + }, 4906 + "arguments": [ 4907 + { 4908 + "name": "p_self", 4909 + "type": "GDExtensionConstVariantPtr", 4910 + "description": [ 4911 + "A pointer to the Variant." 4912 + ] 4913 + }, 4914 + { 4915 + "name": "p_key", 4916 + "type": "GDExtensionConstVariantPtr", 4917 + "description": [ 4918 + "A pointer to a Variant representing the key." 4919 + ] 4920 + }, 4921 + { 4922 + "name": "r_valid", 4923 + "type": "GDExtensionBool*", 4924 + "description": [ 4925 + "A pointer to a boolean which will be set to false if the key doesn't exist." 4926 + ] 4927 + } 4928 + ], 4929 + "description": [ 4930 + "Checks if a Variant has a key." 4931 + ], 4932 + "since": "4.1" 4933 + }, 4934 + { 4935 + "name": "variant_get_object_instance_id", 4936 + "return_value": { 4937 + "type": "GDObjectInstanceID", 4938 + "description": [ 4939 + "The instance ID for the contained object." 4940 + ] 4941 + }, 4942 + "arguments": [ 4943 + { 4944 + "name": "p_self", 4945 + "type": "GDExtensionConstVariantPtr", 4946 + "description": [ 4947 + "A pointer to the Variant." 4948 + ] 4949 + } 4950 + ], 4951 + "description": [ 4952 + "Gets the object instance ID from a variant of type GDEXTENSION_VARIANT_TYPE_OBJECT.", 4953 + "If the variant isn't of type GDEXTENSION_VARIANT_TYPE_OBJECT, then zero will be returned.", 4954 + "The instance ID will be returned even if the object is no longer valid - use `object_get_instance_by_id()` to check if the object is still valid." 4955 + ], 4956 + "since": "4.4" 4957 + }, 4958 + { 4959 + "name": "variant_get_type_name", 4960 + "arguments": [ 4961 + { 4962 + "name": "p_type", 4963 + "type": "GDExtensionVariantType", 4964 + "description": [ 4965 + "The Variant type." 4966 + ] 4967 + }, 4968 + { 4969 + "name": "r_name", 4970 + "type": "GDExtensionUninitializedStringPtr", 4971 + "description": [ 4972 + "A pointer to a String to store the Variant type name." 4973 + ] 4974 + } 4975 + ], 4976 + "description": [ 4977 + "Gets the name of a Variant type." 4978 + ], 4979 + "since": "4.1" 4980 + }, 4981 + { 4982 + "name": "variant_can_convert", 4983 + "return_value": { 4984 + "type": "GDExtensionBool", 4985 + "description": [ 4986 + "true if the conversion is possible; otherwise false." 4987 + ] 4988 + }, 4989 + "arguments": [ 4990 + { 4991 + "name": "p_from", 4992 + "type": "GDExtensionVariantType", 4993 + "description": [ 4994 + "The Variant type to convert from." 4995 + ] 4996 + }, 4997 + { 4998 + "name": "p_to", 4999 + "type": "GDExtensionVariantType", 5000 + "description": [ 5001 + "The Variant type to convert to." 5002 + ] 5003 + } 5004 + ], 5005 + "description": [ 5006 + "Checks if Variants can be converted from one type to another." 5007 + ], 5008 + "since": "4.1" 5009 + }, 5010 + { 5011 + "name": "variant_can_convert_strict", 5012 + "return_value": { 5013 + "type": "GDExtensionBool", 5014 + "description": [ 5015 + "true if the conversion is possible; otherwise false." 5016 + ] 5017 + }, 5018 + "arguments": [ 5019 + { 5020 + "name": "p_from", 5021 + "type": "GDExtensionVariantType", 5022 + "description": [ 5023 + "The Variant type to convert from." 5024 + ] 5025 + }, 5026 + { 5027 + "name": "p_to", 5028 + "type": "GDExtensionVariantType", 5029 + "description": [ 5030 + "The Variant type to convert to." 5031 + ] 5032 + } 5033 + ], 5034 + "description": [ 5035 + "Checks if Variant can be converted from one type to another using stricter rules." 5036 + ], 5037 + "since": "4.1" 5038 + }, 5039 + { 5040 + "name": "get_variant_from_type_constructor", 5041 + "return_value": { 5042 + "type": "GDExtensionVariantFromTypeConstructorFunc", 5043 + "description": [ 5044 + "A pointer to a function that can create a Variant of the given type from a raw value." 5045 + ] 5046 + }, 5047 + "arguments": [ 5048 + { 5049 + "name": "p_type", 5050 + "type": "GDExtensionVariantType", 5051 + "description": [ 5052 + "The Variant type." 5053 + ] 5054 + } 5055 + ], 5056 + "description": [ 5057 + "Gets a pointer to a function that can create a Variant of the given type from a raw value." 5058 + ], 5059 + "since": "4.1" 5060 + }, 5061 + { 5062 + "name": "get_variant_to_type_constructor", 5063 + "return_value": { 5064 + "type": "GDExtensionTypeFromVariantConstructorFunc", 5065 + "description": [ 5066 + "A pointer to a function that can get the raw value from a Variant of the given type." 5067 + ] 5068 + }, 5069 + "arguments": [ 5070 + { 5071 + "name": "p_type", 5072 + "type": "GDExtensionVariantType", 5073 + "description": [ 5074 + "The Variant type." 5075 + ] 5076 + } 5077 + ], 5078 + "description": [ 5079 + "Gets a pointer to a function that can get the raw value from a Variant of the given type." 5080 + ], 5081 + "since": "4.1" 5082 + }, 5083 + { 5084 + "name": "variant_get_ptr_internal_getter", 5085 + "return_value": { 5086 + "type": "GDExtensionVariantGetInternalPtrFunc", 5087 + "description": [ 5088 + "A pointer to a type-specific function that returns a pointer to the internal value of a variant. Check the implementation of this function (gdextension_variant_get_ptr_internal_getter) for pointee type info of each variant type." 5089 + ] 5090 + }, 5091 + "arguments": [ 5092 + { 5093 + "name": "p_type", 5094 + "type": "GDExtensionVariantType", 5095 + "description": [ 5096 + "The Variant type." 5097 + ] 5098 + } 5099 + ], 5100 + "description": [ 5101 + "Provides a function pointer for retrieving a pointer to a variant's internal value.", 5102 + "Access to a variant's internal value can be used to modify it in-place, or to retrieve its value without the overhead of variant conversion functions.", 5103 + "It is recommended to cache the getter for all variant types in a function table to avoid retrieval overhead upon use.", 5104 + "", 5105 + "Each function assumes the variant's type has already been determined and matches the function.", 5106 + "Invoking the function with a variant of a mismatched type has undefined behavior, and may lead to a segmentation fault." 5107 + ], 5108 + "since": "4.4", 5109 + "legacy_type_name": "GDExtensionInterfaceGetVariantGetInternalPtrFunc" 5110 + }, 5111 + { 5112 + "name": "variant_get_ptr_operator_evaluator", 5113 + "return_value": { 5114 + "type": "GDExtensionPtrOperatorEvaluator", 5115 + "description": [ 5116 + "A pointer to a function that can evaluate the given Variant operator on the given Variant types." 5117 + ] 5118 + }, 5119 + "arguments": [ 5120 + { 5121 + "name": "p_operator", 5122 + "type": "GDExtensionVariantOperator", 5123 + "description": [ 5124 + "The variant operator." 5125 + ] 5126 + }, 5127 + { 5128 + "name": "p_type_a", 5129 + "type": "GDExtensionVariantType", 5130 + "description": [ 5131 + "The type of the first Variant." 5132 + ] 5133 + }, 5134 + { 5135 + "name": "p_type_b", 5136 + "type": "GDExtensionVariantType", 5137 + "description": [ 5138 + "The type of the second Variant." 5139 + ] 5140 + } 5141 + ], 5142 + "description": [ 5143 + "Gets a pointer to a function that can evaluate the given Variant operator on the given Variant types." 5144 + ], 5145 + "since": "4.1" 5146 + }, 5147 + { 5148 + "name": "variant_get_ptr_builtin_method", 5149 + "return_value": { 5150 + "type": "GDExtensionPtrBuiltInMethod", 5151 + "description": [ 5152 + "A pointer to a function that can call a builtin method on a type of Variant." 5153 + ] 5154 + }, 5155 + "arguments": [ 5156 + { 5157 + "name": "p_type", 5158 + "type": "GDExtensionVariantType", 5159 + "description": [ 5160 + "The Variant type." 5161 + ] 5162 + }, 5163 + { 5164 + "name": "p_method", 5165 + "type": "GDExtensionConstStringNamePtr", 5166 + "description": [ 5167 + "A pointer to a StringName with the method name." 5168 + ] 5169 + }, 5170 + { 5171 + "name": "p_hash", 5172 + "type": "GDExtensionInt", 5173 + "description": [ 5174 + "A hash representing the method signature." 5175 + ] 5176 + } 5177 + ], 5178 + "description": [ 5179 + "Gets a pointer to a function that can call a builtin method on a type of Variant." 5180 + ], 5181 + "since": "4.1" 5182 + }, 5183 + { 5184 + "name": "variant_get_ptr_constructor", 5185 + "return_value": { 5186 + "type": "GDExtensionPtrConstructor", 5187 + "description": [ 5188 + "A pointer to a function that can call one of the constructors for a type of Variant." 5189 + ] 5190 + }, 5191 + "arguments": [ 5192 + { 5193 + "name": "p_type", 5194 + "type": "GDExtensionVariantType", 5195 + "description": [ 5196 + "The Variant type." 5197 + ] 5198 + }, 5199 + { 5200 + "name": "p_constructor", 5201 + "type": "int32_t", 5202 + "description": [ 5203 + "The index of the constructor." 5204 + ] 5205 + } 5206 + ], 5207 + "description": [ 5208 + "Gets a pointer to a function that can call one of the constructors for a type of Variant." 5209 + ], 5210 + "since": "4.1" 5211 + }, 5212 + { 5213 + "name": "variant_get_ptr_destructor", 5214 + "return_value": { 5215 + "type": "GDExtensionPtrDestructor", 5216 + "description": [ 5217 + "A pointer to a function than can call the destructor for a type of Variant." 5218 + ] 5219 + }, 5220 + "arguments": [ 5221 + { 5222 + "name": "p_type", 5223 + "type": "GDExtensionVariantType", 5224 + "description": [ 5225 + "The Variant type." 5226 + ] 5227 + } 5228 + ], 5229 + "description": [ 5230 + "Gets a pointer to a function than can call the destructor for a type of Variant." 5231 + ], 5232 + "since": "4.1" 5233 + }, 5234 + { 5235 + "name": "variant_construct", 5236 + "arguments": [ 5237 + { 5238 + "name": "p_type", 5239 + "type": "GDExtensionVariantType", 5240 + "description": [ 5241 + "The Variant type." 5242 + ] 5243 + }, 5244 + { 5245 + "name": "r_base", 5246 + "type": "GDExtensionUninitializedVariantPtr", 5247 + "description": [ 5248 + "A pointer to a Variant to store the constructed value." 5249 + ] 5250 + }, 5251 + { 5252 + "name": "p_args", 5253 + "type": "const GDExtensionConstVariantPtr*", 5254 + "description": [ 5255 + "A pointer to a C array of Variant pointers representing the arguments for the constructor." 5256 + ] 5257 + }, 5258 + { 5259 + "name": "p_argument_count", 5260 + "type": "int32_t", 5261 + "description": [ 5262 + "The number of arguments to pass to the constructor." 5263 + ] 5264 + }, 5265 + { 5266 + "name": "r_error", 5267 + "type": "GDExtensionCallError*", 5268 + "description": [ 5269 + "A pointer the structure which will be updated with error information." 5270 + ] 5271 + } 5272 + ], 5273 + "description": [ 5274 + "Constructs a Variant of the given type, using the first constructor that matches the given arguments." 5275 + ], 5276 + "since": "4.1" 5277 + }, 5278 + { 5279 + "name": "variant_get_ptr_setter", 5280 + "return_value": { 5281 + "type": "GDExtensionPtrSetter", 5282 + "description": [ 5283 + "A pointer to a function that can call a member's setter on the given Variant type." 5284 + ] 5285 + }, 5286 + "arguments": [ 5287 + { 5288 + "name": "p_type", 5289 + "type": "GDExtensionVariantType", 5290 + "description": [ 5291 + "The Variant type." 5292 + ] 5293 + }, 5294 + { 5295 + "name": "p_member", 5296 + "type": "GDExtensionConstStringNamePtr", 5297 + "description": [ 5298 + "A pointer to a StringName with the member name." 5299 + ] 5300 + } 5301 + ], 5302 + "description": [ 5303 + "Gets a pointer to a function that can call a member's setter on the given Variant type." 5304 + ], 5305 + "since": "4.1" 5306 + }, 5307 + { 5308 + "name": "variant_get_ptr_getter", 5309 + "return_value": { 5310 + "type": "GDExtensionPtrGetter", 5311 + "description": [ 5312 + "A pointer to a function that can call a member's getter on the given Variant type." 5313 + ] 5314 + }, 5315 + "arguments": [ 5316 + { 5317 + "name": "p_type", 5318 + "type": "GDExtensionVariantType", 5319 + "description": [ 5320 + "The Variant type." 5321 + ] 5322 + }, 5323 + { 5324 + "name": "p_member", 5325 + "type": "GDExtensionConstStringNamePtr", 5326 + "description": [ 5327 + "A pointer to a StringName with the member name." 5328 + ] 5329 + } 5330 + ], 5331 + "description": [ 5332 + "Gets a pointer to a function that can call a member's getter on the given Variant type." 5333 + ], 5334 + "since": "4.1" 5335 + }, 5336 + { 5337 + "name": "variant_get_ptr_indexed_setter", 5338 + "return_value": { 5339 + "type": "GDExtensionPtrIndexedSetter", 5340 + "description": [ 5341 + "A pointer to a function that can set an index on the given Variant type." 5342 + ] 5343 + }, 5344 + "arguments": [ 5345 + { 5346 + "name": "p_type", 5347 + "type": "GDExtensionVariantType", 5348 + "description": [ 5349 + "The Variant type." 5350 + ] 5351 + } 5352 + ], 5353 + "description": [ 5354 + "Gets a pointer to a function that can set an index on the given Variant type." 5355 + ], 5356 + "since": "4.1" 5357 + }, 5358 + { 5359 + "name": "variant_get_ptr_indexed_getter", 5360 + "return_value": { 5361 + "type": "GDExtensionPtrIndexedGetter", 5362 + "description": [ 5363 + "A pointer to a function that can get an index on the given Variant type." 5364 + ] 5365 + }, 5366 + "arguments": [ 5367 + { 5368 + "name": "p_type", 5369 + "type": "GDExtensionVariantType", 5370 + "description": [ 5371 + "The Variant type." 5372 + ] 5373 + } 5374 + ], 5375 + "description": [ 5376 + "Gets a pointer to a function that can get an index on the given Variant type." 5377 + ], 5378 + "since": "4.1" 5379 + }, 5380 + { 5381 + "name": "variant_get_ptr_keyed_setter", 5382 + "return_value": { 5383 + "type": "GDExtensionPtrKeyedSetter", 5384 + "description": [ 5385 + "A pointer to a function that can set a key on the given Variant type." 5386 + ] 5387 + }, 5388 + "arguments": [ 5389 + { 5390 + "name": "p_type", 5391 + "type": "GDExtensionVariantType", 5392 + "description": [ 5393 + "The Variant type." 5394 + ] 5395 + } 5396 + ], 5397 + "description": [ 5398 + "Gets a pointer to a function that can set a key on the given Variant type." 5399 + ], 5400 + "since": "4.1" 5401 + }, 5402 + { 5403 + "name": "variant_get_ptr_keyed_getter", 5404 + "return_value": { 5405 + "type": "GDExtensionPtrKeyedGetter", 5406 + "description": [ 5407 + "A pointer to a function that can get a key on the given Variant type." 5408 + ] 5409 + }, 5410 + "arguments": [ 5411 + { 5412 + "name": "p_type", 5413 + "type": "GDExtensionVariantType", 5414 + "description": [ 5415 + "The Variant type." 5416 + ] 5417 + } 5418 + ], 5419 + "description": [ 5420 + "Gets a pointer to a function that can get a key on the given Variant type." 5421 + ], 5422 + "since": "4.1" 5423 + }, 5424 + { 5425 + "name": "variant_get_ptr_keyed_checker", 5426 + "return_value": { 5427 + "type": "GDExtensionPtrKeyedChecker", 5428 + "description": [ 5429 + "A pointer to a function that can check a key on the given Variant type." 5430 + ] 5431 + }, 5432 + "arguments": [ 5433 + { 5434 + "name": "p_type", 5435 + "type": "GDExtensionVariantType", 5436 + "description": [ 5437 + "The Variant type." 5438 + ] 5439 + } 5440 + ], 5441 + "description": [ 5442 + "Gets a pointer to a function that can check a key on the given Variant type." 5443 + ], 5444 + "since": "4.1" 5445 + }, 5446 + { 5447 + "name": "variant_get_constant_value", 5448 + "arguments": [ 5449 + { 5450 + "name": "p_type", 5451 + "type": "GDExtensionVariantType", 5452 + "description": [ 5453 + "The Variant type." 5454 + ] 5455 + }, 5456 + { 5457 + "name": "p_constant", 5458 + "type": "GDExtensionConstStringNamePtr", 5459 + "description": [ 5460 + "A pointer to a StringName with the constant name." 5461 + ] 5462 + }, 5463 + { 5464 + "name": "r_ret", 5465 + "type": "GDExtensionUninitializedVariantPtr", 5466 + "description": [ 5467 + "A pointer to a Variant to store the value." 5468 + ] 5469 + } 5470 + ], 5471 + "description": [ 5472 + "Gets the value of a constant from the given Variant type." 5473 + ], 5474 + "since": "4.1" 5475 + }, 5476 + { 5477 + "name": "variant_get_ptr_utility_function", 5478 + "return_value": { 5479 + "type": "GDExtensionPtrUtilityFunction", 5480 + "description": [ 5481 + "A pointer to a function that can call a Variant utility function." 5482 + ] 5483 + }, 5484 + "arguments": [ 5485 + { 5486 + "name": "p_function", 5487 + "type": "GDExtensionConstStringNamePtr", 5488 + "description": [ 5489 + "A pointer to a StringName with the function name." 5490 + ] 5491 + }, 5492 + { 5493 + "name": "p_hash", 5494 + "type": "GDExtensionInt", 5495 + "description": [ 5496 + "A hash representing the function signature." 5497 + ] 5498 + } 5499 + ], 5500 + "description": [ 5501 + "Gets a pointer to a function that can call a Variant utility function." 5502 + ], 5503 + "since": "4.1" 5504 + }, 5505 + { 5506 + "name": "string_new_with_latin1_chars", 5507 + "arguments": [ 5508 + { 5509 + "name": "r_dest", 5510 + "type": "GDExtensionUninitializedStringPtr", 5511 + "description": [ 5512 + "A pointer to a Variant to hold the newly created String." 5513 + ] 5514 + }, 5515 + { 5516 + "name": "p_contents", 5517 + "type": "const char*", 5518 + "description": [ 5519 + "A pointer to a Latin-1 encoded C string (null terminated)." 5520 + ] 5521 + } 5522 + ], 5523 + "description": [ 5524 + "Creates a String from a Latin-1 encoded C string." 5525 + ], 5526 + "since": "4.1" 5527 + }, 5528 + { 5529 + "name": "string_new_with_utf8_chars", 5530 + "arguments": [ 5531 + { 5532 + "name": "r_dest", 5533 + "type": "GDExtensionUninitializedStringPtr", 5534 + "description": [ 5535 + "A pointer to a Variant to hold the newly created String." 5536 + ] 5537 + }, 5538 + { 5539 + "name": "p_contents", 5540 + "type": "const char*", 5541 + "description": [ 5542 + "A pointer to a UTF-8 encoded C string (null terminated)." 5543 + ] 5544 + } 5545 + ], 5546 + "description": [ 5547 + "Creates a String from a UTF-8 encoded C string." 5548 + ], 5549 + "since": "4.1" 5550 + }, 5551 + { 5552 + "name": "string_new_with_utf16_chars", 5553 + "arguments": [ 5554 + { 5555 + "name": "r_dest", 5556 + "type": "GDExtensionUninitializedStringPtr", 5557 + "description": [ 5558 + "A pointer to a Variant to hold the newly created String." 5559 + ] 5560 + }, 5561 + { 5562 + "name": "p_contents", 5563 + "type": "const char16_t*", 5564 + "description": [ 5565 + "A pointer to a UTF-16 encoded C string (null terminated)." 5566 + ] 5567 + } 5568 + ], 5569 + "description": [ 5570 + "Creates a String from a UTF-16 encoded C string." 5571 + ], 5572 + "since": "4.1" 5573 + }, 5574 + { 5575 + "name": "string_new_with_utf32_chars", 5576 + "arguments": [ 5577 + { 5578 + "name": "r_dest", 5579 + "type": "GDExtensionUninitializedStringPtr", 5580 + "description": [ 5581 + "A pointer to a Variant to hold the newly created String." 5582 + ] 5583 + }, 5584 + { 5585 + "name": "p_contents", 5586 + "type": "const char32_t*", 5587 + "description": [ 5588 + "A pointer to a UTF-32 encoded C string (null terminated)." 5589 + ] 5590 + } 5591 + ], 5592 + "description": [ 5593 + "Creates a String from a UTF-32 encoded C string." 5594 + ], 5595 + "since": "4.1" 5596 + }, 5597 + { 5598 + "name": "string_new_with_wide_chars", 5599 + "arguments": [ 5600 + { 5601 + "name": "r_dest", 5602 + "type": "GDExtensionUninitializedStringPtr", 5603 + "description": [ 5604 + "A pointer to a Variant to hold the newly created String." 5605 + ] 5606 + }, 5607 + { 5608 + "name": "p_contents", 5609 + "type": "const wchar_t*", 5610 + "description": [ 5611 + "A pointer to a wide C string (null terminated)." 5612 + ] 5613 + } 5614 + ], 5615 + "description": [ 5616 + "Creates a String from a wide C string." 5617 + ], 5618 + "since": "4.1" 5619 + }, 5620 + { 5621 + "name": "string_new_with_latin1_chars_and_len", 5622 + "arguments": [ 5623 + { 5624 + "name": "r_dest", 5625 + "type": "GDExtensionUninitializedStringPtr", 5626 + "description": [ 5627 + "A pointer to a Variant to hold the newly created String." 5628 + ] 5629 + }, 5630 + { 5631 + "name": "p_contents", 5632 + "type": "const char*", 5633 + "description": [ 5634 + "A pointer to a Latin-1 encoded C string." 5635 + ] 5636 + }, 5637 + { 5638 + "name": "p_size", 5639 + "type": "GDExtensionInt", 5640 + "description": [ 5641 + "The number of characters (= number of bytes)." 5642 + ] 5643 + } 5644 + ], 5645 + "description": [ 5646 + "Creates a String from a Latin-1 encoded C string with the given length." 5647 + ], 5648 + "since": "4.1" 5649 + }, 5650 + { 5651 + "name": "string_new_with_utf8_chars_and_len", 5652 + "arguments": [ 5653 + { 5654 + "name": "r_dest", 5655 + "type": "GDExtensionUninitializedStringPtr", 5656 + "description": [ 5657 + "A pointer to a Variant to hold the newly created String." 5658 + ] 5659 + }, 5660 + { 5661 + "name": "p_contents", 5662 + "type": "const char*", 5663 + "description": [ 5664 + "A pointer to a UTF-8 encoded C string." 5665 + ] 5666 + }, 5667 + { 5668 + "name": "p_size", 5669 + "type": "GDExtensionInt", 5670 + "description": [ 5671 + "The number of bytes (not code units)." 5672 + ] 5673 + } 5674 + ], 5675 + "description": [ 5676 + "Creates a String from a UTF-8 encoded C string with the given length." 5677 + ], 5678 + "since": "4.1", 5679 + "deprecated": { 5680 + "since": "4.3", 5681 + "replace_with": "string_new_with_utf8_chars_and_len2" 5682 + } 5683 + }, 5684 + { 5685 + "name": "string_new_with_utf8_chars_and_len2", 5686 + "return_value": { 5687 + "type": "GDExtensionInt", 5688 + "description": [ 5689 + "Error code signifying if the operation successful." 5690 + ] 5691 + }, 5692 + "arguments": [ 5693 + { 5694 + "name": "r_dest", 5695 + "type": "GDExtensionUninitializedStringPtr", 5696 + "description": [ 5697 + "A pointer to a Variant to hold the newly created String." 5698 + ] 5699 + }, 5700 + { 5701 + "name": "p_contents", 5702 + "type": "const char*", 5703 + "description": [ 5704 + "A pointer to a UTF-8 encoded C string." 5705 + ] 5706 + }, 5707 + { 5708 + "name": "p_size", 5709 + "type": "GDExtensionInt", 5710 + "description": [ 5711 + "The number of bytes (not code units)." 5712 + ] 5713 + } 5714 + ], 5715 + "description": [ 5716 + "Creates a String from a UTF-8 encoded C string with the given length." 5717 + ], 5718 + "since": "4.3" 5719 + }, 5720 + { 5721 + "name": "string_new_with_utf16_chars_and_len", 5722 + "arguments": [ 5723 + { 5724 + "name": "r_dest", 5725 + "type": "GDExtensionUninitializedStringPtr", 5726 + "description": [ 5727 + "A pointer to a Variant to hold the newly created String." 5728 + ] 5729 + }, 5730 + { 5731 + "name": "p_contents", 5732 + "type": "const char16_t*", 5733 + "description": [ 5734 + "A pointer to a UTF-16 encoded C string." 5735 + ] 5736 + }, 5737 + { 5738 + "name": "p_char_count", 5739 + "type": "GDExtensionInt", 5740 + "description": [ 5741 + "The number of characters (not bytes)." 5742 + ] 5743 + } 5744 + ], 5745 + "description": [ 5746 + "Creates a String from a UTF-16 encoded C string with the given length." 5747 + ], 5748 + "since": "4.1", 5749 + "deprecated": { 5750 + "since": "4.3", 5751 + "replace_with": "string_new_with_utf16_chars_and_len2" 5752 + } 5753 + }, 5754 + { 5755 + "name": "string_new_with_utf16_chars_and_len2", 5756 + "return_value": { 5757 + "type": "GDExtensionInt", 5758 + "description": [ 5759 + "Error code signifying if the operation successful." 5760 + ] 5761 + }, 5762 + "arguments": [ 5763 + { 5764 + "name": "r_dest", 5765 + "type": "GDExtensionUninitializedStringPtr", 5766 + "description": [ 5767 + "A pointer to a Variant to hold the newly created String." 5768 + ] 5769 + }, 5770 + { 5771 + "name": "p_contents", 5772 + "type": "const char16_t*", 5773 + "description": [ 5774 + "A pointer to a UTF-16 encoded C string." 5775 + ] 5776 + }, 5777 + { 5778 + "name": "p_char_count", 5779 + "type": "GDExtensionInt", 5780 + "description": [ 5781 + "The number of characters (not bytes)." 5782 + ] 5783 + }, 5784 + { 5785 + "name": "p_default_little_endian", 5786 + "type": "GDExtensionBool", 5787 + "description": [ 5788 + "If true, UTF-16 use little endian." 5789 + ] 5790 + } 5791 + ], 5792 + "description": [ 5793 + "Creates a String from a UTF-16 encoded C string with the given length." 5794 + ], 5795 + "since": "4.3" 5796 + }, 5797 + { 5798 + "name": "string_new_with_utf32_chars_and_len", 5799 + "arguments": [ 5800 + { 5801 + "name": "r_dest", 5802 + "type": "GDExtensionUninitializedStringPtr", 5803 + "description": [ 5804 + "A pointer to a Variant to hold the newly created String." 5805 + ] 5806 + }, 5807 + { 5808 + "name": "p_contents", 5809 + "type": "const char32_t*", 5810 + "description": [ 5811 + "A pointer to a UTF-32 encoded C string." 5812 + ] 5813 + }, 5814 + { 5815 + "name": "p_char_count", 5816 + "type": "GDExtensionInt", 5817 + "description": [ 5818 + "The number of characters (not bytes)." 5819 + ] 5820 + } 5821 + ], 5822 + "description": [ 5823 + "Creates a String from a UTF-32 encoded C string with the given length." 5824 + ], 5825 + "since": "4.1" 5826 + }, 5827 + { 5828 + "name": "string_new_with_wide_chars_and_len", 5829 + "arguments": [ 5830 + { 5831 + "name": "r_dest", 5832 + "type": "GDExtensionUninitializedStringPtr", 5833 + "description": [ 5834 + "A pointer to a Variant to hold the newly created String." 5835 + ] 5836 + }, 5837 + { 5838 + "name": "p_contents", 5839 + "type": "const wchar_t*", 5840 + "description": [ 5841 + "A pointer to a wide C string." 5842 + ] 5843 + }, 5844 + { 5845 + "name": "p_char_count", 5846 + "type": "GDExtensionInt", 5847 + "description": [ 5848 + "The number of characters (not bytes)." 5849 + ] 5850 + } 5851 + ], 5852 + "description": [ 5853 + "Creates a String from a wide C string with the given length." 5854 + ], 5855 + "since": "4.1" 5856 + }, 5857 + { 5858 + "name": "string_to_latin1_chars", 5859 + "return_value": { 5860 + "type": "GDExtensionInt", 5861 + "description": [ 5862 + "The resulting encoded string length in characters (not bytes), not including a null terminator." 5863 + ] 5864 + }, 5865 + "arguments": [ 5866 + { 5867 + "name": "p_self", 5868 + "type": "GDExtensionConstStringPtr", 5869 + "description": [ 5870 + "A pointer to the String." 5871 + ] 5872 + }, 5873 + { 5874 + "name": "r_text", 5875 + "type": "char*", 5876 + "description": [ 5877 + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." 5878 + ] 5879 + }, 5880 + { 5881 + "name": "p_max_write_length", 5882 + "type": "GDExtensionInt", 5883 + "description": [ 5884 + "The maximum number of characters that can be written to r_text. It has no affect on the return value." 5885 + ] 5886 + } 5887 + ], 5888 + "description": [ 5889 + "Converts a String to a Latin-1 encoded C string.", 5890 + "It doesn't write a null terminator." 5891 + ], 5892 + "since": "4.1" 5893 + }, 5894 + { 5895 + "name": "string_to_utf8_chars", 5896 + "return_value": { 5897 + "type": "GDExtensionInt", 5898 + "description": [ 5899 + "The resulting encoded string length in characters (not bytes), not including a null terminator." 5900 + ] 5901 + }, 5902 + "arguments": [ 5903 + { 5904 + "name": "p_self", 5905 + "type": "GDExtensionConstStringPtr", 5906 + "description": [ 5907 + "A pointer to the String." 5908 + ] 5909 + }, 5910 + { 5911 + "name": "r_text", 5912 + "type": "char*", 5913 + "description": [ 5914 + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." 5915 + ] 5916 + }, 5917 + { 5918 + "name": "p_max_write_length", 5919 + "type": "GDExtensionInt", 5920 + "description": [ 5921 + "The maximum number of characters that can be written to r_text. It has no affect on the return value." 5922 + ] 5923 + } 5924 + ], 5925 + "description": [ 5926 + "Converts a String to a UTF-8 encoded C string.", 5927 + "It doesn't write a null terminator." 5928 + ], 5929 + "since": "4.1" 5930 + }, 5931 + { 5932 + "name": "string_to_utf16_chars", 5933 + "return_value": { 5934 + "type": "GDExtensionInt", 5935 + "description": [ 5936 + "The resulting encoded string length in characters (not bytes), not including a null terminator." 5937 + ] 5938 + }, 5939 + "arguments": [ 5940 + { 5941 + "name": "p_self", 5942 + "type": "GDExtensionConstStringPtr", 5943 + "description": [ 5944 + "A pointer to the String." 5945 + ] 5946 + }, 5947 + { 5948 + "name": "r_text", 5949 + "type": "char16_t*", 5950 + "description": [ 5951 + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." 5952 + ] 5953 + }, 5954 + { 5955 + "name": "p_max_write_length", 5956 + "type": "GDExtensionInt", 5957 + "description": [ 5958 + "The maximum number of characters that can be written to r_text. It has no affect on the return value." 5959 + ] 5960 + } 5961 + ], 5962 + "description": [ 5963 + "Converts a String to a UTF-16 encoded C string.", 5964 + "It doesn't write a null terminator." 5965 + ], 5966 + "since": "4.1" 5967 + }, 5968 + { 5969 + "name": "string_to_utf32_chars", 5970 + "return_value": { 5971 + "type": "GDExtensionInt", 5972 + "description": [ 5973 + "The resulting encoded string length in characters (not bytes), not including a null terminator." 5974 + ] 5975 + }, 5976 + "arguments": [ 5977 + { 5978 + "name": "p_self", 5979 + "type": "GDExtensionConstStringPtr", 5980 + "description": [ 5981 + "A pointer to the String." 5982 + ] 5983 + }, 5984 + { 5985 + "name": "r_text", 5986 + "type": "char32_t*", 5987 + "description": [ 5988 + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." 5989 + ] 5990 + }, 5991 + { 5992 + "name": "p_max_write_length", 5993 + "type": "GDExtensionInt", 5994 + "description": [ 5995 + "The maximum number of characters that can be written to r_text. It has no affect on the return value." 5996 + ] 5997 + } 5998 + ], 5999 + "description": [ 6000 + "Converts a String to a UTF-32 encoded C string.", 6001 + "It doesn't write a null terminator." 6002 + ], 6003 + "since": "4.1" 6004 + }, 6005 + { 6006 + "name": "string_to_wide_chars", 6007 + "return_value": { 6008 + "type": "GDExtensionInt", 6009 + "description": [ 6010 + "The resulting encoded string length in characters (not bytes), not including a null terminator." 6011 + ] 6012 + }, 6013 + "arguments": [ 6014 + { 6015 + "name": "p_self", 6016 + "type": "GDExtensionConstStringPtr", 6017 + "description": [ 6018 + "A pointer to the String." 6019 + ] 6020 + }, 6021 + { 6022 + "name": "r_text", 6023 + "type": "wchar_t*", 6024 + "description": [ 6025 + "A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed." 6026 + ] 6027 + }, 6028 + { 6029 + "name": "p_max_write_length", 6030 + "type": "GDExtensionInt", 6031 + "description": [ 6032 + "The maximum number of characters that can be written to r_text. It has no affect on the return value." 6033 + ] 6034 + } 6035 + ], 6036 + "description": [ 6037 + "Converts a String to a wide C string.", 6038 + "It doesn't write a null terminator." 6039 + ], 6040 + "since": "4.1" 6041 + }, 6042 + { 6043 + "name": "string_operator_index", 6044 + "return_value": { 6045 + "type": "char32_t*", 6046 + "description": [ 6047 + "A pointer to the requested character." 6048 + ] 6049 + }, 6050 + "arguments": [ 6051 + { 6052 + "name": "p_self", 6053 + "type": "GDExtensionStringPtr", 6054 + "description": [ 6055 + "A pointer to the String." 6056 + ] 6057 + }, 6058 + { 6059 + "name": "p_index", 6060 + "type": "GDExtensionInt", 6061 + "description": [ 6062 + "The index." 6063 + ] 6064 + } 6065 + ], 6066 + "description": [ 6067 + "Gets a pointer to the character at the given index from a String." 6068 + ], 6069 + "since": "4.1" 6070 + }, 6071 + { 6072 + "name": "string_operator_index_const", 6073 + "return_value": { 6074 + "type": "const char32_t*", 6075 + "description": [ 6076 + "A const pointer to the requested character." 6077 + ] 6078 + }, 6079 + "arguments": [ 6080 + { 6081 + "name": "p_self", 6082 + "type": "GDExtensionConstStringPtr", 6083 + "description": [ 6084 + "A pointer to the String." 6085 + ] 6086 + }, 6087 + { 6088 + "name": "p_index", 6089 + "type": "GDExtensionInt", 6090 + "description": [ 6091 + "The index." 6092 + ] 6093 + } 6094 + ], 6095 + "description": [ 6096 + "Gets a const pointer to the character at the given index from a String." 6097 + ], 6098 + "since": "4.1" 6099 + }, 6100 + { 6101 + "name": "string_operator_plus_eq_string", 6102 + "arguments": [ 6103 + { 6104 + "name": "p_self", 6105 + "type": "GDExtensionStringPtr", 6106 + "description": [ 6107 + "A pointer to the String." 6108 + ] 6109 + }, 6110 + { 6111 + "name": "p_b", 6112 + "type": "GDExtensionConstStringPtr", 6113 + "description": [ 6114 + "A pointer to the other String to append." 6115 + ] 6116 + } 6117 + ], 6118 + "description": [ 6119 + "Appends another String to a String." 6120 + ], 6121 + "since": "4.1" 6122 + }, 6123 + { 6124 + "name": "string_operator_plus_eq_char", 6125 + "arguments": [ 6126 + { 6127 + "name": "p_self", 6128 + "type": "GDExtensionStringPtr", 6129 + "description": [ 6130 + "A pointer to the String." 6131 + ] 6132 + }, 6133 + { 6134 + "name": "p_b", 6135 + "type": "char32_t", 6136 + "description": [ 6137 + "A pointer to the character to append." 6138 + ] 6139 + } 6140 + ], 6141 + "description": [ 6142 + "Appends a character to a String." 6143 + ], 6144 + "since": "4.1" 6145 + }, 6146 + { 6147 + "name": "string_operator_plus_eq_cstr", 6148 + "arguments": [ 6149 + { 6150 + "name": "p_self", 6151 + "type": "GDExtensionStringPtr", 6152 + "description": [ 6153 + "A pointer to the String." 6154 + ] 6155 + }, 6156 + { 6157 + "name": "p_b", 6158 + "type": "const char*", 6159 + "description": [ 6160 + "A pointer to a Latin-1 encoded C string (null terminated)." 6161 + ] 6162 + } 6163 + ], 6164 + "description": [ 6165 + "Appends a Latin-1 encoded C string to a String." 6166 + ], 6167 + "since": "4.1" 6168 + }, 6169 + { 6170 + "name": "string_operator_plus_eq_wcstr", 6171 + "arguments": [ 6172 + { 6173 + "name": "p_self", 6174 + "type": "GDExtensionStringPtr", 6175 + "description": [ 6176 + "A pointer to the String." 6177 + ] 6178 + }, 6179 + { 6180 + "name": "p_b", 6181 + "type": "const wchar_t*", 6182 + "description": [ 6183 + "A pointer to a wide C string (null terminated)." 6184 + ] 6185 + } 6186 + ], 6187 + "description": [ 6188 + "Appends a wide C string to a String." 6189 + ], 6190 + "since": "4.1" 6191 + }, 6192 + { 6193 + "name": "string_operator_plus_eq_c32str", 6194 + "arguments": [ 6195 + { 6196 + "name": "p_self", 6197 + "type": "GDExtensionStringPtr", 6198 + "description": [ 6199 + "A pointer to the String." 6200 + ] 6201 + }, 6202 + { 6203 + "name": "p_b", 6204 + "type": "const char32_t*", 6205 + "description": [ 6206 + "A pointer to a UTF-32 encoded C string (null terminated)." 6207 + ] 6208 + } 6209 + ], 6210 + "description": [ 6211 + "Appends a UTF-32 encoded C string to a String." 6212 + ], 6213 + "since": "4.1" 6214 + }, 6215 + { 6216 + "name": "string_resize", 6217 + "return_value": { 6218 + "type": "GDExtensionInt", 6219 + "description": [ 6220 + "Error code signifying if the operation successful." 6221 + ] 6222 + }, 6223 + "arguments": [ 6224 + { 6225 + "name": "p_self", 6226 + "type": "GDExtensionStringPtr", 6227 + "description": [ 6228 + "A pointer to the String." 6229 + ] 6230 + }, 6231 + { 6232 + "name": "p_resize", 6233 + "type": "GDExtensionInt", 6234 + "description": [ 6235 + "The new length for the String." 6236 + ] 6237 + } 6238 + ], 6239 + "description": [ 6240 + "Resizes the underlying string data to the given number of characters.", 6241 + "Space needs to be allocated for the null terminating character ('\\0') which", 6242 + "also must be added manually, in order for all string functions to work correctly.", 6243 + "", 6244 + "Warning: This is an error-prone operation - only use it if there's no other", 6245 + "efficient way to accomplish your goal." 6246 + ], 6247 + "since": "4.2" 6248 + }, 6249 + { 6250 + "name": "string_name_new_with_latin1_chars", 6251 + "arguments": [ 6252 + { 6253 + "name": "r_dest", 6254 + "type": "GDExtensionUninitializedStringNamePtr", 6255 + "description": [ 6256 + "A pointer to uninitialized storage, into which the newly created StringName is constructed." 6257 + ] 6258 + }, 6259 + { 6260 + "name": "p_contents", 6261 + "type": "const char*", 6262 + "description": [ 6263 + "A pointer to a C string (null terminated and Latin-1 or ASCII encoded)." 6264 + ] 6265 + }, 6266 + { 6267 + "name": "p_is_static", 6268 + "type": "GDExtensionBool", 6269 + "description": [ 6270 + "Whether the StringName reuses the buffer directly (see above)." 6271 + ] 6272 + } 6273 + ], 6274 + "description": [ 6275 + "Creates a StringName from a Latin-1 encoded C string.", 6276 + "If `p_is_static` is true, then:", 6277 + "- The StringName will reuse the `p_contents` buffer instead of copying it.", 6278 + "- You must guarantee that the buffer remains valid for the duration of the application (e.g. string literal).", 6279 + "- You must not call a destructor for this StringName. Incrementing the initial reference once should achieve this.", 6280 + "", 6281 + "`p_is_static` is purely an optimization and can easily introduce undefined behavior if used wrong. In case of doubt, set it to false." 6282 + ], 6283 + "since": "4.2" 6284 + }, 6285 + { 6286 + "name": "string_name_new_with_utf8_chars", 6287 + "arguments": [ 6288 + { 6289 + "name": "r_dest", 6290 + "type": "GDExtensionUninitializedStringNamePtr", 6291 + "description": [ 6292 + "A pointer to uninitialized storage, into which the newly created StringName is constructed." 6293 + ] 6294 + }, 6295 + { 6296 + "name": "p_contents", 6297 + "type": "const char*", 6298 + "description": [ 6299 + "A pointer to a C string (null terminated and UTF-8 encoded)." 6300 + ] 6301 + } 6302 + ], 6303 + "description": [ 6304 + "Creates a StringName from a UTF-8 encoded C string." 6305 + ], 6306 + "since": "4.2" 6307 + }, 6308 + { 6309 + "name": "string_name_new_with_utf8_chars_and_len", 6310 + "arguments": [ 6311 + { 6312 + "name": "r_dest", 6313 + "type": "GDExtensionUninitializedStringNamePtr", 6314 + "description": [ 6315 + "A pointer to uninitialized storage, into which the newly created StringName is constructed." 6316 + ] 6317 + }, 6318 + { 6319 + "name": "p_contents", 6320 + "type": "const char*", 6321 + "description": [ 6322 + "A pointer to a C string (null terminated and UTF-8 encoded)." 6323 + ] 6324 + }, 6325 + { 6326 + "name": "p_size", 6327 + "type": "GDExtensionInt", 6328 + "description": [ 6329 + "The number of bytes (not UTF-8 code points)." 6330 + ] 6331 + } 6332 + ], 6333 + "description": [ 6334 + "Creates a StringName from a UTF-8 encoded string with a given number of characters." 6335 + ], 6336 + "since": "4.2" 6337 + }, 6338 + { 6339 + "name": "xml_parser_open_buffer", 6340 + "return_value": { 6341 + "type": "GDExtensionInt", 6342 + "description": [ 6343 + "A Godot error code (ex. OK, ERR_INVALID_DATA, etc)." 6344 + ] 6345 + }, 6346 + "arguments": [ 6347 + { 6348 + "name": "p_instance", 6349 + "type": "GDExtensionObjectPtr", 6350 + "description": [ 6351 + "A pointer to an XMLParser object." 6352 + ] 6353 + }, 6354 + { 6355 + "name": "p_buffer", 6356 + "type": "const uint8_t*", 6357 + "description": [ 6358 + "A pointer to the buffer." 6359 + ] 6360 + }, 6361 + { 6362 + "name": "p_size", 6363 + "type": "size_t", 6364 + "description": [ 6365 + "The size of the buffer." 6366 + ] 6367 + } 6368 + ], 6369 + "description": [ 6370 + "Opens a raw XML buffer on an XMLParser instance." 6371 + ], 6372 + "since": "4.1", 6373 + "see": [ 6374 + "XMLParser::open_buffer()" 6375 + ] 6376 + }, 6377 + { 6378 + "name": "file_access_store_buffer", 6379 + "arguments": [ 6380 + { 6381 + "name": "p_instance", 6382 + "type": "GDExtensionObjectPtr", 6383 + "description": [ 6384 + "A pointer to a FileAccess object." 6385 + ] 6386 + }, 6387 + { 6388 + "name": "p_src", 6389 + "type": "const uint8_t*", 6390 + "description": [ 6391 + "A pointer to the buffer." 6392 + ] 6393 + }, 6394 + { 6395 + "name": "p_length", 6396 + "type": "uint64_t", 6397 + "description": [ 6398 + "The size of the buffer." 6399 + ] 6400 + } 6401 + ], 6402 + "description": [ 6403 + "Stores the given buffer using an instance of FileAccess." 6404 + ], 6405 + "since": "4.1", 6406 + "see": [ 6407 + "FileAccess::store_buffer()" 6408 + ] 6409 + }, 6410 + { 6411 + "name": "file_access_get_buffer", 6412 + "return_value": { 6413 + "type": "uint64_t", 6414 + "description": [ 6415 + "The actual number of bytes read (may be less than requested)." 6416 + ] 6417 + }, 6418 + "arguments": [ 6419 + { 6420 + "name": "p_instance", 6421 + "type": "GDExtensionConstObjectPtr", 6422 + "description": [ 6423 + "A pointer to a FileAccess object." 6424 + ] 6425 + }, 6426 + { 6427 + "name": "p_dst", 6428 + "type": "uint8_t*", 6429 + "description": [ 6430 + "A pointer to the buffer to store the data." 6431 + ] 6432 + }, 6433 + { 6434 + "name": "p_length", 6435 + "type": "uint64_t", 6436 + "description": [ 6437 + "The requested number of bytes to read." 6438 + ] 6439 + } 6440 + ], 6441 + "description": [ 6442 + "Reads the next p_length bytes into the given buffer using an instance of FileAccess." 6443 + ], 6444 + "since": "4.1" 6445 + }, 6446 + { 6447 + "name": "image_ptrw", 6448 + "return_value": { 6449 + "type": "uint8_t*", 6450 + "description": [ 6451 + "Pointer to internal Image buffer." 6452 + ] 6453 + }, 6454 + "arguments": [ 6455 + { 6456 + "name": "p_instance", 6457 + "type": "GDExtensionObjectPtr", 6458 + "description": [ 6459 + "A pointer to a Image object." 6460 + ] 6461 + } 6462 + ], 6463 + "description": [ 6464 + "Returns writable pointer to internal Image buffer." 6465 + ], 6466 + "since": "4.3", 6467 + "see": [ 6468 + "Image::ptrw()" 6469 + ] 6470 + }, 6471 + { 6472 + "name": "image_ptr", 6473 + "return_value": { 6474 + "type": "const uint8_t*", 6475 + "description": [ 6476 + "Pointer to internal Image buffer." 6477 + ] 6478 + }, 6479 + "arguments": [ 6480 + { 6481 + "name": "p_instance", 6482 + "type": "GDExtensionObjectPtr", 6483 + "description": [ 6484 + "A pointer to a Image object." 6485 + ] 6486 + } 6487 + ], 6488 + "description": [ 6489 + "Returns read only pointer to internal Image buffer." 6490 + ], 6491 + "since": "4.3", 6492 + "see": [ 6493 + "Image::ptr()" 6494 + ] 6495 + }, 6496 + { 6497 + "name": "worker_thread_pool_add_native_group_task", 6498 + "return_value": { 6499 + "type": "int64_t", 6500 + "description": [ 6501 + "The task group ID." 6502 + ] 6503 + }, 6504 + "arguments": [ 6505 + { 6506 + "name": "p_instance", 6507 + "type": "GDExtensionObjectPtr", 6508 + "description": [ 6509 + "A pointer to a WorkerThreadPool object." 6510 + ] 6511 + }, 6512 + { 6513 + "name": "p_func", 6514 + "type": "GDExtensionWorkerThreadPoolGroupTask", 6515 + "description": [ 6516 + "A pointer to a function to run in the thread pool." 6517 + ] 6518 + }, 6519 + { 6520 + "name": "p_userdata", 6521 + "type": "void*", 6522 + "description": [ 6523 + "A pointer to arbitrary data which will be passed to p_func." 6524 + ] 6525 + }, 6526 + { 6527 + "name": "p_elements", 6528 + "type": "int32_t", 6529 + "description": [ 6530 + "The number of element needed in the group." 6531 + ] 6532 + }, 6533 + { 6534 + "name": "p_tasks", 6535 + "type": "int32_t", 6536 + "description": [ 6537 + "The number of tasks needed in the group." 6538 + ] 6539 + }, 6540 + { 6541 + "name": "p_high_priority", 6542 + "type": "GDExtensionBool", 6543 + "description": [ 6544 + "Whether or not this is a high priority task." 6545 + ] 6546 + }, 6547 + { 6548 + "name": "p_description", 6549 + "type": "GDExtensionConstStringPtr", 6550 + "description": [ 6551 + "A pointer to a String with the task description." 6552 + ] 6553 + } 6554 + ], 6555 + "description": [ 6556 + "Adds a group task to an instance of WorkerThreadPool." 6557 + ], 6558 + "since": "4.1", 6559 + "see": [ 6560 + "WorkerThreadPool::add_group_task()" 6561 + ] 6562 + }, 6563 + { 6564 + "name": "worker_thread_pool_add_native_task", 6565 + "return_value": { 6566 + "type": "int64_t", 6567 + "description": [ 6568 + "The task ID." 6569 + ] 6570 + }, 6571 + "arguments": [ 6572 + { 6573 + "name": "p_instance", 6574 + "type": "GDExtensionObjectPtr", 6575 + "description": [ 6576 + "A pointer to a WorkerThreadPool object." 6577 + ] 6578 + }, 6579 + { 6580 + "name": "p_func", 6581 + "type": "GDExtensionWorkerThreadPoolTask", 6582 + "description": [ 6583 + "A pointer to a function to run in the thread pool." 6584 + ] 6585 + }, 6586 + { 6587 + "name": "p_userdata", 6588 + "type": "void*", 6589 + "description": [ 6590 + "A pointer to arbitrary data which will be passed to p_func." 6591 + ] 6592 + }, 6593 + { 6594 + "name": "p_high_priority", 6595 + "type": "GDExtensionBool", 6596 + "description": [ 6597 + "Whether or not this is a high priority task." 6598 + ] 6599 + }, 6600 + { 6601 + "name": "p_description", 6602 + "type": "GDExtensionConstStringPtr", 6603 + "description": [ 6604 + "A pointer to a String with the task description." 6605 + ] 6606 + } 6607 + ], 6608 + "description": [ 6609 + "Adds a task to an instance of WorkerThreadPool." 6610 + ], 6611 + "since": "4.1" 6612 + }, 6613 + { 6614 + "name": "packed_byte_array_operator_index", 6615 + "return_value": { 6616 + "type": "uint8_t*", 6617 + "description": [ 6618 + "A pointer to the requested byte." 6619 + ] 6620 + }, 6621 + "arguments": [ 6622 + { 6623 + "name": "p_self", 6624 + "type": "GDExtensionTypePtr", 6625 + "description": [ 6626 + "A pointer to a PackedByteArray object." 6627 + ] 6628 + }, 6629 + { 6630 + "name": "p_index", 6631 + "type": "GDExtensionInt", 6632 + "description": [ 6633 + "The index of the byte to get." 6634 + ] 6635 + } 6636 + ], 6637 + "description": [ 6638 + "Gets a pointer to a byte in a PackedByteArray." 6639 + ], 6640 + "since": "4.1" 6641 + }, 6642 + { 6643 + "name": "packed_byte_array_operator_index_const", 6644 + "return_value": { 6645 + "type": "const uint8_t*", 6646 + "description": [ 6647 + "A const pointer to the requested byte." 6648 + ] 6649 + }, 6650 + "arguments": [ 6651 + { 6652 + "name": "p_self", 6653 + "type": "GDExtensionConstTypePtr", 6654 + "description": [ 6655 + "A const pointer to a PackedByteArray object." 6656 + ] 6657 + }, 6658 + { 6659 + "name": "p_index", 6660 + "type": "GDExtensionInt", 6661 + "description": [ 6662 + "The index of the byte to get." 6663 + ] 6664 + } 6665 + ], 6666 + "description": [ 6667 + "Gets a const pointer to a byte in a PackedByteArray." 6668 + ], 6669 + "since": "4.1" 6670 + }, 6671 + { 6672 + "name": "packed_float32_array_operator_index", 6673 + "return_value": { 6674 + "type": "float*", 6675 + "description": [ 6676 + "A pointer to the requested 32-bit float." 6677 + ] 6678 + }, 6679 + "arguments": [ 6680 + { 6681 + "name": "p_self", 6682 + "type": "GDExtensionTypePtr", 6683 + "description": [ 6684 + "A pointer to a PackedFloat32Array object." 6685 + ] 6686 + }, 6687 + { 6688 + "name": "p_index", 6689 + "type": "GDExtensionInt", 6690 + "description": [ 6691 + "The index of the float to get." 6692 + ] 6693 + } 6694 + ], 6695 + "description": [ 6696 + "Gets a pointer to a 32-bit float in a PackedFloat32Array." 6697 + ], 6698 + "since": "4.1" 6699 + }, 6700 + { 6701 + "name": "packed_float32_array_operator_index_const", 6702 + "return_value": { 6703 + "type": "const float*", 6704 + "description": [ 6705 + "A const pointer to the requested 32-bit float." 6706 + ] 6707 + }, 6708 + "arguments": [ 6709 + { 6710 + "name": "p_self", 6711 + "type": "GDExtensionConstTypePtr", 6712 + "description": [ 6713 + "A const pointer to a PackedFloat32Array object." 6714 + ] 6715 + }, 6716 + { 6717 + "name": "p_index", 6718 + "type": "GDExtensionInt", 6719 + "description": [ 6720 + "The index of the float to get." 6721 + ] 6722 + } 6723 + ], 6724 + "description": [ 6725 + "Gets a const pointer to a 32-bit float in a PackedFloat32Array." 6726 + ], 6727 + "since": "4.1" 6728 + }, 6729 + { 6730 + "name": "packed_float64_array_operator_index", 6731 + "return_value": { 6732 + "type": "double*", 6733 + "description": [ 6734 + "A pointer to the requested 64-bit float." 6735 + ] 6736 + }, 6737 + "arguments": [ 6738 + { 6739 + "name": "p_self", 6740 + "type": "GDExtensionTypePtr", 6741 + "description": [ 6742 + "A pointer to a PackedFloat64Array object." 6743 + ] 6744 + }, 6745 + { 6746 + "name": "p_index", 6747 + "type": "GDExtensionInt", 6748 + "description": [ 6749 + "The index of the float to get." 6750 + ] 6751 + } 6752 + ], 6753 + "description": [ 6754 + "Gets a pointer to a 64-bit float in a PackedFloat64Array." 6755 + ], 6756 + "since": "4.1" 6757 + }, 6758 + { 6759 + "name": "packed_float64_array_operator_index_const", 6760 + "return_value": { 6761 + "type": "const double*", 6762 + "description": [ 6763 + "A const pointer to the requested 64-bit float." 6764 + ] 6765 + }, 6766 + "arguments": [ 6767 + { 6768 + "name": "p_self", 6769 + "type": "GDExtensionConstTypePtr", 6770 + "description": [ 6771 + "A const pointer to a PackedFloat64Array object." 6772 + ] 6773 + }, 6774 + { 6775 + "name": "p_index", 6776 + "type": "GDExtensionInt", 6777 + "description": [ 6778 + "The index of the float to get." 6779 + ] 6780 + } 6781 + ], 6782 + "description": [ 6783 + "Gets a const pointer to a 64-bit float in a PackedFloat64Array." 6784 + ], 6785 + "since": "4.1" 6786 + }, 6787 + { 6788 + "name": "packed_int32_array_operator_index", 6789 + "return_value": { 6790 + "type": "int32_t*", 6791 + "description": [ 6792 + "A pointer to the requested 32-bit integer." 6793 + ] 6794 + }, 6795 + "arguments": [ 6796 + { 6797 + "name": "p_self", 6798 + "type": "GDExtensionTypePtr", 6799 + "description": [ 6800 + "A pointer to a PackedInt32Array object." 6801 + ] 6802 + }, 6803 + { 6804 + "name": "p_index", 6805 + "type": "GDExtensionInt", 6806 + "description": [ 6807 + "The index of the integer to get." 6808 + ] 6809 + } 6810 + ], 6811 + "description": [ 6812 + "Gets a pointer to a 32-bit integer in a PackedInt32Array." 6813 + ], 6814 + "since": "4.1" 6815 + }, 6816 + { 6817 + "name": "packed_int32_array_operator_index_const", 6818 + "return_value": { 6819 + "type": "const int32_t*", 6820 + "description": [ 6821 + "A const pointer to the requested 32-bit integer." 6822 + ] 6823 + }, 6824 + "arguments": [ 6825 + { 6826 + "name": "p_self", 6827 + "type": "GDExtensionConstTypePtr", 6828 + "description": [ 6829 + "A const pointer to a PackedInt32Array object." 6830 + ] 6831 + }, 6832 + { 6833 + "name": "p_index", 6834 + "type": "GDExtensionInt", 6835 + "description": [ 6836 + "The index of the integer to get." 6837 + ] 6838 + } 6839 + ], 6840 + "description": [ 6841 + "Gets a const pointer to a 32-bit integer in a PackedInt32Array." 6842 + ], 6843 + "since": "4.1" 6844 + }, 6845 + { 6846 + "name": "packed_int64_array_operator_index", 6847 + "return_value": { 6848 + "type": "int64_t*", 6849 + "description": [ 6850 + "A pointer to the requested 64-bit integer." 6851 + ] 6852 + }, 6853 + "arguments": [ 6854 + { 6855 + "name": "p_self", 6856 + "type": "GDExtensionTypePtr", 6857 + "description": [ 6858 + "A pointer to a PackedInt64Array object." 6859 + ] 6860 + }, 6861 + { 6862 + "name": "p_index", 6863 + "type": "GDExtensionInt", 6864 + "description": [ 6865 + "The index of the integer to get." 6866 + ] 6867 + } 6868 + ], 6869 + "description": [ 6870 + "Gets a pointer to a 64-bit integer in a PackedInt64Array." 6871 + ], 6872 + "since": "4.1" 6873 + }, 6874 + { 6875 + "name": "packed_int64_array_operator_index_const", 6876 + "return_value": { 6877 + "type": "const int64_t*", 6878 + "description": [ 6879 + "A const pointer to the requested 64-bit integer." 6880 + ] 6881 + }, 6882 + "arguments": [ 6883 + { 6884 + "name": "p_self", 6885 + "type": "GDExtensionConstTypePtr", 6886 + "description": [ 6887 + "A const pointer to a PackedInt64Array object." 6888 + ] 6889 + }, 6890 + { 6891 + "name": "p_index", 6892 + "type": "GDExtensionInt", 6893 + "description": [ 6894 + "The index of the integer to get." 6895 + ] 6896 + } 6897 + ], 6898 + "description": [ 6899 + "Gets a const pointer to a 64-bit integer in a PackedInt64Array." 6900 + ], 6901 + "since": "4.1" 6902 + }, 6903 + { 6904 + "name": "packed_string_array_operator_index", 6905 + "return_value": { 6906 + "type": "GDExtensionStringPtr", 6907 + "description": [ 6908 + "A pointer to the requested String." 6909 + ] 6910 + }, 6911 + "arguments": [ 6912 + { 6913 + "name": "p_self", 6914 + "type": "GDExtensionTypePtr", 6915 + "description": [ 6916 + "A pointer to a PackedStringArray object." 6917 + ] 6918 + }, 6919 + { 6920 + "name": "p_index", 6921 + "type": "GDExtensionInt", 6922 + "description": [ 6923 + "The index of the String to get." 6924 + ] 6925 + } 6926 + ], 6927 + "description": [ 6928 + "Gets a pointer to a string in a PackedStringArray." 6929 + ], 6930 + "since": "4.1" 6931 + }, 6932 + { 6933 + "name": "packed_string_array_operator_index_const", 6934 + "return_value": { 6935 + "type": "GDExtensionStringPtr", 6936 + "description": [ 6937 + "A const pointer to the requested String." 6938 + ] 6939 + }, 6940 + "arguments": [ 6941 + { 6942 + "name": "p_self", 6943 + "type": "GDExtensionConstTypePtr", 6944 + "description": [ 6945 + "A const pointer to a PackedStringArray object." 6946 + ] 6947 + }, 6948 + { 6949 + "name": "p_index", 6950 + "type": "GDExtensionInt", 6951 + "description": [ 6952 + "The index of the String to get." 6953 + ] 6954 + } 6955 + ], 6956 + "description": [ 6957 + "Gets a const pointer to a string in a PackedStringArray." 6958 + ], 6959 + "since": "4.1" 6960 + }, 6961 + { 6962 + "name": "packed_vector2_array_operator_index", 6963 + "return_value": { 6964 + "type": "GDExtensionTypePtr", 6965 + "description": [ 6966 + "A pointer to the requested Vector2." 6967 + ] 6968 + }, 6969 + "arguments": [ 6970 + { 6971 + "name": "p_self", 6972 + "type": "GDExtensionTypePtr", 6973 + "description": [ 6974 + "A pointer to a PackedVector2Array object." 6975 + ] 6976 + }, 6977 + { 6978 + "name": "p_index", 6979 + "type": "GDExtensionInt", 6980 + "description": [ 6981 + "The index of the Vector2 to get." 6982 + ] 6983 + } 6984 + ], 6985 + "description": [ 6986 + "Gets a pointer to a Vector2 in a PackedVector2Array." 6987 + ], 6988 + "since": "4.1" 6989 + }, 6990 + { 6991 + "name": "packed_vector2_array_operator_index_const", 6992 + "return_value": { 6993 + "type": "GDExtensionTypePtr", 6994 + "description": [ 6995 + "A const pointer to the requested Vector2." 6996 + ] 6997 + }, 6998 + "arguments": [ 6999 + { 7000 + "name": "p_self", 7001 + "type": "GDExtensionConstTypePtr", 7002 + "description": [ 7003 + "A const pointer to a PackedVector2Array object." 7004 + ] 7005 + }, 7006 + { 7007 + "name": "p_index", 7008 + "type": "GDExtensionInt", 7009 + "description": [ 7010 + "The index of the Vector2 to get." 7011 + ] 7012 + } 7013 + ], 7014 + "description": [ 7015 + "Gets a const pointer to a Vector2 in a PackedVector2Array." 7016 + ], 7017 + "since": "4.1" 7018 + }, 7019 + { 7020 + "name": "packed_vector3_array_operator_index", 7021 + "return_value": { 7022 + "type": "GDExtensionTypePtr", 7023 + "description": [ 7024 + "A pointer to the requested Vector3." 7025 + ] 7026 + }, 7027 + "arguments": [ 7028 + { 7029 + "name": "p_self", 7030 + "type": "GDExtensionTypePtr", 7031 + "description": [ 7032 + "A pointer to a PackedVector3Array object." 7033 + ] 7034 + }, 7035 + { 7036 + "name": "p_index", 7037 + "type": "GDExtensionInt", 7038 + "description": [ 7039 + "The index of the Vector3 to get." 7040 + ] 7041 + } 7042 + ], 7043 + "description": [ 7044 + "Gets a pointer to a Vector3 in a PackedVector3Array." 7045 + ], 7046 + "since": "4.1" 7047 + }, 7048 + { 7049 + "name": "packed_vector3_array_operator_index_const", 7050 + "return_value": { 7051 + "type": "GDExtensionTypePtr", 7052 + "description": [ 7053 + "A const pointer to the requested Vector3." 7054 + ] 7055 + }, 7056 + "arguments": [ 7057 + { 7058 + "name": "p_self", 7059 + "type": "GDExtensionConstTypePtr", 7060 + "description": [ 7061 + "A const pointer to a PackedVector3Array object." 7062 + ] 7063 + }, 7064 + { 7065 + "name": "p_index", 7066 + "type": "GDExtensionInt", 7067 + "description": [ 7068 + "The index of the Vector3 to get." 7069 + ] 7070 + } 7071 + ], 7072 + "description": [ 7073 + "Gets a const pointer to a Vector3 in a PackedVector3Array." 7074 + ], 7075 + "since": "4.1" 7076 + }, 7077 + { 7078 + "name": "packed_vector4_array_operator_index", 7079 + "return_value": { 7080 + "type": "GDExtensionTypePtr", 7081 + "description": [ 7082 + "A pointer to the requested Vector4." 7083 + ] 7084 + }, 7085 + "arguments": [ 7086 + { 7087 + "name": "p_self", 7088 + "type": "GDExtensionTypePtr", 7089 + "description": [ 7090 + "A pointer to a PackedVector4Array object." 7091 + ] 7092 + }, 7093 + { 7094 + "name": "p_index", 7095 + "type": "GDExtensionInt", 7096 + "description": [ 7097 + "The index of the Vector4 to get." 7098 + ] 7099 + } 7100 + ], 7101 + "description": [ 7102 + "Gets a pointer to a Vector4 in a PackedVector4Array." 7103 + ], 7104 + "since": "4.3" 7105 + }, 7106 + { 7107 + "name": "packed_vector4_array_operator_index_const", 7108 + "return_value": { 7109 + "type": "GDExtensionTypePtr", 7110 + "description": [ 7111 + "A const pointer to the requested Vector4." 7112 + ] 7113 + }, 7114 + "arguments": [ 7115 + { 7116 + "name": "p_self", 7117 + "type": "GDExtensionConstTypePtr", 7118 + "description": [ 7119 + "A const pointer to a PackedVector4Array object." 7120 + ] 7121 + }, 7122 + { 7123 + "name": "p_index", 7124 + "type": "GDExtensionInt", 7125 + "description": [ 7126 + "The index of the Vector4 to get." 7127 + ] 7128 + } 7129 + ], 7130 + "description": [ 7131 + "Gets a const pointer to a Vector4 in a PackedVector4Array." 7132 + ], 7133 + "since": "4.3" 7134 + }, 7135 + { 7136 + "name": "packed_color_array_operator_index", 7137 + "return_value": { 7138 + "type": "GDExtensionTypePtr", 7139 + "description": [ 7140 + "A pointer to the requested Color." 7141 + ] 7142 + }, 7143 + "arguments": [ 7144 + { 7145 + "name": "p_self", 7146 + "type": "GDExtensionTypePtr", 7147 + "description": [ 7148 + "A pointer to a PackedColorArray object." 7149 + ] 7150 + }, 7151 + { 7152 + "name": "p_index", 7153 + "type": "GDExtensionInt", 7154 + "description": [ 7155 + "The index of the Color to get." 7156 + ] 7157 + } 7158 + ], 7159 + "description": [ 7160 + "Gets a pointer to a color in a PackedColorArray." 7161 + ], 7162 + "since": "4.1" 7163 + }, 7164 + { 7165 + "name": "packed_color_array_operator_index_const", 7166 + "return_value": { 7167 + "type": "GDExtensionTypePtr", 7168 + "description": [ 7169 + "A const pointer to the requested Color." 7170 + ] 7171 + }, 7172 + "arguments": [ 7173 + { 7174 + "name": "p_self", 7175 + "type": "GDExtensionConstTypePtr", 7176 + "description": [ 7177 + "A const pointer to a PackedColorArray object." 7178 + ] 7179 + }, 7180 + { 7181 + "name": "p_index", 7182 + "type": "GDExtensionInt", 7183 + "description": [ 7184 + "The index of the Color to get." 7185 + ] 7186 + } 7187 + ], 7188 + "description": [ 7189 + "Gets a const pointer to a color in a PackedColorArray." 7190 + ], 7191 + "since": "4.1" 7192 + }, 7193 + { 7194 + "name": "array_operator_index", 7195 + "return_value": { 7196 + "type": "GDExtensionVariantPtr", 7197 + "description": [ 7198 + "A pointer to the requested Variant." 7199 + ] 7200 + }, 7201 + "arguments": [ 7202 + { 7203 + "name": "p_self", 7204 + "type": "GDExtensionTypePtr", 7205 + "description": [ 7206 + "A pointer to an Array object." 7207 + ] 7208 + }, 7209 + { 7210 + "name": "p_index", 7211 + "type": "GDExtensionInt", 7212 + "description": [ 7213 + "The index of the Variant to get." 7214 + ] 7215 + } 7216 + ], 7217 + "description": [ 7218 + "Gets a pointer to a Variant in an Array." 7219 + ], 7220 + "since": "4.1" 7221 + }, 7222 + { 7223 + "name": "array_operator_index_const", 7224 + "return_value": { 7225 + "type": "GDExtensionVariantPtr", 7226 + "description": [ 7227 + "A const pointer to the requested Variant." 7228 + ] 7229 + }, 7230 + "arguments": [ 7231 + { 7232 + "name": "p_self", 7233 + "type": "GDExtensionConstTypePtr", 7234 + "description": [ 7235 + "A const pointer to an Array object." 7236 + ] 7237 + }, 7238 + { 7239 + "name": "p_index", 7240 + "type": "GDExtensionInt", 7241 + "description": [ 7242 + "The index of the Variant to get." 7243 + ] 7244 + } 7245 + ], 7246 + "description": [ 7247 + "Gets a const pointer to a Variant in an Array." 7248 + ], 7249 + "since": "4.1" 7250 + }, 7251 + { 7252 + "name": "array_ref", 7253 + "arguments": [ 7254 + { 7255 + "name": "p_self", 7256 + "type": "GDExtensionTypePtr", 7257 + "description": [ 7258 + "A pointer to the Array object to update." 7259 + ] 7260 + }, 7261 + { 7262 + "name": "p_from", 7263 + "type": "GDExtensionConstTypePtr", 7264 + "description": [ 7265 + "A pointer to the Array object to reference." 7266 + ] 7267 + } 7268 + ], 7269 + "description": [ 7270 + "Sets an Array to be a reference to another Array object." 7271 + ], 7272 + "since": "4.1", 7273 + "deprecated": { 7274 + "since": "4.5", 7275 + "message": "Removed from interface. Use copy constructor instead." 7276 + } 7277 + }, 7278 + { 7279 + "name": "array_set_typed", 7280 + "arguments": [ 7281 + { 7282 + "name": "p_self", 7283 + "type": "GDExtensionTypePtr", 7284 + "description": [ 7285 + "A pointer to the Array." 7286 + ] 7287 + }, 7288 + { 7289 + "name": "p_type", 7290 + "type": "GDExtensionVariantType", 7291 + "description": [ 7292 + "The type of Variant the Array will store." 7293 + ] 7294 + }, 7295 + { 7296 + "name": "p_class_name", 7297 + "type": "GDExtensionConstStringNamePtr", 7298 + "description": [ 7299 + "A pointer to a StringName with the name of the object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." 7300 + ] 7301 + }, 7302 + { 7303 + "name": "p_script", 7304 + "type": "GDExtensionConstVariantPtr", 7305 + "description": [ 7306 + "A pointer to a Script object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." 7307 + ] 7308 + } 7309 + ], 7310 + "description": [ 7311 + "Makes an Array into a typed Array." 7312 + ], 7313 + "since": "4.1" 7314 + }, 7315 + { 7316 + "name": "dictionary_operator_index", 7317 + "return_value": { 7318 + "type": "GDExtensionVariantPtr", 7319 + "description": [ 7320 + "A pointer to a Variant representing the value at the given key." 7321 + ] 7322 + }, 7323 + "arguments": [ 7324 + { 7325 + "name": "p_self", 7326 + "type": "GDExtensionTypePtr", 7327 + "description": [ 7328 + "A pointer to a Dictionary object." 7329 + ] 7330 + }, 7331 + { 7332 + "name": "p_key", 7333 + "type": "GDExtensionConstVariantPtr", 7334 + "description": [ 7335 + "A pointer to a Variant representing the key." 7336 + ] 7337 + } 7338 + ], 7339 + "description": [ 7340 + "Gets a pointer to a Variant in a Dictionary with the given key." 7341 + ], 7342 + "since": "4.1" 7343 + }, 7344 + { 7345 + "name": "dictionary_operator_index_const", 7346 + "return_value": { 7347 + "type": "GDExtensionVariantPtr", 7348 + "description": [ 7349 + "A const pointer to a Variant representing the value at the given key." 7350 + ] 7351 + }, 7352 + "arguments": [ 7353 + { 7354 + "name": "p_self", 7355 + "type": "GDExtensionConstTypePtr", 7356 + "description": [ 7357 + "A const pointer to a Dictionary object." 7358 + ] 7359 + }, 7360 + { 7361 + "name": "p_key", 7362 + "type": "GDExtensionConstVariantPtr", 7363 + "description": [ 7364 + "A pointer to a Variant representing the key." 7365 + ] 7366 + } 7367 + ], 7368 + "description": [ 7369 + "Gets a const pointer to a Variant in a Dictionary with the given key." 7370 + ], 7371 + "since": "4.1" 7372 + }, 7373 + { 7374 + "name": "dictionary_set_typed", 7375 + "arguments": [ 7376 + { 7377 + "name": "p_self", 7378 + "type": "GDExtensionTypePtr", 7379 + "description": [ 7380 + "A pointer to the Dictionary." 7381 + ] 7382 + }, 7383 + { 7384 + "name": "p_key_type", 7385 + "type": "GDExtensionVariantType", 7386 + "description": [ 7387 + "The type of Variant the Dictionary key will store." 7388 + ] 7389 + }, 7390 + { 7391 + "name": "p_key_class_name", 7392 + "type": "GDExtensionConstStringNamePtr", 7393 + "description": [ 7394 + "A pointer to a StringName with the name of the object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." 7395 + ] 7396 + }, 7397 + { 7398 + "name": "p_key_script", 7399 + "type": "GDExtensionConstVariantPtr", 7400 + "description": [ 7401 + "A pointer to a Script object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." 7402 + ] 7403 + }, 7404 + { 7405 + "name": "p_value_type", 7406 + "type": "GDExtensionVariantType", 7407 + "description": [ 7408 + "The type of Variant the Dictionary value will store." 7409 + ] 7410 + }, 7411 + { 7412 + "name": "p_value_class_name", 7413 + "type": "GDExtensionConstStringNamePtr", 7414 + "description": [ 7415 + "A pointer to a StringName with the name of the object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT)." 7416 + ] 7417 + }, 7418 + { 7419 + "name": "p_value_script", 7420 + "type": "GDExtensionConstVariantPtr", 7421 + "description": [ 7422 + "A pointer to a Script object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script)." 7423 + ] 7424 + } 7425 + ], 7426 + "description": [ 7427 + "Makes a Dictionary into a typed Dictionary." 7428 + ], 7429 + "since": "4.4" 7430 + }, 7431 + { 7432 + "name": "object_method_bind_call", 7433 + "arguments": [ 7434 + { 7435 + "name": "p_method_bind", 7436 + "type": "GDExtensionMethodBindPtr", 7437 + "description": [ 7438 + "A pointer to the MethodBind representing the method on the Object's class." 7439 + ] 7440 + }, 7441 + { 7442 + "name": "p_instance", 7443 + "type": "GDExtensionObjectPtr", 7444 + "description": [ 7445 + "A pointer to the Object." 7446 + ] 7447 + }, 7448 + { 7449 + "name": "p_args", 7450 + "type": "const GDExtensionConstVariantPtr*", 7451 + "description": [ 7452 + "A pointer to a C array of Variants representing the arguments." 7453 + ] 7454 + }, 7455 + { 7456 + "name": "p_arg_count", 7457 + "type": "GDExtensionInt", 7458 + "description": [ 7459 + "The number of arguments." 7460 + ] 7461 + }, 7462 + { 7463 + "name": "r_ret", 7464 + "type": "GDExtensionUninitializedVariantPtr", 7465 + "description": [ 7466 + "A pointer to Variant which will receive the return value." 7467 + ] 7468 + }, 7469 + { 7470 + "name": "r_error", 7471 + "type": "GDExtensionCallError*", 7472 + "description": [ 7473 + "A pointer to a GDExtensionCallError struct that will receive error information." 7474 + ] 7475 + } 7476 + ], 7477 + "description": [ 7478 + "Calls a method on an Object." 7479 + ], 7480 + "since": "4.1" 7481 + }, 7482 + { 7483 + "name": "object_method_bind_ptrcall", 7484 + "arguments": [ 7485 + { 7486 + "name": "p_method_bind", 7487 + "type": "GDExtensionMethodBindPtr", 7488 + "description": [ 7489 + "A pointer to the MethodBind representing the method on the Object's class." 7490 + ] 7491 + }, 7492 + { 7493 + "name": "p_instance", 7494 + "type": "GDExtensionObjectPtr", 7495 + "description": [ 7496 + "A pointer to the Object." 7497 + ] 7498 + }, 7499 + { 7500 + "name": "p_args", 7501 + "type": "const GDExtensionConstTypePtr*", 7502 + "description": [ 7503 + "A pointer to a C array representing the arguments." 7504 + ] 7505 + }, 7506 + { 7507 + "name": "r_ret", 7508 + "type": "GDExtensionTypePtr", 7509 + "description": [ 7510 + "A pointer to the Object that will receive the return value." 7511 + ] 7512 + } 7513 + ], 7514 + "description": [ 7515 + "Calls a method on an Object (using a \"ptrcall\")." 7516 + ], 7517 + "since": "4.1" 7518 + }, 7519 + { 7520 + "name": "object_destroy", 7521 + "arguments": [ 7522 + { 7523 + "name": "p_o", 7524 + "type": "GDExtensionObjectPtr", 7525 + "description": [ 7526 + "A pointer to the Object." 7527 + ] 7528 + } 7529 + ], 7530 + "description": [ 7531 + "Destroys an Object." 7532 + ], 7533 + "since": "4.1" 7534 + }, 7535 + { 7536 + "name": "global_get_singleton", 7537 + "return_value": { 7538 + "type": "GDExtensionObjectPtr", 7539 + "description": [ 7540 + "A pointer to the singleton Object." 7541 + ] 7542 + }, 7543 + "arguments": [ 7544 + { 7545 + "name": "p_name", 7546 + "type": "GDExtensionConstStringNamePtr", 7547 + "description": [ 7548 + "A pointer to a StringName with the singleton name." 7549 + ] 7550 + } 7551 + ], 7552 + "description": [ 7553 + "Gets a global singleton by name." 7554 + ], 7555 + "since": "4.1" 7556 + }, 7557 + { 7558 + "name": "object_get_instance_binding", 7559 + "return_value": { 7560 + "type": "void*", 7561 + "description": [ 7562 + "A pointer to the instance binding." 7563 + ] 7564 + }, 7565 + "arguments": [ 7566 + { 7567 + "name": "p_o", 7568 + "type": "GDExtensionObjectPtr", 7569 + "description": [ 7570 + "A pointer to the Object." 7571 + ] 7572 + }, 7573 + { 7574 + "name": "p_token", 7575 + "type": "void*", 7576 + "description": [ 7577 + "A token the library received by the GDExtension's entry point function." 7578 + ] 7579 + }, 7580 + { 7581 + "name": "p_callbacks", 7582 + "type": "const GDExtensionInstanceBindingCallbacks*", 7583 + "description": [ 7584 + "A pointer to a GDExtensionInstanceBindingCallbacks struct." 7585 + ] 7586 + } 7587 + ], 7588 + "description": [ 7589 + "Gets a pointer representing an Object's instance binding." 7590 + ], 7591 + "since": "4.1" 7592 + }, 7593 + { 7594 + "name": "object_set_instance_binding", 7595 + "arguments": [ 7596 + { 7597 + "name": "p_o", 7598 + "type": "GDExtensionObjectPtr", 7599 + "description": [ 7600 + "A pointer to the Object." 7601 + ] 7602 + }, 7603 + { 7604 + "name": "p_token", 7605 + "type": "void*", 7606 + "description": [ 7607 + "A token the library received by the GDExtension's entry point function." 7608 + ] 7609 + }, 7610 + { 7611 + "name": "p_binding", 7612 + "type": "void*", 7613 + "description": [ 7614 + "A pointer to the instance binding." 7615 + ] 7616 + }, 7617 + { 7618 + "name": "p_callbacks", 7619 + "type": "const GDExtensionInstanceBindingCallbacks*", 7620 + "description": [ 7621 + "A pointer to a GDExtensionInstanceBindingCallbacks struct." 7622 + ] 7623 + } 7624 + ], 7625 + "description": [ 7626 + "Sets an Object's instance binding." 7627 + ], 7628 + "since": "4.1" 7629 + }, 7630 + { 7631 + "name": "object_free_instance_binding", 7632 + "arguments": [ 7633 + { 7634 + "name": "p_o", 7635 + "type": "GDExtensionObjectPtr", 7636 + "description": [ 7637 + "A pointer to the Object." 7638 + ] 7639 + }, 7640 + { 7641 + "name": "p_token", 7642 + "type": "void*", 7643 + "description": [ 7644 + "A token the library received by the GDExtension's entry point function." 7645 + ] 7646 + } 7647 + ], 7648 + "description": [ 7649 + "Free an Object's instance binding." 7650 + ], 7651 + "since": "4.2" 7652 + }, 7653 + { 7654 + "name": "object_set_instance", 7655 + "arguments": [ 7656 + { 7657 + "name": "p_o", 7658 + "type": "GDExtensionObjectPtr", 7659 + "description": [ 7660 + "A pointer to the Object." 7661 + ] 7662 + }, 7663 + { 7664 + "name": "p_classname", 7665 + "type": "GDExtensionConstStringNamePtr", 7666 + "description": [ 7667 + "A pointer to a StringName with the registered extension class's name." 7668 + ] 7669 + }, 7670 + { 7671 + "name": "p_instance", 7672 + "type": "GDExtensionClassInstancePtr", 7673 + "description": [ 7674 + "A pointer to the extension class instance." 7675 + ] 7676 + } 7677 + ], 7678 + "description": [ 7679 + "Sets an extension class instance on a Object.", 7680 + "`p_classname` should be a registered extension class and should extend the `p_o` Object's class." 7681 + ], 7682 + "since": "4.1" 7683 + }, 7684 + { 7685 + "name": "object_get_class_name", 7686 + "return_value": { 7687 + "type": "GDExtensionBool", 7688 + "description": [ 7689 + "true if successful in getting the class name; otherwise false." 7690 + ] 7691 + }, 7692 + "arguments": [ 7693 + { 7694 + "name": "p_object", 7695 + "type": "GDExtensionConstObjectPtr", 7696 + "description": [ 7697 + "A pointer to the Object." 7698 + ] 7699 + }, 7700 + { 7701 + "name": "p_library", 7702 + "type": "GDExtensionClassLibraryPtr", 7703 + "description": [ 7704 + "A pointer the library received by the GDExtension's entry point function." 7705 + ] 7706 + }, 7707 + { 7708 + "name": "r_class_name", 7709 + "type": "GDExtensionUninitializedStringNamePtr", 7710 + "description": [ 7711 + "A pointer to a String to receive the class name." 7712 + ] 7713 + } 7714 + ], 7715 + "description": [ 7716 + "Gets the class name of an Object.", 7717 + "If the GDExtension wraps the Godot object in an abstraction specific to its class, this is the", 7718 + "function that should be used to determine which wrapper to use." 7719 + ], 7720 + "since": "4.1" 7721 + }, 7722 + { 7723 + "name": "object_cast_to", 7724 + "return_value": { 7725 + "type": "GDExtensionObjectPtr", 7726 + "description": [ 7727 + "Returns a pointer to the Object, or NULL if it can't be cast to the requested type." 7728 + ] 7729 + }, 7730 + "arguments": [ 7731 + { 7732 + "name": "p_object", 7733 + "type": "GDExtensionConstObjectPtr", 7734 + "description": [ 7735 + "A pointer to the Object." 7736 + ] 7737 + }, 7738 + { 7739 + "name": "p_class_tag", 7740 + "type": "void*", 7741 + "description": [ 7742 + "A pointer uniquely identifying a built-in class in the ClassDB." 7743 + ] 7744 + } 7745 + ], 7746 + "description": [ 7747 + "Casts an Object to a different type." 7748 + ], 7749 + "since": "4.1" 7750 + }, 7751 + { 7752 + "name": "object_get_instance_from_id", 7753 + "return_value": { 7754 + "type": "GDExtensionObjectPtr", 7755 + "description": [ 7756 + "A pointer to the Object." 7757 + ] 7758 + }, 7759 + "arguments": [ 7760 + { 7761 + "name": "p_instance_id", 7762 + "type": "GDObjectInstanceID", 7763 + "description": [ 7764 + "The instance ID." 7765 + ] 7766 + } 7767 + ], 7768 + "description": [ 7769 + "Gets an Object by its instance ID." 7770 + ], 7771 + "since": "4.1" 7772 + }, 7773 + { 7774 + "name": "object_get_instance_id", 7775 + "return_value": { 7776 + "type": "GDObjectInstanceID", 7777 + "description": [ 7778 + "The instance ID." 7779 + ] 7780 + }, 7781 + "arguments": [ 7782 + { 7783 + "name": "p_object", 7784 + "type": "GDExtensionConstObjectPtr", 7785 + "description": [ 7786 + "A pointer to the Object." 7787 + ] 7788 + } 7789 + ], 7790 + "description": [ 7791 + "Gets the instance ID from an Object." 7792 + ], 7793 + "since": "4.1" 7794 + }, 7795 + { 7796 + "name": "object_has_script_method", 7797 + "return_value": { 7798 + "type": "GDExtensionBool", 7799 + "description": [ 7800 + "true if the object has a script and that script has a method with the given name. Returns false if the object has no script." 7801 + ] 7802 + }, 7803 + "arguments": [ 7804 + { 7805 + "name": "p_object", 7806 + "type": "GDExtensionConstObjectPtr", 7807 + "description": [ 7808 + "A pointer to the Object." 7809 + ] 7810 + }, 7811 + { 7812 + "name": "p_method", 7813 + "type": "GDExtensionConstStringNamePtr", 7814 + "description": [ 7815 + "A pointer to a StringName identifying the method." 7816 + ] 7817 + } 7818 + ], 7819 + "description": [ 7820 + "Checks if this object has a script with the given method." 7821 + ], 7822 + "since": "4.3" 7823 + }, 7824 + { 7825 + "name": "object_call_script_method", 7826 + "arguments": [ 7827 + { 7828 + "name": "p_object", 7829 + "type": "GDExtensionObjectPtr", 7830 + "description": [ 7831 + "A pointer to the Object." 7832 + ] 7833 + }, 7834 + { 7835 + "name": "p_method", 7836 + "type": "GDExtensionConstStringNamePtr", 7837 + "description": [ 7838 + "A pointer to a StringName identifying the method." 7839 + ] 7840 + }, 7841 + { 7842 + "name": "p_args", 7843 + "type": "const GDExtensionConstVariantPtr*", 7844 + "description": [ 7845 + "A pointer to a C array of Variant." 7846 + ] 7847 + }, 7848 + { 7849 + "name": "p_argument_count", 7850 + "type": "GDExtensionInt", 7851 + "description": [ 7852 + "The number of arguments." 7853 + ] 7854 + }, 7855 + { 7856 + "name": "r_return", 7857 + "type": "GDExtensionUninitializedVariantPtr", 7858 + "description": [ 7859 + "A pointer a Variant which will be assigned the return value." 7860 + ] 7861 + }, 7862 + { 7863 + "name": "r_error", 7864 + "type": "GDExtensionCallError*", 7865 + "description": [ 7866 + "A pointer the structure which will hold error information." 7867 + ] 7868 + } 7869 + ], 7870 + "description": [ 7871 + "Call the given script method on this object." 7872 + ], 7873 + "since": "4.3" 7874 + }, 7875 + { 7876 + "name": "ref_get_object", 7877 + "return_value": { 7878 + "type": "GDExtensionObjectPtr", 7879 + "description": [ 7880 + "A pointer to the Object from the reference or NULL." 7881 + ] 7882 + }, 7883 + "arguments": [ 7884 + { 7885 + "name": "p_ref", 7886 + "type": "GDExtensionConstRefPtr", 7887 + "description": [ 7888 + "A pointer to the reference." 7889 + ] 7890 + } 7891 + ], 7892 + "description": [ 7893 + "Gets the Object from a reference." 7894 + ], 7895 + "since": "4.1" 7896 + }, 7897 + { 7898 + "name": "ref_set_object", 7899 + "arguments": [ 7900 + { 7901 + "name": "p_ref", 7902 + "type": "GDExtensionRefPtr", 7903 + "description": [ 7904 + "A pointer to the reference." 7905 + ] 7906 + }, 7907 + { 7908 + "name": "p_object", 7909 + "type": "GDExtensionObjectPtr", 7910 + "description": [ 7911 + "A pointer to the Object to refer to." 7912 + ] 7913 + } 7914 + ], 7915 + "description": [ 7916 + "Sets the Object referred to by a reference." 7917 + ], 7918 + "since": "4.1" 7919 + }, 7920 + { 7921 + "name": "script_instance_create", 7922 + "return_value": { 7923 + "type": "GDExtensionScriptInstancePtr", 7924 + "description": [ 7925 + "A pointer to a ScriptInstanceExtension object." 7926 + ] 7927 + }, 7928 + "arguments": [ 7929 + { 7930 + "name": "p_info", 7931 + "type": "const GDExtensionScriptInstanceInfo*", 7932 + "description": [ 7933 + "A pointer to a GDExtensionScriptInstanceInfo struct." 7934 + ] 7935 + }, 7936 + { 7937 + "name": "p_instance_data", 7938 + "type": "GDExtensionScriptInstanceDataPtr", 7939 + "description": [ 7940 + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." 7941 + ] 7942 + } 7943 + ], 7944 + "description": [ 7945 + "Creates a script instance that contains the given info and instance data." 7946 + ], 7947 + "since": "4.1", 7948 + "deprecated": { 7949 + "since": "4.2", 7950 + "replace_with": "script_instance_create3" 7951 + } 7952 + }, 7953 + { 7954 + "name": "script_instance_create2", 7955 + "return_value": { 7956 + "type": "GDExtensionScriptInstancePtr", 7957 + "description": [ 7958 + "A pointer to a ScriptInstanceExtension object." 7959 + ] 7960 + }, 7961 + "arguments": [ 7962 + { 7963 + "name": "p_info", 7964 + "type": "const GDExtensionScriptInstanceInfo2*", 7965 + "description": [ 7966 + "A pointer to a GDExtensionScriptInstanceInfo2 struct." 7967 + ] 7968 + }, 7969 + { 7970 + "name": "p_instance_data", 7971 + "type": "GDExtensionScriptInstanceDataPtr", 7972 + "description": [ 7973 + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." 7974 + ] 7975 + } 7976 + ], 7977 + "description": [ 7978 + "Creates a script instance that contains the given info and instance data." 7979 + ], 7980 + "since": "4.2", 7981 + "deprecated": { 7982 + "since": "4.3", 7983 + "replace_with": "script_instance_create3" 7984 + } 7985 + }, 7986 + { 7987 + "name": "script_instance_create3", 7988 + "return_value": { 7989 + "type": "GDExtensionScriptInstancePtr", 7990 + "description": [ 7991 + "A pointer to a ScriptInstanceExtension object." 7992 + ] 7993 + }, 7994 + "arguments": [ 7995 + { 7996 + "name": "p_info", 7997 + "type": "const GDExtensionScriptInstanceInfo3*", 7998 + "description": [ 7999 + "A pointer to a GDExtensionScriptInstanceInfo3 struct." 8000 + ] 8001 + }, 8002 + { 8003 + "name": "p_instance_data", 8004 + "type": "GDExtensionScriptInstanceDataPtr", 8005 + "description": [ 8006 + "A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info." 8007 + ] 8008 + } 8009 + ], 8010 + "description": [ 8011 + "Creates a script instance that contains the given info and instance data." 8012 + ], 8013 + "since": "4.3" 8014 + }, 8015 + { 8016 + "name": "placeholder_script_instance_create", 8017 + "return_value": { 8018 + "type": "GDExtensionScriptInstancePtr", 8019 + "description": [ 8020 + "A pointer to a PlaceHolderScriptInstance object." 8021 + ] 8022 + }, 8023 + "arguments": [ 8024 + { 8025 + "name": "p_language", 8026 + "type": "GDExtensionObjectPtr", 8027 + "description": [ 8028 + "A pointer to a ScriptLanguage." 8029 + ] 8030 + }, 8031 + { 8032 + "name": "p_script", 8033 + "type": "GDExtensionObjectPtr", 8034 + "description": [ 8035 + "A pointer to a Script." 8036 + ] 8037 + }, 8038 + { 8039 + "name": "p_owner", 8040 + "type": "GDExtensionObjectPtr", 8041 + "description": [ 8042 + "A pointer to an Object." 8043 + ] 8044 + } 8045 + ], 8046 + "description": [ 8047 + "Creates a placeholder script instance for a given script and instance.", 8048 + "This interface is optional as a custom placeholder could also be created with script_instance_create()." 8049 + ], 8050 + "since": "4.2", 8051 + "legacy_type_name": "GDExtensionInterfacePlaceHolderScriptInstanceCreate" 8052 + }, 8053 + { 8054 + "name": "placeholder_script_instance_update", 8055 + "arguments": [ 8056 + { 8057 + "name": "p_placeholder", 8058 + "type": "GDExtensionScriptInstancePtr", 8059 + "description": [ 8060 + "A pointer to a PlaceHolderScriptInstance." 8061 + ] 8062 + }, 8063 + { 8064 + "name": "p_properties", 8065 + "type": "GDExtensionConstTypePtr", 8066 + "description": [ 8067 + "A pointer to an Array of Dictionary representing PropertyInfo." 8068 + ] 8069 + }, 8070 + { 8071 + "name": "p_values", 8072 + "type": "GDExtensionConstTypePtr", 8073 + "description": [ 8074 + "A pointer to a Dictionary mapping StringName to Variant values." 8075 + ] 8076 + } 8077 + ], 8078 + "description": [ 8079 + "Updates a placeholder script instance with the given properties and values.", 8080 + "The passed in placeholder must be an instance of PlaceHolderScriptInstance", 8081 + "such as the one returned by placeholder_script_instance_create()." 8082 + ], 8083 + "since": "4.2", 8084 + "legacy_type_name": "GDExtensionInterfacePlaceHolderScriptInstanceUpdate" 8085 + }, 8086 + { 8087 + "name": "object_get_script_instance", 8088 + "return_value": { 8089 + "type": "GDExtensionScriptInstanceDataPtr", 8090 + "description": [ 8091 + "A GDExtensionScriptInstanceDataPtr that was attached to this object as part of script_instance_create." 8092 + ] 8093 + }, 8094 + "arguments": [ 8095 + { 8096 + "name": "p_object", 8097 + "type": "GDExtensionConstObjectPtr", 8098 + "description": [ 8099 + "A pointer to the Object." 8100 + ] 8101 + }, 8102 + { 8103 + "name": "p_language", 8104 + "type": "GDExtensionObjectPtr", 8105 + "description": [ 8106 + "A pointer to the language expected for this script instance." 8107 + ] 8108 + } 8109 + ], 8110 + "description": [ 8111 + "Get the script instance data attached to this object." 8112 + ], 8113 + "since": "4.2" 8114 + }, 8115 + { 8116 + "name": "object_set_script_instance", 8117 + "arguments": [ 8118 + { 8119 + "name": "p_object", 8120 + "type": "GDExtensionObjectPtr", 8121 + "description": [ 8122 + "A pointer to the Object." 8123 + ] 8124 + }, 8125 + { 8126 + "name": "p_script_instance", 8127 + "type": "GDExtensionScriptInstanceDataPtr", 8128 + "description": [ 8129 + "A pointer to the script instance data to attach to this object." 8130 + ] 8131 + } 8132 + ], 8133 + "description": [ 8134 + "Set the script instance data attached to this object." 8135 + ], 8136 + "since": "4.5" 8137 + }, 8138 + { 8139 + "name": "callable_custom_create", 8140 + "arguments": [ 8141 + { 8142 + "name": "r_callable", 8143 + "type": "GDExtensionUninitializedTypePtr", 8144 + "description": [ 8145 + "A pointer that will receive the new Callable." 8146 + ] 8147 + }, 8148 + { 8149 + "name": "p_callable_custom_info", 8150 + "type": "GDExtensionCallableCustomInfo*", 8151 + "description": [ 8152 + "The info required to construct a Callable." 8153 + ] 8154 + } 8155 + ], 8156 + "description": [ 8157 + "Creates a custom Callable object from a function pointer.", 8158 + "Provided struct can be safely freed once the function returns." 8159 + ], 8160 + "since": "4.2", 8161 + "deprecated": { 8162 + "since": "4.3", 8163 + "replace_with": "callable_custom_create2" 8164 + } 8165 + }, 8166 + { 8167 + "name": "callable_custom_create2", 8168 + "arguments": [ 8169 + { 8170 + "name": "r_callable", 8171 + "type": "GDExtensionUninitializedTypePtr", 8172 + "description": [ 8173 + "A pointer that will receive the new Callable." 8174 + ] 8175 + }, 8176 + { 8177 + "name": "p_callable_custom_info", 8178 + "type": "GDExtensionCallableCustomInfo2*", 8179 + "description": [ 8180 + "The info required to construct a Callable." 8181 + ] 8182 + } 8183 + ], 8184 + "description": [ 8185 + "Creates a custom Callable object from a function pointer.", 8186 + "Provided struct can be safely freed once the function returns." 8187 + ], 8188 + "since": "4.3" 8189 + }, 8190 + { 8191 + "name": "callable_custom_get_userdata", 8192 + "return_value": { 8193 + "type": "void*", 8194 + "description": [ 8195 + "The userdata pointer given when creating this custom Callable." 8196 + ] 8197 + }, 8198 + "arguments": [ 8199 + { 8200 + "name": "p_callable", 8201 + "type": "GDExtensionConstTypePtr", 8202 + "description": [ 8203 + "A pointer to a Callable." 8204 + ] 8205 + }, 8206 + { 8207 + "name": "p_token", 8208 + "type": "void*", 8209 + "description": [ 8210 + "A pointer to an address that uniquely identifies the GDExtension." 8211 + ] 8212 + } 8213 + ], 8214 + "description": [ 8215 + "Retrieves the userdata pointer from a custom Callable.", 8216 + "If the Callable is not a custom Callable or the token does not match the one provided to callable_custom_create() via GDExtensionCallableCustomInfo then NULL will be returned." 8217 + ], 8218 + "since": "4.2", 8219 + "legacy_type_name": "GDExtensionInterfaceCallableCustomGetUserData" 8220 + }, 8221 + { 8222 + "name": "classdb_construct_object", 8223 + "return_value": { 8224 + "type": "GDExtensionObjectPtr", 8225 + "description": [ 8226 + "A pointer to the newly created Object." 8227 + ] 8228 + }, 8229 + "arguments": [ 8230 + { 8231 + "name": "p_classname", 8232 + "type": "GDExtensionConstStringNamePtr", 8233 + "description": [ 8234 + "A pointer to a StringName with the class name." 8235 + ] 8236 + } 8237 + ], 8238 + "description": [ 8239 + "Constructs an Object of the requested class.", 8240 + "The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object." 8241 + ], 8242 + "since": "4.1", 8243 + "deprecated": { 8244 + "since": "4.4", 8245 + "replace_with": "classdb_construct_object2" 8246 + } 8247 + }, 8248 + { 8249 + "name": "classdb_construct_object2", 8250 + "return_value": { 8251 + "type": "GDExtensionObjectPtr", 8252 + "description": [ 8253 + "A pointer to the newly created Object." 8254 + ] 8255 + }, 8256 + "arguments": [ 8257 + { 8258 + "name": "p_classname", 8259 + "type": "GDExtensionConstStringNamePtr", 8260 + "description": [ 8261 + "A pointer to a StringName with the class name." 8262 + ] 8263 + } 8264 + ], 8265 + "description": [ 8266 + "Constructs an Object of the requested class.", 8267 + "The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object.", 8268 + "", 8269 + "\"NOTIFICATION_POSTINITIALIZE\" must be sent after construction." 8270 + ], 8271 + "since": "4.4" 8272 + }, 8273 + { 8274 + "name": "classdb_get_method_bind", 8275 + "return_value": { 8276 + "type": "GDExtensionMethodBindPtr", 8277 + "description": [ 8278 + "A pointer to the MethodBind from ClassDB." 8279 + ] 8280 + }, 8281 + "arguments": [ 8282 + { 8283 + "name": "p_classname", 8284 + "type": "GDExtensionConstStringNamePtr", 8285 + "description": [ 8286 + "A pointer to a StringName with the class name." 8287 + ] 8288 + }, 8289 + { 8290 + "name": "p_methodname", 8291 + "type": "GDExtensionConstStringNamePtr", 8292 + "description": [ 8293 + "A pointer to a StringName with the method name." 8294 + ] 8295 + }, 8296 + { 8297 + "name": "p_hash", 8298 + "type": "GDExtensionInt", 8299 + "description": [ 8300 + "A hash representing the function signature." 8301 + ] 8302 + } 8303 + ], 8304 + "description": [ 8305 + "Gets a pointer to the MethodBind in ClassDB for the given class, method and hash." 8306 + ], 8307 + "since": "4.1" 8308 + }, 8309 + { 8310 + "name": "classdb_get_class_tag", 8311 + "return_value": { 8312 + "type": "void*", 8313 + "description": [ 8314 + "A pointer uniquely identifying the built-in class in the ClassDB." 8315 + ] 8316 + }, 8317 + "arguments": [ 8318 + { 8319 + "name": "p_classname", 8320 + "type": "GDExtensionConstStringNamePtr", 8321 + "description": [ 8322 + "A pointer to a StringName with the class name." 8323 + ] 8324 + } 8325 + ], 8326 + "description": [ 8327 + "Gets a pointer uniquely identifying the given built-in class in the ClassDB." 8328 + ], 8329 + "since": "4.1" 8330 + }, 8331 + { 8332 + "name": "classdb_register_extension_class", 8333 + "arguments": [ 8334 + { 8335 + "name": "p_library", 8336 + "type": "GDExtensionClassLibraryPtr", 8337 + "description": [ 8338 + "A pointer the library received by the GDExtension's entry point function." 8339 + ] 8340 + }, 8341 + { 8342 + "name": "p_class_name", 8343 + "type": "GDExtensionConstStringNamePtr", 8344 + "description": [ 8345 + "A pointer to a StringName with the class name." 8346 + ] 8347 + }, 8348 + { 8349 + "name": "p_parent_class_name", 8350 + "type": "GDExtensionConstStringNamePtr", 8351 + "description": [ 8352 + "A pointer to a StringName with the parent class name." 8353 + ] 8354 + }, 8355 + { 8356 + "name": "p_extension_funcs", 8357 + "type": "const GDExtensionClassCreationInfo*", 8358 + "description": [ 8359 + "A pointer to a GDExtensionClassCreationInfo struct." 8360 + ] 8361 + } 8362 + ], 8363 + "description": [ 8364 + "Registers an extension class in the ClassDB.", 8365 + "Provided struct can be safely freed once the function returns." 8366 + ], 8367 + "since": "4.1", 8368 + "deprecated": { 8369 + "since": "4.2", 8370 + "replace_with": "classdb_register_extension_class5" 8371 + } 8372 + }, 8373 + { 8374 + "name": "classdb_register_extension_class2", 8375 + "arguments": [ 8376 + { 8377 + "name": "p_library", 8378 + "type": "GDExtensionClassLibraryPtr", 8379 + "description": [ 8380 + "A pointer the library received by the GDExtension's entry point function." 8381 + ] 8382 + }, 8383 + { 8384 + "name": "p_class_name", 8385 + "type": "GDExtensionConstStringNamePtr", 8386 + "description": [ 8387 + "A pointer to a StringName with the class name." 8388 + ] 8389 + }, 8390 + { 8391 + "name": "p_parent_class_name", 8392 + "type": "GDExtensionConstStringNamePtr", 8393 + "description": [ 8394 + "A pointer to a StringName with the parent class name." 8395 + ] 8396 + }, 8397 + { 8398 + "name": "p_extension_funcs", 8399 + "type": "const GDExtensionClassCreationInfo2*", 8400 + "description": [ 8401 + "A pointer to a GDExtensionClassCreationInfo2 struct." 8402 + ] 8403 + } 8404 + ], 8405 + "description": [ 8406 + "Registers an extension class in the ClassDB.", 8407 + "Provided struct can be safely freed once the function returns." 8408 + ], 8409 + "since": "4.2", 8410 + "deprecated": { 8411 + "since": "4.3", 8412 + "replace_with": "classdb_register_extension_class5" 8413 + } 8414 + }, 8415 + { 8416 + "name": "classdb_register_extension_class3", 8417 + "arguments": [ 8418 + { 8419 + "name": "p_library", 8420 + "type": "GDExtensionClassLibraryPtr", 8421 + "description": [ 8422 + "A pointer the library received by the GDExtension's entry point function." 8423 + ] 8424 + }, 8425 + { 8426 + "name": "p_class_name", 8427 + "type": "GDExtensionConstStringNamePtr", 8428 + "description": [ 8429 + "A pointer to a StringName with the class name." 8430 + ] 8431 + }, 8432 + { 8433 + "name": "p_parent_class_name", 8434 + "type": "GDExtensionConstStringNamePtr", 8435 + "description": [ 8436 + "A pointer to a StringName with the parent class name." 8437 + ] 8438 + }, 8439 + { 8440 + "name": "p_extension_funcs", 8441 + "type": "const GDExtensionClassCreationInfo3*", 8442 + "description": [ 8443 + "A pointer to a GDExtensionClassCreationInfo3 struct." 8444 + ] 8445 + } 8446 + ], 8447 + "description": [ 8448 + "Registers an extension class in the ClassDB.", 8449 + "Provided struct can be safely freed once the function returns." 8450 + ], 8451 + "since": "4.3", 8452 + "deprecated": { 8453 + "since": "4.4", 8454 + "replace_with": "classdb_register_extension_class5" 8455 + } 8456 + }, 8457 + { 8458 + "name": "classdb_register_extension_class4", 8459 + "arguments": [ 8460 + { 8461 + "name": "p_library", 8462 + "type": "GDExtensionClassLibraryPtr", 8463 + "description": [ 8464 + "A pointer the library received by the GDExtension's entry point function." 8465 + ] 8466 + }, 8467 + { 8468 + "name": "p_class_name", 8469 + "type": "GDExtensionConstStringNamePtr", 8470 + "description": [ 8471 + "A pointer to a StringName with the class name." 8472 + ] 8473 + }, 8474 + { 8475 + "name": "p_parent_class_name", 8476 + "type": "GDExtensionConstStringNamePtr", 8477 + "description": [ 8478 + "A pointer to a StringName with the parent class name." 8479 + ] 8480 + }, 8481 + { 8482 + "name": "p_extension_funcs", 8483 + "type": "const GDExtensionClassCreationInfo4*", 8484 + "description": [ 8485 + "A pointer to a GDExtensionClassCreationInfo4 struct." 8486 + ] 8487 + } 8488 + ], 8489 + "description": [ 8490 + "Registers an extension class in the ClassDB.", 8491 + "Provided struct can be safely freed once the function returns." 8492 + ], 8493 + "since": "4.4", 8494 + "deprecated": { 8495 + "since": "4.5", 8496 + "replace_with": "classdb_register_extension_class5" 8497 + } 8498 + }, 8499 + { 8500 + "name": "classdb_register_extension_class5", 8501 + "arguments": [ 8502 + { 8503 + "name": "p_library", 8504 + "type": "GDExtensionClassLibraryPtr", 8505 + "description": [ 8506 + "A pointer the library received by the GDExtension's entry point function." 8507 + ] 8508 + }, 8509 + { 8510 + "name": "p_class_name", 8511 + "type": "GDExtensionConstStringNamePtr", 8512 + "description": [ 8513 + "A pointer to a StringName with the class name." 8514 + ] 8515 + }, 8516 + { 8517 + "name": "p_parent_class_name", 8518 + "type": "GDExtensionConstStringNamePtr", 8519 + "description": [ 8520 + "A pointer to a StringName with the parent class name." 8521 + ] 8522 + }, 8523 + { 8524 + "name": "p_extension_funcs", 8525 + "type": "const GDExtensionClassCreationInfo5*", 8526 + "description": [ 8527 + "A pointer to a GDExtensionClassCreationInfo5 struct." 8528 + ] 8529 + } 8530 + ], 8531 + "description": [ 8532 + "Registers an extension class in the ClassDB.", 8533 + "Provided struct can be safely freed once the function returns." 8534 + ], 8535 + "since": "4.5" 8536 + }, 8537 + { 8538 + "name": "classdb_register_extension_class_method", 8539 + "arguments": [ 8540 + { 8541 + "name": "p_library", 8542 + "type": "GDExtensionClassLibraryPtr", 8543 + "description": [ 8544 + "A pointer the library received by the GDExtension's entry point function." 8545 + ] 8546 + }, 8547 + { 8548 + "name": "p_class_name", 8549 + "type": "GDExtensionConstStringNamePtr", 8550 + "description": [ 8551 + "A pointer to a StringName with the class name." 8552 + ] 8553 + }, 8554 + { 8555 + "name": "p_method_info", 8556 + "type": "const GDExtensionClassMethodInfo*", 8557 + "description": [ 8558 + "A pointer to a GDExtensionClassMethodInfo struct." 8559 + ] 8560 + } 8561 + ], 8562 + "description": [ 8563 + "Registers a method on an extension class in the ClassDB.", 8564 + "Provided struct can be safely freed once the function returns." 8565 + ], 8566 + "since": "4.1" 8567 + }, 8568 + { 8569 + "name": "classdb_register_extension_class_virtual_method", 8570 + "arguments": [ 8571 + { 8572 + "name": "p_library", 8573 + "type": "GDExtensionClassLibraryPtr", 8574 + "description": [ 8575 + "A pointer the library received by the GDExtension's entry point function." 8576 + ] 8577 + }, 8578 + { 8579 + "name": "p_class_name", 8580 + "type": "GDExtensionConstStringNamePtr", 8581 + "description": [ 8582 + "A pointer to a StringName with the class name." 8583 + ] 8584 + }, 8585 + { 8586 + "name": "p_method_info", 8587 + "type": "const GDExtensionClassVirtualMethodInfo*", 8588 + "description": [ 8589 + "A pointer to a GDExtensionClassMethodInfo struct." 8590 + ] 8591 + } 8592 + ], 8593 + "description": [ 8594 + "Registers a virtual method on an extension class in ClassDB, that can be implemented by scripts or other extensions.", 8595 + "Provided struct can be safely freed once the function returns." 8596 + ], 8597 + "since": "4.3" 8598 + }, 8599 + { 8600 + "name": "classdb_register_extension_class_integer_constant", 8601 + "arguments": [ 8602 + { 8603 + "name": "p_library", 8604 + "type": "GDExtensionClassLibraryPtr", 8605 + "description": [ 8606 + "A pointer the library received by the GDExtension's entry point function." 8607 + ] 8608 + }, 8609 + { 8610 + "name": "p_class_name", 8611 + "type": "GDExtensionConstStringNamePtr", 8612 + "description": [ 8613 + "A pointer to a StringName with the class name." 8614 + ] 8615 + }, 8616 + { 8617 + "name": "p_enum_name", 8618 + "type": "GDExtensionConstStringNamePtr", 8619 + "description": [ 8620 + "A pointer to a StringName with the enum name." 8621 + ] 8622 + }, 8623 + { 8624 + "name": "p_constant_name", 8625 + "type": "GDExtensionConstStringNamePtr", 8626 + "description": [ 8627 + "A pointer to a StringName with the constant name." 8628 + ] 8629 + }, 8630 + { 8631 + "name": "p_constant_value", 8632 + "type": "GDExtensionInt", 8633 + "description": [ 8634 + "The constant value." 8635 + ] 8636 + }, 8637 + { 8638 + "name": "p_is_bitfield", 8639 + "type": "GDExtensionBool", 8640 + "description": [ 8641 + "Whether or not this constant is part of a bitfield." 8642 + ] 8643 + } 8644 + ], 8645 + "description": [ 8646 + "Registers an integer constant on an extension class in the ClassDB.", 8647 + "Note about registering bitfield values (if p_is_bitfield is true): even though p_constant_value is signed, language bindings are", 8648 + "advised to treat bitfields as uint64_t, since this is generally clearer and can prevent mistakes like using -1 for setting all bits.", 8649 + "Language APIs should thus provide an abstraction that registers bitfields (uint64_t) separately from regular constants (int64_t)." 8650 + ], 8651 + "since": "4.1" 8652 + }, 8653 + { 8654 + "name": "classdb_register_extension_class_property", 8655 + "arguments": [ 8656 + { 8657 + "name": "p_library", 8658 + "type": "GDExtensionClassLibraryPtr", 8659 + "description": [ 8660 + "A pointer the library received by the GDExtension's entry point function." 8661 + ] 8662 + }, 8663 + { 8664 + "name": "p_class_name", 8665 + "type": "GDExtensionConstStringNamePtr", 8666 + "description": [ 8667 + "A pointer to a StringName with the class name." 8668 + ] 8669 + }, 8670 + { 8671 + "name": "p_info", 8672 + "type": "const GDExtensionPropertyInfo*", 8673 + "description": [ 8674 + "A pointer to a GDExtensionPropertyInfo struct." 8675 + ] 8676 + }, 8677 + { 8678 + "name": "p_setter", 8679 + "type": "GDExtensionConstStringNamePtr", 8680 + "description": [ 8681 + "A pointer to a StringName with the name of the setter method." 8682 + ] 8683 + }, 8684 + { 8685 + "name": "p_getter", 8686 + "type": "GDExtensionConstStringNamePtr", 8687 + "description": [ 8688 + "A pointer to a StringName with the name of the getter method." 8689 + ] 8690 + } 8691 + ], 8692 + "description": [ 8693 + "Registers a property on an extension class in the ClassDB.", 8694 + "Provided struct can be safely freed once the function returns." 8695 + ], 8696 + "since": "4.1" 8697 + }, 8698 + { 8699 + "name": "classdb_register_extension_class_property_indexed", 8700 + "arguments": [ 8701 + { 8702 + "name": "p_library", 8703 + "type": "GDExtensionClassLibraryPtr", 8704 + "description": [ 8705 + "A pointer the library received by the GDExtension's entry point function." 8706 + ] 8707 + }, 8708 + { 8709 + "name": "p_class_name", 8710 + "type": "GDExtensionConstStringNamePtr", 8711 + "description": [ 8712 + "A pointer to a StringName with the class name." 8713 + ] 8714 + }, 8715 + { 8716 + "name": "p_info", 8717 + "type": "const GDExtensionPropertyInfo*", 8718 + "description": [ 8719 + "A pointer to a GDExtensionPropertyInfo struct." 8720 + ] 8721 + }, 8722 + { 8723 + "name": "p_setter", 8724 + "type": "GDExtensionConstStringNamePtr", 8725 + "description": [ 8726 + "A pointer to a StringName with the name of the setter method." 8727 + ] 8728 + }, 8729 + { 8730 + "name": "p_getter", 8731 + "type": "GDExtensionConstStringNamePtr", 8732 + "description": [ 8733 + "A pointer to a StringName with the name of the getter method." 8734 + ] 8735 + }, 8736 + { 8737 + "name": "p_index", 8738 + "type": "GDExtensionInt", 8739 + "description": [ 8740 + "The index to pass as the first argument to the getter and setter methods." 8741 + ] 8742 + } 8743 + ], 8744 + "description": [ 8745 + "Registers an indexed property on an extension class in the ClassDB.", 8746 + "Provided struct can be safely freed once the function returns." 8747 + ], 8748 + "since": "4.2" 8749 + }, 8750 + { 8751 + "name": "classdb_register_extension_class_property_group", 8752 + "arguments": [ 8753 + { 8754 + "name": "p_library", 8755 + "type": "GDExtensionClassLibraryPtr", 8756 + "description": [ 8757 + "A pointer the library received by the GDExtension's entry point function." 8758 + ] 8759 + }, 8760 + { 8761 + "name": "p_class_name", 8762 + "type": "GDExtensionConstStringNamePtr", 8763 + "description": [ 8764 + "A pointer to a StringName with the class name." 8765 + ] 8766 + }, 8767 + { 8768 + "name": "p_group_name", 8769 + "type": "GDExtensionConstStringPtr", 8770 + "description": [ 8771 + "A pointer to a String with the group name." 8772 + ] 8773 + }, 8774 + { 8775 + "name": "p_prefix", 8776 + "type": "GDExtensionConstStringPtr", 8777 + "description": [ 8778 + "A pointer to a String with the prefix used by properties in this group." 8779 + ] 8780 + } 8781 + ], 8782 + "description": [ 8783 + "Registers a property group on an extension class in the ClassDB." 8784 + ], 8785 + "since": "4.1" 8786 + }, 8787 + { 8788 + "name": "classdb_register_extension_class_property_subgroup", 8789 + "arguments": [ 8790 + { 8791 + "name": "p_library", 8792 + "type": "GDExtensionClassLibraryPtr", 8793 + "description": [ 8794 + "A pointer the library received by the GDExtension's entry point function." 8795 + ] 8796 + }, 8797 + { 8798 + "name": "p_class_name", 8799 + "type": "GDExtensionConstStringNamePtr", 8800 + "description": [ 8801 + "A pointer to a StringName with the class name." 8802 + ] 8803 + }, 8804 + { 8805 + "name": "p_subgroup_name", 8806 + "type": "GDExtensionConstStringPtr", 8807 + "description": [ 8808 + "A pointer to a String with the subgroup name." 8809 + ] 8810 + }, 8811 + { 8812 + "name": "p_prefix", 8813 + "type": "GDExtensionConstStringPtr", 8814 + "description": [ 8815 + "A pointer to a String with the prefix used by properties in this subgroup." 8816 + ] 8817 + } 8818 + ], 8819 + "description": [ 8820 + "Registers a property subgroup on an extension class in the ClassDB." 8821 + ], 8822 + "since": "4.1" 8823 + }, 8824 + { 8825 + "name": "classdb_register_extension_class_signal", 8826 + "arguments": [ 8827 + { 8828 + "name": "p_library", 8829 + "type": "GDExtensionClassLibraryPtr", 8830 + "description": [ 8831 + "A pointer the library received by the GDExtension's entry point function." 8832 + ] 8833 + }, 8834 + { 8835 + "name": "p_class_name", 8836 + "type": "GDExtensionConstStringNamePtr", 8837 + "description": [ 8838 + "A pointer to a StringName with the class name." 8839 + ] 8840 + }, 8841 + { 8842 + "name": "p_signal_name", 8843 + "type": "GDExtensionConstStringNamePtr", 8844 + "description": [ 8845 + "A pointer to a StringName with the signal name." 8846 + ] 8847 + }, 8848 + { 8849 + "name": "p_argument_info", 8850 + "type": "const GDExtensionPropertyInfo*", 8851 + "description": [ 8852 + "A pointer to a GDExtensionPropertyInfo struct." 8853 + ] 8854 + }, 8855 + { 8856 + "name": "p_argument_count", 8857 + "type": "GDExtensionInt", 8858 + "description": [ 8859 + "The number of arguments the signal receives." 8860 + ] 8861 + } 8862 + ], 8863 + "description": [ 8864 + "Registers a signal on an extension class in the ClassDB.", 8865 + "Provided structs can be safely freed once the function returns." 8866 + ], 8867 + "since": "4.1" 8868 + }, 8869 + { 8870 + "name": "classdb_unregister_extension_class", 8871 + "arguments": [ 8872 + { 8873 + "name": "p_library", 8874 + "type": "GDExtensionClassLibraryPtr", 8875 + "description": [ 8876 + "A pointer the library received by the GDExtension's entry point function." 8877 + ] 8878 + }, 8879 + { 8880 + "name": "p_class_name", 8881 + "type": "GDExtensionConstStringNamePtr", 8882 + "description": [ 8883 + "A pointer to a StringName with the class name." 8884 + ] 8885 + } 8886 + ], 8887 + "description": [ 8888 + "Unregisters an extension class in the ClassDB.", 8889 + "Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first." 8890 + ], 8891 + "since": "4.1" 8892 + }, 8893 + { 8894 + "name": "get_library_path", 8895 + "arguments": [ 8896 + { 8897 + "name": "p_library", 8898 + "type": "GDExtensionClassLibraryPtr", 8899 + "description": [ 8900 + "A pointer the library received by the GDExtension's entry point function." 8901 + ] 8902 + }, 8903 + { 8904 + "name": "r_path", 8905 + "type": "GDExtensionUninitializedStringPtr", 8906 + "description": [ 8907 + "A pointer to a String which will receive the path." 8908 + ] 8909 + } 8910 + ], 8911 + "description": [ 8912 + "Gets the path to the current GDExtension library." 8913 + ], 8914 + "since": "4.1" 8915 + }, 8916 + { 8917 + "name": "editor_add_plugin", 8918 + "arguments": [ 8919 + { 8920 + "name": "p_class_name", 8921 + "type": "GDExtensionConstStringNamePtr", 8922 + "description": [ 8923 + "A pointer to a StringName with the name of a class (descending from EditorPlugin) which is already registered with ClassDB." 8924 + ] 8925 + } 8926 + ], 8927 + "description": [ 8928 + "Adds an editor plugin.", 8929 + "It's safe to call during initialization." 8930 + ], 8931 + "since": "4.1" 8932 + }, 8933 + { 8934 + "name": "editor_remove_plugin", 8935 + "arguments": [ 8936 + { 8937 + "name": "p_class_name", 8938 + "type": "GDExtensionConstStringNamePtr", 8939 + "description": [ 8940 + "A pointer to a StringName with the name of a class that was previously added as an editor plugin." 8941 + ] 8942 + } 8943 + ], 8944 + "description": [ 8945 + "Removes an editor plugin." 8946 + ], 8947 + "since": "4.1" 8948 + }, 8949 + { 8950 + "name": "editor_help_load_xml_from_utf8_chars", 8951 + "arguments": [ 8952 + { 8953 + "name": "p_data", 8954 + "type": "const char*", 8955 + "description": [ 8956 + "A pointer to a UTF-8 encoded C string (null terminated)." 8957 + ] 8958 + } 8959 + ], 8960 + "description": [ 8961 + "Loads new XML-formatted documentation data in the editor.", 8962 + "The provided pointer can be immediately freed once the function returns." 8963 + ], 8964 + "since": "4.3", 8965 + "legacy_type_name": "GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars" 8966 + }, 8967 + { 8968 + "name": "editor_help_load_xml_from_utf8_chars_and_len", 8969 + "arguments": [ 8970 + { 8971 + "name": "p_data", 8972 + "type": "const char*", 8973 + "description": [ 8974 + "A pointer to a UTF-8 encoded C string." 8975 + ] 8976 + }, 8977 + { 8978 + "name": "p_size", 8979 + "type": "GDExtensionInt", 8980 + "description": [ 8981 + "The number of bytes (not code units)." 8982 + ] 8983 + } 8984 + ], 8985 + "description": [ 8986 + "Loads new XML-formatted documentation data in the editor.", 8987 + "The provided pointer can be immediately freed once the function returns." 8988 + ], 8989 + "since": "4.3", 8990 + "legacy_type_name": "GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen" 8991 + }, 8992 + { 8993 + "name": "editor_register_get_classes_used_callback", 8994 + "arguments": [ 8995 + { 8996 + "name": "p_library", 8997 + "type": "GDExtensionClassLibraryPtr", 8998 + "description": [ 8999 + "A pointer the library received by the GDExtension's entry point function." 9000 + ] 9001 + }, 9002 + { 9003 + "name": "p_callback", 9004 + "type": "GDExtensionEditorGetClassesUsedCallback", 9005 + "description": [ 9006 + "The callback to retrieve the list of classes used." 9007 + ] 9008 + } 9009 + ], 9010 + "description": [ 9011 + "Registers a callback that Godot can call to get the list of all classes (from ClassDB) that may be used by the calling GDExtension.", 9012 + "This is used by the editor to generate a build profile (in \"Tools\" > \"Engine Compilation Configuration Editor...\" > \"Detect from project\"),", 9013 + "in order to recompile Godot with only the classes used.", 9014 + "In the provided callback, the GDExtension should provide the list of classes that _may_ be used statically, thus the time of invocation shouldn't matter.", 9015 + "If a GDExtension doesn't register a callback, Godot will assume that it could be using any classes." 9016 + ], 9017 + "since": "4.5" 9018 + }, 9019 + { 9020 + "name": "register_main_loop_callbacks", 9021 + "arguments": [ 9022 + { 9023 + "name": "p_library", 9024 + "type": "GDExtensionClassLibraryPtr", 9025 + "description": [ 9026 + "A pointer the library received by the GDExtension's entry point function." 9027 + ] 9028 + }, 9029 + { 9030 + "name": "p_callbacks", 9031 + "type": "const GDExtensionMainLoopCallbacks*", 9032 + "description": [ 9033 + "A pointer to the structure that contains the callbacks." 9034 + ] 9035 + } 9036 + ], 9037 + "description": [ 9038 + "Registers callbacks to be called at different phases of the main loop." 9039 + ], 9040 + "since": "4.5" 9041 + } 9042 + ] 9043 + }
+14
tests/gdextension-control/probe.gd
··· 1 + extends Node 2 + 3 + func report(key: String, value) -> void: 4 + print("CONTROL %s=%s" % [key, JSON.stringify(value)]) 5 + 6 + func _ready() -> void: 7 + report("engine_version", Engine.get_version_info()) 8 + report("extension_file_exists", FileAccess.file_exists("res://example.gdextension")) 9 + report("example_exists", ClassDB.class_exists("Example")) 10 + report("example_runtime_exists", ClassDB.class_exists("ExampleRuntime")) 11 + if ClassDB.class_exists("Example"): 12 + var e = ClassDB.instantiate("Example") 13 + report("example_instantiated", e != null) 14 + get_tree().quit()
+6
tests/gdextension-control/probe.tscn
··· 1 + [gd_scene load_steps=2 format=3] 2 + 3 + [ext_resource type="Script" path="res://probe.gd" id="1"] 4 + 5 + [node name="Probe" type="Node"] 6 + script = ExtResource("1")
+15
tests/gdextension-control/project.godot
··· 1 + config_version=5 2 + 3 + [application] 4 + 5 + config/name="gdextension-control" 6 + run/main_scene="res://probe.tscn" 7 + config/features=PackedStringArray("4.3") 8 + 9 + [editor_plugins] 10 + 11 + enabled=PackedStringArray() 12 + 13 + [autoload] 14 + 15 + _ControlProbeExtension="*res://example.gdextension"
+10
tsconfig.json
··· 1 + { 2 + "compilerOptions": { 3 + "target": "ES2022", 4 + "module": "ESNext", 5 + "moduleResolution": "Bundler", 6 + "strict": true, 7 + "skipLibCheck": true, 8 + "types": [] 9 + } 10 + }