Beispiel #1
0
        //!
        //! calculate the camera positional offset and store in user preferences
        //!
        public void saveCameraOffset()
        {
            switch (currentCameraView)
            {
            case View.PERSP:
                // nothing
                break;

            case View.TOP:
                VPETSettings.Instance.cameraOffsetTop = Camera.main.transform.position - new Vector3(-15f, 10f, 5f);
                break;

            case View.FRONT:
                VPETSettings.Instance.cameraOffsetFront = Camera.main.transform.position - new Vector3(-15f, 5f, 14f);
                break;

            case View.RIGHT:
                VPETSettings.Instance.cameraOffsetRight = Camera.main.transform.position - new Vector3(-22.9f, 5f, 4.7f);
                break;

            case View.LEFT:
                VPETSettings.Instance.cameraOffsetLeft = Camera.main.transform.position - new Vector3(-7.4f, 5f, 4.7f);
                break;

            case View.BOTTOM:
                VPETSettings.Instance.cameraOffsetLeft = Camera.main.transform.position - new Vector3(-15f, -1.88f, 2.24f);
                break;
            }

            VPETSettings.mapValuesToPreferences();
        }
Beispiel #2
0
        public ConfigWidget drawConfigWidget()
        {
            //if user clicks on config icon while in AR setup, accept setup (same as ok button)
            acceptARConfig();
            mainController.deselect();

            // get radial menu
            // get ProgressWidget
            GameObject radialrefObject = GameObject.Find("GUI/Canvas/ProgressWidget");

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

            // copy values from global settings to config widget TODO: load it directly, see next line
            VPETSettings.mapValuesToObject(configWidget);

            // map values from preferences to config widget
            VPETSettings.mapValuesFromPreferences(configWidget);

            configWidget.Show();

            configWidget.initConfigWidget();
            UI.OnUIChanged.Invoke();
            return(configWidget);
        }
Beispiel #3
0
        private void splashFinished()
        {
            // draw main menu
            ui.drawMainMenuButton(true);

            // set values in config widget according to vpet setting
            ConfigWidget configWidget = ui.drawConfigWidget();

            VPETSettings.mapValuesToObject(configWidget);
            configWidget.initConfigWidget();
        }
Beispiel #4
0
        public void hideConfigWidget()
        {
            // must be first
            configWidget.Hide();

            // copy values from config widget to global settings
            VPETSettings.mapValuesFromObject(configWidget);

            // save global settings in preferences
            VPETSettings.mapValuesToPreferences();
        }
Beispiel #5
0
        public void hideConfigWidget()
        {
            // must be first
            configWidget.Hide();

            // copy values from config widget to global settings TODO: obsolete!?
            VPETSettings.mapValuesFromObject(configWidget);

            // save global settings in preferences TODO: save it directly, see next line
            VPETSettings.mapValuesToPreferences();

            // save config widget settings to prferences
            VPETSettings.mapValuesToPreferences(configWidget);

            UI.OnUIChanged.Invoke();
        }
Beispiel #6
0
        public void acceptKeyConfig()
        {
            GameObject arKeyWidget = GameObject.Find("GUI/Canvas/ARKeyWidget");

            GameObject.Find("GUI/Canvas/ARColorPlane").SetActive(false);
            arKeyWidget.SetActive(false);
            // save values to preferences
            VPETSettings.mapValuesToPreferences(configWidget);
            drawConfigWidget();
            arKeyVideoPlane.SetActive(false);
            //reset chroma keying settings
#if USE_AR
            mainController.ToggleARMatteMode(configWidget.mattModeOn);
            mainController.ToggleARKeyMode(configWidget.keyModeOn);
#endif
        }
Beispiel #7
0
        public ConfigWidget drawConfigWidget()
        {
            // get radial menu
            // get ProgressWidget
            GameObject radialrefObject = GameObject.Find("GUI/Canvas/ProgressWidget");

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

            // copy values from global settings to config widget
            VPETSettings.mapValuesToObject(configWidget);

            configWidget.Show();
            configWidget.initConfigWidget();

            return(configWidget);
        }
