mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
3d preview can now be rotated manually
This commit is contained in:
parent
ff191538f6
commit
b861cf446d
@ -8,7 +8,7 @@ var editor_interface = null
|
||||
var current_tab = null
|
||||
|
||||
onready var renderer = $Renderer
|
||||
onready var projects = $VBoxContainer/HBoxContainer/Projects
|
||||
onready var projects = $VBoxContainer/HBoxContainer/ProjectsPane/Projects
|
||||
|
||||
const MENU = [
|
||||
{ menu="File", command="new_material", description="New material" },
|
||||
|
@ -80,16 +80,38 @@ margin_top = 354.0
|
||||
margin_right = 314.0
|
||||
margin_bottom = 696.0
|
||||
|
||||
[node name="Projects" type="Panel" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="ProjectsPane" type="Control" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 326.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 696.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 3.0
|
||||
|
||||
[node name="BackgroundPreview" type="ViewportContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
stretch = true
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="VBoxContainer/HBoxContainer/ProjectsPane/BackgroundPreview"]
|
||||
size = Vector2( 954, 696 )
|
||||
handle_input_locally = false
|
||||
render_target_update_mode = 0
|
||||
|
||||
[node name="Camera" type="Camera" parent="VBoxContainer/HBoxContainer/ProjectsPane/BackgroundPreview/Viewport"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044, 0, 2.24976, 2.68116 )
|
||||
current = true
|
||||
|
||||
[node name="Projects" type="Panel" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
|
||||
self_modulate = Color( 1, 1, 1, 0 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Tabs" type="Tabs" parent="VBoxContainer/HBoxContainer/Projects"]
|
||||
[node name="Tabs" type="Tabs" parent="VBoxContainer/HBoxContainer/ProjectsPane/Projects"]
|
||||
margin_right = 954.0
|
||||
margin_bottom = 24.0
|
||||
tab_align = 0
|
||||
@ -101,13 +123,14 @@ debug_path = null
|
||||
[node name="NodeFactory" type="Node" parent="."]
|
||||
script = ExtResource( 6 )
|
||||
[connection signal="need_update" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview" to="." method="update_preview_3d"]
|
||||
[connection signal="no_more_tabs" from="VBoxContainer/HBoxContainer/Projects" to="." method="new_material"]
|
||||
[connection signal="resized" from="VBoxContainer/HBoxContainer/Projects" to="VBoxContainer/HBoxContainer/Projects" method="_on_Projects_resized"]
|
||||
[connection signal="tab_changed" from="VBoxContainer/HBoxContainer/Projects" to="." method="_on_Projects_tab_changed"]
|
||||
[connection signal="connection_request" from="VBoxContainer/HBoxContainer/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/Projects/GraphEdit" method="connect_node"]
|
||||
[connection signal="disconnection_request" from="VBoxContainer/HBoxContainer/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/Projects/GraphEdit" method="disconnect_node"]
|
||||
[connection signal="close_request" from="VBoxContainer/HBoxContainer/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/Projects/GraphEdit/node_Material" method="on_close_request"]
|
||||
[connection signal="offset_changed" from="VBoxContainer/HBoxContainer/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/Projects/GraphEdit/node_Material" method="on_offset_changed"]
|
||||
[connection signal="reposition_active_tab_request" from="VBoxContainer/HBoxContainer/Projects/Tabs" to="VBoxContainer/HBoxContainer/Projects" method="move_active_tab_to"]
|
||||
[connection signal="tab_changed" from="VBoxContainer/HBoxContainer/Projects/Tabs" to="VBoxContainer/HBoxContainer/Projects" method="set_current_tab"]
|
||||
[connection signal="tab_close" from="VBoxContainer/HBoxContainer/Projects/Tabs" to="VBoxContainer/HBoxContainer/Projects" method="close_tab"]
|
||||
[connection signal="show_background_preview" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview" to="VBoxContainer/HBoxContainer/ProjectsPane/BackgroundPreview" method="set_visible"]
|
||||
[connection signal="no_more_tabs" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects" to="." method="new_material"]
|
||||
[connection signal="resized" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects" method="_on_Projects_resized"]
|
||||
[connection signal="tab_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects" to="." method="_on_Projects_tab_changed"]
|
||||
[connection signal="connection_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" method="connect_node"]
|
||||
[connection signal="disconnection_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" method="disconnect_node"]
|
||||
[connection signal="close_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" method="on_close_request"]
|
||||
[connection signal="offset_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" method="on_offset_changed"]
|
||||
[connection signal="reposition_active_tab_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/Tabs" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects" method="move_active_tab_to"]
|
||||
[connection signal="tab_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/Tabs" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects" method="set_current_tab"]
|
||||
[connection signal="tab_close" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/Tabs" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects" method="close_tab"]
|
||||
|
@ -11,6 +11,7 @@ onready var objects = $MaterialPreview/Objects
|
||||
onready var current_object = objects.get_child(0)
|
||||
|
||||
signal need_update
|
||||
signal show_background_preview
|
||||
|
||||
func _ready():
|
||||
current_object.visible = true
|
||||
@ -23,6 +24,7 @@ func _ready():
|
||||
$Preview2D.material = $Preview2D.material.duplicate(true)
|
||||
_on_Environment_item_selected($Config/Environment.selected)
|
||||
_on_Preview_resized()
|
||||
$MaterialPreview/CameraPivot/Camera/RemoteTransform.set_remote_node("../../../../../../ProjectsPane/BackgroundPreview/Viewport/Camera")
|
||||
|
||||
func _on_Environment_item_selected(id):
|
||||
$MaterialPreview/WorldEnvironment.environment.background_sky.panorama = load("res://addons/material_maker/panoramas/"+ENVIRONMENTS[id]+".hdr")
|
||||
@ -52,3 +54,14 @@ func _on_Preview2D_gui_input(ev : InputEvent):
|
||||
if ev is InputEventMouseButton and ev.button_index == 1 and ev.pressed:
|
||||
preview_maximized = !preview_maximized
|
||||
_on_Preview_resized()
|
||||
|
||||
func _on_Button_toggled(button_pressed):
|
||||
emit_signal("show_background_preview", button_pressed)
|
||||
|
||||
func on_gui_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
$ObjectRotate.stop()
|
||||
elif event is InputEventMouseMotion:
|
||||
if event.button_mask != 0:
|
||||
$MaterialPreview/Objects.rotation.y += 0.01*event.relative.x
|
||||
$MaterialPreview/CameraPivot.rotation.x -= 0.01*event.relative.y
|
||||
|
@ -19,15 +19,15 @@ tracks/0/keys = {
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="PanoramaSky" id=10]
|
||||
[sub_resource type="PanoramaSky" id=2]
|
||||
radiance_size = 2
|
||||
panorama = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="Environment" id=11]
|
||||
[sub_resource type="Environment" id=3]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 10 )
|
||||
background_sky = SubResource( 2 )
|
||||
|
||||
[sub_resource type="Shader" id=12]
|
||||
[sub_resource type="Shader" id=4]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform sampler2D tex;
|
||||
@ -36,8 +36,8 @@ void fragment() {
|
||||
COLOR = texture(tex, UV);
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=13]
|
||||
shader = SubResource( 12 )
|
||||
[sub_resource type="ShaderMaterial" id=5]
|
||||
shader = SubResource( 4 )
|
||||
|
||||
[node name="Preview" type="ViewportContainer"]
|
||||
anchor_left = 1.0
|
||||
@ -47,7 +47,6 @@ margin_top = 3.0
|
||||
margin_right = -3.0
|
||||
margin_bottom = 373.0
|
||||
rect_min_size = Vector2( 200, 200 )
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
stretch = true
|
||||
@ -60,36 +59,41 @@ anims/rotate = SubResource( 1 )
|
||||
|
||||
[node name="MaterialPreview" type="Viewport" parent="."]
|
||||
size = Vector2( 395, 370 )
|
||||
own_world = true
|
||||
handle_input_locally = false
|
||||
render_target_clear_mode = 1
|
||||
render_target_update_mode = 3
|
||||
|
||||
[node name="Objects" parent="MaterialPreview" instance=ExtResource( 2 )]
|
||||
transform = Transform( 0.81104, 0, 0.584983, 0, 1, 0, -0.584983, 0, 0.81104, 0, 0, 0 )
|
||||
transform = Transform( 0.768253, 0, -0.640147, 0, 1, 0, 0.640147, 0, 0.768253, 0, 0, 0 )
|
||||
|
||||
[node name="OmniLight" type="OmniLight" parent="MaterialPreview"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.04729, 1.80471, -2.51024 )
|
||||
omni_range = 6.46518
|
||||
|
||||
[node name="Camera" type="Camera" parent="MaterialPreview"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.766044, 0.642787, 0, -0.642787, 0.766044, 0, 1.83022, 2.2549 )
|
||||
environment = SubResource( 11 )
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="MaterialPreview"]
|
||||
environment = SubResource( 3 )
|
||||
|
||||
[node name="CameraPivot" type="Spatial" parent="MaterialPreview"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044, 0, 0, 0 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="MaterialPreview/CameraPivot"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3.5 )
|
||||
environment = SubResource( 3 )
|
||||
current = true
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="MaterialPreview"]
|
||||
environment = SubResource( 11 )
|
||||
[node name="RemoteTransform" type="RemoteTransform" parent="MaterialPreview/CameraPivot/Camera"]
|
||||
|
||||
[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, "Plane", null, false, -1, null ]
|
||||
items = [ "Cube", null, false, -1, null, "Cylinder", null, false, -1, null, "Sphere", null, false, -1, null, "Quad", null, false, -1, null, "Plane", null, false, -1, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="Environment" type="OptionButton" parent="Config"]
|
||||
@ -101,8 +105,17 @@ text = "Park"
|
||||
items = [ "Experiment", null, false, 0, null, "Lobby", null, false, 1, null, "Night", null, false, 2, null, "Park", null, false, 3, null, "Schelde", null, false, 4, null ]
|
||||
selected = 3
|
||||
|
||||
[node name="Button" type="Button" parent="Config"]
|
||||
margin_left = 372.0
|
||||
margin_right = 395.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Show in main view"
|
||||
size_flags_horizontal = 10
|
||||
toggle_mode = true
|
||||
text = "O"
|
||||
|
||||
[node name="Preview2D" type="ColorRect" parent="."]
|
||||
material = SubResource( 13 )
|
||||
material = SubResource( 5 )
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -64.0
|
||||
@ -111,7 +124,9 @@ 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/Button" to="." method="_on_Button_toggled"]
|
||||
[connection signal="gui_input" from="Preview2D" to="." method="_on_Preview2D_gui_input"]
|
||||
|
Loading…
Reference in New Issue
Block a user