This file contains 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
@tool | |
extends EditorScenePostImport | |
func _post_import(scene: Node) -> Object: | |
_deduplicate_meshes(scene, true) | |
return scene | |
# Finds duplicate meshes and deduplicates them, using a content hash for comparison | |
func _deduplicate_meshes(scene : Node, verbose := false) -> void: | |
var start_time := Time.get_ticks_msec() |
This file contains 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
# Implements a stable sort as requested in https://www.reddit.com/r/godot/comments/1cyyaxo/are_there_any_plans_to_implement_a_stable_sorting/ | |
# in the worst possible way | |
extends Node | |
class TestObject extends RefCounted: | |
const SUITES = ['♠️','♣️','♥️','♦️'] | |
var an_int : int | |
var a_float : float | |
var a_string : String |
This file contains 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 Node3D | |
################################################################## | |
## your scientists were so preoccupied with whether or not they ## | |
## could that they didn't stop to think if they should. ## | |
################################################################## | |
class YeOldeGDScriptFunctionState extends RefCounted: | |
#region Private | |
var _suspended := false # state of the coroutine | |
var _resume_arg : Variant # argument passed to resume() |
This file contains 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 RefCounted | |
class_name MultiAwaiter | |
## Can await till multiple method calls are done | |
## | |
## You use it like: | |
## [codeblock] | |
## var awaiter = MultipleAwait.new() | |
## awaiter.push_method( my_func.bind(arg_a, arg_b, ...) ) | |
## await awaiter.run() # You can also connect stuff to it's completed signal | |
## [/codeblock] |
This file contains 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 AudioStreamPlayer | |
class_name AudioStreamPlayerWithCounter | |
signal playback_position_reached(number) | |
var counter: int = 0 | |
var trigger_map = {} | |
class Trigger extends Reference: |
This file contains 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
@echo off | |
echo.===== RESTARTING LanmanWorkstation and dependencies ===== | |
powershell -command "Restart-Service LanmanWorkstation -Force" && echo.===== DONE ===== || echo.### ERROR ### Did you remember to right click-^>Run as Administrator? If you still get an error after that then there is some other problem. | |
PAUSE |
This file contains 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
tool | |
extends AudioStreamPlayer | |
# "We were so preoccupied with whether or not we could, we didn’t stop to think if we should." | |
var sample_hz = 8000.0 # Adjust and enjoy the sound of nightmares | |
var playback: AudioStreamPlayback = null # Actual playback stream, assigned in _init(). | |
var _stream = PoolRealArray() | |
var stream_pos = 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
tool | |
extends AudioStreamPlayer #exactly the same code should work for extending 2D and 3D versions | |
class_name RoundRobinPlayer | |
export(int, "sequence", "random", "shuffle") var queue_mode = 0 | |
export(Array, AudioStream) var playlist = [] setget _set_playlist, _get_playlist | |
export(bool) var round_robin_playing = false setget _set_playing, _is_playing # can't override properties so use this for animations | |
var playlist_index = -1 # current position in the playlist | |
var shuffled_indices = [] # Array<int> of shuffled playlist indices |
This file contains 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
#You can add this to any singleton where you have helper classes and functions | |
class ShuffleBag: | |
var _shuffled_list | |
var _current_pos = -1 | |
func _init(array_from): | |
var _unshuffled = array_from.duplicate() | |
var _shuffled = [] | |
var _current_pos | |
# Pick a random element from the unshuffled list |
NewerOlder