I have a Menu tool scene with an array of custom resources.
export (Array, Resource) var Items = [null, null, null] setget set_array_items
When the size of the array changes, thesetget
gets called, which calls property_list_changed_notify()
, and the display and property browser update correctly.
The custom resource has three values, e.g.,
export var Name="Name Me" setget _set_name
When the resource's setget
gets called, it also calls property_list_changed_notify()
but no updates to the display or property browser are made. For example, changing the Name field changes the displayed menu and also the resource metadata name (Resource.set_name
) in the property editor. These changes propagate only when the size of the array changes. I would like the changes to propagate when the resource is edited.
For more information:
- The resource's setget
is called and it does call property_list_changed_notify()
- The resource extends Resource and has a class_name
.
- Resources don't emit a changed
signal; it's a bug but I don't care.
- The array's initialization list doesn't work; it's a bug but I don't care.
- The array is an array of Resource, and the setget
does the work of making sure they are resources of the correct type. I cannot do export (Array, MenuItem) ...
or export(Array, Resource, MenuItem) ...
; it's a bug but I don't care.
Any way to trigger the enclosing scene's update on the resource update? How about emitting my own 'changed' type signal in the custom resource? Does the resource need to be a tool?
PostScript: Things that don't work in resource's setget
:
- Calling .property_list_changed_notify()
does update, but at every keystroke, it closes the resource being edited. The property editor becomes unusable. This is probably the 'correct' solution, but has a bug that the update loses the place the resource is being edited.
- Calling get_local_scene()
gets a ...Can't use get_node() ...
error