Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notify_property_list_changed does not refresh the inspector in certain cases #76795

Open
Zylann opened this issue May 6, 2023 · 3 comments · May be fixed by #77006
Open

notify_property_list_changed does not refresh the inspector in certain cases #76795

Zylann opened this issue May 6, 2023 · 3 comments · May be fixed by #77006

Comments

@Zylann
Copy link
Contributor

Zylann commented May 6, 2023

Godot version

Godot 4.0.2
Godot 4.0 90b4ca2

System information

Windows 10 64 bits NVIDIA GeForce GTX 1060

Issue description

I have a class with a TypedArray<Resource> property (where the Resource is a custom one, but it doesnt matter in this issue). When items of this array are modified, it calls the setter of that property, which is ok. I rely on that to update certain things.
In that class, I generate new properties in _get_property_list depending on the non-null contents of the array (null has to be allowed otherwise the inspector wouldn't work). So inside the setter of the array, I call notify_property_list_changed to refresh the inspector. However, in certain cases, Godot is not refreshing the inspector.

Steps to reproduce

In the test project:

  1. Open main.tscn, select the root node.
  2. In the inspector, select the Array property to expand it.
  3. Click Add Element. This makes the array contain one null item. Notice in the Output panel that the setter was called, notify_property_list_changed was called, and _get_property_list was called, printing 0 variants, that's fine.
  4. In the array, click the null item, and create a new Resource. Now the array contains one Resource. Observe notify_property_list_changed has been printed again, however it is not followed by _get_property_list, and the inspector is not refreshing. This is not expected.
  5. To confirm, inspect something else (child node or icon.png), and inspect the root node again. This forces the inspector to refresh. Observe that now _get_property_list: 1 variants is printed, and a new property shows up, variants/0.

Minimal reproduction project

NotifyPropertyListChangedArray.zip

@jcb936
Copy link

jcb936 commented May 7, 2023

This looks to be due to the assign method in Array not correctly assigning over the type information when dealing with variant types. More details in the linked PR.

@ajreckof
Copy link
Member

ajreckof commented May 7, 2023

The linked PR does not fix the described bug but a regression that appears when trying to replicate this (#76642). I linked a fix I made for another issue that also fix this at the same time.

@akien-mga akien-mga added this to the 4.1 milestone May 12, 2023
@ajreckof
Copy link
Member

I looked a bit more at this PR, the other PR fix was in fact fixing only this appearance of this bug. It looks like there would be other cases where it won't work. In a more general way this will happen whenever the call to the setter (which himself calls notify_property_list_changed) happens through a emit_changed with p_changing = true. I'll post a new PR that will adress specifically this bug.

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 14, 2023
@KoBeWi KoBeWi removed this from the 4.3 milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment