godot-4.0-tool_button icon indicating copy to clipboard operation
godot-4.0-tool_button copied to clipboard

Godot 4.2+ _get_tool_buttons Fix

Open gillesdami opened this issue 8 months ago • 0 comments

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))

gillesdami avatar Jun 09 '24 08:06 gillesdami