コード例 #1
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            FindMaterialProperties(props);
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                uiBlocks.Initialize(materialEditor, props);
                uiBlocks.FetchUIBlock <SurfaceOptionUIBlock>().UpdateMaterialProperties(props);
                uiBlocks.FetchUIBlock <SurfaceOptionUIBlock>().OnGUI();

                // TODO: move the terrain UI to a MaterialUIBlock to clarify the code
                DrawTerrainGUI(materialEditor);

                uiBlocks.FetchUIBlock <SurfaceOptionUIBlock>().UpdateMaterialProperties(props);
                uiBlocks.FetchUIBlock <AdvancedOptionsUIBlock>().OnGUI();

                // Apply material keywords and pass:
                if (changed.changed)
                {
                    foreach (var material in uiBlocks.materials)
                    {
                        SetupMaterialKeywordsAndPassInternal(material);
                    }
                }
            }
        }
コード例 #2
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            LoadMaterialProperties(props);

            SerializedProperty instancing = materialEditor.serializedObject.FindProperty("m_EnableInstancingVariants");

            instancing.boolValue = true;

            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                uiBlocks.OnGUI(materialEditor, props);

                var surfaceInputs = uiBlocks.FetchUIBlock <DecalSurfaceInputsUIBlock>();

                // Apply material keywords and pass:
                if (changed.changed)
                {
                    normalBlendSrc.floatValue     = surfaceInputs.normalBlendSrcValue;
                    maskBlendSrc.floatValue       = surfaceInputs.maskBlendSrcValue;
                    maskBlendMode.floatValue      = (float)surfaceInputs.maskBlendFlags;
                    smoothnessRemapMin.floatValue = surfaceInputs.smoothnessRemapMinValue;
                    smoothnessRemapMax.floatValue = surfaceInputs.smoothnessRemapMaxValue;
                    AORemapMin.floatValue         = surfaceInputs.AORemapMinValue;
                    AORemapMax.floatValue         = surfaceInputs.AORemapMaxValue;
                    if (useEmissiveIntensity.floatValue == 1.0f)
                    {
                        emissiveColor.colorValue = emissiveColorLDR.colorValue * emissiveIntensity.floatValue;
                    }
                    else
                    {
                        emissiveColor.colorValue = emissiveColorHDR.colorValue;
                    }

                    foreach (var material in uiBlocks.materials)
                    {
                        SetupMaterialKeywordsAndPassInternal(material);
                    }
                }
            }
            materialEditor.serializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
 protected T FetchUIBlockInCurrentList <T>() where T : MaterialUIBlock
 {
     return(parent.FetchUIBlock <T>());
 }