Esempio n. 1
0
        public void SetActivePLane(DeformerPlane plane)
        {
            if (!deformEnabled)
            {
                return;
            }

            if (!deforming)
            {
                if (activePlane)
                {
                    activePlane.gameObject.GetComponent <MeshRenderer>().material.SetColor("_PlaneColor", new Color(128f / 255f, 128f / 255f, 128f / 255f, 0.2f));
                }

                activePlane = plane;
                if (plane != null)
                {
                    Color selectColor = new Color(selectionColor.r, selectionColor.g, selectionColor.b, 0.2f);
                    activePlane.gameObject.GetComponent <MeshRenderer>().material.SetColor("_PlaneColor", selectColor);

                    Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Trigger, true);
                }
                else
                {
                    Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Trigger, false);
                }
            }
        }
Esempio n. 2
0
        // Callback for the NavigationMode buttons.
        public void OnChangeNavigationMode(string buttonName)
        {
            UpdateRadioButtons(buttonName);

            Tooltips.HideAll(VRDevice.SecondaryController);

            if (options.currentNavigationMode != null)
            {
                options.currentNavigationMode.DeInit();
            }

            switch (buttonName)
            {
            case "BiManual": OnNavMode_BiManual(); break;

            case "Teleport": OnNavMode_Teleport(); break;

            case "Orbit": OnNavMode_Orbit(); break;

            case "Fps": OnNavMode_Fps(); break;

            case "Drone": OnNavMode_Drone(); break;

            case "Fly": OnNavMode_Fly(); break;

            default: Debug.LogError("Unknown navigation mode button name was passed."); break;
            }
            HandleCommonTooltipsVisibility();

            // TODO Scriptable: trouver qui accede a ca
            //GlobalState.currentNavigationMode = currentNavigationMode;
        }
Esempio n. 3
0
 public void OnSetPick()
 {
     colorOp = ColorOp.Pick;
     colorizeButton.Checked        = false;
     pickButton.Checked            = true;
     updateSelectionButton.Checked = false;
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Trigger, Tooltips.Action.Push, "Pick Material");
 }
Esempio n. 4
0
 public override void SetTooltips()
 {
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Primary, Tooltips.Action.Push, "Pick Material");
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Joystick, Tooltips.Action.HoldHorizontal, "Brush Size");
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Trigger, false);
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Grip, false);
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Secondary, false);
 }
Esempio n. 5
0
 public override void SetTooltips()
 {
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Trigger, Tooltips.Action.HoldPush, "Draw");
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Secondary, Tooltips.Action.Push, "Switch Tool");
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Joystick, Tooltips.Action.HoldHorizontal, "Brush Size");
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Primary, false);
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Grip, false);
     // TODOGRASS: tooltips for Grass.
 }
Esempio n. 6
0
 public void OnSetUpdateSelection()
 {
     colorOp = ColorOp.UpdateSelection;
     colorizeButton.Checked        = false;
     pickButton.Checked            = false;
     updateSelectionButton.Checked = true;
     Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Trigger, Tooltips.Action.Push, "Select Object");
     UpdateMaterial();
 }
Esempio n. 7
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);

            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Joystick, "Move Turn");
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Grip, Tooltips.Action.HoldPush, "Grip World");

            usedControls = UsedControls.LEFT_GRIP | UsedControls.LEFT_JOYSTICK;
        }
Esempio n. 8
0
        public static void SetRightHanded(bool value)
        {
            if (null != Instance.secondaryControllerDisplay && Settings.rightHanded == value)
            {
                return;
            }

            Settings.rightHanded = value;

            GameObject leftHandleRightController = Instance.paletteController.Find("right_controller").gameObject;
            GameObject leftHandleLeftController  = Instance.paletteController.Find("left_controller").gameObject;

            GameObject rightHandleRightController = Instance.toolsController.Find("right_controller").gameObject;
            GameObject rightHandleLeftController  = Instance.toolsController.Find("left_controller").gameObject;

            leftHandleLeftController.SetActive(value);
            leftHandleRightController.SetActive(!value);
            rightHandleRightController.SetActive(value);
            rightHandleLeftController.SetActive(!value);

            // Update controller's displays
            Instance.primaryControllerDisplay        = GetPrimaryControllerTransform().Find("Canvas/Text").GetComponent <TextMeshProUGUI>();
            Instance.secondaryControllerDisplay      = GetSecondaryControllerTransform().Find("Canvas/Text").GetComponent <TextMeshProUGUI>();
            Instance.secondaryControllerDisplay.text = "";
            Instance.primaryControllerDisplay.text   = "";

            // Update tooltips
            Tooltips.HideAll(VRDevice.PrimaryController);
            Tooltips.HideAll(VRDevice.SecondaryController);
            ToolBase tool = ToolsManager.CurrentTool();

            if (null != tool)
            {
                tool.SetTooltips();
            }
            Instance.playerController.HandleCommonTooltipsVisibility();

            // Move Palette
            Transform palette = Instance.paletteController.Find("PaletteHandle");
            Vector3   currentPalettePosition = palette.localPosition;

            if (Settings.rightHanded)
            {
                palette.localPosition = new Vector3(-0.02f, currentPalettePosition.y, currentPalettePosition.z);
            }
            else
            {
                palette.localPosition = new Vector3(-0.2f, currentPalettePosition.y, currentPalettePosition.z);
            }
        }
