Skip to content

Commit 53e043b

Browse files
Merge pull request #2 from realitycollective/Service-Framework
Service framework
2 parents 8d68504 + 9b64f66 commit 53e043b

File tree

214 files changed

+11535
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+11535
-47
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Reality Collective - Reality Toolkit Pull Request
2+
3+
## Overview
4+
<!-- Please provide a clear and concise description of the pull request. -->
5+
6+
## Changes
7+
<!-- Brief list of the targeted features that are being changed. -->
8+
9+
- Fixes: <!--issue number or url-->
10+
11+
## Breaking Changes
12+
<!-- Are there any breaking changes included in this change that would prevent or cause issue for existing projects? -->
13+
14+
- Breaks
15+
16+
## Related Submodule Changes
17+
18+
<!-- Include any submodule related Pull Request links here -->
19+
- URL
20+
21+
## Testing status
22+
<!-- Remove the options that do not apply -->
23+
* No tests have been added.
24+
* Includes unit tests.
25+
* Includes performance tests.
26+
* Includes integration tests.
27+
28+
### Manual testing status
29+
<!-- Describe how you tested your implementation/fix. Try to mention all the cases and flows. -->
30+
<!-- It will help the reviewer to understand if you missed any cases or test steps as well as will tell more about your feature or fix. -->
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build UPM
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'development'
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
# Example flow
20+
21+
jobs:
22+
# Check Unity version requird by the package
23+
validate-environment:
24+
name: Get Unity Version from UPM package
25+
uses: realitycollective/reusableworkflows/.github/workflows/getunityversionfrompackage.yml@main
26+
with:
27+
build-target: windows
28+
29+
# Check Unity Hub and Editor Environment
30+
Setup-Unity:
31+
name: Validate Unity Install
32+
needs: validate-environment
33+
uses: realitycollective/reusableworkflows/.github/workflows/validateunityinstall.yml@main
34+
with:
35+
build-target: windows
36+
unityversion: ${{ needs.validate-environment.outputs.unityversion }}
37+
38+
Install-Unity-Editor:
39+
if: ${{ needs.Setup-Unity.outputs.unityeditorinstalled }} == '0'
40+
needs: Setup-Unity
41+
uses: realitycollective/reusableworkflows/.github/workflows/installunityeditor.yml@main
42+
name: Install Unity Editor
43+
with:
44+
build-target: windows
45+
unityversion: ${{ needs.Setup-Unity.outputs.unityeditorversion }}
46+
47+
# Run Unity unit tests defined in the package
48+
Run-Unit-Tests:
49+
name: Run Unity Unit Tests
50+
needs: [Setup-Unity, Install-Unity-Editor]
51+
uses: realitycollective/reusableworkflows/.github/workflows/rununityunittests.yml@main
52+
with:
53+
build-target: windows
54+
unityversion: ${{ needs.Setup-Unity.outputs.unityeditorversion }}

.github/workflows/publishpackages.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release and Tag package for Release
2+
3+
on:
4+
workflow_call:
5+
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
# Example flow
14+
15+
jobs:
16+
release-Package:
17+
name: Up Version package and release
18+
if: github.ref == 'refs/heads/development'
19+
uses: realitycollective/reusableworkflows/.github/workflows/tagrelease.yml@main
20+
with:
21+
build-target: windows
File renamed without changes.

com.realitytoolkit.service-framework/Editor/AssemblyInfo.cs Editor/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
using System.Reflection;
77

