Skip to content

Strongly type Resource .tres files in ResourceTree when possible - #201

Open
Seb105 wants to merge 1 commit into
Cat-Lips:mainfrom
Seb105:Strongly-typed-resources
Open

Strongly type Resource .tres files in ResourceTree when possible#201
Seb105 wants to merge 1 commit into
Cat-Lips:mainfrom
Seb105:Strongly-typed-resources

Conversation

@Seb105

@Seb105 Seb105 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Resource files can contain type information when they are created from a script which is a GlobalClass/Tool

This PR makes [ResourceTree] search for this information, and where it can, load the resource as that type.

As an example:

[GlobalClass, Tool]
public partial class InventoryItemSet : Resource 
{
    // ...
}

Produces this header:

[gd_resource type="Resource" script_class="InventoryItemSet" format=3 uid="uid://cfpe2cbwdix4h"]

This PR makes the ResourceTree source generator look for script_class="Type" in types that are found to be a Resource, and use that type where possible.

Where script_class is not present or no valid type is found, it is simply treated as Resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant