public static void SetLivePopupEditor(DynamicDNAConverterControllerInspector liveDDCCEditor) { if (Application.isPlaying) { _livePopupEditor = liveDDCCEditor; } }
/// <summary> /// Draws a DNAEvaluator with inline styling /// </summary> /// <param name="position"></param> /// <param name="property"></param> /// <param name="label"></param> public void DoFieldsInline(Rect position, SerializedProperty property) { CheckDynamicDNAPlugin(property); Init(); var prevIndent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; Rect calcOptionRect = Rect.zero; if (_drawCalcOption) { calcOptionRect = new Rect(position.xMin, position.yMin, _calcOptionWidth, EditorGUIUtility.singleLineHeight); position.xMin = calcOptionRect.xMax; } var calcOptionProp = property.FindPropertyRelative(CALCOPTIONPROPERTY); var dnaNameProp = property.FindPropertyRelative(DNANAMEPROPERTY); var dnaNameHashProp = property.FindPropertyRelative(DNANAMEHASHPROPERTY); var evaluatorProp = property.FindPropertyRelative(EVALUATORPROPERTY); var intensityProp = property.FindPropertyRelative(MULTIPLIERPROPERTY); var fieldbaseRatio = (position.width - _multiplierLabelWidth) / (_dnaToEvaluatorRatio.x + _dnaToEvaluatorRatio.y); var dnafieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.x; var evaluatorFieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.y; position.height = EditorGUIUtility.singleLineHeight; //theres a space at the bottom so cut that off var dnaNameRect = new Rect(position.xMin + _padding, position.yMin, dnafieldWidth - (_padding * 2), position.height); var evaluatorRect = new Rect(dnaNameRect.xMax + (_padding * 2), position.yMin, evaluatorFieldWidth - (_padding * 2), position.height); var multiplierRect = new Rect(evaluatorRect.xMax + (_padding * 2), position.yMin, _multiplierLabelWidth - (_padding * 2), position.height); if (_drawCalcOption) { calcOptionProp.enumValueIndex = EditorGUI.Popup(calcOptionRect, calcOptionProp.enumValueIndex, _calcOptionMiniLabels); } EditorGUI.BeginChangeCheck(); if (_dynamicDNAPlugin == null) { EditorGUI.PropertyField(dnaNameRect, dnaNameProp, GUIContent.none); } else { DynamicDNAConverterControllerInspector.DNANamesPopup(dnaNameRect, dnaNameProp, dnaNameProp.stringValue, _dynamicDNAPlugin.converterController.DNAAsset); } if (EditorGUI.EndChangeCheck()) { if (!string.IsNullOrEmpty(dnaNameProp.stringValue)) { dnaNameHashProp.intValue = UMAUtils.StringToHash(dnaNameProp.stringValue); } else { dnaNameHashProp.intValue = -1; } } EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(dnaNameProp.stringValue)); EditorGUI.BeginChangeCheck(); EditorGUI.PropertyField(evaluatorRect, evaluatorProp, GUIContent.none); if (EditorGUI.EndChangeCheck()) { InspectorUtlity.RepaintAllInspectors(); GUI.changed = true; } EditorGUI.PropertyField(multiplierRect, intensityProp, GUIContent.none); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel = prevIndent; }