public static void CopyMaterialArgument(Material srcMat, Material tarMat) { tarMat.mainTexture = srcMat.mainTexture; tarMat.mainTextureOffset = srcMat.mainTextureOffset; tarMat.mainTextureScale = srcMat.mainTextureScale; if (NgMaterial.IsMaskTexture(srcMat) && NgMaterial.IsMaskTexture(tarMat)) { NgMaterial.SetMaskTexture(tarMat, NgMaterial.GetMaskTexture(srcMat)); } NgMaterial.SetMaterialColor(tarMat, NgMaterial.GetMaterialColor(srcMat, new Color(0.5f, 0.5f, 0.5f, 0.5f))); }
public static Texture GetTexture(Material mat, bool bMask) { if (mat == null) { return(null); } if (!bMask) { return(mat.mainTexture); } if (NgMaterial.IsMaskTexture(mat)) { return(mat.GetTexture("_Mask")); } return(null); }
// ---------------------------------------------------------------------------------------------------------- protected override void SetActiveObject(int nObjectIndex) { if (nObjectIndex < 0 || m_nObjectCount <= nObjectIndex) { return; } Texture selTexture = GetObjectNodeTexture(nObjectIndex); bool bMaskTex = false; // right button, image Ping and not select if (Input.GetMouseButtonUp(1)) { if (m_SelectedMaterial != null && NgMaterial.IsMaskTexture(m_SelectedMaterial)) { m_nSelMaskTextureIndex = nObjectIndex; bMaskTex = true; } else { FXMakerAsset.SetPingObject(selTexture); return; } } else { m_nSelMainTextureIndex = nObjectIndex; } // // ������ ��Ŭ�� // if (m_nObjectIndex == nObjectIndex) // { // FXMakerAsset.SetPingObject(m_SelectedMaterial); // FXMakerMain.inst.CreateCurrentInstanceEffect(true); // return; // } SetActiveObject(selTexture, bMaskTex); // GUI Update m_nObjectIndex = nObjectIndex; m_nSelObjectProjectIndex = m_nProjectIndex; m_nSelObjectGroupIndex = (m_bOptionRecursively ? -1 : m_nGroupIndex); m_SelObjectContent = new GUIContent(m_ObjectContents[nObjectIndex].text, m_ObjectContents[nObjectIndex].image, m_ObjectContents[nObjectIndex].tooltip); }
public static bool IsSameMaterial(Material mat1, Material mat2, bool bCheckAddress) { return((!bCheckAddress || !(mat1 != mat2)) && !(mat2 == null) && !(mat1.shader != mat2.shader) && !(mat1.mainTexture != mat2.mainTexture) && !(mat1.mainTextureOffset != mat2.mainTextureOffset) && !(mat1.mainTextureScale != mat2.mainTextureScale) && NgMaterial.IsSameColorProperty(mat1, mat2, "_Color") && NgMaterial.IsSameColorProperty(mat1, mat2, "_TintColor") && NgMaterial.IsSameColorProperty(mat1, mat2, "_EmisColor") && NgMaterial.IsSameFloatProperty(mat1, mat2, "_InvFade") && NgMaterial.IsMaskTexture(mat1) == NgMaterial.IsMaskTexture(mat2) && (!NgMaterial.IsMaskTexture(mat1) || !(NgMaterial.GetMaskTexture(mat1) != NgMaterial.GetMaskTexture(mat2)))); }