8639cecf4c
The scripts were streamlined using more or less the following conventions: - space after a comma in lists of arguments - space around weak operators (+, -), no space around strong operators (*, /) - space after a comment start (#) - removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now) - function blocks separate by two newlines The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
20 lines
377 B
GDScript
20 lines
377 B
GDScript
|
|
extends ColorPickerButton
|
|
|
|
|
|
func get_drag_data(pos):
|
|
# use another colorpicker as drag preview
|
|
var cpb = ColorPickerButton.new()
|
|
cpb.set_color(get_color())
|
|
cpb.set_size(Vector2(50, 50))
|
|
set_drag_preview(cpb)
|
|
# return color as drag data
|
|
return get_color()
|
|
|
|
|
|
func can_drop_data(pos, data):
|
|
return typeof(data) == TYPE_COLOR
|
|
|
|
|
|
func drop_data(pos, data):
|
|
set_color(data)
|