Esempio n. 9
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);

            cameraForward = Camera.main.transform.TransformDirection(Vector3.forward).normalized;
            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Joystick, "Altitude / Strafe");

            usedControls = UsedControls.LEFT_JOYSTICK | UsedControls.RIGHT_JOYSTICK;

            Transform drone = parameters.Find("Drone");

            drone.gameObject.SetActive(true);
        }
Esempio n. 10
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);
            controller         = rigTransform.GetComponent <CharacterController>();
            controller.enabled = true;

            cameraForward = Camera.main.transform.TransformDirection(Vector3.forward).normalized;
            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Joystick, "Altitude / Strafe");
            usedControls = UsedControls.LEFT_JOYSTICK | UsedControls.RIGHT_JOYSTICK | UsedControls.RIGHT_PRIMARY;

            Transform fps = parametersTransform.Find("FPS");

            fps.gameObject.SetActive(true);
        }
Esempio n. 11
0
        private void Update()
        {
            // Info on the secondary controller
            if (null != secondaryControllerDisplay)
            {
                string infoText = worldScale < 1f ? $"Scale\n-{1f / worldScale:F2}" : $"Scale\n{worldScale:F2}";
                if (settings.DisplayFPS)
                {
                    UpdateFps();
                    infoText += $"\n\nFPS\n{Fps}";
                }
                secondaryControllerDisplay.text = infoText;
            }

            Tooltips.UpdateOpacity();
        }
Esempio n. 12
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);

            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Joystick, "Target / Turn");

            usedControls = UsedControls.LEFT_JOYSTICK;

            Transform teleportParameters = parameters.Find("Teleport");

            teleportParameters.gameObject.SetActive(true);

            UICheckbox lockHeight = teleportParameters.Find("LockHeight").GetComponent <UICheckbox>();

            lockHeight.Checked = options.lockHeight;
        }
Esempio n. 13
0
        void Start()
        {
            if (!VRInput.TryGetDevices())
            {
                Debug.LogWarning("PlayerController cannot VRInput.TryGetDevices().");
            }

            if (vrCamera == null)
            {
                Debug.LogWarning("Cannot find 'VRCamera' game object");
            }
            if (paletteController == null)
            {
                Debug.LogWarning("Cannot find 'PaletteController' game object");
            }
            if (toolsController == null)
            {
                Debug.LogWarning("Cannot find 'ToolsController' game object");
            }
            if (pivot == null)
            {
                Debug.LogWarning("Cannot find 'Pivot' game object");
            }

            if (ray != null)
            {
                ray.gameObject.SetActive(false);
            }

            if (teleport != null)
            {
                teleport.gameObject.SetActive(false);
            }

            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Trigger, Tooltips.Action.HoldPush, "Open Palette");
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Primary, Tooltips.Action.Push, "Undo");
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Secondary, Tooltips.Action.Push, "Redo");
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Push, "Reset");
            IsInLobby = true;  // hide tooltips

            OnChangeNavigationMode("BiManual");

            rightHanded = world.Find("Avatars");

            StartCoroutine(SendPlayerTransform());
        }
Esempio n. 14
0
        void Start()
        {
            if (!VRInput.TryGetDevices())
            {
                Debug.LogWarning("PlayerController cannot VRInput.TryGetDevices().");
            }

            if (vrCamera == null)
            {
                Debug.LogWarning("Cannot find 'VRCamera' game object");
            }
            if (paletteController == null)
            {
                Debug.LogWarning("Cannot find 'PaletteController' game object");
            }
            if (toolsController == null)
            {
                Debug.LogWarning("Cannot find 'ToolsController' game object");
            }
            if (pivot == null)
            {
                Debug.LogWarning("Cannot find 'Pivot' game object");
            }

            if (ray != null)
            {
                ray.gameObject.SetActive(false);
            }

            if (teleport != null)
            {
                teleport.gameObject.SetActive(false);
            }

            Tooltips.InitSecondaryTooltips();

            IsInLobby = true;  // hide tooltips

            OnChangeNavigationMode("BiManual");

            rightHanded = world.Find("Avatars");

            StartCoroutine(SendPlayerTransform());
        }
