36 lines
985 B
GDScript
36 lines
985 B
GDScript
@tool
|
|
class_name WaitActionNode
|
|
extends "res://addons/cutscene_editor/editor/nodes/BaseGraphNode.gd"
|
|
|
|
# Node for WaitAction
|
|
|
|
func _init() -> void:
|
|
node_type = "wait"
|
|
node_id = "wait_" + str(randi())
|
|
title = "Wait"
|
|
modulate = Color(0.7, 0.7, 0.7) # Gray
|
|
|
|
# One input and one output connection
|
|
var slot = 0
|
|
set_slot(slot, true, 0, Color(0, 0, 0), true, 0, Color(0, 0, 0))
|
|
|
|
func _ready() -> void:
|
|
super._ready()
|
|
# Initialize default parameters
|
|
action_parameters["duration"] = 1.0
|
|
|
|
func _setup_parameter_fields() -> void:
|
|
# Duration field
|
|
var duration_label = Label.new()
|
|
duration_label.text = "Duration:"
|
|
add_child(duration_label)
|
|
|
|
var duration_field = LineEdit.new()
|
|
duration_field.text = str(action_parameters["duration"])
|
|
duration_field.connect("text_changed", _on_duration_changed)
|
|
add_child(duration_field)
|
|
|
|
func _on_duration_changed(new_text: String) -> void:
|
|
var value = float(new_text) if new_text.is_valid_float() else 1.0
|
|
set_parameter("duration", value)
|