godotengine / godotengine/godot

_set() with @tool does not work when property is edited from 2D/3D tab

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

Description

### Tested versions

- Reproducible in 4.2.1.stable

### System information

Godot v4.2.1.stable - Windows 10.0.19045 - GLES3 (Compatibility) - ANGLE (AMD, AMD Radeon(TM) R3 Graphics (0x000098E4) Direct3D11 vs_5_0 ps_5_0, D3D11-27.20.20906.6) () - AMD A4-9125 RADEON R3, 4 COMPUTE CORES 2C+2G (2 Threads)

### Issue description

On the provided MRP, there are several nodes for example. The Panel one. It has this code.
```
@tool
extends Panel

func _set(property, value):
if property == "size":
size = value
print("Resized to %v" % value)
return true
return false
```
Now when you try to edit the size of said Panel with Inspector (Layout > Transform > Size), either by typing the value then press Enter, **or** dragging the number left and right, you will notice there are several text getting printed, which means the code runs fine.

However, when you resize via the 2D scene editor, by clicking the panel once, until there's orange outline, then dragging the outline to resize the Panel, there will be no print out at all, which means the code doesn't run.

It's also a the case with the Sprite2D and Marker3D example.

### Steps to reproduce

- Download the MRP, open the project in godot 4.2.1
- Open demo.tscn, navigate to the 2D editor mode
- Click the Panel node so that it's selected
- Try to modify the "size" property of the Panel from the Inspector, and inspect the print out on the Output tab below
- Now with the panel selected in 2D editor, drag one of the circle orange joints on the Panel, resize it.
- Notice that the size property in the Inspect tab with change, but there are no print out

You can try and test with other node like the Sprite2D and Marker3D.

### Minimal reproduction project (MRP)

[setget_test.zip](https://github.com/godotengine/godot/files/13983849/setget_test.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the linked setget_test.zip project and demo.tscn, then reproduce the difference between editing size in the Inspector and dragging the selected Panel in the 2D editor. Compare the @tool _set() output for Panel, Sprite2D, and Marker3D. Done means 2D/3D editor property changes invoke the same setter behavior as Inspector edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.