[gd_scene load_steps=8 format=2]

[ext_resource path="res://material_maker/icons/icons.svg" type="Texture" id=1]
[ext_resource path="res://material_maker/preview/control_point.tscn" type="PackedScene" id=2]
[ext_resource path="res://material_maker/preview/preview_2d.tscn" type="PackedScene" 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);
	float is = min(size.x, size.y)/1.2;
	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(is*min(m2.x, m2.y), 1.0)), 1.0);
}"

[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
shader = SubResource( 1 )
shader_param/size = Vector2( 585, 492 )

[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 64, 48, 32, 32 )

[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 16, 64, 16, 16 )

[node name="Preview2D" instance=ExtResource( 3 )]
material = SubResource( 2 )
rect_min_size = Vector2( 200, 200 )

[node name="P1" parent="." index="0" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.466667, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 37.0
margin_bottom = 61.0
texture = SubResource( 3 )

[node name="P2" parent="." index="1" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 0, 0.505882, 1, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 37.0
margin_bottom = 61.0
texture = SubResource( 3 )

[node name="Rect1" parent="." index="2" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
texture = SubResource( 4 )
parent_control = "P1"
control_type = 1

[node name="Radius1" parent="." index="3" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2

[node name="Radius11" parent="." index="4" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "Radius1"
control_type = 2

[node name="Scale1" parent="." index="5" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 3

[node name="Angle1" parent="." index="6" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2

[node name="Angle2" parent="." index="7" instance=ExtResource( 2 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_left = 5.0
margin_top = 29.0
margin_right = 21.0
margin_bottom = 45.0
mouse_default_cursor_shape = 10
texture = SubResource( 4 )
parent_control = "P1"
control_type = 2
