/// <summary> /// Enables the user to perform automatic retopology on the .OBJ mesh via Instant Meshes. /// </summary> /// <param name="serializedObject"></param> The serialized object to modify. public void SubsectionRunInstantMeshesOBJ(SerializedObject serializedObject) { EditorGUILayout.Space(); string workspace = dataHandler.dataDirectory; string inputFilePath = Path.Combine(workspace, BlenderConnector.convertPLYtoOBJOutputFileName); string outputFilePath = inputFilePath; string label = "Perform automatic retopology."; string tooltip = "This will re-mesh the .OBJ file at \"" + GeneralToolkit.FormatPathForCommand(inputFilePath) + "\"."; // Check if this option is available. bool isGUIEnabled = GUI.enabled; GUI.enabled = isGUIEnabled && File.Exists(inputFilePath) && Application.isPlaying; GeneralToolkit.EditorRequirePlayMode(ref tooltip);// Display a button to launch the helper method. bool hasPressed = GeneralToolkit.EditorWordWrapLeftButton(new GUIContent("Run", tooltip), new GUIContent(label, tooltip)); // If the button is pressed, launch the method. if (hasPressed) { StartCoroutine(InstantMeshesConnector.RunInstantMeshesCoroutine(this, workspace, inputFilePath, outputFilePath, _reduceVertexCountToRecommended)); } // Provide the option to reduce the face count to the value recommended by Instant Meshes, or to use the current vertex count. SerializedProperty propertyReduceVertexCountToRecommended = serializedObject.FindProperty(_propertyNameReduceVertexCountToRecommended); label = "Reduce vertex count:"; tooltip = "If true, reduces the vertex count to the value recommended by Instant Meshes. Otherwise, aims to keep the same vertex count."; tooltip += " For scenes in which the region of interest is small compared to the bounds of the mesh, it is recommended to turn this off."; propertyReduceVertexCountToRecommended.boolValue = EditorGUILayout.Toggle(new GUIContent(label, tooltip), propertyReduceVertexCountToRecommended.boolValue); // Reset the GUI. GUI.enabled = isGUIEnabled; EditorGUILayout.Space(); }
/// <summary> /// Enables the user to perform automatic retopology on the .OBJ mesh via Instant Meshes. /// </summary> /// <param name="serializedObject"></param> The serialized object to modify. public void SubsectionRunInstantMeshesOBJ(SerializedObject serializedObject) { EditorGUILayout.Space(); string workspace = dataHandler.dataDirectory; string inputFilePath = Path.Combine(workspace, BlenderConnector.convertPLYtoOBJOutputFileName); string outputFilePath = inputFilePath; string label = "Perform automatic retopology."; string tooltip = "This will re-mesh the .OBJ file at \"" + GeneralToolkit.FormatPathForCommand(inputFilePath) + "\"."; // Check if this option is available. bool isGUIEnabled = GUI.enabled; GUI.enabled = isGUIEnabled && File.Exists(inputFilePath) && Application.isPlaying; GeneralToolkit.EditorRequirePlayMode(ref tooltip); // Display a button to launch the helper method. bool hasPressed = GeneralToolkit.EditorWordWrapLeftButton(new GUIContent("Run", tooltip), new GUIContent(label, tooltip)); // If the button is pressed, launch the method. if (hasPressed) { BlenderHelper blenderHelper = GetComponent <BlenderHelper>(); StartCoroutine(InstantMeshesConnector.RunInstantMeshesCoroutine(this, workspace, inputFilePath, outputFilePath, blenderHelper)); } // Reset the GUI. GUI.enabled = isGUIEnabled; EditorGUILayout.Space(); }