public void clickSaveChanges()
        {
            Transform contentPanel = this.transform.Find("Panel").Find("Scroll Rect").Find("Content Panel");
            List<CameraSetting> cameraList = new List<CameraSetting>();

            foreach(Transform cameraSetting in contentPanel)
            {
                CameraSetting item = new CameraSetting();
                Transform panel = cameraSetting.Find("Panel");
                if (panel.Find("ToggleIsActive").GetComponent<Toggle>().isOn)
                {
                    item.id = panel.Find("TextID").GetComponent<Text>().text;
                    item.pitch = float.Parse(panel.Find("IFpitch").GetComponent<InputField>().text);
                    item.yaw = float.Parse(panel.Find("IFYaw").GetComponent<InputField>().text);
                    item.roll = float.Parse(panel.Find("IFRoll").GetComponent<InputField>().text);
                    item.fieldOfView = float.Parse(panel.Find("IFfov").GetComponent<InputField>().text);
                    float posX = float.Parse(panel.Find("IFposX").GetComponent<InputField>().text);
                    float posY = float.Parse(panel.Find("IFposY").GetComponent<InputField>().text);
                    float posZ = float.Parse(panel.Find("IFposZ").GetComponent<InputField>().text);
                    item.position = new Vector3(posX, posY, posZ);
                    cameraList.Add(item);
                }
            }

            CameraVanEdit cameraVan = GameObject.Find("Canvas").transform.Find("CameraVanEdit").GetComponent<CameraVanEdit>();
            cameraVan.cameraList = cameraList;
        }
        public List<CameraSetting> convertBackToCamList(List<SaveCameraSetting> saveCamList)
        {
            List<CameraSetting> camSettingList = new List<CameraSetting>();

            for(int k = 0 ; k < saveCamList.Count ; k++)
            {
                CameraSetting cs = new CameraSetting();
                cs.position = saveCamList[k].position;
                cs.roll = saveCamList[k].roll;
                cs.yaw = saveCamList[k].yaw;
                cs.pitch = saveCamList[k].pitch;
                cs.id = saveCamList[k].id;
                cs.fieldOfView = saveCamList[k].FOV;
                camSettingList.Add(cs);
            }

            return camSettingList;
        }
        public void loadSetting(CameraSetting _camSetting)
        {
            if (rt == null)
            {
                camera = this.GetComponent<Camera>();
                Camera mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
                camera.CopyFrom(mainCamera);

                resolutionWidth = (int)camera.pixelWidth;
                resolutionHeight = (int)camera.pixelHeight;

                rt = new RenderTexture(resolutionWidth, resolutionHeight, 24);
                camera.targetTexture = rt;
            }

            camSetting = _camSetting;
            camera.transform.position = _camSetting.position;
            Quaternion quat = new Quaternion();
            quat.eulerAngles = new Vector3(-_camSetting.pitch,-_camSetting.yaw,-_camSetting.roll);
            camera.transform.localRotation = quat;
            camera.name = _camSetting.id;
            camera.fieldOfView = _camSetting.fieldOfView;
        }
        private void processModeOperations()
        {
            if (fbd.state == myFileBrowserDialog.BrowserState.Processing)
                return;
            else if (fbd.state == myFileBrowserDialog.BrowserState.Cancelled)
            {
                if (carController != null)
                {
                    carController.wheelColliders[0].brakeTorque = 0;
                    carController.wheelColliders[1].brakeTorque = 0;
                }
                cameraMode = CameraMode.None;
                return;
            }
            else
                saveFolder = fbd.selectedPath + "/" + fbd.saveName;

            Debug.Log("Processing Coordinates");
            StartCoroutine(processHelper());

            Directory.CreateDirectory(saveFolder);

            if (cameraList == null)
            {
                recordLog.laserSettings = laserScanner;
                recordLog.laserLog.frameRate = laserScanner.frameRate;
                generateLog(saveFolder);
                cameraMode = CameraMode.GeneratingPCD;
                return;
            }
            else
            {
                recordLog.cameraLog.frameRate = int.Parse(transform.Find("Panel").Find("IFframeRate").GetComponent<InputField>().text);
                recordLog.cameraSettings = new List<CameraSetting>();

                cameraSet = new List<GameObject>();
                cameraSetOrigin = new GameObject();

                for (int c = 0; c < cameraList.Count; c++)
                {
                    CameraSetting cset = new CameraSetting();
                    cset.fieldOfView = cameraList[c].fieldOfView;
                    cset.id = cameraList[c].id;
                    cset.position = cameraList[c].position;
                    cset.pitch = cameraList[c].pitch;
                    cset.yaw = cameraList[c].yaw;
                    cset.roll = cameraList[c].roll;
                    recordLog.cameraSettings.Add(cset);

                    GameObject camObj = new GameObject("Cam" + cameraList[c].id, typeof(Camera), typeof(ControllerCam));
                    ControllerCam camScript = camObj.GetComponent<ControllerCam>();
                    camScript.saveFolder = saveFolder;
                    camScript.loadSetting(cameraList[c]);
                    camObj.transform.SetParent(cameraSetOrigin.transform);
                    Directory.CreateDirectory(saveFolder + "/" + camObj.name);
                    cameraSet.Add(camObj);

                }

            }

            generateLog(saveFolder);
            controllerObject.SetActive(false);
            cameraMode = CameraMode.GeneratingScreenShots;

            stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
        }
