-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
720 additions
and
447 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
@tool | ||
extends CanvasLayer | ||
|
||
var is_active = false | ||
var last_focused_control = null | ||
@onready var mouse_pointer = %MousePointer | ||
@onready var search_again_timer = %SearchAgainTimer | ||
@onready var eye_dropper_button: CheckButton = %EyeDropperButton | ||
|
||
signal node_selected(node) | ||
|
||
func _ready(): | ||
eye_dropper_button.toggled.connect(func(value): | ||
is_active = value | ||
) | ||
search_again_timer.timeout.connect(func(): | ||
var newly_focused_control = focused_control(get_viewport().get_mouse_position()) | ||
if(is_instance_valid(last_focused_control)): | ||
last_focused_control.modulate = Color.WHITE | ||
if(not is_active): return | ||
if newly_focused_control is Control: | ||
newly_focused_control.modulate = Color.GREEN | ||
last_focused_control = newly_focused_control | ||
) | ||
|
||
func _input(event): | ||
if event is InputEventMouseButton and is_active: | ||
var click_event = event as InputEventMouseButton | ||
if(click_event.pressed and click_event.button_index == MOUSE_BUTTON_LEFT): | ||
get_viewport().set_input_as_handled() | ||
if(last_focused_control): | ||
node_selected.emit(last_focused_control) | ||
eye_dropper_button.button_pressed = false | ||
|
||
func _physics_process(delta): | ||
mouse_pointer.visible = is_active | ||
var mouse_position = get_viewport().get_mouse_position() | ||
mouse_pointer.global_position = mouse_position | ||
|
||
|
||
func focused_control(mouse_position: Vector2): | ||
var root = get_tree().root | ||
return _focused_control(mouse_position, root, root) | ||
|
||
func _focused_control(mouse_position: Vector2, current_result: Node, node_to_search_in): | ||
var new_result = current_result | ||
if(node_to_search_in is Control): | ||
var control_node: Control = node_to_search_in | ||
if(control_node.is_visible_in_tree()): | ||
if(control_node.get_global_rect().has_point(mouse_position)): | ||
new_result = control_node | ||
else: | ||
return null | ||
|
||
var node_children = node_to_search_in.get_children(true) | ||
node_children.reverse() | ||
if not node_children.is_empty(): | ||
for child in node_children: | ||
var result_node = _focused_control(mouse_position, new_result, child) | ||
if(result_node): | ||
new_result = result_node | ||
|
||
return new_result | ||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://2lgtp7y73mpm" | ||
path="res://.godot/imported/ColorPicker.svg-1ab765611c164fe3d6a2dac8a93bd161.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://addons/ruake/core/REPL/ColorPicker.svg" | ||
dest_files=["res://.godot/imported/ColorPicker.svg-1ab765611c164fe3d6a2dac8a93bd161.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@tool | ||
extends Control | ||
|
||
@onready var repl = %REPL | ||
@onready var editor_eye_dropper = %EditorEyeDropper | ||
|
||
func _ready(): | ||
EditorInterface.get_selection().selection_changed.connect(self.on_selection_changed) | ||
editor_eye_dropper.node_selected.connect(func(node): | ||
repl._set_object(node) | ||
) | ||
|
||
func on_selection_changed(): | ||
var selected_nodes = EditorInterface.get_selection().get_selected_nodes() | ||
if(selected_nodes.size() == 1): | ||
var selected_node = selected_nodes.front() | ||
repl._set_object(selected_node) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://din1aj8sfxhlk"] | ||
|
||
[ext_resource type="Script" path="res://addons/ruake/core/REPL/InEditorREPL.gd" id="1_vxaw6"] | ||
[ext_resource type="PackedScene" uid="uid://cusxs75017g44" path="res://addons/ruake/core/REPL/REPL.tscn" id="2_1f052"] | ||
[ext_resource type="Script" path="res://addons/ruake/core/EditorEyeDropper.gd" id="2_ubjgs"] | ||
[ext_resource type="Texture2D" uid="uid://2lgtp7y73mpm" path="res://addons/ruake/core/REPL/ColorPicker.svg" id="4_jt8xp"] | ||
|
||
[sub_resource type="SphereMesh" id="SphereMesh_3o8jm"] | ||
radius = 12.5 | ||
height = 25.0 | ||
|
||
[node name="InEditorRepl" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
script = ExtResource("1_vxaw6") | ||
|
||
[node name="EditorEyeDropper" type="CanvasLayer" parent="."] | ||
unique_name_in_owner = true | ||
layer = 128 | ||
follow_viewport_enabled = true | ||
script = ExtResource("2_ubjgs") | ||
|
||
[node name="MousePointer" type="MeshInstance2D" parent="EditorEyeDropper"] | ||
unique_name_in_owner = true | ||
visible = false | ||
modulate = Color(1, 1, 1, 0.392157) | ||
self_modulate = Color(1, 1, 0.752941, 1) | ||
top_level = true | ||
position = Vector2(-308.811, 189.112) | ||
mesh = SubResource("SphereMesh_3o8jm") | ||
|
||
[node name="SearchAgainTimer" type="Timer" parent="EditorEyeDropper"] | ||
unique_name_in_owner = true | ||
wait_time = 0.1 | ||
autostart = true | ||
|
||
[node name="REPL" parent="." instance=ExtResource("2_1f052")] | ||
unique_name_in_owner = true | ||
layout_mode = 1 | ||
|
||
[node name="SelfLabel" parent="REPL/HBoxContainer" index="0"] | ||
text = "Enanos" | ||
|
||
[node name="EyeDropperButton" type="CheckButton" parent="REPL/HBoxContainer" index="1"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
icon = ExtResource("4_jt8xp") | ||
|
||
[editable path="REPL"] |
Oops, something went wrong.