diff --git a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
index d517d12fd..eaaa5685b 100644
--- a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
@@ -467,26 +467,36 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Setup transform
if (Presenter is LayoutElementsContainer l)
{
+ for (int i = 0; i < l.Children.Count; i++)
+ {
+ if (l.Children[i] is GroupElement g && g.Panel.HeaderText.Equals("Transform", StringComparison.Ordinal))
+ {
+ l.Children.Remove(g);
+ l.ContainerControl.Children.Remove(g.Panel);
+ break;
+ }
+ }
+
var transformGroup = l.Group("Transform");
VerticalPanelElement mainHor = VerticalPanelWithoutMargin(transformGroup);
CreateTransformElements(mainHor, ValuesTypes);
-
+
ScriptMemberInfo scaleInfo = ValuesTypes[0].GetProperty("Scale");
ItemInfo scaleItem = new ItemInfo(scaleInfo);
transformGroup.Property("Scale", scaleItem.GetValues(Values));
-
+
ScriptMemberInfo pivotInfo = ValuesTypes[0].GetProperty("Pivot");
ItemInfo pivotItem = new ItemInfo(pivotInfo);
transformGroup.Property("Pivot", pivotItem.GetValues(Values));
-
+
ScriptMemberInfo shearInfo = ValuesTypes[0].GetProperty("Shear");
ItemInfo shearItem = new ItemInfo(shearInfo);
transformGroup.Property("Shear", shearItem.GetValues(Values));
-
+
ScriptMemberInfo rotationInfo = ValuesTypes[0].GetProperty("Rotation");
ItemInfo rotationItem = new ItemInfo(rotationInfo);
transformGroup.Property("Rotation", rotationItem.GetValues(Values));
-
+
// Get position of general tab
for (int i = 0; i < l.Children.Count; i++)
{
diff --git a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs
index d7d16083e..de7a5d1bf 100644
--- a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs
@@ -57,17 +57,18 @@ namespace FlaxEditor.CustomEditors.Editors
menu.ItemsContainer.RemoveChildren();
menu.AddButton("Copy", linkedEditor.Copy);
- var paste = menu.AddButton("Paste", linkedEditor.Paste);
- paste.Enabled = linkedEditor.CanPaste;
+ var b = menu.AddButton("Paste", linkedEditor.Paste);
+ b.Enabled = linkedEditor.CanPaste && !Editor._readOnly;
menu.AddSeparator();
- var moveUpButton = menu.AddButton("Move up", OnMoveUpClicked);
- moveUpButton.Enabled = Index > 0;
+ b = menu.AddButton("Move up", OnMoveUpClicked);
+ b.Enabled = Index > 0 && !Editor._readOnly;
- var moveDownButton = menu.AddButton("Move down", OnMoveDownClicked);
- moveDownButton.Enabled = Index + 1 < Editor.Count;
-
- menu.AddButton("Remove", OnRemoveClicked);
+ b = menu.AddButton("Move down", OnMoveDownClicked);
+ b.Enabled = Index + 1 < Editor.Count && !Editor._readOnly;
+
+ b = menu.AddButton("Remove", OnRemoveClicked);
+ b.Enabled = !Editor._readOnly;
}
private void OnMoveUpClicked()
@@ -177,6 +178,7 @@ namespace FlaxEditor.CustomEditors.Editors
private IntValueBox _sizeBox;
private Color _background;
private int _elementsCount, _minCount, _maxCount;
+ private bool _readOnly;
private bool _canResize;
private bool _canReorderItems;
private CollectionAttribute.DisplayType _displayType;
@@ -209,6 +211,7 @@ namespace FlaxEditor.CustomEditors.Editors
return;
var size = Count;
+ _readOnly = false;
_canResize = true;
_canReorderItems = true;
_minCount = 0;
@@ -225,6 +228,7 @@ namespace FlaxEditor.CustomEditors.Editors
if (collection != null)
{
_canResize = !collection.ReadOnly;
+ _readOnly = collection.ReadOnly;
_minCount = collection.MinCount;
_maxCount = collection.MaxCount;
_canReorderItems = collection.CanReorderItems;
@@ -235,6 +239,12 @@ namespace FlaxEditor.CustomEditors.Editors
spacing = collection.Spacing;
_displayType = collection.Display;
}
+ if (attributes != null && attributes.Any(x => x is ReadOnlyAttribute))
+ {
+ _readOnly = true;
+ _canResize = false;
+ _canReorderItems = false;
+ }
if (_maxCount == 0)
_maxCount = ushort.MaxValue;
_canResize &= _minCount < _maxCount;
@@ -243,8 +253,7 @@ namespace FlaxEditor.CustomEditors.Editors
dragArea.CustomControl.Editor = this;
dragArea.CustomControl.ElementType = ElementType;
- // Check for the AssetReferenceAttribute. In JSON assets, it can be used to filter
- // which scripts can be dragged over and dropped on this collection editor.
+ // Check for the AssetReferenceAttribute. In JSON assets, it can be used to filter which scripts can be dragged over and dropped on this collection editor
var assetReference = (AssetReferenceAttribute)attributes?.FirstOrDefault(x => x is AssetReferenceAttribute);
if (assetReference != null)
{
@@ -333,6 +342,8 @@ namespace FlaxEditor.CustomEditors.Editors
var property = panel.AddPropertyItem(itemLabel);
var itemLayout = (LayoutElementsContainer)property;
itemLabel.LinkedEditor = itemLayout.Object(new ListValueContainer(elementType, i, Values, attributes), overrideEditor);
+ if (_readOnly && itemLayout.Children.Count > 0)
+ GenericEditor.OnReadOnlyProperty(itemLayout);
}
else if (_displayType == CollectionAttribute.DisplayType.Header || (_displayType == CollectionAttribute.DisplayType.Default && !single))
{
@@ -340,13 +351,15 @@ namespace FlaxEditor.CustomEditors.Editors
cdp.CustomControl.Setup(this, i, _canReorderItems);
var itemLayout = cdp.VerticalPanel();
cdp.CustomControl.LinkedEditor = itemLayout.Object(new ListValueContainer(elementType, i, Values, attributes), overrideEditor);
+ if (_readOnly && itemLayout.Children.Count > 0)
+ GenericEditor.OnReadOnlyProperty(itemLayout);
}
}
}
_elementsCount = size;
// Add/Remove buttons
- if (_canResize)
+ if (_canResize && !_readOnly)
{
var panel = dragArea.HorizontalPanel();
panel.Panel.Size = new Float2(0, 20);
diff --git a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
index da60aaefd..0bf477834 100644
--- a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
@@ -131,7 +131,7 @@ namespace FlaxEditor.CustomEditors.Editors
///
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
- if (button == MouseButton.Left)
+ if (button == MouseButton.Left && _editor._canEditKeys)
{
OnEditClicked(null);
return true;
@@ -197,6 +197,11 @@ namespace FlaxEditor.CustomEditors.Editors
spacing = collection.Spacing;
_displayType = collection.Display;
}
+ if (attributes != null && attributes.Any(x => x is ReadOnlyAttribute))
+ {
+ _readOnly = true;
+ _canEditKeys = false;
+ }
// Size
if (layout.ContainerControl is DropPanel dropPanel)
@@ -239,14 +244,6 @@ namespace FlaxEditor.CustomEditors.Editors
var keysEnumerable = ((IDictionary)Values[0]).Keys.OfType