//public void OnDroppedSubstance(ProceduralMaterial procMat){ // Texture diffuse = TryGetProceduralTexture(procMat, "_MainTex"); // Texture normal = TryGetProceduralTexture(procMat, "_BumpMap"); // //Texture parallax = TryGetProceduralTexture(procMat, "_ParallaxMap"); // //Texture emission = TryGetProceduralTexture(procMat, "_Illum"); // //TryGetProceduralTexture("_MainTex"); // SF_Node prevNode = TryLinkIfExistsAndOpenSlotAvailable(diffuse, "MainTex", editor.mainNode.diffuse, "RGB"); // TryLinkIfExistsAndOpenSlotAvailable(normal, "BumpMap", editor.mainNode.normal, "RGB", prevNode); //} // For connecting procedural materials to the main node public SF_Node TryLinkIfExistsAndOpenSlotAvailable(Texture tex, string propertyName, SF_NodeConnector connector, string outChannel, SF_Node prevNode = null) { if (tex) { SFN_Tex2d tNode = editor.AddNode <SFN_Tex2d>(); if (prevNode != null) { Rect r = tNode.rect; r = r.MovedDown(1); r.y += 64; tNode.rect = r; } tNode.TextureAsset = tex; tNode.property.SetName(propertyName); tNode.OnAssignedTexture(); if (connector.enableState == EnableState.Enabled && connector.availableState == AvailableState.Available && !connector.IsConnected()) { connector.LinkTo(tNode[outChannel]); } return(tNode); } return(null); }
public SF_Node OnStopDrag() { if (!IsPlacing()) { return(null); } SF_Node newNode = null; if (editor.nodeView.rect.Contains(Event.current.mousePosition)) { newNode = editor.AddNode(dragNode, registerUndo: true); } dragNode = null; return(newNode); }