Skip to content

Commit

Permalink
Fixed menu in 3D preview
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Oct 13, 2024
1 parent 7a8a1e8 commit f4be794
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions material_maker/panels/preview_3d/preview_3d_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func on_right_click():
var texture : ViewportTexture = $MaterialPreview.get_texture()
var image : Image = texture.get_image()
var mouse_position = get_local_mouse_position()*Vector2($MaterialPreview.size)/size
mouse_position.y = $MaterialPreview.size.y-mouse_position.y
var position_color : Color = image.get_pixelv(mouse_position)
var pos : Vector3 = Vector3(position_color.r, position_color.g, position_color.b)
pos -= Vector3(0.5, 0.5, 0.5)
Expand All @@ -37,7 +36,7 @@ func on_right_click():
# Reset normal rendering
current_object.set_surface_override_material(0, material_save)
$TextureRect.visible = false
$PopupMenu.popup(Rect2(get_global_mouse_position(), Vector2(0.0, 0.0)))
$PopupMenu.popup(Rect2(get_local_mouse_position()+get_screen_position(), Vector2(0, 0)))

func _on_PopupMenu_id_pressed(id):
var pivot = get_node("MaterialPreview/Preview3d/ObjectsPivot/Objects")
Expand Down
4 changes: 1 addition & 3 deletions material_maker/panels/preview_3d/preview_3d_panel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ visible = false
layout_mode = 2
mouse_filter = 2
expand_mode = 1
flip_v = true

[node name="UI" type="PanelContainer" parent="." index="2"]
layout_mode = 2

[node name="Preview3DUI" parent="UI" index="0" instance=ExtResource("2")]
layout_mode = 2

[node name="PopupMenu" type="PopupMenu" parent="." index="4"]
[node name="PopupMenu" type="PopupMenu" parent="." index="3"]
item_count = 2
item_0/text = "Reset center"
item_0/id = 0
item_1/text = "Center on clicked surface"
item_1/id = 1

Expand Down

0 comments on commit f4be794

Please sign in to comment.