Tanoda
WorkstationBehaviourEditor.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
10using System.Collections;
11using System.Collections.Generic;
12using UnityEditor;
13using UnityEngine;
14
15namespace Leap.Unity.Examples {
16
17 [CustomEditor(typeof(WorkstationBehaviourExample))]
18 public class WorkstationBehaviourEditor : CustomEditorBase<WorkstationBehaviourExample> {
19
20 public override void OnInspectorGUI() {
21 EditorGUI.BeginDisabledGroup(target.workstationModeTween == null
22 || target.workstationModeTween.targetTransform == null
23 || target.workstationModeTween.startTransform == null
24 || target.workstationModeTween.endTransform == null
25 || Utils.IsObjectPartOfPrefabAsset(target.gameObject));
26
27 EditorGUILayout.BeginHorizontal();
28
29 if (GUILayout.Button(new GUIContent("Open Workstation",
30 "If the workstationModeTween is fully configured, you can "
31 + "press this to set the target transform to the end (open) "
32 + "state."))) {
33 Undo.IncrementCurrentGroup();
34 Undo.SetCurrentGroupName("Open Workstation");
35 Undo.RecordObject(target.workstationModeTween.targetTransform, "Move Target To End");
36 target.workstationModeTween.SetTargetToEnd();
37 }
38
39 if (GUILayout.Button(new GUIContent("Close Workstation",
40 "If the workstationModeTween is fully configured, you can "
41 + "press this button to set the target transform to the start "
42 + "(closed) state."))) {
43 Undo.IncrementCurrentGroup();
44 Undo.SetCurrentGroupName("Close Workstation");
45 Undo.RecordObject(target.workstationModeTween.targetTransform, "Move Target To Start");
46 target.workstationModeTween.SetTargetToStart();
47 }
48
49 EditorGUILayout.EndHorizontal();
50
51 EditorGUI.EndDisabledGroup();
52
53 base.OnInspectorGUI();
54 }
55
56 }
57
58}