Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Added configuration foldout to all service configuration profiles #529

Merged
merged 3 commits into from
Apr 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class MixedRealityServiceProfileInspector : BaseMixedRealityProfileInspec

private SerializedProperty configurations;

private bool showConfigurationFoldout = true;

/// <summary>
/// Gets the service constraint used to filter options listed in the
/// <see cref="configurations"/> instance type dropdown. Set after
Expand Down Expand Up @@ -56,18 +58,21 @@ protected override void OnEnable()
public override void OnInspectorGUI()
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Configuration Options", EditorStyles.boldLabel);
EditorGUILayout.Space();
serializedObject.Update();
EditorGUILayout.Space();
configurationList.DoLayoutList();
showConfigurationFoldout = EditorGUILayout.Foldout(showConfigurationFoldout, new GUIContent($"{ServiceConstraint.Name} Configuration Options"), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be cached as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it? I'm not confident the service constraint is populated in the constructor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the "EditorGUILayoutExtensions.FoldoutWithBoldLabel" here? To gradually update all the inspectors to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do use it in the rolled up branches. It's just that you didn't commit just that change to the development branch. (We could have you pull it out but that's up to you)


if (configurations == null || configurations.arraySize == 0)
if (showConfigurationFoldout)
{
EditorGUILayout.HelpBox("Register a new Service Configuration", MessageType.Warning);
}
serializedObject.Update();
EditorGUILayout.Space();
configurationList.DoLayoutList();

serializedObject.ApplyModifiedProperties();
if (configurations == null || configurations.arraySize == 0)
{
EditorGUILayout.HelpBox($"Register a new {ServiceConstraint.Name} Configuration", MessageType.Warning);
}

serializedObject.ApplyModifiedProperties();
}
}

private void DrawConfigurationOptionElement(Rect rect, int index, bool isActive, bool isFocused)
Expand Down