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.hexpat
Last active November 21, 2024 15:44
XM patterns for ImHex
#pragma author YuriSizov
#pragma description FastTracker 2 XM File
#pragma magic [ 45 78 74 65 6E 64 65 64 20 4D 6F 64 75 6C 65 3A 20 ] @ 0x00
#include "std/core.pat"
#include "std/string.pat"
// HEADERS.
struct XMHeader {