浏览代码

Merge pull request #209 from Unity-Technologies/goto-documentation-per-node

Adding documentation functionality on the nodes.
/main
GitHub 7 年前
当前提交
545de289
共有 19 个文件被更改,包括 112 次插入0 次删除
  1. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
  2. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/AbsoluteNode.cs
  3. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs
  4. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LengthNode.cs
  5. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs
  6. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ModuloNode.cs
  7. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NegateNode.cs
  8. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NormalizeNode.cs
  9. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/PosterizeNode.cs
  10. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs
  11. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalSquareRootNode.cs
  12. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/AddNode.cs
  13. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/DivideNode.cs
  14. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs
  15. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/PowerNode.cs
  16. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SquareRootNode.cs
  17. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SubtractNode.cs
  18. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  19. 18
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs


set { m_Name = value; }
}
public virtual string documentationURL
{
get { return null; }
}
public virtual bool canDeleteNode
{
get { return true; }

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/AbsoluteNode.cs


name = "Absolute";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Absolute-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Absolute", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs


name = "Exponential";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Exponential-Node"; }
}
[SerializeField]
private ExponentialBase m_ExponentialBase = ExponentialBase.BaseE;

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LengthNode.cs


name = "Length";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Length-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Length", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs


name = "Log";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Log-Node"; }
}
[SerializeField]
private LogBase m_LogBase = LogBase.BaseE;

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ModuloNode.cs


name = "Modulo";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Modulo-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Modulo", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NegateNode.cs


name = "Negate";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Negate-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Negate", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NormalizeNode.cs


name = "Normalize";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Normalize-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Normalize", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/PosterizeNode.cs


name = "Posterize";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Posterize-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Posterize", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs


name = "Reciprocal";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Reciprocal-Node"; }
}
[SerializeField]
private ReciprocalMethod m_ReciprocalMethod = ReciprocalMethod.Default;

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalSquareRootNode.cs


name = "Reciprocal Square Root";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Reciprocal-Square-Root-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Rsqrt", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/AddNode.cs


name = "Add";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Add-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Add", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/DivideNode.cs


name = "Divide";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Divide-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Divide", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs


name = "Multiply";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Multiply-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Multiply", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/PowerNode.cs


name = "Power";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Power-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Power", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SquareRootNode.cs


name = "Square Root";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Square-Root-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_SquareRoot", BindingFlags.Static | BindingFlags.NonPublic);

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SubtractNode.cs


name = "Subtract";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Subtract-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Subtract", BindingFlags.Static | BindingFlags.NonPublic);

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


graphView.nodeCreationRequest(new NodeCreationContext() { screenMousePosition = screenPoint });
}
else if (evt.keyCode == KeyCode.F1)
{
if (m_GraphView.selection.OfType<MaterialNodeView>().Count() == 1)
{
var nodeView = (MaterialNodeView)graphView.selection.First();
if(nodeView.node.documentationURL != null)
System.Diagnostics.Process.Start(nodeView.node.documentationURL);
}
}
}
GraphViewChange GraphViewChanged(GraphViewChange graphViewChange)

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


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

{
node.previewExpanded = true;
}
}
void SeeDocumentation(EventBase evt)
{
var node = selection.OfType<MaterialNodeView>().First().node;
if (node.documentationURL != null)
System.Diagnostics.Process.Start(node.documentationURL);
}
ContextualMenu.MenuAction.StatusFlags SeeDocumentationStatus(EventBase eventBase)
{
if (selection.OfType<MaterialNodeView>().Count() > 1)
return ContextualMenu.MenuAction.StatusFlags.Hidden;
if (selection.OfType<MaterialNodeView>().First().node.documentationURL == null)
return ContextualMenu.MenuAction.StatusFlags.Disabled;
return ContextualMenu.MenuAction.StatusFlags.Normal;
}
ContextualMenu.MenuAction.StatusFlags ConvertToPropertyStatus(EventBase eventBase)

正在加载...
取消
保存