teebarjunk / godot-4.0-tool_button

Ease development with an inspector button that's plumb simple.
MIT License
55 stars 7 forks source link

Godot 4.2+ _get_tool_buttons Fix #13

Open gillesdami opened 4 months ago

gillesdami commented 4 months ago

This addon does not work in godot 4.2+. To fix the code you need to check if the object received by the addon is a GDScript and if so instantiate it to be able to run it's code. "@tool" is not required.

/addons/gd_noise/gd_noise_inspector.gd:37

# buttons defined in _get_tool_buttons show at the top
func _parse_begin(object: Object) -> void:
    var inst
    if object is GDScript:
        inst = object.new()
    else:
        inst = object

    if not inst.has_method("_get_tool_buttons"):
        return

    for method in inst._get_tool_buttons():
        add_custom_control(InspectorToolButton.new(inst, method, pluginref))