54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
|  | using System; | ||
|  | using UnityEngine; | ||
|  | using UnityEditor.Rendering.Universal; | ||
|  | using static Unity.Rendering.Universal.ShaderUtils; | ||
|  | 
 | ||
|  | namespace UnityEditor | ||
|  | { | ||
|  |     // Used for ShaderGraph Unlit shaders | ||
|  |     class ShaderGraphUnlitGUI : BaseShaderGUI | ||
|  |     { | ||
|  |         MaterialProperty[] properties; | ||
|  | 
 | ||
|  |         // collect properties from the material properties | ||
|  |         public override void FindProperties(MaterialProperty[] properties) | ||
|  |         { | ||
|  |             // save off the list of all properties for shadergraph | ||
|  |             this.properties = properties; | ||
|  | 
 | ||
|  |             base.FindProperties(properties); | ||
|  |         } | ||
|  | 
 | ||
|  |         public static void UpdateMaterial(Material material, MaterialUpdateType updateType) | ||
|  |         { | ||
|  |             bool automaticRenderQueue = GetAutomaticQueueControlSetting(material); | ||
|  |             BaseShaderGUI.UpdateMaterialSurfaceOptions(material, automaticRenderQueue); | ||
|  |             BaseShaderGUI.UpdateMotionVectorKeywordsAndPass(material); | ||
|  | #if ENABLE_VR && ENABLE_XR_MODULE | ||
|  |             BaseShaderGUI.UpdateXRMotionVectorKeywordsAndPass(material); | ||
|  | #endif | ||
|  |         } | ||
|  | 
 | ||
|  |         public override void ValidateMaterial(Material material) | ||
|  |         { | ||
|  |             UpdateMaterial(material, MaterialUpdateType.ModifiedMaterial); | ||
|  |         } | ||
|  | 
 | ||
|  |         // material main surface inputs | ||
|  |         public override void DrawSurfaceInputs(Material material) | ||
|  |         { | ||
|  |             DrawShaderGraphProperties(material, properties); | ||
|  |         } | ||
|  | 
 | ||
|  |         public override void DrawAdvancedOptions(Material material) | ||
|  |         { | ||
|  |             // Always show the queue control field.  Only show the render queue field if queue control is set to user override | ||
|  |             DoPopup(Styles.queueControl, queueControlProp, Styles.queueControlNames); | ||
|  |             if (material.HasProperty(Property.QueueControl) && material.GetFloat(Property.QueueControl) == (float)QueueControl.UserOverride) | ||
|  |                 materialEditor.RenderQueueField(); | ||
|  |             base.DrawAdvancedOptions(material); | ||
|  |             materialEditor.DoubleSidedGIField(); | ||
|  |         } | ||
|  |     } | ||
|  | } // namespace UnityEditor |