Need help on a Plugin Build

Godot Version

4.1.1

Question

I am developing a plugin for Godot, i am reasonably new at the whole game development, but feel like I have an acceptable grasp on the coding, but I am struggling to understand how some things are going on, I have been reading through documentations and questions for 2 days now and I am stuck, hence coming here:

I am building a plugin to run through all my gdscript files and look for certain tags - I use a bunch of tags such as #TODO:, #CleanUp, #FindSolution and more…

The plugin is a list to appear in the dock that just shows me the list of the tags in my code.
I have built the first version of this just fine, it parses through my folders, sorts gd files and then parses through each line to find tags - yay!

Now I have come to the point where I need this list to update itself every 30 seconds and I am running in to a couple of challenges.

  1. I am trying to emit a signal from the main node (i know, signalling down is not optimal…) when its time for all the list-items to delete themselves, because a new list is being generated. I cannot for the life of me, consistently get hold of the main node I have tried a bunch of different versions, and right now the node seems to be coming back with different names - I have asked to print the names of the root.get_child(0) with every interval, and its changing between TodoListDock (correct) and @EditorNode@17667 - Until I have this solved, I cannot reliably connect to the signal.

  2. This may be related to my first point - I have on my main script set a refresh timer to run, whenever the time has elapsed, it emits the signal above. But it looks like _process is running in multiple instances (even if I have closed down the plugin… and no active game window is open, its still running and printing the code snippets I have asked.

  3. Finally - I would like to (as a next step) - start being able to check off items on the list, and then the tag and the rest of the line is removed from the code. Could anyone help me with some direction on the principle I should look for here? - I have the file path and the line stored as part of the list - whats my best method of going in an deleting that line.

Thank you so much for the help, I am truly stuck here - some snippets of code here below.

the _Process function on my main script:

func _process(delta):
	#Refreshing list every 'interval'	
	refreshTimer += delta
	if refreshTimer >= refreshInterval:
		refreshTimer -= refreshInterval
		print(get_tree().root.get_child(0).name)
		emit_signal("refreshList")
		makeTheList()

The print() you see there produces a list of differing names “TodoListDock” and “@EditorNode@17667” continuously… even when the program is stopped - i suspect this has to do with the plugin nature (it also continues even if I disable the plugin).

Attempts to grab the signal at later instances sub_nodes (checkboxes):

func _ready():
	#get_node("TodoListDock").refreshList.connect(self.refreshMe) #Connect the Refresh me signal to the Process
	#get_tree().root.get_node("TodoListDock").refreshList.connect(self.refreshMe)
	pass

Lastly the plugin script:

var dock

func _enter_tree():
	dock = preload("res://addons/TODOList/TodoListDock.tscn").instantiate()
	add_control_to_dock(EditorPlugin.DOCK_SLOT_RIGHT_BL, dock)


func _exit_tree():
	remove_control_from_docks(dock)
	dock.set_process(false)
	dock.queue_free()

Screenshot 2024-07-09 at 19.44.25

Well I managed to solve point #1 above by simply sending self down through the functions, so the instantiations gets the main node to connect to the signal.
(The problem ended up being that a plugin is part of the larger GODOT scene-tree and so the root node is nowhere near the main node of the plugin).

Now I just gotta figure out the other two…