浏览代码

Adding documentation functionality on the nodes.

public virtual string documentationURL()   has been added to AbstractMaterialNode
Pressing F1 will take you to the documentation if it exists.
Right clicking on a node gives you the context menu item See Documentation that also takes you to the documentation if it exists.
/main
Martin Thorzen 7 年前
当前提交
54af42c8
共有 2 个文件被更改,包括 3 次插入8 次删除
  1. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  2. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs

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


string m_FloatingWindowsLayoutKey;
FloatingWindowsLayout m_FloatingWindowsLayout;
string m_DocumentURL = "https://github.com/Unity-Technologies/ShaderGraph/wiki";
public Action saveRequested { get; set; }
public Action convertToSubgraphRequested

var nodeView = (MaterialNodeView)graphView.selection.First();
if(nodeView.node.documentationURL != null)
System.Diagnostics.Process.Start(nodeView.node.documentationURL);
else
Debug.Log("Missing Documentation URL for -> " + System.Diagnostics.Process.Start(m_DocumentURL));
}
}
}

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


public AbstractMaterialGraph graph { get; private set; }
public Action onConvertToSubgraphClick { get; set; }
private string m_DocumentURL = "https://github.com/Unity-Technologies/ShaderGraph/wiki";
public override List<Port> GetCompatiblePorts(Port startAnchor, NodeAdapter nodeAdapter)
{
var compatibleAnchors = new List<Port>();

evt.menu.AppendAction("Convert To Inline Node", ConvertToInlineNode, ConvertToInlineNodeStatus);
evt.menu.AppendAction("Convert To Property", ConvertToProperty, ConvertToPropertyStatus);
evt.menu.AppendSeparator();
evt.menu.AppendAction("See Documentation", SeeDocumentation, SeeDocumentationStatus);
evt.menu.AppendAction("Open Documentation", SeeDocumentation, SeeDocumentationStatus);
}
else if (evt.target is BlackboardField)
{

var node = selection.OfType<MaterialNodeView>().First().node;
if (node.documentationURL != null)
System.Diagnostics.Process.Start(node.documentationURL);
else
Debug.Log("Missing Documentation URL for -> " + System.Diagnostics.Process.Start(m_DocumentURL));
}
ContextualMenu.MenuAction.StatusFlags SeeDocumentationStatus(EventBase eventBase)

if (selection.OfType<MaterialNodeView>().First().node.documentationURL == null)
return ContextualMenu.MenuAction.StatusFlags.Disabled;
return ContextualMenu.MenuAction.StatusFlags.Normal;
}

正在加载...
取消
保存