4d49 / object-inspector

In-game properties inspector for Godot 4.3
MIT License
22 stars 5 forks source link

[Request] Short tutorial for new Godot users #10

Open Goicox opened 2 weeks ago

Goicox commented 2 weeks ago

It would be nice if it could expand the documentation, and perhaps you could add a short video showing how to use the plugin. I can load it in Godot, but I don't how to use it.

plugin_img

Thank you in advance!

4d49 commented 2 weeks ago

Please try to read the README again after the update. And tell me if it solved your problem.

Goicox commented 1 week ago

Thank you for updating the README. Still, I do not know how to make it work. I get inspector = null in the _ready method.

image

4d49 commented 1 week ago

I get inspector = null in the _ready method.

What kind of object do you think Inspector should return in the get_object method? Read the example more carefully. You should call inspector.set_object() and assign your object.

4d49 commented 1 week ago

Example:


@onready var inspector: Inspector = $Inspector

func _ready() -> void:
    # Place for YOUR OBJECT.
    var example_object := ExampleClass.new()
    # Assign YOUR object to Inspector.
    inspector.set_object(example_object)

class ExampleClass:
    @export var check: bool = true

    @export_range(0, 100) var number_i: int = 42
    @export_range(0, 100) var number_f: float = PI
Goicox commented 1 week ago

Thank you for the feedback. I just wanted to let you know that now it works.

I was getting inspector = null in the _ready method since the Inspector should be ObjectInspector (at least if the ObjectInspector is not renamed to something else).

@onready var inspector: Inspector = $ObjectInspector

image

image

Goicox commented 1 week ago

Now regarding the second part of the README, I am not able to use the following:

Inspector.add_description

Inspector.get_object_property_description

I am getting:

Static function "add_description()" not found in base "Inspector". Static function "get_object_property_description()" not found in base "Inspector".

Thank you in advance for your help.

4d49 commented 1 week ago

@onready var inspector: Inspector = $ObjectInspector

The $ symbol is equivalent to calling the get_node() function, so it is important to specify the correct path to the node.

4d49 commented 1 week ago

Inspector.add_description #Inspector.get_object_property_description


@onready var inspector: Inspector = $ObjectInspector

func _ready() -> void: Inspector.add_description("ExampleClass", "check", "Custom description for check")

Or:

#Inspector.add_script_property_description(ExampleClass, "check", "Custom description for check")

var example_object := ExampleClass.new()
inspector.set_object(example_object)

But I found a problem and it will NOT work for internal classes, you will have to declare `ExampleClass` in a separate file. I may try to work something out with that later.