mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-03-15 15:56:21 +01:00
Added slot color support.
This commit is contained in:
parent
2eb6f789dd
commit
634d28b713
@ -3,6 +3,8 @@ extends MarginContainer
|
|||||||
|
|
||||||
var MMGraphNode = preload("res://addons/mat_maker_gd/editor/mm_graph_node.gd")
|
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 graph_edit_path : NodePath = "VBoxContainer/GraphEdit"
|
||||||
export(NodePath) var add_popup_path : NodePath = "Popups/AddPopup"
|
export(NodePath) var add_popup_path : NodePath = "Popups/AddPopup"
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ func recreate() -> void:
|
|||||||
|
|
||||||
for n in _material.nodes:
|
for n in _material.nodes:
|
||||||
var gn : GraphNode = MMGraphNode.new()
|
var gn : GraphNode = MMGraphNode.new()
|
||||||
|
gn.slot_colors = slot_colors
|
||||||
gn.set_node(_material, n)
|
gn.set_node(_material, n)
|
||||||
_graph_edit.add_child(gn)
|
_graph_edit.add_child(gn)
|
||||||
|
|
||||||
@ -59,6 +62,7 @@ func _on_AddPopup_ok_pressed(script_path : String):
|
|||||||
_material.add_node(nnode)
|
_material.add_node(nnode)
|
||||||
|
|
||||||
var gn : GraphNode = MMGraphNode.new()
|
var gn : GraphNode = MMGraphNode.new()
|
||||||
|
gn.slot_colors = slot_colors
|
||||||
gn.set_node(_material, nnode)
|
gn.set_node(_material, nnode)
|
||||||
_graph_edit.add_child(gn)
|
_graph_edit.add_child(gn)
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ script = ExtResource( 1 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_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="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
tool
|
tool
|
||||||
extends GraphNode
|
extends GraphNode
|
||||||
|
|
||||||
export(PoolColorArray) var slot_colors : PoolColorArray
|
var slot_colors : PoolColorArray
|
||||||
|
|
||||||
var _material : MMMateial = null
|
var _material : MMMateial = null
|
||||||
var _node : MMNode = null
|
var _node : MMNode = null
|
||||||
@ -10,7 +10,7 @@ var properties : Array = Array()
|
|||||||
func _init():
|
func _init():
|
||||||
show_close = true
|
show_close = true
|
||||||
connect("offset_changed", self, "on_offset_changed")
|
connect("offset_changed", self, "on_offset_changed")
|
||||||
|
|
||||||
func add_slot_texture(input_type : int, output_type : int, getter : String, setter : String) -> void:
|
func add_slot_texture(input_type : int, output_type : int, getter : String, setter : String) -> void:
|
||||||
var t : TextureRect = TextureRect.new()
|
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:
|
if output_type != -1:
|
||||||
set_slot_type_left(slot_idx, output_type)
|
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])
|
set_slot_color_left(slot_idx, slot_colors[input_type])
|
||||||
|
|
||||||
if slot_colors.size() > output_type:
|
if output_type != -1 && slot_colors.size() > output_type:
|
||||||
set_slot_color_left(slot_idx, slot_colors[output_type])
|
set_slot_color_right(slot_idx, slot_colors[output_type])
|
||||||
|
|
||||||
return slot_idx
|
return slot_idx
|
||||||
|
|
||||||
func set_node(material : MMMateial, node : MMNode) -> void:
|
func set_node(material : MMMateial, node : MMNode) -> void:
|
||||||
|
@ -14,5 +14,5 @@ func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color:
|
|||||||
return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed)
|
return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed)
|
||||||
|
|
||||||
func register_methods(mm_graph_node) -> void:
|
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", "")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user