-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #735 from Jowan-Spooner/better-reference-panel
Improved Reference Panel
- Loading branch information
Showing
8 changed files
with
4,506 additions
and
4,308 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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
extends ColorRect | ||
|
||
|
||
signal clicked | ||
extends Button | ||
|
||
|
||
func _ready() -> void: | ||
pass # Replace with function body. | ||
button_group.pressed.connect(func(_x): $ColorRect.queue_redraw()) | ||
toggled.connect(func(_x): $ColorRect.queue_redraw()) | ||
|
||
|
||
func set_slot_color(c) -> void: | ||
$ColorRect.color = c | ||
|
||
func select(b : bool) -> void: | ||
color = Color(1.0, 1.0, 1.0, 1.0) if b else Color(1.0, 1.0, 1.0, 0.0) | ||
|
||
func _on_ColorSlot_gui_input(event : InputEvent): | ||
if event is InputEventMouseButton and event.pressed: | ||
emit_signal("clicked", self) | ||
|
||
func _get_drag_data(_position): | ||
var preview = ColorRect.new() | ||
preview.color = $ColorRect.color | ||
preview.custom_minimum_size = Vector2(32, 32) | ||
set_drag_preview(preview) | ||
return $ColorRect.color | ||
|
||
|
||
func _on_color_rect_draw() -> void: | ||
if button_pressed: | ||
var picker_icon := get_theme_icon("color_picker", "MM_Icons") | ||
$ColorRect.draw_texture(picker_icon, ($ColorRect.get_rect().size-picker_icon.get_size())/2.0) |
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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://cqalnln5sq2ff"] | ||
|
||
[ext_resource type="Script" path="res://material_maker/panels/reference/color_slot.gd" id="1"] | ||
[ext_resource type="Script" uid="uid://ctlul33mwpeby" path="res://material_maker/panels/reference/color_slot.gd" id="1"] | ||
|
||
[node name="ColorSlot" type="ColorRect"] | ||
[node name="ColorSlot" type="Button"] | ||
custom_minimum_size = Vector2(32, 32) | ||
offset_right = 32.0 | ||
offset_bottom = 32.0 | ||
color = Color(1, 1, 1, 0) | ||
toggle_mode = true | ||
script = ExtResource("1") | ||
|
||
[node name="ColorRect" type="ColorRect" parent="."] | ||
layout_mode = 0 | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_left = 2.0 | ||
offset_top = 2.0 | ||
offset_right = -2.0 | ||
offset_bottom = -2.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
mouse_filter = 2 | ||
color = Color(0.501961, 0.501961, 0.501961, 1) | ||
|
||
[connection signal="gui_input" from="." to="." method="_on_ColorSlot_gui_input"] | ||
[connection signal="draw" from="ColorRect" to="." method="_on_color_rect_draw"] |
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
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
Oops, something went wrong.