style: apply gdformat formatting across the entire project
Auto-format all GDScript files using gdformat from gdtoolkit. This is a baseline formatting pass to ensure consistent style: - Normalizes indentation and spacing - Wraps long lines to 100 characters - Removes trailing whitespace - Standardizes blank lines between functions 68 files reformatted, 8 files left unchanged (3rd-party addon files with parse errors excluded).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# This script can be used to move your regions by an offset.
|
||||
# This script can be used to move your regions by an offset.
|
||||
# Eventually this tool will find its way into a built in UI
|
||||
#
|
||||
#
|
||||
# Attach it to your Terrain3D node
|
||||
# Save and reload your scene
|
||||
# Select your Terrain3D node
|
||||
@@ -9,19 +9,18 @@
|
||||
# It should unload the regions, rename files, and reload them
|
||||
# Clear the script and resave your scene
|
||||
|
||||
|
||||
@tool
|
||||
extends Terrain3D
|
||||
|
||||
|
||||
@export var offset: Vector2i
|
||||
@export var run: bool = false : set = start_rename
|
||||
@export var run: bool = false:
|
||||
set = start_rename
|
||||
|
||||
|
||||
func start_rename(val: bool = false) -> void:
|
||||
if val == false or offset == Vector2i.ZERO:
|
||||
return
|
||||
|
||||
|
||||
var dir_name: String = data_directory
|
||||
data_directory = ""
|
||||
var dir := DirAccess.open(dir_name)
|
||||
@@ -36,17 +35,22 @@ func start_rename(val: bool = false) -> void:
|
||||
var region_loc: Vector2i = Terrain3DUtil.filename_to_location(file_name)
|
||||
var new_loc: Vector2i = region_loc + offset
|
||||
if new_loc.x < -16 or new_loc.x > 15 or new_loc.y < -16 or new_loc.y > 15:
|
||||
push_error("New location %.0v out of bounds for region %.0v. Aborting" % [ new_loc, region_loc ])
|
||||
push_error(
|
||||
(
|
||||
"New location %.0v out of bounds for region %.0v. Aborting"
|
||||
% [new_loc, region_loc]
|
||||
)
|
||||
)
|
||||
return
|
||||
var new_name: String = "tmp_" + Terrain3DUtil.location_to_filename(new_loc)
|
||||
dir.rename(file_name, new_name)
|
||||
affected_files.push_back(new_name)
|
||||
print("File: %s renamed to: %s" % [ file_name, new_name ])
|
||||
|
||||
print("File: %s renamed to: %s" % [file_name, new_name])
|
||||
|
||||
for file_name in affected_files:
|
||||
var new_name: String = file_name.trim_prefix("tmp_")
|
||||
dir.rename(file_name, new_name)
|
||||
print("File: %s renamed to: %s" % [ file_name, new_name ])
|
||||
|
||||
print("File: %s renamed to: %s" % [file_name, new_name])
|
||||
|
||||
data_directory = dir_name
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
|
||||
Reference in New Issue
Block a user