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.
Fixes to correctly filter for nested services/data providers in the n…
…ew configuraitons inspector (#470) * Recursively look for generic type arguments on a profile to filter for ServiceConstraint * Fix BaseExtensionService profile type expected in constructor * Update XRTK-Core/Packages/com.xrtk.core/Inspectors/Profiles/MixedRealityServiceProviderProfileInspector.cs Co-Authored-By: Stephen Hodgson <StephenHodgson@users.noreply.github.com> * Update XRTK-Core/Packages/com.xrtk.core/Extensions/TypeExtensions.cs Co-Authored-By: Stephen Hodgson <StephenHodgson@users.noreply.github.com> * Update XRTK-Core/Packages/com.xrtk.core/Definitions/BaseMixedRealityExtensionServiceProfile.cs Co-Authored-By: Stephen Hodgson <StephenHodgson@users.noreply.github.com> * Fix class doc * Fix missing using * Fix base extension service profile generic type * Make ServiceConstraint protected to allow for custom override * Update Tests * Fix interface base type Co-authored-by: Stephen Hodgson <StephenHodgson@users.noreply.github.com>
- Loading branch information
1 parent
6d73c4c
commit 233def2
Showing
6 changed files
with
83 additions
and
4 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,12 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using XRTK.Interfaces; | ||
|
||
namespace XRTK.Definitions | ||
{ | ||
public abstract class BaseMixedRealityExtensionServiceProfile : BaseMixedRealityServiceProfile<IMixedRealityService> | ||
{ | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Definitions/BaseMixedRealityExtensionServiceProfile.cs.meta
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using UnityEngine; | ||
|
||
namespace XRTK.Extensions | ||
{ | ||
/// <summary> | ||
/// Extension methods for <see cref="Type"/> instances. | ||
/// </summary> | ||
public static class TypeExtensions | ||
{ | ||
/// <summary> | ||
/// Recursively looks for generic type arguments in type hierarchy, starting with the | ||
/// root type provided. If no generic type arguments are found on a type, it's base | ||
/// type is checked. | ||
/// </summary> | ||
/// <param name="root">Root type to start looking for generic type arguments at.</param> | ||
/// <param name="maxRecursionDepth">The maximum recursion depth until execution gets canceled even if no results found.</param> | ||
/// <returns>Found gneneric type arguments array or null, if none found.</returns> | ||
public static Type[] FindTopmostGenericTypeArguments(this Type root, int maxRecursionDepth = 5) | ||
{ | ||
Type[] genericTypeArgs = root?.GenericTypeArguments; | ||
if (genericTypeArgs != null && genericTypeArgs.Length > 0) | ||
{ | ||
return genericTypeArgs; | ||
} | ||
|
||
if (maxRecursionDepth > 0 && root != null) | ||
{ | ||
return FindTopmostGenericTypeArguments(root.BaseType, --maxRecursionDepth); | ||
} | ||
|
||
Debug.LogError($"{nameof(FindTopmostGenericTypeArguments)} - Maximum recursion depth reached without finding generic type arguments."); | ||
return null; | ||
} | ||
} | ||
} |
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
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