浏览代码

Don't check textures slots in decal material validation

Add gizmo for selecting decals in scene view
Add material fold out in the DecalProjectorComponent inspector
/main
Paul Melamed 7 年前
当前提交
27248787
共有 2 个文件被更改,包括 59 次插入5 次删除
  1. 15
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs
  2. 49
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Decal/DecalProjectorComponentEditor.cs

15
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs


}
}
public Material Mat
{
get { return this.m_Material; }
}
public void OnEnable()
{
DecalSystem.instance.AddDecal(this);

DecalSystem.instance.UpdateBoundingSphere(this);
}
public void OnDrawGizmos()
{
DrawGizmo(false);
}
if (!m_Material.GetTexture("_BaseColorMap") && !m_Material.GetTexture("_NormalMap") &&
!m_Material.GetTexture("_MaskMap"))
return false;
return true;
}
}

49
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Decal/DecalProjectorComponentEditor.cs


using System;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEditor;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CustomEditor(typeof(DecalProjectorComponent))]
public class DecalProjectorComponentEditor : Editor
{
private MaterialEditor m_MaterialEditor = null;
private DecalProjectorComponent m_DecalProjectorComponent = null;
private void OnEnable()
{
// Create an instance of the MaterialEditor
m_DecalProjectorComponent = (DecalProjectorComponent)target;
m_MaterialEditor = (MaterialEditor)CreateEditor(m_DecalProjectorComponent.Mat);
}
public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
base.OnInspectorGUI();
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
if (m_MaterialEditor != null)
{
// Draw the material's foldout and the material shader field
// Required to call m_MaterialEditor.OnInspectorGUI ();
m_MaterialEditor.DrawHeader();
// We need to prevent the user to edit Unity default materials
bool isDefaultMaterial = !AssetDatabase.GetAssetPath(m_DecalProjectorComponent.Mat).StartsWith("Assets");
using (new EditorGUI.DisabledGroupScope(isDefaultMaterial))
{
// Draw the material properties
// Works only if the foldout of m_MaterialEditor.DrawHeader () is open
m_MaterialEditor.OnInspectorGUI();
}
}
}
}
}
正在加载...
取消
保存