Added 2 panel locations on the right and made panels movable

This commit is contained in:
RodZill4 2020-02-28 08:41:17 +01:00
parent 1b29495cbe
commit 48fbd55546
11 changed files with 367 additions and 231 deletions

View File

@ -82,7 +82,7 @@ func create_gen(data) -> MMGenBase:
if generator == null and data.has("type"):
if types.has(data.type):
generator = types[data.type].new()
else:
elif predefined_generators.has(data.type):
generator = create_gen(predefined_generators[data.type])
if generator == null:
print("Cannot find description for "+data.type)

View File

@ -4,15 +4,17 @@
[ext_resource path="res://material_maker/library.gd" type="Script" id=2]
[node name="Library" type="VBoxContainer"]
margin_right = 352.0
margin_bottom = 423.0
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 352.0
margin_right = 1280.0
margin_bottom = 24.0
size_flags_horizontal = 3
@ -24,14 +26,14 @@ text = "Filter:"
[node name="Filter" type="LineEdit" parent="HBoxContainer"]
margin_left = 41.0
margin_right = 352.0
margin_right = 1280.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="Tree" type="Tree" parent="."]
margin_top = 28.0
margin_right = 352.0
margin_bottom = 423.0
margin_right = 1280.0
margin_bottom = 720.0
rect_min_size = Vector2( 100, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3

View File

@ -10,13 +10,17 @@ var current_tab = null
var updating : bool = false
var need_update : bool = false
onready var projects = $VBoxContainer/HBoxContainer/ProjectsPane/Projects
onready var library = $VBoxContainer/HBoxContainer/VBoxContainer/Library
onready var projects = $VBoxContainer/Layout/SplitRight/ProjectsPane/Projects
onready var library = $VBoxContainer/Layout/Left/Top/Library
onready var preview_2d = $VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D
onready var preview_3d = $VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D
var preview_2d
var preview_3d
onready var preview_2d_background = $VBoxContainer/HBoxContainer/ProjectsPane/Preview2D
onready var preview_2d_background = $VBoxContainer/Layout/SplitRight/ProjectsPane/Preview2D
onready var preview_2d_background_button = $VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Preview2DButton
onready var preview_3d_background = $VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D
onready var preview_3d_background_button = $VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Preview3DButton
onready var preview_3d_background_panel = $VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel
const RECENT_FILES_COUNT = 15
@ -64,6 +68,20 @@ const MENU = [
{ menu="Help", command="about", description="About" }
]
const PANEL_POSITIONS = {
TopLeft="VBoxContainer/Layout/Left/Top",
BottomLeft="VBoxContainer/Layout/Left/Bottom",
TopRight="VBoxContainer/Layout/SplitRight/Right/Top",
BottomRight="VBoxContainer/Layout/SplitRight/Right/Bottom"
}
const PANELS = [
{ name="Library", scene=preload("res://material_maker/library.tscn"), position="TopLeft" },
{ name="Preview2D", scene=preload("res://material_maker/preview/preview_2d_panel.tscn"), position="BottomLeft" },
{ name="Preview3D", scene=preload("res://material_maker/preview/preview_3d_panel.tscn"), position="BottomLeft" }
]
var panels = {}
signal quit
var is_mac = false
@ -116,8 +134,32 @@ func _ready() -> void:
# This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist.
OS.set("min_window_size", Vector2(1024, 600))
# Set window title
OS.set_window_title(ProjectSettings.get_setting("application/config/name")+" v"+ProjectSettings.get_setting("application/config/release"))
# Create panels
for panel_pos in PANEL_POSITIONS.keys():
get_node(PANEL_POSITIONS[panel_pos]).set_tabs_rearrange_group(1)
for panel in PANELS:
var node = panel.scene.instance()
node.name = panel.name
var tab = get_node(PANEL_POSITIONS[panel.position])
tab.add_child(node)
panels[panel.name] = node
preview_2d = panels["Preview2D"]
preview_3d = panels["Preview3D"]
# Load recent projects
load_recents()
# Create menus
for i in MENU.size():
if ! $VBoxContainer/Menu.has_node(MENU[i].menu):
var menu_button = MenuButton.new()
menu_button.name = MENU[i].menu
menu_button.text = MENU[i].menu
menu_button.switch_on_hover = true
$VBoxContainer/Menu.add_child(menu_button)
for m in $VBoxContainer/Menu.get_children():
var menu = m.get_popup()
create_menu(menu, m.name)
@ -492,7 +534,7 @@ func update_preview() -> void:
status = update_preview_2d()
while status is GDScriptFunctionState:
status = yield(status, "completed")
status = update_preview_3d([ $VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D, $VBoxContainer/HBoxContainer/ProjectsPane/Preview3D])
status = update_preview_3d([ preview_3d, preview_3d_background ])
while status is GDScriptFunctionState:
status = yield(status, "completed")
updating = false
@ -566,15 +608,15 @@ func dim_window() -> void:
modulate = Color(0.5, 0.5, 0.5)
func show_background_preview_2d(button_pressed):
$VBoxContainer/HBoxContainer/ProjectsPane/Preview2D.visible = button_pressed
preview_2d_background.visible = button_pressed
if button_pressed:
$VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Preview3DButton.pressed = false
preview_3d_background_button.pressed = false
func show_background_preview_3d(button_pressed):
$VBoxContainer/HBoxContainer/ProjectsPane/Preview3D.visible = button_pressed
$VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel.visible = button_pressed
preview_3d_background.visible = button_pressed
preview_3d_background_panel.visible = button_pressed
if button_pressed:
$VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Preview2DButton.pressed = false
preview_2d_background_button.pressed = false
func generate_screenshots():

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=22 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://material_maker/main_window.gd" type="Script" id=1]
[ext_resource path="res://material_maker/library.tscn" type="PackedScene" id=2]
[ext_resource path="res://material_maker/preview/preview_2d.tscn" type="PackedScene" id=3]
[ext_resource path="res://material_maker/main_window_layout.gd" type="Script" id=2]
[ext_resource path="res://material_maker/preview/preview_3d.tscn" type="PackedScene" id=4]
[ext_resource path="res://material_maker/preview/preview_3d_ui.tscn" type="PackedScene" id=5]
[ext_resource path="res://material_maker/widgets/tabs.gd" type="Script" id=6]
@ -11,19 +10,8 @@
[ext_resource path="res://material_maker/node_factory.gd" type="Script" id=9]
[ext_resource path="res://material_maker/theme/default.tres" type="Theme" id=10]
[ext_resource path="res://material_maker/preview/preview_2d.gd" type="Script" id=11]
[ext_resource path="res://material_maker/preview/control_point.tscn" type="PackedScene" id=12]
[sub_resource type="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 8 )
region = Rect2( 64, 48, 32, 32 )
[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 8 )
region = Rect2( 16, 64, 16, 16 )
[sub_resource type="Shader" id=3]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
uniform sampler2D tex;
@ -39,28 +27,24 @@ void fragment() {
COLOR = vec4(mix(image_with_background, vec3(lines_color), step(min(m2.x*size.x, m2.y*size.y), 1.0)), 1.0);
}"
[sub_resource type="ShaderMaterial" id=4]
shader = SubResource( 3 )
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/size = Vector2( 947, 682 )
[sub_resource type="ShaderMaterial" id=5]
shader = SubResource( 3 )
shader_param/size = Vector2( 721, 546 )
[sub_resource type="AtlasTexture" id=6]
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 8 )
region = Rect2( 96, 96, 32, 32 )
[sub_resource type="AtlasTexture" id=7]
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 8 )
region = Rect2( 96, 32, 32, 32 )
[sub_resource type="StyleBoxFlat" id=8]
[sub_resource type="StyleBoxFlat" id=5]
bg_color = Color( 0, 0, 0, 0.772549 )
[sub_resource type="AtlasTexture" id=9]
[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 8 )
region = Rect2( 96, 64, 32, 31 )
@ -94,168 +78,56 @@ margin_right = 1268.0
margin_bottom = 22.0
[node name="File" type="MenuButton" parent="VBoxContainer/Menu"]
margin_right = 35.0
margin_right = 31.0
margin_bottom = 22.0
text = "File"
items = [ "New material", null, 0, false, false, 0, 0, null, "", false, "Load material", null, 0, false, false, 1, 268435535, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Save material", null, 0, false, false, 4, 268435539, null, "", false, "Save material as...", null, 0, false, false, 5, 301989971, null, "", false, "Save all materials...", null, 0, false, false, 6, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Export material", null, 0, false, false, 8, 268435525, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Close material", null, 0, false, false, 10, 0, null, "", false, "Quit", null, 0, false, false, 11, 268435537, null, "", false ]
switch_on_hover = true
[node name="Edit" type="MenuButton" parent="VBoxContainer/Menu"]
margin_left = 39.0
margin_right = 75.0
margin_bottom = 22.0
text = "Edit"
items = [ "Cut", null, 0, false, false, 12, 268435544, null, "", false, "Copy", null, 0, false, false, 13, 268435523, null, "", false, "Paste", null, 0, false, false, 14, 268435542, null, "", false, "Duplicate", null, 0, false, false, 15, 268435524, null, "", false ]
switch_on_hover = true
[node name="View" type="MenuButton" parent="VBoxContainer/Menu"]
margin_left = 79.0
margin_right = 121.0
margin_bottom = 22.0
text = "View"
items = [ "Center view", null, 0, false, false, 16, 67, null, "", false, "Reset zoom", null, 0, false, false, 17, 268435504, null, "", false ]
switch_on_hover = true
[node name="Tools" type="MenuButton" parent="VBoxContainer/Menu"]
margin_left = 125.0
margin_right = 171.0
margin_bottom = 22.0
text = "Tools"
items = [ "Create", null, 0, false, false, 0, 0, null, "PopupMenu", false, "Create group", null, 0, false, false, 19, 268435527, null, "", false, "Make selected nodes editable", null, 0, false, false, 20, 268435543, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Add selected node to user library", null, 0, false, false, 22, 0, null, "", false, "Export the nodes library", null, 0, false, false, 23, 0, null, "", false ]
switch_on_hover = true
[node name="Help" type="MenuButton" parent="VBoxContainer/Menu"]
margin_left = 175.0
margin_right = 217.0
margin_bottom = 22.0
text = "Help"
items = [ "User manual", null, 0, false, false, 24, 16777244, null, "", false, "Show selected library item documentation", null, 0, false, false, 25, 285212700, null, "", false, "Report a bug", null, 0, false, false, 26, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "About", null, 0, false, false, 28, 0, null, "", false ]
switch_on_hover = true
[node name="HBoxContainer" type="HSplitContainer" parent="VBoxContainer"]
[node name="Layout" type="HSplitContainer" parent="VBoxContainer"]
margin_top = 26.0
margin_right = 1268.0
margin_bottom = 708.0
size_flags_vertical = 3
split_offset = -1039
script = ExtResource( 2 )
[node name="VBoxContainer" type="VSplitContainer" parent="VBoxContainer/HBoxContainer"]
margin_right = 313.0
[node name="Left" type="VSplitContainer" parent="VBoxContainer/Layout"]
margin_right = 203.0
margin_bottom = 682.0
size_flags_horizontal = 3
size_flags_vertical = 3
split_offset = 312
[node name="Library" parent="VBoxContainer/HBoxContainer/VBoxContainer" instance=ExtResource( 2 )]
margin_right = 313.0
margin_bottom = 390.0
size_flags_vertical = 3
size_flags_stretch_ratio = 1.5
[node name="Top" type="TabContainer" parent="VBoxContainer/Layout/Left"]
margin_right = 203.0
margin_bottom = 346.0
tab_align = 0
drag_to_rearrange_enabled = true
[node name="Preview" type="TabContainer" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
margin_top = 398.0
margin_right = 313.0
[node name="Bottom" type="TabContainer" parent="VBoxContainer/Layout/Left"]
margin_top = 354.0
margin_right = 203.0
margin_bottom = 682.0
tab_align = 0
drag_to_rearrange_enabled = true
[node name="Preview2D" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview" instance=ExtResource( 3 )]
margin_left = 5.0
margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
rect_min_size = Vector2( 250, 250 )
[node name="P1" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
visible = false
self_modulate = Color( 1, 0.466667, 0, 1 )
margin_right = 32.0
margin_bottom = 32.0
texture = SubResource( 1 )
[node name="P2" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
visible = false
self_modulate = Color( 0, 0.505882, 1, 1 )
margin_right = 32.0
margin_bottom = 32.0
texture = SubResource( 1 )
[node name="Rect1" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
visible = false
self_modulate = Color( 1, 0.631373, 0, 1 )
margin_right = 16.0
margin_bottom = 16.0
texture = SubResource( 2 )
parent_control = "P1"
control_type = 1
[node name="Radius1" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
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( 2 )
parent_control = "P1"
control_type = 2
[node name="Radius11" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
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( 2 )
parent_control = "Radius1"
control_type = 2
[node name="Scale1" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
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( 2 )
parent_control = "P1"
control_type = 3
[node name="Angle1" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
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( 2 )
parent_control = "P1"
control_type = 2
[node name="Angle2" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview2D" instance=ExtResource( 12 )]
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( 2 )
parent_control = "P1"
control_type = 2
[node name="Preview3D" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview" instance=ExtResource( 4 )]
margin_left = 5.0
margin_top = 29.0
margin_right = -5.0
margin_bottom = -5.0
rect_min_size = Vector2( 250, 250 )
[node name="Preview3DUI" parent="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D" instance=ExtResource( 5 )]
[node name="ProjectsPane" type="Control" parent="VBoxContainer/HBoxContainer"]
margin_left = 321.0
[node name="SplitRight" type="HSplitContainer" parent="VBoxContainer/Layout"]
margin_left = 211.0
margin_right = 1268.0
margin_bottom = 682.0
split_offset = -226
[node name="ProjectsPane" type="Control" parent="VBoxContainer/Layout/SplitRight"]
margin_right = 562.0
margin_bottom = 682.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 3.0
[node name="Preview2D" type="ColorRect" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
[node name="Preview2D" type="ColorRect" parent="VBoxContainer/Layout/SplitRight/ProjectsPane"]
visible = false
material = SubResource( 4 )
material = SubResource( 2 )
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 64, 64 )
@ -268,30 +140,14 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Preview2D_old" type="ColorRect" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
visible = false
material = SubResource( 5 )
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 64, 64 )
rect_clip_content = true
mouse_filter = 1
size_flags_horizontal = 0
size_flags_vertical = 8
script = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}
[node name="Preview3D" parent="VBoxContainer/HBoxContainer/ProjectsPane" instance=ExtResource( 4 )]
[node name="Preview3D" parent="VBoxContainer/Layout/SplitRight/ProjectsPane" instance=ExtResource( 4 )]
margin_left = 0.0
margin_top = 0.0
margin_right = 0.0
margin_bottom = 0.0
ui_path = "../PreviewUI/Panel/HBoxContainer/Preview3DUI"
[node name="Projects" type="Panel" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
[node name="Projects" type="Panel" parent="VBoxContainer/Layout/SplitRight/ProjectsPane"]
self_modulate = Color( 1, 1, 1, 0 )
anchor_right = 1.0
anchor_bottom = 1.0
@ -304,15 +160,18 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Tabs" type="Tabs" parent="VBoxContainer/HBoxContainer/ProjectsPane/Projects"]
[node name="Tabs" type="Tabs" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects"]
margin_right = 950.0
margin_bottom = 24.0
tab_align = 0
tab_close_display_policy = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AddNodePopup" parent="VBoxContainer/HBoxContainer/ProjectsPane/Projects" instance=ExtResource( 7 )]
[node name="AddNodePopup" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" instance=ExtResource( 7 )]
[node name="PreviewUI" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane"]
[node name="PreviewUI" type="HBoxContainer" parent="VBoxContainer/Layout/SplitRight/ProjectsPane"]
anchor_top = 1.0
anchor_bottom = 1.0
margin_left = 1.0
@ -324,30 +183,30 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Preview2DButton" type="Button" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI"]
[node name="Preview2DButton" type="Button" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI"]
margin_right = 44.0
margin_bottom = 40.0
hint_tooltip = "Show 2D preview"
toggle_mode = true
icon = SubResource( 6 )
icon = SubResource( 3 )
[node name="Preview3DButton" type="Button" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI"]
[node name="Preview3DButton" type="Button" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI"]
margin_left = 51.0
margin_right = 95.0
margin_bottom = 40.0
hint_tooltip = "Show 3D preview"
toggle_mode = true
icon = SubResource( 7 )
icon = SubResource( 4 )
[node name="Panel" type="PanelContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI"]
[node name="Panel" type="PanelContainer" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI"]
visible = false
self_modulate = Color( 1, 1, 1, 0.768627 )
margin_left = 102.0
margin_right = 399.0
margin_bottom = 40.0
custom_styles/panel = SubResource( 8 )
custom_styles/panel = SubResource( 5 )
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel"]
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel"]
margin_right = 297.0
margin_bottom = 40.0
custom_constants/separation = 5
@ -355,18 +214,18 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="SpaceLeft" type="Control" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
[node name="SpaceLeft" type="Control" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
margin_bottom = 40.0
[node name="ControlView" type="TextureRect" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
[node name="ControlView" type="TextureRect" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
margin_left = 5.0
margin_top = 4.0
margin_right = 37.0
margin_bottom = 35.0
size_flags_vertical = 4
texture = SubResource( 9 )
texture = SubResource( 6 )
[node name="Preview3DUI" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer" instance=ExtResource( 5 )]
[node name="Preview3DUI" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer" instance=ExtResource( 5 )]
anchor_right = 0.0
margin_left = 42.0
margin_top = 8.0
@ -374,28 +233,47 @@ margin_right = 292.0
margin_bottom = 32.0
size_flags_vertical = 4
[node name="SpaceRight" type="Control" parent="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
[node name="SpaceRight" type="Control" parent="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer"]
margin_left = 297.0
margin_right = 297.0
margin_bottom = 40.0
[node name="Right" type="VSplitContainer" parent="VBoxContainer/Layout/SplitRight"]
margin_left = 570.0
margin_right = 1057.0
margin_bottom = 682.0
size_flags_horizontal = 3
size_flags_vertical = 3
split_offset = 312
[node name="Top" type="TabContainer" parent="VBoxContainer/Layout/SplitRight/Right"]
margin_right = 487.0
margin_bottom = 346.0
tab_align = 0
drag_to_rearrange_enabled = true
[node name="Bottom" type="TabContainer" parent="VBoxContainer/Layout/SplitRight/Right"]
margin_top = 354.0
margin_right = 487.0
margin_bottom = 682.0
tab_align = 0
drag_to_rearrange_enabled = true
[node name="NodeFactory" type="Node" parent="."]
script = ExtResource( 9 )
[connection signal="need_update" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D" to="." method="update_preview_3d"]
[connection signal="environment_selected" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D/Preview3DUI" to="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D" method="_on_Environment_item_selected"]
[connection signal="model_selected" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D/Preview3DUI" to="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D" method="_on_Model_item_selected"]
[connection signal="rotate_toggled" from="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D/Preview3DUI" to="VBoxContainer/HBoxContainer/VBoxContainer/Preview/Preview3D" method="_on_Rotate_toggled"]
[connection signal="resized" from="VBoxContainer/HBoxContainer/ProjectsPane/Preview2D" to="VBoxContainer/HBoxContainer/ProjectsPane/Preview2D" method="on_resized"]
[connection signal="need_update" from="VBoxContainer/HBoxContainer/ProjectsPane/Preview3D" to="." method="update_preview_3d"]
[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="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"]
[connection signal="toggled" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Preview2DButton" to="." method="show_background_preview_2d"]
[connection signal="toggled" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Preview3DButton" to="." method="show_background_preview_3d"]
[connection signal="gui_input" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer/ControlView" to="VBoxContainer/HBoxContainer/ProjectsPane/Preview3D" method="on_gui_input"]
[connection signal="environment_selected" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/HBoxContainer/ProjectsPane/Preview3D" method="_on_Environment_item_selected"]
[connection signal="model_selected" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/HBoxContainer/ProjectsPane/Preview3D" method="_on_Model_item_selected"]
[connection signal="rotate_toggled" from="VBoxContainer/HBoxContainer/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/HBoxContainer/ProjectsPane/Preview3D" method="_on_Rotate_toggled"]
[connection signal="dragged" from="VBoxContainer/Layout" to="VBoxContainer/Layout" method="_on_Left_dragged"]
[connection signal="dragged" from="VBoxContainer/Layout/SplitRight" to="VBoxContainer/Layout" method="_on_Right_dragged"]
[connection signal="resized" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview2D" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview2D" method="on_resized"]
[connection signal="need_update" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D" to="." method="update_preview_3d"]
[connection signal="no_more_tabs" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" to="." method="new_material"]
[connection signal="resized" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" method="_on_Projects_resized"]
[connection signal="tab_changed" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" to="." method="_on_Projects_tab_changed"]
[connection signal="reposition_active_tab_request" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects/Tabs" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" method="move_active_tab_to"]
[connection signal="tab_changed" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects/Tabs" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" method="set_current_tab"]
[connection signal="tab_close" from="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects/Tabs" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Projects" method="close_tab"]
[connection signal="toggled" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Preview2DButton" to="." method="show_background_preview_2d"]
[connection signal="toggled" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Preview3DButton" to="." method="show_background_preview_3d"]
[connection signal="gui_input" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer/ControlView" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D" method="on_gui_input"]
[connection signal="environment_selected" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D" method="_on_Environment_item_selected"]
[connection signal="model_selected" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D" method="_on_Model_item_selected"]
[connection signal="rotate_toggled" from="VBoxContainer/Layout/SplitRight/ProjectsPane/PreviewUI/Panel/HBoxContainer/Preview3DUI" to="VBoxContainer/Layout/SplitRight/ProjectsPane/Preview3D" method="_on_Rotate_toggled"]

View File

@ -0,0 +1,9 @@
extends HSplitContainer
func _on_Left_dragged(offset):
print(offset)
func _on_Right_dragged(offset):
print(offset)

View File

@ -20,6 +20,7 @@ void fragment() {
}"
[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
shader = SubResource( 1 )
shader_param/size = Vector2( 585, 492 )

View File

@ -0,0 +1,106 @@
[gd_scene load_steps=6 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="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 64, 48, 32, 32 )
[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 16, 64, 16, 16 )
[node name="Preview2D" instance=ExtResource( 3 )]
[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( 1 )
[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( 1 )
[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( 2 )
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( 2 )
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( 2 )
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( 2 )
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( 2 )
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( 2 )
parent_control = "P1"
control_type = 2

View File

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://material_maker/preview/preview_3d.tscn" type="PackedScene" id=1]
[ext_resource path="res://material_maker/preview/preview_3d_ui.tscn" type="PackedScene" id=2]
[node name="Preview3D" instance=ExtResource( 1 )]
[node name="Preview3DUI" parent="." index="1" instance=ExtResource( 2 )]
[connection signal="environment_selected" from="Preview3DUI" to="." method="_on_Environment_item_selected"]
[connection signal="model_selected" from="Preview3DUI" to="." method="_on_Model_item_selected"]
[connection signal="rotate_toggled" from="Preview3DUI" to="." method="_on_Rotate_toggled"]

View File

@ -55,6 +55,9 @@ margin_right = 120.0
margin_bottom = 30.0
rect_min_size = Vector2( 120, 32 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="ColorRect" parent="."]
material = SubResource( 2 )

View File

@ -0,0 +1,62 @@
extends Panel
export var rearrange_group : int = 0
var current_tab = -1
signal tab_changed
signal no_more_tabs
func _ready():
$Tabs.set_tabs_rearrange_group(rearrange_group)
add_to_group("tab_group_"+str(rearrange_group))
func add_child(control, legible_unique_name = false) -> void:
.add_child(control, legible_unique_name)
if !(control is Tabs):
$Tabs.add_tab(control.name)
set_current_tab($Tabs.get_tab_count()-1)
func close_tab(tab = null) -> void:
if tab == null:
tab = $Tabs.get_current_tab()
get_node($Tabs.get_tab_title(tab)).queue_free()
$Tabs.remove_tab(tab)
if $Tabs.get_tab_count() == 0:
emit_signal("no_more_tabs")
current_tab = -1
else:
set_current_tab(0)
func set_current_tab(t) -> void:
if t == current_tab or t < 0 or t >= $Tabs.get_tab_count():
if $Tabs.get_tab_count():
current_tab = -1
return
print("Setting current tab to "+str(t))
var node
if current_tab >= 0:
node = get_node($Tabs.get_tab_title(current_tab))
if node != null:
node.visible = false
print("Hiding "+$Tabs.get_tab_title($Tabs.current_tab))
$Tabs.current_tab = t
current_tab = t
node = null
for tab_container in get_tree().get_nodes_in_group("tab_group_"+str(rearrange_group)):
print(tab_container.name)
node = tab_container.get_node($Tabs.get_tab_title(t))
if node != null:
break
print(node)
if node != null:
if node.get_parent() != self:
node.get_parent().call_deferred("set_current_tab", 0)
node.get_parent().remove_child(node)
.add_child(node)
node.visible = true
node.rect_position = Vector2(0, $Tabs.rect_size.y)
node.rect_size = rect_size - node.rect_position
else:
print("Did not find panel")
emit_signal("tab_changed", t)

View File

@ -0,0 +1,22 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://material_maker/widgets/tab_container.gd" type="Script" id=1]
[node name="Tabs" type="Panel"]
margin_right = 260.0
margin_bottom = 312.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Tabs" type="Tabs" parent="."]
anchor_right = 1.0
margin_bottom = 24.0
tab_align = 0
drag_to_rearrange_enabled = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="tab_changed" from="Tabs" to="." method="set_current_tab"]
[connection signal="tab_close" from="Tabs" to="." method="close_tab"]