Giter Site home page Giter Site logo

node-finder's Introduction

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.

node-finder's People

Contributors

yanevyuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.