public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { label = EditorGUI.BeginProperty(position, label, property); var foldoutRect = new Rect(position.xMin, position.yMin, EditorGUIUtility.labelWidth, EditorGUIUtility.singleLineHeight); property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label); if (property.isExpanded) { var contentRectR = new Rect(position.xMin, position.yMin + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight * 2f); var contentRectG = new Rect(position.xMin, contentRectR.yMax + (EditorGUIUtility.standardVerticalSpacing * 2), position.width, EditorGUIUtility.singleLineHeight * 2f); var contentRectB = new Rect(position.xMin, contentRectG.yMax + (EditorGUIUtility.standardVerticalSpacing * 2), position.width, EditorGUIUtility.singleLineHeight * 2f); var contentRectA = new Rect(position.xMin, contentRectB.yMax + (EditorGUIUtility.standardVerticalSpacing * 2), position.width, EditorGUIUtility.singleLineHeight * 2f); var previewToolsRect = new Rect(position.xMin, contentRectA.yMax + (EditorGUIUtility.standardVerticalSpacing * 2), position.width, EditorGUIUtility.singleLineHeight); //EditorGUI.PropertyField(contentRectR, property.FindPropertyRelative("R")); CDCDCCDrawer.OnGUI(contentRectR, property.FindPropertyRelative("R"), new GUIContent("R")); //EditorGUI.PropertyField(contentRectG, property.FindPropertyRelative("G")); CDCDCCDrawer.OnGUI(contentRectG, property.FindPropertyRelative("G"), new GUIContent("G")); //EditorGUI.PropertyField(contentRectB, property.FindPropertyRelative("B")); CDCDCCDrawer.OnGUI(contentRectB, property.FindPropertyRelative("B"), new GUIContent("B")); //EditorGUI.PropertyField(contentRectA, property.FindPropertyRelative("A")); CDCDCCDrawer.OnGUI(contentRectA, property.FindPropertyRelative("A"), new GUIContent("A"), true); var _previewProp = property.FindPropertyRelative("_testDNAVal"); var expanded = _previewProp.isExpanded; GUIHelper.ToolbarStyleFoldout(previewToolsRect, new GUIContent("Preview Tool", "With the Preview Tool you can see how the above settings will affect a given color when the modifying dna evaluates to the given test value"), ref expanded, EditorStyles.label); _previewProp.isExpanded = expanded; if (_previewProp.isExpanded) { DrawPreviewTool(previewToolsRect, property, _previewProp); } } EditorGUI.EndProperty(); }
private void DrawOverallModifiers() { var overallModifiersProp = serializedObject.FindProperty("_overallModifiers"); var overallModsFoldoutRect = EditorGUILayout.GetControlRect(); overallModsFoldoutRect.height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; var overallModsLabel = EditorGUI.BeginProperty(overallModsFoldoutRect, new GUIContent(overallModifiersProp.displayName), overallModifiersProp); overallModsLabel.text = overallModsLabel.text.ToUpper(); //TODO Id actually like an import settings thing here now, so that you can import overallModifiers from another converterController or converterBehaviour GUIHelper.ToolbarStyleFoldout(overallModsFoldoutRect, overallModsLabel.text.ToUpper(), new string[] { overallModsLabel.tooltip }, ref _overallModifiersExpanded, ref _overallModifiersHelpExpanded); if (_overallModifiersExpanded) { GUIHelper.BeginVerticalPadded(3, new Color(0.75f, 0.875f, 1f, 0.3f)); GUILayout.Space(5); EditorGUILayout.PropertyField(overallModifiersProp); GUIHelper.EndVerticalPadded(3); } }
private void DrawDNAAssetField() { var dnaAssetProp = serializedObject.FindProperty("_dnaAsset"); var dnaAssetFoldoutRect = EditorGUILayout.GetControlRect(); dnaAssetFoldoutRect.height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; var dnaAssetLabel = EditorGUI.BeginProperty(dnaAssetFoldoutRect, new GUIContent(dnaAssetProp.displayName), dnaAssetProp); dnaAssetLabel.text = dnaAssetLabel.text.ToUpper(); GUIHelper.ToolbarStyleFoldout(dnaAssetFoldoutRect, dnaAssetLabel.text.ToUpper(), new string[] { dnaAssetLabel.tooltip }, ref _dnaAssetExpanded, ref _dnaAssetHelpExpanded); if (_dnaAssetExpanded) { GUIHelper.BeginVerticalPadded(3, new Color(0.75f, 0.875f, 1f, 0.3f)); GUILayout.Space(5); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(dnaAssetProp); if (EditorGUI.EndChangeCheck()) { if (dnaAssetProp.objectReferenceValue != null) { _dnaAsset = dnaAssetProp.objectReferenceValue as DynamicUMADnaAsset; } else { _dnaAsset = null; } //TODO in the ConverterBehaviour editor we cleared the DNA on the avatar.umaData (if we are in play mode and inspecting using customizer) //we could probably do with doing the same here /* * //force the Avatar to update its dna and dnaconverter dictionaries * umaData.umaRecipe.ClearDna(); * umaData.umaRecipe.ClearDNAConverters(); */ } GUIHelper.EndVerticalPadded(3); } EditorGUILayout.Space(); }
private void DrawControllersHeader(Rect rect, string[] help, ref bool _isExpanded, ref bool _helpExpanded) { //GUIHelper.ToolbarStyleHeader(rect, new GUIContent(_dnaConvertersLabel.ToUpper()), _help, ref _helpExpanded); GUIHelper.ToolbarStyleFoldout(rect, new GUIContent(_dnaConvertersLabel.ToUpper()), _help, ref _isExpanded, ref _helpExpanded); //_isExpanded = true; }