public void Activate() { if (activated == false) { UpdateMaterial(); if (material != null) { var finalWidth = width; var finalHeight = height; var finalTexture = material.GetTexture(slot.Name); CachedPaintable.ScaleSize(ref finalWidth, ref finalHeight); if (texture != null) { finalTexture = texture; } if (string.IsNullOrEmpty(shaderKeyword) == false) { material.EnableKeyword(shaderKeyword); } var desc = new RenderTextureDescriptor(width, height, format, 0); desc.autoGenerateMips = false; if (mipMaps == MipType.ForceOn) { desc.useMipMap = true; } else if (mipMaps == MipType.Auto && P3dHelper.HasMipMaps(finalTexture) == true) { desc.useMipMap = true; } current = P3dHelper.GetRenderTexture(desc); P3dPaintReplace.Blit(current, finalTexture, color); if (current.useMipMap == true) { current.GenerateMips(); } material.SetTexture(slot.Name, current); activated = true; if (string.IsNullOrEmpty(saveName) == false) { Load(); } NotifyOnModified(false); } } }
public void Activate() { if (activated == false) { UpdateMaterial(); if (material != null) { var finalWidth = width; var finalHeight = height; var finalTexture = material.GetTexture(slot.Name); CachedPaintable.ScaleSize(ref finalWidth, ref finalHeight); if (texture != null) { finalTexture = texture; } if (string.IsNullOrEmpty(shaderKeyword) == false) { material.EnableKeyword(shaderKeyword); } current = P3dHelper.GetRenderTexture(finalWidth, finalHeight, 0, format); P3dPaintReplace.Blit(current, finalTexture, color); material.SetTexture(slot.Name, current); activated = true; if (string.IsNullOrEmpty(saveName) == false) { Load(); } NotifyOnModified(false); } } }