void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     ActivateGazePointer(false);
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     ActivateGazePointer(false);             // disable reticle
 }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        WaveVR_InputModuleManager myScript = target as WaveVR_InputModuleManager;

        EditorGUILayout.HelpBox("Select to enable input module.", MessageType.Info);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("EnableInputModule"), true);
        serializedObject.ApplyModifiedProperties();

        if (myScript.EnableInputModule)
        {
            EditorGUILayout.HelpBox("If this checkbox is not selected, it will use system settings, otherwise inspector will popup items which you can define your preferred settings", MessageType.Warning);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("OverrideSystemSettings"), true);
            serializedObject.ApplyModifiedProperties();

            if (myScript.OverrideSystemSettings)
            {
                EditorGUILayout.HelpBox("Choose input module.", MessageType.Info);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomInputModule"), true);
                serializedObject.ApplyModifiedProperties();

                if (myScript.CustomInputModule == WaveVR_EInputModule.Gaze)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Gaze"), true);
                    serializedObject.ApplyModifiedProperties();
                    serializedObject.Update();
                }
                else
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Controller"), true);
                    serializedObject.ApplyModifiedProperties();

                    if (myScript != null && myScript.Controller != null)
                    {
                        if (myScript.Controller.RaycastMode == WaveVR_ControllerInputModule.ERaycastMode.Fixed)
                        {
                            myScript.FixedBeamLength = (float)EditorGUILayout.FloatField("Beam Length", myScript.FixedBeamLength);
                        }
                    }
                    serializedObject.Update();
                }
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty((WaveVR_InputModuleManager)target);
        }
    }
Example #5
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("Gaze"), true);
        serializedObject.ApplyModifiedProperties();
        WaveVR_InputModuleManager myScript = target as WaveVR_InputModuleManager;

        if (myScript != null && myScript.Gaze != null)
        {
            if (myScript.Gaze.EnableGaze)
            {
                myScript.Gaze.BtnControl = EditorGUILayout.Toggle("    BtnControl", myScript.Gaze.BtnControl);
                if (myScript.Gaze.BtnControl)
                {
                    myScript.Gaze.GazeDevice      = (EGazeTriggerDevice)EditorGUILayout.EnumPopup("        Gaze Trigger Device", myScript.Gaze.GazeDevice);
                    myScript.Gaze.ButtonToTrigger = (EGazeTriggerButton)EditorGUILayout.EnumPopup("        Button To Trigger", myScript.Gaze.ButtonToTrigger);
                    myScript.Gaze.WithTimeGaze    = EditorGUILayout.Toggle("        With Time Gaze", myScript.Gaze.WithTimeGaze);
                }
            }
            if (EventSystem.current != null)
            {
                GazeInputModule gim = EventSystem.current.GetComponent <GazeInputModule> ();
                if (gim != null)
                {
                    gim.BtnControl      = myScript.Gaze.BtnControl;
                    gim.GazeDevice      = myScript.Gaze.GazeDevice;
                    gim.ButtonToTrigger = myScript.Gaze.ButtonToTrigger;
                    gim.WithTimeGaze    = myScript.Gaze.WithTimeGaze;
                }
            }
        }
        serializedObject.Update();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("Controller"), true);
        serializedObject.ApplyModifiedProperties();

        if (GUI.changed)
        {
            EditorUtility.SetDirty((WaveVR_InputModuleManager)target);
        }
    }
Example #6
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        WaveVR_InputModuleManager myScript = target as WaveVR_InputModuleManager;

        EditorGUILayout.PropertyField(serializedObject.FindProperty("EnableInputModule"), true);
        EditorGUILayout.HelpBox("Select to enable input module.", MessageType.Info);
        serializedObject.ApplyModifiedProperties();

        if (myScript.EnableInputModule)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("OverrideSystemSettings"), true);
            EditorGUILayout.HelpBox("If this checkbox is not selected, it will use system settings, otherwise inspector will popup items which you can define your preferred settings", MessageType.Warning);
            serializedObject.ApplyModifiedProperties();

            //EditorGUILayout.PropertyField (serializedObject.FindProperty ("AutoGaze"), true);
            //EditorGUILayout.HelpBox ("Select to use Gaze automatically when no connected controller.", MessageType.Info);
            //serializedObject.ApplyModifiedProperties ();

            //EditorGUILayout.PropertyField (serializedObject.FindProperty ("AlwaysShowController"), true);
            //EditorGUILayout.HelpBox ("Whether to show controller when using Gaze input module.", MessageType.Info);
            //serializedObject.ApplyModifiedProperties ();

            if (myScript.OverrideSystemSettings)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomInputModule"), true);
                EditorGUILayout.HelpBox("Choose input module.", MessageType.Info);
                serializedObject.ApplyModifiedProperties();

                if (myScript.CustomInputModule == WaveVR_EInputModule.Gaze)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Gaze"), true);
                    serializedObject.ApplyModifiedProperties();

                    if (myScript != null && myScript.Gaze != null)
                    {
                        myScript.Gaze.BtnControl = EditorGUILayout.Toggle("    BtnControl", myScript.Gaze.BtnControl);
                        if (myScript.Gaze.BtnControl)
                        {
                            myScript.Gaze.GazeDevice      = (EGazeTriggerDevice)EditorGUILayout.EnumPopup("        Gaze Trigger Device", myScript.Gaze.GazeDevice);
                            myScript.Gaze.ButtonToTrigger = (EGazeTriggerButton)EditorGUILayout.EnumPopup("        Button To Trigger", myScript.Gaze.ButtonToTrigger);
                            myScript.Gaze.WithTimeGaze    = EditorGUILayout.Toggle("        With Time Gaze", myScript.Gaze.WithTimeGaze);
                        }

                        if (EventSystem.current != null)
                        {
                            GazeInputModule gim = EventSystem.current.GetComponent <GazeInputModule> ();
                            if (gim != null)
                            {
                                gim.BtnControl      = myScript.Gaze.BtnControl;
                                gim.GazeDevice      = myScript.Gaze.GazeDevice;
                                gim.ButtonToTrigger = myScript.Gaze.ButtonToTrigger;
                                gim.SetWithTimeGaze(myScript.Gaze.WithTimeGaze);
                            }
                        }
                    }
                    serializedObject.Update();
                }
                else
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Controller"), true);
                    serializedObject.ApplyModifiedProperties();

                    if (myScript != null && myScript.Controller != null)
                    {
                        if (myScript.Controller.RaycastMode == ERaycastMode.Fixed)
                        {
                            myScript.FixedBeamLength = (float)EditorGUILayout.FloatField("Beam Length", myScript.FixedBeamLength);
                        }
                    }
                    serializedObject.Update();
                }
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty((WaveVR_InputModuleManager)target);
        }
    }