Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Sep 4, 2024
2 parents 0d51535 + 027e56b commit 9381486
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 64 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dev-desktop-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ on:

env:
GODOT_VERSION: 4.3
GODOT_SUB: beta2
GODOT_DOWNLOAD_DIR: https://github.com/godotengine/godot-builds/releases/download/4.3-beta2
GODOT_SUB: stable
GODOT_DOWNLOAD_DIR: https://github.com/godotengine/godot-builds/releases/download/4.3-stable
EXPORT_NAME: material_maker
MM_RELEASE: 1_4a1

Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
run: sips -s format icns "./build/mac/Material Maker.app/Contents/Resources/icon.icns" --out "./build/mac/Material Maker.app/Contents/Resources/icon.icns"
- name: Get documentation 🚀
if: ${{ github.event.inputs.gen_doc == 'true' }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: documentation
path: doc
Expand Down
8 changes: 4 additions & 4 deletions material_maker/doc/nodes_common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ connected to several node inputs. Each node output (and input) can be:

* a **color image** (shown in blue)

* an **RGBA image** (shown in semi-transparent green)
* an **RGBA image** (shown in blue)

* a **2D signed distance function** (shown in orange)

* a **3D signed distance function** (shown in red), with or without a color index
* a **3D signed distance function** (shown in orange-red), with or without a color index

* a color or greyscale **3D texture** (shown in fuchsia), that can be associated to
* a color or greyscale **3D texture** (shown in violet), that can be associated to
a color index, which makes it possible to associate several 3D textures in a single
3D scene

* **Fill information** (shown in light orange), that contain the bounding box of the
* **Fill information** (shown in green), that contain the bounding box of the
area. This information is generated by the Fill node and a few pattern nodes, and is
used as input by the Fill companion nodes

Expand Down
2 changes: 1 addition & 1 deletion material_maker/widgets/float_edit/float_edit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends Container

var float_value: float = 0.5
@export var value: float = 0.5 :
get:
get:
return float_value
set(new_value):
set_value(new_value)
Expand Down
16 changes: 8 additions & 8 deletions material_maker/widgets/gradient_editor/gradient_edit_cursor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ var cursor_index: int:
cursor_index = val

# Reference to the GradientEdit
var gradient_edit: Control = null
var gradient_edit : Control = null

# Depends on the height of the GradientEdit
var width: float = 10
var width : float = 10

enum Modes {IDLE, SLIDING, PREVIEW}
var mode := Modes.IDLE
var mode : Modes = Modes.IDLE

var slide_start_point := 0.0
var slide_start_point : float = 0.0


func _ready() -> void:
Expand All @@ -32,20 +32,20 @@ func _ready() -> void:


func _draw() -> void:
var HEIGHT := size.y
var WIDTH := size.y/2.0
var HEIGHT : float = size.y
var WIDTH : float = size.y/2.0

# Define the HOUSE shape
var polygon := PackedVector2Array([Vector2(0, HEIGHT*0.75), Vector2(WIDTH*0.5, HEIGHT*0.5), Vector2(WIDTH, HEIGHT*0.75), Vector2(WIDTH, HEIGHT), Vector2(0, HEIGHT), Vector2(0, HEIGHT*0.75)])
draw_colored_polygon(polygon, display_color)

var outline_color := Color.BLACK if (display_color.v > 0.5 and display_color.s < 0.6) else Color.WHITE
var outline_color : Color = Color.BLACK if (display_color.get_luminance() > 0.5) else Color.WHITE
draw_polyline(polygon, outline_color)
draw_dashed_line(Vector2(WIDTH/2, 0), Vector2(WIDTH/2, HEIGHT*0.5), outline_color)

# Draw the TRIANGLE (house roof) shape
if gradient_edit.active_cursor == cursor_index:
var active_polygon := PackedVector2Array([Vector2(0, HEIGHT*0.75), Vector2(WIDTH*0.5, HEIGHT*0.5), Vector2(WIDTH, HEIGHT*0.75), Vector2(0, HEIGHT*0.75)])
var active_polygon : PackedVector2Array = PackedVector2Array([Vector2(0, HEIGHT*0.75), Vector2(WIDTH*0.5, HEIGHT*0.5), Vector2(WIDTH, HEIGHT*0.75), Vector2(0, HEIGHT*0.75)])
draw_colored_polygon(active_polygon, outline_color)


Expand Down
4 changes: 2 additions & 2 deletions material_maker/windows/sdf_builder/gizmo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ mode = 3
[node name="ArrowY" parent="." instance=ExtResource("1")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
material = SubResource("5")
mode = 1
mode = 3

[node name="ArrowZ" parent="." instance=ExtResource("1")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
material = SubResource("6")
mode = 1
mode = 3

[connection signal="move" from="ArrowX" to="." method="_on_Arrow_move"]
[connection signal="rotate" from="ArrowX" to="." method="_on_Arrow_rotate"]
Expand Down
7 changes: 4 additions & 3 deletions material_maker/windows/sdf_builder/gizmo_arrow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ func _ready():
func set_material(m):
material = m
if is_inside_tree():
$Arrow.set_surface_override_material(0, material)
$Torus.set_surface_override_material(0, material)
for mesh in [$Arrow, $Arrow/Tip, $Torus]:
mesh.set_surface_override_material(0, material)

func _on_TranslateArea_input_event(camera, event, _position, _normal, _shape_idx):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
$Arrow.get_surface_override_material(0).set_shader_parameter("highlight", 0.1 if event.pressed else 0.0)
for mesh in [$Arrow, $Arrow/Tip]:
$Arrow.get_surface_override_material(0).set_shader_parameter("highlight", 0.1 if event.pressed else 0.0)
elif event is InputEventMouseMotion and event.button_mask == MOUSE_BUTTON_MASK_LEFT:
var origin : Vector3 = global_transform * Vector3(0, 0, 0)
var end : Vector3 = global_transform * Vector3(1, 0, 0)
Expand Down
68 changes: 30 additions & 38 deletions material_maker/windows/sdf_builder/gizmo_arrow.tscn
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
[gd_scene load_steps=9 format=3 uid="uid://duqci7ecjbnyx"]
[gd_scene load_steps=8 format=3 uid="uid://duqci7ecjbnyx"]

[ext_resource type="Script" path="res://material_maker/windows/sdf_builder/gizmo_arrow.gd" id="1"]

[sub_resource type="StandardMaterial3D" id="3"]
shading_mode = 0
albedo_color = Color(1, 0, 0, 1)

[sub_resource type="StandardMaterial3D" id="1"]
resource_name = "None"
albedo_color = Color(0.8, 0.8, 0.8, 1)
metallic = 0.8

[sub_resource type="ArrayMesh" id="6"]
_surfaces = [{
"aabb": AABB(0, 0, 0, 0, 0, 0),
"format": 34359738368,
"material": SubResource("1"),
"name": "None",
"primitive": 5,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 0,
"vertex_data": PackedByteArray()
}]

[sub_resource type="StandardMaterial3D" id="7"]
resource_name = "None"
albedo_color = Color(0.8, 0.8, 0.8, 1)
metallic = 0.8

[sub_resource type="ArrayMesh" id="8"]
_surfaces = [{
"aabb": AABB(0, 0, 0, 0, 0, 0),
"format": 34359738368,
"material": SubResource("7"),
"name": "None",
"primitive": 5,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 0,
"vertex_data": PackedByteArray()
}]
[sub_resource type="CylinderMesh" id="CylinderMesh_mevst"]
top_radius = 0.025
bottom_radius = 0.025
height = 0.9
radial_segments = 12
rings = 1

[sub_resource type="CylinderMesh" id="CylinderMesh_ujfrw"]
top_radius = 0.0
bottom_radius = 0.05
height = 0.155
radial_segments = 12
rings = 1

[sub_resource type="TorusMesh" id="TorusMesh_33igc"]
inner_radius = 0.475
outer_radius = 0.525

[sub_resource type="CylinderShape3D" id="4"]
margin = 0.01
Expand All @@ -53,14 +37,22 @@ script = ExtResource("1")
material = SubResource("3")

[node name="Arrow" type="MeshInstance3D" parent="."]
mesh = SubResource("6")
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0.45, 0, 0)
mesh = SubResource("CylinderMesh_mevst")
skeleton = NodePath("../..")
material/0 = SubResource("3")
surface_material_override/0 = SubResource("3")

[node name="Tip" type="MeshInstance3D" parent="Arrow"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.07646e-08, 0.47504, 0)
mesh = SubResource("CylinderMesh_ujfrw")
skeleton = NodePath("../../..")
surface_material_override/0 = SubResource("3")

[node name="Torus" type="MeshInstance3D" parent="."]
mesh = SubResource("8")
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
mesh = SubResource("TorusMesh_33igc")
skeleton = NodePath("../..")
material/0 = SubResource("3")
surface_material_override/0 = SubResource("3")

[node name="TranslateArea" type="Area3D" parent="."]
input_capture_on_drag = true
Expand Down
2 changes: 1 addition & 1 deletion material_maker/windows/sdf_builder/preview_2d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var view_style : int = 0
func generate_preview_shader(source : MMGenBase.ShaderCode, _template) -> String:
var variables : Dictionary = {}
variables.GENERATED_GLOBALS = source.uniforms_as_strings()
variables.GENERATED_GLOBALS += "\n".join(PackedStringArray(source.globals))
variables.GENERATED_GLOBALS += source.get_globals_string()
variables.GENERATED_INSTANCE = source.defs
variables.GENERATED_CODE = source.code
if source.output_type == "sdf2d":
Expand Down
9 changes: 5 additions & 4 deletions material_maker/windows/sdf_builder/preview_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func set_generator(g : MMGenBase, o : int = 0, force : bool = false) -> void:
var material = plane.get_surface_override_material(0)
var variables : Dictionary = {}
variables.GENERATED_GLOBALS = source.uniforms_as_strings()
variables.GENERATED_GLOBALS += "\n".join(PackedStringArray(source.globals))
variables.GENERATED_GLOBALS += source.get_globals_string()
variables.GENERATED_INSTANCE = source.defs
variables.GENERATED_CODE = source.code
variables.GENERATED_OUTPUT = source.output_values.sdf3d
Expand All @@ -53,9 +53,10 @@ func set_generator(g : MMGenBase, o : int = 0, force : bool = false) -> void:
variables.INDEX_UNIFORM = "p_"+node_prefix+"_index"
var shader_code : String = mm_preprocessor.preprocess_file("res://material_maker/windows/sdf_builder/preview_3d.gdshader", variables)
material = await mm_deps.buffer_create_shader_material("preview_"+str(get_instance_id()), MMShaderMaterial.new(material), shader_code)
for u in source.uniforms:
if u.value:
material.set_shader_parameter(u.name, u.value)
if material:
for u in source.uniforms:
if u.value:
material.set_shader_parameter(u.name, u.value)

var setup_controls_filter : String = ""
func setup_controls(filter : String = "") -> void:
Expand Down

0 comments on commit 9381486

Please sign in to comment.