Skip to content

Commit

Permalink
Fix problems reported by static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Oct 31, 2024
1 parent ad5db3b commit cca82f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
3 changes: 2 additions & 1 deletion source/main-menu/Play.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ func _on_player_selected(selected_option_id, selected_player_id):
):
option_nodes[option_node_id].selected = (Constants.PlayerType.SIMPLE_CLAIRVOYANT_AI)
elif selected_option_id == Constants.PlayerType.NONE:
var option_nodes_with_player_controllers = find_child("GridContainer").find_children("OptionButton*").filter(
var option_buttons = find_child("GridContainer").find_children("OptionButton*")
var option_nodes_with_player_controllers = option_buttons.filter(
func(option_node): return option_node.selected != Constants.PlayerType.NONE
)
if option_nodes_with_player_controllers.size() < 2:
Expand Down
32 changes: 14 additions & 18 deletions source/utils/IconRenderBooth.gd
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
extends Node3D


var icon_folder: String = "res://assets/ui/icons/"

var icons_to_render_count: int = 0
var icon_render_index: int = 0

@onready var render_booth: SubViewport = $RenderBooth


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
icons_to_render_count = render_booth.get_child_count()

for c in render_booth.get_children():
c.visible = false

set_process(true)


var icons_to_render_count: int = 0
var icon_render_index: int = 0
set_process(true)


func render_icon() -> void:
if icon_render_index > 0:
render_booth.get_child(icon_render_index - 1).visible = false

var rendered_icon_node: Node3D = render_booth.get_child(icon_render_index)
var rendered_icon_camera: Camera3D = rendered_icon_node.get_node("Camera3D")

rendered_icon_node.visible = true
rendered_icon_camera.current = true

var icon_name: String = rendered_icon_node.name

await get_tree().process_frame

var img: Image = render_booth.get_texture().get_image()

var filepath: String = icon_folder + icon_name + ".png"
img.save_png(filepath)

icon_render_index += 1

if icon_render_index >= icons_to_render_count:
set_process(false)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
func _process(_delta: float) -> void:
render_icon()

0 comments on commit cca82f1

Please sign in to comment.