This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up service configuration profiles a bit (#852)
# XRTK - Mixed Reality Toolkit Pull Request ## Overview <!-- Please provide a clear and concise description of the pull request. --> Cleaned up and simplified configuration serialized properties a bit.
- Loading branch information
1 parent
17284ab
commit d224a36
Showing
6 changed files
with
262 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using UnityEditor; | ||
using XRTK.Definitions.Utilities; | ||
|
||
namespace XRTK.Editor.Data | ||
{ | ||
internal class ConfigurationProperty | ||
{ | ||
private readonly SerializedProperty configuration; | ||
|
||
public bool IsExpanded | ||
{ | ||
get => configuration.isExpanded; | ||
set => configuration.isExpanded = value; | ||
} | ||
|
||
private readonly SerializedProperty name; | ||
|
||
public string Name | ||
{ | ||
get => name.stringValue; | ||
set => name.stringValue = value; | ||
} | ||
|
||
private readonly SerializedProperty priority; | ||
|
||
public uint Priority | ||
{ | ||
get => (uint)priority.intValue; | ||
set => priority.intValue = (int)value; | ||
} | ||
|
||
private readonly SerializedProperty instancedType; | ||
private readonly SerializedProperty reference; | ||
|
||
public Type InstancedType | ||
{ | ||
get => new SystemType(instancedType); | ||
set => reference.stringValue = value == null ? string.Empty : value.GUID.ToString(); | ||
} | ||
|
||
private readonly SerializedProperty platformEntries; | ||
private readonly SerializedProperty runtimePlatforms; | ||
|
||
private readonly SerializedProperty profile; | ||
|
||
public UnityEngine.Object Profile | ||
{ | ||
get => profile.objectReferenceValue; | ||
set => profile.objectReferenceValue = value; | ||
} | ||
|
||
public ConfigurationProperty(SerializedProperty property, bool clearPlatforms = false) | ||
{ | ||
configuration = property; | ||
name = property.FindPropertyRelative(nameof(name)); | ||
priority = property.FindPropertyRelative(nameof(priority)); | ||
instancedType = property.FindPropertyRelative(nameof(instancedType)); | ||
reference = instancedType.FindPropertyRelative(nameof(reference)); | ||
platformEntries = property.FindPropertyRelative(nameof(platformEntries)); | ||
runtimePlatforms = platformEntries.FindPropertyRelative(nameof(runtimePlatforms)); | ||
|
||
if (clearPlatforms) | ||
{ | ||
runtimePlatforms.ClearArray(); | ||
} | ||
|
||
profile = property.FindPropertyRelative(nameof(profile)); | ||
} | ||
|
||
public void ApplyModifiedProperties() | ||
{ | ||
configuration.serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.