54 lines
2.0 KiB
Plaintext
54 lines
2.0 KiB
Plaintext
$comment($doc="Ignores its parameters") = {}
|
|
|
|
$debugwc=
|
|
|
|
$valueof($x, $doc="Does nothing, but documents the default value of a function parameter") = { "$valueof("$x")" }
|
|
|
|
$default($expr, $defval, $doc="returns $defval if $expr is $valueof(something)") = {
|
|
$('$defval' if '$expr'.startswith("'$valueof'") else '$expr')
|
|
}
|
|
|
|
$genericseq($expr, $var, $startval, $endval, $startat, $step, $increment, $op, $hidden=true) = {
|
|
$sign($x) = { $('1' if $x >= 0 else '(-1)') }
|
|
[SEQ<%- for step in steps(0, $(round(abs(($endval) - ($startval)), 2)), abs($increment)) -%>
|
|
<%- set $var "=" round($startval + $sign($increment)*step, 2) -%>
|
|
<%- if $var $op ($endval) -%>
|
|
:$expr:"<=" round(($startat) + loop.index0 * ($step), 2) "=>"
|
|
<%- endif -%>
|
|
<%- endfor -%>
|
|
<%- set $var "=" $endval -%>:$expr:1]
|
|
}
|
|
|
|
$ascseq($expr, $var=x, $startval=0, $endval=1, $startat=0, $step=0.1, $increment=$valueof(step)) = {
|
|
$i = $default($increment, $step)
|
|
$genericseq($expr, $var, $startval, $endval, $startat, $step, $i, $op="<")
|
|
}
|
|
|
|
$descseq($expr, $var=x, $startval=1, $endval=0, $startat=$valueof(step), $step=0.1, $increment=$valueof(step)) = {
|
|
$i = $default($increment, $step)
|
|
$s = $default($startat, $step)
|
|
$genericseq($expr, $var, $startval, $endval, $s, $step, $increment=-($i), $op=">")
|
|
}
|
|
|
|
$warmlora($lora, $start=0, $end=1.0, $step=0.1, $startat=0, $increment=$valueof(step)) = {
|
|
$i = $default($increment, $step)
|
|
$x = <lora:$lora:<= x + $start "=>>"
|
|
$y = $($end - $start)
|
|
$ascseq($x, x, 0, $y, $startat, $step, $i)
|
|
}
|
|
|
|
$coollora($lora, $start=1.0, $end=0.0, $step=0.1, $startat=0, $decrement=$valueof(step)) = {
|
|
$s = $($startat + $step)
|
|
$i = $default($decrement, $step)
|
|
$x = <lora:$lora:<= x =>>
|
|
$descseq($x, x, $start, $end, $s, $step, $i)
|
|
}
|
|
|
|
$rectmask($x, $y, $size) = {
|
|
MASK($x "<=" $x + $size "=>", $y "<=" $y + $size "=>")
|
|
}
|
|
|
|
$weight($expr, $stepspec, $inw, $outw=1, $doc="shortcut for [($expr:$inw):($expr:$outw):$stepspec]") = {
|
|
[($expr:$inw):($expr:$outw):$stepspec]
|
|
}
|