8-
[assembly: AssemblyVersion("0.1.0")]
8+
[assembly: AssemblyVersion("1.0.0")]
99
[assembly: AssemblyTitle("com.realitytoolkit.service-framework")]
10-
[assembly: AssemblyCompany("RealityCollective")]
11-
[assembly: AssemblyCopyright("Copyright (c) RealityCollective. All rights reserved.")]
10+
[assembly: AssemblyCompany("Reality Collective")]
11+
[assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")]

Editor/BaseProfileInspector.cs

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright (c) Reality Collective. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using RealityToolkit.ServiceFramework.Definitions;
5+
using RealityToolkit.ServiceFramework.Editor.Extensions;
6+
using RealityToolkit.ServiceFramework.Editor.Utilities;
7+
using RealityToolkit.ServiceFramework.Extensions;
8+
using System;
9+
using UnityEditor;
10+
using UnityEngine;
11+
12+
namespace RealityToolkit.ServiceFramework.Editor.Profiles
13+
{
14+
/// <summary>
15+
/// Base class for all <see cref="BaseProfile"/> Inspectors to inherit from.
16+
/// </summary>
17+
[CustomEditor(typeof(BaseProfile), true, isFallback = true)]
18+
public class BaseProfileInspector : UnityEditor.Editor
19+
{
20+
protected static readonly string DefaultGuidString = default(Guid).ToString("N");
21+
22+
private static SerializedObject targetProfile;
23+
private static BaseProfile currentlySelectedProfile;
24+
private static BaseProfile profileSource;
25+
26+
/// <summary>
27+
/// The <see cref="Guid"/> string representation for this profile asset.
28+
/// </summary>
29+
protected string ThisProfileGuidString { get; private set; }
30+
31+
/// <summary>
32+
/// The instanced reference of the currently rendered <see cref="BaseProfile"/>.
33+
/// </summary>
34+
protected BaseProfile ThisProfile { get; private set; }
35+
36+
private bool isOverrideHeader = false;
37+
38+
protected virtual void OnEnable()
39+
{
40+
targetProfile = serializedObject;
41+
42+
currentlySelectedProfile = target as BaseProfile;
43+
Debug.Assert(!currentlySelectedProfile.IsNull());
44+
ThisProfile = currentlySelectedProfile;
45+
AssetDatabase.TryGetGUIDAndLocalFileIdentifier(ThisProfile, out var guidHex, out long _);
46+
ThisProfileGuidString = guidHex;
47+
}
48+
49+
public override void OnInspectorGUI()
50+
{
51+
RenderHeader();
52+
DrawDefaultInspector();
53+
}
54+
55+
protected void RenderHeader(string infoBoxText = "", Texture2D image = null)
56+
{
57+
if (!image.IsNull() ||
58+
!string.IsNullOrWhiteSpace(infoBoxText))
59+
{
60+
isOverrideHeader = true;
61+
}
62+
else
63+
{
64+
if (isOverrideHeader) { return; }
65+
}
66+
67+
if (image.IsNull())
68+
{
69+
ServiceFrameworkInspectorUtility.RenderMixedRealityToolkitLogo();
70+
}
71+
else
72+
{
73+
ServiceFrameworkInspectorUtility.RenderInspectorHeader(image);
74+
}
75+
76+
if (!ThisProfile.ParentProfile.IsNull() &&
77+
GUILayout.Button("Back to parent profile"))
78+
{
79+
Selection.activeObject = ThisProfile.ParentProfile;
80+
}
81+
82+
EditorGUILayout.Space();
83+
EditorGUILayout.LabelField($"{ThisProfile.name.ToProperCase()} Settings", EditorStyles.boldLabel);
84+
85+
if (isOverrideHeader)
86+
{
87+
EditorGUILayout.HelpBox(infoBoxText, MessageType.Info);
88+
}
89+
90+
EditorGUILayout.Space();
91+
}
92+
93+
[MenuItem("CONTEXT/BaseProfile/Create Clone from Profile Values", false, 0)]
94+
protected static void CreateCloneProfile()
95+
{
96+
profileSource = currentlySelectedProfile;
97+
var newProfile = CreateInstance(currentlySelectedProfile.GetType().ToString());
98+
currentlySelectedProfile = newProfile.CreateAsset() as BaseProfile;
99+
Debug.Assert(!currentlySelectedProfile.IsNull());
100+
101+
//await new WaitUntil(() => profileSource != currentlySelectedProfile);
102+
103+
Selection.activeObject = null;
104+
PasteProfileValues();
105+
Selection.activeObject = currentlySelectedProfile;
106+
EditorGUIUtility.PingObject(currentlySelectedProfile);
107+
}
108+
109+
[MenuItem("CONTEXT/BaseProfile/Copy Profile Values", false, 1)]
110+
private static void CopyProfileValues()
111+
{
112+
profileSource = currentlySelectedProfile;
113+
}
114+
115+
[MenuItem("CONTEXT/BaseProfile/Paste Profile Values", true)]
116+
private static bool PasteProfileValuesValidation()
117+
{
118+
return !currentlySelectedProfile.IsNull() &&
119+
targetProfile != null &&
120+
!profileSource.IsNull() &&
121+
currentlySelectedProfile.GetType() == profileSource.GetType();
122+
}
123+
124+
[MenuItem("CONTEXT/BaseProfile/Paste Profile Values", false, 2)]
125+
private static void PasteProfileValues()
126+
{
127+
currentlySelectedProfile.CopySerializedValues(profileSource);
128+
}
129+
}
130+
}

Editor/BaseProfileInspector.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/ConfigurationProperty.cs

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright (c) Reality Collective. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using RealityToolkit.ServiceFramework.Definitions;
5+
using System;
6+
using UnityEditor;
7+
8+
namespace RealityToolkit.ServiceFramework.Editor
9+
{
10+
internal class ConfigurationProperty
11+
{
12+
private readonly SerializedProperty configuration;
13+
14+
public bool IsExpanded
15+
{
16+
get => configuration.isExpanded;
17+
set => configuration.isExpanded = value;
18+
}
19+
20+
private readonly SerializedProperty name;
21+
22+
public string Name
23+
{
24+
get => name.stringValue;
25+
set => name.stringValue = value;
26+
}
27+
28+
private readonly SerializedProperty priority;
29+
30+
public uint Priority
31+
{
32+
get => (uint)priority.intValue;
33+
set => priority.intValue = (int)value;
34+
}
35+
36+
private readonly SerializedProperty instancedType;
37+
private readonly SerializedProperty reference;
38+
39+
public Type InstancedType
40+
{
41+
get => new SystemType(instancedType);
42+
set => reference.stringValue = value == null ? string.Empty : value.GUID.ToString();
43+
}
44+
45+
private readonly SerializedProperty platformEntries;
46+
private readonly SerializedProperty runtimePlatforms;
47+
48+
private readonly SerializedProperty profile;
49+
50+
public UnityEngine.Object Profile
51+
{
52+
get => profile.objectReferenceValue;
53+
set => profile.objectReferenceValue = value;
54+
}
55+
56+
public ConfigurationProperty(SerializedProperty property, bool clearPlatforms = false)
57+
{
58+
configuration = property;
59+
name = property.FindPropertyRelative(nameof(name));
60+
priority = property.FindPropertyRelative(nameof(priority));
61+
instancedType = property.FindPropertyRelative(nameof(instancedType));
62+
reference = instancedType.FindPropertyRelative(nameof(reference));
63+
platformEntries = property.FindPropertyRelative(nameof(platformEntries));
64+
runtimePlatforms = platformEntries.FindPropertyRelative(nameof(runtimePlatforms));
65+
66+
if (clearPlatforms)
67+
{
68+
runtimePlatforms.ClearArray();
69+
}
70+
71+
profile = property.FindPropertyRelative(nameof(profile));
72+
}
73+
74+
public void ApplyModifiedProperties()
75+
{
76+
configuration.serializedObject.ApplyModifiedProperties();
77+
}
78+
}
79+
}

Editor/ConfigurationProperty.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Extensions.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)