yum-archive/Tooner
A toon shader for Unity's BIRP.
git clone https://git.yummers.dev/yum-archive/Tooner
9b52e08
master
1using System ; 2using System . Collections . Generic ; 3using UnityEngine ; 4using UnityEngine . Rendering ; 5using UnityEditor ; 6 7public class ToonerGUI : ShaderGUI { 8Material target ; 9MaterialEditor editor ; 10MaterialProperty [] properties ; 11List < bool > show_ui ; 12 13public override void OnGUI ( 14MaterialEditor editor , 15MaterialProperty [] properties ) { 16this . target = editor . target as Material ; 17this . editor = editor ; 18this . properties = properties ; 19this . show_ui = new List < bool > (); 20DoMain (); 21} 22 23void TexturePropertySingleLine ( GUIContent label , MaterialProperty bct ) 24{ 25if ( show_ui . Contains ( false )) { 26return ; 27} 28editor . TexturePropertySingleLine ( label , bct ); 29} 30void TexturePropertySingleLine ( GUIContent label , MaterialProperty bct , MaterialProperty bc ) 31{ 32if ( show_ui . Contains ( false )) { 33return ; 34} 35editor . TexturePropertySingleLine ( label , bct , bc ); 36} 37void TexturePropertyWithHDRColor ( GUIContent label , MaterialProperty bct , MaterialProperty bc , bool opt ) 38{ 39if ( show_ui . Contains ( false )) { 40return ; 41} 42editor . TexturePropertyWithHDRColor ( label , bct , bc , opt ); 43} 44void TextureScaleOffsetProperty ( MaterialProperty bc ) 45{ 46if ( show_ui . Contains ( false )) { 47return ; 48} 49editor . TextureScaleOffsetProperty ( bc ); 50} 51void RangeProperty ( MaterialProperty bc , string label ) 52{ 53if ( show_ui . Contains ( false )) { 54return ; 55} 56editor . RangeProperty ( bc , label ); 57} 58void ShaderProperty ( MaterialProperty bc , GUIContent label ) 59{ 60if ( show_ui . Contains ( false )) { 61return ; 62} 63editor . ShaderProperty ( bc , label ); 64} 65void FloatProperty ( MaterialProperty bc , string label ) 66{ 67if ( show_ui . Contains ( false )) { 68return ; 69} 70editor . FloatProperty ( bc , label ); 71} 72void IntegerProperty ( MaterialProperty bc , string label ) 73{ 74if ( show_ui . Contains ( false )) { 75return ; 76} 77editor . IntegerProperty ( bc , label ); 78} 79void VectorProperty ( MaterialProperty bc , string label ) 80{ 81if ( show_ui . Contains ( false )) { 82return ; 83} 84editor . VectorProperty ( bc , label ); 85} 86void ColorProperty ( MaterialProperty bc , string label ) 87{ 88if ( show_ui . Contains ( false )) { 89return ; 90} 91editor . ColorProperty ( bc , label ); 92} 93Enum EnumPopup ( GUIContent label , Enum selected ) 94{ 95if ( show_ui . Contains ( false )) { 96return selected ; 97} 98return EditorGUILayout . EnumPopup ( label , selected ); 99} 100bool Toggle ( string label , bool v ) 101{ 102if ( show_ui . Contains ( false )) { 103return v ; 104} 105return EditorGUILayout . Toggle ( label , v ); 106} 107void LabelField ( string label ) 108{ 109if ( show_ui . Contains ( false )) { 110return ; 111} 112EditorGUILayout . LabelField ( label ); 113} 114void LabelField ( string label , UnityEngine . GUIStyle style ) 115{ 116if ( show_ui . Contains ( false )) { 117return ; 118} 119EditorGUILayout . LabelField ( label , style ); 120} 121 122static GUIContent staticLabel = new GUIContent (); 123 124static GUIContent MakeLabel ( string prop , string tooltip = null ) { 125staticLabel . text = prop ; 126staticLabel . tooltip = tooltip ; 127return staticLabel ; 128} 129 130static GUIContent MakeLabel ( MaterialProperty prop , string tooltip = null ) { 131staticLabel . text = prop . displayName ; 132staticLabel . tooltip = tooltip ; 133return staticLabel ; 134} 135 136void RecordAction ( string label ) { 137editor . RegisterPropertyChangeUndo ( label ); 138} 139 140MaterialProperty FindProperty ( string label ) { 141return FindProperty ( label , properties ); 142} 143 144void SetKeyword ( string keyword , bool state ) { 145if ( state ) { 146target . EnableKeyword ( keyword ); 147} else { 148target . DisableKeyword ( keyword ); 149} 150} 151 152void DoBaseColor () { 153MaterialProperty bc = FindProperty ( "_Color" ); 154MaterialProperty bct = FindProperty ( "_MainTex" ); 155TexturePropertySingleLine ( 156MakeLabel ( bct , "Base color (RGBA)" ), 157bct , 158bc ); 159SetKeyword ( "_BASECOLOR_MAP" , bct . textureValue ); 160if ( bct . textureValue ) { 161TextureScaleOffsetProperty ( bct ); 162} 163} 164 165void DoNormal () { 166MaterialProperty bct = FindProperty ( "_BumpMap" ); 167TexturePropertySingleLine ( 168MakeLabel ( bct , "Normal" ), 169bct , 170FindProperty ( "_Tex_NormalStr" )); 171if ( bct . textureValue ) { 172TextureScaleOffsetProperty ( bct ); 173} 174SetKeyword ( "_NORMAL_MAP" , bct . textureValue ); 175} 176 177void DoMetallic () { 178MaterialProperty bc = FindProperty ( "_Metallic" ); 179MaterialProperty bct = FindProperty ( "_MetallicTex" ); 180TexturePropertySingleLine ( 181MakeLabel ( bct , "Metallic (RGBA)" ), 182bct , 183bc ); 184SetKeyword ( "_METALLIC_MAP" , bct . textureValue ); 185if ( bct . textureValue ) { 186TextureScaleOffsetProperty ( bct ); 187 188bc = FindProperty ( "_MetallicTexChannel" ); 189RangeProperty ( bc , "Channel" ); 190} 191} 192 193void DoRoughness () { 194MaterialProperty bc = FindProperty ( "_Roughness" ); 195MaterialProperty bct = FindProperty ( "_RoughnessTex" ); 196TexturePropertySingleLine ( 197MakeLabel ( bct , "Roughness (RGBA)" ), 198bct , 199bc ); 200SetKeyword ( "_ROUGHNESS_MAP" , bct . textureValue ); 201if ( bct . textureValue ) { 202TextureScaleOffsetProperty ( bct ); 203 204bc = FindProperty ( "_RoughnessTexChannel" ); 205RangeProperty ( bc , "Channel" ); 206 207bc = FindProperty ( "_Roughness_Invert" ); 208bool enabled = bc . floatValue > 1E-6 ; 209EditorGUI . BeginChangeCheck (); 210enabled = Toggle ( "Invert" , enabled ); 211EditorGUI . EndChangeCheck (); 212bc . floatValue = enabled ? 1.0f : 0.0f ; 213} 214} 215 216bool AddCollapsibleMenu ( string name , string matprop ) { 217MaterialProperty bc = FindProperty ( matprop + "_UI_Show" ); 218bool enabled = bc . floatValue > 1E-6 ; 219EditorGUI . BeginChangeCheck (); 220var fs_orig = EditorStyles . label . fontStyle ; 221EditorStyles . label . fontStyle = FontStyle . Bold ; 222enabled = Toggle ( name , enabled ); 223EditorStyles . label . fontStyle = fs_orig ; 224EditorGUI . EndChangeCheck (); 225bc . floatValue = enabled ? 1.0f : 0.0f ; 226 227return enabled ; 228} 229 230// Why do the cartesian product here rather than in C? Easier to do it here 231// than with C macros! 232enum SamplerMode { 233// Why this order? Backwards compatibility when interpolation selection was introduced 234LinearRepeat , 235LinearClamp , 236PointRepeat , 237PointClamp , 238BilinearRepeat , 239BilinearClamp , 240} ; 241void DoPBR () { 242show_ui . Add ( AddCollapsibleMenu ( "PBR" , "_PBR" )); 243EditorGUI . indentLevel += 1 ; 244{ 245DoBaseColor (); 246DoNormal (); 247DoMetallic (); 248DoRoughness (); 249 250EditorGUI . BeginChangeCheck (); 251MaterialProperty bc = FindProperty ( $"_PBR_Sampler_Mode" ); 252SamplerMode sampler_mode = ( SamplerMode ) Math . Round ( bc . floatValue ); 253sampler_mode = ( SamplerMode ) EnumPopup ( 254MakeLabel ( "Sampler mode" ), sampler_mode ); 255EditorGUI . EndChangeCheck (); 256bc . floatValue = ( int ) sampler_mode ; 257 258SetKeyword ( $"_PBR_SAMPLER_LINEAR_REPEAT" , sampler_mode == SamplerMode . LinearRepeat ); 259SetKeyword ( $"_PBR_SAMPLER_LINEAR_CLAMP" , sampler_mode == SamplerMode . LinearClamp ); 260SetKeyword ( $"_PBR_SAMPLER_BILINEAR_REPEAT" , sampler_mode == SamplerMode . BilinearRepeat ); 261SetKeyword ( $"_PBR_SAMPLER_BILINEAR_CLAMP" , sampler_mode == SamplerMode . BilinearClamp ); 262SetKeyword ( $"_PBR_SAMPLER_POINT_REPEAT" , sampler_mode == SamplerMode . PointRepeat ); 263SetKeyword ( $"_PBR_SAMPLER_POINT_CLAMP" , sampler_mode == SamplerMode . PointClamp ); 264} 265EditorGUI . indentLevel -= 1 ; 266show_ui . RemoveAt ( show_ui . Count - 1 ); 267} 268 269void DoClearcoat () { 270show_ui . Add ( AddCollapsibleMenu ( $"Clearcoat" , $"_Clearcoat" )); 271EditorGUI . indentLevel += 1 ; 272 273MaterialProperty bc ; 274bc = FindProperty ( "_Clearcoat_Enabled" ); 275bool enabled = bc . floatValue > 1E-6 ; 276EditorGUI . BeginChangeCheck (); 277enabled = Toggle ( "Enable clearcoat" , enabled ); 278EditorGUI . EndChangeCheck (); 279bc . floatValue = enabled ? 1.0f : 0.0f ; 280SetKeyword ( "_CLEARCOAT" , enabled ); 281 282if ( enabled ) { 283bc = FindProperty ( "_Clearcoat_Strength" ); 284RangeProperty ( bc , "Strength" ); 285bc = FindProperty ( "_Clearcoat_Roughness" ); 286RangeProperty ( bc , "Roughness" ); 287bc = FindProperty ( "_Clearcoat_Mask" ); 288TexturePropertySingleLine ( MakeLabel ( bc , "Mask" ), bc ); 289SetKeyword ( $"_CLEARCOAT_MASK" , bc . textureValue ); 290 291if ( bc . textureValue ) { 292EditorGUI . indentLevel += 1 ; 293bc = FindProperty ( "_Clearcoat_Mask_Invert" ); 294enabled = bc . floatValue > 1E-6 ; 295EditorGUI . BeginChangeCheck (); 296enabled = Toggle ( "Invert mask" , enabled ); 297EditorGUI . EndChangeCheck (); 298bc . floatValue = enabled ? 1.0f : 0.0f ; 299EditorGUI . indentLevel -= 1 ; 300} 301 302bc = FindProperty ( "_Clearcoat_Mask2" ); 303TexturePropertySingleLine ( MakeLabel ( bc , "Mask 2" ), bc ); 304SetKeyword ( $"_CLEARCOAT_MASK2" , bc . textureValue ); 305 306if ( bc . textureValue ) { 307EditorGUI . indentLevel += 1 ; 308bc = FindProperty ( "_Clearcoat_Mask2_Invert" ); 309enabled = bc . floatValue > 1E-6 ; 310EditorGUI . BeginChangeCheck (); 311enabled = Toggle ( "Invert mask" , enabled ); 312EditorGUI . EndChangeCheck (); 313bc . floatValue = enabled ? 1.0f : 0.0f ; 314EditorGUI . indentLevel -= 1 ; 315} 316 317bc = FindProperty ( "_Clearcoat_Use_Texture_Normals" ); 318enabled = bc . floatValue > 1E-6 ; 319EditorGUI . BeginChangeCheck (); 320enabled = Toggle ( "Use texture normals" , enabled ); 321EditorGUI . EndChangeCheck (); 322bc . floatValue = enabled ? 1.0f : 0.0f ; 323} 324EditorGUI . indentLevel -= 1 ; 325show_ui . RemoveAt ( show_ui . Count - 1 ); 326} 327 328enum PbrAlbedoMixMode { 329AlphaBlend , 330Add , 331Min , 332Max , 333Multiply 334} ; 335 336void DoPBROverlay () { 337show_ui . Add ( AddCollapsibleMenu ( $"PBR overlays" , $"_PBR_Overlay" )); 338EditorGUI . indentLevel += 1 ; 339for ( int i = 0 ; i < 4 ; i ++ ) { 340show_ui . Add ( AddCollapsibleMenu ( $"PBR overlay { i } " , $"_PBR_Overlay { i } " )); 341EditorGUI . indentLevel += 1 ; 342 343MaterialProperty bc = FindProperty ( $"_PBR_Overlay { i } _Enable" ); 344bool enabled = bc . floatValue > 1E-6 ; 345EditorGUI . BeginChangeCheck (); 346enabled = Toggle ( "Enable" , enabled ); 347EditorGUI . EndChangeCheck (); 348bc . floatValue = enabled ? 1.0f : 0.0f ; 349SetKeyword ( $"_PBR_OVERLAY { i } " , enabled ); 350 351if ( enabled ) { 352bc = FindProperty ( $"_PBR_Overlay { i } _BaseColor" ); 353MaterialProperty bct = FindProperty ( $"_PBR_Overlay { i } _BaseColorTex" ); 354TexturePropertySingleLine ( 355MakeLabel ( bct , "Base color (RGBA)" ), 356bct , 357bc ); 358if ( bct . textureValue ) { 359TextureScaleOffsetProperty ( bct ); 360} 361SetKeyword ( $"_PBR_OVERLAY { i } _BASECOLOR_MAP" , bct . textureValue ); 362 363EditorGUI . BeginChangeCheck (); 364bc = FindProperty ( $"_PBR_Overlay { i } _Mix" ); 365PbrAlbedoMixMode mode = ( PbrAlbedoMixMode ) Math . Round ( bc . floatValue ); 366mode = ( PbrAlbedoMixMode ) EnumPopup ( 367MakeLabel ( "Mix mode" ), mode ); 368if ( EditorGUI . EndChangeCheck ()) { 369RecordAction ( $"PBR overlay mix mode { i } " ); 370foreach ( Material m in editor . targets ) { 371m . SetFloat ( $"_PBR_Overlay { i } _Mix" , ( int ) mode ); 372} 373} 374SetKeyword ( $"_PBR_OVERLAY { i } _MIX_ALPHA_BLEND" , mode == PbrAlbedoMixMode . AlphaBlend ); 375SetKeyword ( $"_PBR_OVERLAY { i } _MIX_ADD" , mode == PbrAlbedoMixMode . Add ); 376SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MIN" , mode == PbrAlbedoMixMode . Min ); 377SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MAX" , mode == PbrAlbedoMixMode . Max ); 378SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MULTIPLY" , mode == PbrAlbedoMixMode . Multiply ); 379 380bc = FindProperty ( $"_PBR_Overlay { i } _Constrain_By_Alpha" ); 381enabled = bc . floatValue > 1E-6 ; 382EditorGUI . BeginChangeCheck (); 383enabled = Toggle ( "Constrain to transparent sections" , enabled ); 384EditorGUI . EndChangeCheck (); 385bc . floatValue = enabled ? 1.0f : 0.0f ; 386if ( enabled ) { 387EditorGUI . indentLevel += 1 ; 388bc = FindProperty ( $"_PBR_Overlay { i } _Constrain_By_Alpha_Min" ); 389RangeProperty ( bc , "Min" ); 390bc = FindProperty ( $"_PBR_Overlay { i } _Constrain_By_Alpha_Max" ); 391RangeProperty ( bc , "Max" ); 392EditorGUI . indentLevel -= 1 ; 393} 394bc = FindProperty ( $"_PBR_Overlay { i } _Alpha_Multiplier" ); 395RangeProperty ( bc , "Alpha multiplier" ); 396 397bc = FindProperty ( $"_PBR_Overlay { i } _Emission" ); 398bct = FindProperty ( $"_PBR_Overlay { i } _EmissionTex" ); 399TexturePropertySingleLine ( 400MakeLabel ( bct , "Emission (RGB)" ), 401bct , 402bc ); 403if ( bct . textureValue ) { 404TextureScaleOffsetProperty ( bct ); 405} 406SetKeyword ( $"_PBR_OVERLAY { i } _EMISSION_MAP" , bct . textureValue ); 407 408bct = FindProperty ( $"_PBR_Overlay { i } _NormalTex" ); 409TexturePropertySingleLine ( 410MakeLabel ( bct , "Normal" ), 411bct , 412FindProperty ( $"_PBR_Overlay { i } _Tex_NormalStr" )); 413if ( bct . textureValue ) { 414TextureScaleOffsetProperty ( bct ); 415} 416SetKeyword ( $"_PBR_OVERLAY { i } _NORMAL_MAP" , bct . textureValue ); 417 418bc = FindProperty ( $"_PBR_Overlay { i } _Metallic_Enable" ); 419enabled = bc . floatValue > 1E-6 ; 420EditorGUI . BeginChangeCheck (); 421enabled = Toggle ( "Enable metallic" , enabled ); 422EditorGUI . EndChangeCheck (); 423bc . floatValue = enabled ? 1.0f : 0.0f ; 424SetKeyword ( $"_PBR_OVERLAY { i } _METALLIC" , enabled ); 425 426if ( enabled ) { 427bc = FindProperty ( $"_PBR_Overlay { i } _Metallic" ); 428bct = FindProperty ( $"_PBR_Overlay { i } _MetallicTex" ); 429TexturePropertySingleLine ( 430MakeLabel ( bct , "Metallic (RGBA)" ), 431bct , 432bc ); 433if ( bct . textureValue ) { 434TextureScaleOffsetProperty ( bct ); 435} 436SetKeyword ( $"_PBR_OVERLAY { i } _METALLIC_MAP" , bct . textureValue ); 437} 438 439bc = FindProperty ( $"_PBR_Overlay { i } _Roughness_Enable" ); 440enabled = bc . floatValue > 1E-6 ; 441EditorGUI . BeginChangeCheck (); 442enabled = Toggle ( "Enable roughness" , enabled ); 443EditorGUI . EndChangeCheck (); 444bc . floatValue = enabled ? 1.0f : 0.0f ; 445SetKeyword ( $"_PBR_OVERLAY { i } _ROUGHNESS" , enabled ); 446 447if ( enabled ) { 448EditorGUI . indentLevel += 1 ; 449bc = FindProperty ( $"_PBR_Overlay { i } _Roughness" ); 450bct = FindProperty ( $"_PBR_Overlay { i } _RoughnessTex" ); 451TexturePropertySingleLine ( 452MakeLabel ( bct , "Roughness (RGBA)" ), 453bct , 454bc ); 455if ( bct . textureValue ) { 456TextureScaleOffsetProperty ( bct ); 457} 458SetKeyword ( $"_PBR_OVERLAY { i } _ROUGHNESS_MAP" , bct . textureValue ); 459EditorGUI . indentLevel -= 1 ; 460} 461 462bct = FindProperty ( $"_PBR_Overlay { i } _Mask" ); 463TexturePropertySingleLine ( 464MakeLabel ( bct , "Mask" ), 465bct ); 466SetKeyword ( $"_PBR_OVERLAY { i } _MASK" , bct . textureValue ); 467 468if ( bct . textureValue ) { 469TextureScaleOffsetProperty ( bct ); 470 471bc = FindProperty ( $"_PBR_Overlay { i } _Mask_Invert" ); 472enabled = bc . floatValue > 1E-6 ; 473EditorGUI . BeginChangeCheck (); 474enabled = Toggle ( "Invert mask" , enabled ); 475EditorGUI . EndChangeCheck (); 476bc . floatValue = enabled ? 1.0f : 0.0f ; 477} 478 479bc = FindProperty ( $"_PBR_Overlay { i } _UV_Select" ); 480RangeProperty ( 481bc , 482"UV channel" ); 483 484bc = FindProperty ( $"_PBR_Overlay { i } _Mask_Glitter" ); 485enabled = bc . floatValue > 1E-6 ; 486EditorGUI . BeginChangeCheck (); 487enabled = Toggle ( "Mask glitter" , enabled ); 488EditorGUI . EndChangeCheck (); 489bc . floatValue = enabled ? 1.0f : 0.0f ; 490 491EditorGUI . BeginChangeCheck (); 492bc = FindProperty ( $"_PBR_Overlay { i } _Sampler_Mode" ); 493SamplerMode sampler_mode = ( SamplerMode ) Math . Round ( bc . floatValue ); 494sampler_mode = ( SamplerMode ) EnumPopup ( 495MakeLabel ( "Sampler wrapping mode" ), sampler_mode ); 496EditorGUI . EndChangeCheck (); 497bc . floatValue = ( int ) sampler_mode ; 498SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_LINEAR_REPEAT" , sampler_mode == SamplerMode . LinearRepeat ); 499SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_LINEAR_CLAMP" , sampler_mode == SamplerMode . LinearClamp ); 500SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_BILINEAR_REPEAT" , sampler_mode == SamplerMode . BilinearRepeat ); 501SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_BILINEAR_CLAMP" , sampler_mode == SamplerMode . BilinearClamp ); 502SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_POINT_REPEAT" , sampler_mode == SamplerMode . PointRepeat ); 503SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_POINT_CLAMP" , sampler_mode == SamplerMode . PointClamp ); 504 505bc = FindProperty ( $"_PBR_Overlay { i } _Mip_Bias" ); 506FloatProperty ( bc , "Mip bias" ); 507} else { 508SetKeyword ( $"_PBR_OVERLAY { i } _BASECOLOR_MAP" , false ); 509SetKeyword ( $"_PBR_OVERLAY { i } _MIX_ALPHA_BLEND" , false ); 510SetKeyword ( $"_PBR_OVERLAY { i } _MIX_ADD" , false ); 511SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MIN" , false ); 512SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MAX" , false ); 513SetKeyword ( $"_PBR_OVERLAY { i } _MIX_MULTIPLY" , false ); 514SetKeyword ( $"_PBR_OVERLAY { i } _EMISSION_MAP" , false ); 515SetKeyword ( $"_PBR_OVERLAY { i } _NORMAL_MAP" , false ); 516SetKeyword ( $"_PBR_OVERLAY { i } _METALLIC_MAP" , false ); 517SetKeyword ( $"_PBR_OVERLAY { i } _ROUGHNESS_MAP" , false ); 518SetKeyword ( $"_PBR_OVERLAY { i } _MASK" , false ); 519SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_REPEAT" , false ); 520SetKeyword ( $"_PBR_OVERLAY { i } _SAMPLER_CLAMP" , false ); 521} 522EditorGUI . indentLevel -= 1 ; 523show_ui . RemoveAt ( show_ui . Count - 1 ); 524} 525EditorGUI . indentLevel -= 1 ; 526show_ui . RemoveAt ( show_ui . Count - 1 ); 527} 528 529enum TilingMode { 530Clamp , 531Repeat , 532} ; 533enum BaseColorMode { 534Color , 535SDF , 536} ; 537void DoDecal () { 538show_ui . Add ( AddCollapsibleMenu ( "Decals" , "_Decal" )); 539EditorGUI . indentLevel += 1 ; 540for ( int i = 0 ; i < 10 ; i ++ ) { 541show_ui . Add ( AddCollapsibleMenu ( $"Decal { i } " , $"_Decal { i } " )); 542EditorGUI . indentLevel += 1 ; 543 544MaterialProperty bc = FindProperty ( $"_Decal { i } _Enable" ); 545bool enabled = bc . floatValue > 1E-6 ; 546EditorGUI . BeginChangeCheck (); 547enabled = Toggle ( "Enable" , enabled ); 548EditorGUI . EndChangeCheck (); 549bc . floatValue = enabled ? 1.0f : 0.0f ; 550SetKeyword ( $"_DECAL { i } " , enabled ); 551 552if ( enabled ) { 553// Add up/down buttons in a horizontal layout 554EditorGUILayout . BeginHorizontal (); 555if ( i > 0 && GUILayout . Button ( "↑" , GUILayout . Width ( 30 ))) { 556SwapDecalSlots ( i - 1 , i ); 557} 558if ( i < 9 && GUILayout . Button ( "↓" , GUILayout . Width ( 30 ))) { 559SwapDecalSlots ( i , i + 1 ); 560} 561EditorGUILayout . EndHorizontal (); 562 563MaterialProperty bct ; 564bc = FindProperty ( $"_Decal { i } _Color" ); 565bct = FindProperty ( $"_Decal { i } _BaseColor" ); 566TexturePropertySingleLine ( MakeLabel ( bct , "Base color (RGBA)" ), bct , bc ); 567// Unconditionally drive scale + offset because it affects all textures. 568TextureScaleOffsetProperty ( bct ); 569 570bc = FindProperty ( $"_Decal { i } _BaseColor_Mode" ); 571BaseColorMode base_color_mode = ( BaseColorMode ) Math . Round ( bc . floatValue ); 572base_color_mode = ( BaseColorMode ) EnumPopup ( MakeLabel ( "Base color mode" ), base_color_mode ); 573bc . floatValue = ( int ) base_color_mode ; 574 575if ( base_color_mode == BaseColorMode . SDF ) { 576bc = FindProperty ( $"_Decal { i } _SDF_Threshold" ); 577RangeProperty ( bc , "SDF threshold" ); 578 579bc = FindProperty ( $"_Decal { i } _SDF_Softness" ); 580RangeProperty ( bc , "SDF softness" ); 581 582bc = FindProperty ( $"_Decal { i } _SDF_Px_Range" ); 583FloatProperty ( bc , "SDF px range" ); 584 585bc = FindProperty ( $"_Decal { i } _SDF_Invert" ); 586enabled = bc . floatValue > 1E-6 ; 587EditorGUI . BeginChangeCheck (); 588enabled = Toggle ( "Invert SDF" , enabled ); 589EditorGUI . EndChangeCheck (); 590bc . floatValue = enabled ? 1.0f : 0.0f ; 591} 592 593bc = FindProperty ( $"_Decal { i } _Roughness" ); 594TexturePropertySingleLine ( 595MakeLabel ( bc , "Roughness" ), 596bc ); 597SetKeyword ( $"_DECAL { i } _ROUGHNESS" , bc . textureValue ); 598 599bc = FindProperty ( $"_Decal { i } _Metallic" ); 600TexturePropertySingleLine ( 601MakeLabel ( bc , "Metallic" ), 602bc ); 603SetKeyword ( $"_DECAL { i } _METALLIC" , bc . textureValue ); 604 605bc = FindProperty ( $"_Decal { i } _Emission_Strength" ); 606FloatProperty ( 607bc , 608"Emission strength" ); 609bc = FindProperty ( $"_Decal { i } _Angle" ); 610RangeProperty ( 611bc , 612"Angle" ); 613 614bc = FindProperty ( $"_Decal { i } _Alpha_Multiplier" ); 615RangeProperty ( bc , "Alpha multiplier" ); 616 617bc = FindProperty ( $"_Decal { i } _Round_Alpha_Multiplier" ); 618enabled = bc . floatValue > 1E-6 ; 619EditorGUI . BeginChangeCheck (); 620enabled = Toggle ( "Round alpha multiplier" , enabled ); 621EditorGUI . EndChangeCheck (); 622bc . floatValue = enabled ? 1.0f : 0.0f ; 623 624bct = FindProperty ( $"_Decal { i } _Mask" ); 625TexturePropertySingleLine ( MakeLabel ( bct , "Mask" ), bct ); 626SetKeyword ( $"_DECAL { i } _MASK" , bct . textureValue ); 627 628if ( bct . textureValue ) { 629bc = FindProperty ( $"_Decal { i } _Mask_Invert" ); 630enabled = bc . floatValue > 1E-6 ; 631EditorGUI . BeginChangeCheck (); 632enabled = Toggle ( "Invert mask" , enabled ); 633EditorGUI . EndChangeCheck (); 634bc . floatValue = enabled ? 1.0f : 0.0f ; 635} 636 637bc = FindProperty ( $"_Decal { i } _Tiling_Mode" ); 638TilingMode tiling_mode = ( TilingMode ) Math . Round ( bc . floatValue ); 639tiling_mode = ( TilingMode ) EnumPopup ( 640MakeLabel ( "Tiling mode" ), tiling_mode ); 641bc . floatValue = ( int ) tiling_mode ; 642 643bc = FindProperty ( $"_Decal { i } _UV_Select" ); 644RangeProperty ( 645bc , 646"UV channel" ); 647 648bc = FindProperty ( $"_Decal { i } _Domain_Warping_Enable_Static" ); 649enabled = bc . floatValue > 1E-6 ; 650EditorGUI . BeginChangeCheck (); 651enabled = Toggle ( "Enable domain warping" , enabled ); 652EditorGUI . EndChangeCheck (); 653bc . floatValue = enabled ? 1.0f : 0.0f ; 654SetKeyword ( $"_DECAL { i } _DOMAIN_WARPING" , enabled ); 655 656if ( enabled ) { 657bc = FindProperty ( $"_Decal { i } _Domain_Warping_Noise" ); 658TexturePropertySingleLine ( MakeLabel ( bc , "Domain warping noise" ), bc ); 659bc = FindProperty ( $"_Decal { i } _Domain_Warping_Strength" ); 660FloatProperty ( bc , "Domain warping noise strength" ); 661bc = FindProperty ( $"_Decal { i } _Domain_Warping_Speed" ); 662FloatProperty ( bc , "Domain warping noise speed" ); 663bc = FindProperty ( $"_Decal { i } _Domain_Warping_Octaves" ); 664FloatProperty ( bc , "Domain warping octaves" ); 665bc = FindProperty ( $"_Decal { i } _Domain_Warping_Scale" ); 666FloatProperty ( bc , "Domain warping scale" ); 667} 668} 669EditorGUI . indentLevel -= 1 ; 670show_ui . RemoveAt ( show_ui . Count - 1 ); 671} 672EditorGUI . indentLevel -= 1 ; 673show_ui . RemoveAt ( show_ui . Count - 1 ); 674} 675 676void SwapDecalSlots ( int slotA , int slotB ) { 677// List of property suffixes to swap 678string [] propertiesToSwap = new string [] { 679"_Enable" , 680"_Color" , 681"_BaseColor" , 682"_BaseColor_Mode" , 683"_SDF_Threshold" , 684"_SDF_Softness" , 685"_SDF_Px_Range" , 686"_Roughness" , 687"_Metallic" , 688"_Emission_Strength" , 689"_Angle" , 690"_Alpha_Multiplier" , 691"_Round_Alpha_Multiplier" , 692"_Mask" , 693"_Mask_Invert" , 694"_Tiling_Mode" , 695"_UV_Select" , 696"_Domain_Warping_Enable_Static" , 697"_Domain_Warping_Noise" , 698"_Domain_Warping_Strength" , 699"_Domain_Warping_Speed" , 700"_Domain_Warping_Octaves" , 701"_Domain_Warping_Scale" 702}; 703 704// Record undo 705RecordAction ( $"Swap decal slots { slotA } and { slotB } " ); 706 707// For each property, swap values between slots 708foreach ( string prop in propertiesToSwap ) { 709MaterialProperty propA = FindProperty ( $"_Decal { slotA }{ prop } " ); 710MaterialProperty propB = FindProperty ( $"_Decal { slotB }{ prop } " ); 711 712if ( propA != null && propB != null ) { 713if ( propA . type == MaterialProperty . PropType . Color ) { 714Color tempColor = propA . colorValue ; 715propA . colorValue = propB . colorValue ; 716propB . colorValue = tempColor ; 717} else if ( propA . type == MaterialProperty . PropType . Texture ) { 718var tempTex = propA . textureValue ; 719propA . textureValue = propB . textureValue ; 720propB . textureValue = tempTex ; 721 722// Also swap texture scale and offset 723Vector4 tempScale = propA . textureScaleAndOffset ; 724propA . textureScaleAndOffset = propB . textureScaleAndOffset ; 725propB . textureScaleAndOffset = tempScale ; 726} else { 727var tempValue = propA . floatValue ; 728propA . floatValue = propB . floatValue ; 729propB . floatValue = tempValue ; 730} 731} 732} 733} 734 735void DoEmission () { 736show_ui . Add ( AddCollapsibleMenu ( "Emission" , "_Emission" )); 737EditorGUI . indentLevel += 1 ; 738 739MaterialProperty bc ; 740MaterialProperty bct ; 741{ 742LabelField ( $"Base slot" , EditorStyles . boldLabel ); 743EditorGUI . indentLevel += 1 ; 744 745bc = FindProperty ( $"_EmissionColor" ); 746bct = FindProperty ( $"_EmissionMap" ); 747TexturePropertyWithHDRColor ( 748MakeLabel ( bct , "Emission (RGB)" ), 749bct , bc , false ); 750SetKeyword ( $"_EMISSION" , bct . textureValue ); 751 752EditorGUI . indentLevel -= 1 ; 753} 754for ( int i = 0 ; i < 2 ; i ++ ) { 755LabelField ( $"Extra slot { i } " , EditorStyles . boldLabel ); 756EditorGUI . indentLevel += 1 ; 757{ 758bc = FindProperty ( $"_Emission { i } Color" ); 759bct = FindProperty ( $"_Emission { i } Tex" ); 760TexturePropertyWithHDRColor ( 761MakeLabel ( bct , "Emission (RGB)" ), 762bct , bc , false ); 763SetKeyword ( $"_EMISSION { i } " , bct . textureValue ); 764 765if ( bct . textureValue ) { 766bc = FindProperty ( $"_Emission { i } _UV_Select" ); 767RangeProperty ( 768bc , 769"UV channel" ); 770 771bc = FindProperty ( $"_Emission { i } Multiplier" ); 772RangeProperty ( bc , "Multiplier" ); 773} 774} 775EditorGUI . indentLevel -= 1 ; 776} 777 778bc = FindProperty ( "_Global_Emission_Factor" ); 779FloatProperty ( bc , "Global emissions multiplier" ); 780 781bc = FindProperty ( "_Global_Emission_Additive_Factor" ); 782FloatProperty ( bc , "Global emissions additive factor" ); 783 784EditorGUI . indentLevel -= 1 ; 785show_ui . RemoveAt ( show_ui . Count - 1 ); 786} 787 788enum MatcapMode { 789Add , 790Multiply , 791Replace , 792Subtract , 793Min , 794Max , 795} ; 796 797void DoMatcap () { 798for ( int i = 0 ; i < 2 ; i ++ ) { 799show_ui . Add ( AddCollapsibleMenu ( $"Matcap { i } " , $"_Matcap { i } " )); 800EditorGUI . indentLevel += 1 ; 801 802MaterialProperty bc ; 803 804bc = FindProperty ( $"_Matcap { i } " ); 805TexturePropertySingleLine ( 806MakeLabel ( bc , $"Matcap { i } " ), 807bc ); 808SetKeyword ( $"_MATCAP { i } " , bc . textureValue ); 809 810if ( ! bc . textureValue ) { 811EditorGUI . indentLevel -= 1 ; 812show_ui . RemoveAt ( show_ui . Count - 1 ); 813continue ; 814} 815 816bc = FindProperty ( $"_Matcap { i } _Mask" ); 817TexturePropertySingleLine ( 818MakeLabel ( bc , "Mask" ), 819bc ); 820SetKeyword ( $"_MATCAP { i } _MASK" , bc . textureValue ); 821 822bool enabled ; // c# is a shitty language 823if ( bc . textureValue ) { 824EditorGUI . indentLevel += 1 ; 825bc = FindProperty ( $"_Matcap { i } _Mask_Invert" ); 826enabled = bc . floatValue > 1E-6 ; 827EditorGUI . BeginChangeCheck (); 828enabled = Toggle ( "Invert mask" , enabled ); 829EditorGUI . EndChangeCheck (); 830bc . floatValue = enabled ? 1.0f : 0.0f ; 831 832bc = FindProperty ( $"_Matcap { i } _Mask_UV_Select" ); 833RangeProperty ( 834bc , 835"UV channel" ); 836EditorGUI . indentLevel -= 1 ; 837} 838 839bc = FindProperty ( $"_Matcap { i } _Mask2" ); 840TexturePropertySingleLine ( 841MakeLabel ( bc , "Mask" ), 842bc ); 843SetKeyword ( $"_MATCAP { i } _MASK2" , bc . textureValue ); 844 845if ( bc . textureValue ) { 846EditorGUI . indentLevel += 1 ; 847bc = FindProperty ( $"_Matcap { i } _Mask2_Invert_Colors" ); 848enabled = bc . floatValue > 1E-6 ; 849EditorGUI . BeginChangeCheck (); 850enabled = Toggle ( "Invert mask colors" , enabled ); 851EditorGUI . EndChangeCheck (); 852bc . floatValue = enabled ? 1.0f : 0.0f ; 853 854bc = FindProperty ( $"_Matcap { i } _Mask2_Invert_Alpha" ); 855enabled = bc . floatValue > 1E-6 ; 856EditorGUI . BeginChangeCheck (); 857enabled = Toggle ( "Invert mask alpha" , enabled ); 858EditorGUI . EndChangeCheck (); 859bc . floatValue = enabled ? 1.0f : 0.0f ; 860 861bc = FindProperty ( $"_Matcap { i } _Mask2_UV_Select" ); 862RangeProperty ( 863bc , 864"UV channel" ); 865EditorGUI . indentLevel -= 1 ; 866} 867 868bc = FindProperty ( $"_Matcap { i } _Center_Eye_Fix" ); 869enabled = bc . floatValue > 1E-6 ; 870EditorGUI . BeginChangeCheck (); 871enabled = Toggle ( "Center eye fix" , enabled ); 872EditorGUI . EndChangeCheck (); 873bc . floatValue = enabled ? 1.0f : 0.0f ; 874 875EditorGUI . BeginChangeCheck (); 876bc = FindProperty ( $"_Matcap { i } Mode" ); 877MatcapMode mode = ( MatcapMode ) Math . Round ( bc . floatValue ); 878mode = ( MatcapMode ) EnumPopup ( 879MakeLabel ( "Matcap mode" ), mode ); 880if ( EditorGUI . EndChangeCheck ()) { 881RecordAction ( $"Matcap { i } " ); 882foreach ( Material m in editor . targets ) { 883m . SetFloat ( $"_Matcap { i } Mode" , ( int ) mode ); 884} 885} 886 887bc = FindProperty ( $"_Matcap { i } Str" ); 888FloatProperty ( 889bc , 890"Matcap strength" ); 891 892bc = FindProperty ( $"_Matcap { i } MixFactor" ); 893RangeProperty ( 894bc , 895"Mix factor" ); 896 897bc = FindProperty ( $"_Matcap { i } Emission" ); 898FloatProperty ( 899bc , 900"Emission strength" ); 901 902bc = FindProperty ( $"_Matcap { i } Quantization" ); 903FloatProperty ( 904bc , 905"Quantization" ); 906 907bc = FindProperty ( $"_Matcap { i } Normal_Enabled" ); 908enabled = bc . floatValue > 1E-6 ; 909EditorGUI . BeginChangeCheck (); 910enabled = Toggle ( "Replace normals" , enabled ); 911EditorGUI . EndChangeCheck (); 912bc . floatValue = enabled ? 1.0f : 0.0f ; 913SetKeyword ( $"_MATCAP { i } _NORMAL" , enabled ); 914 915if ( enabled ) { 916EditorGUI . indentLevel += 1 ; 917bc = FindProperty ( $"_Matcap { i } Normal" ); 918TexturePropertySingleLine ( 919MakeLabel ( bc , "Normal map" ), 920bc ); 921if ( bc . textureValue ) { 922TextureScaleOffsetProperty ( bc ); 923 924bc = FindProperty ( $"_Matcap { i } Normal_Str" ); 925RangeProperty ( bc , "Strength" ); 926 927bc = FindProperty ( $"_Matcap { i } Normal_UV_Select" ); 928RangeProperty ( 929bc , 930"UV channel" ); 931 932bc = FindProperty ( $"_Matcap { i } Normal_Mip_Bias" ); 933FloatProperty ( bc , "Mip bias" ); 934} 935EditorGUI . indentLevel -= 1 ; 936} 937 938bc = FindProperty ( $"_Matcap { i } Distortion0" ); 939enabled = bc . floatValue > 1E-6 ; 940EditorGUI . BeginChangeCheck (); 941enabled = Toggle ( "Enable distortion 0" , enabled ); 942EditorGUI . EndChangeCheck (); 943bc . floatValue = enabled ? 1.0f : 0.0f ; 944SetKeyword ( $"_MATCAP { i } _DISTORTION0" , enabled ); 945 946for ( int j = 0 ; j < 4 ; j ++ ) { 947bc = FindProperty ( $"_Matcap { i } _Overwrite_Rim_Lighting_ { j } " ); 948enabled = bc . floatValue > 1E-6 ; 949EditorGUI . BeginChangeCheck (); 950enabled = Toggle ( $"Overwrite rim lighting { j } " , enabled ); 951EditorGUI . EndChangeCheck (); 952bc . floatValue = enabled ? 1.0f : 0.0f ; 953} 954 955EditorGUI . indentLevel -= 1 ; 956show_ui . RemoveAt ( show_ui . Count - 1 ); 957} 958} 959 960void DoRimLighting () { 961for ( int i = 0 ; i < 4 ; i ++ ) { 962show_ui . Add ( AddCollapsibleMenu ( $"Rim lighting { i } " , $"_Rim_Lighting { i } " )); 963EditorGUI . indentLevel += 1 ; 964 965MaterialProperty bc ; 966 967bc = FindProperty ( $"_Rim_Lighting { i } _Enabled" ); 968bool enabled = bc . floatValue > 1E-6 ; 969EditorGUI . BeginChangeCheck (); 970enabled = Toggle ( "Enable" , enabled ); 971EditorGUI . EndChangeCheck (); 972bc . floatValue = enabled ? 1.0f : 0.0f ; 973SetKeyword ( $"_RIM_LIGHTING { i } " , enabled ); 974 975if ( ! enabled ) { 976EditorGUI . indentLevel -= 1 ; 977show_ui . RemoveAt ( show_ui . Count - 1 ); 978continue ; 979} 980 981bc = FindProperty ( $"_Rim_Lighting { i } _Color" ); 982ColorProperty ( bc , "Color (RGB)" ); 983 984bc = FindProperty ( $"_Rim_Lighting { i } _Mask" ); 985TexturePropertySingleLine ( 986MakeLabel ( bc , "Mask" ), 987bc ); 988SetKeyword ( $"_RIM_LIGHTING { i } _MASK" , bc . textureValue ); 989if ( bc . textureValue ) { 990EditorGUI . indentLevel += 1 ; 991 992bc = FindProperty ( $"_Rim_Lighting { i } _Mask_Invert" ); 993enabled = bc . floatValue > 1E-6 ; 994EditorGUI . BeginChangeCheck (); 995enabled = Toggle ( "Invert mask" , enabled ); 996EditorGUI . EndChangeCheck (); 997bc . floatValue = enabled ? 1.0f : 0.0f ; 998 999bc = FindProperty ( $"_Rim_Lighting { i } _Mask_UV_Select" ); 1000RangeProperty ( bc , "UV channel" ); 1001 1002EditorGUI . indentLevel -= 1 ; 1003} 1004 1005bc = FindProperty ( $"_Rim_Lighting { i } _Mask2" ); 1006TexturePropertySingleLine ( 1007MakeLabel ( bc , "Mask 2" ), 1008bc ); 1009SetKeyword ( $"_RIM_LIGHTING { i } _MASK2" , bc . textureValue ); 1010if ( bc . textureValue ) { 1011EditorGUI . indentLevel += 1 ; 1012 1013bc = FindProperty ( $"_Rim_Lighting { i } _Mask2_Invert_Colors" ); 1014enabled = bc . floatValue > 1E-6 ; 1015EditorGUI . BeginChangeCheck (); 1016enabled = Toggle ( "Invert mask colors" , enabled ); 1017EditorGUI . EndChangeCheck (); 1018bc . floatValue = enabled ? 1.0f : 0.0f ; 1019 1020bc = FindProperty ( $"_Rim_Lighting { i } _Mask2_Invert_Alpha" ); 1021enabled = bc . floatValue > 1E-6 ; 1022EditorGUI . BeginChangeCheck (); 1023enabled = Toggle ( "Invert mask alpha" , enabled ); 1024EditorGUI . EndChangeCheck (); 1025bc . floatValue = enabled ? 1.0f : 0.0f ; 1026 1027bc = FindProperty ( $"_Rim_Lighting { i } _Mask2_UV_Select" ); 1028RangeProperty ( bc , "UV channel" ); 1029 1030EditorGUI . indentLevel -= 1 ; 1031} 1032 1033bc = FindProperty ( $"_Rim_Lighting { i } _Mask_Sampler_Mode" ); 1034SamplerMode sampler_mode = ( SamplerMode ) Math . Round ( bc . floatValue ); 1035sampler_mode = ( SamplerMode ) EnumPopup ( 1036MakeLabel ( "Sampler mode" ), sampler_mode ); 1037EditorGUI . EndChangeCheck (); 1038bc . floatValue = ( int ) sampler_mode ; 1039 1040SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_LINEAR_REPEAT" , sampler_mode == SamplerMode . LinearRepeat ); 1041SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_LINEAR_CLAMP" , sampler_mode == SamplerMode . LinearClamp ); 1042SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_BILINEAR_REPEAT" , sampler_mode == SamplerMode . BilinearRepeat ); 1043SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_BILINEAR_CLAMP" , sampler_mode == SamplerMode . BilinearClamp ); 1044SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_POINT_REPEAT" , sampler_mode == SamplerMode . PointRepeat ); 1045SetKeyword ( $"_RIM_LIGHTING { i } _SAMPLER_POINT_CLAMP" , sampler_mode == SamplerMode . PointClamp ); 1046 1047bc = FindProperty ( $"_Rim_Lighting { i } _Center_Eye_Fix" ); 1048enabled = bc . floatValue > 1E-6 ; 1049EditorGUI . BeginChangeCheck (); 1050enabled = Toggle ( "Center eye fix" , enabled ); 1051EditorGUI . EndChangeCheck (); 1052bc . floatValue = enabled ? 1.0f : 0.0f ; 1053 1054bc = FindProperty ( $"_Rim_Lighting { i } _Use_Texture_Normals" ); 1055enabled = bc . floatValue > 1E-6 ; 1056EditorGUI . BeginChangeCheck (); 1057enabled = Toggle ( "Use texture normals" , enabled ); 1058EditorGUI . EndChangeCheck (); 1059bc . floatValue = enabled ? 1.0f : 0.0f ; 1060 1061EditorGUI . BeginChangeCheck (); 1062bc = FindProperty ( $"_Rim_Lighting { i } _Mode" ); 1063MatcapMode mode = ( MatcapMode ) Math . Round ( bc . floatValue ); 1064mode = ( MatcapMode ) EnumPopup ( 1065MakeLabel ( "Rim lighting mode" ), mode ); 1066if ( EditorGUI . EndChangeCheck ()) { 1067RecordAction ( "Rim lighting mode" ); 1068foreach ( Material m in editor . targets ) { 1069m . SetFloat ( $"_Rim_Lighting { i } _Mode" , ( int ) mode ); 1070} 1071} 1072 1073bc = FindProperty ( $"_Rim_Lighting { i } _Center" ); 1074FloatProperty ( 1075bc , 1076"Center" ); 1077 1078bc = FindProperty ( $"_Rim_Lighting { i } _Power" ); 1079FloatProperty ( 1080bc , 1081"Power" ); 1082 1083bc = FindProperty ( $"_Rim_Lighting { i } _Strength" ); 1084FloatProperty ( 1085bc , 1086"Strength" ); 1087 1088bc = FindProperty ( $"_Rim_Lighting { i } _Emission" ); 1089FloatProperty ( 1090bc , 1091"Emission" ); 1092 1093bc = FindProperty ( $"_Rim_Lighting { i } _Quantization" ); 1094FloatProperty ( 1095bc , 1096"Quantization" ); 1097 1098bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_Enabled" ); 1099enabled = bc . floatValue > 1E-6 ; 1100EditorGUI . BeginChangeCheck (); 1101enabled = Toggle ( "Glitter" , enabled ); 1102EditorGUI . EndChangeCheck (); 1103bc . floatValue = enabled ? 1.0f : 0.0f ; 1104SetKeyword ( $"_RIM_LIGHTING { i } _GLITTER" , enabled ); 1105 1106if ( enabled ) { 1107EditorGUI . indentLevel += 1 ; 1108 1109bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_Density" ); 1110FloatProperty ( 1111bc , 1112"Density" ); 1113 1114bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_Amount" ); 1115FloatProperty ( 1116bc , 1117"Amount" ); 1118 1119bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_Speed" ); 1120FloatProperty ( 1121bc , 1122"Speed" ); 1123 1124bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_Quantization" ); 1125FloatProperty ( 1126bc , 1127"Quantization" ); 1128 1129bc = FindProperty ( $"_Rim_Lighting { i } _Glitter_UV_Select" ); 1130RangeProperty ( 1131bc , 1132"UV channel" ); 1133 1134EditorGUI . indentLevel -= 1 ; 1135} 1136 1137bc = FindProperty ( $"_Rim_Lighting { i } _PolarMask_Enabled" ); 1138enabled = bc . floatValue > 1E-6 ; 1139EditorGUI . BeginChangeCheck (); 1140enabled = Toggle ( "Polar mask" , enabled ); 1141EditorGUI . EndChangeCheck (); 1142bc . floatValue = enabled ? 1.0f : 0.0f ; 1143SetKeyword ( $"_RIM_LIGHTING { i } _POLAR_MASK" , enabled ); 1144 1145if ( enabled ) { 1146EditorGUI . indentLevel += 1 ; 1147bc = FindProperty ( $"_Rim_Lighting { i } _PolarMask_Theta" ); 1148FloatProperty ( 1149bc , 1150"Theta" ); 1151bc = FindProperty ( $"_Rim_Lighting { i } _PolarMask_Power" ); 1152FloatProperty ( 1153bc , 1154"Power" ); 1155EditorGUI . indentLevel -= 1 ; 1156} 1157 1158bc = FindProperty ( $"_Rim_Lighting { i } _Custom_View_Vector_Enabled" ); 1159enabled = bc . floatValue > 1E-6 ; 1160EditorGUI . BeginChangeCheck (); 1161enabled = Toggle ( "Custom view vector" , enabled ); 1162EditorGUI . EndChangeCheck (); 1163bc . floatValue = enabled ? 1.0f : 0.0f ; 1164SetKeyword ( $"_RIM_LIGHTING { i } _CUSTOM_VIEW_VECTOR" , enabled ); 1165 1166if ( enabled ) { 1167EditorGUI . indentLevel += 1 ; 1168bc = FindProperty ( $"_Rim_Lighting { i } _Custom_View_Vector" ); 1169VectorProperty ( bc , "Vector" ); 1170EditorGUI . indentLevel -= 1 ; 1171} 1172 1173bc = FindProperty ( $"_Rim_Lighting { i } _Reflect_In_World_Space" ); 1174enabled = bc . floatValue > 1E-6 ; 1175EditorGUI . BeginChangeCheck (); 1176enabled = Toggle ( "Reflect in world space" , enabled ); 1177EditorGUI . EndChangeCheck (); 1178bc . floatValue = enabled ? 1.0f : 0.0f ; 1179SetKeyword ( $"_RIM_LIGHTING { i } _REFLECT_IN_WORLD" , enabled ); 1180 1181EditorGUI . indentLevel -= 1 ; 1182show_ui . RemoveAt ( show_ui . Count - 1 ); 1183} 1184} 1185 1186void DoMatcapRL () { 1187show_ui . Add ( AddCollapsibleMenu ( "Matcaps" , "_Matcaps" )); 1188EditorGUI . indentLevel += 1 ; 1189 1190DoMatcap (); 1191DoRimLighting (); 1192 1193EditorGUI . indentLevel -= 1 ; 1194show_ui . RemoveAt ( show_ui . Count - 1 ); 1195} 1196 1197enum NormalsMode { 1198Flat , 1199Spherical , 1200Realistic , 1201Toon 1202} ; 1203 1204void DoShadingMode () { 1205show_ui . Add ( AddCollapsibleMenu ( "Shading" , "_Shading" )); 1206EditorGUI . indentLevel += 1 ; 1207 1208MaterialProperty bc ; 1209 1210bc = FindProperty ( $"_Mesh_Normals_Mode" ); 1211EditorGUI . BeginChangeCheck (); 1212NormalsMode mode = ( NormalsMode ) Math . Round ( bc . floatValue , 0 ); 1213mode = ( NormalsMode ) EnumPopup ( 1214MakeLabel ( "Normals mode" ), mode ); 1215if ( EditorGUI . EndChangeCheck ()) { 1216RecordAction ( "Rendering mode" ); 1217} 1218bc . floatValue = ( float ) mode ; 1219 1220if ( mode == NormalsMode . Flat ) { 1221bc = FindProperty ( "_Flatten_Mesh_Normals_Str" ); 1222FloatProperty ( 1223bc , 1224"Flattening strength" ); 1225} 1226EditorGUI . indentLevel -= 1 ; 1227show_ui . RemoveAt ( show_ui . Count - 1 ); 1228} 1229 1230void DoOKLAB () { 1231show_ui . Add ( AddCollapsibleMenu ( "OKLAB" , "_Hue_Shift_OKLAB" )); 1232EditorGUI . indentLevel += 1 ; 1233 1234MaterialProperty bc ; 1235 1236bc = FindProperty ( "_OKLAB_Enabled" ); 1237bool enabled = bc . floatValue > 1E-6 ; 1238EditorGUI . BeginChangeCheck (); 1239enabled = Toggle ( "Enable" , enabled ); 1240EditorGUI . EndChangeCheck (); 1241bc . floatValue = enabled ? 1.0f : 0.0f ; 1242 1243SetKeyword ( "_OKLAB" , enabled ); 1244 1245if ( enabled ) { 1246bc = FindProperty ( "_OKLAB_Mask" ); 1247TexturePropertySingleLine ( 1248MakeLabel ( bc , "Mask" ), 1249bc ); 1250 1251if ( bc . textureValue ) { 1252bc = FindProperty ( "_OKLAB_Mask_Invert" ); 1253enabled = bc . floatValue > 1E-6 ; 1254EditorGUI . BeginChangeCheck (); 1255enabled = Toggle ( "Invert" , enabled ); 1256EditorGUI . EndChangeCheck (); 1257bc . floatValue = enabled ? 1.0f : 0.0f ; 1258} 1259 1260bc = FindProperty ( "_OKLAB_Lightness_Shift" ); 1261RangeProperty ( 1262bc , 1263"Lightness shift" ); 1264bc = FindProperty ( "_OKLAB_Chroma_Shift" ); 1265RangeProperty ( 1266bc , 1267"Chroma shift" ); 1268bc = FindProperty ( "_OKLAB_Hue_Shift" ); 1269RangeProperty ( 1270bc , 1271"Hue shift" ); 1272} 1273EditorGUI . indentLevel -= 1 ; 1274show_ui . RemoveAt ( show_ui . Count - 1 ); 1275} 1276 1277void DoHSV () { 1278show_ui . Add ( AddCollapsibleMenu ( "HSV" , "_Hue_Shift_HSV" )); 1279EditorGUI . indentLevel += 1 ; 1280 1281MaterialProperty bc ; 1282 1283for ( int i = 0 ; i < 3 ; i ++ ) { 1284bc = FindProperty ( $"_HSV { i } _Enabled" ); 1285bool enabled = bc . floatValue > 1E-6 ; 1286EditorGUI . BeginChangeCheck (); 1287enabled = Toggle ( $"Enable slot { i } " , enabled ); 1288EditorGUI . EndChangeCheck (); 1289bc . floatValue = enabled ? 1.0f : 0.0f ; 1290 1291SetKeyword ( $"_HSV { i } " , enabled ); 1292 1293if ( enabled ) { 1294bc = FindProperty ( $"_HSV { i } _Mask" ); 1295TexturePropertySingleLine ( 1296MakeLabel ( bc , "Mask" ), 1297bc ); 1298 1299if ( bc . textureValue ) { 1300bc = FindProperty ( $"_HSV { i } _Mask_Invert" ); 1301enabled = bc . floatValue > 1E-6 ; 1302EditorGUI . BeginChangeCheck (); 1303enabled = Toggle ( "Invert" , enabled ); 1304EditorGUI . EndChangeCheck (); 1305bc . floatValue = enabled ? 1.0f : 0.0f ; 1306} 1307 1308bc = FindProperty ( $"_HSV { i } _Hue_Shift" ); 1309RangeProperty ( 1310bc , 1311"Hue shift" ); 1312bc = FindProperty ( $"_HSV { i } _Sat_Shift" ); 1313RangeProperty ( 1314bc , 1315"Saturation shift" ); 1316bc = FindProperty ( $"_HSV { i } _Val_Shift" ); 1317RangeProperty ( 1318bc , 1319"Value shift" ); 1320} 1321} 1322EditorGUI . indentLevel -= 1 ; 1323show_ui . RemoveAt ( show_ui . Count - 1 ); 1324} 1325 1326void DoHueShift () { 1327show_ui . Add ( AddCollapsibleMenu ( "Hue shift" , "_Hue_Shift" )); 1328EditorGUI . indentLevel += 1 ; 1329 1330DoOKLAB (); 1331DoHSV (); 1332 1333EditorGUI . indentLevel -= 1 ; 1334show_ui . RemoveAt ( show_ui . Count - 1 ); 1335} 1336 1337void DoClones () { 1338show_ui . Add ( AddCollapsibleMenu ( "Clones" , "_Clones" )); 1339EditorGUI . indentLevel += 1 ; 1340 1341MaterialProperty bc ; 1342 1343bc = FindProperty ( "_Clones_Enabled" ); 1344bool enabled = bc . floatValue > 1E-6 ; 1345EditorGUI . BeginChangeCheck (); 1346enabled = Toggle ( "Enable" , enabled ); 1347EditorGUI . EndChangeCheck (); 1348bc . floatValue = enabled ? 1.0f : 0.0f ; 1349 1350SetKeyword ( "_CLONES" , enabled ); 1351 1352if ( enabled ) { 1353bc = FindProperty ( "_Clones_Count" ); 1354RangeProperty ( 1355bc , 1356"Number of clones" ); 1357bc = FindProperty ( "_Clones_dx" ); 1358RangeProperty ( bc , "x offset" ); 1359bc = FindProperty ( "_Clones_dy" ); 1360RangeProperty ( bc , "y offset" ); 1361bc = FindProperty ( "_Clones_dz" ); 1362RangeProperty ( bc , "z offset" ); 1363bc = FindProperty ( "_Clones_Scale" ); 1364VectorProperty ( bc , "Scale" ); 1365} 1366EditorGUI . indentLevel -= 1 ; 1367show_ui . RemoveAt ( show_ui . Count - 1 ); 1368} 1369 1370void DoOutlines () { 1371show_ui . Add ( AddCollapsibleMenu ( "Outlines" , "_Outlines" )); 1372EditorGUI . indentLevel += 1 ; 1373MaterialProperty bc ; 1374 1375bc = FindProperty ( "_Outline_Width" ); 1376RangeProperty ( 1377bc , 1378"Outline width" ); 1379SetKeyword ( "_OUTLINES" , bc . floatValue > 1E-9 ); 1380 1381if ( bc . floatValue > 1E-6 ) { 1382bc = FindProperty ( "_Outline_Color" ); 1383ColorProperty ( 1384bc , 1385"Outline color (RGBA)" ); 1386 1387bc = FindProperty ( "_Outline_Emission_Strength" ); 1388RangeProperty ( 1389bc , 1390"Outline emission strength" ); 1391 1392bc = FindProperty ( "_Outline_Mask" ); 1393TexturePropertySingleLine ( 1394MakeLabel ( bc , "Outline mask" ), 1395bc ); 1396 1397bc = FindProperty ( "_Outline_Mask_Invert" ); 1398bool inverted = bc . floatValue > 1E-6 ; 1399EditorGUI . BeginChangeCheck (); 1400inverted = Toggle ( "Invert mask" , inverted ); 1401EditorGUI . EndChangeCheck (); 1402bc . floatValue = inverted ? 1.0f : 0.0f ; 1403 1404bc = FindProperty ( "_Outline_Width_Multiplier" ); 1405FloatProperty ( 1406bc , 1407"Outline width multiplier" ); 1408} 1409EditorGUI . indentLevel -= 1 ; 1410show_ui . RemoveAt ( show_ui . Count - 1 ); 1411} 1412 1413void DoGlitter () { 1414show_ui . Add ( AddCollapsibleMenu ( "Glitter" , "_Glitter" )); 1415EditorGUI . indentLevel += 1 ; 1416 1417MaterialProperty bc = FindProperty ( "_Glitter_Enabled" ); 1418bool enabled = bc . floatValue > 1E-6 ; 1419 1420EditorGUI . BeginChangeCheck (); 1421enabled = Toggle ( "Enable" , enabled ); 1422EditorGUI . EndChangeCheck (); 1423SetKeyword ( "_GLITTER" , enabled ); 1424bc . floatValue = enabled ? 1.0f : 0.0f ; 1425 1426if ( enabled ) { 1427bc = FindProperty ( "_Glitter_Mask" ); 1428TexturePropertySingleLine ( 1429MakeLabel ( bc , "Glitter mask (RGBA)" ), 1430bc ); 1431 1432bc = FindProperty ( "_Glitter_Color" ); 1433ColorProperty ( bc , "Color" ); 1434 1435bc = FindProperty ( "_Glitter_Density" ); 1436FloatProperty ( 1437bc , 1438"Density" ); 1439 1440bc = FindProperty ( "_Glitter_Amount" ); 1441FloatProperty ( 1442bc , 1443"Amount" ); 1444 1445bc = FindProperty ( "_Glitter_Speed" ); 1446FloatProperty ( 1447bc , 1448"Speed" ); 1449 1450bc = FindProperty ( "_Glitter_Brightness_Lit" ); 1451FloatProperty ( 1452bc , 1453"Brightness (lit)" ); 1454 1455bc = FindProperty ( "_Glitter_Brightness" ); 1456FloatProperty ( 1457bc , 1458"Brightness (unlit)" ); 1459 1460bc = FindProperty ( "_Glitter_Angle" ); 1461FloatProperty ( 1462bc , 1463"Angle" ); 1464 1465bc = FindProperty ( "_Glitter_Power" ); 1466FloatProperty ( 1467bc , 1468"Power" ); 1469 1470bc = FindProperty ( "_Glitter_UV_Select" ); 1471RangeProperty ( 1472bc , 1473"UV select" ); 1474 1475bc = FindProperty ( "_Glitter_Vector_Mask_Enabled" ); 1476enabled = bc . floatValue > 1E-6 ; 1477EditorGUI . BeginChangeCheck (); 1478enabled = Toggle ( "Vector mask" , enabled ); 1479EditorGUI . EndChangeCheck (); 1480bc . floatValue = enabled ? 1.0f : 0.0f ; 1481 1482if ( enabled ) { 1483EditorGUI . indentLevel += 1 ; 1484 1485bc = FindProperty ( "_Glitter_Vector_Mask_Vector" ); 1486VectorProperty ( bc , "Vector" ); 1487bc = FindProperty ( "_Glitter_Vector_Mask_Power" ); 1488FloatProperty ( bc , "Power" ); 1489bc = FindProperty ( "_Glitter_Vector_Mask_Invert" ); 1490bool inverted = bc . floatValue > 1E-6 ; 1491EditorGUI . BeginChangeCheck (); 1492inverted = Toggle ( "Invert" , inverted ); 1493EditorGUI . EndChangeCheck (); 1494bc . floatValue = inverted ? 1.0f : 0.0f ; 1495 1496EditorGUI . indentLevel -= 1 ; 1497} 1498} 1499EditorGUI . indentLevel -= 1 ; 1500show_ui . RemoveAt ( show_ui . Count - 1 ); 1501} 1502 1503void DoExplosion () { 1504show_ui . Add ( AddCollapsibleMenu ( "Explosion" , "_Explosion" )); 1505EditorGUI . indentLevel += 1 ; 1506 1507MaterialProperty bc = FindProperty ( "_Explode_Toggle" ); 1508bool enabled = bc . floatValue > 1E-6 ; 1509 1510EditorGUI . BeginChangeCheck (); 1511enabled = Toggle ( "Enable" , enabled ); 1512EditorGUI . EndChangeCheck (); 1513SetKeyword ( "_EXPLODE" , enabled ); 1514bc . floatValue = enabled ? 1.0f : 0.0f ; 1515 1516bc = FindProperty ( "_Explode_Phase" ); 1517if ( enabled ) { 1518RangeProperty ( 1519bc , 1520"Explosion phase" ); 1521} else { 1522bc . floatValue = 0.0f ; 1523} 1524bc = FindProperty ( "_OutlinesCull" ); 1525bc . floatValue = ( float ) UnityEngine . Rendering . CullMode . Front ; 1526 1527/* 1528if (enabled) { 1529bc = FindProperty("_Explode_Phase"); 1530RangeProperty( 1531bc, 1532"Explosion phase"); 1533if (bc.floatValue > 1E-3) { 1534bc = FindProperty("_Cull"); 1535bc.floatValue = (float) UnityEngine.Rendering.CullMode.Back; 1536} else { 1537bc = FindProperty("_Cull"); 1538bc.floatValue = (float) UnityEngine.Rendering.CullMode.Front; 1539} 1540} else { 1541bc = FindProperty("_Explode_Phase"); 1542bc.floatValue = 0.0f; 1543bc = FindProperty("_Cull"); 1544bc.floatValue = (float) UnityEngine.Rendering.CullMode.Front; 1545} 1546*/ 1547EditorGUI . indentLevel -= 1 ; 1548show_ui . RemoveAt ( show_ui . Count - 1 ); 1549} 1550 1551void DoGeoScroll () { 1552show_ui . Add ( AddCollapsibleMenu ( "Geometry scroll" , "_Geometry_Scroll" )); 1553EditorGUI . indentLevel += 1 ; 1554 1555MaterialProperty bc = FindProperty ( "_Scroll_Toggle" ); 1556bool enabled = bc . floatValue > 1E-6 ; 1557 1558EditorGUI . BeginChangeCheck (); 1559enabled = Toggle ( "Enable" , enabled ); 1560EditorGUI . EndChangeCheck (); 1561SetKeyword ( "_SCROLL" , enabled ); 1562bc . floatValue = enabled ? 1.0f : 0.0f ; 1563 1564if ( enabled ) { 1565bc = FindProperty ( "_Scroll_Top" ); 1566RangeProperty ( 1567bc , 1568"Scroll top" ); 1569 1570bc = FindProperty ( "_Scroll_Bottom" ); 1571RangeProperty ( 1572bc , 1573"Scroll bottom" ); 1574 1575bc = FindProperty ( "_Scroll_Width" ); 1576RangeProperty ( 1577bc , 1578"Scroll width" ); 1579 1580bc = FindProperty ( "_Scroll_Strength" ); 1581RangeProperty ( 1582bc , 1583"Scroll strength" ); 1584 1585bc = FindProperty ( "_Scroll_Speed" ); 1586RangeProperty ( 1587bc , 1588"Scroll speed" ); 1589} 1590EditorGUI . indentLevel -= 1 ; 1591show_ui . RemoveAt ( show_ui . Count - 1 ); 1592} 1593 1594void DoUVScroll () { 1595show_ui . Add ( AddCollapsibleMenu ( "UV Scroll" , "_UV_Scroll" )); 1596EditorGUI . indentLevel += 1 ; 1597 1598MaterialProperty bc = FindProperty ( "_UVScroll_Enabled" ); 1599bool enabled = bc . floatValue > 1E-6 ; 1600 1601EditorGUI . BeginChangeCheck (); 1602enabled = Toggle ( "Enable" , enabled ); 1603EditorGUI . EndChangeCheck (); 1604SetKeyword ( "_UVSCROLL" , enabled ); 1605bc . floatValue = enabled ? 1.0f : 0.0f ; 1606 1607if ( enabled ) { 1608bc = FindProperty ( "_UVScroll_Mask" ); 1609TexturePropertySingleLine ( 1610MakeLabel ( bc , "Mask" ), 1611bc ); 1612 1613bc = FindProperty ( "_UVScroll_U_Speed" ); 1614FloatProperty ( 1615bc , 1616"U speed" ); 1617 1618bc = FindProperty ( "_UVScroll_V_Speed" ); 1619FloatProperty ( 1620bc , 1621"V speed" ); 1622 1623bc = FindProperty ( "_UVScroll_Alpha" ); 1624TexturePropertySingleLine ( 1625MakeLabel ( bc , "Alpha" ), 1626bc ); 1627} 1628EditorGUI . indentLevel -= 1 ; 1629show_ui . RemoveAt ( show_ui . Count - 1 ); 1630} 1631 1632void DoGimmickFlatColor () 1633{ 1634MaterialProperty bc ; 1635bc = FindProperty ( "_Gimmick_Flat_Color_Enable_Static" ); 1636bool enabled = ( bc . floatValue != 0.0 ); 1637EditorGUI . BeginChangeCheck (); 1638enabled = Toggle ( "Flat color" , enabled ); 1639EditorGUI . EndChangeCheck (); 1640bc . floatValue = enabled ? 1.0f : 0.0f ; 1641SetKeyword ( "_GIMMICK_FLAT_COLOR" , enabled ); 1642 1643if ( ! enabled ) { 1644return ; 1645} 1646 1647EditorGUI . indentLevel += 1 ; 1648 1649bc = FindProperty ( "_Gimmick_Flat_Color_Enable_Dynamic" ); 1650enabled = ( bc . floatValue != 0.0 ); 1651EditorGUI . BeginChangeCheck (); 1652enabled = Toggle ( "Enable (runtime switch)" , enabled ); 1653EditorGUI . EndChangeCheck (); 1654bc . floatValue = enabled ? 1.0f : 0.0f ; 1655 1656bc = FindProperty ( "_Gimmick_Flat_Color_Color" ); 1657ColorProperty ( bc , "Color" ); 1658bc = FindProperty ( "_Gimmick_Flat_Color_Emission" ); 1659ColorProperty ( bc , "Emission" ); 1660 1661EditorGUI . indentLevel -= 1 ; 1662} 1663 1664void DoGimmickUVDomainWarping () { 1665MaterialProperty bc ; 1666bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Enable_Static" ); 1667bool enabled = ( bc . floatValue != 0.0 ); 1668EditorGUI . BeginChangeCheck (); 1669enabled = Toggle ( "UV domain warping" , enabled ); 1670EditorGUI . EndChangeCheck (); 1671bc . floatValue = enabled ? 1.0f : 0.0f ; 1672SetKeyword ( "_GIMMICK_UV_DOMAIN_WARPING" , enabled ); 1673 1674if ( ! enabled ) { 1675return ; 1676} 1677 1678EditorGUI . indentLevel += 1 ; 1679 1680bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Octaves" ); 1681FloatProperty ( bc , "Octaves" ); 1682bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Strength" ); 1683FloatProperty ( bc , "Strength" ); 1684bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Scale" ); 1685FloatProperty ( bc , "Scale" ); 1686bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Speed" ); 1687FloatProperty ( bc , "Speed" ); 1688bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Noise" ); 1689TexturePropertySingleLine ( 1690MakeLabel ( bc , "Noise" ), 1691bc ); 1692bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Mask" ); 1693TexturePropertySingleLine ( 1694MakeLabel ( bc , "Mask" ), 1695bc ); 1696if ( bc . textureValue ) { 1697EditorGUI . indentLevel += 1 ; 1698bc = FindProperty ( "_Gimmick_UV_Domain_Warping_Mask_Invert" ); 1699FloatProperty ( bc , "Invert" ); 1700EditorGUI . indentLevel -= 1 ; 1701} 1702 1703EditorGUI . indentLevel -= 1 ; 1704} 1705 1706void DoGimmickQuantizeLocation () { 1707MaterialProperty bc ; 1708bc = FindProperty ( "_Gimmick_Quantize_Location_Enable_Static" ); 1709bool enabled = ( bc . floatValue != 0.0 ); 1710EditorGUI . BeginChangeCheck (); 1711enabled = Toggle ( "Quantize location" , enabled ); 1712EditorGUI . EndChangeCheck (); 1713bc . floatValue = enabled ? 1.0f : 0.0f ; 1714SetKeyword ( "_GIMMICK_QUANTIZE_LOCATION" , enabled ); 1715 1716if ( ! enabled ) { 1717return ; 1718} 1719 1720EditorGUI . indentLevel += 1 ; 1721 1722bc = FindProperty ( "_Gimmick_Quantize_Location_Enable_Dynamic" ); 1723enabled = ( bc . floatValue != 0.0 ); 1724EditorGUI . BeginChangeCheck (); 1725enabled = Toggle ( "Enable (runtime switch)" , enabled ); 1726EditorGUI . EndChangeCheck (); 1727bc . floatValue = enabled ? 1.0f : 0.0f ; 1728 1729bc = FindProperty ( "_Gimmick_Quantize_Location_Precision" ); 1730FloatProperty ( bc , "Precision" ); 1731bc = FindProperty ( "_Gimmick_Quantize_Location_Direction" ); 1732FloatProperty ( bc , "Direction" ); 1733bc = FindProperty ( "_Gimmick_Quantize_Location_Multiplier" ); 1734RangeProperty ( bc , "Multiplier" ); 1735bc = FindProperty ( "_Gimmick_Quantize_Location_Mask" ); 1736TexturePropertySingleLine ( 1737MakeLabel ( bc , "Mask" ), 1738bc ); 1739 1740bc = FindProperty ( "_Gimmick_Quantize_Location_Audiolink_Enable_Static" ); 1741enabled = ( bc . floatValue != 0.0 ); 1742EditorGUI . BeginChangeCheck (); 1743enabled = Toggle ( "Audiolink" , enabled ); 1744EditorGUI . EndChangeCheck (); 1745bc . floatValue = enabled ? 1.0f : 0.0f ; 1746SetKeyword ( "_GIMMICK_QUANTIZE_LOCATION_AUDIOLINK" , enabled ); 1747 1748if ( enabled ) { 1749EditorGUI . indentLevel += 1 ; 1750 1751bc = FindProperty ( "_Gimmick_Quantize_Location_Audiolink_Enable_Dynamic" ); 1752enabled = ( bc . floatValue != 0.0 ); 1753EditorGUI . BeginChangeCheck (); 1754enabled = Toggle ( "Enable (runtime switch)" , enabled ); 1755EditorGUI . EndChangeCheck (); 1756bc . floatValue = enabled ? 1.0f : 0.0f ; 1757 1758bc = FindProperty ( "_Gimmick_Quantize_Location_Audiolink_Strength" ); 1759FloatProperty ( 1760bc , 1761"Strength" ); 1762 1763EditorGUI . indentLevel -= 1 ; 1764} 1765 1766EditorGUI . indentLevel -= 1 ; 1767} 1768 1769void DoGimmickShearLocation () { 1770MaterialProperty bc ; 1771bc = FindProperty ( "_Gimmick_Shear_Location_Enable_Static" ); 1772bool enabled = ( bc . floatValue != 0.0 ); 1773EditorGUI . BeginChangeCheck (); 1774enabled = Toggle ( "Shear location" , enabled ); 1775EditorGUI . EndChangeCheck (); 1776bc . floatValue = enabled ? 1.0f : 0.0f ; 1777SetKeyword ( "_GIMMICK_SHEAR_LOCATION" , enabled ); 1778 1779if ( ! enabled ) { 1780return ; 1781} 1782 1783EditorGUI . indentLevel += 1 ; 1784 1785bc = FindProperty ( "_Gimmick_Shear_Location_Enable_Dynamic" ); 1786enabled = ( bc . floatValue != 0.0 ); 1787EditorGUI . BeginChangeCheck (); 1788enabled = Toggle ( "Enable (runtime switch)" , enabled ); 1789EditorGUI . EndChangeCheck (); 1790bc . floatValue = enabled ? 1.0f : 0.0f ; 1791 1792bc = FindProperty ( "_Gimmick_Shear_Location_Strength" ); 1793VectorProperty ( bc , "Strength" ); 1794 1795bc = FindProperty ( "_Gimmick_Shear_Location_Mesh_Renderer_Fix" ); 1796enabled = ( bc . floatValue != 0.0 ); 1797EditorGUI . BeginChangeCheck (); 1798enabled = Toggle ( "Mesh renderer fix" , enabled ); 1799EditorGUI . EndChangeCheck (); 1800bc . floatValue = enabled ? 1.0f : 0.0f ; 1801 1802if ( enabled ) { 1803EditorGUI . indentLevel += 1 ; 1804bc = FindProperty ( "_Gimmick_Shear_Location_Mesh_Renderer_Offset" ); 1805VectorProperty ( bc , "Offset" ); 1806bc = FindProperty ( "_Gimmick_Shear_Location_Mesh_Renderer_Rotation" ); 1807VectorProperty ( bc , "Rotation" ); 1808bc = FindProperty ( "_Gimmick_Shear_Location_Mesh_Renderer_Scale" ); 1809VectorProperty ( bc , "Scale" ); 1810EditorGUI . indentLevel -= 1 ; 1811} 1812 1813EditorGUI . indentLevel -= 1 ; 1814} 1815 1816void DoGimmickSpherizeLocation () { 1817MaterialProperty bc ; 1818bc = FindProperty ( "_Gimmick_Spherize_Location_Enable_Static" ); 1819bool enabled = ( bc . floatValue != 0.0 ); 1820EditorGUI . BeginChangeCheck (); 1821enabled = Toggle ( "Spherize location" , enabled ); 1822EditorGUI . EndChangeCheck (); 1823bc . floatValue = enabled ? 1.0f : 0.0f ; 1824SetKeyword ( "_GIMMICK_SPHERIZE_LOCATION" , enabled ); 1825 1826if ( ! enabled ) { 1827return ; 1828} 1829 1830EditorGUI . indentLevel += 1 ; 1831 1832bc = FindProperty ( "_Gimmick_Spherize_Location_Enable_Dynamic" ); 1833enabled = ( bc . floatValue != 0.0 ); 1834EditorGUI . BeginChangeCheck (); 1835enabled = Toggle ( "Enable (runtime switch)" , enabled ); 1836EditorGUI . EndChangeCheck (); 1837bc . floatValue = enabled ? 1.0f : 0.0f ; 1838 1839bc = FindProperty ( "_Gimmick_Spherize_Location_Strength" ); 1840RangeProperty ( bc , "Strength" ); 1841bc = FindProperty ( "_Gimmick_Spherize_Location_Radius" ); 1842FloatProperty ( bc , "Radius" ); 1843 1844EditorGUI . indentLevel -= 1 ; 1845} 1846 1847 1848void DoGimmickEyes00 () { 1849MaterialProperty bc ; 1850bc = FindProperty ( "_Gimmick_Eyes00_Enable_Static" ); 1851bool enabled = ( bc . floatValue != 0.0 ); 1852EditorGUI . BeginChangeCheck (); 1853enabled = Toggle ( "Eyes 00" , enabled ); 1854EditorGUI . EndChangeCheck (); 1855bc . floatValue = enabled ? 1.0f : 0.0f ; 1856SetKeyword ( "_GIMMICK_EYES_00" , enabled ); 1857 1858if ( ! enabled ) { 1859return ; 1860} 1861 1862EditorGUI . indentLevel += 1 ; 1863 1864bc = FindProperty ( "_Gimmick_Eyes00_Effect_Mask" ); 1865TexturePropertySingleLine ( 1866MakeLabel ( bc , "Effect mask" ), 1867bc ); 1868 1869EditorGUI . indentLevel -= 1 ; 1870} 1871 1872void DoGimmickEyes01 () { 1873MaterialProperty bc ; 1874bc = FindProperty ( "_Gimmick_Eyes01_Enable_Static" ); 1875bool enabled = ( bc . floatValue != 0.0 ); 1876EditorGUI . BeginChangeCheck (); 1877enabled = Toggle ( "Eyes 01" , enabled ); 1878EditorGUI . EndChangeCheck (); 1879bc . floatValue = enabled ? 1.0f : 0.0f ; 1880SetKeyword ( "_GIMMICK_EYES_01" , enabled ); 1881 1882if ( ! enabled ) { 1883return ; 1884} 1885 1886EditorGUI . indentLevel += 1 ; 1887 1888bc = FindProperty ( "_Gimmick_Eyes01_Radius" ); 1889FloatProperty ( bc , "Radius (meters, object space)" ); 1890 1891EditorGUI . indentLevel -= 1 ; 1892} 1893 1894void DoGimmickEyes02 () { 1895MaterialProperty bc ; 1896bc = FindProperty ( "_Gimmick_Eyes02_Enable_Static" ); 1897bool enabled = ( bc . floatValue != 0.0 ); 1898EditorGUI . BeginChangeCheck (); 1899enabled = Toggle ( "Eyes 02" , enabled ); 1900EditorGUI . EndChangeCheck (); 1901bc . floatValue = enabled ? 1.0f : 0.0f ; 1902SetKeyword ( "_GIMMICK_EYES_02" , enabled ); 1903 1904if ( ! enabled ) { 1905return ; 1906} 1907 1908EditorGUI . indentLevel += 1 ; 1909 1910bc = FindProperty ( "_Gimmick_Eyes02_N" ); 1911RangeProperty ( bc , "n" ); 1912bc = FindProperty ( "_Gimmick_Eyes02_A0" ); 1913RangeProperty ( bc , "a0" ); 1914bc = FindProperty ( "_Gimmick_Eyes02_A1" ); 1915RangeProperty ( bc , "a1" ); 1916bc = FindProperty ( "_Gimmick_Eyes02_A2" ); 1917RangeProperty ( bc , "a2" ); 1918bc = FindProperty ( "_Gimmick_Eyes02_A3" ); 1919RangeProperty ( bc , "a3" ); 1920bc = FindProperty ( "_Gimmick_Eyes02_A4" ); 1921RangeProperty ( bc , "a4" ); 1922 1923bc = FindProperty ( "_Gimmick_Eyes02_Animate" ); 1924enabled = ( bc . floatValue != 0.0 ); 1925EditorGUI . BeginChangeCheck (); 1926enabled = Toggle ( "Animate" , enabled ); 1927EditorGUI . EndChangeCheck (); 1928bc . floatValue = enabled ? 1.0f : 0.0f ; 1929if ( enabled ) { 1930EditorGUI . indentLevel += 1 ; 1931bc = FindProperty ( "_Gimmick_Eyes02_Animate_Speed" ); 1932FloatProperty ( bc , "Speed" ); 1933 1934bc = FindProperty ( "_Gimmick_Eyes02_Animate_Strength" ); 1935FloatProperty ( bc , "Strength" ); 1936EditorGUI . indentLevel -= 1 ; 1937} 1938 1939bc = FindProperty ( "_Gimmick_Eyes02_UV_X_Symmetry" ); 1940enabled = ( bc . floatValue != 0.0 ); 1941EditorGUI . BeginChangeCheck (); 1942enabled = Toggle ( "UV x symmetry" , enabled ); 1943EditorGUI . EndChangeCheck (); 1944bc . floatValue = enabled ? 1.0f : 0.0f ; 1945 1946bc = FindProperty ( "_Gimmick_Eyes02_UV_Adjust" ); 1947VectorProperty ( bc , "UV scale & offset" ); 1948 1949bc = FindProperty ( "_Gimmick_Eyes02_Albedo" ); 1950ColorProperty ( bc , "Albedo" ); 1951bc = FindProperty ( "_Gimmick_Eyes02_Metallic" ); 1952FloatProperty ( bc , "Metallic" ); 1953bc = FindProperty ( "_Gimmick_Eyes02_Roughness" ); 1954FloatProperty ( bc , "Roughness" ); 1955bc = FindProperty ( "_Gimmick_Eyes02_Emission" ); 1956ColorProperty ( bc , "Emission" ); 1957 1958EditorGUI . indentLevel -= 1 ; 1959} 1960 1961void DoGimmickDownstairs2 () { 1962MaterialProperty bc ; 1963bc = FindProperty ( "_Gimmick_DS2_Enable_Static" ); 1964bool enabled = ( bc . floatValue != 0.0 ); 1965EditorGUI . BeginChangeCheck (); 1966enabled = Toggle ( "Downstairs 2" , enabled ); 1967EditorGUI . EndChangeCheck (); 1968bc . floatValue = enabled ? 1.0f : 0.0f ; 1969SetKeyword ( "_GIMMICK_DS2" , enabled ); 1970 1971if ( ! enabled ) { 1972return ; 1973} 1974 1975EditorGUI . indentLevel += 1 ; 1976 1977bc = FindProperty ( "_Gimmick_DS2_Mask" ); 1978TexturePropertySingleLine ( MakeLabel ( bc , "Mask" ), bc ); 1979bc = FindProperty ( "_Gimmick_DS2_Noise" ); 1980TexturePropertySingleLine ( MakeLabel ( bc , "Noise" ), bc ); 1981bc = FindProperty ( "_Gimmick_DS2_Albedo_Factor" ); 1982FloatProperty ( bc , "Albedo factor" ); 1983bc = FindProperty ( "_Gimmick_DS2_Emission_Factor" ); 1984FloatProperty ( bc , "Emission factor" ); 1985 1986bc = FindProperty ( "_Gimmick_DS2_Choice" ); 1987FloatProperty ( bc , "Choice" ); 1988float choice = bc . floatValue ; 1989 1990if ( Mathf . Round ( choice ) == - 1 ) { 1991EditorGUI . indentLevel += 1 ; 1992 1993EditorGUI . indentLevel -= 1 ; 1994} 1995 1996if ( Mathf . Round ( choice ) == 0 ) { 1997EditorGUI . indentLevel += 1 ; 1998 1999bc = FindProperty ( "_Gimmick_DS2_00_Domain_Warping_Octaves" ); 2000FloatProperty ( bc , "Domain warping octaves" ); 2001bc = FindProperty ( "_Gimmick_DS2_00_Domain_Warping_Strength" ); 2002FloatProperty ( bc , "Domain warping strength" ); 2003bc = FindProperty ( "_Gimmick_DS2_00_Domain_Warping_Scale" ); 2004FloatProperty ( bc , "Domain warping scale" ); 2005bc = FindProperty ( "_Gimmick_DS2_00_Domain_Warping_Speed" ); 2006FloatProperty ( bc , "Domain warping speed" ); 2007 2008EditorGUI . indentLevel -= 1 ; 2009} 2010 2011if ( Mathf . Round ( choice ) == 1 ) { 2012EditorGUI . indentLevel += 1 ; 2013 2014bc = FindProperty ( "_Gimmick_DS2_01_Period" ); 2015VectorProperty ( bc , "Period" ); 2016bc = FindProperty ( "_Gimmick_DS2_01_Count" ); 2017VectorProperty ( bc , "Count" ); 2018bc = FindProperty ( "_Gimmick_DS2_01_Radius" ); 2019FloatProperty ( bc , "Radius" ); 2020 2021bc = FindProperty ( "_Gimmick_DS2_01_Domain_Warping_Octaves" ); 2022FloatProperty ( bc , "Domain warping octaves" ); 2023bc = FindProperty ( "_Gimmick_DS2_01_Domain_Warping_Strength" ); 2024FloatProperty ( bc , "Domain warping strength" ); 2025bc = FindProperty ( "_Gimmick_DS2_01_Domain_Warping_Scale" ); 2026FloatProperty ( bc , "Domain warping scale" ); 2027bc = FindProperty ( "_Gimmick_DS2_01_Domain_Warping_Speed" ); 2028FloatProperty ( bc , "Domain warping speed" ); 2029 2030EditorGUI . indentLevel -= 1 ; 2031} 2032 2033if ( Mathf . Round ( choice ) == 2 ) { 2034EditorGUI . indentLevel += 1 ; 2035 2036bc = FindProperty ( "_Gimmick_DS2_02_Period" ); 2037VectorProperty ( bc , "Period" ); 2038bc = FindProperty ( "_Gimmick_DS2_02_Count" ); 2039VectorProperty ( bc , "Count" ); 2040bc = FindProperty ( "_Gimmick_DS2_02_Edge_Length" ); 2041FloatProperty ( bc , "Edge length" ); 2042 2043bc = FindProperty ( "_Gimmick_DS2_02_Domain_Warping_Octaves" ); 2044FloatProperty ( bc , "Domain warping octaves" ); 2045bc = FindProperty ( "_Gimmick_DS2_02_Domain_Warping_Strength" ); 2046FloatProperty ( bc , "Domain warping strength" ); 2047bc = FindProperty ( "_Gimmick_DS2_02_Domain_Warping_Scale" ); 2048FloatProperty ( bc , "Domain warping scale" ); 2049bc = FindProperty ( "_Gimmick_DS2_02_Domain_Warping_Speed" ); 2050FloatProperty ( bc , "Domain warping speed" ); 2051 2052EditorGUI . indentLevel -= 1 ; 2053} 2054 2055if ( Mathf . Round ( choice ) == 3 ) { 2056EditorGUI . indentLevel += 1 ; 2057 2058bc = FindProperty ( "_Gimmick_DS2_03_Period" ); 2059VectorProperty ( bc , "Period" ); 2060bc = FindProperty ( "_Gimmick_DS2_03_Count" ); 2061VectorProperty ( bc , "Count" ); 2062bc = FindProperty ( "_Gimmick_DS2_03_Edge_Length" ); 2063FloatProperty ( bc , "Edge length" ); 2064 2065EditorGUI . indentLevel -= 1 ; 2066} 2067 2068if ( Mathf . Round ( choice ) == 11 ) { 2069EditorGUI . indentLevel += 1 ; 2070 2071bc = FindProperty ( "_Gimmick_DS2_11_Fog_Enable" ); 2072enabled = ( bc . floatValue != 0.0 ); 2073EditorGUI . BeginChangeCheck (); 2074enabled = Toggle ( "Fog enable" , enabled ); 2075EditorGUI . EndChangeCheck (); 2076bc . floatValue = enabled ? 1.0f : 0.0f ; 2077 2078if ( enabled ) { 2079bc = FindProperty ( "_Gimmick_DS2_11_Fog_Density" ); 2080FloatProperty ( bc , "Fog density" ); 2081bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Direction" ); 2082VectorProperty ( bc , "Fog sun direction" ); 2083bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Exponent" ); 2084FloatProperty ( bc , "Fog sun exponent" ); 2085bc = FindProperty ( "_Gimmick_DS2_11_Fog_Color" ); 2086ColorProperty ( bc , "Fog color" ); 2087bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Color" ); 2088ColorProperty ( bc , "Fog sun color" ); 2089 2090bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Color_2_Enable" ); 2091enabled = ( bc . floatValue != 0.0 ); 2092EditorGUI . BeginChangeCheck (); 2093enabled = Toggle ( "Fog sun color 2 enable" , enabled ); 2094EditorGUI . EndChangeCheck (); 2095bc . floatValue = enabled ? 1.0f : 0.0f ; 2096 2097if ( enabled ) { 2098bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Color_2" ); 2099ColorProperty ( bc , "Fog sun color 2" ); 2100bc = FindProperty ( "_Gimmick_DS2_11_Fog_Sun_Exponent_2" ); 2101FloatProperty ( bc , "Fog sun exponent 2" ); 2102} 2103} 2104 2105bc = FindProperty ( "_Gimmick_DS2_11_FBM" ); 2106TexturePropertySingleLine ( MakeLabel ( bc , "FBM" ), bc ); 2107 2108bc = FindProperty ( "_Gimmick_DS2_11_Snow_Color" ); 2109ColorProperty ( bc , "Snow color" ); 2110bc = FindProperty ( "_Gimmick_DS2_11_Snowline" ); 2111FloatProperty ( bc , "Snowline" ); 2112bc = FindProperty ( "_Gimmick_DS2_11_Snowline_Octaves" ); 2113FloatProperty ( bc , "Snowline octaves" ); 2114bc = FindProperty ( "_Gimmick_DS2_11_Snowline_Width" ); 2115FloatProperty ( bc , "Snowline width" ); 2116bc = FindProperty ( "_Gimmick_DS2_11_Snowline_Noise_Scale" ); 2117FloatProperty ( bc , "Snowline noise scale" ); 2118 2119bc = FindProperty ( "_Gimmick_DS2_11_Rock_Color" ); 2120ColorProperty ( bc , "Rock color" ); 2121bc = FindProperty ( "_Gimmick_DS2_11_Rockline" ); 2122FloatProperty ( bc , "Rockline" ); 2123bc = FindProperty ( "_Gimmick_DS2_11_Rockline_Octaves" ); 2124FloatProperty ( bc , "Rockline octaves" ); 2125bc = FindProperty ( "_Gimmick_DS2_11_Rockline_Width" ); 2126FloatProperty ( bc , "Rockline width" ); 2127bc = FindProperty ( "_Gimmick_DS2_11_Rockline_Noise_Scale" ); 2128FloatProperty ( bc , "Rockline noise scale" ); 2129 2130bc = FindProperty ( "_Gimmick_DS2_11_Grass_Color" ); 2131ColorProperty ( bc , "Grass color" ); 2132bc = FindProperty ( "_Gimmick_DS2_11_Alpha" ); 2133RangeProperty ( bc , "Alpha" ); 2134 2135bc = FindProperty ( "_Gimmick_DS2_11_Offset" ); 2136VectorProperty ( bc , "Offset" ); 2137bc = FindProperty ( "_Gimmick_DS2_11_Octaves" ); 2138FloatProperty ( bc , "Octaves" ); 2139bc = FindProperty ( "_Gimmick_DS2_11_March_Initial_Offset" ); 2140FloatProperty ( bc , "March initial offset" ); 2141bc = FindProperty ( "_Gimmick_DS2_11_March_Initial_Step_Size" ); 2142FloatProperty ( bc , "March initial step size" ); 2143bc = FindProperty ( "_Gimmick_DS2_11_March_Steps" ); 2144FloatProperty ( bc , "March steps" ); 2145bc = FindProperty ( "_Gimmick_DS2_11_March_Backtrack_Steps" ); 2146FloatProperty ( bc , "March backtrack steps" ); 2147bc = FindProperty ( "_Gimmick_DS2_11_Simulation_Scale" ); 2148FloatProperty ( bc , "Simulation scale" ); 2149bc = FindProperty ( "_Gimmick_DS2_11_Coord_Scale" ); 2150FloatProperty ( bc , "Coord scale" ); 2151bc = FindProperty ( "_Gimmick_DS2_11_Height_Scale" ); 2152FloatProperty ( bc , "Height scale" ); 2153bc = FindProperty ( "_Gimmick_DS2_11_Height_Power" ); 2154FloatProperty ( bc , "Height power" ); 2155bc = FindProperty ( "_Gimmick_DS2_11_Valley_Power" ); 2156FloatProperty ( bc , "Valley power" ); 2157bc = FindProperty ( "_Gimmick_DS2_11_Valley_Depth" ); 2158FloatProperty ( bc , "Valley depth" ); 2159bc = FindProperty ( "_Gimmick_DS2_11_Early_Exit_Cutoff_Cos_Theta" ); 2160FloatProperty ( bc , "Early exit cutoff (cos theta)" ); 2161 2162bc = FindProperty ( "_Gimmick_DS2_11_Distance_Culling_Enable" ); 2163enabled = ( bc . floatValue != 0.0 ); 2164EditorGUI . BeginChangeCheck (); 2165enabled = Toggle ( "Distance culling enable" , enabled ); 2166EditorGUI . EndChangeCheck (); 2167bc . floatValue = enabled ? 1.0f : 0.0f ; 2168 2169if ( enabled ) { 2170EditorGUI . indentLevel += 1 ; 2171 2172bc = FindProperty ( "_Gimmick_DS2_11_Activation_Y" ); 2173FloatProperty ( bc , "Activation Y" ); 2174 2175EditorGUI . indentLevel -= 1 ; 2176} 2177 2178bc = FindProperty ( "_Gimmick_DS2_11_Normal_Epsilon" ); 2179FloatProperty ( bc , "Normal epsilon" ); 2180 2181EditorGUI . indentLevel -= 1 ; 2182} 2183 2184EditorGUI . indentLevel -= 1 ; 2185} 2186 2187void DoGimmickHalo00 () { 2188MaterialProperty bc ; 2189bc = FindProperty ( "_Gimmick_Halo00_Enable_Static" ); 2190bool enabled = ( bc . floatValue != 0.0 ); 2191EditorGUI . BeginChangeCheck (); 2192enabled = Toggle ( "Halo 00" , enabled ); 2193EditorGUI . EndChangeCheck (); 2194bc . floatValue = enabled ? 1.0f : 0.0f ; 2195SetKeyword ( "_GIMMICK_HALO_00" , enabled ); 2196 2197if ( ! enabled ) { 2198return ; 2199} 2200 2201EditorGUI . indentLevel += 1 ; 2202 2203EditorGUI . indentLevel -= 1 ; 2204} 2205 2206void DoGimmickPixellate () { 2207MaterialProperty bc ; 2208bc = FindProperty ( "_Gimmick_Pixellate_Enable_Static" ); 2209bool enabled = ( bc . floatValue != 0.0 ); 2210EditorGUI . BeginChangeCheck (); 2211enabled = Toggle ( "Pixellate" , enabled ); 2212EditorGUI . EndChangeCheck (); 2213bc . floatValue = enabled ? 1.0f : 0.0f ; 2214SetKeyword ( "_PIXELLATE" , enabled ); 2215 2216if ( ! enabled ) { 2217return ; 2218} 2219 2220EditorGUI . indentLevel += 1 ; 2221 2222bc = FindProperty ( "_Gimmick_Pixellate_Resolution_U" ); 2223FloatProperty ( bc , "Resolution (U)" ); 2224bc = FindProperty ( "_Gimmick_Pixellate_Resolution_V" ); 2225FloatProperty ( bc , "Resolution (V)" ); 2226bc = FindProperty ( "_Gimmick_Pixellate_Effect_Mask" ); 2227TexturePropertySingleLine ( 2228MakeLabel ( bc , "Effect mask" ), 2229bc ); 2230 2231EditorGUI . indentLevel -= 1 ; 2232} 2233 2234void DoGimmickTrochoid () { 2235MaterialProperty bc ; 2236bc = FindProperty ( "_Trochoid_Enable_Static" ); 2237bool enabled = ( bc . floatValue != 0.0 ); 2238EditorGUI . BeginChangeCheck (); 2239enabled = Toggle ( "Trochoid" , enabled ); 2240EditorGUI . EndChangeCheck (); 2241bc . floatValue = enabled ? 1.0f : 0.0f ; 2242SetKeyword ( "_TROCHOID" , enabled ); 2243 2244if ( ! enabled ) { 2245return ; 2246} 2247 2248EditorGUI . indentLevel += 1 ; 2249 2250bc = FindProperty ( "_Trochoid_R" ); 2251FloatProperty ( bc , "R" ); 2252bc = FindProperty ( "_Trochoid_r" ); 2253FloatProperty ( bc , "r" ); 2254bc = FindProperty ( "_Trochoid_d" ); 2255FloatProperty ( bc , "d" ); 2256bc = FindProperty ( "_Trochoid_Speed" ); 2257FloatProperty ( bc , "Speed" ); 2258bc = FindProperty ( "_Trochoid_Radius_Power" ); 2259FloatProperty ( bc , "Radius power" ); 2260bc = FindProperty ( "_Trochoid_Radius_Scale" ); 2261FloatProperty ( bc , "Radius scale" ); 2262bc = FindProperty ( "_Trochoid_Height_Scale" ); 2263FloatProperty ( bc , "Height scale" ); 2264 2265bc = FindProperty ( "_Trochoid_Enable_Fragment_Normals" ); 2266enabled = ( bc . floatValue != 0.0 ); 2267EditorGUI . BeginChangeCheck (); 2268enabled = Toggle ( "Enable fragment normals" , enabled ); 2269EditorGUI . EndChangeCheck (); 2270bc . floatValue = enabled ? 1.0f : 0.0f ; 2271 2272bc = FindProperty ( "_Trochoid_Distance_Culling_Enable" ); 2273enabled = ( bc . floatValue != 0.0 ); 2274EditorGUI . BeginChangeCheck (); 2275enabled = Toggle ( "Distance culling enable" , enabled ); 2276EditorGUI . EndChangeCheck (); 2277bc . floatValue = enabled ? 1.0f : 0.0f ; 2278 2279if ( enabled ) { 2280EditorGUI . indentLevel += 1 ; 2281 2282bc = FindProperty ( "_Trochoid_Activation_Center" ); 2283VectorProperty ( bc , "Activation center" ); 2284bc = FindProperty ( "_Trochoid_Activation_Radius" ); 2285FloatProperty ( bc , "Activation radius" ); 2286 2287EditorGUI . indentLevel -= 1 ; 2288} 2289 2290EditorGUI . indentLevel -= 1 ; 2291} 2292 2293void DoGimmickFaceMeWorldY () { 2294MaterialProperty bc ; 2295bc = FindProperty ( "_FaceMeWorldY_Enable_Static" ); 2296bool enabled = ( bc . floatValue != 0.0 ); 2297EditorGUI . BeginChangeCheck (); 2298enabled = Toggle ( "FaceMeWorldY" , enabled ); 2299EditorGUI . EndChangeCheck (); 2300bc . floatValue = enabled ? 1.0f : 0.0f ; 2301SetKeyword ( "_FACE_ME_WORLD_Y" , enabled ); 2302 2303if ( ! enabled ) { 2304return ; 2305} 2306 2307EditorGUI . indentLevel += 1 ; 2308 2309bc = FindProperty ( "_FaceMeWorldY_Enable_Dynamic" ); 2310enabled = ( bc . floatValue != 0.0 ); 2311EditorGUI . BeginChangeCheck (); 2312enabled = Toggle ( "Enable (runtime switch)" , enabled ); 2313EditorGUI . EndChangeCheck (); 2314bc . floatValue = enabled ? 1.0f : 0.0f ; 2315 2316bc = FindProperty ( "_FaceMeWorldY_Enable_X" ); 2317FloatProperty ( bc , "X" ); 2318bc = FindProperty ( "_FaceMeWorldY_Enable_Y" ); 2319FloatProperty ( bc , "Y" ); 2320bc = FindProperty ( "_FaceMeWorldY_Enable_Z" ); 2321FloatProperty ( bc , "Z" ); 2322 2323EditorGUI . indentLevel -= 1 ; 2324} 2325 2326void DoGimmickRorschach () { 2327MaterialProperty bc ; 2328bc = FindProperty ( "_Rorschach_Enable_Static" ); 2329bool enabled = ( bc . floatValue != 0.0 ); 2330EditorGUI . BeginChangeCheck (); 2331enabled = Toggle ( "Rorschach" , enabled ); 2332EditorGUI . EndChangeCheck (); 2333bc . floatValue = enabled ? 1.0f : 0.0f ; 2334SetKeyword ( "_RORSCHACH" , enabled ); 2335 2336if ( ! enabled ) { 2337return ; 2338} 2339 2340EditorGUI . indentLevel += 1 ; 2341 2342bc = FindProperty ( "_Rorschach_Enable_Dynamic" ); 2343enabled = ( bc . floatValue != 0.0 ); 2344EditorGUI . BeginChangeCheck (); 2345enabled = Toggle ( "Enable (runtime switch)" , enabled ); 2346EditorGUI . EndChangeCheck (); 2347bc . floatValue = enabled ? 1.0f : 0.0f ; 2348 2349bc = FindProperty ( "_Rorschach_Color" ); 2350ColorProperty ( bc , "Color" ); 2351bc = FindProperty ( "_Rorschach_Count_X" ); 2352FloatProperty ( bc , "Count (x)" ); 2353bc = FindProperty ( "_Rorschach_Count_Y" ); 2354FloatProperty ( bc , "Count (y)" ); 2355bc = FindProperty ( "_Rorschach_Center_Randomization" ); 2356FloatProperty ( bc , "Center randomization" ); 2357bc = FindProperty ( "_Rorschach_Radius" ); 2358FloatProperty ( bc , "Radius" ); 2359bc = FindProperty ( "_Rorschach_Emission_Strength" ); 2360FloatProperty ( bc , "Emission strength" ); 2361bc = FindProperty ( "_Rorschach_Speed" ); 2362FloatProperty ( bc , "Speed" ); 2363bc = FindProperty ( "_Rorschach_Quantization" ); 2364FloatProperty ( bc , "Quantization" ); 2365bc = FindProperty ( "_Rorschach_Alpha_Cutoff" ); 2366FloatProperty ( bc , "Alpha cutoff" ); 2367bc = FindProperty ( "_Rorschach_Mask" ); 2368TexturePropertySingleLine ( 2369MakeLabel ( bc , "Mask" ), 2370bc ); 2371SetKeyword ( "_RORSCHACH_MASK" , bc . textureValue ); 2372if ( bc . textureValue ) { 2373EditorGUI . indentLevel += 1 ; 2374bc = FindProperty ( "_Rorschach_Mask_Invert" ); 2375enabled = bc . floatValue > 1E-6 ; 2376EditorGUI . BeginChangeCheck (); 2377enabled = Toggle ( "Invert" , enabled ); 2378EditorGUI . EndChangeCheck (); 2379bc . floatValue = enabled ? 1.0f : 0.0f ; 2380EditorGUI . indentLevel -= 1 ; 2381} 2382 2383EditorGUI . indentLevel -= 1 ; 2384} 2385 2386void DoGimmickMirrorUVFlip () { 2387MaterialProperty bc ; 2388bc = FindProperty ( "_Mirror_UV_Flip_Enable_Static" ); 2389bool enabled = ( bc . floatValue != 0.0 ); 2390EditorGUI . BeginChangeCheck (); 2391enabled = Toggle ( "Flip UVs in mirror" , enabled ); 2392EditorGUI . EndChangeCheck (); 2393bc . floatValue = enabled ? 1.0f : 0.0f ; 2394SetKeyword ( "_MIRROR_UV_FLIP" , enabled ); 2395 2396if ( ! enabled ) { 2397return ; 2398} 2399 2400EditorGUI . indentLevel += 1 ; 2401 2402bc = FindProperty ( "_Mirror_UV_Flip_Enable_Dynamic" ); 2403enabled = ( bc . floatValue != 0.0 ); 2404EditorGUI . BeginChangeCheck (); 2405enabled = Toggle ( "Enable (runtime switch)" , enabled ); 2406EditorGUI . EndChangeCheck (); 2407bc . floatValue = enabled ? 1.0f : 0.0f ; 2408 2409EditorGUI . indentLevel -= 1 ; 2410} 2411 2412void DoGimmickLetterGrid () { 2413MaterialProperty bc ; 2414bc = FindProperty ( "_Gimmick_Letter_Grid_Enable_Static" ); 2415bool enabled = ( bc . floatValue != 0.0 ); 2416EditorGUI . BeginChangeCheck (); 2417enabled = Toggle ( "Letter grid" , enabled ); 2418EditorGUI . EndChangeCheck (); 2419bc . floatValue = enabled ? 1.0f : 0.0f ; 2420SetKeyword ( "_GIMMICK_LETTER_GRID" , enabled ); 2421 2422if ( ! enabled ) { 2423return ; 2424} 2425 2426EditorGUI . indentLevel += 1 ; 2427 2428bc = FindProperty ( "_Gimmick_Letter_Grid_Texture" ); 2429TexturePropertySingleLine ( 2430MakeLabel ( bc , "Texture" ), 2431bc ); 2432 2433bc = FindProperty ( "_Gimmick_Letter_Grid_Tex_Res_X" ); 2434FloatProperty ( bc , "Number of glyphs in texture (X)" ); 2435bc = FindProperty ( "_Gimmick_Letter_Grid_Tex_Res_Y" ); 2436FloatProperty ( bc , "Number of glyphs in texture (Y)" ); 2437 2438bc = FindProperty ( "_Gimmick_Letter_Grid_Res_X" ); 2439FloatProperty ( bc , "Number of glyphs in grid (X)" ); 2440bc = FindProperty ( "_Gimmick_Letter_Grid_Res_Y" ); 2441FloatProperty ( bc , "Number of glyphs in grid (Y)" ); 2442 2443bc = FindProperty ( "_Gimmick_Letter_Grid_UV_Scale_Offset" ); 2444VectorProperty ( bc , "UV scale & offset" ); 2445bc = FindProperty ( "_Gimmick_Letter_Grid_Padding" ); 2446FloatProperty ( bc , "Padding" ); 2447 2448bc = FindProperty ( "_Gimmick_Letter_Grid_Color" ); 2449bc = FindProperty ( "_Gimmick_Letter_Grid_Metallic" ); 2450RangeProperty ( bc , "Metallic" ); 2451bc = FindProperty ( "_Gimmick_Letter_Grid_Roughness" ); 2452RangeProperty ( bc , "Roughness" ); 2453bc = FindProperty ( "_Gimmick_Letter_Grid_Emission" ); 2454FloatProperty ( bc , "Emission" ); 2455 2456bc = FindProperty ( "_Gimmick_Letter_Grid_UV_Select" ); 2457RangeProperty ( 2458bc , 2459"UV channel" ); 2460 2461bc = FindProperty ( "_Gimmick_Letter_Grid_Color_Wave" ); 2462enabled = ( bc . floatValue != 0.0 ); 2463EditorGUI . BeginChangeCheck (); 2464enabled = Toggle ( "Color waves" , enabled ); 2465EditorGUI . EndChangeCheck (); 2466bc . floatValue = enabled ? 1.0f : 0.0f ; 2467SetKeyword ( "_GIMMICK_LETTER_GRID_COLOR_WAVE" , enabled ); 2468 2469if ( enabled ) { 2470EditorGUI . indentLevel += 1 ; 2471bc = FindProperty ( "_Gimmick_Letter_Grid_Color_Wave_Speed" ); 2472FloatProperty ( bc , "Speed" ); 2473bc = FindProperty ( "_Gimmick_Letter_Grid_Color_Wave_Frequency" ); 2474FloatProperty ( bc , "Frequency" ); 2475EditorGUI . indentLevel -= 1 ; 2476} 2477 2478bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting" ); 2479enabled = ( bc . floatValue != 0.0 ); 2480EditorGUI . BeginChangeCheck (); 2481enabled = Toggle ( "Rim lighting" , enabled ); 2482EditorGUI . EndChangeCheck (); 2483bc . floatValue = enabled ? 1.0f : 0.0f ; 2484SetKeyword ( "_GIMMICK_LETTER_GRID_RIM_LIGHTING" , enabled ); 2485 2486if ( enabled ) { 2487EditorGUI . indentLevel += 1 ; 2488bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Power" ); 2489FloatProperty ( bc , "Power" ); 2490bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Center" ); 2491FloatProperty ( bc , "Center" ); 2492bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Quantization" ); 2493FloatProperty ( bc , "Quantization" ); 2494bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Mask" ); 2495TexturePropertySingleLine ( MakeLabel ( bc , "Mask" ), bc ); 2496if ( bc . textureValue ) { 2497EditorGUI . indentLevel += 1 ; 2498bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Mask_UV_Select" ); 2499FloatProperty ( bc , "Mask UV Select" ); 2500bc = FindProperty ( "_Gimmick_Letter_Grid_Rim_Lighting_Mask_Invert" ); 2501FloatProperty ( bc , "Mask invert" ); 2502EditorGUI . indentLevel -= 1 ; 2503} 2504EditorGUI . indentLevel -= 1 ; 2505} 2506 2507EditorGUI . indentLevel -= 1 ; 2508} 2509 2510void DoGimmickLetterGrid2 () { 2511MaterialProperty bc ; 2512bc = FindProperty ( "_Gimmick_Letter_Grid_2_Enable_Static" ); 2513bool enabled = ( bc . floatValue != 0.0 ); 2514EditorGUI . BeginChangeCheck (); 2515enabled = Toggle ( "Letter grid 2" , enabled ); 2516EditorGUI . EndChangeCheck (); 2517bc . floatValue = enabled ? 1.0f : 0.0f ; 2518SetKeyword ( "_GIMMICK_LETTER_GRID_2" , enabled ); 2519 2520if ( ! enabled ) { 2521return ; 2522} 2523 2524EditorGUI . indentLevel += 1 ; 2525 2526bc = FindProperty ( "_Gimmick_Letter_Grid_2_Texture" ); 2527TexturePropertySingleLine ( 2528MakeLabel ( bc , "Texture" ), 2529bc ); 2530 2531bc = FindProperty ( "_Gimmick_Letter_Grid_2_Tex_Res_X" ); 2532FloatProperty ( bc , "Number of glyphs in texture (X)" ); 2533bc = FindProperty ( "_Gimmick_Letter_Grid_2_Tex_Res_Y" ); 2534FloatProperty ( bc , "Number of glyphs in texture (Y)" ); 2535 2536MaterialProperty rows = FindProperty ( "_Gimmick_Letter_Grid_2_Res_X" ); 2537RangeProperty ( rows , "Number of glyphs in grid (X)" ); 2538MaterialProperty cols = FindProperty ( "_Gimmick_Letter_Grid_2_Res_Y" ); 2539RangeProperty ( cols , "Number of glyphs in grid (Y)" ); 2540 2541for ( int i = 0 ; i < rows . floatValue ; i ++ ) { 2542EditorGUI . indentLevel += 1 ; 2543bc = FindProperty ( $"_Gimmick_Letter_Grid_2_Data_Row_ { i } " ); 2544VectorProperty ( bc , $"Letter grid data row { i } " ); 2545EditorGUI . indentLevel -= 1 ; 2546} 2547 2548bc = FindProperty ( "_Gimmick_Letter_Grid_2_UV_Scale_Offset" ); 2549VectorProperty ( bc , "UV scale & offset" ); 2550bc = FindProperty ( "_Gimmick_Letter_Grid_2_Padding" ); 2551FloatProperty ( bc , "Padding" ); 2552 2553bc = FindProperty ( "_Gimmick_Letter_Grid_2_Color" ); 2554ColorProperty ( bc , "Color" ); 2555bc = FindProperty ( "_Gimmick_Letter_Grid_2_Metallic" ); 2556RangeProperty ( bc , "Metallic" ); 2557bc = FindProperty ( "_Gimmick_Letter_Grid_2_Roughness" ); 2558RangeProperty ( bc , "Roughness" ); 2559bc = FindProperty ( "_Gimmick_Letter_Grid_2_Emission" ); 2560FloatProperty ( bc , "Emission" ); 2561 2562bc = FindProperty ( "_Gimmick_Letter_Grid_2_Mask" ); 2563TexturePropertySingleLine ( MakeLabel ( bc , "Mask" ), bc ); 2564 2565bc = FindProperty ( "_Gimmick_Letter_Grid_2_Global_Offset" ); 2566FloatProperty ( bc , "Global offset" ); 2567 2568bc = FindProperty ( "_Gimmick_Letter_Grid_2_Screen_Px_Range" ); 2569FloatProperty ( bc , "Screen px range (from msdfgen)" ); 2570bc = FindProperty ( "_Gimmick_Letter_Grid_2_Min_Screen_Px_Range" ); 2571FloatProperty ( bc , "Minimum screen px range" ); 2572bc = FindProperty ( "_Gimmick_Letter_Grid_2_Blurriness" ); 2573FloatProperty ( bc , "Blurriness" ); 2574bc = FindProperty ( "_Gimmick_Letter_Grid_2_Alpha_Threshold" ); 2575RangeProperty ( bc , "Alpha threshold" ); 2576 2577EditorGUI . indentLevel -= 1 ; 2578} 2579 2580void DoGimmickAudiolinkChroma00 () { 2581MaterialProperty bc ; 2582bc = FindProperty ( "_Gimmick_AL_Chroma_00_Enable_Static" ); 2583bool enabled = ( bc . floatValue != 0.0 ); 2584EditorGUI . BeginChangeCheck (); 2585enabled = Toggle ( "Audiolink chroma 00" , enabled ); 2586EditorGUI . EndChangeCheck (); 2587bc . floatValue = enabled ? 1.0f : 0.0f ; 2588SetKeyword ( "_GIMMICK_AL_CHROMA_00" , enabled ); 2589 2590if ( ! enabled ) { 2591return ; 2592} 2593 2594EditorGUI . indentLevel += 1 ; 2595 2596bc = FindProperty ( "_Gimmick_AL_Chroma_00_Forward_Pass" ); 2597enabled = bc . floatValue > 1E-6 ; 2598EditorGUI . BeginChangeCheck (); 2599enabled = Toggle ( "Forward pass" , enabled ); 2600EditorGUI . EndChangeCheck (); 2601bc . floatValue = enabled ? 1.0f : 0.0f ; 2602 2603if ( enabled ) { 2604bc = FindProperty ( "_Gimmick_AL_Chroma_00_Forward_Blend" ); 2605RangeProperty ( bc , "Blend factor" ); 2606} 2607 2608bc = FindProperty ( "_Gimmick_AL_Chroma_00_Outline_Pass" ); 2609enabled = bc . floatValue > 1E-6 ; 2610EditorGUI . BeginChangeCheck (); 2611enabled = Toggle ( "Outline pass" , enabled ); 2612EditorGUI . EndChangeCheck (); 2613bc . floatValue = enabled ? 1.0f : 0.0f ; 2614 2615if ( enabled ) { 2616EditorGUI . indentLevel += 1 ; 2617 2618bc = FindProperty ( "_Gimmick_AL_Chroma_00_Outline_Blend" ); 2619RangeProperty ( bc , "Blend factor" ); 2620 2621bc = FindProperty ( "_Gimmick_AL_Chroma_00_Outline_Emission" ); 2622RangeProperty ( bc , "Emission strength" ); 2623EditorGUI . indentLevel -= 1 ; 2624} 2625 2626bc = FindProperty ( "_Gimmick_AL_Chroma_00_Hue_Shift_Enable_Static" ); 2627enabled = bc . floatValue > 1E-6 ; 2628EditorGUI . BeginChangeCheck (); 2629enabled = Toggle ( "Hue shift" , enabled ); 2630EditorGUI . EndChangeCheck (); 2631bc . floatValue = enabled ? 1.0f : 0.0f ; 2632SetKeyword ( "_GIMMICK_AL_CHROMA_00_HUE_SHIFT" , enabled ); 2633 2634if ( enabled ) { 2635EditorGUI . indentLevel += 1 ; 2636 2637bc = FindProperty ( "_Gimmick_AL_Chroma_00_Hue_Shift_Theta" ); 2638RangeProperty ( bc , "Theta" ); 2639 2640EditorGUI . indentLevel -= 1 ; 2641} 2642 2643EditorGUI . indentLevel -= 1 ; 2644} 2645 2646enum GimmickFog00BoundaryType { 2647Cylinder = 0 , 2648Plane = 1 , 2649Sphere = 2 , 2650} ; 2651 2652void DoGimmickFog0 () { 2653MaterialProperty bc ; 2654 2655bc = FindProperty ( "_Gimmick_Fog_00_Enable_Static" ); 2656bool enabled = ( bc . floatValue != 0.0 ); 2657EditorGUI . BeginChangeCheck (); 2658enabled = Toggle ( "Fog 00" , enabled ); 2659EditorGUI . EndChangeCheck (); 2660bc . floatValue = enabled ? 1.0f : 0.0f ; 2661SetKeyword ( "_GIMMICK_FOG_00" , enabled ); 2662 2663if ( ! enabled ) { 2664return ; 2665} 2666 2667EditorGUI . indentLevel += 1 ; 2668 2669bc = FindProperty ( "_Gimmick_Fog_00_Density" ); 2670RangeProperty ( bc , "Density" ); 2671 2672bc = FindProperty ( "_Gimmick_Fog_00_Boundary_Type" ); 2673EditorGUI . BeginChangeCheck (); 2674GimmickFog00BoundaryType boundary_type = ( GimmickFog00BoundaryType ) Math . Round ( bc . floatValue ); 2675boundary_type = ( GimmickFog00BoundaryType ) EnumPopup ( 2676MakeLabel ( "Boundary type" ), boundary_type ); 2677EditorGUI . EndChangeCheck (); 2678bc . floatValue = ( int ) boundary_type ; 2679 2680if ( boundary_type == GimmickFog00BoundaryType . Cylinder || boundary_type == GimmickFog00BoundaryType . Sphere ) { 2681bc = FindProperty ( "_Gimmick_Fog_00_Radius" ); 2682FloatProperty ( bc , "Radius" ); 2683} else if ( boundary_type == GimmickFog00BoundaryType . Plane ) { 2684bc = FindProperty ( "_Gimmick_Fog_00_Plane_Normal" ); 2685VectorProperty ( bc , "Plane normal" ); 2686bc = FindProperty ( "_Gimmick_Fog_00_Plane_Center" ); 2687VectorProperty ( bc , "Plane center" ); 2688} 2689SetKeyword ( "_GIMMICK_FOG_00_BOUNDARY_CYLINDER" , boundary_type == GimmickFog00BoundaryType . Cylinder ); 2690SetKeyword ( "_GIMMICK_FOG_00_BOUNDARY_SPHERE" , boundary_type == GimmickFog00BoundaryType . Sphere ); 2691SetKeyword ( "_GIMMICK_FOG_00_BOUNDARY_PLANE" , boundary_type == GimmickFog00BoundaryType . Plane ); 2692 2693bc = FindProperty ( "_Gimmick_Fog_00_Step_Size_Factor" ); 2694FloatProperty ( bc , "Step size multiplier" ); 2695bc = FindProperty ( "_Gimmick_Fog_00_Initial_Offset" ); 2696FloatProperty ( bc , "Initial offset" ); 2697bc = FindProperty ( "_Gimmick_Fog_00_Max_Ray" ); 2698FloatProperty ( bc , "Max ray length (m)" ); 2699bc = FindProperty ( "_Gimmick_Fog_00_Noise_Scale" ); 2700VectorProperty ( bc , "Noise scale" ); 2701bc = FindProperty ( "_Gimmick_Fog_00_Motion_Vector" ); 2702VectorProperty ( bc , "Motion vector" ); 2703bc = FindProperty ( "_Gimmick_Fog_00_Noise_Exponent" ); 2704FloatProperty ( bc , "Noise exponent" ); 2705bc = FindProperty ( "_Gimmick_Fog_00_Normal_Cutoff" ); 2706RangeProperty ( bc , "Normal cutoff" ); 2707bc = FindProperty ( "_Gimmick_Fog_00_Alpha_Cutoff" ); 2708RangeProperty ( bc , "Alpha cutoff" ); 2709bc = FindProperty ( "_Gimmick_Fog_00_Ray_Origin_Randomization" ); 2710RangeProperty ( bc , "Ray origin randomization" ); 2711bc = FindProperty ( "_Gimmick_Fog_00_Lod_Half_Life" ); 2712FloatProperty ( bc , "LOD half life" ); 2713bc = FindProperty ( "_Gimmick_Fog_00_Max_Brightness" ); 2714RangeProperty ( bc , "Max brightness" ); 2715bc = FindProperty ( "_Gimmick_Fog_00_Noise" ); 2716TexturePropertySingleLine ( 2717MakeLabel ( bc , "3D Noise" ), 2718bc ); 2719bc = FindProperty ( "_Gimmick_Fog_00_Noise_2D" ); 2720TexturePropertySingleLine ( 2721MakeLabel ( bc , "2D Noise (optional)" ), 2722bc ); 2723SetKeyword ( "_GIMMICK_FOG_00_NOISE_2D" , bc . textureValue ); 2724 2725bc = FindProperty ( "_Gimmick_Fog_00_LTCGI_Brightness" ); 2726FloatProperty ( bc , "LTCGI brightness" ); 2727 2728bc = FindProperty ( "_Gimmick_Fog_00_Emitter_Texture" ); 2729TexturePropertySingleLine ( 2730MakeLabel ( bc , "Emitter texture" ), 2731bc ); 2732SetKeyword ( "_GIMMICK_FOG_00_EMITTER_TEXTURE" , bc . textureValue ); 2733if ( bc . textureValue ) { 2734EditorGUI . indentLevel += 1 ; 2735 2736// TODO this is a misnomer, it's actually enabling normal-based 2737// lighting. 2738bc = FindProperty ( "_Gimmick_Fog_00_Emitter_Variable_Density" ); 2739enabled = ( bc . floatValue != 0.0 ); 2740EditorGUI . BeginChangeCheck (); 2741enabled = Toggle ( "Enable variable density" , enabled ); 2742EditorGUI . EndChangeCheck (); 2743bc . floatValue = enabled ? 1.0f : 0.0f ; 2744SetKeyword ( "_GIMMICK_FOG_00_EMITTER_VARIABLE_DENSITY" , enabled ); 2745 2746bc = FindProperty ( "_Gimmick_Fog_00_Emitter0_Location" ); 2747VectorProperty ( bc , "Location (world)" ); 2748bc = FindProperty ( "_Gimmick_Fog_00_Emitter0_Normal" ); 2749VectorProperty ( bc , "Normal (world)" ); 2750bc = FindProperty ( "_Gimmick_Fog_00_Emitter0_Tangent" ); 2751VectorProperty ( bc , "Tangent (world)" ); 2752bc = FindProperty ( "_Gimmick_Fog_00_Emitter0_Scale_T" ); 2753FloatProperty ( bc , "Scale (tangent)" ); 2754bc = FindProperty ( "_Gimmick_Fog_00_Emitter0_Scale_NxT" ); 2755FloatProperty ( bc , "Scale (normal x tangent)" ); 2756 2757bc = FindProperty ( "_Gimmick_Fog_00_Emitter_Brightness_Diffuse" ); 2758FloatProperty ( bc , "Brightness (diffuse)" ); 2759bc = FindProperty ( "_Gimmick_Fog_00_Emitter_Brightness_Direct" ); 2760FloatProperty ( bc , "Brightness (direct)" ); 2761bc = FindProperty ( "_Gimmick_Fog_00_Emitter_Lod_Half_Life" ); 2762FloatProperty ( bc , "LOD half life" ); 2763 2764for ( int i = 0 ; i < 2 ; i ++ ) { 2765bc = FindProperty ( $"_Gimmick_Fog_00_Emitter { i + 1 } _Enable_Static" ); 2766enabled = ( bc . floatValue != 0.0 ); 2767EditorGUI . BeginChangeCheck (); 2768enabled = Toggle ( $"Enable emitter { i + 1 } " , enabled ); 2769EditorGUI . EndChangeCheck (); 2770bc . floatValue = enabled ? 1.0f : 0.0f ; 2771SetKeyword ( $"_GIMMICK_FOG_00_EMITTER_ { i + 1 } " , enabled ); 2772 2773if ( enabled ) { 2774EditorGUI . indentLevel += 1 ; 2775 2776bc = FindProperty ( $"_Gimmick_Fog_00_Emitter { i + 1 } _Location" ); 2777VectorProperty ( bc , "Location (world)" ); 2778bc = FindProperty ( $"_Gimmick_Fog_00_Emitter { i + 1 } _Normal" ); 2779VectorProperty ( bc , "Normal (world)" ); 2780bc = FindProperty ( $"_Gimmick_Fog_00_Emitter { i + 1 } _Scale_X" ); 2781FloatProperty ( bc , "Scale (x)" ); 2782bc = FindProperty ( $"_Gimmick_Fog_00_Emitter { i + 1 } _Scale_Y" ); 2783FloatProperty ( bc , "Scale (y)" ); 2784 2785EditorGUI . indentLevel -= 1 ; 2786} 2787} 2788 2789EditorGUI . indentLevel -= 1 ; 2790} 2791 2792bc = FindProperty ( "_Gimmick_Fog_00_Ray_March_0_Enable_Static" ); 2793enabled = ( bc . floatValue != 0.0 ); 2794EditorGUI . BeginChangeCheck (); 2795enabled = Toggle ( "Ray march effect 0" , enabled ); 2796EditorGUI . EndChangeCheck (); 2797bc . floatValue = enabled ? 1.0f : 0.0f ; 2798SetKeyword ( "_GIMMICK_FOG_00_RAY_MARCH_0" , enabled ); 2799 2800if ( enabled ) { 2801EditorGUI . indentLevel += 1 ; 2802 2803bc = FindProperty ( "_Gimmick_Fog_00_Ray_March_0_Seed" ); 2804FloatProperty ( bc , "Seed" ); 2805 2806EditorGUI . indentLevel -= 1 ; 2807} 2808 2809// Composite fog on top of some raymarched effect. Does not rely on depth 2810// buffer; uses whatever the raymarch generated. 2811bc = FindProperty ( "_Gimmick_Fog_00_Overlay_Mode" ); 2812enabled = ( bc . floatValue != 0.0 ); 2813EditorGUI . BeginChangeCheck (); 2814enabled = Toggle ( "Overlay mode" , enabled ); 2815EditorGUI . EndChangeCheck (); 2816bc . floatValue = enabled ? 1.0f : 0.0f ; 2817 2818EditorGUI . indentLevel -= 1 ; 2819} 2820 2821void DoGimmickFog1 () { 2822MaterialProperty bc ; 2823 2824bc = FindProperty ( "_Gimmick_Fog_01_Enable_Static" ); 2825bool enabled = ( bc . floatValue != 0.0 ); 2826EditorGUI . BeginChangeCheck (); 2827enabled = Toggle ( "Fog 01" , enabled ); 2828EditorGUI . EndChangeCheck (); 2829bc . floatValue = enabled ? 1.0f : 0.0f ; 2830SetKeyword ( "_GIMMICK_FOG_01" , enabled ); 2831 2832if ( ! enabled ) { 2833return ; 2834} 2835EditorGUI . indentLevel += 1 ; 2836 2837bc = FindProperty ( "_Gimmick_Fog_01_Density" ); 2838RangeProperty ( bc , "Density" ); 2839bc = FindProperty ( "_Gimmick_Fog_01_Sun_Direction" ); 2840VectorProperty ( bc , "Sun direction" ); 2841bc = FindProperty ( "_Gimmick_Fog_01_Color" ); 2842ColorProperty ( bc , "Color" ); 2843bc = FindProperty ( "_Gimmick_Fog_01_Sun_Color" ); 2844ColorProperty ( bc , "Sun color" ); 2845bc = FindProperty ( "_Gimmick_Fog_01_Sun_Exponent" ); 2846FloatProperty ( bc , "Sun exponent" ); 2847 2848bc = FindProperty ( "_Gimmick_Fog_01_Sun_Color_2_Enable" ); 2849enabled = ( bc . floatValue != 0.0 ); 2850EditorGUI . BeginChangeCheck (); 2851enabled = Toggle ( "Sun color 2" , enabled ); 2852EditorGUI . EndChangeCheck (); 2853bc . floatValue = enabled ? 1.0f : 0.0f ; 2854 2855if ( enabled ) { 2856EditorGUI . indentLevel += 1 ; 2857 2858bc = FindProperty ( "_Gimmick_Fog_01_Sun_Color_2" ); 2859ColorProperty ( bc , "Color" ); 2860bc = FindProperty ( "_Gimmick_Fog_01_Sun_Exponent_2" ); 2861FloatProperty ( bc , "Exponent" ); 2862 2863EditorGUI . indentLevel -= 1 ; 2864} 2865 2866bc = FindProperty ( "_Gimmick_Fog_01_Distance_Culling_Enable" ); 2867enabled = ( bc . floatValue != 0.0 ); 2868EditorGUI . BeginChangeCheck (); 2869enabled = Toggle ( "Distance culling enable" , enabled ); 2870EditorGUI . EndChangeCheck (); 2871bc . floatValue = enabled ? 1.0f : 0.0f ; 2872 2873if ( enabled ) { 2874EditorGUI . indentLevel += 1 ; 2875 2876bc = FindProperty ( "_Gimmick_Fog_01_Activation_Center" ); 2877VectorProperty ( bc , "Activation center" ); 2878bc = FindProperty ( "_Gimmick_Fog_01_Activation_Radius" ); 2879FloatProperty ( bc , "Activation radius" ); 2880 2881EditorGUI . indentLevel -= 1 ; 2882} 2883 2884bc = FindProperty ( "_Gimmick_Fog_01_Overlay_Mode" ); 2885enabled = ( bc . floatValue != 0.0 ); 2886EditorGUI . BeginChangeCheck (); 2887enabled = Toggle ( "Overlay mode" , enabled ); 2888EditorGUI . EndChangeCheck (); 2889bc . floatValue = enabled ? 1.0f : 0.0f ; 2890 2891EditorGUI . indentLevel -= 1 ; 2892} 2893 2894void DoGimmickZWriteAbomination () { 2895MaterialProperty bc ; 2896 2897bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Enable_Static" ); 2898bool enabled = ( bc . floatValue != 0.0 ); 2899EditorGUI . BeginChangeCheck (); 2900enabled = Toggle ( "Zwrite abomination" , enabled ); 2901EditorGUI . EndChangeCheck (); 2902bc . floatValue = enabled ? 1.0f : 0.0f ; 2903SetKeyword ( "_GIMMICK_ZWRITE_ABOMINATION" , enabled ); 2904 2905if ( ! enabled ) { 2906return ; 2907} 2908 2909EditorGUI . indentLevel += 1 ; 2910 2911bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Min_Hit_Dist" ); 2912FloatProperty ( bc , "Min hit dist" ); 2913bc = FindProperty ( "_Gimmick_ZWrite_Abomination_March_Steps" ); 2914FloatProperty ( bc , "March steps" ); 2915bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Normal_Epsilon" ); 2916FloatProperty ( bc , "Normal epsilon" ); 2917bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Initial_Step_Size" ); 2918FloatProperty ( bc , "Initial step size" ); 2919bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Global_Scale" ); 2920FloatProperty ( bc , "Global scale" ); 2921bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Vertex_Expansion_Factor" ); 2922FloatProperty ( bc , "Vertex expansion factor" ); 2923bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Global_Offset" ); 2924VectorProperty ( bc , "Global offset" ); 2925 2926bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Body_Half_Height" ); 2927FloatProperty ( bc , "Body half height" ); 2928bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Body_Radius" ); 2929FloatProperty ( bc , "Body radius" ); 2930bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Radius" ); 2931FloatProperty ( bc , "Denim radius" ); 2932bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Half_Height" ); 2933FloatProperty ( bc , "Denim half height" ); 2934bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Center" ); 2935VectorProperty ( bc , "Denim center" ); 2936bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Strap_Theta" ); 2937FloatProperty ( bc , "Denim strap theta" ); 2938bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Strap_RA" ); 2939FloatProperty ( bc , "Denim strap RA" ); 2940bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Strap_RB" ); 2941FloatProperty ( bc , "Denim strap RB" ); 2942bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Strap_Z_Theta" ); 2943FloatProperty ( bc , "Denim strap z theta" ); 2944bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Strap_Center" ); 2945VectorProperty ( bc , "Denim strap center" ); 2946bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Radius" ); 2947FloatProperty ( bc , "Lens radius" ); 2948bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Depth" ); 2949FloatProperty ( bc , "Lens depth" ); 2950bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Thickness" ); 2951FloatProperty ( bc , "Lens thickness" ); 2952bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Strap_Height" ); 2953FloatProperty ( bc , "Lens strap height" ); 2954bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Pupil_Radius" ); 2955FloatProperty ( bc , "Pupil radius" ); 2956bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Eye_Center" ); 2957VectorProperty ( bc , "Eye center" ); 2958bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Arm_Radius" ); 2959FloatProperty ( bc , "Arm radius" ); 2960bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Arm_Half_Length" ); 2961FloatProperty ( bc , "Arm half length" ); 2962bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Arm_Center" ); 2963VectorProperty ( bc , "Arm center" ); 2964bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Leg_Radius" ); 2965FloatProperty ( bc , "Leg radius" ); 2966bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Leg_Half_Length" ); 2967FloatProperty ( bc , "Leg half length" ); 2968bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Leg_Center" ); 2969VectorProperty ( bc , "Leg center" ); 2970bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Mouth_Theta" ); 2971FloatProperty ( bc , "Mouth theta" ); 2972bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Mouth_RA" ); 2973FloatProperty ( bc , "Mouth RA" ); 2974bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Mouth_RB" ); 2975FloatProperty ( bc , "Mouth RB" ); 2976bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Mouth_Center" ); 2977VectorProperty ( bc , "Mouth center" ); 2978 2979bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Strap_Color" ); 2980ColorProperty ( bc , "Lens strap color" ); 2981bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Strap_Metallic" ); 2982FloatProperty ( bc , "Lens strap metallic" ); 2983bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Strap_Roughness" ); 2984FloatProperty ( bc , "Lens strap roughness" ); 2985bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Skin_Color" ); 2986ColorProperty ( bc , "Skin color" ); 2987bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Skin_Metallic" ); 2988FloatProperty ( bc , "Skin metallic" ); 2989bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Skin_Roughness" ); 2990FloatProperty ( bc , "Skin roughness" ); 2991bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Color" ); 2992ColorProperty ( bc , "Lens color" ); 2993bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Metallic" ); 2994FloatProperty ( bc , "Lens metallic" ); 2995bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Lens_Roughness" ); 2996FloatProperty ( bc , "Lens roughness" ); 2997bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Color" ); 2998ColorProperty ( bc , "Denim color" ); 2999bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Metallic" ); 3000FloatProperty ( bc , "Denim metallic" ); 3001bc = FindProperty ( "_Gimmick_ZWrite_Abomination_Denim_Roughness" ); 3002FloatProperty ( bc , "Denim roughness" ); 3003 3004EditorGUI . indentLevel -= 1 ; 3005} 3006 3007 3008void DoGimmickAurora () { 3009MaterialProperty bc ; 3010 3011bc = FindProperty ( "_Gimmick_Aurora_Enable_Static" ); 3012bool enabled = ( bc . floatValue != 0.0 ); 3013EditorGUI . BeginChangeCheck (); 3014enabled = Toggle ( "Aurora" , enabled ); 3015EditorGUI . EndChangeCheck (); 3016bc . floatValue = enabled ? 1.0f : 0.0f ; 3017SetKeyword ( "_GIMMICK_AURORA" , enabled ); 3018 3019if ( ! enabled ) { 3020return ; 3021} 3022EditorGUI . indentLevel += 1 ; 3023EditorGUI . indentLevel -= 1 ; 3024} 3025 3026void DoGimmickGerstnerWater () { 3027MaterialProperty bc ; 3028 3029bc = FindProperty ( "_Gimmick_Gerstner_Water_Enable_Static" ); 3030bool enabled = ( bc . floatValue != 0.0 ); 3031EditorGUI . BeginChangeCheck (); 3032enabled = Toggle ( "Water (gerstner)" , enabled ); 3033EditorGUI . EndChangeCheck (); 3034bc . floatValue = enabled ? 1.0f : 0.0f ; 3035SetKeyword ( "_GIMMICK_GERSTNER_WATER" , enabled ); 3036 3037if ( ! enabled ) { 3038return ; 3039} 3040EditorGUI . indentLevel += 1 ; 3041 3042bc = FindProperty ( "_Gimmick_Gerstner_Water_M" ); 3043FloatProperty ( bc , "M" ); 3044int num_octaves = ( int ) Math . Floor (( bc . floatValue - 1 ) / 4 ); 3045SetKeyword ( "_GIMMICK_GERSTNER_WATER_OCTAVE_1" , num_octaves >= 1 ); 3046 3047bc = FindProperty ( "_Gimmick_Gerstner_Water_Color_Ramp" ); 3048TexturePropertySingleLine ( 3049MakeLabel ( bc , "Color ramp" ), 3050bc ); 3051SetKeyword ( "_GIMMICK_GERSTNER_WATER_COLOR_RAMP" , bc . textureValue ); 3052 3053if ( bc . textureValue ) { 3054EditorGUI . indentLevel += 1 ; 3055 3056bc = FindProperty ( "_Gimmick_Gerstner_Water_Color_Ramp_Offset" ); 3057FloatProperty ( bc , "Offset" ); 3058bc = FindProperty ( "_Gimmick_Gerstner_Water_Color_Ramp_Scale" ); 3059FloatProperty ( bc , "Scale" ); 3060bc = FindProperty ( "_Gimmick_Gerstner_Water_Color_Ramp_Mask" ); 3061VectorProperty ( bc , "Mask (octave 0)" ); 3062bc = FindProperty ( "_Gimmick_Gerstner_Water_Color_Ramp_Mask1" ); 3063VectorProperty ( bc , "Mask (octave 1)" ); 3064 3065EditorGUI . indentLevel -= 1 ; 3066} 3067 3068{ 3069LabelField ( "Octave 0" , EditorStyles . boldLabel ); 3070EditorGUI . indentLevel += 1 ; 3071bc = FindProperty ( "_Gimmick_Gerstner_Water_a" ); 3072VectorProperty ( bc , "a" ); 3073bc = FindProperty ( "_Gimmick_Gerstner_Water_p" ); 3074VectorProperty ( bc , "p" ); 3075bc = FindProperty ( "_Gimmick_Gerstner_Water_k_x" ); 3076VectorProperty ( bc , "k_x" ); 3077bc = FindProperty ( "_Gimmick_Gerstner_Water_k_y" ); 3078VectorProperty ( bc , "k_y" ); 3079bc = FindProperty ( "_Gimmick_Gerstner_Water_t_f" ); 3080VectorProperty ( bc , "Time speed" ); 3081EditorGUI . indentLevel -= 1 ; 3082} 3083if ( num_octaves > 0 ) { 3084LabelField ( "Octave 1" , EditorStyles . boldLabel ); 3085EditorGUI . indentLevel += 1 ; 3086bc = FindProperty ( "_Gimmick_Gerstner_Water_a1" ); 3087VectorProperty ( bc , "a" ); 3088bc = FindProperty ( "_Gimmick_Gerstner_Water_p1" ); 3089VectorProperty ( bc , "p" ); 3090bc = FindProperty ( "_Gimmick_Gerstner_Water_k_x1" ); 3091VectorProperty ( bc , "k_x" ); 3092bc = FindProperty ( "_Gimmick_Gerstner_Water_k_y1" ); 3093VectorProperty ( bc , "k_y" ); 3094bc = FindProperty ( "_Gimmick_Gerstner_Water_t_f1" ); 3095VectorProperty ( bc , "Time speed" ); 3096EditorGUI . indentLevel -= 1 ; 3097} 3098 3099bc = FindProperty ( "_Gimmick_Gerstner_Water_h" ); 3100FloatProperty ( bc , "h" ); 3101bc = FindProperty ( "_Gimmick_Gerstner_Water_g" ); 3102FloatProperty ( bc , "g" ); 3103bc = FindProperty ( "_Gimmick_Gerstner_Water_Scale" ); 3104VectorProperty ( bc , "Scale" ); 3105bc = FindProperty ( "_Gimmick_Gerstner_Water_Origin_Damping_Direction" ); 3106FloatProperty ( bc , "Origin damping direction" ); 3107 3108EditorGUI . indentLevel -= 1 ; 3109} 3110 3111// Discard unless camera is inside this box. 3112void DoGimmickBoxDiscard () { 3113MaterialProperty bc ; 3114 3115bc = FindProperty ( "_Gimmick_Box_Discard_Enable_Static" ); 3116bool enabled = ( bc . floatValue != 0.0 ); 3117EditorGUI . BeginChangeCheck (); 3118enabled = Toggle ( "Box discard" , enabled ); 3119EditorGUI . EndChangeCheck (); 3120bc . floatValue = enabled ? 1.0f : 0.0f ; 3121SetKeyword ( "_GIMMICK_BOX_DISCARD" , enabled ); 3122 3123if ( ! enabled ) { 3124return ; 3125} 3126 3127EditorGUI . indentLevel += 1 ; 3128 3129bc = FindProperty ( "_Gimmick_Box_Discard_Corner_1" ); 3130VectorProperty ( bc , "Corner 1" ); 3131bc = FindProperty ( "_Gimmick_Box_Discard_Corner_2" ); 3132VectorProperty ( bc , "Corner 2" ); 3133 3134bc = FindProperty ( "_Gimmick_Box_Discard_Invert" ); 3135enabled = ( bc . floatValue != 0.0 ); 3136EditorGUI . BeginChangeCheck (); 3137enabled = Toggle ( "Invert" , enabled ); 3138EditorGUI . EndChangeCheck (); 3139bc . floatValue = enabled ? 1.0f : 0.0f ; 3140 3141EditorGUI . indentLevel -= 1 ; 3142} 3143 3144// Dim and desaturate colors. This is in no way comprehensive. Proceed with 3145// utmost caution whenever creating effects for users with photosensitive 3146// epilepsy. 3147void DoGimmickEpilepsyMode () { 3148MaterialProperty bc ; 3149 3150bc = FindProperty ( "_Gimmick_Epilepsy_Mode_Enable_Static" ); 3151bool enabled = ( bc . floatValue != 0.0 ); 3152EditorGUI . BeginChangeCheck (); 3153enabled = Toggle ( "Epilepsy protection mode" , enabled ); 3154EditorGUI . EndChangeCheck (); 3155bc . floatValue = enabled ? 1.0f : 0.0f ; 3156SetKeyword ( "_GIMMICK_EPILEPSY_MODE" , enabled ); 3157 3158if ( ! enabled ) { 3159return ; 3160} 3161 3162EditorGUI . indentLevel += 1 ; 3163 3164bc = FindProperty ( "_Gimmick_Epilepsy_Mode_Enable_Dynamic" ); 3165enabled = ( bc . floatValue != 0.0 ); 3166EditorGUI . BeginChangeCheck (); 3167enabled = Toggle ( "Enable (runtime switch)" , enabled ); 3168EditorGUI . EndChangeCheck (); 3169bc . floatValue = enabled ? 1.0f : 0.0f ; 3170 3171bc = FindProperty ( "_Gimmick_Epilepsy_Mode_Luminance_Cutoff" ); 3172RangeProperty ( bc , "Luminance cutoff" ); 3173bc = FindProperty ( "_Gimmick_Epilepsy_Mode_Saturation_Cutoff" ); 3174RangeProperty ( bc , "Saturation cutoff" ); 3175 3176bc = FindProperty ( "_Gimmick_Epilepsy_Mode_Rolloff_Power" ); 3177FloatProperty ( bc , "Rolloff power" ); 3178 3179EditorGUI . indentLevel -= 1 ; 3180} 3181 3182enum Lens00Mode { 3183Bayer , 3184InterleavedGradientNoise , 3185SurfaceStableFractalDithering , 3186} 3187 3188void DoLens00 () { 3189MaterialProperty bc ; 3190 3191bc = FindProperty ( "_Gimmick_Lens_00_Enable_Static" ); 3192bool enabled = ( bc . floatValue != 0.0 ); 3193EditorGUI . BeginChangeCheck (); 3194enabled = Toggle ( "Lens00" , enabled ); 3195EditorGUI . EndChangeCheck (); 3196bc . floatValue = enabled ? 1.0f : 0.0f ; 3197SetKeyword ( "_GIMMICK_LENS_00" , enabled ); 3198 3199if ( ! enabled ) { 3200return ; 3201} 3202 3203EditorGUI . indentLevel += 1 ; 3204 3205bc = FindProperty ( "_Gimmick_Lens_00_Enable_Frame_Counter" ); 3206enabled = ( bc . floatValue != 0.0 ); 3207EditorGUI . BeginChangeCheck (); 3208enabled = Toggle ( "Frame counter" , enabled ); 3209EditorGUI . EndChangeCheck (); 3210bc . floatValue = enabled ? 1.0f : 0.0f ; 3211SetKeyword ( "_GIMMICK_LENS_00_FRAME_COUNTER" , enabled ); 3212 3213bc = FindProperty ( "_Gimmick_Lens_00_Subdivisions" ); 3214FloatProperty ( bc , "Quantization subdivisions" ); 3215 3216if ( enabled ) { 3217EditorGUI . indentLevel += 1 ; 3218bc = FindProperty ( "_Gimmick_Lens_00_Frame_Counter_Speed" ); 3219FloatProperty ( bc , "Speed" ); 3220EditorGUI . indentLevel -= 1 ; 3221} 3222 3223 3224bc = FindProperty ( "_Gimmick_Lens_00_Scale" ); 3225FloatProperty ( bc , "Scale" ); 3226 3227bc = FindProperty ( "_Gimmick_Lens_00_Mode" ); 3228Lens00Mode mode = ( Lens00Mode ) Math . Round ( bc . floatValue ); 3229EditorGUI . BeginChangeCheck (); 3230mode = ( Lens00Mode ) EnumPopup ( 3231MakeLabel ( "Mode" ), mode ); 3232EditorGUI . EndChangeCheck (); 3233bc . floatValue = ( float ) mode ; 3234SetKeyword ( "_GIMMICK_LENS_00_BAYER" , mode == Lens00Mode . Bayer ); 3235SetKeyword ( "_GIMMICK_LENS_00_INTERLEAVED_GRADIENT_NOISE" , mode == Lens00Mode . InterleavedGradientNoise ); 3236SetKeyword ( "_GIMMICK_LENS_00_SSFD" , mode == Lens00Mode . SurfaceStableFractalDithering ); 3237 3238if ( mode == Lens00Mode . SurfaceStableFractalDithering ) { 3239EditorGUI . indentLevel += 1 ; 3240bc = FindProperty ( "_Gimmick_Lens_00_SSFD_Scale" ); 3241FloatProperty ( bc , "Scale" ); 3242bc = FindProperty ( "_Gimmick_Lens_00_SSFD_Max_Fwidth" ); 3243FloatProperty ( bc , "Max fwidth" ); 3244bc = FindProperty ( "_Gimmick_Lens_00_SSFD_Size_Factor" ); 3245FloatProperty ( bc , "Size factor" ); 3246bc = FindProperty ( "_Gimmick_Lens_00_SSFD_Noise" ); 3247TexturePropertySingleLine ( MakeLabel ( bc , "Noise" ), bc ); 3248EditorGUI . indentLevel -= 1 ; 3249} 3250 3251 3252EditorGUI . indentLevel -= 1 ; 3253} 3254 3255void DoSurfaceStableFractalDithering () { 3256MaterialProperty bc ; 3257 3258bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Enable_Static" ); 3259bool enabled = ( bc . floatValue != 0.0 ); 3260EditorGUI . BeginChangeCheck (); 3261enabled = Toggle ( "Stable fractal dithering" , enabled ); 3262EditorGUI . EndChangeCheck (); 3263bc . floatValue = enabled ? 1.0f : 0.0f ; 3264SetKeyword ( "_SURFACE_STABLE_FRACTAL_DITHERING" , enabled ); 3265 3266if ( ! enabled ) { 3267return ; 3268} 3269 3270EditorGUI . indentLevel += 1 ; 3271 3272bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Enable_Dynamic" ); 3273enabled = ( bc . floatValue != 0.0 ); 3274EditorGUI . BeginChangeCheck (); 3275enabled = Toggle ( "Enable (runtime switch)" , enabled ); 3276EditorGUI . EndChangeCheck (); 3277bc . floatValue = enabled ? 1.0f : 0.0f ; 3278 3279bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Noise" ); 3280TexturePropertySingleLine ( MakeLabel ( bc , "Noise" ), bc ); 3281bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Scale" ); 3282RangeProperty ( bc , "Scale" ); 3283bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Max_Fwidth" ); 3284FloatProperty ( bc , "Max fwidth" ); 3285bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Size_Factor" ); 3286FloatProperty ( bc , "Size factor" ); 3287bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_Brightness_Factor" ); 3288FloatProperty ( bc , "Brightness factor" ); 3289bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_UV_Offset_R" ); 3290VectorProperty ( bc , "UV offset (r)" ); 3291bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_UV_Offset_G" ); 3292VectorProperty ( bc , "UV offset (g)" ); 3293bc = FindProperty ( "_Surface_Stable_Fractal_Dithering_UV_Offset_B" ); 3294VectorProperty ( bc , "UV offset (b)" ); 3295 3296EditorGUI . indentLevel -= 1 ; 3297} 3298 3299void DoGimmicks () { 3300show_ui . Add ( AddCollapsibleMenu ( "Gimmicks" , "_Gimmicks" )); 3301EditorGUI . indentLevel += 1 ; 3302 3303DoGimmickFlatColor (); 3304DoGimmickUVDomainWarping (); 3305DoGimmickQuantizeLocation (); 3306DoGimmickShearLocation (); 3307DoGimmickSpherizeLocation (); 3308DoGimmickEyes00 (); 3309DoGimmickEyes01 (); 3310DoGimmickEyes02 (); 3311DoGimmickDownstairs2 (); 3312DoGimmickHalo00 (); 3313DoGimmickPixellate (); 3314DoGimmickTrochoid (); 3315DoGimmickFaceMeWorldY (); 3316DoGimmickRorschach (); 3317DoGimmickMirrorUVFlip (); 3318DoGimmickLetterGrid (); 3319DoGimmickLetterGrid2 (); 3320DoGimmickAudiolinkChroma00 (); 3321DoGimmickFog0 (); 3322DoGimmickFog1 (); 3323DoGimmickZWriteAbomination (); 3324DoGimmickAurora (); 3325DoGimmickGerstnerWater (); 3326DoGimmickBoxDiscard (); 3327DoClones (); 3328DoExplosion (); 3329DoGeoScroll (); 3330DoGimmickEpilepsyMode (); 3331DoLens00 (); 3332DoSurfaceStableFractalDithering (); 3333 3334EditorGUI . indentLevel -= 1 ; 3335show_ui . RemoveAt ( show_ui . Count - 1 ); 3336} 3337 3338void DoMochieParams () { 3339show_ui . Add ( AddCollapsibleMenu ( "Mochie" , "_Mochie" )); 3340EditorGUI . indentLevel += 1 ; 3341 3342MaterialProperty bc ; 3343 3344bc = FindProperty ( "_WrappingFactor" ); 3345RangeProperty ( bc , "Wrapping factor" ); 3346bc = FindProperty ( "_SpecularStrength" ); 3347RangeProperty ( bc , "Specular strength" ); 3348bc = FindProperty ( "_FresnelStrength" ); 3349RangeProperty ( bc , "Fresnel strength" ); 3350 3351bc = FindProperty ( "_UseFresnel" ); 3352bool enabled = bc . floatValue > 1E-6 ; 3353EditorGUI . BeginChangeCheck (); 3354enabled = Toggle ( "Use fresnel" , enabled ); 3355EditorGUI . EndChangeCheck (); 3356bc . floatValue = enabled ? 1.0f : 0.0f ; 3357 3358MaterialProperty bct = FindProperty ( "_ReflectionStrengthTex" ); 3359bc = FindProperty ( "_ReflectionStrength" ); 3360TexturePropertySingleLine ( 3361MakeLabel ( bct , "Ambient occlusion" ), 3362bct , bc ); 3363SetKeyword ( "_REFLECTION_STRENGTH_TEX" , bct . textureValue ); 3364 3365 3366bc = FindProperty ( "_Enable_SSR" ); 3367enabled = bc . floatValue > 1E-6 ; 3368EditorGUI . BeginChangeCheck (); 3369enabled = Toggle ( "Enable SSR" , enabled ); 3370EditorGUI . EndChangeCheck (); 3371bc . floatValue = enabled ? 1.0f : 0.0f ; 3372SetKeyword ( "SSR_ENABLED" , enabled ); 3373 3374if ( enabled ) { 3375EditorGUI . indentLevel += 1 ; 3376 3377bc = FindProperty ( "_SSRStrength" ); 3378FloatProperty ( bc , "Strength" ); 3379 3380bc = FindProperty ( "_SSRHeight" ); 3381FloatProperty ( bc , "Height" ); 3382 3383bc = FindProperty ( "_SSR_Mask" ); 3384TexturePropertySingleLine ( 3385MakeLabel ( bc , "Mask" ), 3386bc ); 3387SetKeyword ( "SSR_MASK" , bc . textureValue ); 3388 3389EditorGUI . indentLevel -= 1 ; 3390} else { 3391SetKeyword ( "SSR_MASK" , false ); 3392} 3393 3394EditorGUI . indentLevel -= 1 ; 3395show_ui . RemoveAt ( show_ui . Count - 1 ); 3396} 3397 3398enum RenderingMode { 3399Opaque , 3400Cutout , 3401Fade , 3402Transparent , 3403TransClipping , 3404} 3405 3406enum CutoutMode { 3407Cutoff , 3408Stochastic , 3409InterleavedGradientNoise , 3410NoiseMask , 3411SurfaceStableFractalDithering , 3412} 3413 3414// unity is made by fucking morons and they don't expose this so i'm 3415// reimplementing it 3416// ref: https://docs.unity3d.com/6000.0/Documentation/Manual/SL-ZTest.html 3417enum ZTestMode { 3418Disabled , 3419Never , 3420Less , 3421Equal , 3422LEqual , 3423Greater , 3424NotEqual , 3425GEqual , 3426Always 3427} 3428 3429void DoRendering () { 3430show_ui . Add ( AddCollapsibleMenu ( "Rendering" , "_Rendering" )); 3431EditorGUI . indentLevel += 1 ; 3432 3433RenderingMode mode = RenderingMode . Opaque ; 3434if ( target . IsKeywordEnabled ( "_RENDERING_CUTOUT" )) { 3435mode = RenderingMode . Cutout ; 3436} else if ( target . IsKeywordEnabled ( "_RENDERING_FADE" )) { 3437mode = RenderingMode . Fade ; 3438} else if ( target . IsKeywordEnabled ( "_RENDERING_TRANSPARENT" )) { 3439mode = RenderingMode . Transparent ; 3440} else if ( target . IsKeywordEnabled ( "_RENDERING_TRANSCLIPPING" )) { 3441mode = RenderingMode . TransClipping ; 3442} 3443 3444MaterialProperty bc ; 3445 3446EditorGUI . BeginChangeCheck (); 3447mode = ( RenderingMode ) EnumPopup ( 3448MakeLabel ( "Rendering mode" ), mode ); 3449BlendMode src_blend = BlendMode . One ; 3450BlendMode dst_blend = BlendMode . Zero ; 3451bool zwrite = false ; 3452EditorGUI . EndChangeCheck (); 3453RecordAction ( "Rendering mode" ); 3454 3455bc = FindProperty ( "_Render_Queue_Offset" ); 3456IntegerProperty ( 3457bc , 3458"Render queue offset" ); 3459int queue_offset = bc . intValue ; 3460 3461{ 3462SetKeyword ( "_RENDERING_CUTOUT" , mode == RenderingMode . Cutout ); 3463SetKeyword ( "_RENDERING_FADE" , mode == RenderingMode . Fade ); 3464SetKeyword ( "_RENDERING_TRANSPARENT" , mode == RenderingMode . Transparent ); 3465SetKeyword ( "_RENDERING_TRANSCLIPPING" , mode == RenderingMode . TransClipping ); 3466 3467RenderQueue queue = RenderQueue . Geometry ; 3468string render_type = "" ; 3469switch ( mode ) { 3470case RenderingMode . Opaque : 3471queue = RenderQueue . Geometry ; 3472render_type = "" ; 3473src_blend = BlendMode . One ; 3474dst_blend = BlendMode . Zero ; 3475zwrite = true ; 3476break ; 3477case RenderingMode . Cutout : 3478queue = RenderQueue . AlphaTest ; 3479render_type = "TransparentCutout" ; 3480src_blend = BlendMode . One ; 3481dst_blend = BlendMode . Zero ; 3482zwrite = true ; 3483break ; 3484case RenderingMode . Fade : 3485queue = RenderQueue . Transparent ; 3486render_type = "Transparent" ; 3487src_blend = BlendMode . SrcAlpha ; 3488dst_blend = BlendMode . OneMinusSrcAlpha ; 3489zwrite = false ; 3490break ; 3491case RenderingMode . Transparent : 3492queue = RenderQueue . Transparent ; 3493render_type = "Transparent" ; 3494src_blend = BlendMode . One ; 3495dst_blend = BlendMode . OneMinusSrcAlpha ; 3496zwrite = false ; 3497break ; 3498case RenderingMode . TransClipping : 3499queue = RenderQueue . AlphaTest ; 3500render_type = "Transparent" ; 3501src_blend = BlendMode . SrcAlpha ; 3502dst_blend = BlendMode . OneMinusSrcAlpha ; 3503zwrite = true ; 3504break ; 3505} 3506 3507foreach ( Material m in editor . targets ) { 3508m . renderQueue = (( int ) queue ) + queue_offset ; 3509m . SetOverrideTag ( "RenderType" , render_type ); 3510m . SetInt ( "_SrcBlend" , ( int ) src_blend ); 3511m . SetInt ( "_DstBlend" , ( int ) dst_blend ); 3512m . SetInt ( "_ZWrite" , zwrite ? 1 : 0 ); 3513} 3514} 3515 3516if ( mode == RenderingMode . Cutout ) { 3517EditorGUI . BeginChangeCheck (); 3518bc = FindProperty ( "_Cutout_Mode" ); 3519CutoutMode cmode = ( CutoutMode ) Math . Round ( bc . floatValue ); 3520cmode = ( CutoutMode ) EnumPopup ( 3521MakeLabel ( "Cutout mode" ), cmode ); 3522EditorGUI . EndChangeCheck (); 3523bc . floatValue = ( float ) cmode ; 3524SetKeyword ( "_RENDERING_CUTOUT_STOCHASTIC" , cmode == CutoutMode . Stochastic ); 3525SetKeyword ( "_RENDERING_CUTOUT_IGN" , cmode == CutoutMode . InterleavedGradientNoise ); 3526SetKeyword ( "_RENDERING_CUTOUT_NOISE_MASK" , cmode == CutoutMode . NoiseMask ); 3527SetKeyword ( "_RENDERING_CUTOUT_SSFD" , cmode == CutoutMode . SurfaceStableFractalDithering ); 3528 3529EditorGUI . indentLevel += 1 ; 3530{ 3531if ( cmode == CutoutMode . Cutoff ) { 3532bc = FindProperty ( "_Alpha_Cutoff" ); 3533ShaderProperty ( bc , MakeLabel ( bc )); 3534} else if ( cmode == CutoutMode . NoiseMask ) { 3535bc = FindProperty ( "_Rendering_Cutout_Noise_Mask" ); 3536TexturePropertySingleLine ( 3537MakeLabel ( bc , "Noise mask" ), 3538bc ); 3539} else if ( cmode == CutoutMode . InterleavedGradientNoise ) { 3540bc = FindProperty ( "_Rendering_Cutout_Ign_Seed" ); 3541FloatProperty ( bc , "Seed" ); 3542} else if ( cmode == CutoutMode . SurfaceStableFractalDithering ) { 3543bc = FindProperty ( "_Rendering_Cutout_SSFD_Scale" ); 3544FloatProperty ( bc , "Scale" ); 3545bc = FindProperty ( "_Rendering_Cutout_SSFD_Max_Fwidth" ); 3546FloatProperty ( bc , "Max fwidth" ); 3547bc = FindProperty ( "_Rendering_Cutout_SSFD_Noise" ); 3548TexturePropertySingleLine ( MakeLabel ( bc , "Noise" ), bc ); 3549} 3550 3551bc = FindProperty ( "_Rendering_Cutout_Speed" ); 3552FloatProperty ( bc , "Speed (for stochastic methods)" ); 3553} 3554EditorGUI . indentLevel -= 1 ; 3555} 3556 3557bc = FindProperty ( "_Rendering_Cutout_Noise_Scale" ); 3558FloatProperty ( bc , "Cutout noise scale" ); 3559 3560bc = FindProperty ( "_Frame_Counter_Enable_Static" ); 3561bool enabled = bc . floatValue > 1E-6 ; 3562EditorGUI . BeginChangeCheck (); 3563enabled = Toggle ( "Frame counter" , enabled ); 3564EditorGUI . EndChangeCheck (); 3565bc . floatValue = enabled ? 1.0f : 0.0f ; 3566SetKeyword ( "_FRAME_COUNTER" , enabled ); 3567if ( enabled ) { 3568bc = FindProperty ( "_Frame_Counter" ); 3569FloatProperty ( bc , "Frame counter" ); 3570} 3571 3572bc = FindProperty ( "_Cull" ); 3573UnityEngine . Rendering . CullMode cull_mode = ( UnityEngine . Rendering . CullMode ) bc . floatValue ; 3574EditorGUI . BeginChangeCheck (); 3575cull_mode = ( UnityEngine . Rendering . CullMode ) EnumPopup ( 3576MakeLabel ( "Culling mode" ), cull_mode ); 3577if ( EditorGUI . EndChangeCheck ()) { 3578RecordAction ( "Culling mode" ); 3579bc . floatValue = ( float ) cull_mode ; 3580} 3581 3582EditorGUI . BeginChangeCheck (); 3583bc = FindProperty ( "_ZTest" ); 3584ZTestMode zmode = ( ZTestMode ) Math . Round ( bc . floatValue ); 3585zmode = ( ZTestMode ) EnumPopup ( 3586MakeLabel ( "ZTest" ), zmode ); 3587EditorGUI . EndChangeCheck (); 3588bc . floatValue = ( float ) zmode ; 3589 3590bc = FindProperty ( "_Discard_Enable_Static" ); 3591enabled = bc . floatValue > 1E-6 ; 3592EditorGUI . BeginChangeCheck (); 3593enabled = Toggle ( "Discard" , enabled ); 3594EditorGUI . EndChangeCheck (); 3595bc . floatValue = enabled ? 1.0f : 0.0f ; 3596SetKeyword ( "_DISCARD" , enabled ); 3597if ( enabled ) { 3598EditorGUI . indentLevel += 1 ; 3599bc = FindProperty ( "_Discard_Enable_Dynamic" ); 3600enabled = bc . floatValue > 1E-6 ; 3601EditorGUI . BeginChangeCheck (); 3602enabled = Toggle ( "Enable" , enabled ); 3603EditorGUI . EndChangeCheck (); 3604bc . floatValue = enabled ? 1.0f : 0.0f ; 3605EditorGUI . indentLevel -= 1 ; 3606} 3607 3608bc = FindProperty ( "_Enable_Unity_Fog" ); 3609enabled = bc . floatValue > 1E-6 ; 3610EditorGUI . BeginChangeCheck (); 3611enabled = Toggle ( "Enable Unity fog" , enabled ); 3612EditorGUI . EndChangeCheck (); 3613bc . floatValue = enabled ? 1.0f : 0.0f ; 3614SetKeyword ( "_UNITY_FOG" , enabled ); 3615 3616LabelField ( "Stenciling" , EditorStyles . boldLabel ); 3617for ( int i = 0 ; i < 2 ; i ++ ) { 3618EditorGUI . indentLevel += 1 ; 3619 3620string pass_str = "" ; 3621switch ( i ) { 3622case 0 : 3623pass_str = "Base" ; 3624break ; 3625case 1 : 3626pass_str = "Outline" ; 3627break ; 3628} 3629 3630LabelField ( $" { pass_str } pass" ); 3631{ 3632EditorGUI . indentLevel += 1 ; 3633bc = FindProperty ( $"_Stencil_Ref_ { pass_str } " ); 3634FloatProperty ( bc , "Ref" ); 3635 3636bc = FindProperty ( $"_Stencil_Comp_ { pass_str } " ); 3637EditorGUI . BeginChangeCheck (); 3638UnityEngine . Rendering . CompareFunction stencil_comp = 3639( UnityEngine . Rendering . CompareFunction ) bc . floatValue ; 3640stencil_comp = ( UnityEngine . Rendering . CompareFunction ) 3641EnumPopup ( MakeLabel ( "Comp" ), stencil_comp ); 3642EditorGUI . EndChangeCheck (); 3643RecordAction ( "Rendering mode" ); 3644bc . floatValue = ( float ) stencil_comp ; 3645 3646bc = FindProperty ( $"_Stencil_Pass_Op_ { pass_str } " ); 3647EditorGUI . BeginChangeCheck (); 3648UnityEngine . Rendering . StencilOp stencil_op = 3649( UnityEngine . Rendering . StencilOp ) bc . floatValue ; 3650stencil_op = ( UnityEngine . Rendering . StencilOp ) 3651EnumPopup ( MakeLabel ( "Pass op" ), stencil_op ); 3652EditorGUI . EndChangeCheck (); 3653RecordAction ( "Rendering mode" ); 3654bc . floatValue = ( float ) stencil_op ; 3655 3656bc = FindProperty ( $"_Stencil_Fail_Op_ { pass_str } " ); 3657EditorGUI . BeginChangeCheck (); 3658stencil_op = ( UnityEngine . Rendering . StencilOp ) bc . floatValue ; 3659stencil_op = ( UnityEngine . Rendering . StencilOp ) 3660EnumPopup ( MakeLabel ( "Fail op" ), stencil_op ); 3661EditorGUI . EndChangeCheck (); 3662RecordAction ( "Rendering mode" ); 3663bc . floatValue = ( float ) stencil_op ; 3664 3665EditorGUI . indentLevel -= 1 ; 3666} 3667EditorGUI . indentLevel -= 1 ; 3668} 3669EditorGUI . indentLevel -= 1 ; 3670show_ui . RemoveAt ( show_ui . Count - 1 ); 3671} 3672 3673void DoLighting () { 3674show_ui . Add ( AddCollapsibleMenu ( "Lighting" , "_Lighting" )); 3675EditorGUI . indentLevel += 1 ; 3676 3677MaterialProperty bc ; 3678 3679bc = FindProperty ( "_Enable_Brightness_Clamp" ); 3680bool brightness_clamp_enabled = bc . floatValue > 1E-6 ; 3681EditorGUI . BeginChangeCheck (); 3682brightness_clamp_enabled = Toggle ( "Clamp brightness" , 3683brightness_clamp_enabled ); 3684EditorGUI . EndChangeCheck (); 3685bc . floatValue = brightness_clamp_enabled ? 1.0f : 0.0f ; 3686SetKeyword ( "_BRIGHTNESS_CLAMP" , brightness_clamp_enabled ); 3687if ( brightness_clamp_enabled ) { 3688EditorGUI . indentLevel += 1 ; 3689bc = FindProperty ( "_Min_Brightness" ); 3690RangeProperty ( 3691bc , 3692"Min brightness" ); 3693 3694bc = FindProperty ( "_Max_Brightness" ); 3695RangeProperty ( 3696bc , 3697"Max brightness" ); 3698EditorGUI . indentLevel -= 1 ; 3699} 3700 3701bc = FindProperty ( "_Ambient_Occlusion" ); 3702TexturePropertySingleLine ( 3703MakeLabel ( bc , "Ambient occlusion" ), 3704bc ); 3705SetKeyword ( "_AMBIENT_OCCLUSION" , bc . textureValue ); 3706if ( bc . textureValue ) { 3707TextureScaleOffsetProperty ( bc ); 3708} 3709 3710if ( bc . textureValue ) { 3711bc = FindProperty ( "_Ambient_Occlusion_Strength" ); 3712RangeProperty ( bc , "Ambient occlusion strength" ); 3713} 3714 3715bc = FindProperty ( "_Cubemap" ); 3716TexturePropertySingleLine ( 3717MakeLabel ( bc , "Cubemap" ), 3718bc ); 3719SetKeyword ( "_CUBEMAP" , bc . textureValue ); 3720 3721if ( bc . textureValue ) { 3722bc = FindProperty ( "_Cubemap_Limit_To_Metallic" ); 3723bool cube_lim_enabled = bc . floatValue > 1E-6 ; 3724EditorGUI . BeginChangeCheck (); 3725cube_lim_enabled = Toggle ( "Limit to metallic" , 3726cube_lim_enabled ); 3727EditorGUI . EndChangeCheck (); 3728bc . floatValue = cube_lim_enabled ? 1.0f : 0.0f ; 3729} 3730 3731bc = FindProperty ( "_Lighting_Factor" ); 3732RangeProperty ( 3733bc , 3734"Lighting multiplier" ); 3735 3736{ 3737EditorGUI . indentLevel += 1 ; 3738bc = FindProperty ( "_Direct_Lighting_Factor" ); 3739RangeProperty ( 3740bc , 3741"Direct multiplier" ); 3742 3743bc = FindProperty ( "_Vertex_Lighting_Factor" ); 3744RangeProperty ( 3745bc , 3746"Vertex light multiplier" ); 3747 3748bc = FindProperty ( "_Indirect_Specular_Lighting_Factor" ); 3749RangeProperty ( 3750bc , 3751"Indirect specular multiplier" ); 3752 3753bc = FindProperty ( "_Indirect_Specular_Lighting_Factor2" ); 3754RangeProperty ( 3755bc , 3756"Secondary ind. spec. multiplier" ); 3757 3758bc = FindProperty ( "_Indirect_Diffuse_Lighting_Factor" ); 3759RangeProperty ( 3760bc , 3761"Indirect diffuse multiplier" ); 3762EditorGUI . indentLevel -= 1 ; 3763} 3764 3765bc = FindProperty ( "_Reflection_Probe_Saturation" ); 3766RangeProperty ( 3767bc , 3768"Reflection probe saturation" ); 3769 3770bc = FindProperty ( "_Shadow_Strength" ); 3771RangeProperty ( 3772bc , 3773"Shadows strength" ); 3774 3775bc = FindProperty ( "_Global_Sample_Bias" ); 3776FloatProperty ( 3777bc , 3778"Global mipmap bias" ); 3779 3780bc = FindProperty ( "_Proximity_Dimming_Enable_Static" ); 3781bool enabled = bc . floatValue > 1E-6 ; 3782EditorGUI . BeginChangeCheck (); 3783enabled = Toggle ( "Proximity dimming" , enabled ); 3784EditorGUI . EndChangeCheck (); 3785bc . floatValue = enabled ? 1.0f : 0.0f ; 3786SetKeyword ( "_PROXIMITY_DIMMING" , enabled ); 3787 3788if ( enabled ) { 3789EditorGUI . indentLevel += 1 ; 3790 3791bc = FindProperty ( "_Proximity_Dimming_Min_Dist" ); 3792FloatProperty ( bc , "Min distance" ); 3793 3794bc = FindProperty ( "_Proximity_Dimming_Max_Dist" ); 3795FloatProperty ( bc , "Max distance" ); 3796 3797bc = FindProperty ( "_Proximity_Dimming_Factor" ); 3798FloatProperty ( bc , "Dimming factor" ); 3799 3800EditorGUI . indentLevel -= 1 ; 3801} 3802 3803bc = FindProperty ( "_LTCGI_Enabled" ); 3804enabled = bc . floatValue > 1E-6 ; 3805EditorGUI . BeginChangeCheck (); 3806enabled = Toggle ( "Enable LTCGI" , enabled ); 3807EditorGUI . EndChangeCheck (); 3808bc . floatValue = enabled ? 1.0f : 0.0f ; 3809SetKeyword ( "_LTCGI" , enabled ); 3810 3811if ( enabled ) { 3812EditorGUI . indentLevel += 1 ; 3813 3814bc = FindProperty ( "_LTCGI_Enabled_Dynamic" ); 3815enabled = bc . floatValue > 1E-6 ; 3816EditorGUI . BeginChangeCheck (); 3817enabled = Toggle ( "Enable (runtime switch)" , enabled ); 3818EditorGUI . EndChangeCheck (); 3819bc . floatValue = enabled ? 1.0f : 0.0f ; 3820 3821bc = FindProperty ( "_LTCGI_SpecularColor" ); 3822ColorProperty ( bc , "Specular color (RGB)" ); 3823 3824bc = FindProperty ( "_LTCGI_DiffuseColor" ); 3825ColorProperty ( bc , "Diffuse color (RGB)" ); 3826 3827bc = FindProperty ( "_LTCGI_Strength" ); 3828FloatProperty ( bc , "LTCGI strength" ); 3829 3830EditorGUI . indentLevel -= 1 ; 3831} 3832 3833bc = FindProperty ( "_Force_World_Lighting" ); 3834enabled = bc . floatValue > 1E-6 ; 3835EditorGUI . BeginChangeCheck (); 3836enabled = Toggle ( "Force world lighting" , enabled ); 3837EditorGUI . EndChangeCheck (); 3838bc . floatValue = enabled ? 1.0f : 0.0f ; 3839SetKeyword ( "_FORCE_WORLD_LIGHTING" , enabled ); 3840 3841bc = FindProperty ( "_Aces_Filmic_Enable_Static" ); 3842enabled = bc . floatValue > 1E-6 ; 3843EditorGUI . BeginChangeCheck (); 3844enabled = Toggle ( "Enable ACES filmic" , enabled ); 3845EditorGUI . EndChangeCheck (); 3846bc . floatValue = enabled ? 1.0f : 0.0f ; 3847SetKeyword ( "_ACES_FILMIC" , enabled ); 3848 3849EditorGUI . BeginChangeCheck (); 3850editor . LightmapEmissionProperty (); 3851if ( EditorGUI . EndChangeCheck ()) { 3852foreach ( Material m in editor . targets ) { 3853m . globalIlluminationFlags &= 3854~ MaterialGlobalIlluminationFlags . EmissiveIsBlack ; 3855} 3856} 3857 3858EditorGUI . indentLevel -= 1 ; 3859show_ui . RemoveAt ( show_ui . Count - 1 ); 3860} 3861 3862void DoMain () { 3863DoPBR (); 3864DoPBROverlay (); 3865DoClearcoat (); 3866DoDecal (); 3867DoEmission (); 3868DoShadingMode (); 3869DoMatcapRL (); 3870DoOutlines (); 3871DoGlitter (); 3872DoUVScroll (); 3873DoHueShift (); 3874DoGimmicks (); 3875DoMochieParams (); 3876DoLighting (); 3877DoRendering (); 3878} 3879} 3880