Skip to content

Commit

Permalink
Add palette generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariasteam committed Jan 8, 2019
1 parent b88572e commit 6b63011
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 0 deletions.
205 changes: 205 additions & 0 deletions Scenes/Palette_tester.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
[gd_scene load_steps=2 format=1]

[ext_resource path="res://palette_tester.gd" type="Script" id=1]

[node name="Control" type="Control"]

anchor/left = 3
anchor/right = 3
rect/scale = Vector2( 2, 2 )
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 351.0
margin/top = 9.0
margin/right = 311.0
margin/bottom = 49.0
script/script = ExtResource( 1 )

[node name="Panel" type="Panel" parent="."]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = -5.0
margin/top = -6.0
margin/right = 354.0
margin/bottom = 118.0

[node name="HBoxContainer" type="HBoxContainer" parent="."]

focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 350.0
margin/bottom = 113.0
alignment = 0

[node name="GridContainer" type="GridContainer" parent="HBoxContainer"]

focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 3
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 173.0
margin/bottom = 113.0
custom_constants/vseparation = 10
custom_constants/hseparation = 10
columns = 2

[node name="Column_lbl" type="Label" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 67.0
margin/bottom = 31.0
text = "Column"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="col_edit" type="TextEdit" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 3
size_flags/vertical = 3
margin/left = 77.0
margin/top = 0.0
margin/right = 173.0
margin/bottom = 31.0
syntax_highlighting = false
show_line_numbers = false
highlight_all_occurrences = false
caret/block_caret = false
caret/caret_blink = false
caret/caret_blink_speed = 0.65

[node name="Platform_good_lbl" type="Label" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 41.0
margin/right = 67.0
margin/bottom = 72.0
text = "Platform A"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="good_edit" type="TextEdit" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 3
size_flags/vertical = 3
margin/left = 77.0
margin/top = 41.0
margin/right = 173.0
margin/bottom = 72.0
syntax_highlighting = false
show_line_numbers = false
highlight_all_occurrences = false
caret/block_caret = false
caret/caret_blink = false
caret/caret_blink_speed = 0.65

[node name="Platform_bad_lbl" type="Label" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 82.0
margin/right = 67.0
margin/bottom = 113.0
text = "Platform B"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="bad_edit" type="TextEdit" parent="HBoxContainer/GridContainer"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 3
size_flags/vertical = 3
margin/left = 77.0
margin/top = 82.0
margin/right = 173.0
margin/bottom = 113.0
syntax_highlighting = false
show_line_numbers = false
highlight_all_occurrences = false
caret/block_caret = false
caret/caret_blink = false
caret/caret_blink_speed = 0.65

[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]

focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 3
size_flags/vertical = 2
margin/left = 177.0
margin/top = 0.0
margin/right = 350.0
margin/bottom = 113.0
alignment = 0

[node name="Apply_Button" type="Button" parent="HBoxContainer/VBoxContainer"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 3
size_flags/vertical = 3
margin/left = 0.0
margin/top = 0.0
margin/right = 173.0
margin/bottom = 54.0
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
text = "Apply"
flat = false

[node name="Dark_Button" type="Button" parent="HBoxContainer/VBoxContainer"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 3
size_flags/vertical = 3
margin/left = 0.0
margin/top = 58.0
margin/right = 173.0
margin/bottom = 113.0
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
text = "Dark"
flat = false

[node name="Spatial" type="Spatial" parent="."]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )

[connection signal="pressed" from="HBoxContainer/VBoxContainer/Apply_Button" to="." method="_on_Apply_Button_pressed"]

[connection signal="pressed" from="HBoxContainer/VBoxContainer/Dark_Button" to="." method="_on_Dark_Button_pressed"]


29 changes: 29 additions & 0 deletions palette_tester.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
extends Control

onready var col = get_node("HBoxContainer/GridContainer/col_edit")
onready var good = get_node("HBoxContainer/GridContainer/good_edit")
onready var bad = get_node("HBoxContainer/GridContainer/bad_edit")

var game_scene = preload ("res://Scenes/Column.tscn")

onready var sp = get_node("Spatial")

func _ready():
pass

func _on_Apply_Button_pressed():
var color_col = Color(col.get_text())
var color_good = Color(good.get_text())
var color_bad = Color(bad.get_text())

global.mat_regular.set_parameter(FixedMaterial.PARAM_DIFFUSE, Color(color_good))
global.mat_bad.set_parameter(FixedMaterial.PARAM_DIFFUSE, Color(color_bad))
global.mat_column.set_parameter(FixedMaterial.PARAM_DIFFUSE, Color(color_col))

sp.queue_free()
sp = game_scene.instance()
add_child(sp)


func _on_Dark_Button_pressed():
pass # replace with function body

0 comments on commit 6b63011

Please sign in to comment.