improvement
This commit is contained in:
@@ -57,31 +57,25 @@ func add_node(node_type: String, position: Vector2) -> BaseGraphNode:
|
||||
|
||||
match node_type:
|
||||
"entry":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/EntryNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/EntryNode.tscn").instantiate()
|
||||
"exit":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/ExitNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/ExitNode.tscn").instantiate()
|
||||
"move":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/MoveActionNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/MoveActionNode.tscn").instantiate()
|
||||
"turn":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/TurnActionNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/TurnActionNode.tscn").instantiate()
|
||||
"dialogue":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/DialogueActionNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/DialogueActionNode.tscn").instantiate()
|
||||
"animation":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/AnimationActionNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/AnimationActionNode.tscn").instantiate()
|
||||
"wait":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/WaitActionNode.gd").new()
|
||||
"parallel":
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/ParallelGroupNode.gd").new()
|
||||
new_node = preload("res://addons/cutscene_editor/editor/nodes/WaitActionNode.tscn").instantiate()
|
||||
_:
|
||||
return null
|
||||
|
||||
# Set node position
|
||||
new_node.position_offset = position
|
||||
|
||||
# Special handling for parallel groups
|
||||
if new_node is ParallelGroupNode:
|
||||
# Set a larger initial size for parallel groups
|
||||
new_node.custom_minimum_size = Vector2(200, 150)
|
||||
|
||||
# Add to GraphEdit
|
||||
add_child(new_node)
|
||||
@@ -105,21 +99,6 @@ func _on_connection_request(from_node: String, from_port: int, to_node: String,
|
||||
var from_node_instance = get_node_or_null(from_node)
|
||||
var to_node_instance = get_node_or_null(to_node)
|
||||
|
||||
# Special handling for parallel groups
|
||||
if to_node_instance is ParallelGroupNode:
|
||||
# Connecting to a parallel group
|
||||
if _is_valid_parallel_connection(from_node_instance, from_port, to_node_instance, to_port):
|
||||
# Add child node to parallel group
|
||||
if to_node_instance.can_add_child_node(from_node_instance):
|
||||
to_node_instance.add_child_node(from_node_instance)
|
||||
|
||||
# Create a logical connection (not visual)
|
||||
_create_logical_parallel_connection(from_node, from_port, to_node, to_port)
|
||||
|
||||
# Emit signal
|
||||
emit_signal("connection_created", from_node, from_port, to_node, to_port)
|
||||
emit_signal("graph_changed")
|
||||
return
|
||||
|
||||
# Create the connection
|
||||
connect_node(from_node, from_port, to_node, to_port)
|
||||
@@ -137,19 +116,6 @@ func _on_disconnection_request(from_node: String, from_port: int, to_node: Strin
|
||||
var from_node_instance = get_node_or_null(from_node)
|
||||
var to_node_instance = get_node_or_null(to_node)
|
||||
|
||||
# Special handling for parallel groups
|
||||
if to_node_instance is ParallelGroupNode:
|
||||
# Remove child node from parallel group
|
||||
if from_node_instance in to_node_instance.child_nodes:
|
||||
to_node_instance.remove_child_node(from_node_instance)
|
||||
|
||||
# Remove logical connection
|
||||
_remove_logical_parallel_connection(from_node, from_port, to_node, to_port)
|
||||
|
||||
# Emit signal
|
||||
emit_signal("connection_removed", from_node, from_port, to_node, to_port)
|
||||
emit_signal("graph_changed")
|
||||
return
|
||||
|
||||
# Remove the connection
|
||||
disconnect_node(from_node, from_port, to_node, to_port)
|
||||
@@ -187,12 +153,6 @@ func _is_connection_valid(from_node_name: String, from_port: int, to_node_name:
|
||||
"exit":
|
||||
# Exit cannot have outgoing connections
|
||||
return false
|
||||
"parallel":
|
||||
# Parallel group output can connect to any node except entry/parallel
|
||||
if from_port == from_node.input_connections: # Output port
|
||||
return to_node.node_type != "entry" and to_node.node_type != "parallel"
|
||||
else: # Input port
|
||||
return to_node.node_type != "exit" and to_node.node_type != "parallel"
|
||||
_:
|
||||
# Other nodes can connect to any node except entry
|
||||
return to_node.node_type != "entry"
|
||||
@@ -231,24 +191,6 @@ func _dfs_cycle_check(current_node_name: String, target_node_name: String, visit
|
||||
elif recursion_stack.has(next_node_name):
|
||||
return true
|
||||
|
||||
# Check parallel connections
|
||||
if has_meta("logical_connections"):
|
||||
var logical_connections = get_meta("logical_connections")
|
||||
for connection in logical_connections:
|
||||
if connection["from_node"] == current_node_name:
|
||||
var next_node_name = connection["to_node"]
|
||||
|
||||
# If we reached the target node, we found a cycle
|
||||
if next_node_name == target_node_name:
|
||||
return true
|
||||
|
||||
# If next node not visited, recursively check
|
||||
if not visited.has(next_node_name):
|
||||
if _dfs_cycle_check(next_node_name, target_node_name, visited, recursion_stack):
|
||||
return true
|
||||
# If next node is in recursion stack, we found a cycle
|
||||
elif recursion_stack.has(next_node_name):
|
||||
return true
|
||||
|
||||
# Remove from recursion stack
|
||||
recursion_stack[current_node_name] = false
|
||||
@@ -274,7 +216,6 @@ func _on_popup_request(position: Vector2) -> void:
|
||||
menu.add_item("Add Dialogue Action", 4)
|
||||
menu.add_item("Add Animation Action", 5)
|
||||
menu.add_item("Add Wait Action", 6)
|
||||
menu.add_item("Add Parallel Group", 7)
|
||||
|
||||
# Connect menu signals
|
||||
menu.connect("id_pressed", _on_context_menu_selected.bind(position))
|
||||
@@ -303,8 +244,6 @@ func _on_context_menu_selected(id: int, position: Vector2) -> void:
|
||||
node_type = "animation"
|
||||
6:
|
||||
node_type = "wait"
|
||||
7:
|
||||
node_type = "parallel"
|
||||
_:
|
||||
return
|
||||
|
||||
@@ -346,22 +285,6 @@ func _on_graph_node_selected(node: BaseGraphNode) -> void:
|
||||
|
||||
# Handle graph node deletion
|
||||
func _on_graph_node_deleted(node: BaseGraphNode) -> void:
|
||||
# Special handling for parallel groups
|
||||
if node is ParallelGroupNode:
|
||||
# Remove all child nodes first
|
||||
for child_node in node.child_nodes:
|
||||
# Remove child from scene tree
|
||||
if child_node.get_parent():
|
||||
child_node.get_parent().remove_child(child_node)
|
||||
|
||||
# Add child back to main graph
|
||||
add_child(child_node)
|
||||
|
||||
# Update child position to be near the parallel group
|
||||
child_node.position_offset = node.position_offset + Vector2(50, 50)
|
||||
|
||||
# Clear child nodes array
|
||||
node.child_nodes.clear()
|
||||
|
||||
# Remove all connections to/from this node
|
||||
var connections = get_connection_list()
|
||||
@@ -369,16 +292,6 @@ func _on_graph_node_deleted(node: BaseGraphNode) -> void:
|
||||
if connection["from_node"] == node.name or connection["to_node"] == node.name:
|
||||
disconnect_node(connection["from_node"], connection["from_port"], connection["to_node"], connection["to_port"])
|
||||
|
||||
# Remove logical connections for parallel groups
|
||||
if has_meta("logical_connections"):
|
||||
var logical_connections = get_meta("logical_connections")
|
||||
var i = 0
|
||||
while i < logical_connections.size():
|
||||
var conn = logical_connections[i]
|
||||
if conn["from_node"] == node.name or conn["to_node"] == node.name:
|
||||
logical_connections.remove_at(i)
|
||||
else:
|
||||
i += 1
|
||||
|
||||
# Remove node from GraphEdit
|
||||
remove_child(node)
|
||||
@@ -477,65 +390,6 @@ func save_to_cutscene() -> CutsceneResource:
|
||||
|
||||
return current_cutscene
|
||||
|
||||
# Special handling for parallel groups
|
||||
func _is_valid_parallel_connection(from_node: BaseGraphNode, from_port: int, to_node: ParallelGroupNode, to_port: int) -> bool:
|
||||
# Can only connect to input ports of parallel groups
|
||||
if to_port >= to_node.input_connections:
|
||||
return false
|
||||
|
||||
# Can't connect parallel group to itself
|
||||
if from_node == to_node:
|
||||
return false
|
||||
|
||||
# Can't connect entry or exit nodes to parallel groups
|
||||
if from_node.node_type == "entry" or from_node.node_type == "exit":
|
||||
return false
|
||||
|
||||
# Can't connect parallel groups to parallel groups
|
||||
if from_node.node_type == "parallel":
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
# Create a logical connection for parallel groups (not visually represented)
|
||||
func _create_logical_parallel_connection(from_node: String, from_port: int, to_node: String, to_port: int) -> void:
|
||||
# Store the logical connection in our data structure
|
||||
# This connection won't be visually represented but will be used for generation
|
||||
var logical_connection = {
|
||||
"from_node": from_node,
|
||||
"from_port": from_port,
|
||||
"to_node": to_node,
|
||||
"to_port": to_port,
|
||||
"is_parallel": true
|
||||
}
|
||||
|
||||
# Add to a separate list of logical connections
|
||||
if not has_meta("logical_connections"):
|
||||
set_meta("logical_connections", [])
|
||||
|
||||
var logical_connections = get_meta("logical_connections")
|
||||
logical_connections.append(logical_connection)
|
||||
|
||||
# Remove a logical connection for parallel groups
|
||||
func _remove_logical_parallel_connection(from_node: String, from_port: int, to_node: String, to_port: int) -> void:
|
||||
if not has_meta("logical_connections"):
|
||||
return
|
||||
|
||||
var logical_connections = get_meta("logical_connections")
|
||||
var i = 0
|
||||
while i < logical_connections.size():
|
||||
var conn = logical_connections[i]
|
||||
if (conn["from_node"] == from_node and conn["from_port"] == from_port and
|
||||
conn["to_node"] == to_node and conn["to_port"] == to_port):
|
||||
logical_connections.remove_at(i)
|
||||
return
|
||||
i += 1
|
||||
|
||||
# Get all logical connections
|
||||
func get_logical_connections() -> Array:
|
||||
if has_meta("logical_connections"):
|
||||
return get_meta("logical_connections")
|
||||
return []
|
||||
|
||||
# Set up preview system
|
||||
func setup_preview() -> void:
|
||||
|
||||
@@ -21,37 +21,6 @@ func _ready() -> void:
|
||||
action_parameters["animation_name"] = ""
|
||||
action_parameters["loop"] = false
|
||||
|
||||
func _setup_parameter_fields() -> void:
|
||||
# Character field
|
||||
var char_label = Label.new()
|
||||
char_label.text = "Character:"
|
||||
add_child(char_label)
|
||||
|
||||
var char_field = LineEdit.new()
|
||||
char_field.text = action_parameters["character"]
|
||||
char_field.connect("text_changed", _on_character_changed)
|
||||
add_child(char_field)
|
||||
|
||||
# Animation name field
|
||||
var anim_label = Label.new()
|
||||
anim_label.text = "Animation:"
|
||||
add_child(anim_label)
|
||||
|
||||
var anim_field = LineEdit.new()
|
||||
anim_field.text = action_parameters["animation_name"]
|
||||
anim_field.connect("text_changed", _on_animation_changed)
|
||||
add_child(anim_field)
|
||||
|
||||
# Loop checkbox
|
||||
var loop_label = Label.new()
|
||||
loop_label.text = "Loop:"
|
||||
add_child(loop_label)
|
||||
|
||||
var loop_checkbox = CheckBox.new()
|
||||
loop_checkbox.button_pressed = action_parameters["loop"]
|
||||
loop_checkbox.connect("toggled", _on_loop_toggled)
|
||||
add_child(loop_checkbox)
|
||||
|
||||
func _on_character_changed(new_text: String) -> void:
|
||||
set_parameter("character", new_text)
|
||||
|
||||
|
||||
36
addons/cutscene_editor/editor/nodes/AnimationActionNode.tscn
Normal file
36
addons/cutscene_editor/editor/nodes/AnimationActionNode.tscn
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://animationactionnodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/AnimationActionNode.gd" id="1_animation"]
|
||||
[node name="AnimationActionNode" type="GraphNode"]
|
||||
modulate = Color(0.8, 0.4, 0.8, 1)
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
title = "Animation"
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_animation")
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
[node name="Character" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Character"
|
||||
[node name="character" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Character name"
|
||||
[node name="Animation" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Animation"
|
||||
[node name="animation_name" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Animation name"
|
||||
[node name="Loop" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Loop"
|
||||
[node name="loop" type="CheckBox" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
[connection signal="text_changed" from="VBoxContainer/character" to="." method="_on_character_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/animation_name" to="." method="_on_animation_changed"]
|
||||
[connection signal="toggled" from="VBoxContainer/loop" to="." method="_on_loop_toggled"]
|
||||
@@ -21,47 +21,11 @@ func _ready() -> void:
|
||||
action_parameters["text"] = ""
|
||||
action_parameters["duration"] = 0.0
|
||||
|
||||
func _setup_parameter_fields() -> void:
|
||||
# Character field
|
||||
var x = VBoxContainer.new()
|
||||
add_child(x)
|
||||
var char_label = Label.new()
|
||||
char_label.text = "Character:"
|
||||
char_label.hide()
|
||||
x.add_child(char_label)
|
||||
|
||||
var char_field = LineEdit.new()
|
||||
char_field.text = action_parameters["character"]
|
||||
char_field.connect("text_changed", _on_character_changed)
|
||||
x.add_child(char_field)
|
||||
|
||||
# Text field
|
||||
var text_label = Label.new()
|
||||
text_label.text = "Text:"
|
||||
x.add_child(text_label)
|
||||
|
||||
var text_field = TextEdit.new()
|
||||
text_field.text = action_parameters["text"]
|
||||
text_field.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
text_field.connect("text_changed", _on_text_changed)
|
||||
x.add_child(text_field)
|
||||
|
||||
# Duration field
|
||||
var duration_label = Label.new()
|
||||
duration_label.text = "Duration:"
|
||||
x.add_child(duration_label)
|
||||
|
||||
var duration_field = LineEdit.new()
|
||||
duration_field.text = str(action_parameters["duration"])
|
||||
duration_field.connect("text_changed", _on_duration_changed)
|
||||
x.add_child(duration_field)
|
||||
|
||||
func _on_character_changed(new_text: String) -> void:
|
||||
set_parameter("character", new_text)
|
||||
|
||||
func _on_text_changed() -> void:
|
||||
var text_edit = get_child(get_child_count() - 2) # TextEdit is second to last child
|
||||
set_parameter("text", text_edit.text)
|
||||
func _on_text_changed(new_text: String) -> void:
|
||||
set_parameter("text", new_text)
|
||||
|
||||
func _on_duration_changed(new_text: String) -> void:
|
||||
var value = float(new_text) if new_text.is_valid_float() else 0.0
|
||||
|
||||
38
addons/cutscene_editor/editor/nodes/DialogueActionNode.tscn
Normal file
38
addons/cutscene_editor/editor/nodes/DialogueActionNode.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dialogueactionnodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/DialogueActionNode.gd" id="1_dialogue"]
|
||||
[node name="DialogueActionNode" type="GraphNode"]
|
||||
modulate = Color(1.0, 1.0, 0.5, 1)
|
||||
custom_minimum_size = Vector2(200, 100)
|
||||
title = "Dialogue"
|
||||
resizable = true
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_dialogue")
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
[node name="Character" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Character"
|
||||
[node name="character" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Character name"
|
||||
[node name="Text" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Text"
|
||||
[node name="text" type="TextEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
[node name="Duration" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Duration"
|
||||
[node name="duration" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Duration in seconds"
|
||||
[connection signal="text_changed" from="VBoxContainer/character" to="." method="_on_character_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/text" to="." method="_on_text_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/duration" to="." method="_on_duration_changed"]
|
||||
15
addons/cutscene_editor/editor/nodes/EntryNode.tscn
Normal file
15
addons/cutscene_editor/editor/nodes/EntryNode.tscn
Normal file
@@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://entrynodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/EntryNode.gd" id="1_entry"]
|
||||
[node name="EntryNode" type="GraphNode"]
|
||||
modulate = Color(0.5, 1.0, 0.5, 1)
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
title = "Start"
|
||||
slot/0/left_enabled = false
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 0)
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_icon = null
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_entry")
|
||||
14
addons/cutscene_editor/editor/nodes/ExitNode.tscn
Normal file
14
addons/cutscene_editor/editor/nodes/ExitNode.tscn
Normal file
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://exitnodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/ExitNode.gd" id="1_exit"]
|
||||
[node name="ExitNode" type="GraphNode"]
|
||||
modulate = Color(1.0, 0.5, 0.5, 1)
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
title = "End"
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_enabled = false
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 0)
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_exit")
|
||||
@@ -22,56 +22,6 @@ func _ready() -> void:
|
||||
action_parameters["target_y"] = 0.0
|
||||
action_parameters["speed"] = 100.0
|
||||
|
||||
func _setup_parameter_fields() -> void:
|
||||
# Character field
|
||||
var char_label = Label.new()
|
||||
char_label.text = "Character:"
|
||||
add_child(char_label)
|
||||
|
||||
var char_field = LineEdit.new()
|
||||
char_field.text = action_parameters["character"]
|
||||
char_field.connect("text_changed", _on_character_changed)
|
||||
add_child(char_field)
|
||||
|
||||
# Target position fields
|
||||
var pos_label = Label.new()
|
||||
pos_label.text = "Target Position:"
|
||||
add_child(pos_label)
|
||||
|
||||
var pos_container = HBoxContainer.new()
|
||||
|
||||
var x_label = Label.new()
|
||||
x_label.text = "X:"
|
||||
pos_container.add_child(x_label)
|
||||
|
||||
var x_field = LineEdit.new()
|
||||
x_field.text = str(action_parameters["target_x"])
|
||||
x_field.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
x_field.connect("text_changed", _on_target_x_changed)
|
||||
pos_container.add_child(x_field)
|
||||
|
||||
var y_label = Label.new()
|
||||
y_label.text = "Y:"
|
||||
pos_container.add_child(y_label)
|
||||
|
||||
var y_field = LineEdit.new()
|
||||
y_field.text = str(action_parameters["target_y"])
|
||||
y_field.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
y_field.connect("text_changed", _on_target_y_changed)
|
||||
pos_container.add_child(y_field)
|
||||
|
||||
add_child(pos_container)
|
||||
|
||||
# Speed field
|
||||
var speed_label = Label.new()
|
||||
speed_label.text = "Speed:"
|
||||
add_child(speed_label)
|
||||
|
||||
var speed_field = LineEdit.new()
|
||||
speed_field.text = str(action_parameters["speed"])
|
||||
speed_field.connect("text_changed", _on_speed_changed)
|
||||
add_child(speed_field)
|
||||
|
||||
func _on_character_changed(new_text: String) -> void:
|
||||
set_parameter("character", new_text)
|
||||
|
||||
@@ -80,9 +30,12 @@ func _on_target_x_changed(new_text: String) -> void:
|
||||
set_parameter("target_x", value)
|
||||
|
||||
func _on_target_y_changed(new_text: String) -> void:
|
||||
print("toarget y")
|
||||
var value = float(new_text) if new_text.is_valid_float() else 0.0
|
||||
set_parameter("target_y", value)
|
||||
|
||||
func _on_speed_changed(new_text: String) -> void:
|
||||
|
||||
print("speed")
|
||||
var value = float(new_text) if new_text.is_valid_float() else 100.0
|
||||
set_parameter("speed", value)
|
||||
|
||||
56
addons/cutscene_editor/editor/nodes/MoveActionNode.tscn
Normal file
56
addons/cutscene_editor/editor/nodes/MoveActionNode.tscn
Normal file
@@ -0,0 +1,56 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://y74lqsx8bpxn"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/MoveActionNode.gd" id="1_5aood"]
|
||||
|
||||
[node name="MoveActionNode" type="GraphNode"]
|
||||
modulate = Color(0.4, 0.6, 1, 1)
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
title = "Move"
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/left_icon = null
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_icon = null
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_5aood")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Character" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextEdit" type="LineEdit" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 32.865)
|
||||
layout_mode = 2
|
||||
text = "aoeu"
|
||||
placeholder_text = "aoeu"
|
||||
|
||||
[node name="Location" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Location"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="x" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="y" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Speed" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Speed"
|
||||
|
||||
[node name="speed" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="text_changed" from="VBoxContainer/TextEdit" to="." method="_on_character_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/HBoxContainer/x" to="." method="_on_target_x_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/HBoxContainer/y" to="." method="_on_target_y_changed"]
|
||||
[connection signal="text_change_rejected" from="VBoxContainer/speed" to="." method="_on_speed_text_change_rejected"]
|
||||
[connection signal="text_changed" from="VBoxContainer/speed" to="." method="_on_speed_changed"]
|
||||
@@ -21,37 +21,6 @@ func _ready() -> void:
|
||||
action_parameters["target"] = ""
|
||||
action_parameters["turn_speed"] = 2.0
|
||||
|
||||
func _setup_parameter_fields() -> void:
|
||||
# Character field
|
||||
var char_label = Label.new()
|
||||
char_label.text = "Character:"
|
||||
add_child(char_label)
|
||||
|
||||
var char_field = LineEdit.new()
|
||||
char_field.text = action_parameters["character"]
|
||||
char_field.connect("text_changed", _on_character_changed)
|
||||
add_child(char_field)
|
||||
|
||||
# Target field
|
||||
var target_label = Label.new()
|
||||
target_label.text = "Target:"
|
||||
add_child(target_label)
|
||||
|
||||
var target_field = LineEdit.new()
|
||||
target_field.text = action_parameters["target"]
|
||||
target_field.connect("text_changed", _on_target_changed)
|
||||
add_child(target_field)
|
||||
|
||||
# Turn speed field
|
||||
var speed_label = Label.new()
|
||||
speed_label.text = "Turn Speed:"
|
||||
add_child(speed_label)
|
||||
|
||||
var speed_field = LineEdit.new()
|
||||
speed_field.text = str(action_parameters["turn_speed"])
|
||||
speed_field.connect("text_changed", _on_turn_speed_changed)
|
||||
add_child(speed_field)
|
||||
|
||||
func _on_character_changed(new_text: String) -> void:
|
||||
set_parameter("character", new_text)
|
||||
|
||||
|
||||
37
addons/cutscene_editor/editor/nodes/TurnActionNode.tscn
Normal file
37
addons/cutscene_editor/editor/nodes/TurnActionNode.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://turnactionnodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/TurnActionNode.gd" id="1_turn"]
|
||||
[node name="TurnActionNode" type="GraphNode"]
|
||||
modulate = Color(0.5, 1.0, 0.5, 1)
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
title = "Turn"
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_turn")
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
[node name="Character" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Character"
|
||||
[node name="character" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Character name"
|
||||
[node name="Target" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Target"
|
||||
[node name="target" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Target name"
|
||||
[node name="TurnSpeed" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Turn Speed"
|
||||
[node name="turn_speed" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Turn speed"
|
||||
[connection signal="text_changed" from="VBoxContainer/character" to="." method="_on_character_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/target" to="." method="_on_target_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/turn_speed" to="." method="_on_turn_speed_changed"]
|
||||
@@ -19,17 +19,6 @@ func _ready() -> void:
|
||||
# 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)
|
||||
|
||||
26
addons/cutscene_editor/editor/nodes/WaitActionNode.tscn
Normal file
26
addons/cutscene_editor/editor/nodes/WaitActionNode.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://waitnodetscn"]
|
||||
[ext_resource type="Script" path="res://addons/cutscene_editor/editor/nodes/WaitActionNode.gd" id="1_wait"]
|
||||
[node name="WaitActionNode" type="GraphNode"]
|
||||
modulate = Color(0.7, 0.7, 0.7, 1)
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
title = "Wait"
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color(0, 0, 0, 1)
|
||||
slot/0/left_icon = null
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color(0, 0, 0, 1)
|
||||
slot/0/right_icon = null
|
||||
slot/0/draw_stylebox = true
|
||||
script = ExtResource("1_wait")
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
[node name="Duration" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Duration"
|
||||
[node name="duration" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "1.0"
|
||||
placeholder_text = "Duration in seconds"
|
||||
[connection signal="text_changed" from="VBoxContainer/duration" to="." method="_on_duration_changed"]
|
||||
Reference in New Issue
Block a user