card_fields rewrite and magic-modules.mse-include (#21)
Overhauls the card_fields file to allow for template designers more freedom in manipulating data. Adds magic-modules.mse-include, a large scale include file for building templates in a standardized way. Applying this to existing frames will be coming in future updates.
This commit is contained in:
@@ -9,18 +9,18 @@
|
||||
########################################################################
|
||||
include file: masks
|
||||
|
||||
mask_hybrid_with_land := { false }
|
||||
mask_hybrid_with_gold := { false }
|
||||
mask_multi_land_with_color := { false }
|
||||
template := { input + "{type}.jpg" }
|
||||
land_template := { ( if input == "a" then "c" else input)+ "l{type}.jpg" }
|
||||
offset := 0
|
||||
mask_hybrid_with_land := { false }
|
||||
mask_hybrid_with_gold := { false }
|
||||
mask_multi_land_with_color := { false }
|
||||
template := { input + "{type}.jpg" }
|
||||
land_template := { ( if input == "a" then "c" else input) + "l{type}.jpg" }
|
||||
offset := 0
|
||||
# For what value should thumbnails of hybrids be made?
|
||||
hybrid_previews := "hybrid"
|
||||
hybrid_previews := "hybrid"
|
||||
|
||||
# Are there templates for colored lands, land_template(...)?
|
||||
colored_lands := true
|
||||
trim_colors :=
|
||||
colored_lands := true
|
||||
trim_colors :=
|
||||
replace@(match:"(, )?(multicolor|hybrid|artifact|land|horizontal|vertical|radial)", replace:"")
|
||||
|
||||
watermark_colors := {
|
||||
@@ -41,27 +41,27 @@ hybrid_color := {
|
||||
check_colors := card.card_color
|
||||
if face != "" then check_colors := face
|
||||
trimmed := trim_colors(check_colors)
|
||||
if trimmed == "white, blue" then "wu"
|
||||
else if trimmed == "white, black" then "wb"
|
||||
else if trimmed == "white, red" then "rw"
|
||||
else if trimmed == "white, green" then "gw"
|
||||
else if trimmed == "blue, black" then "ub"
|
||||
else if trimmed == "blue, red" then "ur"
|
||||
else if trimmed == "blue, green" then "gu"
|
||||
else if trimmed == "black, red" then "br"
|
||||
else if trimmed == "black, green" then "bg"
|
||||
else if trimmed == "red, green" then "rg"
|
||||
else if trimmed == "white, blue, reversed" then "uw"
|
||||
else if trimmed == "white, black, reversed" then "bw"
|
||||
else if trimmed == "white, red, reversed" then "wr"
|
||||
else if trimmed == "white, green, reversed" then "wg"
|
||||
else if trimmed == "blue, black, reversed" then "bu"
|
||||
else if trimmed == "blue, red, reversed" then "ru"
|
||||
else if trimmed == "blue, green, reversed" then "ug"
|
||||
else if trimmed == "black, red, reversed" then "rb"
|
||||
else if trimmed == "black, green, reversed" then "bg"
|
||||
else if trimmed == "red, green, reversed" then "gr"
|
||||
else "mm"
|
||||
if trimmed == "white, blue" then "wu"
|
||||
else if trimmed == "white, black" then "wb"
|
||||
else if trimmed == "white, red" then "rw"
|
||||
else if trimmed == "white, green" then "gw"
|
||||
else if trimmed == "blue, black" then "ub"
|
||||
else if trimmed == "blue, red" then "ur"
|
||||
else if trimmed == "blue, green" then "gu"
|
||||
else if trimmed == "black, red" then "br"
|
||||
else if trimmed == "black, green" then "bg"
|
||||
else if trimmed == "red, green" then "rg"
|
||||
else if trimmed == "white, blue, reversed" then "uw"
|
||||
else if trimmed == "white, black, reversed" then "bw"
|
||||
else if trimmed == "white, red, reversed" then "wr"
|
||||
else if trimmed == "white, green, reversed" then "wg"
|
||||
else if trimmed == "blue, black, reversed" then "bu"
|
||||
else if trimmed == "blue, red, reversed" then "ru"
|
||||
else if trimmed == "blue, green, reversed" then "ug"
|
||||
else if trimmed == "black, red, reversed" then "rb"
|
||||
else if trimmed == "black, green, reversed" then "bg"
|
||||
else if trimmed == "red, green, reversed" then "gr"
|
||||
else "mm"
|
||||
}@(face:"")
|
||||
########################################################################
|
||||
# Combining multiple colors (hybrids)
|
||||
@@ -78,8 +78,8 @@ card_hybrid_2 := {linear_blend(
|
||||
overlay_hybrid := [
|
||||
1: { template( colors[0] ) }
|
||||
2: {combine_blend(
|
||||
image1: template( colors[0] ),
|
||||
image2: template( colors[1] ),
|
||||
image1: template( colors[0] ),
|
||||
image2: template( colors[1] ),
|
||||
combine: "symmetric overlay"
|
||||
)}
|
||||
]
|
||||
@@ -87,7 +87,7 @@ overlay_hybrid := [
|
||||
|
||||
# vertical version of a horizontal hybrid
|
||||
vertical_card_hybrid := {
|
||||
do_linear_blend := linear_blend
|
||||
do_linear_blend := linear_blend
|
||||
linear_blend := { do_linear_blend(x1: 0, x2: 0, y1: x1, y2: x2) }
|
||||
card_hybrid.horizontal[color_count]()
|
||||
}
|
||||
@@ -102,7 +102,7 @@ horizontal_card_hybrid := [
|
||||
x2: 0.4, y2: 0
|
||||
image2: linear_blend(
|
||||
image1: template( colors[(to_int(offset) + 1 ) mod 3] ),
|
||||
image2: template( colors[(to_int(offset) + 2 ) mod 3] ),
|
||||
image2: template( colors[(to_int(offset) + 2 ) mod 3] ),
|
||||
x1: 0.6, y1: 0
|
||||
x2: 0.78, y2: 0
|
||||
)
|
||||
@@ -124,15 +124,15 @@ horizontal_card_hybrid := [
|
||||
)))}
|
||||
|
||||
5: {linear_blend(
|
||||
image1: template( colors[(to_int(offset) + 0 ) mod 5] ),
|
||||
image1: template( colors[(to_int(offset) + 0 ) mod 5] ),
|
||||
x1: 2.0 / 15, y1: 0
|
||||
x2: 4.0 / 15, y2: 0
|
||||
image2: linear_blend(
|
||||
image1: template( colors[(to_int(offset) + 1 ) mod 5] ),
|
||||
image1: template( colors[(to_int(offset) + 1 ) mod 5] ),
|
||||
x1: 5.0 / 15, y1: 0
|
||||
x2: 7.0 / 15, y2: 0
|
||||
image2: linear_blend(
|
||||
image1: template( colors[(to_int(offset) + 2 ) mod 5] ),
|
||||
image1: template( colors[(to_int(offset) + 2 ) mod 5] ),
|
||||
x1: 8.0 / 15, y1: 0
|
||||
x2: 10.0 / 15, y2: 0
|
||||
image2: linear_blend(
|
||||
@@ -198,19 +198,19 @@ card_hybrid := [
|
||||
radial: [
|
||||
0: { template( "c") }
|
||||
1: { template( colors[0]) }
|
||||
2: card_hybrid_2
|
||||
2: card_hybrid_2
|
||||
|
||||
3:{linear_blend(
|
||||
image1: card_hybrid_2( colors: colors[(to_int(offset) + 0 ) mod 3] +
|
||||
image1: card_hybrid_2( colors: colors[(to_int(offset) + 0 ) mod 3] +
|
||||
colors[(to_int(offset) + 1 ) mod 3] ),
|
||||
image2: template( colors[(to_int(offset) + 2 ) mod 3] ),
|
||||
image2: template( colors[(to_int(offset) + 2 ) mod 3] ),
|
||||
x1: 0, y1: 0.55
|
||||
x2: 0, y2: 0.77
|
||||
)}
|
||||
4:{linear_blend(
|
||||
image1: card_hybrid_2( colors: colors[(to_int(offset) + 0 ) mod 4] +
|
||||
colors[(to_int(offset) + 1 ) mod 4] ),
|
||||
image2: card_hybrid_2( colors: colors[(to_int(offset) + 3 ) mod 4] +
|
||||
image2: card_hybrid_2( colors: colors[(to_int(offset) + 3 ) mod 4] +
|
||||
colors[(to_int(offset) + 2 ) mod 4] ),
|
||||
x1: 0, y1: 0.4
|
||||
x2: 0, y2: 0.62
|
||||
@@ -219,7 +219,7 @@ card_hybrid := [
|
||||
5: {linear_blend(
|
||||
image1: linear_blend(
|
||||
image1: card_hybrid_2( colors: colors[(to_int(offset) + 0 ) mod 5] +
|
||||
colors[(to_int(offset) + 1 ) mod 5] ),
|
||||
colors[(to_int(offset) + 1 ) mod 5] ),
|
||||
image2: card_hybrid_2( colors: colors[(to_int(offset) + 4 ) mod 5] +
|
||||
colors[(to_int(offset) + 2 ) mod 5] ),
|
||||
x1: 0, y1: 0.19
|
||||
@@ -235,7 +235,7 @@ card_hybrid := [
|
||||
image1: card_hybrid_2( colors: colors[(to_int(offset) + 0 ) mod 6] +
|
||||
colors[(to_int(offset) + 1 ) mod 6] ),
|
||||
image2: card_hybrid_2( colors: colors[(to_int(offset) + 5 ) mod 6] +
|
||||
colors[(to_int(offset) + 2 ) mod 6] ),
|
||||
colors[(to_int(offset) + 2 ) mod 6] ),
|
||||
x1: 0, y1: 0.19
|
||||
x2: 0, y2: 0.35
|
||||
),
|
||||
@@ -267,7 +267,7 @@ card_hybrid := [
|
||||
]
|
||||
horizontal: horizontal_card_hybrid
|
||||
vertical: [
|
||||
1: { template( colors[0]) }
|
||||
1: { template( colors[0]) }
|
||||
2: { linear_blend(
|
||||
image1: template( colors[0] ),
|
||||
image2: template( colors[1] ),
|
||||
@@ -350,7 +350,7 @@ pt_hybrid := [
|
||||
x1: 0, y1: -1.5
|
||||
x2: 0, y2: 0.7
|
||||
)}
|
||||
7: { template( colors[(to_int(offset) + 4 ) mod 7]) }
|
||||
7: { template( colors[(to_int(offset) + 4 ) mod 7]) }
|
||||
]
|
||||
horizontal: horizontal_pt_hybrid
|
||||
vertical: [
|
||||
@@ -799,7 +799,7 @@ stamp_hybrid := [
|
||||
image2: template( colors[(to_int(offset) + 3) mod 6] ),
|
||||
x1: -0.3, y1: 0
|
||||
x2: 1.3, y2: 0
|
||||
)}
|
||||
)}
|
||||
7: { template( colors[(to_int(offset) + 4 ) mod 7]) }
|
||||
]
|
||||
horizontal: horizontal_stamp_hybrid
|
||||
@@ -858,10 +858,10 @@ color_background := {
|
||||
if colors == "" then colors == "c"
|
||||
|
||||
# 'shape' / type of hybrid
|
||||
shape := if chosen(choice:"horizontal" ) then "horizontal"
|
||||
else if chosen(choice:"vertical" ) then "vertical"
|
||||
else if chosen(choice:"overlay" ) then "overlay"
|
||||
else "radial"
|
||||
shape := if chosen(choice:"horizontal" ) then "horizontal"
|
||||
else if chosen(choice:"vertical" ) then "vertical"
|
||||
else if chosen(choice:"overlay" ) then "overlay"
|
||||
else "radial"
|
||||
|
||||
# Determine background (allows styles to hook something else here)
|
||||
color_combination(folder:folder)
|
||||
@@ -983,36 +983,36 @@ font_color_positions := [
|
||||
|
||||
# Determine whether light or dark fonts should be used
|
||||
font_white := {
|
||||
hybrid := chosen(choice:"hybrid" )
|
||||
artifact := chosen(choice:"artifact" )
|
||||
colors := sort_text( order: "(wubrg)"
|
||||
, (if chosen(choice:"white" ) then "w")
|
||||
+ (if chosen(choice:"blue" ) then "u")
|
||||
+ (if chosen(choice:"black" ) then "b")
|
||||
+ (if chosen(choice:"red" ) then "r")
|
||||
+ (if chosen(choice:"green" ) then "g"))
|
||||
+ (if artifact then "a")
|
||||
hybrid := chosen(choice:"hybrid" )
|
||||
artifact := chosen(choice:"artifact" )
|
||||
colors := sort_text( order: "(wubrg)"
|
||||
, (if chosen(choice:"white" ) then "w")
|
||||
+ (if chosen(choice:"blue" ) then "u")
|
||||
+ (if chosen(choice:"black" ) then "b")
|
||||
+ (if chosen(choice:"red" ) then "r")
|
||||
+ (if chosen(choice:"green" ) then "g"))
|
||||
+ (if artifact then "a")
|
||||
font_colors_white(
|
||||
if chosen(choice:"land") then "l"
|
||||
else if input == "artifact, multicolor" then "a"
|
||||
else if chosen(choice:"multicolor") then "m"
|
||||
else if artifact and not hybrid then "a"
|
||||
else if colors == "" then "c"
|
||||
else colors[
|
||||
else if input == "artifact, multicolor" then "a"
|
||||
else if chosen(choice:"multicolor") then "m"
|
||||
else if artifact and not hybrid then "a"
|
||||
else if colors == "" then "c"
|
||||
else colors[
|
||||
font_color_positions[
|
||||
if chosen(choice:"horizontal") then "horizontal"
|
||||
else if chosen(choice:"vertical") then "vertical"
|
||||
else if chosen(choice:"overlay") then "overlay"
|
||||
else "radial"
|
||||
][number_of_items(in: colors)]
|
||||
]
|
||||
if chosen(choice:"horizontal") then "horizontal"
|
||||
else if chosen(choice:"vertical") then "vertical"
|
||||
else if chosen(choice:"overlay") then "overlay"
|
||||
else "radial"
|
||||
][number_of_items(in: colors)]
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
font_color := { if font_white() then rgb(255,255,255) else rgb(0,0,0) }
|
||||
|
||||
#####Watermark Blending
|
||||
watermark_hybrid:= {
|
||||
watermark_hybrid := {
|
||||
linear_blend(
|
||||
image1: colors[0] + input + ".png"
|
||||
image2: colors[1] + input + ".png"
|
||||
@@ -1043,38 +1043,106 @@ set_watermark_blend := {
|
||||
)
|
||||
}
|
||||
spotlight_watermark_blend := {
|
||||
if face == false then face := card.card_color
|
||||
wmc := watermark_colors(face:face)
|
||||
c1 := "/magic-watermarks.mse-include/spotlight/" + wmc.0 + (if contains(face, match:"land") then "l") + "spotlight.png"
|
||||
c2 := "/magic-watermarks.mse-include/spotlight/" + wmc.1 + (if contains(face, match:"land") then "l") + "spotlight.png"
|
||||
if contains(input, match:".png,") then (
|
||||
face := [1:card.card_color, 2:card.card_color_2, 3:card.card_color_3][face]
|
||||
if type_name(input) == "string" and contains(input, match:".png,") then (
|
||||
array := split_text(input+",,", match:",")
|
||||
input := array.0
|
||||
l := min(to_number(array.1),500)
|
||||
h := min(to_number(array.2),500)
|
||||
)
|
||||
wmc := watermark_colors(face:face)
|
||||
c1 := wmc.0 + (if contains(face, match:"land") then "l") + "spotlight.png"
|
||||
c2 := wmc.1 + (if contains(face, match:"land") then "l") + "spotlight.png"
|
||||
wmdir := "/magic-watermarks.mse-include/spotlight/"
|
||||
if (h != 500 or l != 500) then (
|
||||
c1 := crop(c1, height:h, width:l, offset_x:0, offset_y:0)
|
||||
c2 := crop(c2, height:h, width:l, offset_x:0, offset_y:0)
|
||||
wmdir := wmdir + "1024/"
|
||||
c1 := crop(wmdir+c1, height:h, width:l, offset_x:0, offset_y:0)
|
||||
c2 := crop(wmdir+c2, height:h, width:l, offset_x:0, offset_y:0)
|
||||
)else(
|
||||
c1 := wmdir + c1
|
||||
c2 := wmdir + c2
|
||||
)
|
||||
mask := input
|
||||
set_alpha(
|
||||
alpha: 0.75
|
||||
alpha: alpha
|
||||
input:
|
||||
linear_blend(
|
||||
image1:
|
||||
masked_blend(
|
||||
light: input
|
||||
dark: c1
|
||||
mask: input
|
||||
mask: mask
|
||||
)
|
||||
image2:
|
||||
masked_blend(
|
||||
light: input
|
||||
dark: c2
|
||||
mask: input
|
||||
mask: mask
|
||||
)
|
||||
x1: 0.4, y1: 0
|
||||
x2: 0.6, y2: 0
|
||||
)
|
||||
)
|
||||
}@(h:500,l:500,face:false)
|
||||
}@(h:500,l:500,face:1,alpha:0.2)
|
||||
|
||||
shadow_watermark_blend := {
|
||||
set_combine(
|
||||
combine:"shadow",
|
||||
set_alpha(
|
||||
alpha: 0.5,
|
||||
drop_shadow(
|
||||
offset_x: -0.01,
|
||||
offset_y: 0.03,
|
||||
blur_radius: 0.02,
|
||||
alpha: 1,
|
||||
color: rgb(0,0,0),
|
||||
enlarge(
|
||||
border_size: 0.03,
|
||||
invert_image(input)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
glow_watermark_blend := {
|
||||
set_combine(
|
||||
combine:"glow",
|
||||
set_alpha(
|
||||
alpha: 0.3,
|
||||
drop_shadow(
|
||||
offset_x: -0.01,
|
||||
offset_y: 0.03,
|
||||
blur_radius: 0.02,
|
||||
alpha: 1,
|
||||
color: rgb(0,0,0),
|
||||
enlarge(
|
||||
border_size: 0.03,
|
||||
invert_image(input)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
watermark_blend :=
|
||||
{
|
||||
dark_textbox := (face == 1 and invert_watermark())
|
||||
or (face == 2 and invert_watermark2())
|
||||
or (face == 3 and invert_watermark3())
|
||||
invert_base_image := false
|
||||
if dark_textbox then
|
||||
(
|
||||
alpha := dark_alpha
|
||||
spotlight_alpha := dark_spotlight_alpha
|
||||
invert_base_image := true
|
||||
)
|
||||
backup := if custom then set.blend_with_colors else set.use_blended_watermarks
|
||||
option := styling.watermark_render or else backup
|
||||
if colored then set_alpha(alpha: alpha, input)
|
||||
else if option == "yes" or option == "blend with colors" then spotlight_watermark_blend(h:h, l:l, face:face, alpha: spotlight_alpha, input)
|
||||
else if option == "shadow" then shadow_watermark_blend(input)
|
||||
else if option == "glow" then glow_watermark_blend(input)
|
||||
else if invert_base_image then set_alpha(alpha: alpha, invert_image(input))
|
||||
else set_alpha(alpha: alpha, input)
|
||||
}@(h:500,l:500,colored:false,face:1,alpha:0.25,spotlight_alpha:0.75,dark_alpha:0.25,dark_spotlight_alpha:0.35,custom:false)
|
||||
Reference in New Issue
Block a user