浏览代码

Update to work with trunk

/main
Peter Bay Bastian 7 年前
当前提交
61fab094
共有 11 个文件被更改,包括 57 次插入58 次删除
  1. 14
      MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/TextureCache.cs
  2. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
  3. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs
  4. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
  5. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs
  6. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  7. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
  8. 36
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewTextureView.cs
  9. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs
  10. 2
      MaterialGraphProject/ProjectSettings/ProjectVersion.txt
  11. 0
      /MaterialGraphProject/UnityPackageManager

14
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/TextureCache.cs


if (mismatch)
{
if (!Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
if (!UnityEngine.Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
{
Debug.LogErrorFormat(texture, "Unable to convert texture \"{0}\" to match renderloop settings ({1}x{2} {3})",
texture.name, m_Cache.width, m_Cache.height, m_Cache.format);

{
Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
UnityEngine.Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
}
}

for (int f = 0; f < 6; f++)
{
if (!Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
if (!UnityEngine.Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
{
failed = true;
break;

else
{
for (int f = 0; f < 6; f++)
Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
UnityEngine.Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
}
}
}

for (int m = 0; m < m_NumPanoMipLevels; m++)
{
m_CubeBlitMaterial.SetInt(m_CubeMipLevelPropName, Mathf.Min(m_NumMipLevels - 1, m));
Graphics.SetRenderTarget(m_StagingRTs[m]);
Graphics.Blit(null, m_CubeBlitMaterial, 0);
UnityEngine.Graphics.SetRenderTarget(m_StagingRTs[m]);
UnityEngine.Graphics.Blit(null, m_CubeBlitMaterial, 0);
Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
UnityEngine.Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


{
var headerContainer = new VisualElement {name = "header"};
{
headerContainer.Add(new VisualElement {name = "title", text = assetName});
headerContainer.Add(new Label(assetName) {name = "title"});
}
topContainer.Add(headerContainer);

{
var header = new VisualElement {name = "header"};
{
var title = new VisualElement {name = "title", text = "Properties"};
var title = new Label("Properties") {name = "title"};
header.Add(title);
var addPropertyButton = new Button(OnAddProperty) {text = "Add", name = "addButton"};

{
var header = new VisualElement {name = "header"};
{
var title = new VisualElement {name = "title", text = "Layers"};
var title = new Label("Layers") {name = "title"};
header.Add(title);
var addLayerButton = new Button(OnAddLayer) {text = "Add", name = "addButton"};

m_ContentContainer.Clear();
if (m_SelectedNodes.Count > 1)
{
var element = new VisualElement
var element = new Label(string.Format("{0} nodes selected.", m_SelectedNodes.Count))
name = "selectionCount",
text = string.Format("{0} nodes selected.", m_SelectedNodes.Count)
name = "selectionCount"
};
m_ContentContainer.Add(element);
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs


{
public class NodeEditorHeaderView : VisualElement
{
VisualElement m_Title;
VisualElement m_Type;
Label m_Title;
Label m_Type;
m_Title = new VisualElement { name = "title", text = "" };
m_Title = new Label("") { name = "title" };
Add(new VisualElement { name = "preType", text = "(" });
m_Type = new VisualElement { name = "type", text = "" };
Add(new Label("(") { name = "preType" });
m_Type = new Label("") { name = "type" };
Add(new VisualElement { name = "postType", text = ")" });
Add(new Label(")") { name = "postType" });
}
public string title

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


{
if (m_GraphEditorView != null)
{
rootVisualContainer.Remove(m_GraphEditorView);
m_GraphEditorView.RemoveFromHierarchy();
m_GraphEditorView.Dispose();
}
m_GraphEditorView = value;

m_GraphEditorView.onConvertToSubgraphClick += ToSubGraph;
m_GraphEditorView.onShowInProjectClick += PingAsset;
rootVisualContainer.Add(graphEditorView);
rootVisualContainer.parent.clippingOptions = VisualElement.ClippingOptions.ClipContents;
this.GetRootVisualContainer().Add(graphEditorView);
this.GetRootVisualContainer().parent.clippingOptions = VisualElement.ClippingOptions.ClipContents;
}
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs


edgeControl.edgeWidth = edgeWidth;
edgeControl.inputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : inputColor);
edgeControl.outputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : outputColor);
edgeControl.startCapColor = edgeControl.outputColor;
edgeControl.endCapColor = edgeControl.inputColor;
// edgeControl.startCapColor = edgeControl.outputColor;
// edgeControl.endCapColor = edgeControl.inputColor;
}
}
}

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


{
if (m_GraphView == null)
return;
var dependentNodes = new List<INode>();
NodeUtils.CollectNodesNodeFeedsInto(dependentNodes, inNode);
foreach (var node in dependentNodes)

var targetNodeView = m_GraphView.nodes.ToList().OfType<MaterialNodeView>().FirstOrDefault(x => x.node == targetNode);
var targetAnchor = targetNodeView.inputContainer.Children().OfType<Port>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(targetSlot));
var edgeView = new GradientEdge
var edgeView = new Edge
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
edgeView.output.Connect(edgeView);
edgeView.input.Connect(edgeView);
m_GraphView.AddElement(edgeView);

foreach (var anchorView in nodeView.outputContainer.Children().OfType<Port>())
{
var sourceSlot = (MaterialSlot)anchorView.userData;
foreach (var edgeView in anchorView.connections.OfType<GradientEdge>())
foreach (var edgeView in anchorView.connections.OfType<Edge>())
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
var connectedNodeView = edgeView.input.node as MaterialNodeView;
if (connectedNodeView != null && !nodeViews.Contains(connectedNodeView))
{

var targetSlot = (MaterialSlot)anchorView.userData;
if (targetSlot.valueType != SlotValueType.Dynamic)
continue;
foreach (var edgeView in anchorView.connections.OfType<GradientEdge>())
foreach (var edgeView in anchorView.connections.OfType<Edge>())
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
var connectedNodeView = edgeView.output.node as MaterialNodeView;
if (connectedNodeView != null && !nodeViews.Contains(connectedNodeView))
{

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


UpdatePreviewTexture();
m_PreviewContainer.Add(m_PreviewTextureView);
var collapsePreviewButton = new VisualElement { name = "collapse", text = "▲" };
var collapsePreviewButton = new Label { name = "collapse", text = "▲" };
collapsePreviewButton.AddManipulator(new Clickable(() =>
{
node.owner.owner.RegisterCompleteObjectUndo("Collapse Preview");

m_PreviewContainer.Add(collapsePreviewButton);
var expandPreviewButton = new VisualElement { name = "expand", text = "▼" };
var expandPreviewButton = new Label { name = "expand", text = "▼" };
expandPreviewButton.AddManipulator(new Clickable(() =>
{
node.owner.owner.RegisterCompleteObjectUndo("Expand Preview");

if (node is PreviewNode)
{
var resizeHandle = new VisualElement { name = "resize", text = "" };
var resizeHandle = new Label { name = "resize", text = "" };
resizeHandle.AddManipulator(new Draggable(OnResize));
Add(resizeHandle);

if (slot.hidden)
continue;
var port = InstantiatePort(Orientation.Horizontal, slot.isInputSlot ? Direction.Input : Direction.Output, typeof(Vector4));
var port = InstantiatePort(Orientation.Horizontal, slot.isInputSlot ? Direction.Input : Direction.Output, null);
port.capabilities &= ~Capabilities.Movable;
port.portName = slot.displayName;
port.userData = slot;

36
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewTextureView.cs


namespace UnityEditor.ShaderGraph.Drawing
{
public sealed class PreviewTextureView : VisualElement
public sealed class PreviewTextureView : Image
Texture m_Image;
public Texture image
{
get { return m_Image; }
set
{
if (value == m_Image)
return;
m_Image = value;
Dirty(ChangeType.Repaint);
}
}
// Texture m_Image;
//
// public Texture image
// {
// get { return m_Image; }
// set
// {
// if (value == m_Image)
// return;
// m_Image = value;
// Dirty(ChangeType.Repaint);
// }
// }
public override void DoRepaint()
{
EditorGUI.DrawPreviewTexture(contentRect, image);
}
// public override void DoRepaint()
// {
// EditorGUI.DrawPreviewTexture(contentRect, image);
// }
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs


namespace UnityEditor.ShaderGraph.Drawing
{
public class ToolbarView : VisualElement
public class ToolbarView : BaseTextElement
{
public ToolbarView()
{

public class ToolbarButtonView : VisualElement
public class ToolbarButtonView : BaseTextElement
{
public ToolbarButtonView()
{

public class ToolbarSeparatorView : VisualElement
public class ToolbarSeparatorView : BaseTextElement
{
public ToolbarSeparatorView()
{

public class ToolbarSpaceView : VisualElement
public class ToolbarSpaceView : BaseTextElement
{
public ToolbarSpaceView()
{

2
MaterialGraphProject/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.1.0a5
m_EditorVersion: 2018.1.0a6

/MaterialGraphProject/Packages → /MaterialGraphProject/UnityPackageManager

正在加载...
取消
保存