@@ -445,39 +445,53 @@ static func setup_script_property_edit_node(property_info: Dictionary, value:Var
445
445
input .select (value )
446
446
input .item_selected .connect (DialogicUtil ._on_export_int_enum_submitted .bind (property_info .name , property_changed ))
447
447
else :
448
- input = SpinBox .new ()
449
- input .value_changed .connect (DialogicUtil ._on_export_number_submitted .bind (property_info .name , property_changed ))
450
- if property_info .hint_string == 'int' :
451
- input .step = 1
452
- input .allow_greater = true
453
- input .allow_lesser = true
454
- elif ',' in property_info .hint_string :
448
+ input = load ("res://addons/dialogic/Editor/Events/Fields/field_number.tscn" ).instantiate ()
449
+ input .property_name = property_info ['name' ]
450
+ input .use_int_mode ()
451
+
452
+ if ',' in property_info .hint_string :
455
453
input .min_value = int (property_info .hint_string .get_slice (',' , 0 ))
456
454
input .max_value = int (property_info .hint_string .get_slice (',' , 1 ))
457
455
if property_info .hint_string .count (',' ) > 1 :
458
456
input .step = int (property_info .hint_string .get_slice (',' , 2 ))
457
+ else :
458
+ input .step = 1
459
+ input .max_value = INF
460
+ input .min_value = - INF
461
+
459
462
if value != null :
460
- input .value = value
463
+ input .set_value (value )
464
+ input .value_changed .connect (DialogicUtil ._on_export_number_submitted .bind (property_changed ))
461
465
TYPE_FLOAT :
462
- input = SpinBox .new ()
466
+ input = load ("res://addons/dialogic/Editor/Events/Fields/field_number.tscn" ).instantiate ()
467
+ input .property_name = property_info ['name' ]
468
+ input .use_float_mode ()
463
469
input .step = 0.01
464
470
if ',' in property_info .hint_string :
465
471
input .min_value = float (property_info .hint_string .get_slice (',' , 0 ))
466
472
input .max_value = float (property_info .hint_string .get_slice (',' , 1 ))
467
473
if property_info .hint_string .count (',' ) > 1 :
468
474
input .step = float (property_info .hint_string .get_slice (',' , 2 ))
469
- input .value_changed .connect (DialogicUtil ._on_export_number_submitted .bind (property_info .name , property_changed ))
470
475
if value != null :
471
- input .value = value
476
+ input .set_value (value )
477
+ input .value_changed .connect (DialogicUtil ._on_export_number_submitted .bind (property_changed ))
472
478
TYPE_VECTOR2 , TYPE_VECTOR3 , TYPE_VECTOR4 :
473
479
var vectorSize : String = type_string (typeof (value ))[- 1 ]
474
480
input = load ("res://addons/dialogic/Editor/Events/Fields/field_vector" + vectorSize + ".tscn" ).instantiate ()
475
481
input .property_name = property_info ['name' ]
476
482
input .set_value (value )
477
483
input .value_changed .connect (DialogicUtil ._on_export_vector_submitted .bind (property_changed ))
484
+ TYPE_VECTOR2I , TYPE_VECTOR3I , TYPE_VECTOR4I :
485
+ var vectorSize : String = type_string (typeof (value ))[- 2 ]
486
+ input = load ("res://addons/dialogic/Editor/Events/Fields/field_vector" + vectorSize + ".tscn" ).instantiate ()
487
+ input .step = 1
488
+ input .property_name = property_info ['name' ]
489
+ input .set_value (value )
490
+ input .value_changed .connect (DialogicUtil ._on_export_vectori_submitted .bind (property_changed ))
478
491
TYPE_STRING :
479
492
if property_info ['hint' ] & PROPERTY_HINT_FILE or property_info ['hint' ] & PROPERTY_HINT_DIR :
480
493
input = load ("res://addons/dialogic/Editor/Events/Fields/field_file.tscn" ).instantiate ()
494
+ input .show_editing_button = true
481
495
input .file_filter = property_info ['hint_string' ]
482
496
input .file_mode = FileDialog .FILE_MODE_OPEN_FILE
483
497
if property_info ['hint' ] == PROPERTY_HINT_DIR :
@@ -531,7 +545,7 @@ static func _on_export_color_submitted(color:Color, property_name:String, callab
531
545
static func _on_export_int_enum_submitted (item :int , property_name :String , callable : Callable ) -> void :
532
546
callable .call (property_name , var_to_str (item ))
533
547
534
- static func _on_export_number_submitted (value : float , property_name : String , callable : Callable ) -> void :
548
+ static func _on_export_number_submitted (property_name : String , value : float , callable : Callable ) -> void :
535
549
callable .call (property_name , var_to_str (value ))
536
550
537
551
static func _on_export_file_submitted (property_name :String , value :String , callable : Callable ) -> void :
@@ -543,6 +557,13 @@ static func _on_export_string_enum_submitted(value:int, property_name:String, li
543
557
static func _on_export_vector_submitted (property_name :String , value :Variant , callable : Callable ) -> void :
544
558
callable .call (property_name , var_to_str (value ))
545
559
560
+ static func _on_export_vectori_submitted (property_name :String , value :Variant , callable : Callable ) -> void :
561
+ match typeof (value ):
562
+ TYPE_VECTOR2 : value = Vector2i (value )
563
+ TYPE_VECTOR3 : value = Vector3i (value )
564
+ TYPE_VECTOR4 : value = Vector4i (value )
565
+ callable .call (property_name , var_to_str (value ))
566
+
546
567
static func _on_export_dict_submitted (property_name :String , value :Variant , callable : Callable ) -> void :
547
568
callable .call (property_name , var_to_str (value ))
548
569
0 commit comments