IEnumerator Coroutine_SelectTargetVideo()
        {
            // https://docs.unity3d.com/Manual/VideoSources-FileCompatibility.html
            // var filters = new string[] { ".mp4", ".avi", "m4v", ".mov", ".webm", ".wmv" };
            string startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);

            yield return(DanbiFileSys.OpenLoadDialog(startingPath,
Ejemplo n.º 2
0
        IEnumerator Coroutine_SaveProjectorExtneralParameters()
        {
            // https://docs.unity3d.com/Manual/VideoSources-FileCompatibility.html
            var    filters      = new string[] { ".dat" };
            string startingPath = default;

#if UNITY_EDITOR
            startingPath = Application.dataPath + "/Resources/";
#else
            startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
#endif
            yield return(DanbiFileSys.OpenSaveDialog(startingPath,
                                                     filters,
                                                     "Save Camera Internal Parameters",
                                                     "Save"));

            // forward the path to save the Internal parameters as a file.
            DanbiFileSys.GetResourcePathIntact(out m_savePath, out _);

            var bf = new BinaryFormatter();
            using (var file = File.Open(m_savePath, FileMode.OpenOrCreate))
            {
                bf.Serialize(file, m_externalData);
            }
        }
Ejemplo n.º 3
0
        IEnumerator Coroutine_LoadProjectorInternalParameters(Transform panel, Dictionary <string, Selectable> elements)
        {
            var    filters      = new string[] { ".dat" };
            string startingPath = default;

#if UNITY_EDITOR
            startingPath = Application.dataPath + "/Resources/";
#else
            startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
#endif
            yield return(DanbiFileSys.OpenLoadDialog(startingPath, filters, "Load Camera Externel Paramaters (Scriptable Object)", "Select"));

            DanbiFileSys.GetResourcePathIntact(out m_loadPath, out _);

            // Load the Internal parameters.
            if (!File.Exists(m_loadPath))
            {
                yield break;
            }

            var bf = new BinaryFormatter();
            DanbiCameraInternalData loaded = null;
            using (var file = File.Open(m_loadPath, FileMode.Open))
            {
                loaded = bf.Deserialize(file) as DanbiCameraInternalData;
            }

            yield return(new WaitUntil(() => !(loaded is null)));

            m_internalData = loaded;

            m_selectedPanoramaInternalParameterText.text = m_loadPath;

            (elements["radialCoefficientX"] as TMP_InputField).text = m_internalData.radialCoefficient.x.ToString();
            onRadialCoefficientXUpdate?.Invoke(m_internalData.radialCoefficient.x);

            (elements["radialCoefficientY"] as TMP_InputField).text = m_internalData.radialCoefficient.y.ToString();
            onRadialCoefficientYUpdate?.Invoke(m_internalData.radialCoefficient.y);

            (elements["radialCoefficientZ"] as TMP_InputField).text = m_internalData.radialCoefficient.z.ToString();
            onRadialCoefficientZUpdate?.Invoke(m_internalData.radialCoefficient.z);

            (elements["tangentialCoefficientX"] as TMP_InputField).text = m_internalData.tangentialCoefficient.x.ToString();
            onTangentialCoefficientXUpdate?.Invoke(m_internalData.tangentialCoefficient.x);

            (elements["tangentialCoefficientY"] as TMP_InputField).text = m_internalData.tangentialCoefficient.y.ToString();
            onTangentialCoefficientYUpdate?.Invoke(m_internalData.tangentialCoefficient.y);

            (elements["principalPointX"] as TMP_InputField).text = m_internalData.principalPoint.x.ToString();
            onPrincipalPointXUpdate?.Invoke(m_internalData.principalPoint.x);

            (elements["principalPointY"] as TMP_InputField).text = m_internalData.principalPoint.y.ToString();
            onPrincipalPointYUpdate?.Invoke(m_internalData.principalPoint.y);

            (elements["focalLengthX"] as TMP_InputField).text = m_internalData.focalLength.x.ToString();
            onFocalLengthXUpdate?.Invoke(m_internalData.focalLength.x);

            (elements["focalLengthY"] as TMP_InputField).text = m_internalData.focalLength.y.ToString();
            onFocalLengthYUpdate?.Invoke(m_internalData.focalLength.y);
        }
        IEnumerator Coroutine_SaveFilePath(TMP_Text displayText)
        {
            string startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);

            yield return(DanbiFileSys.OpenLoadDialog(startingPath,
                                                     null,
                                                     "Select Save Video File Path",
                                                     "Select",
                                                     true));

            DanbiFileSys.GetResourcePathIntact(out m_videoPath, out _);
            displayText.text = $"File Location : {m_savePathAndName}";
            onSavedVideoPathAndNameChange?.Invoke(m_savePathAndName);
        }
        IEnumerator Coroutine_SaveFilePath(TMP_Text displayText)
        {
            string startingPath = default;

#if UNITY_EDITOR
            startingPath = Application.dataPath + "/Resources/";
#else
            startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
#endif
            yield return(DanbiFileSys.OpenLoadDialog(startingPath,
                                                     null,
                                                     "Select Save Image File Path",
                                                     "Select",
                                                     true));

            DanbiFileSys.GetResourcePathIntact(out m_filePath, out _);
            onFilePathChanged?.Invoke(m_filePath);
            displayText.text = $"File Location : {fileSavePathAndName}";
        }
Ejemplo n.º 6
0
        IEnumerator SelectMesh()
        {
            string startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
            var    filter       = new List <string> {
                ".obj"
            };

            yield return(DanbiFileSys.OpenLoadDialog(startingPath,
                                                     filter,
                                                     "Select Mesh",
                                                     "Select"));

            DanbiFileSys.GetResourcePathIntact(out var rsrcPath, out _);
            var mesh = DanbiOBJImporter.ImportFile(rsrcPath);

            onMeshLoaded?.Invoke(mesh);

            m_meshLocation.text = $"Mesh Location : {rsrcPath}";
            m_vertexCount.text  = $"Vertex Count : {mesh.vertexCount}";
            m_indexCount.text   = $"Index Count : {mesh.GetIndexCount(0)}";
            m_uv0Count.text     = $"UV0 Count : {mesh.uv.Length}";
        }
        IEnumerator Coroutine_SelectTargetTexture()
        {
            // var filters = new string[] { ".png", ".jpg" };
            string startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);

            yield return(DanbiFileSys.OpenLoadDialog(startingPath,
Ejemplo n.º 8
0
        IEnumerator Coroutine_LoadProjectorExternalParameters(Transform panel, Dictionary <string, Selectable> elements)
        {
            var    filters      = new string[] { ".dat" };
            string startingPath = default;

#if UNITY_EDITOR
            startingPath = Application.dataPath + "/Resources/";
#else
            startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
#endif
            yield return(DanbiFileSys.OpenLoadDialog(startingPath, filters, "Load Camera Externel Paramaters (Scriptable Object)", "Select"));

            DanbiFileSys.GetResourcePathIntact(out m_loadPath, out _);

            // Load the Internal parameters.
            if (!File.Exists(m_loadPath))
            {
                yield break;
            }

            var bf = new BinaryFormatter();
            DanbiCameraExternalData loaded = null;
            using (var file = File.Open(m_loadPath, FileMode.Open))
            {
                loaded = bf.Deserialize(file) as DanbiCameraExternalData;
            }

            yield return(new WaitUntil(() => !(loaded is null)));

            m_externalData = loaded;

            m_selectProjectorExternalParameterText.text = m_loadPath;

            (elements["positionXInputField"] as TMP_InputField).text = m_externalData.projectorPosition.x.ToString();
            onProjectorPositionXUpdate?.Invoke(m_externalData.projectorPosition.x);

            (elements["positionYInputField"] as TMP_InputField).text = m_externalData.projectorPosition.y.ToString();
            onProjectorPositionYUpdate?.Invoke(m_externalData.projectorPosition.y);

            (elements["positionZInputField"] as TMP_InputField).text = m_externalData.projectorPosition.z.ToString();
            onProjectorPositionZUpdate?.Invoke(m_externalData.projectorPosition.z);

            (elements["xOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.x.ToString();
            onProjectorXAxisXUpdate?.Invoke(m_externalData.xAxis.x);

            (elements["yOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.y.ToString();
            onProjectorXAxisYUpdate?.Invoke(m_externalData.xAxis.y);

            (elements["zOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.z.ToString();
            onProjectorXAxisZUpdate?.Invoke(m_externalData.xAxis.z);

            (elements["xOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.x.ToString();
            onProjectorYAxisXUpdate?.Invoke(m_externalData.yAxis.x);

            (elements["yOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.y.ToString();
            onProjectorYAxisYUpdate?.Invoke(m_externalData.yAxis.y);

            (elements["zOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.z.ToString();
            onProjectorYAxisZUpdate?.Invoke(m_externalData.yAxis.z);

            (elements["xOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.x.ToString();
            onProjectorZAxisXUpdate?.Invoke(m_externalData.zAxis.x);

            (elements["yOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.y.ToString();
            onProjectorZAxisYUpdate?.Invoke(m_externalData.zAxis.y);

            (elements["zOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.z.ToString();
            onProjectorZAxisZUpdate?.Invoke(m_externalData.zAxis.z);
        }