Skip to content

Commit

Permalink
Apply blend modes to export/preview, add unfinished warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbjørn Thirslund committed Jul 25, 2015
1 parent c1e5f9b commit 4e5501b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
Binary file added Assets/BlendModeTest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions Assets/BlendModeTest.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Assets/UPAToolkit/Editor/EditorGUI/UPALayerSettings.cs
Expand Up @@ -42,6 +42,10 @@ public class UPALayerSettings : EditorWindow {
// Edit blend mode and opacity
GUILayout.Label ("Blending", EditorStyles.boldLabel);
layer.mode = (UPALayer.BlendMode) EditorGUILayout.EnumPopup ("Mode: ", layer.mode);
if (layer.mode != UPALayer.BlendMode.NORMAL)
{
GUILayout.Label("Some blend modes are still in testing and might not produce\nentirely accurate results.");
}
layer.opacity = EditorGUILayout.IntSlider ("Opacity: ", Mathf.RoundToInt(layer.opacity * 100), 0, 100) / 100f;
}
}
7 changes: 1 addition & 6 deletions Assets/UPAToolkit/Editor/UPAImage.cs
Expand Up @@ -189,12 +189,7 @@ public int layerCount
if (!dirty && finalImg != null || !update && finalImg != null)
return finalImg;

finalImg = new Texture2D(width, height);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
finalImg.SetPixel (x,y, GetBlendedPixel (x,y));
}
}
finalImg = UPADrawer.CalculateBlendedTex(layers);
finalImg.filterMode = FilterMode.Point;
finalImg.Apply();

Expand Down

0 comments on commit 4e5501b

Please sign in to comment.