Fix not using hardcoded order for showing Actor main properties in editor
This commit is contained in:
@@ -24,43 +24,6 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
private Guid _linkedPrefabId;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void SpawnProperty(LayoutElementsContainer itemLayout, ValueContainer itemValues, ItemInfo item)
|
||||
{
|
||||
// Note: we cannot specify actor properties editor types directly because we want to keep editor classes in FlaxEditor assembly
|
||||
int order = item.Order?.Order ?? int.MinValue;
|
||||
switch (order)
|
||||
{
|
||||
// Override static flags editor
|
||||
case -80:
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ActorStaticFlagsEditor));
|
||||
break;
|
||||
|
||||
// Override layer editor
|
||||
case -69:
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ActorLayerEditor));
|
||||
break;
|
||||
|
||||
// Override tag editor
|
||||
case -68:
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ActorTagEditor));
|
||||
break;
|
||||
|
||||
// Override position/scale editor
|
||||
case -30:
|
||||
case -10:
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ActorTransformEditor.PositionScaleEditor));
|
||||
break;
|
||||
|
||||
// Override orientation editor
|
||||
case -20:
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ActorTransformEditor.OrientationEditor));
|
||||
break;
|
||||
}
|
||||
|
||||
base.SpawnProperty(itemLayout, itemValues, item);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override List<ItemInfo> GetItemsForType(ScriptType type)
|
||||
{
|
||||
|
||||
@@ -517,23 +517,22 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
if (item.Header != null)
|
||||
itemLayout.Header(item.Header.Text);
|
||||
|
||||
// Peek values
|
||||
ValueContainer itemValues;
|
||||
try
|
||||
{
|
||||
itemValues = item.GetValues(Values);
|
||||
// Peek values
|
||||
ValueContainer itemValues = item.GetValues(Values);
|
||||
|
||||
// Spawn property editor
|
||||
SpawnProperty(itemLayout, itemValues, item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Editor.LogWarning("Failed to get object values for item " + item);
|
||||
Editor.LogWarning("Failed to setup values and UI for item " + item);
|
||||
Editor.LogWarning(ex.Message);
|
||||
Editor.LogWarning(ex.StackTrace);
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn property editor
|
||||
SpawnProperty(itemLayout, itemValues, item);
|
||||
|
||||
// Expand all parent groups if need to
|
||||
if (item.ExpandGroups)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user