Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combo demo #24

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions combo-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Mono-specific ignores
.mono/
data_*/
8 changes: 8 additions & 0 deletions combo-demo/Game.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]

[node name="Game" type="Node2D"]

[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 937, 585 )
21 changes: 21 additions & 0 deletions combo-demo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 GDQuest

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions combo-demo/addons/ColorPickerPresets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Mono-specific ignores
.mono/
data_*/
23 changes: 23 additions & 0 deletions combo-demo/addons/ColorPickerPresets/ColorPickerPresets.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
tool
extends EditorPlugin

const PRESETS_FILENAME := 'presets.hex'


func _enter_tree() -> void:
var presets := PoolColorArray()
var presets_raw := PoolStringArray()
var presets_file := File.new()
var presets_path: String = get_script().resource_path.get_base_dir().plus_file(PRESETS_FILENAME)

if presets_file.open(presets_path, File.READ) == OK:
presets_raw = presets_file.get_as_text().split("\n")
presets_file.close()

for hex in presets_raw:
if hex.is_valid_html_color():
presets.push_back(Color(hex))

get_editor_interface().get_editor_settings().set_project_metadata(
"color_picker", "presets", presets
)
21 changes: 21 additions & 0 deletions combo-demo/addons/ColorPickerPresets/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Răzvan C. Rădulescu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 40 additions & 0 deletions combo-demo/addons/ColorPickerPresets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Godot ColorPicker Presets

Reads a color presets hex file in the addon local directory, called `presets.hex`. It adds the colors to the editor ColorPicker for quick access.

This repository includes a `presets.hex` file as an example. It's the [Pear36 color palette](https://lospec.com/palette-list/pear36) and you can directly download it from lospec.

![lospec download](./readme/lospec-download.png)

Follow the format of placing one hex color value per line:

```
5e315b
8c3f5d
ba6156
etc.
```

## ✗ WARNING

The addon:

1. Doesn't check the length of the color palette/file.
1. Skips malformed text lines without warning. It uses the ones it can convert to `Color`.
1. Overwrites the _ColorPicker_ presets whenever you reopen the project or re-enable the addon.

## ✓ Install

1. Make a new folder at `res://addons/ColorPickerPresets/`.
1. Copy the contents of this repository into `res://addons/ColorPickerPresets/`.
1. Replace `res://addons/ColorPickerPresets/presets.hex` with your prefered version.
1. Enable the addon from `Project > Project Settings... > Plugins`.
1. Profit.

![install project settings](./readme/install-project-settings.png)

## Where do I find the presets?

They'll be available in the editor _ColorPicker_.

![ColorPicker presets](./readme/colorpicker-presets.png)
9 changes: 9 additions & 0 deletions combo-demo/addons/ColorPickerPresets/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[plugin]

name="ColorPickerPresets"
description="Sets the editor color picker presets from
`presets.hex`, if it exists. The file is local to the
addon folder."
author="Răzvan Cosmin Rădulescu - razcore"
version="0.1"
script="ColorPickerPresets.gd"
11 changes: 11 additions & 0 deletions combo-demo/addons/ColorPickerPresets/presets.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
090a20
171830
303049
4a4b63
928fb8
3dff6e
f5fafa
fff540
26c6f7
aa00ba
ff1852
Binary file added combo-demo/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/icon.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added combo-demo/interface/checkbox_checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/interface/checkbox_checked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/checkbox_checked.png-12eabc30b54c2ae69ab7b7355b90b340.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://interface/checkbox_checked.png"
dest_files=[ "res://.import/checkbox_checked.png-12eabc30b54c2ae69ab7b7355b90b340.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/interface/checkbox_disabled_checked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/checkbox_disabled_checked.png-68f092b33814e626b50d028094fade47.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://interface/checkbox_disabled_checked.png"
dest_files=[ "res://.import/checkbox_disabled_checked.png-68f092b33814e626b50d028094fade47.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added combo-demo/interface/checkbox_disabled_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/interface/checkbox_disabled_empty.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/checkbox_disabled_empty.png-f6f9d65ecb79bc3df4d291bdb9a2d97f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://interface/checkbox_disabled_empty.png"
dest_files=[ "res://.import/checkbox_disabled_empty.png-f6f9d65ecb79bc3df4d291bdb9a2d97f.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added combo-demo/interface/checkbox_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/interface/checkbox_empty.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/checkbox_empty.png-f0498668c78a4185a4f68e2f8e65d543.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://interface/checkbox_empty.png"
dest_files=[ "res://.import/checkbox_empty.png-f0498668c78a4185a4f68e2f8e65d543.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added combo-demo/interface/checkbox_radio_checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions combo-demo/interface/checkbox_radio_checked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/checkbox_radio_checked.png-53cd6010aa5406f49aefb70eabd4a41d.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://interface/checkbox_radio_checked.png"
dest_files=[ "res://.import/checkbox_radio_checked.png-53cd6010aa5406f49aefb70eabd4a41d.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added combo-demo/interface/checkbox_radio_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading