Override _get_property_list()

Godot Version

4.3

Question

i’m trying to make a “resource+” class that extends from resource, and will “prettify” all the properties extended from this resource. in other words i’d like to use _get_property_list() and _validate_property() to conditionally show exported variables and have some custom exported variables, but how do i use the two functions in relation to each other? At first i was going to override _get_property_list() and call get_property_list() inside that function to fetch the properties and edit them (quite a genius move, really, i only realised what i was doing when it crashed on me). Should i use _validate_property()? How would you go about returning the property dictionary in the overrided _get_property_list() function if i cant really get the resource’s properties from within that function? unless im mistaken here.

Can you show an example of the current state of the Resource that you want to “prettify” and maybe a mockup of how you want this to ultimately look like?

Messing with custom exported variables is quite advance stuff and in my honest opinion very rarely worth the effort, unless you’re working on a really big project that will benefit from the time savings or data quality / readability.

thanks for replying! i don’t really have much to show here since this is all i’ve got:

image

i was just messing around with the functions to figure them out, i’m not sure yet how i’d deal with exporting some custom variables, i was thinking of exporting custom ones with a prefix to identify their “custom” type, like

@export var health: float = 50.0 
@export var condition_health: bool = true 
# ticking this off/on would hide/show the health property, 
# if i use this naming convention of appending "condition_" behind the variable name then i could probably
# loop through every property that has that appended to it and do the show/hide magic

im quite the perfectionist type i guess and i’d gladly use this type of resource over the built in resource in my other projects as well so overall it might be worth it, thats my reasoning, other than that i’d just like things to look clean

For that simple example you mentioned with the health component, you can just use @export_group, @export_subgroup or @export_category to group and hide your params.