Example #1
0
        public void ApplyToMaterial(IEnumerable <Material> mats)
        {
            if (material == null)
            {
                Debug.LogWarningFormat("[WF] Material is not set in the template: {0}", name);
                return;
            }
            Undo.RecordObjects(mats.ToArray(), "WF apply Template");

            // シェーダを揃える
            foreach (var mat in mats)
            {
                if (mat.shader != material.shader)
                {
                    mat.shader      = material.shader;
                    mat.renderQueue = material.renderQueue;
                }
            }

            // プロパティ類をコピー
            var prm = CopyPropParameter.Create();

            prm.materialSource      = material;
            prm.materialDestination = mats.ToArray();
            prm.labels = WFShaderFunction.GetEnableFunctionList(material).Select(f => f.Label).ToArray();
            prm.onlyOverrideBuiltinTextures = true; // テクスチャ類はビルトインテクスチャのみ上書き可能

            WFMaterialEditUtility.CopyPropertiesWithoutUndo(prm);
        }
Example #2
0
 private void OnEnable()
 {
     minSize = new Vector2(480, 640);
     param   = CopyPropParameter.Create();
     ToolCommon.GetSelectedMaterials(ref param.materialDestination);
 }