Skip to content

Commit

Permalink
Miscelaneous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Jul 30, 2024
1 parent 13e08c2 commit 0268009
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 182 deletions.
194 changes: 120 additions & 74 deletions material_maker/icons/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions material_maker/nodes/edit_buttons.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@ offset_bottom = 22.0
script = ExtResource("1")

[node name="Edit" type="Button" parent="."]
offset_right = 28.0
offset_bottom = 22.0
layout_mode = 2
icon = SubResource("1")
flat = true

[node name="Load" type="Button" parent="."]
offset_left = 32.0
offset_right = 60.0
offset_bottom = 22.0
layout_mode = 2
icon = SubResource("2")
flat = true

[node name="Save" type="Button" parent="."]
offset_left = 64.0
offset_right = 92.0
offset_bottom = 22.0
layout_mode = 2
icon = SubResource("3")
flat = true
2 changes: 1 addition & 1 deletion material_maker/panels/brushes/brushes.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ func _ready():

func _on_Tree_item_activated():
var main_window = mm_globals.main_window
var data = $Tree.get_selected().get_metadata(0)
var data = %Tree.get_selected().get_metadata(0)
if data != null:
main_window.get_current_project().set_brush(data)

Expand Down
6 changes: 1 addition & 5 deletions material_maker/panels/brushes/brushes.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
script = ExtResource("2")
library_manager_name = "BrushLibraryManager"

[node name="Tree" parent="." index="3"]
supports_drag = false

[connection signal="item_activated" from="Tree" to="." method="_on_Tree_item_activated"]
[connection signal="item_icon_double_clicked" from="Tree" to="." method="_on_Tree_item_double_clicked"]
[connection signal="item_activated" from="Library/Tree" to="." method="_on_Tree_item_activated"]
2 changes: 1 addition & 1 deletion material_maker/panels/paint/export.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func setup_material(material_textures : Dictionary) -> void:
if c == null:
continue
var channel_node = graph.get_node(c)
channel_node.texture.set_image(material_textures[c].get_image())
channel_node.texture.set_texture(ImageTexture.create_from_image(material_textures[c].get_image()))
mm_deps.dependency_update("o%d_tex" % channel_node.get_instance_id(), channel_node.texture)
graph.get_node("material").all_sources_changed()

Expand Down
3 changes: 1 addition & 2 deletions material_maker/panels/paint/paint.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ stretch = true
[node name="MainView" type="SubViewport" parent="VSplitContainer/HSplitContainer/Painter/View"]
own_world_3d = true
handle_input_locally = false
size = Vector2i(800, 480)
size = Vector2i(10, 10)
render_target_update_mode = 4

[node name="CameraPosition" type="Node3D" parent="VSplitContainer/HSplitContainer/Painter/View/MainView"]
Expand Down Expand Up @@ -643,7 +643,6 @@ mouse_filter = 2
layout_mode = 2
size_flags_vertical = 3
focus_mode = 1
scroll_offset = Vector2(0, -308)
shader_context_defs = "uniform sampler2D mesh_normal_tex;
"

Expand Down
3 changes: 2 additions & 1 deletion material_maker/panels/paint/paint_layers.gd
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ func apply_masks(material : ShaderMaterial, masks : Array) -> void:
func update_layers_renderer(visible_layers : Array) -> void:
for viewport in [ albedo, metallic, roughness, emission, normal, depth, occlusion ]:
while viewport.get_child_count() > 0:
viewport.remove_child(viewport.get_child(0))
var child = viewport.get_child(0)
viewport.remove_child(child)
var color_rect : ColorRect
color_rect = ColorRect.new()
color_rect.size = normal.size
Expand Down
30 changes: 7 additions & 23 deletions material_maker/panels/paint/paint_layers.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,42 @@ shader_parameter/depth_tex = SubResource("1")
script = ExtResource("1")

[node name="Albedo" type="SubViewport" parent="."]
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
render_target_update_mode = 1

[node name="Metallic" type="SubViewport" parent="."]
transparent_bg = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 1

[node name="Roughness" type="SubViewport" parent="."]
transparent_bg = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 1

[node name="Emission" type="SubViewport" parent="."]
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
render_target_update_mode = 1

[node name="Normal" type="SubViewport" parent="."]
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
render_target_update_mode = 1

[node name="Depth" type="SubViewport" parent="."]
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
render_target_update_mode = 1

[node name="Occlusion" type="SubViewport" parent="."]
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
render_target_update_mode = 1

[node name="NormalMap" type="SubViewport" parent="."]
size = Vector2(2048, 2048)
transparent_bg = true
disable_3d = true
usage = 0
render_target_v_flip = true
transparent_bg = true
size = Vector2i(2048, 2048)
render_target_clear_mode = 1
render_target_update_mode = 1

Expand Down
87 changes: 22 additions & 65 deletions material_maker/panels/paint/paint_project_settings.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,129 +5,86 @@
[ext_resource type="Script" path="res://material_maker/panels/paint/paint_project_settings.gd" id="3"]

