@@ -630,9 +630,9 @@ void UpdateSizeOfOneTarget(DecalProjector currentTarget)
630
630
m_SizeValues [ axe ] . floatValue = newSize ;
631
631
}
632
632
633
- internal void MinMaxSliderWithFields ( GUIContent label , ref float minValue , ref float maxValue , float minLimit , float maxLimit )
633
+ internal void MinMaxSliderWithFields ( Rect rect , GUIContent label , ref float minValue , ref float maxValue , float minLimit , float maxLimit )
634
634
{
635
- var rect = EditorGUILayout . GetControlRect ( ) ;
635
+ // Reserve label space and push the slider rect to the right
636
636
rect = EditorGUI . PrefixLabel ( rect , label ) ;
637
637
638
638
const float fieldWidth = 40 , padding = 4 ;
@@ -662,6 +662,45 @@ internal void MinMaxSliderWithFields(GUIContent label, ref float minValue, ref f
662
662
}
663
663
}
664
664
665
+ void DoRenderingLayerMask ( )
666
+ {
667
+ Rect rect = EditorGUILayout . GetControlRect ( true , 18f ) ;
668
+ EditorGUI . BeginProperty ( rect , k_DecalLayerMaskContent , m_DecalLayerMask ) ;
669
+
670
+ var mask = m_DecalLayerMask . uintValue ;
671
+ EditorGUI . BeginChangeCheck ( ) ;
672
+ mask = EditorGUI . RenderingLayerMaskField ( rect , k_DecalLayerMaskContent , ( RenderingLayerMask ) mask , EditorStyles . layerMaskField ) ;
673
+ if ( EditorGUI . EndChangeCheck ( ) )
674
+ {
675
+ m_DecalLayerMask . intValue = unchecked ( ( int ) mask ) ;
676
+ serializedObject . ApplyModifiedProperties ( ) ;
677
+ }
678
+
679
+ EditorGUI . EndProperty ( ) ;
680
+ }
681
+
682
+ void DoAngleFade ( )
683
+ {
684
+ // The slider edits 2 different properties. Both can be overridden separately.
685
+ var rect = EditorGUILayout . GetControlRect ( ) ;
686
+ EditorGUI . BeginProperty ( rect , k_AngleFadeContent , m_StartAngleFadeProperty ) ;
687
+ EditorGUI . BeginProperty ( rect , k_AngleFadeContent , m_EndAngleFadeProperty ) ;
688
+
689
+ float angleFadeMinValue = m_StartAngleFadeProperty . floatValue ;
690
+ float angleFadeMaxValue = m_EndAngleFadeProperty . floatValue ;
691
+ EditorGUI . BeginChangeCheck ( ) ;
692
+ MinMaxSliderWithFields ( rect , k_AngleFadeContent , ref angleFadeMinValue , ref angleFadeMaxValue , 0.0f , 180.0f ) ;
693
+ if ( EditorGUI . EndChangeCheck ( ) )
694
+ {
695
+ m_StartAngleFadeProperty . floatValue = angleFadeMinValue ;
696
+ m_EndAngleFadeProperty . floatValue = angleFadeMaxValue ;
697
+ serializedObject . ApplyModifiedProperties ( ) ;
698
+ }
699
+
700
+ EditorGUI . EndProperty ( ) ;
701
+ EditorGUI . EndProperty ( ) ;
702
+ }
703
+
665
704
public override void OnInspectorGUI ( )
666
705
{
667
706
bool supportDecals = false ;
@@ -735,14 +774,7 @@ public override void OnInspectorGUI()
735
774
decalLayerEnabled = supportDecals && hdrp . currentPlatformRenderPipelineSettings . supportDecalLayers ;
736
775
using ( new EditorGUI . DisabledScope ( ! decalLayerEnabled ) )
737
776
{
738
- var mask = m_DecalLayerMask . uintValue ;
739
- EditorGUI . BeginChangeCheck ( ) ;
740
- mask = EditorGUILayout . RenderingLayerMaskField ( k_DecalLayerMaskContent , mask ) ;
741
- if ( EditorGUI . EndChangeCheck ( ) )
742
- {
743
- m_DecalLayerMask . intValue = unchecked ( ( int ) mask ) ;
744
- EditorUtility . SetDirty ( m_DecalLayerMask . serializedObject . targetObject ) ;
745
- }
777
+ DoRenderingLayerMask ( ) ;
746
778
}
747
779
}
748
780
@@ -758,15 +790,7 @@ public override void OnInspectorGUI()
758
790
EditorGUILayout . PropertyField ( m_FadeScaleProperty , k_FadeScaleContent ) ;
759
791
using ( new EditorGUI . DisabledScope ( ! decalLayerEnabled ) )
760
792
{
761
- float angleFadeMinValue = m_StartAngleFadeProperty . floatValue ;
762
- float angleFadeMaxValue = m_EndAngleFadeProperty . floatValue ;
763
- EditorGUI . BeginChangeCheck ( ) ;
764
- MinMaxSliderWithFields ( k_AngleFadeContent , ref angleFadeMinValue , ref angleFadeMaxValue , 0.0f , 180.0f ) ;
765
- if ( EditorGUI . EndChangeCheck ( ) )
766
- {
767
- m_StartAngleFadeProperty . floatValue = angleFadeMinValue ;
768
- m_EndAngleFadeProperty . floatValue = angleFadeMaxValue ;
769
- }
793
+ DoAngleFade ( ) ;
770
794
}
771
795
772
796
if ( ! decalLayerEnabled )
@@ -985,7 +1009,7 @@ public override void Action(int instanceId, string pathName, string resourceFile
985
1009
}
986
1010
987
1011
if ( shader != null )
988
- {
1012
+ {
989
1013
var material = new Material ( shader ) ;
990
1014
AssetDatabase . CreateAsset ( material , materialName ) ;
991
1015
ProjectWindowUtil . ShowCreatedAsset ( material ) ;
0 commit comments