This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2025 WhizArts | |
| # Basic Godot Utility functions | |
| extends Node | |
| const INT32_MAX := int(int(pow(2, 31)) - 1) | |
| const INT64_MAX := int(int(pow(2, 63)) - 1) | |
| const UINT32_MAX := int(pow(2, 32)) | |
| func recursively_get_all_children(target : Node) -> Array: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| 3D Models | |
| ------------------------------------------------------------------------------- | |
| 3 Great Feathers Pack | |
| CC BY 4.0 | |
| https://creativecommons.org/licenses/by/4.0/ | |
| https://sketchfab.com/3d-models/3-great-feathers-pack-ee6a816aa4bf46e399a0169ed826c276 | |
| American style house |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from os.path import splitext | |
| uid_to_file = {} | |
| headers = ["[gd_scene ", "[gd_resource "] | |
| exts = [".tscn", ".tres"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DirectoryIterator: | |
| var _path : String | |
| var _dir : Directory | |
| var _file_name := "" | |
| var _skip_navigational := false | |
| var _skip_hidden := false | |
| func _init(path : String, skip_navigational := false, skip_hidden := false) -> void: | |
| _path = path | |
| _skip_navigational = skip_navigational |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rng := RandomNumberGenerator.new() | |
| func _ready() -> void: | |
| # Set seed here | |
| rng.set_seed(3) | |
| # Will print the same 10 numbers each run | |
| for i in range(10): | |
| var my_random_number = rng.randi_range(0, 2) | |
| print(my_random_number) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Control | |
| var _thread : Thread = null | |
| var _to_load := [] | |
| var _to_load_mutex := Mutex.new() | |
| func start_async_loader() -> void: | |
| _thread = Thread.new() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vec4 int_to_vec4(const int data) { | |
| int mask = shift_left(shift_right(data, 8), 8); | |
| float r = float(data - mask) / 255.0; | |
| mask = shift_left(shift_right(data, 16), 16); | |
| float g = float(shift_right(data - mask, 8)) / 255.0; | |
| mask = shift_left(shift_right(data, 24), 24); | |
| float b = float(shift_right(data - mask, 16)) / 255.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Here is a sloppy hack to get a Godot resource type without having to load it first | |
| func get_resource_type(file_name : String) -> GDScriptNativeClass: | |
| var f := File.new() | |
| f.open(file_name, File.READ) | |
| var text := f.get_as_text() | |
| #[gd_resource type="ParticlesMaterial" load_steps=3 format=2] | |
| for line in text.split("\n"): | |
| line = line.rstrip("\r") | |
| if line.find("[gd_resource") == 0 and line.find("]") == line.length()-1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Spatial moves without physics | |
| func _physics_process(delta : float) -> void: | |
| var speed := 1.0 | |
| var velocity := self.transform.basis.z * speed | |
| self.transform.origin += velocity * delta | |
| # KinematicBody moves with physics | |
| func _physics_process(delta : float) -> void: | |
| var speed := 1.0 | |
| var velocity := self.transform.basis.z * speed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Check these things to get more PPC CPU info: | |
| "/sys/devices/system/cpu/cpu%d" | |
| "/sys/devices/system/cpu/subcores_per_core" | |
| "/sys/devices/system/cpu/dscr_default" | |
| "/proc/device-tree/cpus/%s/ibm,ppc-interrupt-server#s" | |
| Is this installed by default on PPC Linux?: | |
| https://github.com/ibm-power-utilities/powerpc-utils |
NewerOlder