diff --git a/addons/voxel-core/controls/voxel_viewer/voxel_viewer.gd b/addons/voxel-core/controls/voxel_viewer/voxel_viewer.gd index 1c3f8819..59c1ffcc 100644 --- a/addons/voxel-core/controls/voxel_viewer/voxel_viewer.gd +++ b/addons/voxel-core/controls/voxel_viewer/voxel_viewer.gd @@ -463,7 +463,13 @@ func show_context_menu(global_position : Vector2, face := _last_hovered_face) -> func show_color_menu(color : Color) -> void: if is_instance_valid(ColorMenu): VoxelColor.color = color - ColorMenu.popup_centered() + ColorMenu.show() + ColorMenu.set_as_minsize() + ColorMenu.rect_size += Vector2(32, 32) + ColorMenu.rect_min_size = ColorMenu.rect_size + + ColorMenu.set_position( + (get_viewport_rect().size / 2) - (ColorMenu.rect_min_size / 2)) # Closes the color menu @@ -478,7 +484,13 @@ func show_texture_menu(uv : Vector2) -> void: if is_instance_valid(TextureMenu): VoxelTexture.unselect_all() VoxelTexture.select(uv) - TextureMenu.popup_centered() + TextureMenu.show() + TextureMenu.set_as_minsize() + TextureMenu.rect_size += Vector2(32, 32) + TextureMenu.rect_min_size = TextureMenu.rect_size + + TextureMenu.set_position( + (get_viewport_rect().size / 2) - (TextureMenu.rect_min_size / 2)) # Closes the texture menu @@ -498,7 +510,14 @@ func show_material_menu(voxel := get_viewing_voxel()) -> void: Roughness.value = Voxel.get_roughness(voxel) Energy.value = Voxel.get_energy(voxel) EnergyColor.color = Voxel.get_energy_color(voxel) - MaterialMenu.popup_centered() + + MaterialMenu.show() + MaterialMenu.set_as_minsize() + MaterialMenu.rect_size += Vector2(32, 32) + MaterialMenu.rect_min_size = MaterialMenu.rect_size + + MaterialMenu.set_position( + (get_viewport_rect().size / 2) - (MaterialMenu.rect_min_size / 2)) # Closes the material menu @@ -510,6 +529,9 @@ func hide_material_menu() -> void: func show_environment_change_menu() -> void: EnvironmentMenu.popup_centered() + EnvironmentMenu.set_as_minsize() + EnvironmentMenu.rect_size += Vector2(32, 32) + EnvironmentMenu.rect_min_size = EnvironmentMenu.rect_size func hide_environment_change_menu() -> void: EnvironmentMenu.hide() diff --git a/addons/voxel-core/controls/voxel_viewer/voxel_viewer.tscn b/addons/voxel-core/controls/voxel_viewer/voxel_viewer.tscn index 5ed39144..da2f6bf1 100644 --- a/addons/voxel-core/controls/voxel_viewer/voxel_viewer.tscn +++ b/addons/voxel-core/controls/voxel_viewer/voxel_viewer.tscn @@ -169,31 +169,29 @@ __meta__ = { "_edit_use_anchors_": true } -[node name="ColorMenu" type="PopupDialog" parent="."] -margin_right = 324.0 -margin_bottom = 502.0 -rect_min_size = Vector2( 340, 525 ) +[node name="ColorMenu" type="WindowDialog" parent="."] +visible = true +margin_right = 359.0 +margin_bottom = 495.0 popup_exclusive = true +window_title = "Color Picker" +resizable = true __meta__ = { "_edit_use_anchors_": false } [node name="VBoxContainer" type="VBoxContainer" parent="ColorMenu"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.00003 -margin_bottom = -8.00003 +anchor_left = 0.0334262 +anchor_top = 0.0224299 +anchor_right = 0.969359 +anchor_bottom = 0.900935 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } [node name="VoxelColor" type="ColorPicker" parent="ColorMenu/VBoxContainer"] -margin_left = 60.0 -margin_top = 60.0 -margin_right = 384.0 -margin_bottom = 545.0 +margin_right = 336.0 +margin_bottom = 438.0 size_flags_horizontal = 3 size_flags_vertical = 3 edit_alpha = false @@ -201,39 +199,45 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="HSeparator" type="HSeparator" parent="ColorMenu/VBoxContainer"] +margin_top = 442.0 +margin_right = 336.0 +margin_bottom = 446.0 + [node name="HBoxContainer" type="HBoxContainer" parent="ColorMenu/VBoxContainer"] -margin_top = 489.0 -margin_right = 324.0 -margin_bottom = 509.0 +margin_top = 450.0 +margin_right = 336.0 +margin_bottom = 470.0 +size_flags_vertical = 3 [node name="Cancel" type="Button" parent="ColorMenu/VBoxContainer/HBoxContainer"] -margin_right = 160.0 +margin_right = 166.0 margin_bottom = 20.0 size_flags_horizontal = 3 text = "Cancel" [node name="Confirm" type="Button" parent="ColorMenu/VBoxContainer/HBoxContainer"] -margin_left = 164.0 -margin_right = 324.0 +margin_left = 170.0 +margin_right = 336.0 margin_bottom = 20.0 size_flags_horizontal = 3 text = "Confirm" -[node name="TextureMenu" type="PopupDialog" parent="."] +[node name="TextureMenu" type="WindowDialog" parent="."] margin_right = 324.0 margin_bottom = 260.0 rect_min_size = Vector2( 324, 260 ) popup_exclusive = true +window_title = "Texture Picker" +resizable = true [node name="VBoxContainer" type="VBoxContainer" parent="TextureMenu"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.00003 -margin_bottom = -8.00003 +anchor_left = 0.0246914 +anchor_top = 0.0307692 +anchor_right = 0.975309 +anchor_bottom = 0.969231 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } [node name="ScrollContainer" type="ScrollContainer" parent="TextureMenu/VBoxContainer"] @@ -269,26 +273,23 @@ margin_bottom = 20.0 size_flags_horizontal = 3 text = "Confirm" -[node name="MaterialMenu" type="PopupDialog" parent="."] +[node name="MaterialMenu" type="WindowDialog" parent="."] margin_right = 250.0 margin_bottom = 325.0 rect_min_size = Vector2( 250, 325 ) size_flags_horizontal = 0 size_flags_vertical = 0 popup_exclusive = true -__meta__ = { -"_edit_use_anchors_": false -} +window_title = "Material Picker" +resizable = true [node name="VBoxContainer" type="VBoxContainer" parent="MaterialMenu"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.00003 -margin_bottom = -8.00003 +anchor_left = 0.032 +anchor_top = 0.0246154 +anchor_right = 0.968 +anchor_bottom = 0.975385 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } [node name="VBoxContainer" type="VBoxContainer" parent="MaterialMenu/VBoxContainer"] @@ -443,6 +444,7 @@ rect_min_size = Vector2( 200, 350 ) window_title = "Open a File" mode = 0 filters = PoolStringArray( "*.tres; Environment files" ) + [connection signal="gui_input" from="View2D/Left" to="." method="_on_Face_gui_input" binds= [ Vector3( -1, 0, 0 ) ]] [connection signal="mouse_exited" from="View2D/Left" to="." method="_set_last_hovered_face" binds= [ Vector3( 0, 0, 0 ) ]] [connection signal="gui_input" from="View2D/Front" to="." method="_on_Face_gui_input" binds= [ Vector3( 0, 0, -1 ) ]]