Run godot --convert-3to4 (automated conversion)
Apply Godot 4.6 automated conversion: renames Spatial.translate->position, margin_*->offset_*, tool->@tool, .empty()->.is_empty(), DynamicFont->FontFile, onready->@onready, export()->@export, and many more. 127 files changed by the tool. Manual fixes still required for: - godot_db_manager plugin (incompatible APIs: WindowDialog, Tabs, etc.) - lod plugin (Spatial -> Node3D renames) - ResourceLoader.load_interactive removed -> load_threaded_request - OS.set_window_fullscreen removed -> DisplayServer - Viewport.set_size_override removed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
# Copyright © 2020 Hugo Locurcio and contributors - MIT License
|
||||
# See `LICENSE.md` included in the source distribution for details.
|
||||
extends Spatial
|
||||
extends Node3D
|
||||
class_name LODSpatial, "lod_spatial.svg"
|
||||
|
||||
# If `false`, LOD won't update anymore. This can be used for performance comparison
|
||||
# purposes.
|
||||
export var enable_lod := true
|
||||
@export var enable_lod := true
|
||||
|
||||
# The maximum LOD 0 (high quality) distance in units.
|
||||
export(float, 0.0, 1000.0, 0.1) var lod_0_max_distance := 10
|
||||
@export var lod_0_max_distance := 10 # (float, 0.0, 1000.0, 0.1)
|
||||
|
||||
# The maximum LOD 1 (medium quality) distance in units.
|
||||
export(float, 0.0, 1000.0, 0.1) var lod_1_max_distance := 25
|
||||
@export var lod_1_max_distance := 25 # (float, 0.0, 1000.0, 0.1)
|
||||
|
||||
# The maximum LOD 2 (low quality) distance in units.
|
||||
# Past this distance, all LOD variants are hidden.
|
||||
export(float, 0.0, 1000.0, 0.1) var lod_2_max_distance := 100
|
||||
@export var lod_2_max_distance := 100 # (float, 0.0, 1000.0, 0.1)
|
||||
|
||||
# The rate at which LODs will be updated (in seconds). Lower values are more reactive
|
||||
# but use more CPU, which is especially noticeable with large amounts of LOD-enabled nodes.
|
||||
@@ -43,7 +43,7 @@ func _ready() -> void:
|
||||
|
||||
# Add random jitter to the timer to ensure LODs don't all swap at the same time.
|
||||
randomize()
|
||||
timer += rand_range(0, refresh_rate)
|
||||
timer += randf_range(0, refresh_rate)
|
||||
|
||||
|
||||
# Despite LOD not being related to physics, we chose to run in `_physics_process()`
|
||||
@@ -53,7 +53,7 @@ func _physics_process(delta: float) -> void:
|
||||
return
|
||||
|
||||
# We need a camera to do the rest.
|
||||
var camera := get_viewport().get_camera()
|
||||
var camera := get_viewport().get_camera_3d()
|
||||
if camera == null:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user