Esempio n. 15
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);

            // reset rig rotation
            Vector3   up      = Vector3.up;
            Vector3   right   = Vector3.Cross(up, rig.forward).normalized;
            Vector3   forward = Vector3.Cross(right, Vector3.up).normalized;
            Matrix4x4 m       = new Matrix4x4(right, up, forward, new Vector4(0, 0, 0, 1));

            rig.localRotation = m.rotation;

            lineUI.Show(false);

            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Grip, Tooltips.Action.HoldPush, "Grip World");

            usedControls = UsedControls.LEFT_GRIP | UsedControls.RIGHT_GRIP;
        }
Esempio n. 16
0
        public override void Init(Transform rigTransform, Transform worldTransform, Transform leftHandleTransform, Transform rightHandleTransform, Transform pivotTransform, Transform cameraTransform, Transform parametersTransform)
        {
            base.Init(rigTransform, worldTransform, leftHandleTransform, rightHandleTransform, pivotTransform, cameraTransform, parametersTransform);

            // Create tooltips
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Joystick, "Turn");
            Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Grip, Tooltips.Action.HoldPush, "Grip Object");
            // TODO: find a way to reach the current right_controller (via GlobalState???)

            usedControls = UsedControls.LEFT_GRIP | UsedControls.LEFT_JOYSTICK | UsedControls.RIGHT_JOYSTICK;

            // Activate Panel and set initial slider values.
            Transform orbitPanel = parametersTransform.Find("Orbit");

            if (orbitPanel != null)
            {
                orbitPanel.gameObject.SetActive(true);
                UISlider moveSpeedSlider = orbitPanel.Find("MoveSpeed")?.GetComponent <UISlider>();
                if (moveSpeedSlider != null)
                {
                    moveSpeedSlider.Value = moveSpeed;
                }
                UISlider scaleSpeedSlider = orbitPanel.Find("ScaleSpeed")?.GetComponent <UISlider>();
                if (scaleSpeedSlider)
                {
                    scaleSpeedSlider.Value = scaleSpeed;
                }
                UISlider rotateSpeedSlider = orbitPanel.Find("RotateSpeed")?.GetComponent <UISlider>();
                if (rotateSpeedSlider)
                {
                    rotateSpeedSlider.Value = rotationalSpeed;
                }
            }

            // Activate the ray.
            if (ray != null)
            {
                ray.gameObject.SetActive(true);
                ray.SetDefaultColor(); // TODO: does not seem to work.
            }
        }
Esempio n. 17
0
        public void SetRightHanded(bool value)
        {
            inverseRightController.controllerTransform.gameObject.SetActive(!value);
            inverseLeftController.controllerTransform.gameObject.SetActive(!value);
            rightController.controllerTransform.gameObject.SetActive(value);
            leftController.controllerTransform.gameObject.SetActive(value);

            Transform toolsController   = GlobalState.Instance.toolsController;
            Transform paletteController = GlobalState.Instance.paletteController;


            // Update controller's displays
            rightController.controllerDisplay.text        = "";
            inverseRightController.controllerDisplay.text = "";
            leftController.controllerDisplay.text         = "";
            inverseLeftController.controllerDisplay.text  = "";

            // Update tooltips
            Tooltips.HideAll(VRDevice.PrimaryController);
            Tooltips.HideAll(VRDevice.SecondaryController);
            ToolBase tool = ToolsManager.CurrentTool();

            if (null != tool)
            {
                tool.SetTooltips();
            }
            GlobalState.Instance.playerController.HandleCommonTooltipsVisibility();

            Transform palette = GlobalState.Instance.paletteController.Find("PaletteHandle");

            if (value)
            {
                SetHolders(leftController, rightController, toolsController, paletteController, palette);
            }
            else
            {
                SetHolders(inverseRightController, inverseLeftController, toolsController, paletteController, palette);
            }
        }
