Exemple #1
0
    private void OnGUI()
    {
        /*
         * EditorGUI.LabelField(new Rect(0, 0, width, lineHeight), "Setup",EditorStyles.boldLabel);
         *
         * newFolderName = EditorGUI.TextField(new Rect(10, 15, width-20, buttonHeight), new GUIContent("Folder name:"), newFolderName);
         *
         * if (GUI.Button(new Rect(50, outputStart, buttonWidth, buttonHeight), "Select Output Folder", EditorStyles.miniButtonRight)) {
         *  SetNewFolder();
         * }
         * EditorGUI.LabelField(new Rect(50, outputStart + buttonHeight - 5, width, lineHeight), outputText, EditorStyles.centeredGreyMiniLabel);
         */
        if (GUI.Button(new Rect(50, inputStart, buttonWidth, buttonHeight), "Select PointCloud Text File", EditorStyles.miniButtonRight))
        {
            SetNewFile();
        }
        EditorGUI.LabelField(new Rect(0, inputStart + buttonHeight - 5, width, lineHeight), inputText, EditorStyles.centeredGreyMiniLabel);



        EditorGUI.LabelField(new Rect(0, progressStart, width, lineHeight), "Process Files", EditorStyles.boldLabel);

        if (path != null)
        {
            msgStart       = 135;
            additionalText = "Press the button above to begin processing.\n\n";

            messageText = "";
            if (startedJob)
            {
                messageText    = "";
                additionalText = "Press the above button to cancel job.\n\n";

                EditorGUI.ProgressBar(new Rect(10, msgStart + msgHeight + 10, width - 20, 15), readPoints.getProgressValue, string.Format("{0} days, {1} hrs, {2} mins, {3}secs", readPoints.timeRemaining.Days, readPoints.timeRemaining.Hours, readPoints.timeRemaining.Minutes, readPoints.timeRemaining.Seconds));

                if (GUI.Button(new Rect(50, msgStart - 20, buttonWidth, buttonHeight), "Cancel", EditorStyles.miniButtonRight))
                {
                    readPoints.cancel();
                }

                if (readPoints.hasFinished)
                {
                    messageText += "All Finished.\n\nPress button to load a new file.\n\n";
                    inputText    = "Please select a PointCloud text file to process.";
                    FinsihedJob  = false;
                    startedJob   = false;
                    EditorUtility.ClearProgressBar();
                    path = null;
                }
                messageText = messageText + readPoints.getMessages;
            }
            else
            {
                if (GUI.Button(new Rect(50, msgStart - 20, buttonWidth, buttonHeight), "Start Processing", EditorStyles.miniButtonRight))
                {
                    processFiles(path);
                }
            }
        }

        EditorGUI.TextArea(new Rect(10, msgStart, width - 20, msgHeight), additionalText + messageText, EditorStyles.helpBox);
        additionalText = "";
    }