Beispiel #5
0
        private void processModeOperations()
        {
            if (fbd.state == myFileBrowserDialog.BrowserState.Processing)
            {
                return;
            }
            else if (fbd.state == myFileBrowserDialog.BrowserState.Cancelled)
            {
                if (carController != null)
                {
                    carController.wheelColliders[0].brakeTorque = 0;
                    carController.wheelColliders[1].brakeTorque = 0;
                }
                cameraMode = CameraMode.None;
                return;
            }
            else
            {
                saveFolder = fbd.selectedPath + "/" + fbd.saveName;
            }

            Debug.Log("Processing Coordinates");
            StartCoroutine(processHelper());

            Directory.CreateDirectory(saveFolder);

            if (cameraList == null)
            {
                recordLog.laserSettings      = laserScanner;
                recordLog.laserLog.frameRate = laserScanner.frameRate;
                generateLog(saveFolder);
                cameraMode = CameraMode.GeneratingPCD;
                return;
            }
            else
            {
                recordLog.cameraLog.frameRate = int.Parse(transform.Find("Panel").Find("IFframeRate").GetComponent <InputField>().text);
                recordLog.cameraSettings      = new List <CameraSetting>();

                cameraSet       = new List <GameObject>();
                cameraSetOrigin = new GameObject();

                for (int c = 0; c < cameraList.Count; c++)
                {
                    CameraSetting cset = new CameraSetting();
                    cset.fieldOfView = cameraList[c].fieldOfView;
                    cset.id          = cameraList[c].id;
                    cset.position    = cameraList[c].position;
                    cset.pitch       = cameraList[c].pitch;
                    cset.yaw         = cameraList[c].yaw;
                    cset.roll        = cameraList[c].roll;
                    recordLog.cameraSettings.Add(cset);

                    GameObject    camObj    = new GameObject("Cam" + cameraList[c].id, typeof(Camera), typeof(ControllerCam));
                    ControllerCam camScript = camObj.GetComponent <ControllerCam>();
                    camScript.saveFolder = saveFolder;
                    camScript.loadSetting(cameraList[c]);
                    camObj.transform.SetParent(cameraSetOrigin.transform);
                    Directory.CreateDirectory(saveFolder + "/" + camObj.name);
                    cameraSet.Add(camObj);
                }
            }

            generateLog(saveFolder);
            controllerObject.SetActive(false);
            cameraMode = CameraMode.GeneratingScreenShots;

            stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
        }