Esempio n. 18
0
        public void HandleCommonTooltipsVisibility()
        {
            if (options.currentNavigationMode == null)
            {
                return;
            }

            if (IsCompatibleWithReset(options.currentNavigationMode))
            {
                Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Joystick, Tooltips.Action.Push, "Reset", !isInLobby);
            }
            else
            {
                Tooltips.SetVisible(VRDevice.SecondaryController, Tooltips.Location.Joystick, false);
            }

            if (IsCompatibleWithPalette(options.currentNavigationMode))
            {
                Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Trigger, Tooltips.Action.Push, "Open Palette", !isInLobby);
            }
            else
            {
                Tooltips.SetVisible(VRDevice.SecondaryController, Tooltips.Location.Trigger, false);
            }

            if (IsCompatibleWithUndoRedo(options.currentNavigationMode))
            {
                Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Primary, Tooltips.Action.Push, "Undo", !isInLobby);
                Tooltips.SetText(VRDevice.SecondaryController, Tooltips.Location.Secondary, Tooltips.Action.Push, "Redo", !isInLobby);
            }
            else
            {
                Tooltips.SetVisible(VRDevice.SecondaryController, Tooltips.Location.Primary, false);
                Tooltips.SetVisible(VRDevice.SecondaryController, Tooltips.Location.Secondary, false);
            }
        }
Esempio n. 19
0
        protected override void Awake()
        {
            base.Awake();

            if (!panel)
            {
                Debug.LogWarning("You forgot to give the Camera Panel to the Camera Tool.");
            }
            else
            {
                focalSlider                  = panel.Find("Focal");
                focusSlider                  = panel.Find("Focus");
                apertureSlider               = panel.Find("Aperture");
                enableDepthOfFieldCheckbox   = panel.Find("EnableDepthOfField").gameObject.GetComponent <UICheckbox>();
                showCameraFeedbackCheckbox   = panel.Find("ShowFeedback").gameObject.GetComponent <UICheckbox>();
                feedbackPositionningCheckbox = panel.Find("Feedback").gameObject.GetComponent <UICheckbox>();
                showDopesheetCheckbox        = panel.Find("ShowDopesheet").gameObject.GetComponent <UICheckbox>();
                showShotManagerCheckbox      = panel.Find("ShowShotManager").gameObject.GetComponent <UICheckbox>();
                showCameraPreviewCheckbox    = panel.Find("ShowCameraPreview").gameObject.GetComponent <UICheckbox>();
                showCameraFrustumCheckbox    = panel.Find("ShowFrustum").gameObject.GetComponent <UICheckbox>();
            }

            if (!dopesheetHandle)
            {
                Debug.LogWarning("You forgot to give the Dopesheet to the Camera Tool.");
            }
            else
            {
                //dopesheet = dopesheetHandle.GetComponentInChildren<Dopesheet>();
                dopesheetHandle.localScale = Vector3.zero; // si tous les tools ont une ref sur la dopesheet, qui la cache au demarrage? ToolsUIManager?
                dopesheetHandle.position   = Vector3.zero;
            }

            if (!shotManagerHandle)
            {
                Debug.LogWarning("You forgot to give the Shot Manager to the Camera Tool.");
            }
            else
            {
                shotManagerHandle.localScale = Vector3.zero; // si tous les tools ont une ref sur le shot manager, qui la cache au demarrage? ToolsUIManager?
                shotManagerHandle.position   = Vector3.zero;
            }

            if (!cameraPreviewHandle)
            {
                Debug.LogWarning("You forgot to give the CameraPreview to the Camera Tool.");
            }
            else
            {
                cameraPreviewWindow            = cameraPreviewHandle.GetComponentInChildren <CameraPreviewWindow>();
                cameraPreviewHandle.localScale = Vector3.zero;
                cameraPreviewHandle.position   = Vector3.zero;
            }


            Init();

            // Create tooltips
            SetTooltips();
            Tooltips.SetText(VRDevice.PrimaryController, Tooltips.Location.Joystick, Tooltips.Action.HoldVertical, "Zoom");

            // Camera list
            GlobalState.ObjectAddedEvent.AddListener(OnCameraAdded);
            GlobalState.ObjectRemovedEvent.AddListener(OnCameraRemoved);
            GlobalState.ObjectRenamedEvent.AddListener(OnCameraRenamed);
            SceneManager.clearSceneEvent.AddListener(OnClearScene);
            if (null != cameraList)
            {
                cameraList.ItemClickedEvent += OnSelectCameraItem;
            }
            cameraItemPrefab = Resources.Load <GameObject>("Prefabs/UI/CameraItem");
        }
Esempio n. 20
0
 public override void OnSelectorTriggerExit(Collider other)
 {
     Tooltips.SetVisible(VRDevice.PrimaryController, Tooltips.Location.Grip, false);
 }