Skip to content

Commit

Permalink
Merge pull request #23 from stereolabs/RC2.6
Browse files Browse the repository at this point in the history
Rc2.6
  • Loading branch information
nesnes authored Sep 11, 2018
2 parents 0580b07 + 0ac8c03 commit ea8f95d
Show file tree
Hide file tree
Showing 86 changed files with 7,192 additions and 3,937 deletions.
33 changes: 26 additions & 7 deletions ZEDCamera/Assets/ZED/Doc/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
<!------------------------- Release notes ------------------------------------->

### 2.6.0
* **Features/Bug Fixes**:
- Add WindowsMR support through SteamVR Only (Beta).
- Fixed overwriting old mesh textures when Spatial mapping button is used while Save Mesh is checked.
- Forced pasue state to false when stating a scan in case it's been left in a pause state from a previous scan.
- Fixed restart (not) required when changing post-processing settings.
- Fixed repetitve UI error when not using plugin in VR mode in ZEDControllerTracker.cs. [ssue #21 reported on github].


* **Documentation**:
- Full rework of comments in source code.


* **Compatibility**:
- Compatible with ZED SDK 2.5, CUDA 9.0 or 9.2.


### 2.5.0
- **Features**:
* **Features**:
- Add USB Headset detection function in non-play mode.
- Improve tracking status with "Camera not tracked" status if no headset connected and camera tracking is disabled
- Improve tracking status with "Camera not tracked" status if no headset connected and camera tracking is disabled.

- **Examples**:
- Add Drone Shooter example. This example reproduces the ZEDWorld drone demo app.
- Add Movie Screen example. This example reproduces the ZEDWorld movie demo app.
- Add VR Only Plane Detection. Advanced plane detection sample to show how the place the bunny and make collisions.

* **Examples**:
- Add Drone Shooter example. This example reproduces the ZEDWorld drone demo app.
- Add Movie Screen example. This example reproduces the ZEDWorld movie demo app.
- Add VR Only Plane Detection. Advanced plane detection sample to show how the place the bunny and make collisions.


- **Compatibility**:
* **Compatibility**:
- Compatible with ZED SDK 2.5, CUDA 9.0 or 9.2.


Expand Down
81 changes: 43 additions & 38 deletions ZEDCamera/Assets/ZED/Editor/Scripts/ZEDCameraEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@
using UnityEditor;

/// <summary>
/// Custom inspector :Add a button to the ZEDCameraSettingsEditor at the end of the panel ZEDManager
/// Custom editor used by ZEDManager to extend the default panel shown in the Inspector.
/// Adds the camera status boxes, the button on the bottom to open camera settings, and a button to restart the camera when
/// a settings has changed that requires it.
/// </summary>
[CustomEditor(typeof(ZEDManager)), CanEditMultipleObjects]
public class ZEDCameraEditor : Editor
{
/// <summary>
/// Reference to the ZEDManager instance we're editing.
/// </summary>
ZEDManager manager;

//Store copies of ZEDManager's fields to detect changes
//Store copies of ZEDManager's fields to detect changes later with CheckChange().
sl.RESOLUTION resolution;
sl.DEPTH_MODE depthmode;
bool usespatialmemory;
bool usedepthocclusion;
bool usepostprocessing;
bool usedepthocclusion = true;
bool usepostprocessing = true;

bool pendingchange = false;
bool restartneeded = false;


private void OnEnable()
{


manager = (ZEDManager)target;

resolution = manager.resolution;
Expand All @@ -35,14 +38,14 @@ private void OnEnable()

public override void OnInspectorGUI()
{
DrawDefaultInspector();
DrawDefaultInspector(); //Draws what you'd normally see in the inspector in absense of a custom inspector.

if(GUI.changed)
{
pendingchange = CheckChange();
restartneeded = CheckChange();
}

if (Application.isPlaying && manager.IsZEDReady && pendingchange)
if (Application.isPlaying && manager.IsZEDReady && restartneeded) //Checks if we need to restart the camera.
{
GUILayout.Space(10);

Expand All @@ -57,18 +60,16 @@ public override void OnInspectorGUI()

if (GUILayout.Button("Restart Camera"))
{
manager.Reset(); //Reset the ZED
manager.Reset(); //Reset the ZED.

//Reset the fields now that they're synced
//Reset the fields now that they're synced.
resolution = manager.resolution;
depthmode = manager.depthMode;
usespatialmemory = manager.enableSpatialMemory;
usepostprocessing = manager.postProcessing;

pendingchange = false;
restartneeded = false;
}


}

GUIStyle standardStyle = new GUIStyle(EditorStyles.textField);
Expand All @@ -77,53 +78,57 @@ public override void OnInspectorGUI()

GUILayout.Space(10);

//Status window
//Status window.
EditorGUILayout.LabelField("Status", EditorStyles.boldLabel);
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.TextField("SDK Version:", manager.versionZED);
EditorGUILayout.TextField("Engine FPS:", manager.engineFPS);
EditorGUILayout.TextField("Camera FPS:", manager.cameraFPS);

if (manager.IsCameraTracked)
EditorGUILayout.TextField ("Tracking State:", manager.trackingState, standardStyle);
GUIContent sdkversionlabel = new GUIContent("SDK Version:", "Version of the installed ZED SDK.");
EditorGUILayout.TextField(sdkversionlabel, manager.versionZED);

GUIContent enginefpslabel = new GUIContent("Engine FPS:", "How many frames per second the engine is rendering.");
EditorGUILayout.TextField(enginefpslabel, manager.engineFPS);

GUIContent camerafpslabel = new GUIContent("Camera FPS:", "How many images per second are received from the ZED.");
EditorGUILayout.TextField(camerafpslabel, manager.cameraFPS);

GUIContent trackingstatelabel = new GUIContent("Tracking State:", "Whether the ZED's tracking is on, off, or searching (lost position, trying to recover).");
if (manager.IsCameraTracked || !manager.IsZEDReady)
EditorGUILayout.TextField (trackingstatelabel, manager.trackingState, standardStyle);
else
EditorGUILayout.TextField ("Tracking State:", manager.trackingState,errorStyle);

EditorGUILayout.TextField (trackingstatelabel, manager.trackingState,errorStyle);

GUIContent hmdlabel = new GUIContent("HMD Device:", "The connected VR headset, if any.");
if (Application.isPlaying)
EditorGUILayout.TextField ("HMD Device:", manager.HMDDevice);
EditorGUILayout.TextField (hmdlabel, manager.HMDDevice);
else {
//Detect through USB
//Detect devices through USB.
if (sl.ZEDCamera.CheckUSBDeviceConnected(sl.USB_DEVICE.USB_DEVICE_OCULUS))
EditorGUILayout.TextField ("HMD Device:", "Oculus USB Detected");
else if (sl.ZEDCamera.CheckUSBDeviceConnected(sl.USB_DEVICE.USB_DEVICE_OCULUS))
EditorGUILayout.TextField ("HMD Device:", "HTC USB Detected");
EditorGUILayout.TextField (hmdlabel, "Oculus USB Detected");
else if (sl.ZEDCamera.CheckUSBDeviceConnected(sl.USB_DEVICE.USB_DEVICE_HTC))
EditorGUILayout.TextField (hmdlabel, "HTC USB Detected");
else
EditorGUILayout.TextField ("HMD Device:", "-");
EditorGUILayout.TextField (hmdlabel, "-");
}
EditorGUI.EndDisabledGroup();

GUILayout.Space(20);
if (GUILayout.Button("Open Camera Control"))
GUIContent camcontrolbuttonlabel = new GUIContent("Open Camera Control", "Opens a window for adjusting camera settings like brightness, gain/exposure, etc.");
if (GUILayout.Button(camcontrolbuttonlabel))
{
EditorWindow.GetWindow(typeof(ZEDCameraSettingsEditor), false, "ZED Camera").Show();
}



}

/// <summary>
/// Check if something has changed that requires restarting the camera
/// Check if something has changed that requires restarting the camera.
/// Used to know if the Restart Camera button and a prompt to press it should be visible.
/// </summary>
/// <returns></returns>
/// <returns>True if a setting was changed that won't go into effect until a restart. </returns>
private bool CheckChange()
{
if (resolution != manager.resolution ||
depthmode != manager.depthMode ||
usespatialmemory != manager.enableSpatialMemory ||
//usedepthocclusion != manager.depthOcclusion ||
usepostprocessing != manager.postProcessing)
usespatialmemory != manager.enableSpatialMemory)
{
return true;
}
Expand Down
Loading

0 comments on commit ea8f95d

Please sign in to comment.