// Draw UND Shape GUI private void DrawShapeUND(string label, MaterialEditor editor) { Styles.bShowShapeUND = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowShapeUND); if (!Styles.bShowShapeUND) { return; } if (isComplexProfile) { editor.TextureProperty(_StrandShapeMapUND, "Strand Shape Map UND", false); editor.TextureProperty(_StrandColorIndexMapUND, "Strand Index Map UND", false); editor.TextureScaleOffsetProperty(_StrandShapeMapUND); } else { editor.TextureProperty(_StrandShapeMapUND, "Strand Shape Map UND"); } if (isOptimizedProfile) { if (_StrandShapeMapUND.textureValue) { bool showCurve = DoToggleProperty("Enable curve adjustments for strands", _bAdjustPatternCurve, editor); if (showCurve) { DoRangeProperty("Pattern curve power", _PatternCurvePower, editor); } } } }
// Draw OVR Density GUI private void DrawDensityOVR(string label, MaterialEditor editor) { Styles.bShowDensityOVR = NeoGUIHelper.MaterialHeaderWithToggle(_bDensityOVR, editor, label, Styles.bShowDensityOVR); if (!Styles.bShowDensityOVR) { return; } EditorGUI.BeginDisabledGroup(_bOVR.floatValue == 0.0f || _bDensityOVR.floatValue == 0.0f); bool bDensityMap = DoToggleProperty("Enable Density Map OVR", _bDensityMapOVR, editor); if (bDensityMap) { NeoGUIHelper.PushIndent(); editor.TextureProperty(_DensityMapOVR, "Density Map OVR"); DoRangeProperty("Min Density of strands OVR", _DensityMinOVR, editor); DoRangeProperty("Max Density of strands OVR", _DensityMaxOVR, editor); NeoGUIHelper.PopIndent(); } else { DoRangeProperty("Density of strands OVR", _DensityOVR, editor); } EditorGUI.EndDisabledGroup(); }
// Draw OVR Shape GUI private void DrawShapeOVR(string label, MaterialEditor editor) { Styles.bShowShapeOVR = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowShapeOVR); if (!Styles.bShowShapeOVR) { return; } editor.TextureScaleOffsetProperty(_StrandShapeMapOVR); }
// Draw OVR Height GUI private void DrawHeightOVR(string label, MaterialEditor editor) { Styles.bShowHeightOVR = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowHeightOVR); if (!Styles.bShowHeightOVR) { return; } DoToggleProperty("Enable use of UND Height Map", _bHeightMapOVR, editor); DoRangeProperty("Min Strand Length/Height", _StrandLengthMinOVR, editor); DoRangeProperty("Max Strand Length/Height", _StrandLengthMaxOVR, editor); }
// Draw UND Height GUI private void DrawHeightUND(string label, MaterialEditor editor) { Styles.bShowHeightUND = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowHeightUND); if (!Styles.bShowHeightUND) { return; } if (!isMobileProfile) { if (isComplexProfile) { bool bOpaque = DoToggleProperty("Make base layer opaque", _bOpaqueBaseUND, editor); if (bOpaque && _bHeightMapUND.floatValue >= 0.5f) { NeoGUIHelper.PushIndent(); DoRangeProperty("Base Layer Height Threshold", _BaseLayerHeightThreshold, editor); NeoGUIHelper.PopIndent(); } } DoRangeProperty("Min Strand Length/Height", _StrandLengthMinUND, editor); DoRangeProperty("Max Strand Length/Height", _StrandLengthMaxUND, editor); bool bHeightMap = DoToggleProperty("Enable Height Map", _bHeightMapUND, editor); if (!bHeightMap) { return; } NeoGUIHelper.PushIndent(); if (isComplexProfile) { DoRangeProperty("Height Map Influence", _HMPDepthUND, editor); } } else if (isMobileProfile) { DoRangeProperty("Strand base layer offset", _StrandAlphaOffset, editor); } editor.TextureProperty(_HeightMapUND, "Height Map"); if (!isMobileProfile) { NeoGUIHelper.PopIndent(); } }
private void DrawSurfaceValues(MaterialEditor editor) { NeoGUIHelper.PushTextColor(Color.white); NeoGUIHelper.PushBGColor(NeoGUIHelper.Colors.LightGrey); if (isComplexProfile) { Styles.bShowSurfaceValues = NeoGUIHelper.HeaderWithFoldout("3. SURFACE VALUES", Styles.bShowSurfaceValues); } else { Styles.bShowSurfaceValues = NeoGUIHelper.HeaderWithFoldout("2. SURFACE VALUES", Styles.bShowSurfaceValues); } NeoGUIHelper.PopTextColor(); NeoGUIHelper.PopBGColor(); if (!Styles.bShowSurfaceValues) { return; } NeoGUIHelper.PushIndent(); //if (!isComplexProfile) { EditorGUILayout.Space(); DrawAOValues(editor); EditorGUILayout.Space(); } if (isComplexProfile) { _EmissionColor.colorValue = editor.ColorProperty(_EmissionColor, "Emissive Color"); } else { DoRangeProperty("Smoothness", _Smoothness, editor); DoRangeProperty("Metallicness", _Metallic, editor); DoRangeProperty("Rim Brightness", _RimBrightness, editor); DoRangeProperty("Rim Center", _RimCenter, editor); DoRangeProperty("Rim Contrast", _RimContrast, editor); } DoEnumProperty <CullMode>("Cull Mode", _CullMode, editor); NeoGUIHelper.PopIndent(); }
// Draw OVR Lighting GUI private void DrawLightingOVR(string label, MaterialEditor editor) { Styles.bShowLightingOVR = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowLightingOVR); if (!Styles.bShowLightingOVR) { return; } editor.TexturePropertySingleLine(Styles.GradientScatterMapLabelOVR, _GradientScatterMapOVR); DoRangeProperty("Smoothness OVR", _RoughnessOVR, editor); DoRangeProperty("Scatter OVR", _ScatterOVR, editor); DoRangeProperty("Specular reflections breakup OVR", _SpecularBreakupOVR, editor); }
// Draw OVR Color GUI private void DrawColorOVR(string label, MaterialEditor editor) { Styles.bShowColorOVR = NeoGUIHelper.MaterialHeaderWithToggle(_bColorOVR, editor, label, Styles.bShowColorOVR); if (!Styles.bShowColorOVR) { return; } EditorGUI.BeginDisabledGroup(_bOVR.floatValue == 0.0f || _bColorOVR.floatValue == 0.0f); bool bColorMap = DoToggleProperty("Enable Color Map", _bColorMapOVR, editor); if (bColorMap) // color maps { NeoGUIHelper.PushIndent(); bool bGradientMap = DoToggleProperty("Enable Gradient Map OVR", _bGradientMapOVR, editor); if (bGradientMap) { NeoGUIHelper.PushIndent(); DoToggleProperty("Color Gradient Root To Tip", _bGradientMapRootToTipOVR, editor); //gradient map editor.TexturePropertySingleLine(Styles.GradientMapLabelOVR, _GradientMapOVR); NeoGUIHelper.PopIndent(); } else { // root and tip color maps editor.TextureProperty(_ColorRootMapOVR, "Color Root Map OVR"); editor.TextureProperty(_ColorTipMapOVR, "Color Tip Map OVR"); } editor.ShaderProperty(_ColorTintRootOVR, "Root Tint"); editor.ShaderProperty(_ColorTintTipOVR, "Tip Tint"); NeoGUIHelper.PopIndent(); } else // color values { editor.ShaderProperty(_ColorRootOVR, "Root Color"); editor.ShaderProperty(_ColorTipOVR, "Tip Color"); } EditorGUI.EndDisabledGroup(); }
void PreProcessSection(NeoFurAsset nfa) { bPreProcessFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutPreProcess.text, bPreProcessFolded); if (bPreProcessFolded) { EditorGUI.indentLevel++; EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth / 5; GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(Styles.labelFurGuideGenMethod); string[] choices = new string[3]; choices[0] = "Splines"; choices[1] = "Morphs"; choices[2] = "Normals"; nfa.data.guideMethod = (NeoFurAssetData.GuideMethod)(GUILayout.SelectionGrid( (int)nfa.data.guideMethod, choices, 3, EditorStyles.radioButton)); mLastGuideMethod = nfa.data.guideMethod; GUILayout.EndHorizontal(); if (nfa.data.guideMethod == NeoFurAssetData.GuideMethod.Normals) { float oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth / 2; //desired length of guides generated from normals EditorGUILayout.PropertyField(guideLengthProp, Styles.labelGuideLength); EditorGUIUtility.labelWidth = oldWidth; } else if (nfa.data.guideMethod == NeoFurAssetData.GuideMethod.Morphs) { MorphSection(nfa); } else if (nfa.data.guideMethod == NeoFurAssetData.GuideMethod.Splines) { SplineSection(nfa); } EditorGUI.indentLevel--; } }
// Draw UND GUI private void DrawUndercoat(MaterialEditor editor) { NeoGUIHelper.PushTextColor(Color.white); NeoGUIHelper.PushBGColor(NeoGUIHelper.Colors.LightGrey); Styles.bShowUND = NeoGUIHelper.HeaderWithFoldout("1. undercoat (und)", Styles.bShowUND); NeoGUIHelper.PopTextColor(); NeoGUIHelper.PopBGColor(); if (!Styles.bShowUND) { return; } int prevIndent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; NeoGUIHelper.PushIndent(); { EditorGUILayout.Space(); DrawColorUND("1.1 UND COLOR", editor); EditorGUILayout.Space(); DrawShapeUND("1.2 UND SHAPE", editor); if (isComplexProfile) { EditorGUILayout.Space(); DrawDensityUND("1.3 UND DENSITY", editor); } EditorGUILayout.Space(); DrawHeightUND("1.4 UND HEIGHT", editor); if (isComplexProfile) { EditorGUILayout.Space(); DrawLightingUND("1.5 UND LIGHTING", editor); } } NeoGUIHelper.PopIndent(); EditorGUI.indentLevel = prevIndent; }
private void DrawAOValues(MaterialEditor editor) { if (isComplexProfile) { DoRangeProperty("Overall AO", _AOValue, editor); return; } if (!isMobileProfile) { Styles.bShowAOValues = NeoGUIHelper.HeaderWithFoldout("Ambient Occlusion", Styles.bShowAOValues); if (!Styles.bShowAOValues) { return; } } if (!isMobileProfile) { NeoGUIHelper.PushIndent(); } if (isOptimizedProfile) { DoRangeProperty("AO Occlusion", _AOValue, editor); } DoRangeProperty("AO Pattern", _AOPattern, editor); if (isOptimizedProfile) { DoRangeProperty("AO Pattern Darkness", _AOPatternDarkness, editor); } if (!isMobileProfile) { NeoGUIHelper.PopIndent(); } }
// Draw OVR GUI private void DrawOvercoat(MaterialEditor editor) { NeoGUIHelper.PushTextColor(Color.white); NeoGUIHelper.PushBGColor(NeoGUIHelper.Colors.LightGrey); Styles.bShowOVR = NeoGUIHelper.MaterialHeaderWithToggle(_bOVR, editor, "2. overcoat (OVR)", Styles.bShowOVR); NeoGUIHelper.PopTextColor(); NeoGUIHelper.PopBGColor(); if (!Styles.bShowOVR) { return; } EditorGUI.BeginDisabledGroup(_bOVR.floatValue == 0.0f); int prevIndent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; NeoGUIHelper.PushIndent(); { EditorGUILayout.Space(); DrawColorOVR("2.1 OVR COLOR", editor); EditorGUILayout.Space(); DrawShapeOVR("2.2 OVR SHAPE", editor); EditorGUILayout.Space(); DrawDensityOVR("2.3 OVR DENSITY", editor); EditorGUILayout.Space(); DrawHeightOVR("2.4 OVR HEIGHT", editor); EditorGUILayout.Space(); DrawLightingOVR("2.5 OVR LIGHTING", editor); } NeoGUIHelper.PopIndent(); EditorGUI.indentLevel = prevIndent; EditorGUI.EndDisabledGroup(); }
// Draw UND Density GUI private void DrawDensityUND(string label, MaterialEditor editor) { Styles.bShowDensityUND = NeoGUIHelper.MaterialHeaderWithToggle(_bDensityUND, editor, label, Styles.bShowDensityUND); if (!Styles.bShowDensityUND) { return; } EditorGUI.BeginDisabledGroup(_bDensityUND.floatValue == 0.0f); if (isComplexProfile) { bool bDensityMap = DoToggleProperty("Enable Density Map UND", _bDensityMapUND, editor); if (bDensityMap) { NeoGUIHelper.PushIndent(); editor.TextureProperty(_DensityMapUND, "Density Map UND"); DoRangeProperty("Min Density of strands UND", _DensityMinUND, editor); DoRangeProperty("Max Density of strands UND", _DensityMaxUND, editor); NeoGUIHelper.PopIndent(); } else { DoRangeProperty("Density of strands UND", _DensityUND, editor); } } else if (isOptimizedProfile) { editor.TextureProperty(_DensityMapUND, "Density Map UND"); DoRangeProperty("Min Density of strands UND", _DensityMinUND, editor); DoRangeProperty("Max Density of strands UND", _DensityMaxUND, editor); } EditorGUI.EndDisabledGroup(); }
// Draw UND Lighting GUI private void DrawLightingUND(string label, MaterialEditor editor) { Styles.bShowLightingUND = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowLightingUND); if (!Styles.bShowLightingUND) { return; } bool useDither = DoToggleProperty("Use animated dither", _bUseAnimatedDither, editor); if (useDither) { NeoGUIHelper.PushIndent(); DoRangeProperty("Dither amount", _DitherAmoutUND, editor); NeoGUIHelper.PopIndent(); } editor.TexturePropertySingleLine(Styles.GradientScatterMapLabelUND, _GradientScatterMapUND); DoRangeProperty("Smoothness UND", _RoughnessUND, editor); DoRangeProperty("Specular reflections breakup UND", _SpecularBreakupUND, editor); }
// Draw UND Color GUI private void DrawColorUND(string label, MaterialEditor editor) { Styles.bShowColorUND = NeoGUIHelper.HeaderWithFoldout(label, Styles.bShowColorUND); if (!Styles.bShowColorUND) { return; } if (isComplexProfile) { bool bColorMap = DoToggleProperty("Enable Color Map", _bColorMapUND, editor); if (bColorMap) // color maps { NeoGUIHelper.PushIndent(); bool bGradientMap = DoToggleProperty("Enable Gradient Map UND", _bGradientMapUND, editor); if (bGradientMap) { NeoGUIHelper.PushIndent(); DoToggleProperty("Color Gradient Root To Tip", _bGradientMapRootToTipUND, editor); //gradient map editor.TexturePropertySingleLine(Styles.GradientMapLabelUND, _GradientMapUND); NeoGUIHelper.PopIndent(); } else { // root and tip color maps editor.TextureProperty(_ColorRootMapUND, "Color Root Map UND"); editor.TextureProperty(_ColorTipMapUND, "Color Tip Map UND"); } //Textures can be tinted now. editor.ShaderProperty(_ColorTintRootUND, "Root Tint"); editor.ShaderProperty(_ColorTintTipUND, "Tip Tint"); NeoGUIHelper.PopIndent(); } else // color values { editor.ShaderProperty(_ColorRootUND, "Root Color"); editor.ShaderProperty(_ColorTipUND, "Tip Color"); } EditorGUILayout.Space(); // hue and value DoRangeProperty("Hue Variation", _HueVariationUND, editor); DoRangeProperty("Value Variation", _ValueVariationUND, editor); } else if (isOptimizedProfile) { bool bColorMapUND = DoToggleProperty("Use Color Maps", _bColorMapUND, editor); if (bColorMapUND) { editor.TextureProperty(_ColorRootMapUND, "Root Color Map UND"); editor.ColorProperty(_ColorTintRootUND, "Root Tint Color UND"); editor.TextureProperty(_ColorTipMapUND, "Tip Color Map UND"); editor.ColorProperty(_ColorTintTipUND, "Tip Tint Color UND"); } else { editor.ColorProperty(_ColorRootUND, "Root Color UND"); editor.ColorProperty(_ColorTipUND, "Tip Color UND"); } } else if (isMobileProfile) { editor.TextureProperty(_ColorTipMapUND, "Color Map"); } }
public override void OnInspectorGUI() { // update serializedObject with NFA's values serializedObject.Update(); FindProperties(); GUILayout.Space(15); projectIssueNotifications.OnGUI(); if (!TopSection(nfa)) { //early out serializedObject.ApplyModifiedProperties(); return; } GUILayout.Space(25); //fur material, only allow changes editor time if (!Application.isPlaying) { EditorGUILayout.PropertyField(matProp, Styles.labelFurryMat); } //fur submesh index //don't allow changing this at game time if (!Application.isPlaying) { EditorGUILayout.PropertyField(subMeshIndexProp, Styles.labelFurSubMesh); } // shell count, fur length, shell fade EditorGUILayout.PropertyField(shellCountProp, Styles.labelShellCount); EditorGUILayout.PropertyField(shellDistanceProp, Styles.labelFurLength); EditorGUILayout.PropertyField(shellDistanceScaleProp, Styles.labelShellFade); EditorGUILayout.PropertyField(shellOffsetProp, Styles.labelShellOffset); GUILayout.Space(25); //Preprocessing foldout //skip if not in editor mode if (!Application.isPlaying) { PreProcessSection(nfa); } bShadowsFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutShadows.text, bShadowsFolded); if (bShadowsFolded) { EditorGUI.indentLevel++; //shadow settings EditorGUILayout.PropertyField(renderSettingsProp, Styles.labelUseRenderSettings); if (!nfa.useRendererSettings) { EditorGUILayout.PropertyField(castShadowProp, Styles.labelShadowCastingMode); EditorGUILayout.PropertyField(receiveShadowsProp, Styles.labelRecieveShadows); } EditorGUI.indentLevel--; } //LOD foldout //In the past here we'd check for an assigned scene camera, as LOD is kind of meaningless //without the ability to check the distance to the camera. But alot of users are setting //up cameras in code, so they need to be able to edit these numbers. { bLODFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutLOD.text, bLODFolded); if (bLODFolded) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(lodStartDistProp, Styles.labelLODStartDist); EditorGUILayout.PropertyField(lodEndDistProp, Styles.labelLODEndDist); EditorGUILayout.PropertyField(lodMinShellCountProp, Styles.labelLODMinShellCount); EditorGUILayout.PropertyField(maxCamDistProp, Styles.labelLODMaxCamDist); //near compression stuff EditorGUILayout.PropertyField(nearCompressionDistProp, Styles.labelNearCompressionDist); EditorGUILayout.PropertyField(nearCompressionMinProp, Styles.labelNearCompressionMin); EditorGUILayout.PropertyField(nearCompressionMaxProp, Styles.labelNearCompressionMax); EditorGUI.indentLevel--; } } // Physics foldout bPhysicsFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutPhysics.text, bPhysicsFolded); if (bPhysicsFolded) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(velocityInfluenceProp, Styles.labelVelocityInfluence); EditorGUILayout.PropertyField(springLenStiffProp, Styles.labelSpringLenStiff); EditorGUILayout.PropertyField(springAngleStiffProp, Styles.labelSpringAngleStiff); EditorGUILayout.PropertyField(springDampMultProp, Styles.labelSpringDampMult); EditorGUILayout.PropertyField(gravityInfluenceProp, Styles.labelGravityInfluence); EditorGUILayout.PropertyField(airResistMultProp, Styles.labelAirResistMult); EditorGUILayout.PropertyField(maxStretchDistMultProp, Styles.labelMaxStretchDistMult); EditorGUILayout.PropertyField(minStretchDistMultProp, Styles.labelMinStretchDistMult); EditorGUILayout.PropertyField(maxRotFromNormalProp, Styles.labelMaxRotFromNormal); EditorGUILayout.PropertyField(radialForceInfluenceProp, Styles.labelRadialForceInfluence); EditorGUILayout.PropertyField(windProp, Styles.labelWind); if (windProp.objectReferenceValue != null) { NeoGUIHelper.PushIndent(); EditorGUILayout.PropertyField(windInfluenceProp, Styles.labelWindInfluence); NeoGUIHelper.PopIndent(); } EditorGUILayout.PropertyField(bendExponentProp, Styles.labelBendExponent); // normal direction blend EditorGUILayout.PropertyField(normalDirectionBlendProp, Styles.labelNormalDirection); EditorGUI.indentLevel--; } // Debug Draw foldout bDebugDrawFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutDebugDraw.text, bDebugDrawFolded); if (bDebugDrawFolded) { NeoFurAsset neoFurAsset = ((NeoFurAsset)target); EditorGUI.indentLevel++; if (neoFurAsset.vertexProcessor != null) { GUILayout.Label($"Average compute time: {(neoFurAsset.vertexProcessor.averageProcessTime*1000).ToString("0.00")}ms"); GUILayout.Label($"Active shells: {(neoFurAsset.lodShellCount)}"); } // debug: draw control points? EditorGUILayout.PropertyField(drawControlPointsProp, Styles.labelDrawControlPoints); // debug: draw fur guides? EditorGUILayout.PropertyField(drawGuidesProp, Styles.labelDrawFurGuides); // if the application is playing, then show the section for debug textures if (Application.isPlaying) { bDebugDrawTexturesFolded = NeoGUIHelper.HeaderWithFoldout(Styles.foldoutDebugDrawTextures.text, bDebugDrawTexturesFolded); if (bDebugDrawTexturesFolded) { int originalIndent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; if (neoFurAsset.vertexProcessor != null) { repaintDebugTextures = EditorGUILayout.Toggle("Live Update", repaintDebugTextures); neoFurAsset.vertexProcessor.DebugDraw(); } if (repaintDebugTextures) { Repaint(); } EditorGUI.indentLevel = originalIndent; } } EditorGUI.indentLevel--; } // send values from property fields back to NFA serializedObject.ApplyModifiedProperties(); //if runtime, do material editor at the bottom if (Application.isPlaying) { ValidateMaterialEditor(); // only do stuff with the material editor if it was instantiated if (mMatEdit && mMatEdit.target) { GUI.changed = false; EditorGUIUtility.labelWidth = 0; mMatEdit.DrawHeader(); mMatEdit.OnInspectorGUI(); bool didUndo = Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed"; if (GUI.changed || didUndo) { nfa.CreateMaterialInstance(); } } } }