浏览代码

material upgrader: support texture scale/offset, disable saving assets for now

/main
vlad-andreev 8 年前
当前提交
a3bbf88f
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 12
      Assets/ScriptableRenderLoop/Editor/MaterialUpgrader.cs

12
Assets/ScriptableRenderLoop/Editor/MaterialUpgrader.cs


// Overridable function to implement custom material upgrading functionality
public virtual void Convert(Material srcMaterial, Material dstMaterial)
{
foreach (var t in m_TextureRename)
dstMaterial.SetTexture (t.Value, srcMaterial.GetTexture (t.Key));
foreach (var t in m_TextureRename)
{
dstMaterial.SetTextureScale(t.Value, srcMaterial.GetTextureScale(t.Key));
dstMaterial.SetTextureOffset(t.Value, srcMaterial.GetTextureOffset(t.Key));
dstMaterial.SetTexture(t.Value, srcMaterial.GetTexture(t.Key));
}
foreach (var t in m_FloatRename)
foreach (var t in m_FloatRename)
dstMaterial.SetFloat (t.Value, srcMaterial.GetFloat(t.Key));
foreach (var t in m_ColorRename)

Material m = UnityEditor.AssetDatabase.LoadMainAssetAtPath( path ) as Material;
Upgrade (m, upgraders, UpgradeFlags.None);
SaveAssetsAndFreeMemory();
//SaveAssetsAndFreeMemory();
}
}

正在加载...
取消
保存