[gd_scene load_steps=6 format=2]

[ext_resource path="res://addons/material_maker/preview/preview.gd" type="Script" id=1]
[ext_resource path="res://addons/material_maker/preview/preview_3d.tscn" type="PackedScene" id=2]


[sub_resource type="World" id=1]

[sub_resource type="Shader" id=2]
code = "shader_type canvas_item;

uniform sampler2D tex;

void fragment() {
	COLOR = texture(tex, UV);
}"

[sub_resource type="ShaderMaterial" id=3]
shader = SubResource( 2 )

[node name="Preview" type="ViewportContainer"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -398.0
margin_top = 3.0
margin_right = -3.0
margin_bottom = 373.0
rect_min_size = Vector2( 200, 200 )
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
stretch = true
script = ExtResource( 1 )

[node name="MaterialPreview" type="Viewport" parent="."]
size = Vector2( 395, 370 )
own_world = true
world = SubResource( 1 )
handle_input_locally = false
msaa = 2
render_target_clear_mode = 1
render_target_update_mode = 3
physics_object_picking = true

[node name="Preview3d" parent="MaterialPreview" instance=ExtResource( 2 )]

[node name="Config" type="HBoxContainer" parent="."]
anchor_right = 1.0
margin_bottom = 20.0
size_flags_horizontal = 3

[node name="Model" type="OptionButton" parent="Config"]
margin_right = 100.0
margin_bottom = 20.0
rect_min_size = Vector2( 100, 0 )
text = "Cube"
items = [ "Cube", null, false, -1, null, "Cylinder", null, false, -1, null, "Sphere", null, false, -1, null, "Sphere2", null, false, -1, null, "Quad", null, false, -1, null, "Plane", null, false, -1, null ]
selected = 0

[node name="Environment" type="OptionButton" parent="Config"]
margin_left = 104.0
margin_right = 231.0
margin_bottom = 20.0
rect_min_size = Vector2( 100, 0 )
text = "Epping Forest"
items = [ "Epping Forest", null, false, -1, null, "Moonless Golf", null, false, -1, null ]
selected = 0

[node name="Rotate" type="Button" parent="Config"]
margin_left = 235.0
margin_right = 255.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( -4, 7 )
hint_tooltip = "Rotate object"
size_flags_horizontal = 2
toggle_mode = true
pressed = true
text = "R"

[node name="Background" type="Button" parent="Config"]
margin_left = 372.0
margin_right = 395.0
margin_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
rect_pivot_offset = Vector2( -4, 7 )
hint_tooltip = "Show in main view"
size_flags_horizontal = 8
toggle_mode = true
text = "O"

[node name="Preview2D" type="ColorRect" parent="."]
material = SubResource( 3 )
anchor_top = 1.0
anchor_bottom = 1.0
margin_top = -64.0
margin_right = 64.0
rect_min_size = Vector2( 64, 64 )
mouse_filter = 1
size_flags_horizontal = 0
size_flags_vertical = 8
[connection signal="gui_input" from="." to="." method="on_gui_input"]
[connection signal="resized" from="." to="." method="_on_Preview_resized"]
[connection signal="item_selected" from="Config/Model" to="." method="_on_Model_item_selected"]
[connection signal="item_selected" from="Config/Environment" to="." method="_on_Environment_item_selected"]
[connection signal="toggled" from="Config/Rotate" to="." method="_on_Rotate_toggled"]
[connection signal="toggled" from="Config/Background" to="." method="_on_Background_toggled"]
[connection signal="gui_input" from="Preview2D" to="." method="_on_Preview2D_gui_input"]
