浏览代码

Fix for lightweight pipeline asset creation and bump package version

/feature-ReflectionProbeFit
Peter Bay Bastian 7 年前
当前提交
a395e251
共有 5 个文件被更改,包括 44 次插入36 次删除
  1. 2
      ScriptableRenderPipeline/Core/package.json
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/package.json
  3. 68
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs
  4. 4
      ScriptableRenderPipeline/LightweightPipeline/package.json
  5. 2
      ScriptableRenderPipeline/master-package.json

2
ScriptableRenderPipeline/Core/package.json


{
"name": "com.unity.render-pipelines.core",
"description": "Core library for Unity render pipelines.",
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

4
ScriptableRenderPipeline/HDRenderPipeline/package.json


{
"name": "com.unity.render-pipelines.high-definition",
"description": "HD Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

68
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs


using UnityEditor;
using UnityEditor.ProjectWindowCallback;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public enum ShadowCascades

public class LightweightPipelineAsset : RenderPipelineAsset
{
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines"};
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines.lightweight"};
// Default values set when a new LightweightPipeline asset is created
[SerializeField] private int m_MaxPixelLights = 4;

[SerializeField] private Material m_DefaultParticleMaterial;
[SerializeField] private Material m_DefaultTerrainMaterial;
[UnityEditor.MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
var instance = CreateInstance<LightweightPipelineAsset>();
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateLightweightPipelineAsset>(),
"LightweightAsset.asset", null, null);
}
string[] guids = UnityEditor.AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
class CreateLightweightPipelineAsset : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
var instance = CreateInstance<LightweightPipelineAsset>();
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
string[] guids = AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
string assetPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
"Please enter a file name to save the asset to");
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (assetPath.Length > 0)
UnityEditor.AssetDatabase.CreateAsset(instance, assetPath);
AssetDatabase.CreateAsset(instance, pathName);
}
}
#endif

4
ScriptableRenderPipeline/LightweightPipeline/package.json


{
"name": "com.unity.render-pipelines.lightweight",
"description": "Lightweight Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

2
ScriptableRenderPipeline/master-package.json


{
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

正在加载...
取消
保存