Skip to content

Commit 9c30316

Browse files
Use a hint_string parameter in create_node_from_variable
1 parent db4dd73 commit 9c30316

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

src/Autoload/Global.gd

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,21 +1289,38 @@ func undo_redo_draw_op(
12891289
)
12901290

12911291

1292-
#gdlint: ignore=function-arguments-number
12931292
func create_node_from_variable(
12941293
curr_value: Variant,
12951294
value_changed: Callable,
1296-
started_editing := Callable(),
1297-
min_value: Variant = null,
1298-
max_value: Variant = null,
1299-
step: Variant = null,
1300-
allow_lesser := true,
1301-
allow_greater := true,
1302-
prefix := "",
1303-
suffix := "",
1295+
hint_string := "",
13041296
hint := PROPERTY_HINT_NONE,
1305-
option_button_options := PackedStringArray()
1297+
started_editing := Callable()
13061298
) -> Control:
1299+
var min_value = null
1300+
var max_value = null
1301+
var step = null
1302+
var allow_lesser := false
1303+
var allow_greater := false
1304+
var prefix := ""
1305+
var suffix := ""
1306+
if "or_less" in hint_string:
1307+
allow_lesser = true
1308+
if "or_greater" in hint_string:
1309+
allow_greater = true
1310+
var slider_options := hint_string.split(",")
1311+
for i in slider_options.size():
1312+
var option := slider_options[i]
1313+
if i == 0 and slider_options[0].is_valid_float():
1314+
min_value = slider_options[0].to_float()
1315+
elif i == 1 and slider_options[1].is_valid_float():
1316+
max_value = slider_options[1].to_float()
1317+
elif i == 2 and slider_options[2].is_valid_float():
1318+
step = slider_options[2].to_float()
1319+
elif option.begins_with("prefix:"):
1320+
prefix = option.replace("prefix:", "")
1321+
elif option.begins_with("suffix:"):
1322+
suffix = option.replace("suffix:", "")
1323+
var option_button_options := hint_string.split(",")
13071324
var type := typeof(curr_value)
13081325
match type:
13091326
TYPE_BOOL:

0 commit comments

Comments
 (0)