mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 16:14:43 -04:00
Added GPL importer, new palette classes for clarification
This commit is contained in:
parent
73f550f723
commit
770c633db2
10 changed files with 327 additions and 133 deletions
42
Scripts/Palette/PaletteColor.gd
Normal file
42
Scripts/Palette/PaletteColor.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
extends Reference
|
||||
|
||||
class_name PaletteColor
|
||||
func get_class(): return "PaletteColor"
|
||||
func is_class(name): return name == "PaletteColor" or .is_class(name)
|
||||
|
||||
var color : Color = Color.black setget _set_color
|
||||
var data : String = "" setget _set_data
|
||||
var name : String = "no name"
|
||||
|
||||
func _init(new_color : Color = Color.black, new_name : String = "no name"):
|
||||
self.color = new_color
|
||||
self.name = new_name
|
||||
|
||||
func _set_color(new_value : Color) -> void:
|
||||
color = new_value
|
||||
data = color.to_html(true)
|
||||
|
||||
func _set_data(new_value : String) -> void:
|
||||
data = new_value
|
||||
color = Color(data)
|
||||
|
||||
func toDict() -> Dictionary:
|
||||
var result = {
|
||||
"data" : data,
|
||||
"name" : name
|
||||
}
|
||||
return result
|
||||
|
||||
func fromDict(input_dict : Dictionary) -> PaletteColor:
|
||||
var result = get_script().new()
|
||||
|
||||
result.data = input_dict.data
|
||||
result.name = input_dict.name
|
||||
|
||||
return result
|
||||
|
||||
func duplicate() -> PaletteColor:
|
||||
var copy : PaletteColor = get_script().new()
|
||||
copy.data = data
|
||||
copy.name = name
|
||||
return copy
|
Loading…
Add table
Add a link
Reference in a new issue