jpInspector3.x

by duriganjp

1

jpInspector for Godot 3.x

Define categories, groups and buttons in the inspector using export vars in Godot 3.x!

✅ Works in Godot 3.1 ~ 3.5

How to

Export a Dictionary var with the defined prefix and it will be rendered as the element in the inspector.

# Creates a category with title "My Category"
export var _c_my_category: Dictionary

# Creates a group with title "Colors Group"
export var _g_colors_group: Dictionary = jpInspector.Group("color")
export var color_base: Color = Color.white
export var color_text: Color = Color.black

# Creates a button with title "Execute" that calls execute() when pressed
export var _b_execute: Dictionary

Inspector generated by the code above.

You can set custom prefixes in Project Settings.

In non-tools scripts, variables such as
export var _c_cat: Dictionary = jpInspector.Category("My Category")
won't be initialized in the editor, only on runtime.
This plugin bypass that by parsing your script and evaluating GDScript in a temporary reference.
You must declare and initialize the variable in a single line for it to work.
If you want to be extra careful, you may disable this in Project Settings.

You can also declare custom elements with a plain Dictionary:

export var _c_category: Dictionary = {
	jpInspector.CATEGORY_KEY_TITLE: "My actual title"
}

export var _c_category2 = {
	"title": "i like to live dangerously 8)"
}

Category

Default prefix: _c_

A category may have a custom title and icon.

export var _c_category: Dictionary = jpInspector.Category("My Category", "res://icon.png")

Group

Default prefix: _g_

Groups can control the visibity of properties that share a common prefix
or directly specified in variables. They can also have custom title.

It must be declared before the properties it controls.

export var _g_path_group: Dictionary = jpInspector.Group("path_", "NodePaths Group")
export var path_button: NodePath
export var path_label: NodePath
export var path_container: NodePath

export var _g_custom_group: Dictionary = jpInspector.GroupCustom(["page_title", "text", "button_color"])
export var page_title: String
export(String, MULTILINE) var text: String
export var button_color: Color

Button

Default prefix: _b_

A button will call a function in the object currently edited.
You can specify the method and its title.

It needs a tool script to work.

export var but_custom_function: Dictionary = jpInspector.FuncButton("custom_function")
export var but_button_2: Dictionary = jpInspector.FuncButton("another_custom_function", "Another Custom Function")

func custom_function() -> void:
	printt(self, "Calling custom function!")

func another_custom_function() -> void:
	printt(self, "Calling another custom function!")

Version

v1.0.0

Engine

3.3

Category

Scripts

Download

Versionv1.0.0
Download Now

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author