NodeFinder

An asset by yanevyuk
The page banner background of a mountain and forest
NodeFinder hero image

Quick Information

0 ratings
NodeFinder icon image
yanevyuk
NodeFinder

This plugin adds a singleton named NodeFinder to the editor. It comes with a set functions that will allow you to easily reach nodes within your scene either by registering them into the singleton or simply using their name, rather than going through the hassle of using get_node which can break if you change the hierarchy.

Supported Engine Version
3.1
Version String
1.0
License Version
Apache-2.0
Support Level
community
Modified Date
5 years ago
Git URL
Issue URL

Turgy's NodeFinder Plugin

Adds a singleton named NodeFinder to make accessing nodes through GDScript easier.


Installation

  1. Install this plugin through the Asset Library in Godot or paste the contents of this repository to your projects folder.

  2. Activate the plugin in Godot through the project settings

Instructions

When the plugin is activated, a singleton named "NodeFinder" is added to the editor. You must call functions through this singleton.

  NodeFinder.example_function()

If you think "NodeFinder" is too long and you want it to be something shorter like "NF", you can change the string in the plugin.gd. Just make sure to disable the plugin beforehand!

Methods

There are two ways to access nodes through this singleton. You can either register nodes with a key, which essentially makes the singleton work like a global dictionary. Or you can simply search for a node by its name. Only the nodes that belong to the current scene the function is being called from are accessible!

  NodeFinder.get_named(nodename: String, suppress: bool = false `optional`)

This function will find the node with the given name. If more than one node exists in the scene with that name, it will return an array that contains all those nodes. This will cause the plugin to give out a warning about it. If you give the second argument as true it will suppress that warning.


  NodeFinder.register( key: String, node: Node )

Registers this node under this key. If the key has been registered before, it will push a warning.


  NodeFinder.get( key: String, suppress: bool = false `optional`)

Retrieves the node that is registered to this key. Pushes a warning if key doesn't exist. If the key has been found in multiple registeries for any reason, it will return an array which contains all those nodes instead.


  NodeFinder.override( key: String, node: Node )

Registers this node under this key. If the key has been registered before, it will override.


  NodeFinder.unregister( key: String, root: Node = null `optional`)

Removes the registry of that key. This might push a warning if the same key has been used in different scenes. In which case you should provide the root of the scene that holds the node you wish to delete.

This plugin adds a singleton named NodeFinder to the editor. It comes with a set functions that will allow you to easily reach nodes within your scene either by registering them into the singleton or simply using their name, rather than going through the hassle of using get_node which can break if you change the hierarchy.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
NodeFinder icon image
yanevyuk
NodeFinder

This plugin adds a singleton named NodeFinder to the editor. It comes with a set functions that will allow you to easily reach nodes within your scene either by registering them into the singleton or simply using their name, rather than going through the hassle of using get_node which can break if you change the hierarchy.

Supported Engine Version
3.1
Version String
1.0
License Version
Apache-2.0
Support Level
community
Modified Date
5 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers