diff --git a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd index 9568cc66..496a24ed 100644 --- a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd +++ b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd @@ -3,6 +3,8 @@ extends MarginContainer var MMGraphNode = preload("res://addons/mat_maker_gd/editor/mm_graph_node.gd") +export(PoolColorArray) var slot_colors : PoolColorArray + export(NodePath) var graph_edit_path : NodePath = "VBoxContainer/GraphEdit" export(NodePath) var add_popup_path : NodePath = "Popups/AddPopup" @@ -30,6 +32,7 @@ func recreate() -> void: for n in _material.nodes: var gn : GraphNode = MMGraphNode.new() + gn.slot_colors = slot_colors gn.set_node(_material, n) _graph_edit.add_child(gn) @@ -59,6 +62,7 @@ func _on_AddPopup_ok_pressed(script_path : String): _material.add_node(nnode) var gn : GraphNode = MMGraphNode.new() + gn.slot_colors = slot_colors gn.set_node(_material, nnode) _graph_edit.add_child(gn) diff --git a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.tscn b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.tscn index 6c316e28..e4286c1b 100644 --- a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.tscn +++ b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.tscn @@ -13,6 +13,7 @@ script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } +slot_colors = PoolColorArray( 0.905882, 0.0627451, 0.0627451, 1, 0.431373, 0.0352941, 0.0352941, 1, 0.827451, 0.376471, 0.376471, 1, 0.0431373, 0.478431, 0.427451, 1, 0.352941, 0.0352941, 0.341176, 1 ) [node name="VBoxContainer" type="VBoxContainer" parent="."] margin_right = 1024.0 diff --git a/game/addons/mat_maker_gd/editor/mm_graph_node.gd b/game/addons/mat_maker_gd/editor/mm_graph_node.gd index a42c450a..04f87660 100644 --- a/game/addons/mat_maker_gd/editor/mm_graph_node.gd +++ b/game/addons/mat_maker_gd/editor/mm_graph_node.gd @@ -1,7 +1,7 @@ tool extends GraphNode -export(PoolColorArray) var slot_colors : PoolColorArray +var slot_colors : PoolColorArray var _material : MMMateial = null var _node : MMNode = null @@ -10,7 +10,7 @@ var properties : Array = Array() func _init(): show_close = true connect("offset_changed", self, "on_offset_changed") - + func add_slot_texture(input_type : int, output_type : int, getter : String, setter : String) -> void: var t : TextureRect = TextureRect.new() @@ -50,12 +50,12 @@ func add_slot(input_type : int, output_type : int, getter : String, setter : Str if output_type != -1: set_slot_type_left(slot_idx, output_type) - if slot_colors.size() > input_type: + if input_type != -1 && slot_colors.size() > input_type: set_slot_color_left(slot_idx, slot_colors[input_type]) - if slot_colors.size() > output_type: - set_slot_color_left(slot_idx, slot_colors[output_type]) - + if output_type != -1 && slot_colors.size() > output_type: + set_slot_color_right(slot_idx, slot_colors[output_type]) + return slot_idx func set_node(material : MMMateial, node : MMNode) -> void: diff --git a/game/addons/mat_maker_gd/nodes/noise/perlin.gd b/game/addons/mat_maker_gd/nodes/noise/perlin.gd index 0be1b4d5..4627fd8b 100644 --- a/game/addons/mat_maker_gd/nodes/noise/perlin.gd +++ b/game/addons/mat_maker_gd/nodes/noise/perlin.gd @@ -14,5 +14,5 @@ func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color: return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed) func register_methods(mm_graph_node) -> void: - mm_graph_node.add_slot_texture(0, 0, "recalculate_image", "") + mm_graph_node.add_slot_texture(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "")