From 679e992ef894980b8312e502f93ccb966970b8bc Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 4 Oct 2021 15:00:00 +0200 Subject: [PATCH] Add step as a parameter to add_slot_float. --- .../mat_maker_gd/editor/mm_graph_node.gd | 4 ++-- game/addons/mat_maker_gd/new_resource.tres | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 game/addons/mat_maker_gd/new_resource.tres 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 d3340740..a433c04e 100644 --- a/game/addons/mat_maker_gd/editor/mm_graph_node.gd +++ b/game/addons/mat_maker_gd/editor/mm_graph_node.gd @@ -44,7 +44,7 @@ func add_slot_int(input_type : int, output_type : int, getter : String, setter : sb.connect("value_changed", self, "on_int_spinbox_value_changed", [ slot_idx ]) -func add_slot_float(input_type : int, output_type : int, getter : String, setter : String, slot_name : String) -> void: +func add_slot_float(input_type : int, output_type : int, getter : String, setter : String, slot_name : String, step : float = 0.1) -> void: var bc : VBoxContainer = VBoxContainer.new() if slot_name != "": @@ -57,7 +57,7 @@ func add_slot_float(input_type : int, output_type : int, getter : String, setter var slot_idx : int = add_slot(input_type, output_type, getter, setter, bc) sb.rounded = false - sb.step = 0 + sb.step = step sb.value = _node.call(getter) sb.connect("value_changed", self, "on_float_spinbox_value_changed", [ slot_idx ]) diff --git a/game/addons/mat_maker_gd/new_resource.tres b/game/addons/mat_maker_gd/new_resource.tres new file mode 100644 index 00000000..dce60e8e --- /dev/null +++ b/game/addons/mat_maker_gd/new_resource.tres @@ -0,0 +1,24 @@ +[gd_resource type="Resource" load_steps=6 format=2] + +[ext_resource path="res://addons/mat_maker_gd/nodes/mm_material.gd" type="Script" id=1] +[ext_resource path="res://addons/mat_maker_gd/nodes/noise/perlin.gd" type="Script" id=2] +[ext_resource path="res://addons/mat_maker_gd/nodes/noise/noise.gd" type="Script" id=3] + +[sub_resource type="Resource" id=1] +script = ExtResource( 2 ) +graph_position = Vector2( -520, -340 ) +scale = Vector2( 15, 4 ) +iterations = 3 +persistence = 0.5 + +[sub_resource type="Resource" id=2] +script = ExtResource( 3 ) +graph_position = Vector2( 0, 0 ) +bmin = Vector2( 0.1, 0.1 ) +bmax = Vector2( 1, 1 ) +refresh = false + +[resource] +script = ExtResource( 1 ) +image_size = Vector2( 128, 128 ) +nodes = [ SubResource( 1 ), SubResource( 2 ) ]