Skip to content

Instantly share code, notes, and snippets.

View YuriSizov's full-sized avatar
🤠
Professional cat herder

Yuri Sizov YuriSizov

🤠
Professional cat herder
View GitHub Profile
@YuriSizov
YuriSizov / NodeUtils.gd
Last active December 19, 2021 19:50
A sample code for Godot Editor plugin to play an arbitrary scene from GDScript
extends Object
class_name NodeUtils
static func get_child_by_class(node : Node, child_class : String, counter : int = 1) -> Node:
var match_counter = 0
var node_children = node.get_children()
for child in node_children:
if (child.get_class() == child_class):
match_counter += 1
@YuriSizov
YuriSizov / DrawUtils.gd
Last active June 7, 2021 09:13
GraphEdit Minimap GDScript implementation
extends Object
class_name DrawUtils
# Extracted from graph_node.cpp
static func draw_cos_line(node : Node, from_position : Vector2, to_position : Vector2, from_color : Color, to_color : Color, bezier_len_pos : int, bezier_len_neg : int, line_width : float = 1.0, shadow : bool = false) -> void:
var diff = to_position.x - from_position.x
var cp_offset
var cp_len = bezier_len_pos
var cp_neg_len = bezier_len_neg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@YuriSizov
YuriSizov / ResourceUtils.gd
Last active April 15, 2024 10:29
Busting Godot resource cache
extends Object
class_name ResourceUtils
# ResourceLoader is unreliable when it comes to cache.
# Sub-resources get cached regardless of the argument passed to load function.
# This is a workaround that generates a new file on a fly,
# while making sure that there is no cache record for it.
# This file is then used to load the resource, after which
# the resource takes over the original path.
static func load_fresh(resource_path : String) -> Resource:
@YuriSizov
YuriSizov / gist:aea35e12fe1ed04e54ef4371d75c6da9
Created December 30, 2023 16:50
Scripting language parity check in Godot class reference
298 code samples failed parity check:
- 1 hits in class "AnimatedSprite2D"
- Codeblocks only has one language in method "set_frame_and_progress" description
- 1 hits in class "AnimatedSprite3D"
- Codeblocks only has one language in method "set_frame_and_progress" description
- 7 hits in class "AnimationMixer"
- Codeblocks only has one language in method "get_root_motion_position" description
- Codeblocks only has one language in method "get_root_motion_position" description
- Codeblocks only has one language in method "get_root_motion_position_accumulator" description
- Codeblocks only has one language in method "get_root_motion_rotation" description
@YuriSizov
YuriSizov / xm_tracker.pat
Created May 30, 2024 16:22
XM patterns for ImHex
#include "std/core.pat"
struct XMHeader {
char module_head[0x11];
char module_name[0x14];
padding[1];
char tracker_name[0x14];
u8 version_min;
u8 version_maj;
};