Skip to content

Inspector: Clear option not visible when a Resource's @export-ed property is a Script #110178

@elmarhoppieland

Description

@elmarhoppieland

Tested versions

v4.4.1.stable.official [49a5bc7]

System information

Godot v4.4.1.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 Laptop GPU (NVIDIA; 32.0.15.6607) - AMD Ryzen AI 9 HX 370 w/ Radeon 890M (24 threads)

Issue description

When right-clicking a Resource's property that has @export, if that property is set to a Script, the inspector does not show the Clear button to set the property to null.

This is what I would expect to see:
Image

But when the property is set to a Script:
Image

As you can see, the Clear button is not shown on the Script.

This happens regardless of the type of the property. Even when the property is typed to Resource, when setting it to a Script it still doesn't show Clear. Also, for some reason this issue does not apply when the property is exported from a Node.

I'm guessing this is done to prevent people from clearing an object's script by clearing its script property, but this shouldn't apply to other properties.

This issue is preventing me from adding a custom revert value for Script properties, since they cannot (easily) be set to null again afterwards.

Steps to reproduce

  1. Create a custom Resource script.
  2. Add an @export-ed property of type Script (or an ancestor class).
  3. Create an instance of the custom Resource.
  4. Set the property to a Script.
  5. Right-click the property, and observe that the Clear button is missing.

Minimal reproduction project (MRP)

mrp.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions