Skip to content

Commit

Permalink
Cast selected Nodes to BrushStroke Nodes in typed array
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrlabs committed Sep 11, 2024
1 parent 1419bb2 commit 112ff31
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lorien/InfiniteCanvas/Tools/SelectionTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,14 @@ func is_selecting() -> bool:
return _state == State.SELECTING

# ------------------------------------------------------------------------------------------------
func get_selected_strokes() -> Array:
return get_tree().get_nodes_in_group(GROUP_SELECTED_STROKES)
func get_selected_strokes() -> Array[BrushStroke]:
# Can't cast from Array[Node] to Array[BrushStroke] directly (godot bug/missing feature?)
# so let's do it per item
var strokes: Array[BrushStroke]
for stroke in get_tree().get_nodes_in_group(GROUP_SELECTED_STROKES):
strokes.append(stroke as BrushStroke)

return strokes

# ------------------------------------------------------------------------------------------------
func _on_brush_color_changed(color: Color) -> void:
Expand Down

0 comments on commit 112ff31

Please sign in to comment.