internal override void DrawGUI(BrushSettings settings) { base.DrawGUI(settings); EditorGUI.BeginChangeCheck(); s_IgnoreOpenEdges.value = PolyGUILayout.Toggle(BrushModeSculpt.Styles.gcIgnoreOpenEdges, s_IgnoreOpenEdges); if (s_RaiseLowerDirection == PolyDirection.BrushNormal) { s_UseFirstNormalVector.value = PolyGUILayout.Toggle(BrushModeSculpt.Styles.gcBrushNormalIsSticky, s_UseFirstNormalVector); } s_RaiseLowerDirection.value = (PolyDirection)PolyGUILayout.PopupFieldWithTitle(BrushModeSculpt.Styles.gcDirection, (int)s_RaiseLowerDirection.value, BrushModeSculpt.Styles.s_BrushDirectionList); s_RaiseLowerStrength.value = PolyGUILayout.FloatField(Styles.s_GCBrushEffect, s_RaiseLowerStrength); if (EditorGUI.EndChangeCheck()) { PolybrushSettings.Save(); } }
// Inspector GUI shown in the Editor window. Base class shows BrushSettings by default internal override void DrawGUI(BrushSettings brushSettings) { base.DrawGUI(brushSettings); /// Verify dependencies VerifyLoadedAssetsIntegrity(); EditorGUI.BeginChangeCheck(); /// Interface s_UsePivotForPlacement.value = PolyGUILayout.Toggle(m_GCUsePrefabPivot, s_UsePivotForPlacement); s_ParentObjectWithSurface.value = PolyGUILayout.Toggle(m_GCHitSurfaceIsParent, s_ParentObjectWithSurface); s_AvoidOverlappingGameObjects.value = PolyGUILayout.Toggle(m_GCAvoidOverlappingGameObjects, s_AvoidOverlappingGameObjects); if (SceneView.lastActiveSceneView.in2DMode) { s_2DDepthOffset.value = PolyGUILayout.FloatField(m_GC2DPaintingDepth, s_2DDepthOffset); } EditorGUI.BeginChangeCheck(); m_CurrentPaletteIndex = EditorGUILayout.Popup(m_CurrentPaletteIndex, m_AvailablePalettesAsStrings); if (EditorGUI.EndChangeCheck()) { if (m_CurrentPaletteIndex >= m_AvailablePalettes.Length) { SetPrefabPalette(PrefabPaletteEditor.AddNew()); } else { SetPrefabPalette(m_AvailablePalettes[m_CurrentPaletteIndex]); } } using (new GUILayout.HorizontalScope()) { s_PreviewThumbSize.value = (int)EditorGUILayout.Slider("Preview Size", (float)s_PreviewThumbSize, 60f, 128f); } if (EditorGUI.EndChangeCheck()) { if (m_CurrentPaletteIndex >= m_AvailablePalettes.Length) { SetPrefabPalette(PrefabPaletteEditor.AddNew()); } else { SetPrefabPalette(m_AvailablePalettes[m_CurrentPaletteIndex]); } PolybrushSettings.Save(); } using (new GUILayout.VerticalScope()) { if (prefabLoadoutEditor != null) { prefabLoadoutEditor.OnInspectorGUI_Internal(s_PreviewThumbSize); } } }
public override void OnInspectorGUI() { serializedObject.Update(); // Manually show the settings header in PolyEditor so that the preset selector can be included in the block // if(PolyGUILayout.HeaderWithDocsLink(PolyGUI.TempContent("Brush Settings"))) // Application.OpenURL("http://procore3d.github.io/polybrush/brushSettings/"); showSettingsBounds = PolyGUILayout.Foldout(showSettingsBounds, m_GCBrushSettingsMinMax); if (showSettingsBounds) { using (new EditorGUI.IndentLevelScope()) { using (new GUILayout.VerticalScope()) { brushRadiusMin.floatValue = PolyGUILayout.FloatField(m_GCRadiusMin, brushRadiusMin.floatValue); brushRadiusMin.floatValue = Mathf.Clamp(brushRadiusMin.floatValue, .0001f, Mathf.Infinity); brushRadiusMax.floatValue = PolyGUILayout.FloatField(m_GCRadiusMax, brushRadiusMax.floatValue); brushRadiusMax.floatValue = Mathf.Clamp(brushRadiusMax.floatValue, brushRadiusMin.floatValue + .001f, Mathf.Infinity); allowNonNormalizedFalloff.boolValue = PolyGUILayout.Toggle(m_GCAllowUnclampedFalloff, allowNonNormalizedFalloff.boolValue); } } } radius.floatValue = PolyGUILayout.FloatFieldWithSlider(m_GCRadius, radius.floatValue, brushRadiusMin.floatValue, brushRadiusMax.floatValue); strength.floatValue = PolyGUILayout.FloatFieldWithSlider(m_GCStrength, strength.floatValue, 0f, 1f); falloff.floatValue = PolyGUILayout.FloatFieldWithSlider(m_GCFalloff, falloff.floatValue, 0f, 1f); using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(m_GCFalloffCurve, GUILayout.Width(100)); if (allowNonNormalizedFalloff.boolValue) { curve.animationCurveValue = EditorGUILayout.CurveField(curve.animationCurveValue, GUILayout.MinHeight(22)); } else { curve.animationCurveValue = EditorGUILayout.CurveField(curve.animationCurveValue, Color.green, RECT_ONE, GUILayout.MinHeight(22)); } } Keyframe[] keys = curve.animationCurveValue.keys; if ((approx(keys[0].time, 0f) && approx(keys[0].value, 0f) && approx(keys[1].time, 1f) && approx(keys[1].value, 1f))) { Keyframe[] rev = new Keyframe[keys.Length]; for (int i = 0; i < keys.Length; i++) { rev[keys.Length - i - 1] = new Keyframe(1f - keys[i].time, keys[i].value, -keys[i].outTangent, -keys[i].inTangent); } curve.animationCurveValue = new AnimationCurve(rev); } serializedObject.ApplyModifiedProperties(); SceneView.RepaintAll(); }