godotengine / godotengine/godot

Cannot edit exported property when using export_custom with Variant type hint

Open
#95,693 3 comments 0 reactions 0 assignees View on GitHub
discussion topic:core topic:editor topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: v4.3.stable.official [77dcf97d8]

### System information

Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.3623) - AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G (4 Threads)

### Issue description

When using the new ```@export_custom``` annotation for untyped properties, the inspector behavior is different if the user uses no type hints or the Variant type hint

![image](https://github.com/user-attachments/assets/e5e40eb9-4fbb-466b-b709-1444a9dbef8e)

The inspector only shows a usable field correctly when not using any type hint. It will show the type hint for the same type of the default value used as initializer for the property in the script.

But when using the ```Variant``` type hint, regardless of the property initializer value, the editor inspector will show a ```""``` label and the value won't be editable at all. I imagine the desired behavior would be for an usable inspector field to be show regardless when either not using type hints or explicitly using Variant as type hint.

As a side note, a similar thing happens with the data property of json resources, since the data property of a json resource is just a plain variant, it will always show a "" label regardless of the property contents. Please note I'm just pointing out an already existing similar behavior, not reporting a new issue.

![image](https://github.com/user-attachments/assets/5d6ea220-3900-49a0-ace3-c40c0e262671)

### Steps to reproduce

1) in any project, create a new script
1) put the code bellow there
```gdscript
@export_custom(0, '')
var exported_var_without_type_hint = 1.23
@export_custom(0, '')
var exported_var_using_variant_type_hint:Variant = 1.23
```

### Minimal reproduction project (MRP)

[ExportCustomWithVariantBug.zip](https://github.com/user-attachments/files/16644846/ExportCustomWithVariantBug.zip)

### Other notes

Would this [PR](https://github.com/godotengine/godot/pull/89324) fix this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.