Created
June 23, 2024 06:10
-
-
Save Shilo/2595c48b589e84112eb5b0c0f49af0bf to your computer and use it in GitHub Desktop.
Godot EditorScript to align selected Node2Ds to current mouse position.
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 EditorScript | |
# Align selected Node2Ds to current mouse position. | |
# Ctrl+Shift+X to run. | |
func _run(): | |
var editor_interface = get_editor_interface() | |
var mouse_position = editor_interface.get_editor_viewport_2d().get_mouse_position() | |
for selected_node in editor_interface.get_selection().get_selected_nodes(): | |
if selected_node is Node2D: | |
selected_node.global_position = mouse_position | |
print("Aligned %s with mouse position." % selected_node) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment