Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #115 from bhaptics/FixAARandEditor
Browse files Browse the repository at this point in the history
Fix AAR and editor
  • Loading branch information
second141 authored Mar 3, 2020
2 parents c14bc34 + cbf3da8 commit ae8f684
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## bHaptics Haptic Library (C++ STL)
* Current version is 1.4.12
* Current version is 1.4.13

## Prerequisite
* bHaptics Player has to be installed (Windows)
Expand Down
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

This file was deleted.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified samples/unity-plugin/Assets/bHapticsManager/README.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ public class TactSourceEditor : Editor
{
private string[] _feedbackDescOptions;
private int _selectedFeedbackIndex;
public bool _dataChanged = false;



public override void OnInspectorGUI()
{
// DrawDefaultInspector();
serializedObject.Update();


EditorGUI.BeginChangeCheck();

FeedbackTypeUi();

var feedbackTypeProperty = serializedObject.FindProperty("FeedbackType");
Expand All @@ -25,25 +30,35 @@ public override void OnInspectorGUI()
PositionUi();
PathPointUi();
TimeMillisUi();
break;
break;
case "DotMode":
PositionUi();
DotPointUi();
TimeMillisUi();
break;
break;
case "TactFile":
TactFileUi();
break;
}

PlayUi();
serializedObject.ApplyModifiedProperties();

if (EditorGUI.EndChangeCheck())
{
var tactSourceEditors = Resources.FindObjectsOfTypeAll<TactSourceEditor>();
for (int i = 0; i < tactSourceEditors.Length; ++i)
{
tactSourceEditors[i]._dataChanged = true;
}
}
}

private void TactFileUi()
{
if (_feedbackDescOptions == null)
if (_feedbackDescOptions == null || _dataChanged)
{
_dataChanged = false;
var key = serializedObject.FindProperty("FeedbackFile.Id").stringValue;

var length = TactFileAsset.Instance.FeedbackFiles.Length;
Expand Down Expand Up @@ -100,15 +115,15 @@ private void TactFileUi()

GUILayout.EndHorizontal();

if (_selectedFeedbackIndex >= 0 &&
(serializedObject.FindProperty("FeedbackFile.Type").stringValue == BhapticsUtils.TypeVest ||
if (_selectedFeedbackIndex >= 0 &&
(serializedObject.FindProperty("FeedbackFile.Type").stringValue == BhapticsUtils.TypeVest ||
serializedObject.FindProperty("FeedbackFile.Type").stringValue == BhapticsUtils.TypeTactot))
{
GUILayout.BeginHorizontal();
EditorGUIUtility.labelWidth = 120f;
EditorGUILayout.PropertyField(serializedObject.FindProperty("TactFileOffsetX"),
EditorGUILayout.PropertyField(serializedObject.FindProperty("TactFileOffsetX"),
new GUIContent("Tact File Angle (X)"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("TactFileOffsetY"),
EditorGUILayout.PropertyField(serializedObject.FindProperty("TactFileOffsetY"),
new GUIContent("Tact File Offset (Y)"));
GUILayout.EndHorizontal();
}
Expand Down Expand Up @@ -146,7 +161,7 @@ private void PlayUi()
return;
}
GUILayout.BeginHorizontal();
var source = (TactSource) serializedObject.targetObject;
var source = (TactSource)serializedObject.targetObject;
if (GUILayout.Button("Play"))
{
source.Play();
Expand Down Expand Up @@ -176,10 +191,10 @@ private void DotPointUi()
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
}

EditorGUIUtility.labelWidth = 20f;
SerializedProperty property = dotPoints.GetArrayElementAtIndex(index);

property.intValue = Mathf.Min(100, Mathf.Max(0, property.intValue));
EditorGUILayout.PropertyField(property, new GUIContent("" + (index + 1)));
}
Expand All @@ -200,7 +215,7 @@ private void PathPointUi()
points.GetArrayElementAtIndex(inserted).FindPropertyRelative("Intensity").intValue = 100;
}
GUILayout.EndHorizontal();


for (var index = 0; index < points.arraySize; index++)
{
Expand Down
Binary file modified samples/unity-plugin/ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion samples/unity-plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity plugin
* This project will help integrate bHaptics' haptic devices into Unity environments.
* Current version is 1.4.12
* Current version is 1.4.13

## 1. Prerequisite (Only for Windows)
### The bHaptics Player needs to be installed
Expand Down

0 comments on commit ae8f684

Please sign in to comment.