Fix Label auto sizing to be relative to pivot and sync layout when editing

#2496
This commit is contained in:
Wojtek Figat
2024-09-18 22:21:56 +02:00
parent 8c0d89bc62
commit 262c536d7f
4 changed files with 31 additions and 21 deletions

View File

@@ -296,6 +296,16 @@ namespace FlaxEditor.CustomEditors
_values.Set(_parent.Values, value);
}
private bool SyncParent()
{
// TODO: add attribute for types that want to sync their contents with a parent
var type = Values.Type.Type;
if (type == typeof(LocalizedString) ||
type == typeof(FontReference))
return true;
return _parent != null && !(_parent is SyncPointEditor);
}
internal virtual void RefreshInternal()
{
if (_values == null)
@@ -317,7 +327,7 @@ namespace FlaxEditor.CustomEditors
// Propagate values up (eg. when member of structure gets modified, also structure should be updated as a part of the other object)
var obj = _parent;
while (obj._parent != null && !(obj._parent is SyncPointEditor))
while (obj.SyncParent())
{
obj.Values.Set(obj._parent.Values, obj.Values);
obj = obj._parent;