mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
Added uniform and greyscale_uniform nodes for mat_maker_gd.
This commit is contained in:
parent
01bb81675e
commit
c9edde9ef9
@ -13,7 +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, 0.372549, 0.372549, 0.372549, 1 )
|
||||
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, 0.0352941, 0.0509804, 1, 1, 0.372549, 0.372549, 0.372549, 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
@ -49,7 +49,7 @@ margin_bottom = 600.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="AddPopup" parent="Popups" instance=ExtResource( 2 )]
|
||||
type_folders = PoolStringArray( "res://addons/mat_maker_gd/nodes/noise", "res://addons/mat_maker_gd/nodes/filter", "res://addons/mat_maker_gd/nodes/gradient", "res://addons/mat_maker_gd/nodes/pattern", "res://addons/mat_maker_gd/nodes/sdf2d", "res://addons/mat_maker_gd/nodes/sdf3d", "res://addons/mat_maker_gd/nodes/simple", "res://addons/mat_maker_gd/nodes/other" )
|
||||
type_folders = PoolStringArray( "res://addons/mat_maker_gd/nodes/uniform", "res://addons/mat_maker_gd/nodes/noise", "res://addons/mat_maker_gd/nodes/filter", "res://addons/mat_maker_gd/nodes/gradient", "res://addons/mat_maker_gd/nodes/pattern", "res://addons/mat_maker_gd/nodes/sdf2d", "res://addons/mat_maker_gd/nodes/sdf3d", "res://addons/mat_maker_gd/nodes/simple", "res://addons/mat_maker_gd/nodes/other" )
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/PanelContainer/HBoxContainer/AddButton" to="." method="_on_AddButton_pressed"]
|
||||
[connection signal="ok_pressed" from="Popups/AddPopup" to="." method="_on_AddPopup_ok_pressed"]
|
||||
|
@ -23,18 +23,6 @@ func add_slot_texture(getter : String, setter : String) -> int:
|
||||
|
||||
return slot_idx
|
||||
|
||||
func add_slot_gradient() -> int:
|
||||
var ge : Control = gradient_editor_scene.instance()
|
||||
|
||||
var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "", "", ge)
|
||||
|
||||
ge.set_value(_node)
|
||||
#ge.texture = _node.call(getter, _material, slot_idx)
|
||||
#properties[slot_idx].append(ge.texture)
|
||||
|
||||
return slot_idx
|
||||
|
||||
|
||||
func add_slot_texture_universal(property : MMNodeUniversalProperty) -> int:
|
||||
var t : TextureRect = TextureRect.new()
|
||||
|
||||
@ -55,6 +43,39 @@ func add_slot_texture_universal(property : MMNodeUniversalProperty) -> int:
|
||||
|
||||
return slot_idx
|
||||
|
||||
func add_slot_gradient() -> int:
|
||||
var ge : Control = gradient_editor_scene.instance()
|
||||
|
||||
var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "", "", ge)
|
||||
|
||||
ge.set_value(_node)
|
||||
#ge.texture = _node.call(getter, _material, slot_idx)
|
||||
#properties[slot_idx].append(ge.texture)
|
||||
|
||||
return slot_idx
|
||||
|
||||
func add_slot_color(getter : String, setter : String) -> int:
|
||||
var cp : ColorPickerButton = ColorPickerButton.new()
|
||||
|
||||
var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, getter, setter, cp)
|
||||
|
||||
cp.color = _node.call(getter)
|
||||
|
||||
return slot_idx
|
||||
|
||||
func add_slot_color_universal(property : MMNodeUniversalProperty) -> int:
|
||||
var cp : ColorPickerButton = ColorPickerButton.new()
|
||||
|
||||
var slot_idx : int = add_slot(property.input_slot_type, property.output_slot_type, "", "", cp)
|
||||
|
||||
cp.color = property.get_default_value()
|
||||
|
||||
properties[slot_idx].append(property)
|
||||
|
||||
cp.connect("color_changed", self, "on_universal_color_changed", [ slot_idx ])
|
||||
|
||||
return slot_idx
|
||||
|
||||
func add_slot_label(getter : String, setter : String, slot_name : String) -> int:
|
||||
var l : Label = Label.new()
|
||||
|
||||
@ -436,5 +457,8 @@ func on_universal_texture_changed(slot_idx : int) -> void:
|
||||
func on_slot_line_edit_text_entered(text : String, slot_idx : int) -> void:
|
||||
_node.call(properties[slot_idx][4], text)
|
||||
|
||||
func on_universal_color_changed(c : Color, slot_idx : int) -> void:
|
||||
properties[slot_idx][6].set_default_value(c)
|
||||
|
||||
func get_material_node() -> MMNode:
|
||||
return _node
|
||||
|
@ -9,7 +9,8 @@ enum SlotTypes {
|
||||
SLOT_TYPE_FLOAT = 2,
|
||||
SLOT_TYPE_VECTOR2 = 3,
|
||||
SLOT_TYPE_VECTOR3 = 4,
|
||||
SLOT_TYPE_UNIVERSAL = 5,
|
||||
SLOT_TYPE_COLOR = 5,
|
||||
SLOT_TYPE_UNIVERSAL = 6,
|
||||
}
|
||||
|
||||
enum MMNodeUniversalPropertyDefaultType {
|
||||
|
25
game/addons/mat_maker_gd/nodes/uniform/greyscale_uniform.gd
Normal file
25
game/addons/mat_maker_gd/nodes/uniform/greyscale_uniform.gd
Normal file
@ -0,0 +1,25 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
export(Resource) var uniform : Resource
|
||||
|
||||
func _init_properties():
|
||||
if !uniform:
|
||||
uniform = MMNodeUniversalProperty.new()
|
||||
uniform.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
uniform.set_default_value(0.5)
|
||||
uniform.slot_name = "Value (Color)"
|
||||
uniform.value_step = 0.01
|
||||
uniform.value_range = Vector2(0, 1)
|
||||
|
||||
uniform.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_COLOR
|
||||
|
||||
register_output_property(uniform)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_float_universal(uniform)
|
||||
|
||||
func get_value_for(uv : Vector2, pseed : int) -> Color:
|
||||
var f : float = uniform.get_value(uv)
|
||||
|
||||
return Color(f, f, f, 1)
|
20
game/addons/mat_maker_gd/nodes/uniform/uniform.gd
Normal file
20
game/addons/mat_maker_gd/nodes/uniform/uniform.gd
Normal file
@ -0,0 +1,20 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
export(Resource) var uniform : Resource
|
||||
|
||||
func _init_properties():
|
||||
if !uniform:
|
||||
uniform = MMNodeUniversalProperty.new()
|
||||
uniform.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_COLOR
|
||||
uniform.set_default_value(Color(1, 1, 1, 1))
|
||||
|
||||
uniform.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_COLOR
|
||||
|
||||
register_output_property(uniform)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_color_universal(uniform)
|
||||
|
||||
func get_value_for(uv : Vector2, pseed : int) -> Color:
|
||||
return uniform.get_value(uv)
|
Loading…
Reference in New Issue
Block a user