AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
DrawOverrideAttribute.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using System.Reflection;
6 using System.Text.RegularExpressions;
7 using UnityEngine;
8 #if UNITY_EDITOR
9 using UnityEditor;
10 #endif
11 
12 namespace HoloToolkit.Unity
13 {
14  // Base class for custom drawing without property drawers - prevents the MRTKEditor from drawing a default property, supplies an alternative
15  public abstract class DrawOverrideAttribute : Attribute
16  {
17 #if UNITY_EDITOR
18  public abstract void DrawEditor(UnityEngine.Object target, FieldInfo field, SerializedProperty property);
19  public abstract void DrawEditor(UnityEngine.Object target, PropertyInfo prop);
20 #endif
21 
22  protected string SplitCamelCase(string str)
23  {
24  if (string.IsNullOrEmpty(str))
25  return string.Empty;
26 
27  char[] a = str.ToCharArray();
28  a[0] = char.ToUpper(a[0]);
29 
30  return Regex.Replace(
31  Regex.Replace(
32  new string(a),
33  @"(\P{Ll})(\P{Ll}\p{Ll})",
34  "$1 $2"
35  ),
36  @"(\p{Ll})(\P{Ll})",
37  "$1 $2"
38  );
39  }
40  }
41 }