Notify_property_list_changed() not working with custom Resource Array

Godot Version



I have a Array[MyResource], which has to be @export to be edited on per scene basis, also only relevant when my_bool is unchecked.
So, to make it only appears when my_bool is false, I call notify_property_list_changed() in my_bool setter, make the script @tool, and wrote the code below, which works perfectly fine when it’s dealing with int:

func _get_property_list():
	var properties := []
		"name": "custom_resource_array",
		"type": TYPE_ARRAY,
    return properties

But it doesn’t quite work with custom resource.

In the inspector, the part where it’s supposed to ask me to create new resource, is simply null.
It somewhat work when I set the type to Array[int],
but there’s still the pencil icon on the right to suggest I can modify the type, which shouldn’t be possible with typed array.
Considering this might be a hint problem, I added


Annnd it did nothing.

Can I just say this can really be made simpler? Like some kind of custom @export parameter that checks a flag could do, instead of making @tool script everywhere?

Anyway, I’m exhausted and asking for help.
Thanks for reading.

Not really solved, but do the @export normally and use

func _validate_property(property: Dictionary):
	if == "custom_resource_array":
		property.usage = PROPERTY_USAGE_DEFAULT if !my_bool else PROPERTY_USAGE_NO_EDITOR

works because it only edited a single property instead of writing the whole dictionary.
Problem is solved, but the question remains.

Did you…throw my question into ChatGPT and post the reply
@export(condition) is not a thing…I wouldn’t be posting if this existed