void CheckMaxBlockPermutationsAllowed(bool isBlockVariable) { if (!isBlockVariable || valuesProperty.arraySize <= ExperimentDesign.MaxBlockPermutationsAllowed) { return; } IExperimentDesignFile iExperimentDesignFile = VariableProperty.serializedObject.targetObject as IExperimentDesignFile; if (iExperimentDesignFile == null) { return; } if (iExperimentDesignFile.GetBlockOrderConfigurations.Count == 0) { VariableValidationResults.AddError( "Too many Block Values for automatic permutation. " + "Must define possible Block orders manually using BlockOrderDefinition files. " + "Please see docs."); } if (!iExperimentDesignFile.GetBlockOrderIsValid) { VariableValidationResults.AddWarning("A recent change has invalidated your manual block order configurations. " + "Please update them before running your experiment"); } }
protected override void DrawVariableSpecificInspector() { SerializedProperty blockProperty = VariableProperty.FindPropertyRelative(nameof(IndependentVariable.Block)); CheckMaxBlockPermutationsAllowed(blockProperty.boolValue); EditorGUILayout.PropertyField(blockProperty); SerializedProperty mixType = VariableProperty.FindPropertyRelative(nameof(IndependentVariable.MixingType)); VariableMixingType op = (VariableMixingType)mixType.intValue; op = (VariableMixingType)EditorGUILayout.EnumPopup("Mixing Type", op); mixType.intValue = (int)op; if (valuesProperty.arraySize == 0) { VariableValidationResults.AddWarning("No values"); } bool isCustomProbability = CheckIfCustomProbability(); EditorGUILayout.Space(); EditorGUILayout.Space(); valuesList.DoLayoutList(); EditorGUILayout.Space(); if (isCustomProbability) { CalculateFinalProbability(); CheckProbabilityErrors(true); } if (waitingToClearAllValues) { int n = valuesProperty.arraySize; for (int i = 0; i < n; i++) { RemoveValue(0); RemoveProbability(0); } waitingToClearAllValues = false; } }