Beispiel #8
0
        private void splashFinished()
        {
            // draw main menu
            ui.drawMainMenuButton(true);



            /*
             * // HACK to invoke
             * MenuButton configButton = GameObject.Find("GUI/Canvas/UI/mainMenuObject/3_GeneralMenu_Settings_sel").GetComponent<MenuButton>();
             * configButton.onClick.Invoke();
             * configButton.Toggled = true;
             */



            // set values in config widget according to vpet setting
            ConfigWidget configWidget = ui.drawConfigWidget();

            VPETSettings.mapValuesToObject(configWidget);
            configWidget.initConfigWidget();
        }
        //!
        //! Use this for pre initialization
        //!
        void Awake()
        {
            // read settings from inspector values
            VPETSettings.mapValuesFromObject(this);

            // read settings from config file if wanted
            if (!ignoreConfig)
            {
                string filePath = Application.dataPath + "/VPET/editing_tool.cfg";
                if (!File.Exists(filePath))
                {
                    filePath = Application.persistentDataPath + "/editing_tool.cfg";
                }

                VPETSettings.mapValuesFromConfigFile(filePath);
            }

            // read settings from user preferences
            VPETSettings.mapValuesFromPreferences();


            // check if scene dump file available
            if (Directory.Exists(Application.dataPath + "/Resources/VPET/SceneDumps"))
            {
                VPETSettings.Instance.sceneDumpFolderEmpty = (Directory.GetFiles(Application.dataPath + "/Resources/VPET/SceneDumps", "*.bytes").Length == 0);
                // print("PETSettings.Instance.sceneDumpFolderEmpty " + VPETSettings.Instance.sceneDumpFolderEmpty);
            }

            VPETSettings.Instance.sceneDumpFolderEmpty = false;


            // get all adapters and add them if missing
            //
            // get scene adapter
            GameObject refObject = GameObject.Find("SceneAdapter");

            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("SceneAdapter");
            }
            sceneAdapter = refObject.GetComponent <SceneLoader>();
            if (sceneAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Component found. Create", this.GetType()));
                sceneAdapter = refObject.AddComponent <SceneLoader>();
            }

            // get server adapter
            refObject = GameObject.Find("ServerAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("ServerAdapter");
            }
            serverAdapter = refObject.GetComponent <ServerAdapter>();
            if (serverAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Component found. Create", this.GetType()));
                serverAdapter = refObject.AddComponent <ServerAdapter>();
            }

            // set properties
            serverAdapter.SceneLoader = sceneAdapter;

            // get animation adapter
            refObject = GameObject.Find("AnimationController");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Object found. Create.", this.GetType()));
                refObject = new GameObject("AnimationAdapter");
            }
            animationController = refObject.GetComponent <AnimationController>();
            if (animationController == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Component found. Create", this.GetType()));
                animationController = refObject.AddComponent <AnimationController>();
            }


            // get JoystickAdapter adapter
            refObject = GameObject.Find("JoystickAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("JoystickAdapter");
            }
            joystickAdapter = refObject.GetComponent <JoystickInput>();
            if (joystickAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Component found. Create", this.GetType()));
                joystickAdapter = refObject.AddComponent <JoystickInput>();
            }


            // get InputAdapter adapter
            refObject = GameObject.Find("InputAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("InputAdapter");
            }
            inputAdapter = refObject.GetComponent <InputAdapter>();
            if (inputAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Component found. Create", this.GetType()));
                inputAdapter = refObject.AddComponent <InputAdapter>();
            }
            // inputAdapter.MainController = this;


            // get ui adapter
            refObject = GameObject.Find("GUI/Canvas/UI");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No GUI/Canvas/UI Object found. Create.", this.GetType()));
                refObject = new GameObject("UI");
                GameObject refParent = GameObject.Find("GUI/Canvas");
                refObject.transform.SetParent(refParent.transform, false);
            }
            ui = refObject.GetComponent <UI>();
            if (ui == null)
            {
                Debug.LogWarning(string.Format("{0}: No UI Component found. Create", this.GetType()));
                ui = refObject.AddComponent <UI>();
            }

            // get move camera component camera Adapter
            cameraAdapter = Camera.main.GetComponent <MoveCamera>();
            if (cameraAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No CameraAdapter Component found. Create", this.GetType()));
                cameraAdapter = Camera.main.gameObject.AddComponent <MoveCamera>();
            }

#if USE_TANGO
            GameObject tangoObject = GameObject.Find("Tango Manager");
            if (tangoObject)
            {
                tangoApplication = tangoObject.GetComponent <Tango.TangoApplication>();
            }
