private void ShowClearAllExamplesButton() { bool disableButton = false; if (!Lists.IsNullOrEmpty(ref m_TrainingExamplesNode.TrainingExamplesVector)) { disableButton = false; } // Only run button logic when there are training examples to delete if (!disableButton) { // If there are any models connected we check some conditions /*if (!Lists.IsNullOrEmpty(ref m_SeriesTrainingExamplesNode.IMLConfigurationNodesConnected)) * { * foreach (var IMLConfigNode in m_SeriesTrainingExamplesNode.IMLConfigurationNodesConnected) * { * // Disable button if any of the models is runnning OR collecting data OR training * if (IMLConfigNode.Running || IMLConfigNode.Training || m_SeriesTrainingExamplesNode.CollectingData) * { * disableButton = true; * break; * } * } * }*/ // Draw button if (disableButton) { GUI.enabled = false; } if (GUILayout.Button("Delete Data", Resources.Load <GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Delete Button"))) { m_TrainingExamplesNode.ClearTrainingExamples(); } // Always enable it back at the end GUI.enabled = true; } // If there are no training examples to delete we draw a disabled button else { GUI.enabled = false; if (GUILayout.Button("Delete Data", Resources.Load <GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Delete Button"))) { m_TrainingExamplesNode.ToggleCollectExamples(); } GUI.enabled = true; } }
private void ShowClearAllExamplesButton() { string nameButton = ""; bool disableButton = false; switch (m_TrainingExamplesNode.ModeOfCollection) { case TrainingExamplesNode.CollectionMode.SingleExample: nameButton = "Delete All Training Examples"; // Only run button logic when there are training examples to delete if (!Lists.IsNullOrEmpty(ref m_TrainingExamplesNode.TrainingExamplesVector)) { disableButton = false; } break; case TrainingExamplesNode.CollectionMode.Series: nameButton = "Delete All Training Series Collected"; // Only run button logic when there are training examples to delete if (!Lists.IsNullOrEmpty(ref m_TrainingExamplesNode.TrainingSeriesCollection)) { disableButton = false; } break; default: break; } // Only run button logic when there are training examples to delete if (!disableButton) { // If there are any models connected we check some conditions if (!Lists.IsNullOrEmpty(ref m_TrainingExamplesNode.IMLConfigurationNodesConnected)) { foreach (var IMLConfigNode in m_TrainingExamplesNode.IMLConfigurationNodesConnected) { // Disable button if any of the models is runnning OR collecting data OR training if (IMLConfigNode.Running || IMLConfigNode.Training || m_TrainingExamplesNode.CollectingData) { disableButton = true; break; } } } // Draw button if (disableButton) { GUI.enabled = false; } if (GUILayout.Button(nameButton)) { m_TrainingExamplesNode.ClearTrainingExamples(); } // Always enable it back at the end GUI.enabled = true; } // If there are no training examples to delete we draw a disabled button else { GUI.enabled = false; if (GUILayout.Button(nameButton)) { m_TrainingExamplesNode.ToggleCollectExamples(); } GUI.enabled = true; } }