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
@tool | |
class_name DevTool extends Node | |
const SCREENSHOT_PATH = "-Editor/Screenshots/" | |
@warning_ignore("unused_private_class_variable") | |
@export_tool_button("Screenshot Viewport", "Image") var _screenshot_viewport := screenshot_viewport.bind(true, true) | |
func screenshot_viewport(transparent_background: bool = false, hide_debug_colors: bool = false) -> void: |
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_name VisibleOnScreenActivator2D extends VisibleOnScreenEnabler2D | |
@export var activate_visibility: bool = true | |
@export var auto_rect: bool = false | |
@export_group("Debug", "debug_") | |
@export var debug_enabled: bool = false | |
@export var debug_color: Color = Color(Color.YELLOW, 0.1) | |
var _activate_node_path: NodePath |
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
@tool | |
class_name ScreenshotViewportTool extends Node | |
@export var screenshot: bool: | |
set(__): | |
screenshot_viewport() | |
func screenshot_viewport(transparent_background: bool = false, hide_debug_colors: bool = false) -> void: | |
var time_string: String = Time.get_datetime_string_from_system().replace(":", "-").replace("T", "-") | |
var scene_file_name: String = self.get_owner().scene_file_path.get_file().get_basename() |
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
func screenshot_viewport(transparent_background: bool = false) -> void: | |
var time_string: String = Time.get_datetime_string_from_system().replace(":", "-").replace("T", "-") | |
var path := "res://screenshot-" + time_string + '-' + str(randi() % 8999 + 1000) + ".png" | |
var viewport := get_viewport() | |
if transparent_background: | |
viewport.transparent_bg = true; | |
await RenderingServer.frame_post_draw | |
var error: Error = viewport.get_texture().get_image().save_png(path) |
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 Label | |
func _process(_delta: float) -> void: | |
text = format_number(Engine.get_frames_per_second()) + " FPS" | |
func format_number(number: Variant, thousand_separator: String = ",") -> String: | |
var number_str: String = str(number) | |
var start_index: int = number_str.find(".") | |
if start_index == -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
func format_number(number: Variant, thousand_separator: String = ",") -> String: | |
var number_str: String = str(number) | |
var start_index: int = number_str.find(".") | |
if start_index == -1: | |
start_index = number_str.length() | |
for i in range(start_index - 3, 0, -3): | |
number_str = number_str.insert(i, thousand_separator) | |
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
shader_type canvas_item; | |
uniform sampler2D noise_texture: repeat_enable, filter_nearest; | |
uniform vec2 speed = vec2(0.01, 0.01); | |
uniform float sparsity: hint_range(0.0, 5.0) = 1.0; | |
uniform float alpha: hint_range(0.0, 1.0) = 0.5; | |
uniform float edge_falloff: hint_range(0.0, 1.0) = 0.0; | |
uniform float edge_falloff_sensitivity: hint_range(1.0, 20.0) = 1.0; | |
void fragment() { |
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
@tool | |
extends Node2D | |
@export var radius = 50.0: | |
set(value): | |
radius = value | |
queue_redraw() | |
@export var start_angle_deg = 0.0: | |
set(value): |
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
@tool | |
class_name Circle2D extends Polygon2D | |
@export_range(0.0, 360.0, 0.001, "or_greater", "or_less") var start_degree: float = 0.0: | |
set(value): | |
start_degree = _wrap_degree(value) | |
queue_update() | |
@export_range(0.0, 360.0, 0.001, "or_greater", "or_less") var end_degree: float = 360.0: | |
set(value): |