You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.8 KiB

  1. using System;
  2. using UnityEngine;
  3. namespace AmplifyShaderEditor
  4. {
  5. public class OutputNode : SignalGeneratorNode
  6. {
  7. [SerializeField]
  8. protected bool m_isMainOutputNode = false;
  9. public OutputNode() : base() { }
  10. public OutputNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { }
  11. public override void ResetNodeData()
  12. {
  13. base.ResetNodeData();
  14. m_graphDepth = -1;
  15. }
  16. public virtual void SetupNodeCategories()
  17. {
  18. ContainerGraph.ResetNodesData();
  19. //int count = m_inputPorts.Count;
  20. //for( int i = 0; i < count; i++ )
  21. //{
  22. // if( m_inputPorts[ i ].IsConnected )
  23. // {
  24. // NodeData nodeData = new NodeData( m_inputPorts[ i ].Category );
  25. // ParentNode node = m_inputPorts[ i ].GetOutputNode();
  26. // node.PropagateNodeData( nodeData, ref collector );
  27. // }
  28. //}
  29. }
  30. public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
  31. {
  32. base.WriteToString( ref nodeInfo, ref connectionsInfo );
  33. IOUtils.AddFieldValueToString( ref nodeInfo, m_isMainOutputNode );
  34. }
  35. public override void ReadFromString( ref string[] nodeParams )
  36. {
  37. base.ReadFromString( ref nodeParams );
  38. m_isMainOutputNode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
  39. if( m_isMainOutputNode && !ContainerGraph.IsDuplicating )
  40. {
  41. ContainerGraph.AssignMasterNode( this, true );
  42. }
  43. }
  44. public override void AfterDuplication()
  45. {
  46. base.AfterDuplication();
  47. m_isMainOutputNode = false;
  48. }
  49. public bool IsMainOutputNode
  50. {
  51. get { return m_isMainOutputNode; }
  52. set
  53. {
  54. if( value != m_isMainOutputNode )
  55. {
  56. m_isMainOutputNode = value;
  57. if( m_isMainOutputNode )
  58. {
  59. GenerateSignalPropagation();
  60. }
  61. else
  62. {
  63. GenerateSignalInibitor();
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }