Skip to content

An addon for Godot 3.4, written completely in GDScript, that gives GDScript some extra functionality.

License

Notifications You must be signed in to change notification settings

Totobird-Creations/Godot-GDScript-Plus

Repository files navigation

GDScript Plus

icon
An addon for Godot 3.4, written completely in GDScript, that gives GDScript some extra functionality.

Contents

Features

  • Nodes with scripts can disable the script button in the scene tree.
  • Custom nodes can disable creation using the create node menu.
  • Custom nodes can hide the script filename shown in the create node menu.
  • Custom nodes can show a description in the create node menu.
  • Export properties on nodes can show different property variables.
  • Export properties on nodes can have tooltips and descriptions.
  • Signals on nodes can have tooltips and descriptions.

Installation

Method 1 - Asset Library:
  • Open the AssetLib tab in Godot.
  • Search for GDScript Plus.
  • Download and install the plugin by Totobird Creations (If it isn't there, you will have to use method 2).
  • Open your project settings and go to the Plugins tab.
  • Enable the GDScript Plus plugin.
  • You're done!
Method 2 - Git Clone:
  • Download or clone this repository.
  • Move the addons/totobird_creations.property_descriptions folder into the addons folder in your project.
  • Open your project settings and go to the Plugins tab.
  • Enable the GDScript Plus plugin.
  • You're done!

Usage

Property Descriptions:

screenshot

In a GDScript file, on a line directly before an export command, add a line starting with ##. You can have as many lines as you want, as long as there is no separation between them
Example:

## Hit points of the player.
## This should not be set below 0.
export(int) var hit_points := 10
## This will not be a description because there is an empty line below.

export(String) var player_name := "Player"

Alternatively, you can define a get_property_description method in the script. This is useful for when you override the _get_property_list method. If the get_property_description method is defined, and it doesn't return an empty string, the doublehash comment will be ignored.

func get_property_description(property : String) -> String:
	if (property == "player_strength"):
		return "How much damage the player deals."
	return "" # If the return value is empty, no description will be provided.
Property Variable Overrides:

screenshot

Property variable names (The Property: my_property_name thing), can be modified using the get_property_variable method. Useful for when your property path is something like networking/port, but the variable storing the value is networking_port.

func get_property_variable(property : String) -> String:
	if (property == "player_resistance"):
		return "player_defence"
	return "" # If the return value is empty, the variable will not be overridden
Signal Descriptions:

screenshot

In a GDScript file, on a line directly before a signal command, add a line starting with ##. You can have as many lines as you want, as long as there is no separation between them
Example:

## Emitted when the entity begins charging an attack.
signal charging_attack(seconds)
## This will not be a description because there is an empty line below.

signal attack(damage)
Node Class Descriptions:

screenshot

In a GDScript file, on a line directly before the class_name command, add a line starting with ##. You can have as many lines as you want, as long as there is no separation between them
Example:

## Generic entity class.
## Contains information about hitpoints, attack damage, etc.
class_name Entity
## This will not be a description because there is an empty line below.

class_name PlayerEntity
Node Tags:

In a GDScript file, You can include lines starting with #@, and followed by an identifier to change how the node containing the script, acts in the editor

  • tree_disable_script : Disables the open script button in the scene tree.
    screenshot
  • create_disable : Similar to the CanvasItem node, this will prevent the node from being created using the create node menu. It can still be used by manually applying the script. (Top item in the image below)
    screenshot
  • create_hide_script : In the create node menu, the script filename will not be displayed. (Bottom item in the image below)
    screenshot
    Example:
#@ tree_disable_script
#@create_hide_script
# There can be a space between the prefix and tag.

License

MIT

About

An addon for Godot 3.4, written completely in GDScript, that gives GDScript some extra functionality.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published