public override void OnInspectorGUI() { serializedObject.Update(); DrawDefaultInspector(); PointCloudGenerator script = (PointCloudGenerator)target; GUILayout.Label("Initializing", EditorStyles.boldLabel); if (GUILayout.Button("Generate")) { script.Generate(); } if (GUILayout.Button("Reset")) { script.Reset(); } GUILayout.Label("Modifying", EditorStyles.boldLabel); if (GUILayout.Button("Displace")) { script.Displace(); } GUILayout.Label("Exporting", EditorStyles.boldLabel); if (GUILayout.Button("Export")) { script.Export(); } if (GUILayout.Button("Save Baked Colors")) { string fileName = EditorUtility.SaveFilePanel("Export .png file", "", "", "png"); File.WriteAllBytes(fileName, script.GetBakedMap().EncodeToPNG()); } }
/// <summary> /// Erase user-drawn shape and clear object indices. /// </summary> public void Reset() { _userDrawnShapePoints = new List <Vector3>(); _userDrawnHullVertices = new List <Vector3>(); _userDrawnHullLines = new List <Vector3[]>(); _currentButtons = new List <GameObject>(); _numObjects = 0; WaitingButtonClick = false; _pointCloudGenerator.Reset(); }