From 220475229978e3cc35fe00a7111747a13ed5c516 Mon Sep 17 00:00:00 2001 From: nothke Date: Sat, 21 Oct 2023 04:52:50 +0200 Subject: [PATCH 1/7] Pressing X now also deletes - like in blender! --- material_maker/panels/graph_edit/graph_edit.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material_maker/panels/graph_edit/graph_edit.gd b/material_maker/panels/graph_edit/graph_edit.gd index a2e687945..c39fa057a 100644 --- a/material_maker/panels/graph_edit/graph_edit.gd +++ b/material_maker/panels/graph_edit/graph_edit.gd @@ -185,7 +185,7 @@ func _gui_input(event) -> void: if event.pressed: var scancode_with_modifiers = event.get_scancode_with_modifiers() match scancode_with_modifiers: - KEY_DELETE,KEY_BACKSPACE: + KEY_DELETE,KEY_BACKSPACE,KEY_X: remove_selection() KEY_LEFT: scroll_offset.x -= 0.5*rect_size.x From 1f60523817af4762a111f1c083ff13d37d838738 Mon Sep 17 00:00:00 2001 From: nothke Date: Sat, 21 Oct 2023 05:00:04 +0200 Subject: [PATCH 2/7] Removed preview texture filtering from all resolutions ..for making large pixelated trim sheets --- addons/material_maker/engine/gen_material.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/material_maker/engine/gen_material.gd b/addons/material_maker/engine/gen_material.gd index 0e898dfe0..7c253bf46 100644 --- a/addons/material_maker/engine/gen_material.gd +++ b/addons/material_maker/engine/gen_material.gd @@ -31,7 +31,7 @@ const TEXTURE_SIZE_MAX : int = 13 # 8192x8192 const TEXTURE_SIZE_DEFAULT : int = 10 # 1024x1024 # The minimum allowed texture size as a power-of-two exponent -const TEXTURE_FILTERING_LIMIT : int = 256 +const TEXTURE_FILTERING_LIMIT : int = 8192 const EXPORT_OUTPUT_DEF_INDEX : int = 12345 From 0ab21c520eaf3c1574ba78e8f0bf25362b278fa3 Mon Sep 17 00:00:00 2001 From: nothke Date: Sat, 21 Oct 2023 17:00:18 +0200 Subject: [PATCH 3/7] Added moving (grabbing) nodes on G Just like in blender! --- material_maker/nodes/minimal.gd | 1 + material_maker/panels/graph_edit/graph_edit.gd | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/material_maker/nodes/minimal.gd b/material_maker/nodes/minimal.gd index 9e723b642..4f87b4f57 100644 --- a/material_maker/nodes/minimal.gd +++ b/material_maker/nodes/minimal.gd @@ -4,6 +4,7 @@ class_name MMGraphNodeMinimal var generator : MMGenBase = null setget set_generator var disable_undoredo_for_offset : bool = false +var grab_offset : Vector2 func _ready() -> void: diff --git a/material_maker/panels/graph_edit/graph_edit.gd b/material_maker/panels/graph_edit/graph_edit.gd index c39fa057a..2b3d3b228 100644 --- a/material_maker/panels/graph_edit/graph_edit.gd +++ b/material_maker/panels/graph_edit/graph_edit.gd @@ -42,6 +42,7 @@ signal graph_changed signal view_updated signal preview_changed +var grabbing = false func _ready() -> void: OS.low_processor_usage_mode = true @@ -135,6 +136,8 @@ func _gui_input(event) -> void: if selected_nodes.size() == 1 and selected_nodes[0].generator is MMGenGraph: update_view(selected_nodes[0].generator) elif event is InputEventMouseButton: + if event.is_pressed(): + grabbing = false # reverted to default GraphEdit behavior if false and event.button_index == BUTTON_WHEEL_UP and event.is_pressed(): if event.control: @@ -180,9 +183,11 @@ func _gui_input(event) -> void: on_ButtonUp_pressed() else: process_port_click(event.is_pressed()) + grabbing = false call_deferred("check_previews") elif event is InputEventKey: if event.pressed: + grabbing = false var scancode_with_modifiers = event.get_scancode_with_modifiers() match scancode_with_modifiers: KEY_DELETE,KEY_BACKSPACE,KEY_X: @@ -199,6 +204,13 @@ func _gui_input(event) -> void: KEY_DOWN: scroll_offset.y += 0.5*rect_size.y accept_event() + KEY_G: + if !grabbing: + grabbing = true + for node in get_selected_nodes(): + var mousepos = offset_from_global_position(get_global_mouse_position()) + # note: get_offset() becomes get_offset_position() in Godot 4: + node.grab_offset = mousepos - node.get_offset() match event.get_scancode(): KEY_SHIFT, KEY_CONTROL, KEY_ALT: var found_tip : bool = false @@ -209,6 +221,11 @@ func _gui_input(event) -> void: if rect.has_point(get_global_mouse_position()): found_tip = found_tip or c.set_slot_tip_text(get_global_mouse_position()-c.rect_global_position) elif event is InputEventMouseMotion: + if grabbing: + for node in get_selected_nodes(): + var mousepos = offset_from_global_position(get_global_mouse_position()) + node.do_set_position(mousepos - node.grab_offset) + var found_tip : bool = false for c in get_children(): if c.has_method("get_slot_tooltip"): From 150564d5c3eadd456a993f1e1d5f170af60afe03 Mon Sep 17 00:00:00 2001 From: nothke Date: Sat, 21 Oct 2023 17:06:59 +0200 Subject: [PATCH 4/7] Added new nothke's changes in readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1a15643d7..02921d374 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +### Nothke's improvements: + +- Material preview textures now without filtering (in all resolutions). Ideal for big pixel art sheets +- Delete nodes on X (just like in blender!) +- Move nodes on G (just like in blender!) + # Material Maker This is a tool based on [Godot Engine](https://godotengine.org/) that can From 82836c5221cb4deb94dcec3a133debe350fb9624 Mon Sep 17 00:00:00 2001 From: nothke Date: Sun, 22 Oct 2023 14:04:26 +0200 Subject: [PATCH 5/7] Added option in preferences to disable texture filtering --- addons/material_maker/engine/gen_material.gd | 4 ++-- material_maker/globals.gd | 1 + material_maker/windows/preferences/preferences.tscn | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/material_maker/engine/gen_material.gd b/addons/material_maker/engine/gen_material.gd index 7c253bf46..2ef5de86d 100644 --- a/addons/material_maker/engine/gen_material.gd +++ b/addons/material_maker/engine/gen_material.gd @@ -31,7 +31,7 @@ const TEXTURE_SIZE_MAX : int = 13 # 8192x8192 const TEXTURE_SIZE_DEFAULT : int = 10 # 1024x1024 # The minimum allowed texture size as a power-of-two exponent -const TEXTURE_FILTERING_LIMIT : int = 8192 +#const TEXTURE_FILTERING_LIMIT : int = 8192 const EXPORT_OUTPUT_DEF_INDEX : int = 12345 @@ -148,7 +148,7 @@ func on_dep_update_buffer(buffer_name) -> bool: renderer.copy_to_texture(preview_textures[texture_name].texture) renderer.release(self) mm_deps.dependency_update(preview_textures[texture_name].buffer, preview_textures[texture_name].texture, true) - if size <= TEXTURE_FILTERING_LIMIT: + if !mm_globals.get_config("ui_3d_preview_texture_filtering"): preview_textures[texture_name].texture.flags &= ~Texture.FLAG_FILTER else: preview_textures[texture_name].texture.flags |= Texture.FLAG_FILTER diff --git a/material_maker/globals.gd b/material_maker/globals.gd index 4c180c059..6df7c8ed0 100644 --- a/material_maker/globals.gd +++ b/material_maker/globals.gd @@ -20,6 +20,7 @@ const DEFAULT_CONFIG = { ui_3d_preview_resolution = 2.0, ui_3d_preview_tesselation_detail = 256, ui_3d_preview_sun_shadow = false, + ui_3d_preview_texture_filtering = true, ui_3d_preview_tonemap = 0, bake_ray_count = 64, bake_ao_ray_dist = 128.0, diff --git a/material_maker/windows/preferences/preferences.tscn b/material_maker/windows/preferences/preferences.tscn index 2c2925579..231efc472 100644 --- a/material_maker/windows/preferences/preferences.tscn +++ b/material_maker/windows/preferences/preferences.tscn @@ -202,6 +202,15 @@ Changes to this setting are only applied on application restart." text = "3D preview sun shadow (requires restart)" config_variable = "ui_3d_preview_sun_shadow" +[node name="Gui3DPreviewFiltering" parent="VBoxContainer/TabContainer/General" instance=ExtResource( 1 )] +margin_top = 192.0 +margin_right = 296.0 +margin_bottom = 216.0 +hint_tooltip = "If disabled, the preview will be shown with nearest neighbor (point) filtering. Useful to disable when working on pixel art." +pressed = true +text = "3D preview use texture filtering" +config_variable = "ui_3d_preview_texture_filtering" + [node name="Space2" type="Control" parent="VBoxContainer/TabContainer/General"] margin_top = 220.0 margin_right = 296.0 From 8e4b722383ece968bd701a534b75215addd3698b Mon Sep 17 00:00:00 2001 From: nothke Date: Sun, 22 Oct 2023 14:10:41 +0200 Subject: [PATCH 6/7] Added (requires restart) note --- material_maker/windows/preferences/preferences.tscn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material_maker/windows/preferences/preferences.tscn b/material_maker/windows/preferences/preferences.tscn index 231efc472..b970c18eb 100644 --- a/material_maker/windows/preferences/preferences.tscn +++ b/material_maker/windows/preferences/preferences.tscn @@ -208,7 +208,7 @@ margin_right = 296.0 margin_bottom = 216.0 hint_tooltip = "If disabled, the preview will be shown with nearest neighbor (point) filtering. Useful to disable when working on pixel art." pressed = true -text = "3D preview use texture filtering" +text = "3D preview use texture filtering (requires restart)" config_variable = "ui_3d_preview_texture_filtering" [node name="Space2" type="Control" parent="VBoxContainer/TabContainer/General"] From 9aee19cd2c411d99b4772e446e0a23295edd9f7c Mon Sep 17 00:00:00 2001 From: nothke Date: Sun, 22 Oct 2023 14:14:55 +0200 Subject: [PATCH 7/7] Removed Nothke's improvements from the readme --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 02921d374..1a15643d7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ -### Nothke's improvements: - -- Material preview textures now without filtering (in all resolutions). Ideal for big pixel art sheets -- Delete nodes on X (just like in blender!) -- Move nodes on G (just like in blender!) - # Material Maker This is a tool based on [Godot Engine](https://godotengine.org/) that can