material-maker/material_maker/preview/preview_2d.tscn

122 lines
3.3 KiB
Plaintext

[gd_scene load_steps=8 format=2]
[ext_resource path="res://material_maker/preview/preview_2d.gd" type="Script" id=1]
[ext_resource path="res://material_maker/preview/control_point.tscn" type="PackedScene" id=2]
[ext_resource path="res://material_maker/icons/icons.svg" type="Texture" id=3]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
uniform sampler2D tex;
uniform vec2 size;
void fragment() {
float ms = max(size.x, size.y);
vec2 uv = fract(0.5+1.2*(UV-vec2(0.5))*ms/size.yx);
vec2 m2 = min(fract(uv), 1.0-fract(uv));
vec4 image = texture(tex, uv);
vec3 image_with_background = mix(vec3(mod(floor(uv.x*32.0)+floor(uv.y*32.0), 2.0)), image.xyz, image.a);
float lines_color = 0.5*(cos(5.0*TIME+100.0*(UV.x+UV.y))+1.0);
COLOR = vec4(mix(image_with_background, vec3(lines_color), step(min(m2.x, m2.y), 1.0/min(size.x, size.y))), 1.0);
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/size = Vector2( 721, 546 )
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 64, 48, 32, 32 )
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 16, 64, 16, 16 )
[node name="Preview2D" type="ColorRect"]
material = SubResource( 2 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -559.0
margin_bottom = -174.0
rect_min_size = Vector2( 64, 64 )
rect_clip_content = true
mouse_filter = 1
size_flags_horizontal = 0
size_flags_vertical = 8
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="P1" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.466667, 0, 1 )
texture = SubResource( 3 )
[node name="P2" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 0, 0.505882, 1, 1 )
texture = SubResource( 3 )
[node name="Rect1" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
texture = SubResource( 4 )
parent_control = "P1"
control_type = 1
[node name="Radius1" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2
[node name="Radius11" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "Radius1"
control_type = 2
[node name="Scale1" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 3
[node name="Angle1" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2
[node name="Angle2" parent="." instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2
[connection signal="resized" from="." to="." method="on_resized"]