[node name="PaintProjectSettings" type="Window"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -171.0
offset_top = -86.0
offset_right = 69.0
offset_bottom = 85.0
window_title = "Paint project settings"
title = "Paint project settings"
exclusive = true
always_on_top = true
extend_to_title = true
script = ExtResource("3")
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Margin" type="MarginContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
theme_override_constants/margin_right = 2
theme_override_constants/margin_top = 2
theme_override_constants/margin_left = 2
theme_override_constants/margin_top = 2
theme_override_constants/margin_right = 2
theme_override_constants/margin_bottom = 2
__meta__ = {
"_edit_use_anchors_": false
}

[node name="VBox" type="VBoxContainer" parent="Margin"]
offset_left = 2.0
offset_top = 2.0
offset_right = 238.0
offset_bottom = 169.0
layout_mode = 2

[node name="TextureSize" type="HBoxContainer" parent="Margin/VBox"]
offset_right = 236.0
offset_bottom = 20.0
layout_mode = 2

[node name="Label" type="Label" parent="Margin/VBox/TextureSize"]
offset_top = 3.0
offset_right = 82.0
offset_bottom = 17.0
layout_mode = 2
text = "Texture2D size:"

[node name="SizeOptionButton" type="OptionButton" parent="Margin/VBox/TextureSize"]
offset_left = 86.0
offset_right = 115.0
offset_bottom = 20.0
layout_mode = 2
script = ExtResource("1")
min_size = 8
max_size = 12

[node name="PaintEmission" type="CheckBox" parent="Margin/VBox"]
offset_top = 24.0
offset_right = 122.0
offset_bottom = 48.0
layout_mode = 2
size_flags_horizontal = 0
text = "Paint Emission"

[node name="PaintNormal" type="CheckBox" parent="Margin/VBox"]
offset_top = 52.0
offset_right = 111.0
offset_bottom = 76.0
layout_mode = 2
size_flags_horizontal = 0
text = "Paint Normal"

[node name="PaintDepth" type="CheckBox" parent="Margin/VBox"]
offset_top = 80.0
offset_right = 103.0
offset_bottom = 104.0
layout_mode = 2
size_flags_horizontal = 0
text = "Paint Depth"

[node name="Bump" type="HBoxContainer" parent="Margin/VBox"]
offset_top = 108.0
offset_right = 236.0
offset_bottom = 132.0
layout_mode = 2

[node name="PaintBump" type="CheckBox" parent="Margin/VBox/Bump"]
offset_right = 157.0
offset_bottom = 24.0
layout_mode = 2
text = "Normals from depth"

[node name="BumpStrength" parent="Margin/VBox/Bump" instance=ExtResource("2")]
anchor_left = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 161.0
offset_right = 219.0
offset_bottom = 24.0
layout_mode = 2
step = 0.01
float_only = true

[node name="HSeparator" type="HSeparator" parent="Margin/VBox"]
offset_top = 136.0
offset_right = 236.0
offset_bottom = 140.0
layout_mode = 2

[node name="Buttons" type="HBoxContainer" parent="Margin/VBox"]
offset_left = 24.0
offset_top = 144.0
offset_right = 212.0
offset_bottom = 164.0
layout_mode = 2
size_flags_horizontal = 4

[node name="Apply" type="Button" parent="Margin/VBox/Buttons"]
offset_right = 60.0
offset_bottom = 20.0
custom_minimum_size = Vector2(60, 0)
layout_mode = 2
text = "Apply"

[node name="OK" type="Button" parent="Margin/VBox/Buttons"]
offset_left = 64.0
offset_right = 124.0
offset_bottom = 20.0
custom_minimum_size = Vector2(60, 0)
layout_mode = 2
text = "OK"

[node name="Cancel" type="Button" parent="Margin/VBox/Buttons"]
offset_left = 128.0
offset_right = 188.0
offset_bottom = 20.0
custom_minimum_size = Vector2(60, 0)
layout_mode = 2
text = "Cancel"

[connection signal="popup_hide" from="." to="." method="queue_free"]
[connection signal="minimum_size_changed" from="Margin" to="." method="_on_Margin_minimum_size_changed"]
[connection signal="pressed" from="Margin/VBox/Buttons/Apply" to="." method="apply_settings"]
[connection signal="pressed" from="Margin/VBox/Buttons/OK" to="." method="ok"]
Expand Down
2 changes: 1 addition & 1 deletion material_maker/tools/painter/painter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ func update_brush(update_shaders : bool = false):
definitions += pattern_shader_code.defs

var global_definitions : String = ""
global_definitions += brush_shader_code.get_globals_string()
global_definitions += brush_shader_code.get_globals_string(definitions+brush_code+pattern_code)

var replaces : Dictionary = {
BRUSH_MODE="\""+get_brush_mode()+"\"",
Expand Down
3 changes: 2 additions & 1 deletion material_maker/windows/new_painter/new_painter.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)

[node name="NewPainterWindow" type="Window"]
title = "New Paint Project"
size = Vector2i(500, 300)
script = ExtResource("2")
mesh_material = SubResource("ShaderMaterial_5x24r")
Expand Down Expand Up @@ -133,7 +134,7 @@ stretch = true
own_world_3d = true
world_3d = SubResource("World3D_pmwks")
handle_input_locally = false
size = Vector2i(360, 257)
size = Vector2i(2, 2)
render_target_update_mode = 4

[node name="MeshPivot" type="Node3D" parent="VBoxContainer/Main/SubViewportContainer/SubViewport"]
Expand Down

0 comments on commit 0268009

Please sign in to comment.