Skip to content
Snippets Groups Projects
Commit 4a71adda authored by Alexis Iakovenko's avatar Alexis Iakovenko
Browse files

Import Leap Motion package for Unity

parent f1def449
No related branches found
No related tags found
No related merge requests found
Showing
with 881 additions and 0 deletions
fileFormatVersion: 2
guid: 2618d93cf7ed83a4cb83c036e91a6913
folderAsset: yes
timeCreated: 1511352012
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b47ad6cdcce6f4e43b44253629439e88
folderAsset: yes
timeCreated: 1511351961
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 67cc45ee505a6e642a6899b6f122ee6d
folderAsset: yes
timeCreated: 1511351961
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This Unity Asset is dependent on Leap Motion tracking and the Leap Motion Controller which can be installed from: https://developer.leapmotion.com/
\ No newline at end of file
fileFormatVersion: 2
guid: cb1e08d6c2b9e4e629986b5afb697fdb
timeCreated: 1427392316
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7e2e2d1db3237474f8641afbc91ff899
folderAsset: yes
timeCreated: 1511351961
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using UnityEngine;
using UnityEditor;
namespace Leap.Unity {
public static class CorePreferences {
private const string ALLOW_CLEAR_TRANSFORM_HOTKEY_KEY = "LeapMotion_AllowClearTransformHotkey";
private const string ALLOW_GROUP_OBJECTS_HOTKEY_KEY = "LeapMotion_AllowGroupObjectsHotkey";
public static bool allowClearTransformHotkey {
get {
return EditorPrefs.GetBool(ALLOW_CLEAR_TRANSFORM_HOTKEY_KEY, defaultValue: false);
}
set {
EditorPrefs.SetBool(ALLOW_CLEAR_TRANSFORM_HOTKEY_KEY, value);
}
}
public static bool allowGroupObjectsHotkey {
get {
return EditorPrefs.GetBool(ALLOW_GROUP_OBJECTS_HOTKEY_KEY, defaultValue: false);
}
set {
EditorPrefs.SetBool(ALLOW_GROUP_OBJECTS_HOTKEY_KEY, value);
}
}
[LeapPreferences("Core", 0)]
private static void drawCorePreferences() {
drawPreferencesBool(ALLOW_CLEAR_TRANSFORM_HOTKEY_KEY, "Clear Transforms Hotkey", "When you press Ctrl+E, clear out the local position, rotation, and scale of the selected transforms.");
drawPreferencesBool(ALLOW_GROUP_OBJECTS_HOTKEY_KEY, "Group Transforms Hotkey", "When you press Ctrl+G, group all selected objects underneath a single new object named Group.");
}
private static void drawPreferencesBool(string key, string label, string tooltip) {
GUIContent content = new GUIContent(label, tooltip);
bool value = EditorPrefs.GetBool(key, defaultValue: false);
var newValue = EditorGUILayout.Toggle(content, value);
if (newValue != value) {
EditorPrefs.SetBool(key, newValue);
}
}
}
}
fileFormatVersion: 2
guid: 6659559e2a159ac4cbc8a42ba449dcf6
timeCreated: 1498009954
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using Leap.Unity.Query;
namespace Leap.Unity {
public class CustomEditorBase<T> : CustomEditorBase where T : UnityEngine.Object {
protected new T target;
protected new T[] targets;
protected override void OnEnable() {
base.OnEnable();
target = base.target as T;
targets = base.targets.Query().
Where(t => t != null).
OfType<T>().
ToArray();
}
}
public class CustomEditorBase : Editor {
protected Dictionary<string, Action<SerializedProperty>> _specifiedDrawers;
protected Dictionary<string, List<Action<SerializedProperty>>> _specifiedDecorators;
protected Dictionary<string, List<Action<SerializedProperty>>> _specifiedPostDecorators;
protected Dictionary<string, List<Func<bool>>> _conditionalProperties;
protected List<string> _deferredProperties;
protected bool _showScriptField = true;
private bool _canCallSpecifyFunctions = false;
protected List<SerializedProperty> _modifiedProperties = new List<SerializedProperty>();
protected void dontShowScriptField() {
_showScriptField = false;
}
/// <summary>
/// Specify a callback to be used to draw a specific named property. Should be called in OnEnable.
/// </summary>
/// <param name="propertyName"></param>
/// <param name="propertyDrawer"></param>
protected void specifyCustomDrawer(string propertyName, Action<SerializedProperty> propertyDrawer) {
throwIfNotInOnEnable("specifyCustomDrawer");
if (!validateProperty(propertyName)) {
return;
}
_specifiedDrawers[propertyName] = propertyDrawer;
}
/// <summary>
/// Specify a callback to be used to draw a decorator for a specific named property. Should be called in OnEnable.
/// </summary>
protected void specifyCustomDecorator(string propertyName, Action<SerializedProperty> decoratorDrawer) {
throwIfNotInOnEnable("specifyCustomDecorator");
if (!validateProperty(propertyName)) {
return;
}
List<Action<SerializedProperty>> list;
if (!_specifiedDecorators.TryGetValue(propertyName, out list)) {
list = new List<Action<SerializedProperty>>();
_specifiedDecorators[propertyName] = list;
}
list.Add(decoratorDrawer);
}
/// <summary>
/// Specify a callback to be used to draw a decorator AFTER a specific named property.
///
/// Should be called in OnEnable.
/// </summary>
protected void specifyCustomPostDecorator(string propertyName, Action<SerializedProperty> decoratorDrawer) {
throwIfNotInOnEnable("specifyCustomPostDecorator");
if (!validateProperty(propertyName)) {
return;
}
List<Action<SerializedProperty>> list;
if (!_specifiedPostDecorators.TryGetValue(propertyName, out list)) {
list = new List<Action<SerializedProperty>>();
_specifiedPostDecorators[propertyName] = list;
}
list.Add(decoratorDrawer);
}
/// <summary>
/// Specify a list of properties that should only be displayed if the conditional property has a value of true.
/// Should be called in OnEnable.
/// </summary>
/// <param name="conditionalName"></param>
/// <param name="dependantProperties"></param>
protected void specifyConditionalDrawing(string conditionalName, params string[] dependantProperties) {
throwIfNotInOnEnable("specifyConditionalDrawing");
if (!validateProperty(conditionalName)) {
return;
}
SerializedProperty conditionalProp = serializedObject.FindProperty(conditionalName);
specifyConditionalDrawing(() => {
if (conditionalProp.hasMultipleDifferentValues) {
return false;
} else {
return conditionalProp.boolValue;
}
}, dependantProperties);
}
protected void specifyConditionalDrawing(string enumName, int enumValue, params string[] dependantProperties) {
throwIfNotInOnEnable("specifyConditionalDrawing");
if (!validateProperty(enumName)) {
return;
}
SerializedProperty enumProp = serializedObject.FindProperty(enumName);
specifyConditionalDrawing(() => {
if (enumProp.hasMultipleDifferentValues) {
return false;
} else {
return enumProp.intValue == enumValue;
}
}, dependantProperties);
}
protected void hideField(string propertyName) {
throwIfNotInOnEnable("hideField");
specifyConditionalDrawing(() => false, propertyName);
}
protected void specifyConditionalDrawing(Func<bool> conditional, params string[] dependantProperties) {
throwIfNotInOnEnable("specifyConditionalDrawing");
for (int i = 0; i < dependantProperties.Length; i++) {
string dependant = dependantProperties[i];
if (!validateProperty(dependant)) {
continue;
}
List<Func<bool>> list;
if (!_conditionalProperties.TryGetValue(dependant, out list)) {
list = new List<Func<bool>>();
_conditionalProperties[dependant] = list;
}
list.Add(conditional);
}
}
/// <summary>
/// Defer rendering of a property until the end of the inspector. Deferred properties
/// are drawn in the REVERSE order they are deferred! NOT by the order they appear in the
/// serialized object!
/// </summary>
protected void deferProperty(string propertyName) {
throwIfNotInOnEnable("deferProperty");
if (!validateProperty(propertyName)) {
return;
}
_deferredProperties.Insert(0, propertyName);
}
protected void drawScriptField(bool disable = true) {
var scriptProp = serializedObject.FindProperty("m_Script");
EditorGUI.BeginDisabledGroup(disable);
EditorGUILayout.PropertyField(scriptProp);
EditorGUI.EndDisabledGroup();
}
protected virtual void OnEnable() {
try {
if (serializedObject == null) { }
} catch (NullReferenceException) {
DestroyImmediate(this);
throw new Exception("Cleaning up an editor of type " + GetType() + ". Make sure to always destroy your editors when you are done with them!");
}
_specifiedDrawers = new Dictionary<string, Action<SerializedProperty>>();
_specifiedDecorators = new Dictionary<string, List<Action<SerializedProperty>>>();
_specifiedPostDecorators = new Dictionary<string, List<Action<SerializedProperty>>>();
_conditionalProperties = new Dictionary<string, List<Func<bool>>>();
_deferredProperties = new List<string>();
_canCallSpecifyFunctions = true;
}
protected bool validateProperty(string propertyName) {
if (serializedObject.FindProperty(propertyName) == null) {
Debug.LogWarning("Property " + propertyName + " does not exist, was it removed or renamed?");
return false;
}
return true;
}
/*
* This method draws all visible properties, mirroring the default behavior of OnInspectorGUI.
* Individual properties can be specified to have custom drawers.
*/
public override void OnInspectorGUI() {
_canCallSpecifyFunctions = false;
_modifiedProperties.Clear();
SerializedProperty iterator = serializedObject.GetIterator();
bool isFirst = true;
while (iterator.NextVisible(isFirst)) {
if (isFirst && !_showScriptField) {
isFirst = false;
continue;
}
if (_deferredProperties.Contains(iterator.name)) {
continue;
}
using (new EditorGUI.DisabledGroupScope(isFirst)) {
drawProperty(iterator);
}
isFirst = false;
}
foreach (var deferredProperty in _deferredProperties) {
drawProperty(serializedObject.FindProperty(deferredProperty));
}
serializedObject.ApplyModifiedProperties();
}
private void drawProperty(SerializedProperty property) {
List<Func<bool>> conditionalList;
if (_conditionalProperties.TryGetValue(property.name, out conditionalList)) {
bool allTrue = true;
for (int i = 0; i < conditionalList.Count; i++) {
allTrue &= conditionalList[i]();
}
if (!allTrue) {
return;
}
}
Action<SerializedProperty> customDrawer;
List<Action<SerializedProperty>> decoratorList;
if (_specifiedDecorators.TryGetValue(property.name, out decoratorList)) {
for (int i = 0; i < decoratorList.Count; i++) {
decoratorList[i](property);
}
}
EditorGUI.BeginChangeCheck();
if (_specifiedDrawers.TryGetValue(property.name, out customDrawer)) {
customDrawer(property);
} else {
EditorGUILayout.PropertyField(property, true);
}
if (EditorGUI.EndChangeCheck()) {
_modifiedProperties.Add(property.Copy());
}
List<Action<SerializedProperty>> postDecoratorList;
if (_specifiedPostDecorators.TryGetValue(property.name, out postDecoratorList)) {
for (int i = 0; i < postDecoratorList.Count; i++) {
postDecoratorList[i](property);
}
}
}
private void throwIfNotInOnEnable(string methodName) {
if (!_canCallSpecifyFunctions) {
throw new InvalidOperationException("Cannot call " + methodName + " from within any other function but OnEnable. Make sure you also call base.OnEnable as well!");
}
}
}
}
fileFormatVersion: 2
guid: 5153a3309ec1fdb4fb6d7ebecfc60279
timeCreated: 1459454776
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Leap.Unity {
public class CustomPropertyDrawerBase : PropertyDrawer {
public const float INDENT_AMOUNT = 12;
private List<IDrawable> _drawables;
private SerializedProperty _property;
private string _onGuiSampleName;
private string _getHeightSampleName;
public CustomPropertyDrawerBase() {
_onGuiSampleName = "OnGUI for " + GetType().Name;
_getHeightSampleName = "GetPropertyHeight for " + GetType().Name;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
using (new ProfilerSample(_onGuiSampleName)) {
init(property);
foreach (var drawable in _drawables) {
drawable.Draw(ref position);
}
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
using (new ProfilerSample(_getHeightSampleName)) {
init(property);
float height = 0;
foreach (var drawable in _drawables) {
if (drawable is PropertyContainer) {
height += ((PropertyContainer)drawable).getHeight();
}
}
return height;
}
}
protected virtual void init(SerializedProperty property) {
if (_property == property) {
return;
}
_drawables = new List<IDrawable>();
_property = property;
}
protected void drawPropertyConditionally(string propertyName, string conditionalName, bool includeChildren = true) {
SerializedProperty property, condition;
if (!tryGetProperty(propertyName, out property) || !tryGetProperty(conditionalName, out condition)) {
return;
}
_drawables.Add(new PropertyContainer() {
draw = rect => {
if (condition.boolValue) {
EditorGUI.PropertyField(rect, property, includeChildren);
}
},
getHeight = () => {
return condition.boolValue ? EditorGUI.GetPropertyHeight(property, GUIContent.none, includeChildren) : 0;
}
});
}
protected void drawPropertyConditionally(string propertyName, Func<bool> condition, bool includeChildren = true) {
SerializedProperty property;
if (!tryGetProperty(propertyName, out property)) {
return;
}
_drawables.Add(new PropertyContainer() {
draw = rect => {
if (condition()) {
EditorGUI.PropertyField(rect, property, includeChildren);
}
},
getHeight = () => {
return condition() ? EditorGUI.GetPropertyHeight(property, GUIContent.none, includeChildren) : 0;
}
});
}
protected void drawProperty(string name, bool includeChildren = true, bool disable = false) {
SerializedProperty property;
if (!tryGetProperty(name, out property)) {
return;
}
GUIContent content = new GUIContent(property.displayName, property.tooltip);
_drawables.Add(new PropertyContainer() {
draw = rect => {
EditorGUI.BeginDisabledGroup(disable);
EditorGUI.PropertyField(rect, property, content, includeChildren);
EditorGUI.EndDisabledGroup();
},
getHeight = () => EditorGUI.GetPropertyHeight(property, GUIContent.none, includeChildren)
});
}
protected void drawProperty(string name, Func<string> nameFunc, bool includeChildren = true) {
SerializedProperty property;
if (!tryGetProperty(name, out property)) {
return;
}
GUIContent content = new GUIContent(nameFunc(), property.tooltip);
_drawables.Add(new PropertyContainer() {
draw = rect => {
content.text = nameFunc() ?? property.displayName;
EditorGUI.PropertyField(rect, property, content, includeChildren);
},
getHeight = () => EditorGUI.GetPropertyHeight(property, content, includeChildren)
});
}
protected void drawCustom(Action<Rect> drawFunc, float height) {
_drawables.Add(new PropertyContainer() {
draw = drawFunc,
getHeight = () => height
});
}
protected void drawCustom(Action<Rect> drawFunc, Func<float> heightFunc) {
_drawables.Add(new PropertyContainer() {
draw = drawFunc,
getHeight = heightFunc
});
}
protected void increaseIndent() {
_drawables.Add(new IndentDrawable() {
indent = INDENT_AMOUNT
});
}
protected void decreaseIndent() {
_drawables.Add(new IndentDrawable() {
indent = -INDENT_AMOUNT
});
}
protected bool tryGetProperty(string name, out SerializedProperty property) {
property = _property.FindPropertyRelative(name);
if (property == null) {
Debug.LogWarning("Could not find property " + name + ", was it renamed or removed?");
return false;
} else {
return true;
}
}
protected bool validateProperty(string name) {
if (_property.FindPropertyRelative(name) == null) {
Debug.LogWarning("Could not find property " + name + ", was it renamed or removed?");
return false;
}
return true;
}
private interface IDrawable {
void Draw(ref Rect rect);
}
private struct PropertyContainer : IDrawable {
public Action<Rect> draw;
public Func<float> getHeight;
public void Draw(ref Rect rect) {
rect.height = getHeight();
draw(rect);
rect.y += rect.height;
}
}
private struct IndentDrawable : IDrawable {
public float indent;
public void Draw(ref Rect rect) {
rect.x += indent;
rect.width -= indent;
}
}
}
}
fileFormatVersion: 2
guid: bf0db7f46a29f4745bdcc7d116b80572
timeCreated: 1493751356
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
public static class EmptyFolderUtility {
[MenuItem("Assets/Delete Empty Folders")]
public static void DeleteEmptyFolders() {
string[] directories = Directory.GetDirectories("Assets", "*", SearchOption.AllDirectories);
foreach (var directory in directories) {
try {
if (!Directory.Exists(directory)) {
continue;
}
if (Directory.GetFiles(directory, "*", SearchOption.AllDirectories).Count(p => Path.GetExtension(p) != ".meta") > 0) {
continue;
}
} catch (Exception e) {
Debug.LogException(e);
}
try {
Directory.Delete(directory, recursive: true);
} catch (Exception e) {
Debug.LogError("Could not delete directory " + directory);
Debug.LogException(e);
}
}
AssetDatabase.Refresh();
}
}
fileFormatVersion: 2
guid: 86c4d5fe8c1e52f438fc8663e7d3b46d
timeCreated: 1502479020
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using UnityEditor;
using UnityEngine;
using System.Collections;
using Leap;
namespace Leap.Unity {
[CustomEditor(typeof(LeapHandController))]
public class LeapHandControllerEditor : CustomEditorBase<LeapHandController> {
private const float BOX_RADIUS = 0.45f;
private const float BOX_WIDTH = 0.965f;
private const float BOX_DEPTH = 0.6671f;
public void OnSceneGUI() {
Vector3 origin = target.transform.TransformPoint(Vector3.zero);
Vector3 local_top_left, top_left, local_top_right, top_right,
local_bottom_left, bottom_left, local_bottom_right, bottom_right;
getLocalGlobalPoint(-1, 1, 1, out local_top_left, out top_left);
getLocalGlobalPoint(1, 1, 1, out local_top_right, out top_right);
getLocalGlobalPoint(-1, 1, -1, out local_bottom_left, out bottom_left);
getLocalGlobalPoint(1, 1, -1, out local_bottom_right, out bottom_right);
Handles.DrawLine(origin, top_left);
Handles.DrawLine(origin, top_right);
Handles.DrawLine(origin, bottom_left);
Handles.DrawLine(origin, bottom_right);
drawControllerEdge(origin, local_top_left, local_top_right);
drawControllerEdge(origin, local_bottom_left, local_top_left);
drawControllerEdge(origin, local_bottom_left, local_bottom_right);
drawControllerEdge(origin, local_bottom_right, local_top_right);
drawControllerArc(origin, local_top_left, local_bottom_left, local_top_right, local_bottom_right, -Vector3.forward);
drawControllerArc(origin, local_top_left, local_top_right, local_bottom_left, local_bottom_right, -Vector3.right);
}
private void getLocalGlobalPoint(int x, int y, int z, out Vector3 local, out Vector3 global) {
local = new Vector3(x * BOX_WIDTH, y * BOX_RADIUS, z * BOX_DEPTH);
global = target.transform.TransformPoint(BOX_RADIUS * local.normalized);
}
private void drawControllerEdge(Vector3 origin,
Vector3 edge0, Vector3 edge1) {
Vector3 right_normal = target.transform.TransformDirection(Vector3.Cross(edge0, edge1));
float right_angle = Vector3.Angle(edge0, edge1);
Handles.DrawWireArc(origin, right_normal,
target.transform.TransformDirection(edge0),
right_angle, target.transform.lossyScale.x * BOX_RADIUS);
}
private void drawControllerArc(Vector3 origin,
Vector3 edgeA0, Vector3 edgeA1,
Vector3 edgeB0, Vector3 edgeB1,
Vector3 direction) {
Vector3 faceA = Vector3.Lerp(edgeA0, edgeA1, 0.5f);
Vector3 faceB = Vector3.Lerp(edgeB0, edgeB1, 0.5f);
Vector3 depth_normal = target.transform.TransformDirection(direction);
float angle = Vector3.Angle(faceA, faceB);
Handles.DrawWireArc(origin, depth_normal,
target.transform.TransformDirection(faceA),
angle, target.transform.lossyScale.x * BOX_RADIUS);
}
}
}
fileFormatVersion: 2
guid: e617762d9583845b884c0dce6e2b54a6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using UnityEngine;
using UnityEditor;
namespace Leap.Unity{
[CustomEditor(typeof(LeapImageRetriever))]
public class LeapImageRetrieverEditor : CustomEditorBase<LeapImageRetriever> {
private GUIContent _brightTextureGUIContent;
private GUIContent _rawTextureGUIContent;
private GUIContent _distortionTextureGUIContent;
protected override void OnEnable() {
base.OnEnable();
_brightTextureGUIContent = new GUIContent("Bright Texture");
_rawTextureGUIContent = new GUIContent("Raw Texture");
_distortionTextureGUIContent = new GUIContent("Distortion Texture");
}
public override void OnInspectorGUI() {
base.OnInspectorGUI();
if (Application.isPlaying) {
var data = target.TextureData;
var dataType = typeof(Object);
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField(_brightTextureGUIContent, data.BrightTexture.CombinedTexture, dataType, true);
EditorGUILayout.ObjectField(_rawTextureGUIContent, data.RawTexture.CombinedTexture, dataType, true);
EditorGUILayout.ObjectField(_distortionTextureGUIContent, data.Distortion.CombinedTexture, dataType, true);
EditorGUI.EndDisabledGroup();
}
}
}
}
fileFormatVersion: 2
guid: 489ddbb3e49c3c34f8016d4ea0c4b5d2
timeCreated: 1429813852
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/******************************************************************************
* Copyright (C) Leap Motion, Inc. 2011-2017. *
* Leap Motion proprietary and confidential. *
* *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
******************************************************************************/
using UnityEditor;
namespace Leap.Unity {
[CustomEditor(typeof(LeapServiceProvider))]
public class LeapServiceProviderEditor : CustomEditorBase {
protected override void OnEnable() {
base.OnEnable();
specifyCustomDecorator("_frameOptimization", frameOptimizationWarning);
}
private void frameOptimizationWarning(SerializedProperty property) {
var mode = (LeapServiceProvider.FrameOptimizationMode)property.intValue;
string warningText;
switch (mode) {
case LeapServiceProvider.FrameOptimizationMode.ReuseUpdateForPhysics:
warningText = "Reusing update frames for physics introduces a frame of latency for physics interactions.";
break;
case LeapServiceProvider.FrameOptimizationMode.ReusePhysicsForUpdate:
warningText = "This optimization REQUIRES physics framerate to match your target framerate EXACTLY.";
break;
default:
return;
}
EditorGUILayout.HelpBox(warningText, MessageType.Warning);
}
}
}
fileFormatVersion: 2
guid: 820a690b04c5ed7449f6d0bd3a657f06
timeCreated: 1458765852
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment