浏览代码

[shader graph] Fix issue where we were overriding base class and not calling the function.

/main
Tim Cooper 9 年前
当前提交
424d2324
共有 3 个文件被更改,包括 12 次插入12 次删除
  1. 7
      UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraphGUI.cs
  2. 6
      UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs
  3. 11
      UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/PixelShaderNode.cs

7
UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraphGUI.cs


else if (m_SelectedGUI == SelectedOptions.options)
graph.materialOptions.DoGUI();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Output Shader :)"))
{
Dictionary<string, Texture> defaultTextures;
var shader = ShaderGenerator.GenerateSurfaceShader(graph, graph.name, false, out defaultTextures);
graph.UpdateShaderSource(shader, defaultTextures);
}
GUILayout.EndArea();
}
}

6
UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs


hideFlags = HideFlags.HideInHierarchy;
}
void OnEnable()
public virtual void OnEnable()
{
if (m_SlotDefaultValues == null)
{

// if it has... do nothing.
MaterialWindow.DebugMaterialGraph("Node ID: " + GetInstanceID());
MaterialWindow.DebugMaterialGraph("Node Name: " + GetOutputVariableNameForNode());
Debug.Log("Slot name" + (slot != null ? slot.name : "Null"));
if (GetSlotDefaultValue(slot.name) == null)
SetSlotDefaultValue(slot.name, new SlotDefaultValue(defaultValue, this, slot.name, true));
SetSlotDefaultValue(slot.name, new SlotDefaultValue(defaultValue, this, slot.name, true));
var slotthing = GetSlotDefaultValue(slot.name);
MaterialWindow.DebugMaterialGraph("Slot Thing: " + slotthing.inputName);

11
UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/PixelShaderNode.cs


get { return 300; }
}
public void OnEnable()
public override void OnEnable()
base.OnEnable();
AddSlot(new Slot(SlotType.InputSlot, kAlbedoSlotName));
AddSlot(new Slot(SlotType.InputSlot, kNormalSlotName));
AddSlot(new Slot(SlotType.InputSlot, kSpecularSlotName));

public override bool UpdatePreviewMaterial()
{
var shaderName = "Hidden/PreviewShader/" + name + "_" + Math.Abs(GetInstanceID());;
var shaderName = "Hidden/PreviewShader/" + name + "_" + Math.Abs(GetInstanceID());
/*
//For the pixel shader node we also want to update the shader that uses it:
defaultTextures.Clear();
var shader = ShaderGenerator.GenerateSurfaceShader(pixelGraph.owner, pixelGraph.owner.name, false, out defaultTextures);
pixelGraph.owner.UpdateShaderSource(shader, defaultTextures);*/
return true;
}
}
正在加载...
取消
保存