├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── addons
└── sprite-shader-mixer
│ ├── assets
│ ├── background.jpg
│ ├── background.jpg.import
│ ├── icons
│ │ ├── AnimatedSprite2DShaderMixer.svg
│ │ ├── AnimatedSprite2DShaderMixer.svg.import
│ │ ├── Sprite2DShaderMixer.svg
│ │ ├── Sprite2DShaderMixer.svg.import
│ │ ├── add.svg
│ │ ├── add.svg.import
│ │ ├── close.svg
│ │ ├── close.svg.import
│ │ ├── delete.svg
│ │ ├── delete.svg.import
│ │ ├── down.svg
│ │ ├── down.svg.import
│ │ ├── download.svg
│ │ ├── download.svg.import
│ │ ├── right.svg
│ │ ├── right.svg.import
│ │ ├── sync.svg
│ │ ├── sync.svg.import
│ │ ├── up.svg
│ │ └── up.svg.import
│ ├── shaders
│ │ ├── _readme.txt
│ │ ├── empty.gdshader
│ │ └── noise
│ │ │ └── _readme.txt
│ └── supergodot
│ │ ├── supergodot-0000.png
│ │ ├── supergodot-0000.png.import
│ │ ├── supergodot-0001.png
│ │ ├── supergodot-0001.png.import
│ │ ├── supergodot-0002.png
│ │ ├── supergodot-0002.png.import
│ │ ├── supergodot-0003.png
│ │ ├── supergodot-0003.png.import
│ │ ├── supergodot-0004.png
│ │ ├── supergodot-0004.png.import
│ │ ├── supergodot-0005.png
│ │ ├── supergodot-0005.png.import
│ │ ├── supergodot-0006.png
│ │ ├── supergodot-0006.png.import
│ │ ├── supergodot-0007.png
│ │ ├── supergodot-0007.png.import
│ │ ├── supergodot-0008.png
│ │ ├── supergodot-0008.png.import
│ │ ├── supergodot-0009.png
│ │ ├── supergodot-0009.png.import
│ │ ├── supergodot-0010.png
│ │ ├── supergodot-0010.png.import
│ │ ├── supergodot-0011.png
│ │ ├── supergodot-0011.png.import
│ │ ├── supergodot-0012.png
│ │ ├── supergodot-0012.png.import
│ │ ├── supergodot-0013.png
│ │ ├── supergodot-0013.png.import
│ │ ├── supergodot-0014.png
│ │ ├── supergodot-0014.png.import
│ │ ├── supergodot-0015.png
│ │ ├── supergodot-0015.png.import
│ │ ├── supergodot-0016.png
│ │ ├── supergodot-0016.png.import
│ │ ├── supergodot-0017.png
│ │ ├── supergodot-0017.png.import
│ │ ├── supergodot-0018.png
│ │ ├── supergodot-0018.png.import
│ │ ├── supergodot-0019.png
│ │ └── supergodot-0019.png.import
│ ├── plugin.cfg
│ └── src
│ ├── domain
│ ├── ShaderInfo.gd
│ └── ShaderInfoParameter.gd
│ ├── extension
│ ├── ExtensionLogic.gd
│ ├── ExtensionView.gd
│ ├── ExtensionView.tscn
│ ├── searchform
│ │ ├── searchform.gd
│ │ └── searchform.tscn
│ └── shaderinfo
│ │ ├── ShaderInfoContainer.gd
│ │ ├── ShaderInfoContainer.tscn
│ │ └── parameter
│ │ ├── ShaderInfoParameterContainer.gd
│ │ └── ShaderInfoParameterContainer.tscn
│ ├── plugin
│ ├── SpriteShaderMixerEditorInspectorPlugin.gd
│ └── SpriteShaderMixerEditorPlugin.gd
│ └── util
│ ├── Util.gd
│ └── UtilHTTP.gd
├── demo
├── assets
│ ├── godot-text.png
│ ├── godot-text.png.import
│ ├── shaders
│ │ ├── chars_texture3x3.png
│ │ ├── chars_texture3x3.png.import
│ │ ├── example1.gdshader
│ │ ├── example2.gdshader
│ │ ├── example3.gdshader
│ │ ├── noise1.png
│ │ └── noise1.png.import
│ └── supergodot
│ │ ├── animation.tres
│ │ └── supergodot-anim.kra
└── demo.tscn
├── icon.png
├── icon.png.import
├── icon.svg
├── icon.svg.import
└── project.godot
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize EOL for all files that Git considers text files.
2 | * text=auto eol=lf
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Godot 4+ specific ignores
2 | .godot/
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 José Amuedo Salmerón
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GODOT Sprite Shader Mixer
2 | Ok, here we are.
3 |
4 | [](https://github.com/YourUsername/YourRepository/LICENSE)
5 | [](https://godotengine.org/)
6 |
7 | Some examples of what this addon can do:
8 |
9 | 
10 |
11 | 
12 |
13 | 
14 |
15 | 
16 |
17 | 
18 |
19 | 
20 |
21 | Disclaimer: This project is inspired by [godot-sprite-shader](https://github.com/duongvituan/godot-sprite-shader) by duongvituan. Initially I've got and adapted a lot of shaders from there, and also from the great web page https://godotshaders.com/. I want to express my sincere gratitude for the inspiration them provided.
22 |
23 | ## Description
24 |
25 | The Godot Sprite Shader Mixer is a plugin for Godot that allows Sprite2D and AnimationSprite2D (since version 1.2 also Label and ColorRect) nodes to blend shaders from a list of available shaders. Users can select and add shaders to sprites dynamically, automatically downloading them from GitHub as needed. The plugin handles shader generation and blending, resulting in a texture that combines all selected shaders.
26 |
27 | ## Features
28 |
29 | - Dynamic blending of shaders on Sprite2D and AnimationSprite2D nodes (since 1.2 version also Label and ColorRect).
30 | - Automatic shader downloading from GitHub.
31 | - Generation and application of combined shaders.
32 | - Customization of the intensity of each shader.
33 | - Search Manager with preview
34 |
35 | ## Installation
36 |
37 | To use this plugin, follow these steps:
38 |
39 | 1. Download the repository or clone it into your Godot project.
40 | 2. Enable the plugin in your project's settings.
41 | 3. Open the "Plugins" window in Godot and configure the options as needed.
42 |
43 | 
44 |
45 |
46 | ## Usage
47 |
48 | 1. Add a Sprite2D or AnimationSprite2D (since version 1.2 also Label and ColorRect) node to your scene with a texture or animation.
49 |
50 | 
51 |
52 | 2. In the Inspector tab, you will find a new section called "Create Shader Mixer."
53 |
54 | 
55 |
56 | 3. Once done, the section will grow. The first time you need to download (or sync) the list of available shaders at this github page. Click on "Sync List".
57 |
58 | 
59 |
60 | 4. Wait and you will get a list of available shaders. The list can grow over time when new shaders are available.
61 |
62 | 
63 |
64 | 5. Select one shader. The first time you will need to download the shader, and textures if needed.
65 |
66 | 
67 |
68 | 6. Wait for the download and you will see the shader applied to the texture.
69 |
70 | 
71 |
72 | 8. You can adjust all the parameters of the shader going directly to the shader params, at the material->shader inspector. It works like any shader, nothing special. The interesting part is that the plugin created that shader for you. But that's not all.
73 |
74 | 
75 |
76 | 10. Go again and select a different shader, now you can mix them. The plugin will download, and create a new shader blending both shaders!
77 |
78 | 
79 |
80 | 12. By the way, you can see info about the shader if you press the "List of Current Shaders" button
81 |
82 | 
83 |
84 | 14. You can reorder the shaders, it affects the way they are mixed. You can quit a shader from your shader code. You can also remove the downloaded shader (you can download it again later). Be free and experiment with it!
85 |
86 |
87 | 15. The point is that the plugin creates a shader script for your texture with the shaders you select. The collection will grow, it is open to incorporate new shaders easily, just making a pull request over the shaders branch. So, consider sync the shader list to see if there are new shaders available. (explained later)
88 |
89 |
90 | ## Contribution
91 |
92 | Contributions are more than welcome! This is a tool I need for my own game.
93 | Yes, I come from Unity and I needed something like this :D.
94 | The point is that it is difficult to maintain by only one person, so contributions are more than needed.
95 | If you wish to improve this project, please:
96 |
97 | 1. Open an issue to discuss your ideas or problems.
98 | 2. Fork the repository, make your changes, and create a pull request.
99 | 3. Make sure to follow the contribution guidelines and code of conduct.
100 |
101 | ## HEY! I want to add a new Shader for this incredible tool!
102 | Great! that's the idea, increase the collection of shaders. One of the positive things about this plugin is that it doesn't have the shaders inside, it downloads them from this page when the user wants to apply the shader and mix with others. Therefore, we can grow with new shaders, without affecting them.
103 |
104 | First of all, all the shaders are in a separate branch of this project:
105 | https://github.com/spheras/godot-sprite-shader-mixer/tree/v1/shaders
106 |
107 | I mean, if you only want to add a new shader, you only need to PR that branch.
108 | The plugin will get shaders from this branch, syncing what shaders are available. There are three main aspects to consider:
109 |
110 | 1. The file shaders.json. This file contains the definition of all the available shaders. If you want to add a new one, you will need to add a new shader info there.
111 | 2. The shader (.gdshader) itself. The shader info JSON contains the filename of the shader, among other info. It must be unique as possible, to avoid conflicts with other shaders.
112 | 3. Textures. Some shader parameters need to put textures inside. The plugin sets those texture parameters with a texture image.
113 |
114 |
115 |
116 | ## License
117 |
118 | This project is licensed under the [MIT License](LICENSE).
119 |
120 | ---
121 |
122 | Thank you for your interest in Godot Sprite Shader Mixer! If you have any questions, suggestions, or issues, please feel free to contact me.
123 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/background.jpg
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/background.jpg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bql2ueidhx0gr"
6 | path="res://.godot/imported/background.jpg-8a69c144e29a6851ffe8f1223f8b9ca9.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/background.jpg"
14 | dest_files=["res://.godot/imported/background.jpg-8a69c144e29a6851ffe8f1223f8b9ca9.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/AnimatedSprite2DShaderMixer.svg:
--------------------------------------------------------------------------------
1 |
2 |
84 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/AnimatedSprite2DShaderMixer.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://4lyiadv8asiv"
6 | path="res://.godot/imported/AnimatedSprite2DShaderMixer.svg-86361938518bc7e48b213c4733bbcb02.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/AnimatedSprite2DShaderMixer.svg"
14 | dest_files=["res://.godot/imported/AnimatedSprite2DShaderMixer.svg-86361938518bc7e48b213c4733bbcb02.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/Sprite2DShaderMixer.svg:
--------------------------------------------------------------------------------
1 |
2 |
80 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/Sprite2DShaderMixer.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b00p80u83d33j"
6 | path="res://.godot/imported/Sprite2DShaderMixer.svg-d9b9620201145e7365fba9dadeef60a0.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/Sprite2DShaderMixer.svg"
14 | dest_files=["res://.godot/imported/Sprite2DShaderMixer.svg-d9b9620201145e7365fba9dadeef60a0.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/add.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/add.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://t0cto3il2buo"
6 | path="res://.godot/imported/add.svg-ed6add9a0a2481bf64200f55eb05f0cd.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/add.svg"
14 | dest_files=["res://.godot/imported/add.svg-ed6add9a0a2481bf64200f55eb05f0cd.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/close.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/close.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bh3ternlmjqxo"
6 | path="res://.godot/imported/close.svg-8bffa5d3c980aa1933a4a6d08f71ac5d.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/close.svg"
14 | dest_files=["res://.godot/imported/close.svg-8bffa5d3c980aa1933a4a6d08f71ac5d.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/delete.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/delete.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://blwvphk004alx"
6 | path="res://.godot/imported/delete.svg-0674a99ea8d6f1bc07d28e43a937c42c.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/delete.svg"
14 | dest_files=["res://.godot/imported/delete.svg-0674a99ea8d6f1bc07d28e43a937c42c.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/down.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/down.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cpxfo28hww3v5"
6 | path="res://.godot/imported/down.svg-f9590906b36128b04bb054adb0d291d5.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/down.svg"
14 | dest_files=["res://.godot/imported/down.svg-f9590906b36128b04bb054adb0d291d5.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/download.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/download.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b1rygy2x8jbew"
6 | path="res://.godot/imported/download.svg-00990617501e698c0469425b2f7922eb.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/download.svg"
14 | dest_files=["res://.godot/imported/download.svg-00990617501e698c0469425b2f7922eb.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/right.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/right.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://nsea1n1hugod"
6 | path="res://.godot/imported/right.svg-1ab3cf0d3b8f634ba24184a11184f4f7.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/right.svg"
14 | dest_files=["res://.godot/imported/right.svg-1ab3cf0d3b8f634ba24184a11184f4f7.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/sync.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/sync.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b30x1ipn1kw8j"
6 | path="res://.godot/imported/sync.svg-bd3bf85830b71f16b866070bdeb0f360.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/sync.svg"
14 | dest_files=["res://.godot/imported/sync.svg-bd3bf85830b71f16b866070bdeb0f360.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/up.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/icons/up.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dcf5gngxrgfkl"
6 | path="res://.godot/imported/up.svg-95f00366ffa3f229768bfa3b134be3fe.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/icons/up.svg"
14 | dest_files=["res://.godot/imported/up.svg-95f00366ffa3f229768bfa3b134be3fe.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/shaders/_readme.txt:
--------------------------------------------------------------------------------
1 | this folder store all the shaders downloaded from the github place.
2 | You can remove the shaders extra files, but don't remove these files:
3 | - empty.gdshader
4 | - the folder itself
5 | - the noise folder
6 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/shaders/empty.gdshader:
--------------------------------------------------------------------------------
1 | //ATTENTION:
2 | // THIS IS SHADE AUTOGENERATED BY
3 | // THE ADDON SPRITE-SHADER-MIXER
4 | // ANY MANUAL CHANGES WILL BE REMOVED WHEN THE ADDON
5 | // UPDATES THIS SHADER.
6 | // ANYWAY, YOU CAN SAVE THE CURRENT VERSION AS A RESOURCE FILE.
7 | //SHADERS:%SHADERS%
8 | shader_type canvas_item;
9 |
10 | uniform float opacity:hint_range(0.0, 1.0, 0.01)=1.;
11 |
12 | //%FUNCTIONS%
13 |
14 | void fragment() {
15 | vec4 color = texture(TEXTURE, UV);
16 | vec2 size = vec2(textureSize(TEXTURE, 0));
17 | vec2 uv = UV;
18 | vec2 screen_uv = SCREEN_UV;
19 |
20 | //%CALLS%
21 |
22 | color.a*=opacity;
23 | COLOR=color;
24 | }
25 |
26 | void vertex() {
27 | //%VERTEX_CALLS%
28 | }
29 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/shaders/noise/_readme.txt:
--------------------------------------------------------------------------------
1 | this folder store all the textures downloaded from the shaders downloaded.
2 | You can remove the texture files, but don't remove the folder itself
3 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bkmtfe42ptooh"
6 | path="res://.godot/imported/supergodot-0000.png-9bc5c2dbe3bfdd3298f12baaba89158f.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png"
14 | dest_files=["res://.godot/imported/supergodot-0000.png-9bc5c2dbe3bfdd3298f12baaba89158f.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b1o4oqvqpb1qy"
6 | path="res://.godot/imported/supergodot-0001.png-60b5a0bf69310c4967dc127010fe8292.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png"
14 | dest_files=["res://.godot/imported/supergodot-0001.png-60b5a0bf69310c4967dc127010fe8292.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bs33nr7syqox7"
6 | path="res://.godot/imported/supergodot-0002.png-9dfa43908f83e93f9a822eb3b26a86aa.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png"
14 | dest_files=["res://.godot/imported/supergodot-0002.png-9dfa43908f83e93f9a822eb3b26a86aa.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://8wimrai50mn1"
6 | path="res://.godot/imported/supergodot-0003.png-fa27824178f741a4dc80d32d0ffb7211.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png"
14 | dest_files=["res://.godot/imported/supergodot-0003.png-fa27824178f741a4dc80d32d0ffb7211.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dwpufhhaw82ug"
6 | path="res://.godot/imported/supergodot-0004.png-2de8aa910360030e4f80d81b7670af60.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png"
14 | dest_files=["res://.godot/imported/supergodot-0004.png-2de8aa910360030e4f80d81b7670af60.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cihrw6565y3r1"
6 | path="res://.godot/imported/supergodot-0005.png-d74f3a9abf3415d6f8f4f81b2adaa5a4.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png"
14 | dest_files=["res://.godot/imported/supergodot-0005.png-d74f3a9abf3415d6f8f4f81b2adaa5a4.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cblgnfg5ui8df"
6 | path="res://.godot/imported/supergodot-0006.png-2032be1abad07fc1da64d8fc7a642ada.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png"
14 | dest_files=["res://.godot/imported/supergodot-0006.png-2032be1abad07fc1da64d8fc7a642ada.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://xols7iqcmm6u"
6 | path="res://.godot/imported/supergodot-0007.png-3e783610dd2a5037ff6c32c1064e32eb.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png"
14 | dest_files=["res://.godot/imported/supergodot-0007.png-3e783610dd2a5037ff6c32c1064e32eb.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cv1ig6gansjqn"
6 | path="res://.godot/imported/supergodot-0008.png-71c173d07acf74dbdd499e0c112fa74c.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png"
14 | dest_files=["res://.godot/imported/supergodot-0008.png-71c173d07acf74dbdd499e0c112fa74c.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://0e7h0nbb5uxg"
6 | path="res://.godot/imported/supergodot-0009.png-16a3b53351ba9fad8ccec228ae8b58e3.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png"
14 | dest_files=["res://.godot/imported/supergodot-0009.png-16a3b53351ba9fad8ccec228ae8b58e3.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bglwd2chn700u"
6 | path="res://.godot/imported/supergodot-0010.png-78a47d6a28b80aa102edfc7ae238663b.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png"
14 | dest_files=["res://.godot/imported/supergodot-0010.png-78a47d6a28b80aa102edfc7ae238663b.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c145wbhfimwne"
6 | path="res://.godot/imported/supergodot-0011.png-bf67fa23eff4d9a9d2efc4d7c72d8e78.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png"
14 | dest_files=["res://.godot/imported/supergodot-0011.png-bf67fa23eff4d9a9d2efc4d7c72d8e78.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dj4d28tivbgb0"
6 | path="res://.godot/imported/supergodot-0012.png-8b6f94ffe1d34799d4cf23ab9d011388.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png"
14 | dest_files=["res://.godot/imported/supergodot-0012.png-8b6f94ffe1d34799d4cf23ab9d011388.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://7pagyvbmsoey"
6 | path="res://.godot/imported/supergodot-0013.png-2cbbc5db3362993a6b5e616307231307.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png"
14 | dest_files=["res://.godot/imported/supergodot-0013.png-2cbbc5db3362993a6b5e616307231307.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://coqntke8nkel5"
6 | path="res://.godot/imported/supergodot-0014.png-9085e58c7326f3dd124697edbf7c38c6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png"
14 | dest_files=["res://.godot/imported/supergodot-0014.png-9085e58c7326f3dd124697edbf7c38c6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bdoqc7jitaivj"
6 | path="res://.godot/imported/supergodot-0015.png-aa117e362084e72268a2a3807a8521de.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png"
14 | dest_files=["res://.godot/imported/supergodot-0015.png-aa117e362084e72268a2a3807a8521de.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://mwcarsfwblj"
6 | path="res://.godot/imported/supergodot-0016.png-8d4b4ad65ce567f72fc47471ac814de4.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png"
14 | dest_files=["res://.godot/imported/supergodot-0016.png-8d4b4ad65ce567f72fc47471ac814de4.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://d2dubli5df5va"
6 | path="res://.godot/imported/supergodot-0017.png-001d3b472d68d2d8e77e02897f070e39.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png"
14 | dest_files=["res://.godot/imported/supergodot-0017.png-001d3b472d68d2d8e77e02897f070e39.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dqv5ugl4038aj"
6 | path="res://.godot/imported/supergodot-0018.png-635e8af6fcdcb03a27a053e3115b5373.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png"
14 | dest_files=["res://.godot/imported/supergodot-0018.png-635e8af6fcdcb03a27a053e3115b5373.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dn2tu0peutt2u"
6 | path="res://.godot/imported/supergodot-0019.png-5cc650ce6a7ecdee59e978ade122b94c.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png"
14 | dest_files=["res://.godot/imported/supergodot-0019.png-5cc650ce6a7ecdee59e978ade122b94c.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/plugin.cfg:
--------------------------------------------------------------------------------
1 | [plugin]
2 |
3 | name="Sprite Shader Mixer"
4 | description="Addon to work with a sets of shaders, mainliy for sprites, which can be mixed together and downloaded from github to create a custom shader for your Sprite2D and AnimatedSprited2D nodes"
5 | author="spheras"
6 | version="1.0"
7 | script="src/plugin/SpriteShaderMixerEditorPlugin.gd"
8 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/domain/ShaderInfo.gd:
--------------------------------------------------------------------------------
1 | class_name ShaderInfo
2 | extends Object
3 |
4 | const SHADERS_BASE_PATH="res://addons/sprite-shader-mixer/assets/shaders/"
5 | const EMPTY_SHADER_FILE_PATH="res://addons/sprite-shader-mixer/assets/shaders/empty.gdshader"
6 | const EMPTY_SHADER_VARIABLE_SHADERS="%SHADERS%"
7 | const EMPTY_SHADER_VARIABLE_FUNCTIONS="//%FUNCTIONS%"
8 | const EMPTY_SHADER_VARIABLE_FRAGMENT_CALLS="//%CALLS%"
9 | const EMPTY_SHADER_VARIABLE_VERTEX_CALLS="//%VERTEX_CALLS%"
10 | const SHADERS_COMMENT="//SHADERS:"
11 |
12 | var name:String #name of the shader
13 | var group:String #group of the shader
14 | var description:String #description of the shader
15 | var author:String #original author of the shader
16 | var adaptedBy:String #who mades the adaptation to the plugin
17 | var link:String #link to the original shader/author/...
18 | var license:String #license of the original shader
19 | var version:String #version of the adaptation
20 | var filename:String #filename where is located the shader
21 | var activation:String #activation uniform variable name
22 | var function:String #main function of the shader to be called
23 | var customCall:String #Optional, custom call from fragment, list of parameters
24 | var vertex:bool=false #indicates if the shader has vertex functions
25 | var vertexCallCode:String #Optional, in case there is a vertex code, we need the vertex code to add to the vertex function, like calling functions and setting initial values to varying variables
26 | var parameters:Array[ShaderInfoParameter] #List of parameters of the shader
27 |
28 | # Load a shader info values from a json dictionary
29 | # shaderInfoJsonObject the object readed from a json, converted in a dictionary
30 | func loadShaderInfo(shaderInfoJsonObject:Dictionary):
31 | self.name=shaderInfoJsonObject.name
32 | self.group=shaderInfoJsonObject.group
33 | self.description=shaderInfoJsonObject.description
34 | self.author=shaderInfoJsonObject.author
35 | self.version=shaderInfoJsonObject.version
36 | self.filename=shaderInfoJsonObject.filename
37 | self.activation=shaderInfoJsonObject.activation
38 | self.link=shaderInfoJsonObject.link
39 | self.adaptedBy=shaderInfoJsonObject.adaptedBy
40 | self.license=shaderInfoJsonObject.license
41 |
42 | self.function=shaderInfoJsonObject.function
43 | if(shaderInfoJsonObject.has("customCall")):
44 | if(shaderInfoJsonObject.customCall.length()>0):
45 | self.customCall=shaderInfoJsonObject.customCall
46 |
47 | for param in shaderInfoJsonObject.parameters:
48 | var shaderInfoParameter:ShaderInfoParameter=ShaderInfoParameter.new()
49 | shaderInfoParameter.loadParameter(param)
50 | self.parameters.push_back(shaderInfoParameter)
51 |
52 | if(shaderInfoJsonObject.has("vertex")):
53 | self.vertex=shaderInfoJsonObject.vertex
54 |
55 | if(shaderInfoJsonObject.has("vertexCallCode")):
56 | if(shaderInfoJsonObject.vertexCallCode.length()>0):
57 | self.vertexCallCode=shaderInfoJsonObject.vertexCallCode
58 |
59 | # delete this shader phisically and the textures associated
60 | func delete():
61 | if(shaderHasBeenDownloaded(self)):
62 | #delete the gdshader script
63 | Util.deleteFile(SHADERS_BASE_PATH+self.filename)
64 | #delete if necessary the texture images
65 | for param in self.parameters:
66 | if(param.texture!=null && param.texture.length()>0):
67 | var texturePath=SHADERS_BASE_PATH+param.texture
68 | Util.deleteFile(texturePath)
69 |
70 | #delete if neccesary the vertex code
71 | if(vertex && self.vertexCallCode):
72 | var vertexPath=SHADERS_BASE_PATH+self.vertexCallCode
73 | Util.deleteFile(vertexPath)
74 |
75 | OS.alert("Shader Removed, you can download again if necessary. See you!")
76 |
77 | # static function to read the currently active shaders from the shader script
78 | # selectedShadersCode -> the shader code to read
79 | # allShaders -> the list of all shaders available
80 | # return -> the list of currently shaders inside the shader code
81 | static func readCurrentlyActiveShadersFromShaderCode(selectedShadersCode:String, allShaders:Array[ShaderInfo])->Array[ShaderInfo]:
82 | var lines:PackedStringArray=selectedShadersCode.split("\n")
83 | var result:Array[ShaderInfo]=[]
84 | for line in lines:
85 | var lineTrimmed=(line as String).trim_prefix(" ")
86 | if (lineTrimmed.begins_with(SHADERS_COMMENT)):
87 | var includedShadersName=lineTrimmed.substr(SHADERS_COMMENT.length()).split(",")
88 | for includedShaderName in includedShadersName:
89 | var shaderInfo=_searchShaderWithName(includedShaderName,allShaders)
90 | if(shaderInfo!=null):
91 | result.append(shaderInfo)
92 | return result
93 | return result
94 |
95 | # private static function to find a ShaderInfo object from the array with a certain name
96 | # shaderName -> the name to search
97 | # allShaders -> the array of shaders where the algorithm must search
98 | # return -> the ShaderInfo object found or null otherwise
99 | static func _searchShaderWithName(shaderName:String, allShaders:Array[ShaderInfo]) -> ShaderInfo:
100 | for shader in allShaders:
101 | if(shader.name.match(shaderName)):
102 | return shader
103 | return null
104 |
105 | # private static function to replace variables inside the empty shader. Those variables are
106 | # relatives to the list of shaders, the functions, the calls... converting the empty shader
107 | # in a valid full shader with the selected shaders
108 | # shaders: the list of shaders included in the code
109 | # functions: the code of the shaders
110 | # calls: the calls to the shaders from fragment
111 | # vertexCall: the call to the shaders from the vertex
112 | # return-> the final shader code with all merged
113 | static func _replaceScriptVariables(shaders:String, functions:String, calls:String, vertexCalls:String)->String:
114 | var contentOfEmptyShader=Util.readFile(EMPTY_SHADER_FILE_PATH)
115 | contentOfEmptyShader=contentOfEmptyShader.replace(EMPTY_SHADER_VARIABLE_SHADERS,shaders)
116 | contentOfEmptyShader=contentOfEmptyShader.replace(EMPTY_SHADER_VARIABLE_FUNCTIONS,functions)
117 | contentOfEmptyShader=contentOfEmptyShader.replace(EMPTY_SHADER_VARIABLE_FRAGMENT_CALLS,calls)
118 | contentOfEmptyShader=contentOfEmptyShader.replace(EMPTY_SHADER_VARIABLE_VERTEX_CALLS,vertexCalls)
119 | return contentOfEmptyShader
120 |
121 | # static function to check whether a specific shader has been downloaded already or not
122 | # shader -> the shader to check
123 | # return -> true if the shader has been downloaded, false otherwise
124 | static func shaderHasBeenDownloaded(shader:ShaderInfo)->bool:
125 | return FileAccess.file_exists(SHADERS_BASE_PATH+shader.filename)
126 |
127 | # static function to generate a shader code based on the selected shaders to incorporate.
128 | # selectedShaders -> a list of selected shaders to generate the shader code
129 | # return -> the shader object generated with the code inside
130 | static func generateShaderCode(selectedShaders:Array[ShaderInfo])->Shader:
131 | var functionsCode:String=""
132 | for selectedShader in selectedShaders:
133 | #fragment functions
134 | var contentOfSelectedShader=Util.readFile(SHADERS_BASE_PATH+selectedShader.filename)
135 | functionsCode=functionsCode+"\n"+contentOfSelectedShader
136 |
137 | var shadersCode=""
138 | for selectedShader in selectedShaders:
139 | shadersCode=shadersCode + selectedShader.name + ","
140 |
141 | var callsCode=""
142 | for selectedShader in selectedShaders:
143 | var parameters="uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color";
144 | if(selectedShader.customCall!=null && selectedShader.customCall.length()>0):
145 | parameters=selectedShader.customCall;
146 | callsCode=callsCode+"\tif("+selectedShader.activation+") "+selectedShader.function+"("+parameters+");\n"
147 |
148 | var vertexCode=""
149 | for selectedShader in selectedShaders:
150 | if(selectedShader.vertex && selectedShader.vertexCallCode!=null && selectedShader.vertexCallCode.length()>0):
151 | var vertexCodeOfSelectedShader=Util.readFile(SHADERS_BASE_PATH+selectedShader.vertexCallCode)
152 | vertexCode=vertexCode+"\n"+vertexCodeOfSelectedShader
153 |
154 |
155 | var shaderCode=_replaceScriptVariables(shadersCode, functionsCode, callsCode, vertexCode)
156 | var shader=Shader.new()
157 | shader.code=shaderCode
158 | return shader
159 |
160 |
161 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/domain/ShaderInfoParameter.gd:
--------------------------------------------------------------------------------
1 | class_name ShaderInfoParameter
2 | extends Object
3 |
4 | var name:String
5 | var description:String
6 | var texture:String
7 |
8 | # function to load the parameter values from a json dictionary
9 | # shaderParameterJson -> the dictionary containing the properties
10 | func loadParameter(shaderParameterJson:Dictionary):
11 | self.name=shaderParameterJson.name
12 | self.description=shaderParameterJson.description
13 | if(shaderParameterJson.has("texture")):
14 | if(shaderParameterJson.texture.length()>0):
15 | self.texture=shaderParameterJson.texture
16 |
17 | # static function to check whether a specific shader has been downloaded already or not
18 | # shader -> the shader to check
19 | # return -> true if the shader has been downloaded, false otherwise
20 | func textureHasBeenDownloaded()->bool:
21 | if(self.texture!=null && self.texture.length()>0):
22 | return FileAccess.file_exists("res://addons/sprite-shader-mixer/assets/shaders/"+self.texture)
23 | return true
24 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/ExtensionLogic.gd:
--------------------------------------------------------------------------------
1 | class_name ExtensionLogic
2 | extends Object
3 |
4 | #SIGNALS
5 | signal onCreateContainerVisible(visible:bool)
6 | signal onDownloadButtonVisible(visible:bool)
7 | signal onSyncButtonVisible(visible:bool)
8 | signal onAddShaderButtonVisible(visible:bool)
9 | signal onShadersCalculated(shadersInserted:Array[ShaderInfo], shadersNotInserted:Array[ShaderInfo])
10 |
11 | #RESOURCES
12 | const SHADERS_JSON_LOCAL_PATH="res://addons/sprite-shader-mixer/assets/shaders/shaders.json"
13 | const SHADERS_JSON_GITHUB_DOMAIN="raw.githubusercontent.com"
14 | const SHADERS_JSON_GITHUB_PATH="/spheras/godot-sprite-shader-mixer/v1/shaders/shaders.json"
15 | const SHADERS_GITHUB_DOMAIN="raw.githubusercontent.com"
16 | const SHADERS_GITHUB_BASE_PATH="/spheras/godot-sprite-shader-mixer/v1/shaders/"
17 | const SHADERS_LOCAL_BASE_PATH="res://addons/sprite-shader-mixer/assets/shaders/"
18 |
19 | #PROPERTIES
20 | static var NONE_SHADER:String="None"
21 | var parentSprite #The parent sprite to set the shaders. It can be a Sprite2D or an AnimatedSprite2D
22 | var ALL_SHADERS:Array[ShaderInfo]=[] #list of all available shaders
23 | var selectedShaders:Array[ShaderInfo]=[] #list of selected shaders in the sprite
24 | var pendingShaders:Array[ShaderInfo]=[] #list of pending available shaders
25 |
26 |
27 | func onReady():
28 | self._checkCreateVisibility()
29 |
30 | # Set the parent which is owner of the shader to manipulate
31 | # parent -> Sprite2D or AnimationSprite2D
32 | func setParentSprite(parent)->void:
33 | assert(parent is Sprite2D || parent is AnimatedSprite2D || parent is Label || parent is ColorRect)
34 | self.parentSprite=parent;
35 | self._checkCreateVisibility()
36 |
37 | # find a shader info by its name
38 | # shaderName -> the name to search
39 | # return -> the ShaderInfo found or null otherwise
40 | func _findShaderInfo(shaderName:String) -> ShaderInfo:
41 | for shader in ALL_SHADERS:
42 | if(shader.name.match(shaderName)):
43 | return shader
44 | return null
45 |
46 | # Function called when a shader is intended to be added
47 | # shader -> the shader name to be added
48 | func onAddShaderPressed(shaderName:String)->void:
49 | for shaderToAdd in pendingShaders:
50 | if(shaderToAdd.name.match(shaderName)):
51 | if(shaderToAdd.vertex):
52 | self.selectedShaders.insert(0,shaderToAdd)
53 | else:
54 | self.selectedShaders.append(shaderToAdd)
55 | self.pendingShaders.erase(shaderToAdd)
56 | var newShader:Shader=ShaderInfo.generateShaderCode(self.selectedShaders)
57 | (self.parentSprite.material as ShaderMaterial).shader=newShader
58 |
59 | for param in shaderToAdd.parameters:
60 | if(param.texture!=null && param.texture.length()>0):
61 | var texturePath=SHADERS_LOCAL_BASE_PATH+param.texture
62 | var textureRes:CompressedTexture2D=ResourceLoader.load(texturePath)
63 | (self.parentSprite.material as ShaderMaterial).set_shader_parameter(param.name,textureRes)
64 |
65 | self._calculateShadersInserted()
66 | return
67 |
68 | # Function called when the user wants to download a shader from github
69 | # shaderName -> the name of the shader to download
70 | # node -> the parent node, just for hack purposes
71 | # text -> if the download is for testing the shader (true) or we want to really download and run the texture
72 | func onDownloadShaderPressed(shaderName:String, node:Node, test:bool=false)->void:
73 | var shaderInfo=_findShaderInfo(shaderName)
74 | if(shaderInfo!=null):
75 | var shaderGithubPath=SHADERS_GITHUB_BASE_PATH +shaderInfo.filename
76 | print("Downloading Shader...")
77 | print(" %s/%s" % [SHADERS_GITHUB_DOMAIN,shaderGithubPath])
78 | print("please wait...")
79 | var shaderContent=await UtilHTTP.httpsDownloadJson(SHADERS_GITHUB_DOMAIN, shaderGithubPath)
80 | var shaderPath=SHADERS_LOCAL_BASE_PATH+shaderInfo.filename
81 | Util.saveFile(shaderPath,shaderContent)
82 | print("Saved shader to: ", shaderPath)
83 | if(!test):
84 | self.onDownloadButtonVisible.emit(false)
85 | self.onAddShaderButtonVisible.emit(true)
86 |
87 | #Download vertex code if neceesary
88 | if(shaderInfo.vertex):
89 | var vertexGithubPath=SHADERS_GITHUB_BASE_PATH +shaderInfo.vertexCallCode
90 | var vertexContent=await UtilHTTP.httpsDownloadJson(SHADERS_GITHUB_DOMAIN, vertexGithubPath)
91 | var vertexPath=SHADERS_LOCAL_BASE_PATH+shaderInfo.vertexCallCode
92 | Util.saveFile(vertexPath,vertexContent)
93 | print("Saved vertex to: ", vertexPath)
94 |
95 | var anyTexturePathToSolveBug:String=""
96 | for param in shaderInfo.parameters:
97 | if (!(param as ShaderInfoParameter).textureHasBeenDownloaded()):
98 | var textureGithubPath=SHADERS_GITHUB_BASE_PATH + param.texture
99 | print("Downloading Texture...")
100 | print(" %s/%s" % [SHADERS_GITHUB_DOMAIN,textureGithubPath])
101 | print("please wait...")
102 | var byteArray:PackedByteArray=await UtilHTTP.httpsDownloadBinary(SHADERS_GITHUB_DOMAIN,textureGithubPath)
103 | var texturePath=SHADERS_LOCAL_BASE_PATH+param.texture
104 | #await Util.saveBinaryFile(texturePath,byteArray)
105 | var image=Image.new()
106 | image.load_png_from_buffer(byteArray)
107 | var texture:ImageTexture=ImageTexture.create_from_image(image)
108 | ResourceSaver.save(texture,texturePath)
109 | texture.take_over_path(texturePath)
110 | anyTexturePathToSolveBug=texturePath
111 |
112 | print("Save texture to: ", texturePath)
113 |
114 | print("Downloaded Shader, enjoy.")
115 |
116 | #HACK START
117 | #ATTENTION: THIS PART, INCLUDED THE OS ALERT (NOT SURE IF THIS HAPPENS IN ALL OS)
118 | #SOLVE A PROBLEM WITH GODOT. THE POINT IS THAT IF WE SAVE
119 | #THE RESOURCE, GODOT EDITOR DOESN'T READ IT UNTIL THE WINDOW EDITOR LOST THE FOCUS
120 | #AND GAIN IT AGAIN. THE ALERT, FORCE THAT.
121 | #ON THE OTHER HAND, AFTER THAT, WE NEED TO WAIT TO GODOT TO LOAD CORRECTLY
122 | #THE RESOURCE... AND THAT'S ALL NECESSARY TO SET CORRECTLY ALL THE TEXTURES
123 | OS.alert("Downloaded Shader, enjoy", 'Import')
124 | if(anyTexturePathToSolveBug.length()>0):
125 | #AFTER THE ALERT, WE CAN EXPECT GODOT IS LOADING THE RESOURCE, LET'S WAIT
126 | var waitingEditorFinished=ResourceLoader.exists(anyTexturePathToSolveBug)
127 | while(!waitingEditorFinished):
128 | if(node.is_inside_tree()):
129 | await node.get_tree().create_timer(0.5).timeout
130 | waitingEditorFinished=ResourceLoader.exists(anyTexturePathToSolveBug)
131 | #OK, NOW EVERYTHING SHOULD BE OK TO CONTINUE
132 | #HACK END
133 |
134 | #Adding it
135 | if(!test):
136 | self.onAddShaderPressed(shaderName)
137 |
138 |
139 | # Function called when a shader has been selected
140 | # shader -> the shader name selected
141 | func shaderSelected(shaderName:String)->void:
142 | if(!shaderName.match(NONE_SHADER)):
143 | var shaderInfo:ShaderInfo=_findShaderInfo(shaderName)
144 | if(shaderInfo!=null):
145 | var downloaded=ShaderInfo.shaderHasBeenDownloaded(shaderInfo)
146 | self.onAddShaderButtonVisible.emit(downloaded)
147 | self.onDownloadButtonVisible.emit(!downloaded)
148 | return
149 | self.onAddShaderButtonVisible.emit(false)
150 | self.onDownloadButtonVisible.emit(false)
151 |
152 |
153 | func onSyncShaderList()->void:
154 | print("Syncing the Shader list from Github... please wait...")
155 | var jsonContent=await UtilHTTP.httpsDownloadJson(SHADERS_JSON_GITHUB_DOMAIN, SHADERS_JSON_GITHUB_PATH)
156 | Util.saveFile(SHADERS_JSON_LOCAL_PATH,jsonContent)
157 | _calculateShadersInserted()
158 | print("Sync done, enjoy.")
159 |
160 | func onReorder(shader:ShaderInfo, after:bool)->void:
161 | var currentIndex=self.selectedShaders.find(shader)
162 | var flagModified:bool=false
163 | if(!after && currentIndex>0):
164 | self.selectedShaders.remove_at(currentIndex)
165 | self.selectedShaders.insert(currentIndex-1,shader)
166 | flagModified=true
167 | elif(after && currentIndexvoid:
178 | onQuitShader(shader)
179 | shader.delete()
180 | pass
181 |
182 | func onQuitShader(shader:ShaderInfo)->void:
183 | self.selectedShaders.erase(shader)
184 | self.pendingShaders.append(shader)
185 | var newShader:Shader=ShaderInfo.generateShaderCode(self.selectedShaders)
186 | (self.parentSprite.material as ShaderMaterial).shader=newShader
187 | self._calculateShadersInserted()
188 |
189 | # Function called when the create mixed sprite button
190 | func onCreatePressed()->void:
191 | #Create button pressed. Creating a new empty Shader.
192 | if(self.parentSprite.material == null):
193 | self.parentSprite.material=ShaderMaterial.new()
194 | self.parentSprite.material.shader=ShaderInfo.generateShaderCode([])
195 | self._checkCreateVisibility()
196 |
197 | # Checks if the parent Sprite has a shader already configured
198 | # return -> true if the parent has a shader alredy, false otherwise
199 | func _parentSpriteHasShaderAlready()->bool:
200 | if(self.parentSprite is Sprite2D || self.parentSprite is AnimatedSprite2D || self.parentSprite is Label || self.parentSprite is ColorRect):
201 | if(self.parentSprite.material != null):
202 | if(self.parentSprite.material is ShaderMaterial):
203 | if(self.parentSprite.material.shader != null):
204 | return true
205 | return false
206 |
207 | # Check if the create button must be visible,
208 | # and launch the event if necessary
209 | func _checkCreateVisibility()->void:
210 | #if parent has shader, showing the shaders management
211 | #else showing create button for an empty shader
212 | var createButtonVisible=!_parentSpriteHasShaderAlready()
213 | self.onCreateContainerVisible.emit(createButtonVisible)
214 | if(!createButtonVisible):
215 | self._calculateShadersInserted()
216 |
217 | # private function to order the shaders by name
218 | func _orderShadersByName(a, b)->bool:
219 | var compare=(a.name as String).nocasecmp_to(b.name)
220 | if(compare<0):
221 | return true
222 | else:
223 | return false
224 |
225 | # Recopile all the shaders available to be added to the
226 | # sprite, those which hasn't been added yet, and emit
227 | # the evento to force the refill of the combo with those shaders
228 | # and the list of inserted shaders
229 | func _calculateShadersInserted()->void:
230 | #Reading JSON where are defined all available shaders
231 | var jsonContent=Util.readJsonFile(SHADERS_JSON_LOCAL_PATH)
232 | if(jsonContent==null):
233 | return
234 | ALL_SHADERS=[]
235 | var allShaders:Array=jsonContent as Array
236 | allShaders.sort_custom(_orderShadersByName)
237 |
238 | for shaderObj in allShaders:
239 | var shaderInfo:ShaderInfo=ShaderInfo.new()
240 | shaderInfo.loadShaderInfo(shaderObj)
241 | ALL_SHADERS.push_back(shaderInfo)
242 |
243 | #Reading what shaders are currently added to the Sprite
244 | self.selectedShaders=ShaderInfo.readCurrentlyActiveShadersFromShaderCode(self.parentSprite.material.shader.code, ALL_SHADERS)
245 | self._calculatePendingShaders()
246 | self.onShadersCalculated.emit(self.selectedShaders, self.pendingShaders)
247 |
248 |
249 | # Calculates the pending shaders to be added
250 | # based on the shaders already added
251 | func _calculatePendingShaders()->void:
252 | self.pendingShaders=[]
253 | for shader in ALL_SHADERS:
254 | if(self.selectedShaders.find(shader)<0):
255 | self.pendingShaders.append(shader)
256 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/ExtensionView.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name ExtensionView
3 | extends VBoxContainer
4 |
5 | @onready var managerWindow=preload("res://addons/sprite-shader-mixer/src/extension/searchform/searchform.tscn")
6 | @onready var iconDown=preload("res://addons/sprite-shader-mixer/assets/icons/down.svg")
7 | @onready var iconRight=preload("res://addons/sprite-shader-mixer/assets/icons/right.svg")
8 | @onready var shaderInfoContainer = preload("res://addons/sprite-shader-mixer/src/extension/shaderinfo/ShaderInfoContainer.tscn")
9 | @onready var compOptionShaders:OptionButton=$marginContainer/shader_container/HBoxContainer/option_shaders
10 | @onready var compButtonCreate:Button=$marginContainer/create_container/button_create
11 | @onready var compButtonAddShader:Button=$marginContainer/shader_container/HBoxContainer/button_addShader
12 | @onready var compContainerCreate:Control=$marginContainer/create_container
13 | @onready var compContainerShader:Control=$marginContainer/shader_container
14 | @onready var compContainerSelectedShaders:Control=$marginContainer/shader_container/shaders_selected_container
15 | @onready var compCurrentShadersTitle:Button=$marginContainer/shader_container/currentShadersTitle
16 | @onready var compButtonDownload:Button=$marginContainer/shader_container/HBoxContainer/button_download
17 | @onready var compButtonSync:Button=$marginContainer/shader_container/HBoxContainer/button_sync
18 | @onready var compButtonManager:Button=$marginContainer/shader_container/HBoxContainer/button_manager
19 |
20 | var logic:ExtensionLogic=ExtensionLogic.new()
21 |
22 | func setParentSprite(parent)->void:
23 | self.logic.setParentSprite(parent)
24 |
25 | func _ready()->void:
26 | #connecting UI events
27 | self.compButtonCreate.pressed.connect(self.logic.onCreatePressed)
28 | self.compOptionShaders.item_selected.connect(self._onShaderComboSelected)
29 | self.compButtonAddShader.pressed.connect(self._onAddButtonPressed)
30 | self.compCurrentShadersTitle.toggled.connect(self._onShadersButtonToogled)
31 | self.compButtonDownload.pressed.connect(self._onDownloadPressed)
32 | self.compButtonSync.pressed.connect(self._onSyncShaderList)
33 | self.compButtonManager.pressed.connect(self._onShowManager)
34 |
35 | #connecting logic events
36 | logic.onCreateContainerVisible.connect(_onCreateContainerVisible)
37 | logic.onAddShaderButtonVisible.connect(_onAddShadderButtonVisible)
38 | logic.onDownloadButtonVisible.connect(_onDownloadButtonVisible)
39 | logic.onSyncButtonVisible.connect(_onSyncButtonVisible)
40 | logic.onShadersCalculated.connect(_onShadersCalculated)
41 |
42 | logic.onReady()
43 |
44 | #-------------------------------------------------------------------
45 | # UI EVENTS
46 | #-------------------------------------------------------------------
47 | var manager:Window
48 |
49 | func _onShowManager():
50 | if(self.manager!=null):
51 | self.manager.queue_free()
52 |
53 | self.manager=self.managerWindow.instantiate()
54 | self.add_child(manager)
55 | manager.close_requested.connect(_onCloseManager);
56 | manager.setShaders(self.logic.pendingShaders, self.logic)
57 | manager.shaderSelected.connect(_onManagerShaderSelected)
58 |
59 | func _onManagerShaderSelected(shader:ShaderInfo):
60 | for i in range(self.logic.pendingShaders.size()):
61 | var iShader=self.logic.pendingShaders[i]
62 | if(iShader.name==shader.name):
63 | self.compOptionShaders.select(i+1)
64 | self._onShaderComboSelected(i+1)
65 | manager.queue_free()
66 | self.manager=null
67 |
68 | func _onCloseManager():
69 | manager.queue_free()
70 | manager=null
71 |
72 | # Event produced when a Shader is selected from UI
73 | # selectedShader -> the selected shader
74 | func _onShaderComboSelected(selectedShaderIndex:int)->void:
75 | if(selectedShaderIndex>=0):
76 | var selectedShaderName=self.compOptionShaders.get_item_text(selectedShaderIndex)
77 | self.logic.shaderSelected(selectedShaderName)
78 |
79 | func _onSyncShaderList()->void:
80 | var oldText=self.compButtonSync.text
81 | self.compButtonSync.text="Loading..(wait)"
82 | await get_tree().process_frame
83 | await get_tree().process_frame
84 | await get_tree().process_frame
85 | self.logic.onSyncShaderList()
86 | self.compButtonSync.text=oldText
87 |
88 | func _onShadersButtonToogled(toogled:bool)->void:
89 | if(toogled):
90 | compCurrentShadersTitle.icon=self.iconDown
91 | compContainerSelectedShaders.visible=true
92 | else:
93 | compCurrentShadersTitle.icon=self.iconRight
94 | compContainerSelectedShaders.visible=false
95 |
96 | func _onDownloadPressed()->void:
97 | var oldText=self.compButtonDownload.text
98 | self.compButtonDownload.text="Loading..(wait)"
99 | await get_tree().process_frame
100 | await get_tree().process_frame
101 | await get_tree().process_frame
102 | var selectedShaderName=self.compOptionShaders.get_item_text(self.compOptionShaders.get_selected_id())
103 | self.logic.onDownloadShaderPressed(selectedShaderName, self)
104 | self.compButtonDownload.text=oldText
105 |
106 | # Event produce when the add button is pressed from UI
107 | func _onAddButtonPressed()->void:
108 | var selectedShaderName=self.compOptionShaders.get_item_text(self.compOptionShaders.get_selected_id())
109 | self.logic.onAddShaderPressed(selectedShaderName)
110 |
111 | #-------------------------------------------------------------------
112 | # LOGIC EVENTS
113 | #-------------------------------------------------------------------
114 | # Logic Event when shaders are available to be included
115 | # shaders -> List of shaders which can be selected to be included
116 | func _onShadersCalculated(shadersInserted:Array[ShaderInfo], shadersNotInserted:Array[ShaderInfo])->void:
117 | self.compOptionShaders.clear()
118 | self.compOptionShaders.add_item("None")
119 | for shader in shadersNotInserted:
120 | self.compOptionShaders.add_item(shader.name)
121 |
122 | for child in self.compContainerSelectedShaders.get_children():
123 | child.queue_free()
124 | for shader in shadersInserted:
125 | var newInfoComponent:ShaderInfoContainer=self.shaderInfoContainer.instantiate()
126 | self.compContainerSelectedShaders.add_child(newInfoComponent)
127 | newInfoComponent.loadShaderInfo(shader)
128 | newInfoComponent.onDeleteShader.connect(self.logic.onDeleteShader)
129 | newInfoComponent.onQuitShader.connect(self.logic.onQuitShader)
130 | newInfoComponent.onReorder.connect(self.logic.onReorder)
131 |
132 | self.compCurrentShadersTitle.text="List of Current Shaders (%s)"%shadersInserted.size()
133 |
134 | # Logic Event to determine whether the add shader button must be visible
135 | # visible -> whether the button must be visible
136 | func _onAddShadderButtonVisible(visible:bool)->void:
137 | self.compButtonAddShader.visible=visible
138 |
139 | # Logic Event to determine whether the download button must be visible
140 | # visible -> whether the button must be visible
141 | func _onDownloadButtonVisible(visible:bool)->void:
142 | self.compButtonDownload.visible=visible
143 |
144 | # Logic Event to determine whether the sync button must be visible
145 | # visible -> whether the button must be visible
146 | func _onSyncButtonVisible(visible:bool)->void:
147 | self.compButtonSync.visible=visible
148 |
149 | # Logic Event to determine whether the create container must be visible
150 | # visible -> whether the container must be visible
151 | func _onCreateContainerVisible(visible:bool)->void:
152 | self.compContainerCreate.visible=visible
153 | self.compContainerShader.visible=!visible
154 |
155 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/ExtensionView.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=7 format=3 uid="uid://bglmssvn1eiqd"]
2 |
3 | [ext_resource type="Script" path="res://addons/sprite-shader-mixer/src/extension/ExtensionView.gd" id="1_vng8e"]
4 | [ext_resource type="Texture2D" uid="uid://b00p80u83d33j" path="res://addons/sprite-shader-mixer/assets/icons/Sprite2DShaderMixer.svg" id="2_yq7l3"]
5 | [ext_resource type="Texture2D" uid="uid://t0cto3il2buo" path="res://addons/sprite-shader-mixer/assets/icons/add.svg" id="3_0ho1l"]
6 | [ext_resource type="Texture2D" uid="uid://nsea1n1hugod" path="res://addons/sprite-shader-mixer/assets/icons/right.svg" id="3_8det7"]
7 | [ext_resource type="Texture2D" uid="uid://b1rygy2x8jbew" path="res://addons/sprite-shader-mixer/assets/icons/download.svg" id="4_cshyv"]
8 | [ext_resource type="Texture2D" uid="uid://b30x1ipn1kw8j" path="res://addons/sprite-shader-mixer/assets/icons/sync.svg" id="5_nwx26"]
9 |
10 | [node name="main" type="VBoxContainer"]
11 | anchors_preset = 15
12 | anchor_right = 1.0
13 | anchor_bottom = 1.0
14 | grow_horizontal = 2
15 | grow_vertical = 2
16 | size_flags_vertical = 6
17 | script = ExtResource("1_vng8e")
18 |
19 | [node name="marginContainer" type="MarginContainer" parent="."]
20 | layout_mode = 2
21 | theme_override_constants/margin_left = 10
22 | theme_override_constants/margin_top = 10
23 | theme_override_constants/margin_right = 10
24 | theme_override_constants/margin_bottom = 10
25 |
26 | [node name="create_container" type="Control" parent="marginContainer"]
27 | custom_minimum_size = Vector2(0, 50)
28 | layout_mode = 2
29 | size_flags_vertical = 0
30 |
31 | [node name="button_create" type="Button" parent="marginContainer/create_container"]
32 | custom_minimum_size = Vector2(200, 0)
33 | layout_mode = 1
34 | anchors_preset = 8
35 | anchor_left = 0.5
36 | anchor_top = 0.5
37 | anchor_right = 0.5
38 | anchor_bottom = 0.5
39 | offset_left = -74.5
40 | offset_top = -15.5
41 | offset_right = 74.5
42 | offset_bottom = 15.5
43 | grow_horizontal = 2
44 | grow_vertical = 2
45 | text = "Create Shader Mixer"
46 | icon = ExtResource("2_yq7l3")
47 |
48 | [node name="shader_container" type="VBoxContainer" parent="marginContainer"]
49 | layout_mode = 2
50 |
51 | [node name="label_selectShader" type="Label" parent="marginContainer/shader_container"]
52 | layout_mode = 2
53 | text = "Select Shader to Add"
54 |
55 | [node name="HBoxContainer" type="HBoxContainer" parent="marginContainer/shader_container"]
56 | layout_mode = 2
57 |
58 | [node name="option_shaders" type="OptionButton" parent="marginContainer/shader_container/HBoxContainer"]
59 | custom_minimum_size = Vector2(150, 25)
60 | layout_mode = 2
61 |
62 | [node name="button_manager" type="Button" parent="marginContainer/shader_container/HBoxContainer"]
63 | layout_mode = 2
64 | text = "..."
65 |
66 | [node name="button_addShader" type="Button" parent="marginContainer/shader_container/HBoxContainer"]
67 | visible = false
68 | layout_mode = 2
69 | theme_override_colors/icon_normal_color = Color(0, 0.764706, 0, 1)
70 | text = "add"
71 | icon = ExtResource("3_0ho1l")
72 |
73 | [node name="button_download" type="Button" parent="marginContainer/shader_container/HBoxContainer"]
74 | visible = false
75 | layout_mode = 2
76 | theme_override_colors/icon_normal_color = Color(0, 0.764706, 0, 1)
77 | text = "Download"
78 | icon = ExtResource("4_cshyv")
79 |
80 | [node name="button_sync" type="Button" parent="marginContainer/shader_container/HBoxContainer"]
81 | layout_mode = 2
82 | theme_override_colors/icon_normal_color = Color(0, 0.764706, 0, 1)
83 | text = "Sync List"
84 | icon = ExtResource("5_nwx26")
85 |
86 | [node name="HSeparator" type="HSeparator" parent="marginContainer/shader_container"]
87 | layout_mode = 2
88 |
89 | [node name="Label2" type="Label" parent="marginContainer/shader_container"]
90 | layout_mode = 2
91 | text = "Current List of Shaders Added can be manipulated at the Material->Shader exported properties"
92 | autowrap_mode = 3
93 | max_lines_visible = 3
94 |
95 | [node name="HSeparator2" type="HSeparator" parent="marginContainer/shader_container"]
96 | layout_mode = 2
97 |
98 | [node name="currentShadersTitle" type="Button" parent="marginContainer/shader_container"]
99 | layout_mode = 2
100 | toggle_mode = true
101 | text = "List of Current Shaders"
102 | icon = ExtResource("3_8det7")
103 | alignment = 0
104 |
105 | [node name="shaders_selected_container" type="VBoxContainer" parent="marginContainer/shader_container"]
106 | visible = false
107 | layout_mode = 2
108 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/searchform/searchform.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | extends Window
3 |
4 | signal shaderSelected(shader:ShaderInfo)
5 |
6 | @onready var tree:Tree = %tree
7 | @onready var option:OptionButton = %option_group
8 | @onready var panel_right = %panel_right
9 | @onready var text_author = %text_author
10 | @onready var text_adaptedby = %text_adaptedby
11 | @onready var text_link = %text_link
12 | @onready var text_license = %text_license
13 | @onready var text_version = %text_version
14 | @onready var text_description = %text_description
15 | @onready var tab = %tab
16 | @onready var panel_info = %panel_info
17 | @onready var panel_example = %panel_example
18 | @onready var button_select:Button = %button_select
19 | @onready var button_remove:Button = %button_remove
20 | @onready var edit_search = %edit_search
21 | @onready var button_download = %button_download
22 |
23 | var allShaders:Array[ShaderInfo];
24 | var shaders:Array[ShaderInfo];
25 | var logic:ExtensionLogic;
26 |
27 | func _ready():
28 | panel_right.visible=false;
29 | tree.cell_selected.connect(_onShaderSelected)
30 | tab.tab_selected.connect(_onTabSelected)
31 | button_select.disabled=true
32 | button_remove.disabled=true
33 | button_select.pressed.connect(_onButtonSelected)
34 | edit_search.text_changed.connect(_onSearchTextChanged)
35 | option.item_selected.connect(_onOptionSelectionChanged)
36 | button_download.pressed.connect(_onDownloadPressed)
37 | button_remove.pressed.connect(_onButtonRemovePressed)
38 | text_link.gui_input.connect(_onLinkInput)
39 |
40 | func _onLinkInput(event:InputEvent):
41 | if (event is InputEventMouseButton &&
42 | event.pressed &&
43 | event.button_index == 1):
44 | OS.shell_open(text_link.text)
45 |
46 | func _onButtonRemovePressed():
47 | var shaderName=tree.get_selected().get_text(0)
48 | var shader:ShaderInfo=_findShaderByName(shaderName)
49 | logic.onDeleteShader(shader)
50 | self.button_remove.disabled=true
51 |
52 | func _onSearchTextChanged():
53 | _filterShaders()
54 |
55 | func _onOptionSelectionChanged(index:int):
56 | _filterShaders()
57 |
58 | func _getSelectedGroup()->String:
59 | var id=option.get_selected_id()
60 | return option.get_item_text(id)
61 |
62 | func _filterShaders():
63 | var textToSearch:String=edit_search.text
64 | var groupToSearch:String=_getSelectedGroup()
65 | textToSearch=textToSearch.to_upper()
66 | shaders.clear()
67 | if(textToSearch.length()>0):
68 | for shader in allShaders:
69 | if(shader.name.to_upper().contains(textToSearch)):
70 | if(option.get_selected_id()>0):
71 | if(shader.group==groupToSearch):
72 | shaders.append(shader)
73 | else:
74 | shaders.append(shader)
75 | elif(option.get_selected_id()>0):
76 | for shader in allShaders:
77 | if(shader.group==groupToSearch):
78 | shaders.append(shader)
79 | else:
80 | shaders.append_array(allShaders)
81 |
82 | _refreshTree()
83 |
84 |
85 | func _onButtonSelected():
86 | var shaderName=tree.get_selected().get_text(0)
87 | var shader:ShaderInfo=_findShaderByName(shaderName)
88 | self.shaderSelected.emit(shader)
89 |
90 | func _onTabSelected(tab:int):
91 | if(tab==0):
92 | panel_info.visible=true
93 | panel_example.visible=false
94 | else:
95 | panel_info.visible=false
96 | panel_example.visible=true
97 | _onShaderSelected()
98 |
99 | func _onShaderSelected():
100 | var treeItem:TreeItem=tree.get_selected()
101 | var text=treeItem.get_text(0)
102 | var shader:ShaderInfo=_findShaderByName(text)
103 | if(shader!=null):
104 | _fillShaderInfo(shader)
105 | panel_right.visible=true
106 | button_select.disabled=false
107 | var downloaded:bool=ShaderInfo.shaderHasBeenDownloaded(shader)
108 | if(!downloaded):
109 | %button_download.visible = true
110 | %sprites.visible=false
111 | button_remove.disabled=true
112 | else:
113 | var shaders:Array[ShaderInfo]=[]
114 | shaders.append(shader)
115 | var shaderCode:Shader=shader.generateShaderCode(shaders)
116 | %supergodot.material.shader=shaderCode
117 |
118 | for param in shader.parameters:
119 | if(param.texture!=null && param.texture.length()>0):
120 | var texturePath=logic.SHADERS_LOCAL_BASE_PATH+param.texture
121 | var textureRes:CompressedTexture2D=ResourceLoader.load(texturePath)
122 | %supergodot.material.set_shader_parameter(param.name,textureRes)
123 |
124 | %button_download.visible = false
125 | %sprites.visible=true
126 | (%supergodot as AnimatedSprite2D).play()
127 | button_remove.disabled=false
128 | else:
129 | panel_right.visible=false
130 | button_select.disabled=true
131 |
132 | func _onDownloadPressed():
133 | var oldText=self.button_download.text
134 | self.button_download.text="Downloading..(wait)"
135 | await get_tree().process_frame
136 | await get_tree().process_frame
137 | await get_tree().process_frame
138 |
139 |
140 | var treeItem:TreeItem=tree.get_selected()
141 | var text=treeItem.get_text(0)
142 | var shader:ShaderInfo=_findShaderByName(text)
143 | await self.logic.onDownloadShaderPressed(shader.name,self,true)
144 |
145 | %sprites.visible=true
146 | %button_download.visible=false
147 | (%supergodot as AnimatedSprite2D).play()
148 | button_remove.disabled=false
149 | var shaders:Array[ShaderInfo]=[]
150 | shaders.append(shader)
151 | var shaderCode:Shader=shader.generateShaderCode(shaders)
152 | %supergodot.material.shader=shaderCode
153 |
154 | for param in shader.parameters:
155 | if(param.texture!=null && param.texture.length()>0):
156 | var texturePath=logic.SHADERS_LOCAL_BASE_PATH+param.texture
157 | var textureRes:CompressedTexture2D=ResourceLoader.load(texturePath)
158 | %supergodot.material.set_shader_parameter(param.name,textureRes)
159 |
160 |
161 | self.button_download.text=oldText
162 |
163 |
164 |
165 | func _fillShaderInfo(shader:ShaderInfo):
166 | text_author.text=shader.name
167 | text_adaptedby.text=shader.adaptedBy
168 | text_description.text=shader.description
169 | text_license.text=shader.license
170 | text_version.text=shader.version
171 | text_link.text=shader.link
172 |
173 | func _findShaderByName(name:String):
174 | for shader in self.shaders:
175 | if(shader.name==name):
176 | return shader
177 | return null
178 |
179 | func setShaders(shaders:Array[ShaderInfo], logic:ExtensionLogic):
180 | self.allShaders=shaders
181 | self.logic=logic
182 | self.shaders.append_array(allShaders);
183 | var groups=self.getGroups(allShaders)
184 | self.option.add_item("All Groups")
185 | for group in groups:
186 | self.option.add_item(group.to_lower().capitalize())
187 | _refreshTree()
188 |
189 | func _refreshTree():
190 | tree.clear()
191 |
192 | var allItem:TreeItem=tree.create_item();
193 | allItem.set_text(0,"All Shaders")
194 | var groups:Array[String]=self.getGroups(shaders)
195 | for group in groups:
196 | var item:TreeItem=tree.create_item(allItem);
197 | item.set_text(0,group.to_lower().capitalize())
198 | var shadersOfGroup=getShaderOfGroup(shaders, group)
199 | for shader in shadersOfGroup:
200 | var treeShader=tree.create_item(item)
201 | treeShader.set_text(0,shader.name)
202 |
203 |
204 | func getShaderOfGroup(shaders:Array[ShaderInfo], group:String):
205 | var result:Array[ShaderInfo]=[]
206 | for shader in shaders:
207 | if(shader.group == group):
208 | result.append(shader)
209 | return result
210 |
211 | func getGroups(shaders:Array[ShaderInfo]):
212 | var groups:Array[String]=[]
213 | for shader in shaders:
214 | if(groups.find(shader.group)<0):
215 | groups.append(shader.group)
216 | return groups
217 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/searchform/searchform.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=29 format=3 uid="uid://d4nepe0a70ju5"]
2 |
3 | [ext_resource type="Script" path="res://addons/sprite-shader-mixer/src/extension/searchform/searchform.gd" id="1_ovoip"]
4 | [ext_resource type="Texture2D" uid="uid://b1rygy2x8jbew" path="res://addons/sprite-shader-mixer/assets/icons/download.svg" id="2_b17sv"]
5 | [ext_resource type="Texture2D" uid="uid://bkmtfe42ptooh" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png" id="3_n6bfe"]
6 | [ext_resource type="Texture2D" uid="uid://bql2ueidhx0gr" path="res://addons/sprite-shader-mixer/assets/background.jpg" id="3_rs3hf"]
7 | [ext_resource type="Texture2D" uid="uid://b1o4oqvqpb1qy" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png" id="4_lby8e"]
8 | [ext_resource type="Texture2D" uid="uid://bs33nr7syqox7" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png" id="5_c5oyc"]
9 | [ext_resource type="Texture2D" uid="uid://8wimrai50mn1" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png" id="6_l3623"]
10 | [ext_resource type="Texture2D" uid="uid://dwpufhhaw82ug" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png" id="7_eykmg"]
11 | [ext_resource type="Texture2D" uid="uid://cihrw6565y3r1" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png" id="8_sfuok"]
12 | [ext_resource type="Texture2D" uid="uid://cblgnfg5ui8df" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png" id="9_fur0y"]
13 | [ext_resource type="Texture2D" uid="uid://xols7iqcmm6u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png" id="10_i3aty"]
14 | [ext_resource type="Texture2D" uid="uid://cv1ig6gansjqn" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png" id="11_0k3mr"]
15 | [ext_resource type="Texture2D" uid="uid://0e7h0nbb5uxg" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png" id="12_i7uuo"]
16 | [ext_resource type="Texture2D" uid="uid://bglwd2chn700u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png" id="13_pofvg"]
17 | [ext_resource type="Texture2D" uid="uid://c145wbhfimwne" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png" id="14_1mijx"]
18 | [ext_resource type="Texture2D" uid="uid://dj4d28tivbgb0" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png" id="15_t7mnh"]
19 | [ext_resource type="Texture2D" uid="uid://7pagyvbmsoey" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png" id="16_vx01d"]
20 | [ext_resource type="Texture2D" uid="uid://coqntke8nkel5" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png" id="17_labou"]
21 | [ext_resource type="Texture2D" uid="uid://bdoqc7jitaivj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png" id="18_er0m5"]
22 | [ext_resource type="Texture2D" uid="uid://mwcarsfwblj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png" id="19_wdj5v"]
23 | [ext_resource type="Texture2D" uid="uid://d2dubli5df5va" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png" id="20_q40o3"]
24 | [ext_resource type="Texture2D" uid="uid://dqv5ugl4038aj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png" id="21_f5032"]
25 | [ext_resource type="Texture2D" uid="uid://dn2tu0peutt2u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png" id="22_xwcvw"]
26 | [ext_resource type="Texture2D" uid="uid://blwvphk004alx" path="res://addons/sprite-shader-mixer/assets/icons/delete.svg" id="25_np67d"]
27 |
28 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7166x"]
29 | bg_color = Color(0.210938, 0.238281, 0.289063, 1)
30 |
31 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8pp7k"]
32 | content_margin_left = 7.0
33 | content_margin_top = 7.0
34 | content_margin_right = 7.0
35 | content_margin_bottom = 7.0
36 | bg_color = Color(0.25098, 0.258824, 0.27451, 1)
37 | border_width_left = 4
38 | border_width_top = 4
39 | border_width_right = 4
40 | border_width_bottom = 4
41 | corner_radius_top_left = 11
42 | corner_radius_top_right = 11
43 | corner_radius_bottom_right = 11
44 | corner_radius_bottom_left = 11
45 | corner_detail = 20
46 | expand_margin_left = 7.0
47 | shadow_color = Color(0, 0, 0, 0.894118)
48 | shadow_size = 1
49 |
50 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_cb3l7"]
51 |
52 | [sub_resource type="SpriteFrames" id="SpriteFrames_jinux"]
53 | animations = [{
54 | "frames": [{
55 | "duration": 1.0,
56 | "texture": ExtResource("3_n6bfe")
57 | }, {
58 | "duration": 1.0,
59 | "texture": ExtResource("4_lby8e")
60 | }, {
61 | "duration": 1.0,
62 | "texture": ExtResource("5_c5oyc")
63 | }, {
64 | "duration": 1.0,
65 | "texture": ExtResource("6_l3623")
66 | }, {
67 | "duration": 1.0,
68 | "texture": ExtResource("7_eykmg")
69 | }, {
70 | "duration": 1.0,
71 | "texture": ExtResource("8_sfuok")
72 | }, {
73 | "duration": 1.0,
74 | "texture": ExtResource("9_fur0y")
75 | }, {
76 | "duration": 1.0,
77 | "texture": ExtResource("10_i3aty")
78 | }, {
79 | "duration": 1.0,
80 | "texture": ExtResource("11_0k3mr")
81 | }, {
82 | "duration": 1.0,
83 | "texture": ExtResource("12_i7uuo")
84 | }, {
85 | "duration": 1.0,
86 | "texture": ExtResource("13_pofvg")
87 | }, {
88 | "duration": 1.0,
89 | "texture": ExtResource("14_1mijx")
90 | }, {
91 | "duration": 1.0,
92 | "texture": ExtResource("15_t7mnh")
93 | }, {
94 | "duration": 1.0,
95 | "texture": ExtResource("16_vx01d")
96 | }, {
97 | "duration": 1.0,
98 | "texture": ExtResource("17_labou")
99 | }, {
100 | "duration": 1.0,
101 | "texture": ExtResource("18_er0m5")
102 | }, {
103 | "duration": 1.0,
104 | "texture": ExtResource("19_wdj5v")
105 | }, {
106 | "duration": 1.0,
107 | "texture": ExtResource("20_q40o3")
108 | }, {
109 | "duration": 1.0,
110 | "texture": ExtResource("21_f5032")
111 | }, {
112 | "duration": 1.0,
113 | "texture": ExtResource("22_xwcvw")
114 | }],
115 | "loop": true,
116 | "name": &"default",
117 | "speed": 24.0
118 | }]
119 |
120 | [node name="Window" type="Window"]
121 | title = "Shader Search"
122 | initial_position = 1
123 | size = Vector2i(650, 400)
124 | unresizable = true
125 | theme_override_colors/title_color = Color(1, 1, 1, 1)
126 | script = ExtResource("1_ovoip")
127 |
128 | [node name="panel_background" type="Panel" parent="."]
129 | anchors_preset = 15
130 | anchor_right = 1.0
131 | anchor_bottom = 1.0
132 | grow_horizontal = 2
133 | grow_vertical = 2
134 | theme_override_styles/panel = SubResource("StyleBoxFlat_7166x")
135 |
136 | [node name="margin" type="MarginContainer" parent="panel_background"]
137 | layout_mode = 1
138 | anchors_preset = 15
139 | anchor_right = 1.0
140 | anchor_bottom = 1.0
141 | grow_horizontal = 2
142 | grow_vertical = 2
143 | theme_override_constants/margin_left = 10
144 | theme_override_constants/margin_top = 10
145 | theme_override_constants/margin_right = 10
146 | theme_override_constants/margin_bottom = 10
147 |
148 | [node name="VBoxContainer" type="VBoxContainer" parent="panel_background/margin"]
149 | layout_mode = 2
150 |
151 | [node name="HBoxContainer" type="HBoxContainer" parent="panel_background/margin/VBoxContainer"]
152 | layout_mode = 2
153 |
154 | [node name="edit_search" type="TextEdit" parent="panel_background/margin/VBoxContainer/HBoxContainer"]
155 | unique_name_in_owner = true
156 | custom_minimum_size = Vector2(200, 40)
157 | layout_mode = 2
158 | placeholder_text = "search"
159 |
160 | [node name="option_group" type="OptionButton" parent="panel_background/margin/VBoxContainer/HBoxContainer"]
161 | unique_name_in_owner = true
162 | custom_minimum_size = Vector2(200, 0)
163 | layout_mode = 2
164 |
165 | [node name="HBoxContainer2" type="HBoxContainer" parent="panel_background/margin/VBoxContainer"]
166 | layout_mode = 2
167 |
168 | [node name="tree" type="Tree" parent="panel_background/margin/VBoxContainer/HBoxContainer2"]
169 | unique_name_in_owner = true
170 | custom_minimum_size = Vector2(300, 300)
171 | layout_mode = 2
172 |
173 | [node name="panel" type="Panel" parent="panel_background/margin/VBoxContainer/HBoxContainer2"]
174 | clip_contents = true
175 | custom_minimum_size = Vector2(330, 300)
176 | layout_mode = 2
177 |
178 | [node name="panel_right" type="MarginContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel"]
179 | unique_name_in_owner = true
180 | visible = false
181 | layout_mode = 0
182 | offset_right = 40.0
183 | offset_bottom = 40.0
184 | theme_override_constants/margin_left = 10
185 | theme_override_constants/margin_top = 10
186 | theme_override_constants/margin_right = 10
187 | theme_override_constants/margin_bottom = 10
188 |
189 | [node name="VBoxContainer" type="VBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right"]
190 | layout_mode = 2
191 |
192 | [node name="tab" type="TabBar" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer"]
193 | unique_name_in_owner = true
194 | layout_mode = 2
195 | tab_count = 2
196 | tab_0/title = "Info"
197 | tab_1/title = "Example"
198 |
199 | [node name="panel_info" type="ScrollContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer"]
200 | unique_name_in_owner = true
201 | custom_minimum_size = Vector2(310, 250)
202 | layout_mode = 2
203 |
204 | [node name="VBoxContainer" type="VBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info"]
205 | layout_mode = 2
206 |
207 | [node name="container_author" type="HBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
208 | layout_mode = 2
209 |
210 | [node name="label_author" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_author"]
211 | layout_mode = 2
212 | theme_override_font_sizes/font_size = 12
213 | text = "author:"
214 |
215 | [node name="text_author" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_author"]
216 | unique_name_in_owner = true
217 | layout_mode = 2
218 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
219 | theme_override_font_sizes/font_size = 12
220 | text = "spheras"
221 |
222 | [node name="container_adaptedby" type="HBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
223 | layout_mode = 2
224 |
225 | [node name="label_adaptedby" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_adaptedby"]
226 | layout_mode = 2
227 | theme_override_font_sizes/font_size = 12
228 | text = "adapted:"
229 |
230 | [node name="text_adaptedby" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_adaptedby"]
231 | unique_name_in_owner = true
232 | layout_mode = 2
233 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
234 | theme_override_font_sizes/font_size = 12
235 | text = "spheras"
236 |
237 | [node name="container_link" type="HBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
238 | layout_mode = 2
239 |
240 | [node name="label_link" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_link"]
241 | layout_mode = 2
242 | theme_override_font_sizes/font_size = 12
243 | text = "link:"
244 |
245 | [node name="text_link" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_link"]
246 | unique_name_in_owner = true
247 | custom_minimum_size = Vector2(200, 0)
248 | layout_mode = 2
249 | mouse_filter = 0
250 | mouse_default_cursor_shape = 2
251 | theme_override_colors/font_color = Color(0.294118, 0.372549, 1, 1)
252 | theme_override_font_sizes/font_size = 12
253 | text = "http://www.github.com"
254 | text_overrun_behavior = 4
255 | max_lines_visible = 1
256 | visible_characters_behavior = 2
257 |
258 | [node name="container_license" type="HBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
259 | layout_mode = 2
260 |
261 | [node name="label_license" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_license"]
262 | layout_mode = 2
263 | theme_override_font_sizes/font_size = 12
264 | text = "license:"
265 |
266 | [node name="text_license" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_license"]
267 | unique_name_in_owner = true
268 | layout_mode = 2
269 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
270 | theme_override_font_sizes/font_size = 12
271 | text = "MIT"
272 |
273 | [node name="container_version" type="HBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
274 | layout_mode = 2
275 |
276 | [node name="label_version" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_version"]
277 | layout_mode = 2
278 | theme_override_font_sizes/font_size = 12
279 | text = "vesion:"
280 |
281 | [node name="text_version" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_version"]
282 | unique_name_in_owner = true
283 | layout_mode = 2
284 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
285 | theme_override_font_sizes/font_size = 12
286 | text = "1.0"
287 |
288 | [node name="container_description" type="VBoxContainer" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer"]
289 | layout_mode = 2
290 |
291 | [node name="label_description" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_description"]
292 | layout_mode = 2
293 | theme_override_font_sizes/font_size = 12
294 | text = "description:"
295 |
296 | [node name="text_description" type="Label" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_info/VBoxContainer/container_description"]
297 | unique_name_in_owner = true
298 | layout_mode = 2
299 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
300 | theme_override_font_sizes/font_size = 12
301 | text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris in risus eget nisi pulvinar facilisis sed quis ex. Phasellus tortor lectus, rhoncus nec congue ac, laoreet a arcu. Aliquam facilisis vitae lacus id fringilla. Fusce pellentesque "
302 | autowrap_mode = 3
303 |
304 | [node name="panel_example" type="Panel" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer"]
305 | unique_name_in_owner = true
306 | clip_contents = true
307 | custom_minimum_size = Vector2(310, 245)
308 | layout_mode = 2
309 | size_flags_horizontal = 0
310 |
311 | [node name="button_download" type="Button" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_example"]
312 | unique_name_in_owner = true
313 | layout_mode = 1
314 | anchors_preset = 8
315 | anchor_left = 0.5
316 | anchor_top = 0.5
317 | anchor_right = 0.5
318 | anchor_bottom = 0.5
319 | offset_left = -143.5
320 | offset_top = -27.0
321 | offset_right = 143.5
322 | offset_bottom = 27.0
323 | grow_horizontal = 2
324 | grow_vertical = 2
325 | theme_override_styles/normal = SubResource("StyleBoxFlat_8pp7k")
326 | theme_override_styles/hover = SubResource("StyleBoxFlat_8pp7k")
327 | theme_override_styles/pressed = SubResource("StyleBoxFlat_8pp7k")
328 | text = "Press to Download Shader
329 | and Preview Demo"
330 | icon = ExtResource("2_b17sv")
331 | expand_icon = true
332 |
333 | [node name="sprites" type="Control" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_example"]
334 | unique_name_in_owner = true
335 | anchors_preset = 0
336 | offset_right = 40.0
337 | offset_bottom = 40.0
338 |
339 | [node name="background" type="Sprite2D" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_example/sprites"]
340 | position = Vector2(150, 97)
341 | scale = Vector2(0.3, 0.3)
342 | texture = ExtResource("3_rs3hf")
343 |
344 | [node name="supergodot" type="AnimatedSprite2D" parent="panel_background/margin/VBoxContainer/HBoxContainer2/panel/panel_right/VBoxContainer/panel_example/sprites"]
345 | unique_name_in_owner = true
346 | material = SubResource("ShaderMaterial_cb3l7")
347 | position = Vector2(150, 125)
348 | scale = Vector2(0.275, 0.275)
349 | sprite_frames = SubResource("SpriteFrames_jinux")
350 | autoplay = "default"
351 | frame_progress = 0.61346
352 |
353 | [node name="VBoxContainer" type="HBoxContainer" parent="panel_background/margin/VBoxContainer"]
354 | layout_mode = 2
355 |
356 | [node name="button_select" type="Button" parent="panel_background/margin/VBoxContainer/VBoxContainer"]
357 | unique_name_in_owner = true
358 | layout_mode = 2
359 | disabled = true
360 | text = "Select Shader"
361 |
362 | [node name="button_remove" type="Button" parent="panel_background/margin/VBoxContainer/VBoxContainer"]
363 | unique_name_in_owner = true
364 | layout_mode = 2
365 | disabled = true
366 | text = "Remove Shader from Local"
367 | icon = ExtResource("25_np67d")
368 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/shaderinfo/ShaderInfoContainer.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name ShaderInfoContainer
3 | extends VBoxContainer
4 |
5 |
6 | signal onDeleteShader(shaderInfo:ShaderInfo)
7 | signal onQuitShader(shaderInfo:ShaderInfo)
8 | signal onReorder(shaderInfo:ShaderInfo,after:bool)
9 |
10 | @onready var right_icon = preload("res://addons/sprite-shader-mixer/assets/icons/right.svg")
11 | @onready var down_icon = preload("res://addons/sprite-shader-mixer/assets/icons/down.svg")
12 | @onready var shaderInfoParameterContainer = preload("res://addons/sprite-shader-mixer/src/extension/shaderinfo/parameter/ShaderInfoParameterContainer.tscn")
13 | @onready var comp_name:Label=$container_name/container_title/container_name_separator/label_name
14 | @onready var comp_quit:Button=$container_name/remove_container/button_quit
15 | @onready var comp_delete:Button=$container_name/remove_container/button_delete
16 | @onready var comp_author:Label=$container_author/text_author
17 | @onready var comp_link:Label=$container_link/text_link
18 | @onready var comp_adaptedby:Label=$container_adaptedby/text_adaptedby
19 | @onready var comp_license:Label=$container_license/text_license
20 | @onready var comp_version:Label=$container_version/text_version
21 | @onready var comp_description:Label=$container_description/text_description
22 | @onready var comp_buttonUp:Button=$container_name/container_title/container_updown/button_up
23 | @onready var comp_buttonDown:Button=$container_name/container_title/container_updown/button_down
24 | @onready var comp_buttonParameters:Button=$container_parameters/button_parameters
25 | @onready var comp_parameters_container_inside:VBoxContainer=$container_parameters/container_parameters_inside
26 |
27 | var shaderInfo:ShaderInfo
28 |
29 | func _ready():
30 | (comp_link as Label).gui_input.connect(_onLinkInput)
31 |
32 | func _onLinkInput(event:InputEvent):
33 | if (event is InputEventMouseButton &&
34 | event.pressed &&
35 | event.button_index == 1):
36 | OS.shell_open(comp_link.text)
37 |
38 | func loadShaderInfo(shaderInfo:ShaderInfo)->void:
39 | comp_name.text=shaderInfo.name
40 | comp_author.text=shaderInfo.author
41 | comp_version.text=shaderInfo.version
42 | comp_description.text=shaderInfo.description
43 | comp_link.text=shaderInfo.link
44 | comp_adaptedby.text=shaderInfo.adaptedBy
45 | comp_license.text=shaderInfo.license
46 | self.comp_delete.pressed.connect(self._onDeleteButtonPressed)
47 | self.comp_quit.pressed.connect(self._onQuitButtonPressed)
48 | self.comp_buttonUp.pressed.connect(self._onButtonUp)
49 | self.comp_buttonDown.pressed.connect(self._onButtonDown)
50 | self.comp_buttonParameters.toggled.connect(self._onParametersButtonToggled)
51 | self.shaderInfo=shaderInfo
52 | self.comp_parameters_container_inside.visible=false
53 | for parameter in shaderInfo.parameters:
54 | var newParameterComponent:ShaderInfoParameterContainer=self.shaderInfoParameterContainer.instantiate()
55 | self.comp_parameters_container_inside.add_child(newParameterComponent)
56 | await get_tree().process_frame
57 | newParameterComponent.loadParameter(parameter)
58 |
59 | func _onParametersButtonToggled(pressed:bool):
60 | self.comp_parameters_container_inside.visible=pressed
61 | if(pressed):
62 | self.comp_buttonParameters.icon=down_icon
63 | else:
64 | self.comp_buttonParameters.icon=right_icon
65 |
66 | func _onButtonUp():
67 | self.onReorder.emit(self.shaderInfo, false)
68 |
69 | func _onButtonDown():
70 | self.onReorder.emit(self.shaderInfo, true)
71 |
72 | func _onDeleteButtonPressed():
73 | var confirmation=ConfirmationDialog.new()
74 | confirmation.min_size=Vector2(400,100)
75 | confirmation.position=Vector2(100,100)
76 | confirmation.title="Delete Shader"
77 | confirmation.dialog_autowrap=true
78 | confirmation.dialog_text="Deletion means that the downloaded shader will be removed from local and from the shader script. You can download again if necesary, but this will remove the scripts and the textures from your local project."
79 | confirmation.get_ok_button().pressed.connect(func (): self.onDeleteShader.emit(self.shaderInfo))
80 | add_child(confirmation)
81 | confirmation.show()
82 |
83 | func _onQuitButtonPressed():
84 | self.onQuitShader.emit(self.shaderInfo)
85 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/shaderinfo/ShaderInfoContainer.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=11 format=3 uid="uid://bqkflotm3qks7"]
2 |
3 | [ext_resource type="Script" path="res://addons/sprite-shader-mixer/src/extension/shaderinfo/ShaderInfoContainer.gd" id="1_w5epy"]
4 | [ext_resource type="Texture2D" uid="uid://bh3ternlmjqxo" path="res://addons/sprite-shader-mixer/assets/icons/close.svg" id="2_8i1vt"]
5 | [ext_resource type="Texture2D" uid="uid://blwvphk004alx" path="res://addons/sprite-shader-mixer/assets/icons/delete.svg" id="2_l16is"]
6 | [ext_resource type="Texture2D" uid="uid://dcf5gngxrgfkl" path="res://addons/sprite-shader-mixer/assets/icons/up.svg" id="2_rqw54"]
7 | [ext_resource type="Texture2D" uid="uid://cpxfo28hww3v5" path="res://addons/sprite-shader-mixer/assets/icons/down.svg" id="3_tuebg"]
8 | [ext_resource type="Texture2D" uid="uid://nsea1n1hugod" path="res://addons/sprite-shader-mixer/assets/icons/right.svg" id="5_226fn"]
9 |
10 | [sub_resource type="StyleBoxLine" id="StyleBoxLine_xcbid"]
11 | color = Color(1, 1, 1, 1)
12 | grow_begin = 2.0
13 | grow_end = 2.0
14 | thickness = 6
15 | vertical = true
16 |
17 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tcxpa"]
18 | content_margin_left = 5.0
19 | draw_center = false
20 | corner_detail = 1
21 |
22 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r53vx"]
23 | content_margin_left = 5.0
24 | draw_center = false
25 |
26 | [sub_resource type="FontVariation" id="FontVariation_lpxya"]
27 | variation_face_index = 17
28 | variation_embolden = 1.14
29 |
30 | [node name="ShaderInfoControl" type="VBoxContainer"]
31 | anchors_preset = 15
32 | anchor_right = 1.0
33 | anchor_bottom = 1.0
34 | grow_horizontal = 2
35 | grow_vertical = 2
36 | size_flags_stretch_ratio = 0.0
37 | theme_override_constants/separation = 0
38 | script = ExtResource("1_w5epy")
39 |
40 | [node name="container_name" type="PanelContainer" parent="."]
41 | layout_mode = 2
42 | theme_override_styles/panel = SubResource("StyleBoxLine_xcbid")
43 |
44 | [node name="remove_container" type="HBoxContainer" parent="container_name"]
45 | layout_mode = 2
46 | size_flags_horizontal = 8
47 |
48 | [node name="button_quit" type="Button" parent="container_name/remove_container"]
49 | layout_mode = 2
50 | size_flags_horizontal = 8
51 | theme_override_colors/font_color = Color(0, 0, 0, 1)
52 | icon = ExtResource("2_8i1vt")
53 |
54 | [node name="VSeparator" type="VSeparator" parent="container_name/remove_container"]
55 | custom_minimum_size = Vector2(10, 0)
56 | layout_mode = 2
57 |
58 | [node name="button_delete" type="Button" parent="container_name/remove_container"]
59 | layout_mode = 2
60 | size_flags_horizontal = 8
61 | theme_override_colors/font_color = Color(0, 0, 0, 1)
62 | theme_override_colors/icon_normal_color = Color(1, 0.305882, 0, 1)
63 | icon = ExtResource("2_l16is")
64 |
65 | [node name="container_title" type="HBoxContainer" parent="container_name"]
66 | layout_mode = 2
67 | size_flags_horizontal = 0
68 |
69 | [node name="VSeparator" type="VSeparator" parent="container_name/container_title"]
70 | custom_minimum_size = Vector2(10, 0)
71 | layout_mode = 2
72 |
73 | [node name="container_updown" type="VBoxContainer" parent="container_name/container_title"]
74 | layout_mode = 2
75 | size_flags_horizontal = 0
76 | size_flags_vertical = 3
77 |
78 | [node name="button_up" type="Button" parent="container_name/container_title/container_updown"]
79 | layout_mode = 2
80 | size_flags_vertical = 3
81 | theme_override_styles/normal = SubResource("StyleBoxFlat_tcxpa")
82 | icon = ExtResource("2_rqw54")
83 |
84 | [node name="button_down" type="Button" parent="container_name/container_title/container_updown"]
85 | layout_mode = 2
86 | size_flags_vertical = 3
87 | theme_override_styles/normal = SubResource("StyleBoxFlat_r53vx")
88 | icon = ExtResource("3_tuebg")
89 |
90 | [node name="container_name_separator" type="HBoxContainer" parent="container_name/container_title"]
91 | layout_mode = 2
92 | size_flags_horizontal = 0
93 |
94 | [node name="space" type="Label" parent="container_name/container_title/container_name_separator"]
95 | custom_minimum_size = Vector2(3, 0)
96 | layout_mode = 2
97 |
98 | [node name="label_name" type="Label" parent="container_name/container_title/container_name_separator"]
99 | layout_mode = 2
100 | theme_override_colors/font_color = Color(1, 1, 1, 1)
101 | theme_override_fonts/font = SubResource("FontVariation_lpxya")
102 | theme_override_font_sizes/font_size = 24
103 | text = "Glitch"
104 |
105 | [node name="container_author" type="HBoxContainer" parent="."]
106 | layout_mode = 2
107 |
108 | [node name="label_author" type="Label" parent="container_author"]
109 | layout_mode = 2
110 | theme_override_font_sizes/font_size = 12
111 | text = "author:"
112 |
113 | [node name="text_author" type="Label" parent="container_author"]
114 | layout_mode = 2
115 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
116 | theme_override_font_sizes/font_size = 12
117 | text = "spheras"
118 |
119 | [node name="container_adaptedby" type="HBoxContainer" parent="."]
120 | layout_mode = 2
121 |
122 | [node name="label_adaptedby" type="Label" parent="container_adaptedby"]
123 | layout_mode = 2
124 | theme_override_font_sizes/font_size = 12
125 | text = "adapted:"
126 |
127 | [node name="text_adaptedby" type="Label" parent="container_adaptedby"]
128 | layout_mode = 2
129 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
130 | theme_override_font_sizes/font_size = 12
131 | text = "spheras"
132 |
133 | [node name="container_link" type="HBoxContainer" parent="."]
134 | layout_mode = 2
135 |
136 | [node name="label_link" type="Label" parent="container_link"]
137 | layout_mode = 2
138 | theme_override_font_sizes/font_size = 12
139 | text = "link:"
140 |
141 | [node name="text_link" type="Label" parent="container_link"]
142 | custom_minimum_size = Vector2(200, 0)
143 | layout_mode = 2
144 | mouse_filter = 0
145 | mouse_default_cursor_shape = 2
146 | theme_override_colors/font_color = Color(0.278431, 0.376471, 1, 1)
147 | theme_override_font_sizes/font_size = 12
148 | text = "http://www.github.com"
149 | text_overrun_behavior = 4
150 | max_lines_visible = 1
151 | visible_characters_behavior = 2
152 |
153 | [node name="container_license" type="HBoxContainer" parent="."]
154 | layout_mode = 2
155 |
156 | [node name="label_license" type="Label" parent="container_license"]
157 | layout_mode = 2
158 | theme_override_font_sizes/font_size = 12
159 | text = "license:"
160 |
161 | [node name="text_license" type="Label" parent="container_license"]
162 | layout_mode = 2
163 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
164 | theme_override_font_sizes/font_size = 12
165 | text = "MIT"
166 |
167 | [node name="container_version" type="HBoxContainer" parent="."]
168 | layout_mode = 2
169 |
170 | [node name="label_version" type="Label" parent="container_version"]
171 | layout_mode = 2
172 | theme_override_font_sizes/font_size = 12
173 | text = "vesion:"
174 |
175 | [node name="text_version" type="Label" parent="container_version"]
176 | layout_mode = 2
177 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
178 | theme_override_font_sizes/font_size = 12
179 | text = "1.0"
180 |
181 | [node name="container_description" type="VBoxContainer" parent="."]
182 | layout_mode = 2
183 |
184 | [node name="label_description" type="Label" parent="container_description"]
185 | layout_mode = 2
186 | theme_override_font_sizes/font_size = 12
187 | text = "description:"
188 |
189 | [node name="text_description" type="Label" parent="container_description"]
190 | layout_mode = 2
191 | theme_override_colors/font_color = Color(1, 1, 0.270588, 1)
192 | theme_override_font_sizes/font_size = 12
193 | text = "This shader dlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkfdlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkfdlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkfdlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkfdlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkfdlsfkjas ldkfasldfjañlsj fañlsfj añlsfj ñlasfjñlasfjaklfjñafj adsñlf jñalsdfjñlsjfñlasdjfñlasjdkf"
194 | autowrap_mode = 3
195 |
196 | [node name="container_parameters" type="VBoxContainer" parent="."]
197 | layout_mode = 2
198 |
199 | [node name="button_parameters" type="Button" parent="container_parameters"]
200 | layout_mode = 2
201 | toggle_mode = true
202 | text = "Parameters"
203 | icon = ExtResource("5_226fn")
204 | alignment = 0
205 |
206 | [node name="container_parameters_inside" type="VBoxContainer" parent="container_parameters"]
207 | layout_mode = 2
208 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/shaderinfo/parameter/ShaderInfoParameterContainer.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name ShaderInfoParameterContainer
3 | extends HBoxContainer
4 |
5 | @onready var comp_parameter:Label=$label_parameter
6 | @onready var comp_description:Label=$label_description
7 |
8 | var parameter:ShaderInfoParameter
9 |
10 | func loadParameter(parameter:ShaderInfoParameter)->void:
11 | self.parameter=parameter
12 | self.comp_parameter.text=parameter.name + " :"
13 | self.comp_description.text=parameter.description
14 |
15 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/extension/shaderinfo/parameter/ShaderInfoParameterContainer.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://b8ls4hebrqab0"]
2 |
3 | [ext_resource type="Script" path="res://addons/sprite-shader-mixer/src/extension/shaderinfo/parameter/ShaderInfoParameterContainer.gd" id="1_6csjd"]
4 |
5 | [node name="main" type="HBoxContainer"]
6 | anchors_preset = 15
7 | anchor_right = 1.0
8 | anchor_bottom = 1.0
9 | grow_horizontal = 2
10 | grow_vertical = 2
11 | script = ExtResource("1_6csjd")
12 |
13 | [node name="HBoxContainer" type="HBoxContainer" parent="."]
14 | custom_minimum_size = Vector2(20, 0)
15 | layout_mode = 2
16 |
17 | [node name="label_parameter" type="Label" parent="."]
18 | layout_mode = 2
19 | size_flags_vertical = 0
20 | theme_override_font_sizes/font_size = 10
21 | text = "license:"
22 |
23 | [node name="label_description" type="Label" parent="."]
24 | layout_mode = 2
25 | size_flags_vertical = 0
26 | theme_override_colors/font_color = Color(0.4, 1, 0.270588, 1)
27 | theme_override_font_sizes/font_size = 10
28 | text = "MIT"
29 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/plugin/SpriteShaderMixerEditorInspectorPlugin.gd:
--------------------------------------------------------------------------------
1 | extends EditorInspectorPlugin
2 |
3 | var ex_view = preload("res://addons/sprite-shader-mixer/src/extension/ExtensionView.tscn")
4 |
5 | func _can_handle(object):
6 | return (object is Sprite2D) or (object is AnimatedSprite2D) or (object is Label) or (object is ColorRect)
7 |
8 | func _parse_begin(object):
9 | var view = ex_view.instantiate()
10 | view.setParentSprite(object)
11 | add_custom_control(view)
12 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/plugin/SpriteShaderMixerEditorPlugin.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name PluginSpriteShaderMixerEditorPlugin
3 | extends EditorPlugin
4 |
5 | var tool_create_plugin = preload("res://addons/sprite-shader-mixer/src/plugin/SpriteShaderMixerEditorInspectorPlugin.gd")
6 |
7 | func _enter_tree():
8 | tool_create_plugin = tool_create_plugin.new()
9 | add_inspector_plugin(tool_create_plugin)
10 |
11 |
12 | func _exit_tree():
13 | remove_inspector_plugin(tool_create_plugin)
14 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/util/Util.gd:
--------------------------------------------------------------------------------
1 | class_name Util
2 | extends Object
3 |
4 | # Read a file and return the content of it
5 | # filePath -> the absolute path
6 | # return -> the file content
7 | static func readFile(filePath:String)->String:
8 | if(!FileAccess.file_exists(filePath)):
9 | return ""
10 |
11 | var file=FileAccess.open(filePath, FileAccess.READ)
12 | var content=file.get_as_text()
13 | file.close()
14 | return content
15 |
16 | # Delete a file on the filesystem
17 | # filePath -> the aboslute path
18 | static func deleteFile(filePath:String):
19 | DirAccess.remove_absolute(filePath)
20 |
21 |
22 | # Save content to a file
23 | # filePath -> the aboslute path
24 | # content -> the content to store inside
25 | static func saveFile(filePath:String, content:String):
26 | var file=FileAccess.open(filePath, FileAccess.WRITE)
27 | file.store_string(content)
28 | file.close()
29 |
30 | # Save content binary to a file
31 | # filePath -> the aboslute path
32 | # content -> the content to store inside
33 | static func saveBinaryFile(filePath:String, content:PackedByteArray):
34 | var file=FileAccess.open(filePath, FileAccess.WRITE)
35 | file.store_buffer(content)
36 | file.close()
37 |
38 | # Read a JSON file and return the conent of it as a Variant
39 | # filePath -> the absolute path
40 | # return -> the json file content parsed as generic object
41 | static func readJsonFile(filePath:String)->Variant:
42 | var file = FileAccess.open(filePath, FileAccess.READ)
43 | if(file!=null):
44 | var content:String = file.get_as_text()
45 | return JSON.parse_string(content)
46 | return null
47 |
48 |
--------------------------------------------------------------------------------
/addons/sprite-shader-mixer/src/util/UtilHTTP.gd:
--------------------------------------------------------------------------------
1 | class_name UtilHTTP
2 | extends Object
3 |
4 | static func httpsDownloadJson(host:String, url:String)->String:
5 | var byteArray = await httpsDownloadBinary(host, url)
6 | return byteArray.get_string_from_ascii()
7 |
8 | static func httpsDownloadBinary(host:String, url:String)->PackedByteArray:
9 | var err = 0
10 | var http = HTTPClient.new() # Create the Client.
11 | var tls=TLSOptions.client()
12 | err = http.connect_to_host(host, 443, tls) # Connect to host/port.
13 | assert(err == OK) # Make sure connection is OK.
14 |
15 | # Wait until resolved and connected.
16 | while http.get_status() == HTTPClient.STATUS_CONNECTING or http.get_status() == HTTPClient.STATUS_RESOLVING:
17 | http.poll()
18 | #print("Connecting...")
19 | if not OS.has_feature("web"):
20 | OS.delay_msec(500)
21 | else:
22 | await Engine.get_main_loop()
23 |
24 | assert(http.get_status() == HTTPClient.STATUS_CONNECTED) # Check if the connection was made successfully.
25 |
26 | # Some headers
27 | var headers = [
28 | "User-Agent: Pirulo/1.0 (Godot)",
29 | "Accept: */*"
30 | ]
31 |
32 | err = http.request(HTTPClient.METHOD_GET, url, headers) # Request a page from the site (this one was chunked..)
33 | assert(err == OK) # Make sure all is OK.
34 |
35 | while http.get_status() == HTTPClient.STATUS_REQUESTING:
36 | # Keep polling for as long as the request is being processed.
37 | http.poll()
38 | #print("Requesting...")
39 | if OS.has_feature("web"):
40 | # Synchronous HTTP requests are not supported on the web,
41 | # so wait for the next main loop iteration.
42 | await Engine.get_main_loop()
43 | else:
44 | OS.delay_msec(500)
45 |
46 | #print_debug("status:",http.get_status())
47 | assert(http.get_status() == HTTPClient.STATUS_BODY or http.get_status() == HTTPClient.STATUS_CONNECTED) # Make sure request finished well.
48 |
49 | #print("response? ", http.has_response()) # Site might not have a response.
50 |
51 | if http.has_response():
52 | # If there is a response...
53 |
54 | headers = http.get_response_headers_as_dictionary() # Get response headers.
55 | #print("code: ", http.get_response_code()) # Show response code.
56 | #print("**headers:\\n", headers) # Show headers.
57 |
58 | # Getting the HTTP Body
59 |
60 | if http.is_response_chunked():
61 | # Does it use chunks?
62 | #print("Response is Chunked!")
63 | pass
64 | else:
65 | # Or just plain Content-Length
66 | var bl = http.get_response_body_length()
67 | #print("Response Length: ", bl)
68 |
69 | # This method works for both anyway
70 |
71 | var rb = PackedByteArray() # Array that will hold the data.
72 |
73 | while http.get_status() == HTTPClient.STATUS_BODY:
74 | # While there is body left to be read
75 | http.poll()
76 | # Get a chunk.
77 | var chunk = http.read_response_body_chunk()
78 | if chunk.size() == 0:
79 | if not OS.has_feature("web"):
80 | # Got nothing, wait for buffers to fill a bit.
81 | OS.delay_usec(1000)
82 | else:
83 | await Engine.get_main_loop()
84 | else:
85 | rb = rb + chunk # Append to read buffer.
86 | # Done!
87 |
88 | return rb
89 | return PackedByteArray()
90 |
--------------------------------------------------------------------------------
/demo/assets/godot-text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/demo/assets/godot-text.png
--------------------------------------------------------------------------------
/demo/assets/godot-text.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dg1bar8amfygq"
6 | path="res://.godot/imported/godot-text.png-514f2ec64a192723d676e013b4f1cece.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://demo/assets/godot-text.png"
14 | dest_files=["res://.godot/imported/godot-text.png-514f2ec64a192723d676e013b4f1cece.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/demo/assets/shaders/chars_texture3x3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/demo/assets/shaders/chars_texture3x3.png
--------------------------------------------------------------------------------
/demo/assets/shaders/chars_texture3x3.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://d2xrvklvm45mw"
6 | path="res://.godot/imported/chars_texture3x3.png-b24f7919681570e5b5647cdd5d0a88a7.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://demo/assets/shaders/chars_texture3x3.png"
14 | dest_files=["res://.godot/imported/chars_texture3x3.png-b24f7919681570e5b5647cdd5d0a88a7.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/demo/assets/shaders/example1.gdshader:
--------------------------------------------------------------------------------
1 | //ATTENTION:
2 | // THIS IS SHADE AUTOGENERATED BY
3 | // THE ADDON SPRITE-SHADER-MIXER
4 | // ANY MANUAL CHANGES WILL BE REMOVED WHEN THE ADDON
5 | // UPDATES THIS SHADER.
6 | // ANYWAY, YOU CAN SAVE THE CURRENT VERSION AS A RESOURCE FILE.
7 | //SHADERS:Shield,Hologram,Pulse,
8 | shader_type canvas_item;
9 |
10 |
11 | //SHIELD
12 | uniform bool SHIELD_active = true;
13 | uniform float SHIELD_ring_radius : hint_range(0.1, 0.5, 0.01) = 0.4;
14 | uniform float SHIELD_thickness_scalar : hint_range(0.0, 1, 0.05) = 0.7;
15 | uniform float SHIELD_oscillation_scalar : hint_range(0.0, 0.25, 0.005) = 0.025;
16 | uniform float SHIELD_speed : hint_range(0.0, 50.0, 0.1) = 2.0;
17 | uniform vec4 SHIELD_main_color : source_color = vec4(0.0,0.5,0.0,1.0);
18 | uniform vec4 SHIELD_lerp_color : source_color = vec4(0.0,1.0,0.0,1.0);
19 | float SHIELD_range_lerp(float value, float min1, float min2, float max1, float max2){
20 | return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
21 | }
22 | void shield(in vec2 uv, in sampler2D sampler, vec2 size, vec2 pixelSize, inout vec4 color){
23 | // Calculate the distance between the current pixel and the center of the unit
24 | float dist = distance(uv, vec2(0.5, 0.5));
25 |
26 | // Add a slight oscillation to the size of the ring
27 | float o = cos(TIME * SHIELD_speed) - sin(TIME*SHIELD_speed)*dist*SHIELD_speed;
28 | float ring_size = SHIELD_ring_radius + o * SHIELD_oscillation_scalar;
29 |
30 | // Solve for ring alpha channel
31 | float alpha = step(dist, ring_size) * smoothstep(ring_size * (1.0 - SHIELD_thickness_scalar), ring_size, dist);
32 |
33 | // Solve w mix amount for optional color lerping
34 | float w = SHIELD_range_lerp(o, -1.0, 1.0, 1.0, 0.0);
35 |
36 | // Output the final color
37 | if(alpha>0.){
38 | vec4 newColor = vec4(mix(SHIELD_main_color.rgb, SHIELD_lerp_color.rgb, w), alpha );
39 | if(color.a > 0.){
40 | color = color * mix(newColor, color, 2.*color.a);
41 | }else{
42 | color = newColor;
43 | }
44 | }
45 | }
46 | uniform bool HOLOGRAM_active = true;
47 | uniform float HOLOGRAM_mix : hint_range(0, 1, .1) = 0;
48 | uniform int HOLOGRAM_lines = 100;
49 | uniform vec4 HOLOGRAM_color1 : source_color = vec4(0.0, 0.0, 1.0, 1.0);
50 | uniform vec4 HOLOGRAM_color2 : source_color = vec4(1.0, 0.0, 0.0, 1.0);
51 | uniform float HOLOGRAM_speed : hint_range(0.0, 2.0, 0.01) = 0.4;
52 | uniform float HOLOGRAM_alpha : hint_range(0.0, 1.0, 0.01) = 0.5;
53 | uniform float HOLOGRAM_noise_amount : hint_range(0.0, 1.0, 0.01) = 0.05;
54 | uniform float HOLOGRAM_effect_factor : hint_range(0.0, 1.0, 0.01) = 0.4;
55 | void HOLOGRAM_noise(in vec2 uv, inout vec4 color) {
56 | float a = fract(sin(dot(uv, vec2(12.9898, 78.233) * TIME)) * 438.5453) * 1.9;
57 | color.rgb = mix(color.rgb, vec3(a), HOLOGRAM_noise_amount);
58 | }
59 | vec4 HOLOGRAM_color_shift(in vec2 uv, in sampler2D image, vec2 shift_vector) {
60 | return texture(image, uv - shift_vector);
61 | }
62 | void hologram(in vec2 uv, in sampler2D txt, in vec2 size, in vec2 pixelSize, inout vec4 finalColor){
63 | float lineN = floor((uv.y - TIME*HOLOGRAM_speed) * float(HOLOGRAM_lines));
64 | float line_grade = abs(sin(lineN*PI/4.0));
65 | float smooth_line_grade = abs(sin((uv.y - TIME*HOLOGRAM_speed) * float(HOLOGRAM_lines)));
66 |
67 | vec4 line_color = mix(HOLOGRAM_color1, HOLOGRAM_color2, line_grade);
68 |
69 | // change the "240.0" literal to control line color shifting
70 | finalColor = mix(HOLOGRAM_color_shift(uv, txt, vec2(1.0, 0.0)*smooth_line_grade/240.0*HOLOGRAM_effect_factor), finalColor, HOLOGRAM_mix);
71 |
72 | HOLOGRAM_noise(uv, finalColor);
73 |
74 | finalColor.rgb = mix(finalColor.rgb, line_color.rgb, HOLOGRAM_effect_factor);
75 | finalColor.a = HOLOGRAM_alpha * finalColor.a * line_color.a;
76 | }
77 |
78 | uniform bool PULSE_active = true; //activation
79 | uniform vec4 PULSE_shine_color : source_color = vec4(1.0); //Shine color
80 | uniform float PULSE_alpha_limit : hint_range(0.0, 1.0, 0.1) = 0.0; //Alpha color limit to apply the shine, for example, if you won't to apply the shine to semi-transparent pixels
81 | uniform float PULSE_cycle_speed : hint_range(0.0, 100.0, 0.1) = 1.0; //Pulse cycle speed
82 | uniform bool PULSE_full_pulse_cycle = false; //[False = Do the effect and make a pause] [True = Do the effect continuosly]
83 | void pulse(in vec2 uv, in sampler2D tex, in vec2 spriteSize, in vec2 pixelSize, inout vec4 color)
84 | {
85 | //Check the pixel alpha value
86 | if (color.a >= PULSE_alpha_limit)
87 | {
88 | float cycle = sin(TIME * PULSE_cycle_speed);
89 | color.rgb = mix(color.rgb, PULSE_shine_color.rgb, (((cycle >= 0.0) || (PULSE_full_pulse_cycle)) ? abs(cycle) : 0.0) * PULSE_shine_color.a);
90 | }
91 | }
92 |
93 | void fragment() {
94 | vec4 color = texture(TEXTURE, UV);
95 | vec2 size = vec2(textureSize(TEXTURE, 0));
96 | vec2 uv = UV;
97 | vec2 screen_uv = SCREEN_UV;
98 |
99 | if(SHIELD_active) shield(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
100 | if(HOLOGRAM_active) hologram(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
101 | if(PULSE_active) pulse(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
102 |
103 |
104 | COLOR=color;
105 | }
106 |
107 | void vertex() {
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/demo/assets/shaders/example2.gdshader:
--------------------------------------------------------------------------------
1 | //ATTENTION:
2 | // THIS IS SHADE AUTOGENERATED BY
3 | // THE ADDON SPRITE-SHADER-MIXER
4 | // ANY MANUAL CHANGES WILL BE REMOVED WHEN THE ADDON
5 | // UPDATES THIS SHADER.
6 | // ANYWAY, YOU CAN SAVE THE CURRENT VERSION AS A RESOURCE FILE.
7 | //SHADERS:Gold,Teleport,Shadow,
8 | shader_type canvas_item;
9 |
10 |
11 | //GOLD
12 | uniform bool GOLD_active = true;
13 | uniform float GOLD_offset: hint_range(0, 100) = 0;
14 | uniform float GOLD_speed : hint_range(0, 10) = 1;
15 | uniform float GOLD_mix : hint_range(0,1)=0;
16 | float gold_calc_luminance(vec3 color)
17 | {
18 | return dot(color, vec3( 0.299, 0.587, 0.114));
19 | }
20 | float gold_mark_light(vec2 uv, float value)
21 | {
22 | vec2 co = uv * 5.0;
23 | float n = sin(value + co.x) + sin(value - co.x) + sin(value + co.y) + sin(value + 2.5 * co.y);
24 | return fract((5.0 + n) / 5.0);
25 | }
26 | void gold(in vec2 uv, in sampler2D txt, in vec2 spriteSize, in vec2 pixelSize, inout vec4 finalColor)
27 | {
28 | float value = GOLD_offset + TIME * GOLD_speed;
29 | vec4 txt_color = texture(txt, uv);
30 | float luminance = gold_calc_luminance(txt_color.rbg);
31 | vec3 metal = vec3(luminance);
32 | metal.r = luminance * pow(1.5 * luminance, 3.0);
33 | metal.g = luminance * pow(1.5 * luminance, 3.0);
34 | metal.b = luminance * pow(0.75 * luminance, 3.0);
35 |
36 | float n = gold_mark_light(uv, value);
37 | n += dot(txt_color.rbg, vec3(0.2, 0.4, 0.2));
38 | n = fract(n);
39 |
40 | float a = clamp(abs(n * 6.0 - 2.0), 0.0, 1.0);
41 | vec4 color = vec4(metal.rgb + (1.0 - a), 1.0);
42 | color.rgb = color.rgb * 0.5 + dot(color.rgb, vec3 (0.113, 0.455, 0.172)) - vec3(0.0, 0.1, 0.6) + 0.025;
43 | color.a = txt_color.a;
44 | finalColor = mix(color, finalColor, GOLD_mix);
45 | }
46 |
47 |
48 | //TELEPORT
49 | uniform bool TELEPORT_active = true;
50 | uniform float TELEPORT_progress : hint_range(0.0, 1.0);
51 | uniform float TELEPORT_noise_desnity:hint_range(0.0, 500.0, 0.1) = 60;
52 | uniform float TELEPORT_beam_size : hint_range(0.01, 0.15);
53 | uniform vec4 TELEPORT_color : source_color = vec4(0.0, 1.02, 1.2, 1.0);
54 | vec2 TELEPORT_random(vec2 uv){
55 | uv = vec2( dot(uv, vec2(127.1,311.7) ),
56 | dot(uv, vec2(269.5,183.3) ) );
57 | return -1.0 + 2.0 * fract(sin(uv) * 43758.5453123);
58 | }
59 | float TELEPORT_noise(vec2 uv) {
60 | vec2 uv_index = floor(uv);
61 | vec2 uv_fract = fract(uv);
62 |
63 | vec2 blur = smoothstep(0.0, 1.0, uv_fract);
64 |
65 | return mix( mix( dot( TELEPORT_random(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ),
66 | dot( TELEPORT_random(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x),
67 | mix( dot( TELEPORT_random(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ),
68 | dot( TELEPORT_random(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) * 0.5 + 0.5;
69 | }
70 | void teleport(in vec2 uv, in sampler2D txt, vec2 size, vec2 pixelSize, inout vec4 color)
71 | {
72 | float noise = TELEPORT_noise(uv * TELEPORT_noise_desnity) * uv.y;
73 |
74 | float d1 = step(TELEPORT_progress, noise);
75 | float d2 = step(TELEPORT_progress - TELEPORT_beam_size, noise);
76 |
77 | vec3 beam = vec3(d2 - d1) * color.rgb;
78 |
79 | color.rgb += beam;
80 | color.a *= d2;
81 | }
82 | //SHADOW
83 | uniform bool SHADOW_active = true;
84 | uniform vec2 SHADOW_deform = vec2(0.0, 0.0);
85 | uniform vec2 SHADOW_offset = vec2(20.0, 20.0);
86 | uniform vec4 SHADOW_modulate : source_color;
87 | uniform float SHADOW_mix : hint_range(0,1) = 0;
88 | void shadow(in vec2 uv, in sampler2D txt, in vec2 size, in vec2 texturePixelSize, inout vec4 color) {
89 | float sizex = float(textureSize(txt,int(texturePixelSize.x)).x); //comment for GLES2
90 | float sizey = float(textureSize(txt,int(texturePixelSize.y)).y); //comment for GLES2
91 | //float sizex = texture_size.x; //uncomment for GLES2
92 | //float sizey = texture_size.y; //uncomment for GLES2
93 | uv.y+=SHADOW_offset.y*texturePixelSize.y;
94 | uv.x+=SHADOW_offset.x*texturePixelSize.x;
95 | float decalx=((uv.y-texturePixelSize.x*sizex)*SHADOW_deform.x);
96 | float decaly=((uv.y-texturePixelSize.y*sizey)*SHADOW_deform.y);
97 | uv.x += decalx;
98 | uv.y += decaly;
99 | vec4 shadow = vec4(SHADOW_modulate.rgb, texture(txt, uv).a * SHADOW_modulate.a * 0.5);
100 | color =mix(mix(shadow, color, color.a), color, SHADOW_mix);
101 | }
102 |
103 |
104 | void fragment() {
105 | vec4 color = texture(TEXTURE, UV);
106 | vec2 size = vec2(textureSize(TEXTURE, 0));
107 | vec2 uv = UV;
108 | vec2 screen_uv = SCREEN_UV;
109 |
110 | if(GOLD_active) gold(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
111 | if(TELEPORT_active) teleport(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
112 | if(SHADOW_active) shadow(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
113 |
114 |
115 | COLOR=color;
116 | }
117 |
118 | void vertex() {
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/demo/assets/shaders/example3.gdshader:
--------------------------------------------------------------------------------
1 | //ATTENTION:
2 | // THIS IS SHADE AUTOGENERATED BY
3 | // THE ADDON SPRITE-SHADER-MIXER
4 | // ANY MANUAL CHANGES WILL BE REMOVED WHEN THE ADDON
5 | // UPDATES THIS SHADER.
6 | // ANYWAY, YOU CAN SAVE THE CURRENT VERSION AS A RESOURCE FILE.
7 | //SHADERS:Matrix,Color Swap,Border Noise,
8 | shader_type canvas_item;
9 |
10 |
11 | //MATRIX
12 | uniform bool MATRIX_active = true;
13 | uniform int MATRIX_direction = 0;
14 | uniform float MATRIX_velocity : hint_range(0, 4) = 0.5;
15 | uniform float MATRIX_row : hint_range(1.0, 100.0) = 12.0;
16 | uniform float MATRIX_column : hint_range(1.0, 100.0) = 12.0;
17 | uniform float MATRIX_value : hint_range(1, 25) = 20;
18 | uniform sampler2D MATRIX_chars_tex;
19 | uniform float MATRIX_number_row_char_texture = 3.0;
20 | uniform float MATRIX_number_column_char_texture = 3.0;
21 | uniform vec4 MATRIX_tint_color : source_color = vec4(0.12, 0.62, 0.92, 1.0);
22 | uniform float MATRIX_line_thickness : hint_range(0, 20) = 5.0;
23 | uniform float MATRIX_mix : hint_range(0, 1) = 0;
24 | float matrix_rand1(vec2 co, float random_seed)
25 | {
26 | return fract(sin(dot(co.xy * random_seed, vec2(12.,85.5))) * 120.01);
27 | }
28 | vec3 matrix_randomColor (int indexColumn)
29 | {
30 | float f = float(indexColumn);
31 | float red = matrix_rand1(vec2(f, 1.0), f) * 0.8;
32 | float blue = matrix_rand1(vec2(f, 1.0), f + 1.0) * 0.5;
33 | float green = matrix_rand1(vec2(f, 1.0), f + 2.0);
34 | return vec3(red, blue, green);
35 | }
36 | float matrix_rand2_with_range(vec2 co, float m, float M, float random_seed)
37 | {
38 | float r1 = matrix_rand1(co, random_seed);
39 | return (M - m) * r1 + r1;
40 | }
41 | vec3 matrix_rain(vec2 uv, float _matrix_value, float number_row, float number_column, int di, float time)
42 | {
43 | float column_size = 1.0 / number_column;
44 | float row_size = 1.0 / number_row;
45 |
46 | float x = uv.x - mod(uv.x, column_size);
47 | float offset = sin(x * 15.0);
48 | float speed = cos(x * 3.0) * 0.3 + 0.7;
49 |
50 | float y = uv.y - mod(uv.y, row_size);
51 | y = (di > 0) ? fract(y + time * speed + offset) : fract(1.0 - y + time * speed + offset);
52 | float alpha = 1.0 / ((26.0 - _matrix_value) * y);
53 |
54 | vec3 color = MATRIX_tint_color.rgb;
55 | color *= alpha;
56 | return color;
57 | }
58 | vec2 matrix_randomIndexChar(vec2 char_size, vec2 blockID, float time)
59 | {
60 | vec2 indexChar = vec2(0, 0);
61 | float t = time - mod(time, 0.1);
62 | float r1 = matrix_rand2_with_range(blockID / char_size + t, 1, char_size.x, 1);
63 | indexChar.x = blockID.x + char_size.x * r1;
64 | indexChar.y = blockID.y + char_size.y * r1;
65 |
66 | indexChar = mod(floor(indexChar), char_size);
67 | return indexChar;
68 | }
69 | float matrix_text(vec2 uv, float number_row, float number_column, float time)
70 | {
71 | float column_size = 1.0 / number_column;
72 | float row_size = 1.0 / number_row;
73 | vec2 block_size = vec2(column_size, row_size);
74 |
75 | vec2 blockID = floor(uv / block_size);
76 | vec2 _uv = mod(uv.xy, block_size) / block_size;
77 |
78 | vec2 char_texture_size = vec2(MATRIX_number_row_char_texture, MATRIX_number_column_char_texture);
79 | vec2 index_char = matrix_randomIndexChar(char_texture_size, blockID, time);
80 | _uv.y = 1.0 - _uv.y;
81 | _uv = (index_char + _uv) / char_texture_size;
82 |
83 | return texture(MATRIX_chars_tex, _uv).r;
84 | }
85 | void matrix(in vec2 uv, in sampler2D sampler,in vec2 texSize, vec2 pixelSize, inout vec4 color){
86 | vec3 rain = matrix_rain(uv, MATRIX_value, floor(MATRIX_row), floor(MATRIX_column), MATRIX_direction, TIME*MATRIX_velocity);
87 | float text = matrix_text(uv, floor(MATRIX_row), floor(MATRIX_column), TIME*MATRIX_velocity);
88 | vec3 matrix = text * rain;
89 | vec4 txt = texture(sampler, uv);
90 |
91 | vec2 size = pixelSize * MATRIX_line_thickness;
92 | float _outline = texture(sampler, uv + vec2(0, -size.y)).a;
93 | _outline += texture(sampler, uv + vec2(0, -size.y * 2.0)).a;
94 | _outline += texture(sampler, uv + vec2(0, -size.y * 3.0)).a;
95 | _outline += texture(sampler, uv + vec2(0, -size.y * 4.0)).a;
96 | _outline += texture(sampler, uv + vec2(0, -size.y * 5.0)).a;
97 | _outline += texture(sampler, uv + vec2(size.x, 0)).a;
98 | _outline += texture(sampler, uv + vec2(-size.x, 0)).a;
99 | _outline= min(1.0, _outline) - txt.a;
100 |
101 | float v = matrix.r + matrix.g + matrix.b;
102 | if (v > 1.0)
103 | {
104 | float have_char = min(1.0, v);
105 | vec4 outline_matrix = vec4(matrix, 1.0 * text);
106 | txt = mix(txt, outline_matrix, _outline);
107 | txt.rgb = mix(txt.rgb, matrix, have_char);
108 | }
109 |
110 | vec4 output_color = txt;
111 | color = mix(output_color,color,MATRIX_mix);
112 | }
113 |
114 | uniform bool COLORSWAP_active = true;
115 | uniform float COLORSWAP_mix:hint_range(0,1,0.1) = 0;
116 | uniform int COLORSWAP_max_colors:hint_range(1, 8, 1) = 8;
117 | uniform bool COLORSWAP_show_stripes = true;
118 | uniform float COLORSWAP_tolerance: hint_range(0.0, 1, 0.1);
119 | uniform vec4 COLORSWAP_input_color1 : source_color;
120 | uniform vec4 COLORSWAP_output_color1 : source_color;
121 | uniform vec4 COLORSWAP_input_color2 : source_color;
122 | uniform vec4 COLORSWAP_output_color2 : source_color;
123 | uniform vec4 COLORSWAP_input_color3 : source_color;
124 | uniform vec4 COLORSWAP_output_color3 : source_color;
125 | uniform vec4 COLORSWAP_input_color4 : source_color;
126 | uniform vec4 COLORSWAP_output_color4 : source_color;
127 | uniform vec4 COLORSWAP_input_color5 : source_color;
128 | uniform vec4 COLORSWAP_output_color5 : source_color;
129 | uniform vec4 COLORSWAP_input_color6 : source_color;
130 | uniform vec4 COLORSWAP_output_color6 : source_color;
131 | uniform vec4 COLORSWAP_input_color7 : source_color;
132 | uniform vec4 COLORSWAP_output_color7 : source_color;
133 | uniform vec4 COLORSWAP_input_color8 : source_color;
134 | uniform vec4 COLORSWAP_output_color8 : source_color;
135 | vec4 COLORSWAP_grayscale(vec4 color){
136 | float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114));
137 | return vec4(gray, gray, gray, color.a);
138 | }
139 | vec4 COLORSWAP_stripe(vec2 uv, vec4 color){
140 | float w = cos(0.7854) * uv.x + sin(0.7854) * uv.y - 0.05 * TIME;
141 | if (floor(mod(w * 48.0, 2.0)) < 0.0001) {
142 | return color;
143 | }
144 | else {
145 | return COLORSWAP_grayscale(color);
146 | }
147 | }
148 | bool COLORSWAP_isColorSimilar(vec4 color1, vec4 color2){
149 | return (
150 | color1.r > (color2.r - COLORSWAP_tolerance) &&
151 | color1.r < (color2.r + COLORSWAP_tolerance) &&
152 | color1.g > (color2.g - COLORSWAP_tolerance) &&
153 | color1.g < (color2.g + COLORSWAP_tolerance) &&
154 | color1.b > (color2.b - COLORSWAP_tolerance) &&
155 | color1.b < (color2.b + COLORSWAP_tolerance)
156 | );
157 | }
158 | void colorswap(in vec2 uv, in sampler2D txt, in vec2 size, in vec2 pixelSize, inout vec4 finalColor){
159 | vec4[] input_colors = {
160 | COLORSWAP_input_color1,
161 | COLORSWAP_input_color2,
162 | COLORSWAP_input_color3,
163 | COLORSWAP_input_color4,
164 | COLORSWAP_input_color5,
165 | COLORSWAP_input_color6,
166 | COLORSWAP_input_color7,
167 | COLORSWAP_input_color8
168 | };
169 |
170 | vec4[] output_colors = {
171 | COLORSWAP_output_color1,
172 | COLORSWAP_output_color2,
173 | COLORSWAP_output_color3,
174 | COLORSWAP_output_color4,
175 | COLORSWAP_output_color5,
176 | COLORSWAP_output_color6,
177 | COLORSWAP_output_color7,
178 | COLORSWAP_output_color8
179 | };
180 |
181 | bool is_color = false;
182 |
183 | for(int cr = 0; cr < COLORSWAP_max_colors; cr++){
184 | if (finalColor.a>0. && COLORSWAP_isColorSimilar(finalColor, input_colors[cr])){
185 | finalColor = mix(output_colors[cr], finalColor, COLORSWAP_mix);
186 | is_color = true;
187 | break;
188 | }
189 | }
190 |
191 | if (!is_color){
192 | if (COLORSWAP_show_stripes && !(finalColor.a < 0.001)){
193 | finalColor = mix(COLORSWAP_stripe(uv, finalColor), finalColor, COLORSWAP_mix);
194 | }
195 | }
196 | }
197 |
198 | uniform bool BORDERNOISE_active = true;
199 | uniform float BORDERNOISE_max_line_width:hint_range(0.0, 50.0, 0.1) = 10.0;
200 | uniform float BORDERNOISE_min_line_width:hint_range(0.0, 1000.0, 0.1) = 5.0;
201 | uniform float BORDERNOISE_freq:hint_range(0.0, 12.0, 0.1) = 1.0;
202 | uniform float BORDERNOISE_block_size:hint_range(0.0, 100.0, 0.1) = 20.0;
203 | uniform vec4 BORDERNOISE_starting_colour : source_color= vec4(0,0,0,1);
204 | uniform vec4 BORDERNOISE_ending_colour: source_color = vec4(1);
205 | const float BORDERNOISE_pi = 3.1415;
206 | const int BORDERNOISE_ang_res = 16;
207 | const int BORDERNOISE_grad_res = 8;
208 | float BORDERNOISE_hash(vec2 p, float s) {
209 | return fract(35.1 * sin(dot(vec3(112.3, 459.2, 753.2), vec3(p, s))));
210 | }
211 | float BORDERNOISE_noise(vec2 p, float s) {
212 | vec2 d = vec2(0, 1)*sin(TIME);
213 | vec2 b = floor(p)*sin(TIME);
214 | vec2 f = fract(p);
215 | return mix(
216 | mix(BORDERNOISE_hash(b + d.xx, s), BORDERNOISE_hash(b + d.yx, s), f.x),
217 | mix(BORDERNOISE_hash(b + d.xy, s), BORDERNOISE_hash(b + d.yy, s), f.x), f.y);
218 | }
219 | float BORDERNOISE_getLineWidth(vec2 p, float s) {
220 | p /= BORDERNOISE_block_size;
221 | float w = 0.0;
222 | float intensity = 1.0;
223 | for (int i = 0; i < 3; i++) {
224 | w = mix(w, BORDERNOISE_noise(p, s), intensity);
225 | p /= 2.0;
226 | intensity /= 2.0;
227 | }
228 |
229 | return mix(BORDERNOISE_max_line_width, BORDERNOISE_min_line_width, w);
230 | }
231 | bool BORDERNOISE_pixelInRange(sampler2D text, vec2 uv, vec2 dist) {
232 | float alpha = 0.0;
233 | for (int i = 0; i < BORDERNOISE_ang_res; i++) {
234 | float angle = 2.0 * BORDERNOISE_pi * float(i) / float(BORDERNOISE_ang_res);
235 | vec2 disp = dist * vec2(cos(angle), sin(angle));
236 | if (texture(text, uv + disp).a > 0.0) return true;
237 | }
238 | return false;
239 | }
240 | float BORDERNOISE_getClosestDistance(sampler2D text, vec2 uv, vec2 maxDist) {
241 | if (!BORDERNOISE_pixelInRange(text, uv, maxDist)) return -1.0;
242 |
243 | float hi = 1.0; float lo = 0.0;
244 |
245 | for (int i = 1; i <= BORDERNOISE_grad_res; i++) {
246 | float curr = (hi + lo) / 2.0;
247 | if (BORDERNOISE_pixelInRange(text, uv, curr * maxDist)) {
248 | hi = curr;
249 | }
250 | else {
251 | lo = curr;
252 | }
253 | }
254 | return hi;
255 |
256 | }
257 | void borderNoise(in vec2 uv, in sampler2D txt, vec2 size, vec2 pixelSize, inout vec4 color){
258 | float timeStep = floor(BORDERNOISE_freq * TIME);
259 | vec2 scaledDist = pixelSize;
260 | scaledDist *= BORDERNOISE_getLineWidth(uv / pixelSize, timeStep);
261 | float w = BORDERNOISE_getClosestDistance(txt, uv, scaledDist);
262 |
263 | if (( w > 0.0) && (texture(txt, uv).a < 0.2)) {
264 | color = mix(BORDERNOISE_starting_colour, BORDERNOISE_ending_colour, tanh(3.0*w));
265 | }
266 | }
267 |
268 | void fragment() {
269 | vec4 color = texture(TEXTURE, UV);
270 | vec2 size = vec2(textureSize(TEXTURE, 0));
271 | vec2 uv = UV;
272 | vec2 screen_uv = SCREEN_UV;
273 |
274 | if(MATRIX_active) matrix(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
275 | if(COLORSWAP_active) colorswap(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
276 | if(BORDERNOISE_active) borderNoise(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
277 |
278 |
279 | COLOR=color;
280 | }
281 |
282 | void vertex() {
283 |
284 | }
--------------------------------------------------------------------------------
/demo/assets/shaders/noise1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/demo/assets/shaders/noise1.png
--------------------------------------------------------------------------------
/demo/assets/shaders/noise1.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://d1jgbfat8ipuj"
6 | path="res://.godot/imported/noise1.png-aebb16f1e01dde1d4301154e4365c810.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://demo/assets/shaders/noise1.png"
14 | dest_files=["res://.godot/imported/noise1.png-aebb16f1e01dde1d4301154e4365c810.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/demo/assets/supergodot/animation.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="SpriteFrames" load_steps=21 format=3 uid="uid://vk46lrviw2t3"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://bkmtfe42ptooh" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0000.png" id="1_fcmvn"]
4 | [ext_resource type="Texture2D" uid="uid://b1o4oqvqpb1qy" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0001.png" id="2_oi1dm"]
5 | [ext_resource type="Texture2D" uid="uid://bs33nr7syqox7" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0002.png" id="3_gt7fe"]
6 | [ext_resource type="Texture2D" uid="uid://8wimrai50mn1" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0003.png" id="4_fmvbe"]
7 | [ext_resource type="Texture2D" uid="uid://dwpufhhaw82ug" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0004.png" id="5_ow0m5"]
8 | [ext_resource type="Texture2D" uid="uid://cihrw6565y3r1" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0005.png" id="6_ai0v8"]
9 | [ext_resource type="Texture2D" uid="uid://cblgnfg5ui8df" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0006.png" id="7_570lf"]
10 | [ext_resource type="Texture2D" uid="uid://xols7iqcmm6u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0007.png" id="8_e7ufp"]
11 | [ext_resource type="Texture2D" uid="uid://cv1ig6gansjqn" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0008.png" id="9_vh1yh"]
12 | [ext_resource type="Texture2D" uid="uid://0e7h0nbb5uxg" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0009.png" id="10_ccy8w"]
13 | [ext_resource type="Texture2D" uid="uid://bglwd2chn700u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0010.png" id="11_5oyt2"]
14 | [ext_resource type="Texture2D" uid="uid://c145wbhfimwne" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0011.png" id="12_fcmb5"]
15 | [ext_resource type="Texture2D" uid="uid://dj4d28tivbgb0" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0012.png" id="13_aulyl"]
16 | [ext_resource type="Texture2D" uid="uid://7pagyvbmsoey" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0013.png" id="14_hw8vs"]
17 | [ext_resource type="Texture2D" uid="uid://coqntke8nkel5" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0014.png" id="15_o1u4f"]
18 | [ext_resource type="Texture2D" uid="uid://bdoqc7jitaivj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0015.png" id="16_8qk0w"]
19 | [ext_resource type="Texture2D" uid="uid://mwcarsfwblj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0016.png" id="17_0ixae"]
20 | [ext_resource type="Texture2D" uid="uid://d2dubli5df5va" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0017.png" id="18_eqhlp"]
21 | [ext_resource type="Texture2D" uid="uid://dqv5ugl4038aj" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0018.png" id="19_lt5ig"]
22 | [ext_resource type="Texture2D" uid="uid://dn2tu0peutt2u" path="res://addons/sprite-shader-mixer/assets/supergodot/supergodot-0019.png" id="20_qdud3"]
23 |
24 | [resource]
25 | animations = [{
26 | "frames": [{
27 | "duration": 1.0,
28 | "texture": ExtResource("1_fcmvn")
29 | }, {
30 | "duration": 1.0,
31 | "texture": ExtResource("2_oi1dm")
32 | }, {
33 | "duration": 1.0,
34 | "texture": ExtResource("3_gt7fe")
35 | }, {
36 | "duration": 1.0,
37 | "texture": ExtResource("4_fmvbe")
38 | }, {
39 | "duration": 1.0,
40 | "texture": ExtResource("5_ow0m5")
41 | }, {
42 | "duration": 1.0,
43 | "texture": ExtResource("6_ai0v8")
44 | }, {
45 | "duration": 1.0,
46 | "texture": ExtResource("7_570lf")
47 | }, {
48 | "duration": 1.0,
49 | "texture": ExtResource("8_e7ufp")
50 | }, {
51 | "duration": 1.0,
52 | "texture": ExtResource("9_vh1yh")
53 | }, {
54 | "duration": 1.0,
55 | "texture": ExtResource("10_ccy8w")
56 | }, {
57 | "duration": 1.0,
58 | "texture": ExtResource("11_5oyt2")
59 | }, {
60 | "duration": 1.0,
61 | "texture": ExtResource("12_fcmb5")
62 | }, {
63 | "duration": 1.0,
64 | "texture": ExtResource("13_aulyl")
65 | }, {
66 | "duration": 1.0,
67 | "texture": ExtResource("14_hw8vs")
68 | }, {
69 | "duration": 1.0,
70 | "texture": ExtResource("15_o1u4f")
71 | }, {
72 | "duration": 1.0,
73 | "texture": ExtResource("16_8qk0w")
74 | }, {
75 | "duration": 1.0,
76 | "texture": ExtResource("17_0ixae")
77 | }, {
78 | "duration": 1.0,
79 | "texture": ExtResource("18_eqhlp")
80 | }, {
81 | "duration": 1.0,
82 | "texture": ExtResource("19_lt5ig")
83 | }, {
84 | "duration": 1.0,
85 | "texture": ExtResource("20_qdud3")
86 | }],
87 | "loop": true,
88 | "name": &"default",
89 | "speed": 25.0
90 | }]
91 |
--------------------------------------------------------------------------------
/demo/assets/supergodot/supergodot-anim.kra:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/demo/assets/supergodot/supergodot-anim.kra
--------------------------------------------------------------------------------
/demo/demo.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=15 format=3 uid="uid://btvorthsuc7d1"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://d2xrvklvm45mw" path="res://demo/assets/shaders/chars_texture3x3.png" id="2_3ee8b"]
4 | [ext_resource type="Shader" path="res://demo/assets/shaders/example3.gdshader" id="2_40eie"]
5 | [ext_resource type="SpriteFrames" uid="uid://vk46lrviw2t3" path="res://demo/assets/supergodot/animation.tres" id="3_061al"]
6 | [ext_resource type="Shader" path="res://demo/assets/shaders/example2.gdshader" id="5_qmydy"]
7 | [ext_resource type="Shader" path="res://demo/assets/shaders/example1.gdshader" id="6_8kop3"]
8 | [ext_resource type="Texture2D" uid="uid://dg1bar8amfygq" path="res://demo/assets/godot-text.png" id="21_0xoix"]
9 |
10 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_1g2ki"]
11 | shader = ExtResource("2_40eie")
12 | shader_parameter/MATRIX_active = true
13 | shader_parameter/MATRIX_direction = 3
14 | shader_parameter/MATRIX_velocity = 0.582
15 | shader_parameter/MATRIX_row = 24.205
16 | shader_parameter/MATRIX_column = 28.952
17 | shader_parameter/MATRIX_value = 24.932
18 | shader_parameter/MATRIX_number_row_char_texture = 3.0
19 | shader_parameter/MATRIX_number_column_char_texture = 3.0
20 | shader_parameter/MATRIX_tint_color = Color(1, 0.694118, 1, 1)
21 | shader_parameter/MATRIX_line_thickness = 15.548
22 | shader_parameter/MATRIX_mix = 0.678
23 | shader_parameter/COLORSWAP_active = true
24 | shader_parameter/COLORSWAP_mix = 0.0
25 | shader_parameter/COLORSWAP_max_colors = 8
26 | shader_parameter/COLORSWAP_show_stripes = true
27 | shader_parameter/COLORSWAP_tolerance = 0.5
28 | shader_parameter/COLORSWAP_input_color1 = Color(0, 0.482353, 1, 1)
29 | shader_parameter/COLORSWAP_output_color1 = Color(0, 0.815686, 0.258824, 1)
30 | shader_parameter/COLORSWAP_input_color2 = null
31 | shader_parameter/COLORSWAP_output_color2 = null
32 | shader_parameter/COLORSWAP_input_color3 = null
33 | shader_parameter/COLORSWAP_output_color3 = null
34 | shader_parameter/COLORSWAP_input_color4 = null
35 | shader_parameter/COLORSWAP_output_color4 = null
36 | shader_parameter/COLORSWAP_input_color5 = null
37 | shader_parameter/COLORSWAP_output_color5 = null
38 | shader_parameter/COLORSWAP_input_color6 = null
39 | shader_parameter/COLORSWAP_output_color6 = null
40 | shader_parameter/COLORSWAP_input_color7 = null
41 | shader_parameter/COLORSWAP_output_color7 = null
42 | shader_parameter/COLORSWAP_input_color8 = null
43 | shader_parameter/COLORSWAP_output_color8 = null
44 | shader_parameter/BORDERNOISE_active = true
45 | shader_parameter/BORDERNOISE_max_line_width = 20.8
46 | shader_parameter/BORDERNOISE_min_line_width = 93.6
47 | shader_parameter/BORDERNOISE_freq = 0.9
48 | shader_parameter/BORDERNOISE_block_size = 17.5
49 | shader_parameter/BORDERNOISE_starting_colour = Color(1, 1, 0, 1)
50 | shader_parameter/BORDERNOISE_ending_colour = Color(0, 1, 0.360784, 1)
51 | shader_parameter/MATRIX_chars_tex = ExtResource("2_3ee8b")
52 |
53 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_h17j3"]
54 | shader = ExtResource("5_qmydy")
55 | shader_parameter/GOLD_active = true
56 | shader_parameter/GOLD_offset = 0.0
57 | shader_parameter/GOLD_speed = 0.494
58 | shader_parameter/GOLD_mix = 0.0
59 | shader_parameter/TELEPORT_active = true
60 | shader_parameter/TELEPORT_progress = 0.0
61 | shader_parameter/TELEPORT_noise_desnity = 500.0
62 | shader_parameter/TELEPORT_beam_size = 0.15
63 | shader_parameter/TELEPORT_color = Color(0.976471, 0.384314, 0, 1)
64 | shader_parameter/SHADOW_active = true
65 | shader_parameter/SHADOW_deform = Vector2(0, 0)
66 | shader_parameter/SHADOW_offset = Vector2(0, 0)
67 | shader_parameter/SHADOW_modulate = Color(0, 0, 0, 1)
68 | shader_parameter/SHADOW_mix = 0.0
69 |
70 | [sub_resource type="Animation" id="Animation_m6agy"]
71 | resource_name = "teleport"
72 | length = 4.0
73 | loop_mode = 1
74 | tracks/0/type = "value"
75 | tracks/0/imported = false
76 | tracks/0/enabled = true
77 | tracks/0/path = NodePath(".:material:shader_parameter/TELEPORT_progress")
78 | tracks/0/interp = 1
79 | tracks/0/loop_wrap = true
80 | tracks/0/keys = {
81 | "times": PackedFloat32Array(0, 2.1),
82 | "transitions": PackedFloat32Array(1.18921, 1.07177),
83 | "update": 0,
84 | "values": [0.0, 1.0]
85 | }
86 |
87 | [sub_resource type="AnimationLibrary" id="AnimationLibrary_byhr4"]
88 | _data = {
89 | "teleport": SubResource("Animation_m6agy")
90 | }
91 |
92 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_4qsww"]
93 | shader = ExtResource("6_8kop3")
94 | shader_parameter/SHIELD_active = true
95 | shader_parameter/SHIELD_ring_radius = 0.25
96 | shader_parameter/SHIELD_thickness_scalar = 0.25
97 | shader_parameter/SHIELD_oscillation_scalar = 0.025
98 | shader_parameter/SHIELD_speed = 2.3
99 | shader_parameter/SHIELD_main_color = Color(0, 0.501961, 1, 0.654902)
100 | shader_parameter/SHIELD_lerp_color = Color(0, 1, 1, 0.513726)
101 | shader_parameter/HOLOGRAM_active = true
102 | shader_parameter/HOLOGRAM_mix = 1.0
103 | shader_parameter/HOLOGRAM_lines = 100
104 | shader_parameter/HOLOGRAM_color1 = Color(0, 0, 1, 0.576471)
105 | shader_parameter/HOLOGRAM_color2 = Color(1, 0, 0, 1)
106 | shader_parameter/HOLOGRAM_speed = 0.59
107 | shader_parameter/HOLOGRAM_alpha = 1.0
108 | shader_parameter/HOLOGRAM_noise_amount = 0.25
109 | shader_parameter/HOLOGRAM_effect_factor = 0.08
110 | shader_parameter/PULSE_active = true
111 | shader_parameter/PULSE_shine_color = Color(1, 0.0117647, 0, 1)
112 | shader_parameter/PULSE_alpha_limit = 0.8
113 | shader_parameter/PULSE_cycle_speed = 5.8
114 | shader_parameter/PULSE_full_pulse_cycle = false
115 |
116 | [sub_resource type="Shader" id="Shader_yhvx2"]
117 | code = "//ATTENTION:
118 | // THIS IS SHADE AUTOGENERATED BY
119 | // THE ADDON SPRITE-SHADER-MIXER
120 | // ANY MANUAL CHANGES WILL BE REMOVED WHEN THE ADDON
121 | // UPDATES THIS SHADER.
122 | // ANYWAY, YOU CAN SAVE THE CURRENT VERSION AS A RESOURCE FILE.
123 | //SHADERS:Holowave,Outline,Shadow,
124 | shader_type canvas_item;
125 |
126 |
127 | //HOLOWAVE
128 | uniform bool HOLOWAVE_active = true;
129 | uniform float HOLOWAVE_offset: hint_range(0, 100) = 0;
130 | uniform float HOLOWAVE_speed : hint_range(-10, 10) = 1;
131 | uniform float HOLOWAVE_waveHeight : hint_range(0, 1) = 0.12;
132 | uniform float HOLOWAVE_waveSpeed: hint_range(0, 20) = 3;
133 | uniform float HOLOWAVE_waveFreq: hint_range(0, 100) = 30.0;
134 | uniform float HOLOWAVE_waveWidth: hint_range(0, 10) = 1.0;
135 | uniform float HOLOWAVE_mix: hint_range(0,1) = 0;
136 | float mark(vec2 uv, float height, float time)
137 | {
138 | float value = mod(uv.y - time * 0.5, 2.0);
139 | return (value < height) ? 1.0 : 0.0;
140 | }
141 | void holowave(in vec2 uv, in sampler2D sampler, vec2 size, vec2 pixelSize, inout vec4 color)
142 | {
143 | float time = HOLOWAVE_offset + TIME * HOLOWAVE_speed;
144 | vec2 wave_uv_offset = vec2(0, 0);
145 | wave_uv_offset.x = sin(time * HOLOWAVE_waveSpeed + uv.y * HOLOWAVE_waveFreq * 2.0) * uv.y * uv.y * HOLOWAVE_waveWidth * 0.1;
146 | float mark_value = mark(uv, HOLOWAVE_waveHeight, time);
147 | uv = (mark_value > 0.0) ? uv + wave_uv_offset : uv;
148 | color = mix(texture(sampler, uv), color, HOLOWAVE_mix);
149 | }
150 | //OUTLINE
151 | uniform bool OUTLINE_active = true;
152 | uniform float OUTLINE_thickness : hint_range(0, 30) = 3.0;
153 | uniform vec4 OUTLINE_color : source_color;
154 | void outline(in vec2 uv, in sampler2D tex, in vec2 spriteSize, in vec2 pixelSize, inout vec4 color) {
155 | vec2 size = vec2(OUTLINE_thickness) / spriteSize;
156 |
157 | float alpha = color.a;
158 | alpha += texture(tex, uv + vec2(0.0, -size.y)).a;
159 | alpha += texture(tex, uv + vec2(size.x, -size.y)).a;
160 | alpha += texture(tex, uv + vec2(size.x, 0.0)).a;
161 | alpha += texture(tex, uv + vec2(size.x, size.y)).a;
162 | alpha += texture(tex, uv + vec2(0.0, size.y)).a;
163 | alpha += texture(tex, uv + vec2(-size.x, size.y)).a;
164 | alpha += texture(tex, uv + vec2(-size.x, 0.0)).a;
165 | alpha += texture(tex, uv + vec2(-size.x, -size.y)).a;
166 |
167 | vec3 final_color = mix(OUTLINE_color.rgb, color.rgb, color.a);
168 | color = vec4(final_color, clamp(alpha, 0.0, 1.0));
169 | }
170 | //SHADOW
171 | uniform bool SHADOW_active = true;
172 | uniform vec2 SHADOW_deform = vec2(0.0, 0.0);
173 | uniform vec2 SHADOW_offset = vec2(20.0, 20.0);
174 | uniform vec4 SHADOW_modulate : source_color;
175 | uniform float SHADOW_mix : hint_range(0,1) = 0;
176 | void shadow(in vec2 uv, in sampler2D txt, in vec2 size, in vec2 texturePixelSize, inout vec4 color) {
177 | float sizex = float(textureSize(txt,int(texturePixelSize.x)).x); //comment for GLES2
178 | float sizey = float(textureSize(txt,int(texturePixelSize.y)).y); //comment for GLES2
179 | //float sizex = texture_size.x; //uncomment for GLES2
180 | //float sizey = texture_size.y; //uncomment for GLES2
181 | uv.y+=SHADOW_offset.y*texturePixelSize.y;
182 | uv.x+=SHADOW_offset.x*texturePixelSize.x;
183 | float decalx=((uv.y-texturePixelSize.x*sizex)*SHADOW_deform.x);
184 | float decaly=((uv.y-texturePixelSize.y*sizey)*SHADOW_deform.y);
185 | uv.x += decalx;
186 | uv.y += decaly;
187 | vec4 shadow = vec4(SHADOW_modulate.rgb, texture(txt, uv).a * SHADOW_modulate.a * 0.5);
188 | color =mix(mix(shadow, color, color.a), color, SHADOW_mix);
189 | }
190 |
191 |
192 | void fragment() {
193 | vec4 color = texture(TEXTURE, UV);
194 | vec2 size = vec2(textureSize(TEXTURE, 0));
195 | vec2 uv = UV;
196 | vec2 screen_uv = SCREEN_UV;
197 |
198 | if(HOLOWAVE_active) holowave(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
199 | if(OUTLINE_active) outline(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
200 | if(SHADOW_active) shadow(uv, TEXTURE, size, TEXTURE_PIXEL_SIZE, color);
201 |
202 |
203 | COLOR=color;
204 | }
205 |
206 | void vertex() {
207 |
208 | }
209 | "
210 |
211 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_st2lq"]
212 | shader = SubResource("Shader_yhvx2")
213 | shader_parameter/HOLOWAVE_active = true
214 | shader_parameter/HOLOWAVE_offset = 24.79
215 | shader_parameter/HOLOWAVE_speed = 3.689
216 | shader_parameter/HOLOWAVE_waveHeight = 0.322
217 | shader_parameter/HOLOWAVE_waveSpeed = 5.689
218 | shader_parameter/HOLOWAVE_waveFreq = 66.555
219 | shader_parameter/HOLOWAVE_waveWidth = 2.596
220 | shader_parameter/HOLOWAVE_mix = 0.0
221 | shader_parameter/OUTLINE_active = true
222 | shader_parameter/OUTLINE_thickness = 7.033
223 | shader_parameter/OUTLINE_color = Color(0.223529, 0.223529, 0.223529, 1)
224 | shader_parameter/SHADOW_active = true
225 | shader_parameter/SHADOW_deform = Vector2(0, 0.17)
226 | shader_parameter/SHADOW_offset = Vector2(4, -5)
227 | shader_parameter/SHADOW_modulate = Color(0, 0, 0, 1)
228 | shader_parameter/SHADOW_mix = 0.0
229 |
230 | [sub_resource type="LabelSettings" id="LabelSettings_e5q26"]
231 | font_size = 49
232 |
233 | [node name="Demo" type="Node2D"]
234 | position = Vector2(-30, 50)
235 |
236 | [node name="ColorRect" type="ColorRect" parent="."]
237 | offset_left = 35.0
238 | offset_top = -41.0
239 | offset_right = 1315.0
240 | offset_bottom = 661.0
241 | color = Color(0.247059, 0.235294, 0.439216, 1)
242 |
243 | [node name="super-right" type="AnimatedSprite2D" parent="."]
244 | material = SubResource("ShaderMaterial_1g2ki")
245 | position = Vector2(1079, 372)
246 | scale = Vector2(0.486572, 0.486572)
247 | sprite_frames = ExtResource("3_061al")
248 | autoplay = "default"
249 | frame_progress = 0.948825
250 |
251 | [node name="super-left" type="AnimatedSprite2D" parent="."]
252 | material = SubResource("ShaderMaterial_h17j3")
253 | position = Vector2(260, 363)
254 | scale = Vector2(0.53125, 0.53125)
255 | sprite_frames = ExtResource("3_061al")
256 | autoplay = "default"
257 | frame_progress = 0.315742
258 |
259 | [node name="AnimationPlayer" type="AnimationPlayer" parent="super-left"]
260 | autoplay = "teleport"
261 | libraries = {
262 | "": SubResource("AnimationLibrary_byhr4")
263 | }
264 |
265 | [node name="super-middle" type="AnimatedSprite2D" parent="."]
266 | light_mask = 8193
267 | material = SubResource("ShaderMaterial_4qsww")
268 | position = Vector2(641, 245)
269 | scale = Vector2(0.505859, 0.499812)
270 | sprite_frames = ExtResource("3_061al")
271 | autoplay = "default"
272 | frame_progress = 0.287625
273 |
274 | [node name="Godot-text" type="Sprite2D" parent="."]
275 | material = SubResource("ShaderMaterial_st2lq")
276 | position = Vector2(660, 560)
277 | scale = Vector2(0.708515, 0.708515)
278 | texture = ExtResource("21_0xoix")
279 |
280 | [node name="Label" type="Label" parent="."]
281 | offset_left = 99.0
282 | offset_top = 17.0
283 | offset_right = 342.0
284 | offset_bottom = 88.0
285 | text = "Label Text"
286 | label_settings = SubResource("LabelSettings_e5q26")
287 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spheras/godot-sprite-shader-mixer/6009ff4b58d7c5ff0158e881fe814698e73c30c9/icon.png
--------------------------------------------------------------------------------
/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c5q03evsuj1ni"
6 | path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://icon.png"
14 | dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/icon.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://tg5rw7alymsk"
6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://icon.svg"
14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/project.godot:
--------------------------------------------------------------------------------
1 | ; Engine configuration file.
2 | ; It's best edited using the editor UI and not directly,
3 | ; since the parameters that go here are not all obvious.
4 | ;
5 | ; Format:
6 | ; [section] ; section goes between []
7 | ; param=value ; assign values to parameters
8 |
9 | config_version=5
10 |
11 | [application]
12 |
13 | config/name="Godot Sprite Shader Mixer"
14 | config/description="addon project to allow easily the addition of shaders to a Sprite2D and AnimatedSprite2D"
15 | run/main_scene="res://demo/demo.tscn"
16 | config/features=PackedStringArray("4.1", "Forward Plus")
17 | config/icon="res://icon.svg"
18 |
19 | [dotnet]
20 |
21 | project/assembly_name="spriteShaderMixer"
22 |
23 | [editor_plugins]
24 |
25 | enabled=PackedStringArray("res://addons/sprite-shader-mixer/plugin.cfg")
26 |
--------------------------------------------------------------------------------