/// <inheritdoc/>
        public override void SectionAdditionalParameters()
        {
            SerializedObject serializedObject = new SerializedObject(this);

            serializedObject.Update();
            SerializedProperty propertyGlobalMeshPath = serializedObject.FindProperty(_propertyNameGlobalMeshPathAbsolute);

            // Enable the user to select another mesh by modifying the path.
            if (string.IsNullOrEmpty(_globalMeshPathAbsolute))
            {
                string[]   extensionsArray = new string[] { ".asset", ".obj", ".fbx" };
                FileInfo[] files           = GeneralToolkit.GetFilesByExtension(dataHandler.dataDirectory, extensionsArray);
                if (files.Length > 0)
                {
                    _globalMeshPathAbsolute = files[0].FullName;
                }
            }
            string searchTitle = "Select global mesh";
            string tooltip     = "Select the global mesh to use for rendering.";
            string extensions  = "FBX,fbx,OBJ,obj,ASSET,asset";
            string outPath;
            bool   clicked;

            GeneralToolkit.EditorPathSearch(out clicked, out outPath, PathType.File, _globalMeshPathAbsolute, searchTitle, tooltip, Color.grey, true, extensions);
            propertyGlobalMeshPath.stringValue = outPath;
            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 2
0
        /// <summary>
        /// Enables the user to specify the path to the external tool's executable file.
        /// </summary>
        public virtual void EditorSettingsFoldout()
        {
            SerializedObject serializedObject = new SerializedObject(this);

            serializedObject.Update();
            SerializedProperty propertyFoldout = serializedObject.FindProperty(_propertyNameFoldout);
            SerializedProperty propertyExePath = serializedObject.FindProperty(_propertyNameExePath);

            using (var verticalScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                string label   = toolkitName;
                string tooltip = "Select the path to the " + toolkitName + " toolkit.";
                propertyFoldout.boolValue = EditorGUILayout.Foldout(propertyFoldout.boolValue, new GUIContent(label, tooltip));
                if (propertyFoldout.boolValue)
                {
                    label   = "Executable path";
                    tooltip = "Path to the " + toolkitName + " executable file.";
                    string extensions = "EXE,exe,BAT,bat";
                    bool   clicked;
                    string newExePath;
                    GeneralToolkit.EditorPathSearch(out clicked, out newExePath, PathType.File, propertyExePath.stringValue, label, tooltip, Color.grey, false, extensions);
                    if (clicked)
                    {
                        propertyExePath.stringValue = newExePath;
                    }
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// Enables the user to choose the data handler's data directory.
        /// </summary>
        public void SectionDataDirectory()
        {
            string searchTitle = "Select output root directory for the captured data";
            string tooltip     = "Path must be within the Unity project folder (but can be outside of Assets). Existing data in this folder will be overwritten.";
            bool   clicked;
            string outPath;

            GeneralToolkit.EditorPathSearch(out clicked, out outPath, PathType.Directory, _targetObject.dataHandler.dataDirectory, searchTitle, tooltip, Color.grey);
            _targetObject.dataHandler.ChangeDataDirectory(outPath, clicked);
        }
        /// <summary>
        /// Enables the user to select the source data directory.
        /// </summary>
        /// <param name="targetObject"></param> The target processing object.
        public static void SectionDataDirectory(Processing targetObject)
        {
            bool isGUIEnabled = GUI.enabled;

            GUI.enabled = isGUIEnabled && !Application.isPlaying;
            EditorGUILayout.LabelField(targetObject.sourceDataInfo, GeneralToolkit.wordWrapStyle, GUILayout.MaxWidth(GeneralToolkit.EditorGetCurrentScopeWidth()));
            using (var verticalScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                string searchTitle = "Select directory that contains color/depth data";
                string tooltip     = "Select the base directory where the acquisition data was stored.";
                bool   clicked;
                string outPath;
                GeneralToolkit.EditorPathSearch(out clicked, out outPath, PathType.Directory, targetObject.dataHandler.dataDirectory, searchTitle, tooltip, Color.grey);
                targetObject.dataHandler.ChangeDataDirectory(outPath, clicked);
            }
            GUI.enabled = isGUIEnabled;
        }
Esempio n. 5
0
        /// <summary>
        /// Enables the user to choose the directory containing the rectified images from the Stanford Light Field Archive.
        /// </summary>
        public void SectionDataDirectory()
        {
            EditorGUILayout.Space();
            string label = "The rectified images downloaded from the Stanford Light Field Archive should be placed in a folder named \"images\".";

            EditorGUILayout.LabelField(label, GeneralToolkit.wordWrapStyle);
            label = "Please specify the parent directory containing this \"images\" folder:";
            EditorGUILayout.LabelField(label, GeneralToolkit.wordWrapStyle);
            EditorGUILayout.Space();
            string searchTitle = "Select the parent directory of the directory containing the rectified images";
            string tooltip     = "Path must be within the Unity project folder (but can be outside of Assets).";
            bool   clicked;
            string outPath;

            GeneralToolkit.EditorPathSearch(out clicked, out outPath, PathType.Directory, _targetObject.dataHandler.dataDirectory, searchTitle, tooltip, Color.grey);
            _targetObject.dataHandler.ChangeDataDirectory(outPath, clicked);
            _targetObject.dataHandler.CheckStatusOfSourceData();
            EditorGUILayout.LabelField("Detected color images: " + _targetObject.dataHandler.sourceColorCount + ".");
        }