diff --git a/Scenes/Node Types/Sine.tscn b/Scenes/Node Types/Sine.tscn index c35ff37..f87868b 100644 --- a/Scenes/Node Types/Sine.tscn +++ b/Scenes/Node Types/Sine.tscn @@ -6,7 +6,7 @@ [node name="Sine" type="Control"] layout_mode = 3 anchors_preset = 0 -mouse_filter = 2 +mouse_filter = 1 [node name="Node" parent="." instance=ExtResource("1_m6pki")] layout_mode = 0 diff --git a/Scenes/Nodes/Node Row.tscn b/Scenes/Nodes/Node Row.tscn index 599836d..cd782c9 100644 --- a/Scenes/Nodes/Node Row.tscn +++ b/Scenes/Nodes/Node Row.tscn @@ -14,6 +14,7 @@ isOutput = true [node name="Label" type="Label" parent="."] layout_mode = 2 size_flags_horizontal = 3 +mouse_filter = 1 text = "Testtesttesttesttest" clip_text = true diff --git a/Scripts/GL_Node.gd b/Scripts/GL_Node.gd index b073e84..821f1a6 100644 --- a/Scripts/GL_Node.gd +++ b/Scripts/GL_Node.gd @@ -4,20 +4,18 @@ var rows : Dictionary var uuid : int #REMEMBER TO SET THIS ON CREATION var dragging : bool var canDrag : bool - -func _ready(): - _init_visuals() +var dragOffset : Vector2 func _process(delta): if dragging: - position = get_viewport().get_mouse_position() + position = get_viewport().get_mouse_position() + dragOffset -func _on_input_event(viewport, event, shape_idx): - print(str(event) + "A") +func _input(event): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT && event.pressed && canDrag: dragging = true - if event.button_index == MOUSE_BUTTON_LEFT && event.canceled && dragging: + dragOffset = position - get_viewport().get_mouse_position() + if event.button_index == MOUSE_BUTTON_LEFT && !event.pressed && dragging: dragging = false func _create_uuid(): @@ -25,10 +23,6 @@ func _create_uuid(): rand.seed = Time.get_unix_time_from_system() uuid = rand.randi() -func _init_visuals(): - var nodeVisuals = load("res://Scenes/Nodes/Node.tscn").instantiate() - call_deferred("add_child",nodeVisuals) - func _update_visuals(): var holder = get_node("Holder") for child in holder.get_children(): diff --git a/Scripts/GL_Node_Point.gd b/Scripts/GL_Node_Point.gd index f6f6778..6d5eddf 100644 --- a/Scripts/GL_Node_Point.gd +++ b/Scripts/GL_Node_Point.gd @@ -9,7 +9,10 @@ var dragging:bool var previewLine:Line2D = null -func process(delta): +func _ready(): + set_process(true) + +func _process(delta): if dragging: if previewLine == null: previewLine = Line2D.new() @@ -20,7 +23,7 @@ func process(delta): previewLine.points[0] = position previewLine.points[1] = get_viewport().get_mouse_position() -func _on_input_event(viewport, event, shape_idx): +func _input(event): if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: if !event.pressed: _finish_drag() diff --git a/Scripts/GL_Sine.gd b/Scripts/GL_Sine.gd index fcc4c97..26cb53e 100644 --- a/Scripts/GL_Sine.gd +++ b/Scripts/GL_Sine.gd @@ -7,5 +7,6 @@ func _ready(): pass func _process(delta): + super._process(delta) rows["Output"]["output"] = sin(Time.get_ticks_msec() * rows["Length"].get("input",1)) pass