Exemple #2
0
    private void OnGUI()
    {
        EditorGUI.LabelField(new Rect(0, 0, width, lineHeight), "Setup", EditorStyles.boldLabel);

        newFolderName = EditorGUI.TextField(new Rect(10, 15, width - 20, buttonHeight), new GUIContent("Folder name:"), newFolderName);

        if (GUI.Button(new Rect(50, outputStart, buttonWidth, buttonHeight), "Select Output Folder", EditorStyles.miniButtonRight))
        {
            SetNewFolder();
        }
        EditorGUI.LabelField(new Rect(50, outputStart + buttonHeight - 5, width, lineHeight), outputText, EditorStyles.centeredGreyMiniLabel);

        if (GUI.Button(new Rect(50, inputStart, buttonWidth, buttonHeight), "Select PointCloud Text File", EditorStyles.miniButtonRight))
        {
            SetNewFile();
        }
        EditorGUI.LabelField(new Rect(50, inputStart + buttonHeight - 5, width, lineHeight), inputText, EditorStyles.centeredGreyMiniLabel);



        EditorGUI.LabelField(new Rect(0, progressStart, width, lineHeight), "Process Files", EditorStyles.boldLabel);

        if (path != null && outputPath != null)
        {
            msgStart = 135;
            if (Directory.Exists(outputPath + "/" + newFolderName))
            {
                additionalText = "                      *****DANGER*****\n" +
                                 "                      NEW FOLDER EXISTS\n" +
                                 "  THE FOLDER IS DELETED WHEN PROCESSING BEGINS\n\n" +
                                 "To keep all files, please change the name of the desired output in the text box at the start of the setup section.\n\n";
            }
            else
            {
                additionalText = "Press the button above to begin processing.\n\n";
            }

            if (startedJob)
            {
                messageText = "";

                EditorGUI.ProgressBar(new Rect(10, msgStart + msgHeight + 10, width - 20, 15), readPoints.getProgressValue, string.Format("{0} days, {1} hrs, {2} mins, {3}secs", readPoints.timeRemaining.Days, readPoints.timeRemaining.Hours, readPoints.timeRemaining.Minutes, readPoints.timeRemaining.Seconds));

                if (GUI.Button(new Rect(50, msgStart - 20, buttonWidth, buttonHeight), "Cancel", EditorStyles.miniButtonRight))
                {
                    readPoints.cancel();
                }

                if (readPoints.hasFinished)
                {
                    messageText += "\nAll Finished.\n\nPress button to load a new file.";
                    inputText    = "Please select a PointCloud text file to process.";
                    FinsihedJob  = false;
                    startedJob   = false;
                    EditorUtility.ClearProgressBar();
                    path = null;
                }
                messageText = readPoints.getMessages;
            }
            else
            {
                if (GUI.Button(new Rect(50, msgStart - 20, buttonWidth, buttonHeight), "Start Processing", EditorStyles.miniButtonRight))
                {
                    processFiles(path);
                }
            }
        }

        EditorGUI.TextArea(new Rect(10, msgStart, width - 20, msgHeight), additionalText + messageText, EditorStyles.helpBox);
        additionalText = "";
        // messageText = "Please finish setup.\n\t1)  Name the new output folder.\n\t2)  Select the output parent folder.\n\t3)  Select the .pts file to process.\n";
        // GUI.skin.verticalScrollbar
        //Vector2 ScrollPos = Vector2.zero;
        // scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(100), GUILayout.Height(100));
        // ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos, GUILayout.Height(msgHeight), GUILayout.Width(width - 20));
        // EditorGUILayout.EndScrollView();


        // EditorGUI.PrefixLabel(new Rect(0, s_topOffset * 0, s_WinWidth, s_topOffset), new GUIContent("This is a prefix lable."));
        //EditorGUI.TextField(new Rect(0, s_topOffset *1, s_WinWidth, s_topOffset), "This is a text field.");
        //EditorGUI.TextArea(new Rect(0, s_topOffset * 2,  s_WinWidth, s_topOffset), "This is a text area.");
        //  EditorGUI.LabelField(new Rect(0, s_topOffset * 3,  s_WinWidth, s_topOffset), "This is a lable.");
        //  GUI.Button(new Rect(0, s_topOffset * 4, s_WinWidth, 15), "Set your output folder");

        /*
         * if (startedJob) {
         *  // update progress bar if not finished...
         *
         *  messageText = readPoints.getMessages;
         *
         *  if (FinsihedJob) {
         *      messageText += "\nAll Finished.\n\nPress button to load a new file.";
         *      FinsihedJob = false;
         *      startedJob = false;
         *      EditorUtility.ClearProgressBar();
         *      path = null;
         *  }
         *  EditorGUI.ProgressBar(new Rect(10, msgStart + msgHeight + 10, width - 20, 15), readPoints.getProgressValue, readPoints.timeRemaining.ToString("c"));
         * }
         *
         * if (!messageRead && startedRead) {
         *  if (readPoints.hasFinished) {
         *      messageText += "\nAll Finished.\n\nPress button to load a new file.";
         *      startedRead = false;
         *      EditorUtility.ClearProgressBar();
         *      path = null;
         *  }
         * }
         * if (path == null) {
         *
         *  if (GUILayout.Button("Add path from browser")) {
         *      if (loadFiles()) {
         *          messageText = "Loaded a new file!\n\n";
         *          messageText += string.Format("File:\t {0}\n\nPress the button above to process document.\n",path);
         *      }
         *      messageRead = false;
         *  }
         * }
         * else {
         *  if (GUILayout.Button("Process the loaded file")) {
         *      processFiles(path);
         *      messageRead = false;
         *  }
         * }
         */
    }