浏览代码

Moved editor code from HDUtils to HDEditorUtils

/stochastic_alpha_test
Thomas 7 年前
当前提交
5b0ab305
共有 4 个文件被更改,包括 35 次插入22 次删除
  1. 6
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDAssetFactory.cs
  2. 19
      ScriptableRenderPipeline/HDRenderPipeline/HDUtils.cs
  3. 19
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs
  4. 13
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs.meta

6
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDAssetFactory.cs


{
static string s_RenderPipelineResourcesPath
{
get { return HDUtils.GetHDRenderPipelinePath() + "RenderPipelineResources/HDRenderPipelineResources.asset"; }
get { return HDEditorUtils.GetHDRenderPipelinePath() + "RenderPipelineResources/HDRenderPipelineResources.asset"; }
}
[MenuItem("RenderPipeline/HDRenderPipeline/Create Pipeline Asset", false, 16)]

AssetDatabase.CreateAsset(instance, HDUtils.GetHDRenderPipelinePath() + "HDRenderPipelineAsset.asset");
AssetDatabase.CreateAsset(instance, HDEditorUtils.GetHDRenderPipelinePath() + "HDRenderPipelineAsset.asset");
// If it exist, load renderPipelineResources
instance.renderPipelineResources = AssetDatabase.LoadAssetAtPath<RenderPipelineResources>(s_RenderPipelineResourcesPath);

[MenuItem("RenderPipeline/HDRenderPipeline/Create Resources Asset", false, 15)]
static void CreateRenderPipelineResources()
{
string HDRenderPipelinePath = HDUtils.GetHDRenderPipelinePath();
string HDRenderPipelinePath = HDEditorUtils.GetHDRenderPipelinePath();
var instance = ScriptableObject.CreateInstance<RenderPipelineResources>();
instance.debugDisplayLatlongShader = Load<Shader>(HDRenderPipelinePath + "Debug/DebugDisplayLatlong.Shader");

19
ScriptableRenderPipeline/HDRenderPipeline/HDUtils.cs


#if UNITY_EDITOR
using System.IO;
using UnityEditor;
#endif
#if UNITY_EDITOR
public static string GetHDRenderPipelinePath()
{
// User can create their own directory for SRP, so we need to find the current path that they use.
// We know that DefaultHDMaterial exist and we know where it is, let's use that to find the current directory.
var guid = AssetDatabase.FindAssets("DefaultHDMaterial t:material");
string path = AssetDatabase.GUIDToAssetPath(guid[0]);
path = Path.GetDirectoryName(path); // Asset is in HDRenderPipeline/RenderPipelineResources/DefaultHDMaterial.mat
path = path.Replace("RenderPipelineResources", ""); // Keep only path with HDRenderPipeline
return path;
}
#endif
public const RendererConfiguration k_RendererConfigurationBakedLighting = RendererConfiguration.PerObjectLightProbe | RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbeProxyVolume;
public static Matrix4x4 GetViewProjectionMatrix(Matrix4x4 worldToViewMatrix, Matrix4x4 projectionMatrix)

19
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs


using System.IO;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class HDEditorUtils
{
public static string GetHDRenderPipelinePath()
{
// User can create their own directory for SRP, so we need to find the current path that they use.
// We know that DefaultHDMaterial exist and we know where it is, let's use that to find the current directory.
var guid = AssetDatabase.FindAssets("DefaultHDMaterial t:material");
string path = AssetDatabase.GUIDToAssetPath(guid[0]);
path = Path.GetDirectoryName(path); // Asset is in HDRenderPipeline/RenderPipelineResources/DefaultHDMaterial.mat
path = path.Replace("RenderPipelineResources", ""); // Keep only path with HDRenderPipeline
return path;
}
}
}

13
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs.meta


fileFormatVersion: 2
guid: 7e04ef797263c2a47ad576cce5233df9
timeCreated: 1507109247
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存