Added Unity subnamespace
All checks were successful
Copy Documentation to webserver / copy-documentation (push) Successful in 28s
All checks were successful
Copy Documentation to webserver / copy-documentation (push) Successful in 28s
This commit is contained in:
parent
931c98b065
commit
ce1ff796b8
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
public class ClusterPickerWindow : EditorWindow {
|
public class ClusterPickerWindow : EditorWindow {
|
||||||
private Vector2 scroll;
|
private Vector2 scroll;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using UnityEditor.UIElements;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
[CustomEditor(typeof(Brain))]
|
[CustomEditor(typeof(Brain))]
|
||||||
public class Brain_Editor : Editor {
|
public class Brain_Editor : Editor {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
[CustomEditor(typeof(ClusterPrefab))]
|
[CustomEditor(typeof(ClusterPrefab))]
|
||||||
public class ClusterEditor : ClusterViewer {
|
public class ClusterEditor : ClusterViewer {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
public class ClusterViewer : Editor {
|
public class ClusterViewer : Editor {
|
||||||
|
|
||||||
|
|||||||
@ -3,76 +3,73 @@ using UnityEditor;
|
|||||||
using UnityEditor.Build;
|
using UnityEditor.Build;
|
||||||
using UnityEditor.Callbacks;
|
using UnityEditor.Callbacks;
|
||||||
|
|
||||||
class ConfigurationChecker {
|
namespace Passer {
|
||||||
|
|
||||||
[DidReloadScripts]
|
class ConfigurationChecker {
|
||||||
protected static void DidReloadScripts() {
|
|
||||||
CheckUnityMathematics();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CheckUnityMathematics() {
|
[DidReloadScripts]
|
||||||
bool available = isUnityMathematicsAvailable;
|
protected static void DidReloadScripts() {
|
||||||
UpdateDefine(available, "UNITY_MATHEMATICS");
|
CheckUnityMathematics();
|
||||||
return available;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected static void UpdateDefine(bool enabled, string define) {
|
public static bool CheckUnityMathematics() {
|
||||||
if (enabled)
|
bool available = isUnityMathematicsAvailable;
|
||||||
GlobalDefine(define);
|
UpdateDefine(available, "UNITY_MATHEMATICS");
|
||||||
else
|
return available;
|
||||||
GlobalUndefine(define);
|
}
|
||||||
}
|
|
||||||
|
protected static void UpdateDefine(bool enabled, string define) {
|
||||||
|
if (enabled)
|
||||||
|
GlobalDefine(define);
|
||||||
|
else
|
||||||
|
GlobalUndefine(define);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void GlobalDefine(string name) {
|
public static void GlobalDefine(string name) {
|
||||||
// UnityEngine.Debug.Log("Define " + name);
|
// UnityEngine.Debug.Log("Define " + name);
|
||||||
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
|
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||||
NamedBuildTarget namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
|
NamedBuildTarget namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
|
||||||
//string scriptDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
string scriptDefines = PlayerSettings.GetScriptingDefineSymbols(namedBuildTarget);
|
||||||
string scriptDefines = PlayerSettings.GetScriptingDefineSymbols(namedBuildTarget);
|
if (!scriptDefines.Contains(name)) {
|
||||||
if (!scriptDefines.Contains(name)) {
|
string newScriptDefines = scriptDefines + " " + name;
|
||||||
string newScriptDefines = scriptDefines + " " + name;
|
if (EditorUserBuildSettings.selectedBuildTargetGroup != 0)
|
||||||
if (EditorUserBuildSettings.selectedBuildTargetGroup != 0)
|
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, newScriptDefines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GlobalUndefine(string name) {
|
||||||
|
// UnityEngine.Debug.Log("Undefine " + name);
|
||||||
|
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||||
|
NamedBuildTarget namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
|
||||||
|
string scriptDefines = PlayerSettings.GetScriptingDefineSymbols(namedBuildTarget);
|
||||||
|
if (scriptDefines.Contains(name)) {
|
||||||
|
int playMakerIndex = scriptDefines.IndexOf(name);
|
||||||
|
string newScriptDefines = scriptDefines.Remove(playMakerIndex, name.Length);
|
||||||
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, newScriptDefines);
|
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, newScriptDefines);
|
||||||
//PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newScriptDefines);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GlobalUndefine(string name) {
|
|
||||||
// UnityEngine.Debug.Log("Undefine " + name);
|
|
||||||
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
|
|
||||||
NamedBuildTarget namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
|
|
||||||
// string scriptDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
|
||||||
string scriptDefines = PlayerSettings.GetScriptingDefineSymbols(namedBuildTarget);
|
|
||||||
if (scriptDefines.Contains(name)) {
|
|
||||||
int playMakerIndex = scriptDefines.IndexOf(name);
|
|
||||||
string newScriptDefines = scriptDefines.Remove(playMakerIndex, name.Length);
|
|
||||||
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, newScriptDefines);
|
|
||||||
// PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newScriptDefines);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
#region Availability
|
||||||
|
|
||||||
#region Availability
|
#region Packages
|
||||||
|
|
||||||
#region Packages
|
private static bool isUnityMathematicsAvailable {
|
||||||
|
get => DoesTypeExist("Unity.Mathematics.float3");
|
||||||
private static bool isUnityMathematicsAvailable {
|
|
||||||
get => DoesTypeExist("Unity.Mathematics.float3");
|
|
||||||
// {
|
|
||||||
// return DoesTypeExist("Passer.Tracking.HydraBaseStation");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
#endregion Packages
|
|
||||||
|
|
||||||
public static bool DoesTypeExist(string className) {
|
|
||||||
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
||||||
foreach (System.Reflection.Assembly assembly in assemblies) {
|
|
||||||
if (assembly.GetType(className) != null)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
#endregion Packages
|
||||||
|
|
||||||
|
public static bool DoesTypeExist(string className) {
|
||||||
|
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
foreach (System.Reflection.Assembly assembly in assemblies) {
|
||||||
|
if (assembly.GetType(className) != null)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Availability
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Availability
|
}
|
||||||
}
|
|
||||||
@ -5,7 +5,8 @@ using System;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
[CustomPropertyDrawer(typeof(Neuron))]
|
[CustomPropertyDrawer(typeof(Neuron))]
|
||||||
class Neuron_Drawer : PropertyDrawer {
|
class Neuron_Drawer : PropertyDrawer {
|
||||||
public static void Insepctor(SerializedObject serializedObject, string propertyName ) {
|
public static void Insepctor(SerializedObject serializedObject, string propertyName ) {
|
||||||
@ -80,4 +81,5 @@ namespace NanoBrain {
|
|||||||
return en.Current;
|
return en.Current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The NanoBrain Unity Componnent
|
/// The NanoBrain Unity Componnent
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
using static Unity.Mathematics.math;
|
using static Unity.Mathematics.math;
|
||||||
#endif
|
#endif
|
||||||
|
using NanoBrain.Unity;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain {
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NanoBrain {
|
namespace NanoBrain.Unity {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Unity ScriptableObject to implement re-usable Cluster Prefabs
|
/// The Unity ScriptableObject to implement re-usable Cluster Prefabs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user