#endif
        }
Beispiel #10
0
        //!
        //! Use this for pre initialization
        //!
        void Awake()
        {
            QualitySettings.vSyncCount  = 0;
            Application.targetFrameRate = 30;
            Resolution res = Screen.currentResolution;

            //Screen.SetResolution(res.width/2, res.height/2, true);

            // read settings from inspector values
            VPETSettings.mapValuesFromObject(this);

            // read settings from config file if wanted
            if (!ignoreConfig)
            {
                string filePath = Application.dataPath + "/VPET/editing_tool.cfg";
                if (!File.Exists(filePath))
                {
                    filePath = Application.persistentDataPath + "/editing_tool.cfg";
                }

                VPETSettings.mapValuesFromConfigFile(filePath);
            }

            // read settings from user preferences
            VPETSettings.mapValuesFromPreferences();


            // check if scene dump file available
            if (Directory.Exists(Application.dataPath + "/Resources/VPET/SceneDumps"))
            {
                VPETSettings.Instance.sceneDumpFolderEmpty = (Directory.GetFiles(Application.dataPath + "/Resources/VPET/SceneDumps", "*.bytes").Length == 0);
                // print("PETSettings.Instance.sceneDumpFolderEmpty " + VPETSettings.Instance.sceneDumpFolderEmpty);
            }

            VPETSettings.Instance.sceneDumpFolderEmpty = false;

            // Register plugins
            VPETRegister.RegisterNodeParser();
            VPETRegister.RegisterNodeBuilder();
            VPETRegister.RegisterObjectSender();

            // get all adapters and add them if missing
            //
            // get scene adapter
            GameObject refObject = GameObject.Find("SceneAdapter");

            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("SceneAdapter");
            }
            sceneAdapter = refObject.GetComponent <SceneLoader>();
            if (sceneAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Component found. Create", this.GetType()));
                sceneAdapter = refObject.AddComponent <SceneLoader>();
            }

            // get server adapter
            refObject = GameObject.Find("ServerAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("ServerAdapter");
            }
            serverAdapter = refObject.GetComponent <ServerAdapter>();
            if (serverAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Component found. Create", this.GetType()));
                serverAdapter = refObject.AddComponent <ServerAdapter>();
            }

            // copy cache name to settings
            VPETSettings.Instance.sceneFileName = serverAdapter.sceneFileName;

            // set properties
            serverAdapter.SceneLoader = sceneAdapter;

            // get animation adapter
            refObject = GameObject.Find("AnimationController");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Object found. Create.", this.GetType()));
                refObject = new GameObject("AnimationAdapter");
            }
            animationController = refObject.GetComponent <AnimationController>();
            if (animationController == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Component found. Create", this.GetType()));
                animationController = refObject.AddComponent <AnimationController>();
            }


            // get JoystickAdapter adapter
            refObject = GameObject.Find("JoystickAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("JoystickAdapter");
            }

#if !SCENE_HOST
            joystickAdapter = refObject.GetComponent <JoystickInput>();
            if (joystickAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Component found. Create", this.GetType()));
                joystickAdapter = refObject.AddComponent <JoystickInput>();
            }
#endif

            // get InputAdapter adapter
            refObject = GameObject.Find("InputAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("InputAdapter");
            }
            inputAdapter = refObject.GetComponent <InputAdapter>();
            if (inputAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Component found. Create", this.GetType()));
                inputAdapter = refObject.AddComponent <InputAdapter>();
            }
            // inputAdapter.MainController = this;


            // get ui adapter
            refObject = GameObject.Find("GUI/Canvas/UI");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No GUI/Canvas/UI Object found. Create.", this.GetType()));
                refObject = new GameObject("UI");
                GameObject refParent = GameObject.Find("GUI/Canvas");
                refObject.transform.SetParent(refParent.transform, false);
            }
            ui = refObject.GetComponent <UI>();
            if (ui == null)
            {
                Debug.LogWarning(string.Format("{0}: No UI Component found. Create", this.GetType()));
                ui = refObject.AddComponent <UI>();
            }

            // get move camera component camera Adapter
            cameraAdapter = Camera.main.GetComponent <MoveCamera>();
            if (cameraAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No CameraAdapter Component found. Create", this.GetType()));
                cameraAdapter = Camera.main.gameObject.AddComponent <MoveCamera>();
            }
        }