= false);
+```
+```javascript
+// Example:
+let params =
+ [{
+ filterType: "glow",
+ filterId: "tokenmagic-example",
+ outerStrength: 3,
+ color: 0x003000,
+ padding: 20
+ },
+ {
+ filterType: "shadow",
+ filterId: "tokenmagic-example",
+ rotation: 35,
+ blur: 2,
+ quality: 10,
+ distance: 20,
+ alpha: 0.7,
+ color: 0x000000,
+ }];
+
+// All possible existing filters will be deleted on the selected placeables before applying the new filters
+// Technical precision -> it is just one call to a setFlag which add and delete the filters
+TokenMagic.addFiltersOnSelected(params, true);
+```
# Token Magic FX - Update v0.2.2b-alpha
*Fixed issues :*
diff --git a/Tokenmagic.zip b/Tokenmagic.zip
index 057ad40..59986a3 100644
Binary files a/Tokenmagic.zip and b/Tokenmagic.zip differ
diff --git a/images/templates-ex.png b/images/templates-ex.png
new file mode 100644
index 0000000..966dcd2
Binary files /dev/null and b/images/templates-ex.png differ
diff --git a/tokenmagic/fx/assets/chromatic.png b/tokenmagic/fx/assets/chromatic.png
deleted file mode 100644
index 25c2372..0000000
Binary files a/tokenmagic/fx/assets/chromatic.png and /dev/null differ
diff --git a/tokenmagic/fx/assets/noise-4.png b/tokenmagic/fx/assets/noise-4.png
deleted file mode 100644
index 03ce8b4..0000000
Binary files a/tokenmagic/fx/assets/noise-4.png and /dev/null differ
diff --git a/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png b/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png
new file mode 100644
index 0000000..c1760cc
Binary files /dev/null and b/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png differ
diff --git a/tokenmagic/fx/assets/templates/black-tone-vstrong-opacity.png b/tokenmagic/fx/assets/templates/black-tone-vstrong-opacity.png
new file mode 100644
index 0000000..6637d67
Binary files /dev/null and b/tokenmagic/fx/assets/templates/black-tone-vstrong-opacity.png differ
diff --git a/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png b/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png
new file mode 100644
index 0000000..d57aa3c
Binary files /dev/null and b/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png differ
diff --git a/tokenmagic/fx/filters/FilterShockWave.js b/tokenmagic/fx/filters/FilterShockWave.js
index 93601fc..fce47c0 100644
--- a/tokenmagic/fx/filters/FilterShockWave.js
+++ b/tokenmagic/fx/filters/FilterShockWave.js
@@ -20,13 +20,16 @@ export class FilterShockwave extends PIXI.filters.ShockwaveFilter {
}
handleTransform() {
+ let scale = this.placeableImg.parent.data?.scale;
+ if (scale == null) scale = 1;
+
this.center[0] = (this.placeableImg.localTransform.tx
* this.placeableImg.parent.worldTransform.a
- * this.placeableImg.parent.data.scale)
+ * scale)
+ this.padding;
this.center[1] = (this.placeableImg.localTransform.ty
* this.placeableImg.parent.worldTransform.a
- * this.placeableImg.parent.data.scale)
+ * scale)
+ this.padding;
}
}
diff --git a/tokenmagic/fx/filters/FilterSpiderWeb.js b/tokenmagic/fx/filters/FilterSpiderWeb.js
new file mode 100644
index 0000000..de70ea3
--- /dev/null
+++ b/tokenmagic/fx/filters/FilterSpiderWeb.js
@@ -0,0 +1,124 @@
+import { spiderWeb } from '../glsl/fragmentshaders/spiderweb.js';
+import { customVertex2D } from '../glsl/vertexshaders/customvertex2D.js';
+import { Anime } from "../Anime.js";
+import "./proto/FilterProto.js";
+
+export class FilterSpiderWeb extends PIXI.Filter {
+
+ constructor(params) {
+ let {
+ time,
+ anchorX,
+ anchorY,
+ color,
+ thickness,
+ div1,
+ div2,
+ tear,
+ amplitude
+ } = Object.assign({}, FilterSpiderWeb.defaults, params);
+
+ // using specific vertex shader and fragment shader
+ super(customVertex2D, spiderWeb);
+
+ this.uniforms.anchor = new Float32Array([0.5, -1.0]);
+ this.uniforms.color = new Float32Array([0.75, 0.75, 0.75]);
+
+ Object.assign(this, {
+ time, anchorX, anchorY, color, thickness, div1, div2, tear, amplitude
+ });
+
+ this.animated = {};
+ this.setTMParams(params);
+ this.anime = new Anime(this);
+ this.normalizeTMParams();
+ }
+
+ get time() {
+ return this.uniforms.time;
+ }
+
+ set time(value) {
+ this.uniforms.time = value;
+ }
+
+ get color() {
+ return PIXI.utils.rgb2hex(this.uniforms.color);
+ }
+
+ set color(value) {
+ PIXI.utils.hex2rgb(value, this.uniforms.color);
+ }
+
+ get anchorX() {
+ return this.uniforms.anchor[0];
+ }
+
+ set anchorX(value) {
+ this.uniforms.anchor[0] = 0.5;
+ }
+
+ get anchorY() {
+ return this.uniforms.anchor[1];
+ }
+
+ set anchorY(value) {
+ this.uniforms.anchor[1] = 0.5;
+ }
+
+ get thickness() {
+ return this.uniforms.thickness;
+ }
+
+ set thickness(value) {
+ this.uniforms.thickness = value;
+ }
+
+ get tear() {
+ return this.uniforms.tear;
+ }
+
+ set tear(value) {
+ this.uniforms.tear = value;
+ }
+
+ get amplitude() {
+ return this.uniforms.amplitude;
+ }
+
+ set amplitude(value) {
+ this.uniforms.amplitude = value;
+ }
+
+ get div1() {
+ return this.uniforms.div1;
+ }
+
+ set div1(value) {
+ this.uniforms.div1 = value;
+ }
+
+ get div2() {
+ return this.uniforms.div2;
+ }
+
+ set div2(value) {
+ this.uniforms.div2 = value;
+ }
+}
+
+FilterSpiderWeb.defaults = {
+ time: 0.0,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ color: 0xBBBBBB,
+ thickness: 1,
+ div1: 10,
+ div2: 10,
+ tear: 0.54,
+ amplitude: 0.8
+};
+
+
+
+
diff --git a/tokenmagic/fx/filters/FilterTwist.js b/tokenmagic/fx/filters/FilterTwist.js
index 10b981a..b27a55f 100644
--- a/tokenmagic/fx/filters/FilterTwist.js
+++ b/tokenmagic/fx/filters/FilterTwist.js
@@ -22,4 +22,4 @@ export class FilterTwist extends PIXI.filters.TwistFilter {
* this.placeableImg.parent.worldTransform.a
* this.radiusPercent) / 200;
}
-}
+}
\ No newline at end of file
diff --git a/tokenmagic/fx/filters/FilterXFog.js b/tokenmagic/fx/filters/FilterXFog.js
new file mode 100644
index 0000000..08c53a7
--- /dev/null
+++ b/tokenmagic/fx/filters/FilterXFog.js
@@ -0,0 +1,51 @@
+import { xFog } from '../glsl/fragmentshaders/xfog.js';
+import { customVertex2D } from '../glsl/vertexshaders/customvertex2D.js';
+import { Anime } from "../Anime.js";
+
+export class FilterXFog extends PIXI.Filter {
+
+ constructor(params) {
+ let {
+ time,
+ color
+ } = Object.assign({}, FilterXFog.defaults, params);
+
+ // specific vertex and fragment shaders
+ super(customVertex2D, xFog);
+
+ this.uniforms.color = new Float32Array([1.0, 0.4, 0.1, 0.55]);
+
+ Object.assign(this, {
+ time, color
+ });
+
+ this.animated = {};
+ Object.assign(this, params);
+ this.anime = new Anime(this);
+ }
+
+ get time() {
+ return this.uniforms.time;
+ }
+
+ set time(value) {
+ this.uniforms.time = value;
+ }
+
+ get color() {
+ return PIXI.utils.rgb2hex(this.uniforms.color);
+ }
+
+ set color(value) {
+ PIXI.utils.hex2rgb(value, this.uniforms.color);
+ }
+}
+
+FilterXFog.defaults = {
+ time: 0.0,
+ color: 0xFFFFFF,
+};
+
+
+
+
diff --git a/tokenmagic/fx/filters/proto/FilterProto.js b/tokenmagic/fx/filters/proto/FilterProto.js
index 5f79985..7e672e8 100644
--- a/tokenmagic/fx/filters/proto/FilterProto.js
+++ b/tokenmagic/fx/filters/proto/FilterProto.js
@@ -4,11 +4,11 @@ import "../../../module/proto/PlaceableObjectProto.js";
PIXI.Filter.prototype.setTMParams = function (params) {
this.autoDisable = false;
this.autoDestroy = false;
- this.autoFit = false;
this.padding = 0;
this.gridPadding = 0;
this.dummy = false;
objectAssign(this, params);
+ this.autoFit = false;
if (!this.dummy) {
this.originalPadding = Math.max(this.padding, getMinPadding());
this.assignPlaceable();
@@ -52,10 +52,6 @@ PIXI.Filter.prototype.assignPlaceable = function () {
: this.placeableImg = null;
}
-PIXI.Filter.prototype.assignPlaceable = function () {
- this.placeableImg = this.getPlaceable();
-}
-
PIXI.Filter.prototype.activateTransform = function () {
this.preComputation = this.filterTransform;
this.filterTransform();
diff --git a/tokenmagic/fx/glsl/fragmentshaders/electricity.js b/tokenmagic/fx/glsl/fragmentshaders/electricity.js
index 65c73ae..accbb23 100644
--- a/tokenmagic/fx/glsl/fragmentshaders/electricity.js
+++ b/tokenmagic/fx/glsl/fragmentshaders/electricity.js
@@ -77,10 +77,10 @@ float Perlin(vec3 P)
float fbm(vec3 p)
{
float v = 0.0;
- v += Perlin(p * 0.9) * 1.5 * cos(1.2 * PI * (time * 0.4));
+ v += Perlin(p * 0.9) * 1.5 * cos(PI * time * 0.48);
v += Perlin(p * 3.99) * 0.5 * sin(PI * time * 0.4);
v += Perlin(p * 8.01) * 0.4 * cos(PI * time * 0.4);
- v += Perlin(p * 15.05) * 0.05 * sin(0.1 * PI * time * 8.);
+ v += Perlin(p * 15.05) * 0.05 * sin(PI * time * 0.8);
return v;
}
@@ -111,6 +111,4 @@ void main() {
gl_FragColor = blenderVec3(blend,pixel,electric)*pixel.a;
}
-`;
-
-
+`;
\ No newline at end of file
diff --git a/tokenmagic/fx/glsl/fragmentshaders/spiderweb.js b/tokenmagic/fx/glsl/fragmentshaders/spiderweb.js
new file mode 100644
index 0000000..6bfeb51
--- /dev/null
+++ b/tokenmagic/fx/glsl/fragmentshaders/spiderweb.js
@@ -0,0 +1,87 @@
+export const spiderWeb = `
+precision mediump float;
+
+uniform float time;
+uniform float thickness;
+uniform float div1;
+uniform float div2;
+uniform float tear;
+uniform float amplitude;
+uniform vec2 anchor;
+uniform vec3 color;
+uniform sampler2D uSampler;
+
+varying vec2 vTextureCoord;
+varying vec2 vFilterCoord;
+
+const float PI = 3.14159265358;
+
+float random(vec2 n)
+{
+ return fract(cos(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);
+}
+
+vec2 random2(vec2 p)
+{
+ return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);
+}
+
+float uvrand(vec2 uv)
+{
+ return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
+}
+
+float noise(vec2 n)
+{
+ const vec2 d = vec2(0., 1.0);
+ vec2 b = floor(n);
+ vec2 f = smoothstep(vec2(0.), vec2(1.0), fract(n));
+ return mix(mix(random(b), random(b + d.yx), f.x),
+ mix(random(b + d.xy), random(b + d.yy), f.x), f.y);
+}
+
+float fbm(vec2 n)
+{
+ float total = 0.0, amp = amplitude;
+ for (int i = 0; i < 2; i++) {
+ total += noise(n) * amp;
+ n += n;
+ amp *= 0.5;
+ }
+ return total;
+}
+
+vec4 spiderweb()
+{
+ vec2 coord = vFilterCoord.xy + anchor;
+
+ float t = floor(time * 0.01) * 7.3962;
+
+ vec2 sc = (coord.xy - 1.) * 0.5;
+ float phi = atan(sc.y, sc.x + 1e-6);
+ vec2 pc = vec2(fract(phi / (PI * 2.)), length(sc));
+
+ float h_divnum = div1;
+ float s_divnum = div2;
+
+ float ddth = fbm(vec2(pc.x*h_divnum,pc.x*20.*pow(length(sc*0.5),2.))*3.);
+
+ float h_rand = 0.3+0.0895*(0.1*cos(time)+010.9)*tear;
+ float s_rand = .355*(0.2*cos(time)+1.);
+
+ float l = pc.y+ cos(ddth*0.5) * (h_rand - 0.4) + ddth*(s_rand - 0.5)*0.2;
+
+ float ts = 0.05;
+ float a = smoothstep(abs( 1.*sin(( pc.x*PI*2. ) * s_divnum) ),-.1,thickness * ts );
+ float b = smoothstep(abs( 1.*sin(( pc.y*PI*2. + h_rand + l) * h_divnum ) ),-.1,thickness * ts );
+ float s = a*b+a*b;
+
+ return vec4(color.r*2.25,color.g*2.25,color.b*2.25,2.)-vec4(s,s,s,1.0);
+}
+
+void main()
+{
+ vec4 pixel = texture2D(uSampler,vTextureCoord);
+ gl_FragColor = max(spiderweb(),pixel)*pixel.a;
+}
+`;
\ No newline at end of file
diff --git a/tokenmagic/fx/glsl/fragmentshaders/xfog.js b/tokenmagic/fx/glsl/fragmentshaders/xfog.js
new file mode 100644
index 0000000..f748b70
--- /dev/null
+++ b/tokenmagic/fx/glsl/fragmentshaders/xfog.js
@@ -0,0 +1,76 @@
+export const xFog = `
+precision mediump float;
+
+uniform float time;
+uniform vec3 color;
+uniform sampler2D uSampler;
+
+varying vec2 vTextureCoord;
+varying vec2 vFilterCoord;
+
+const float PI = 3.14159265;
+const mat3 rotationMatrix = mat3(1.0,0.0,0.0,0.0,0.47,-0.88,0.0,0.88,0.47);
+
+float hash(float p)
+{
+ return fract(sin(dot(vec2(p*0.00010,0.),vec2(12.9898,78.233))) * 43758.5453);
+}
+
+float noise( vec3 x )
+{
+ vec3 p = floor(x);
+ vec3 f = fract(x);
+ f = f*f*(3.0-2.0*f);
+ float n = p.x + p.y*57.0 + 113.0*p.z;
+ return mix(mix(mix( hash(n+0.0 ), hash(n+1.0),f.x),mix( hash(n+57.0 ), hash(n+58.0 ),f.x),f.y),
+ mix(mix( hash(n+113.0), hash(n+114.0),f.x),mix( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z);
+}
+
+vec4 map( vec3 p )
+{
+ float d = 0.2 - p.y;
+ vec3 q = p - vec3(0.0,1.0,0.0)*time;
+ float f = 0.50000*noise( q ); q = q*2.02 - vec3(0.0,1.0,0.0)*time*0.4;
+ f += 0.25000*noise( q ); q = q*2.03 - vec3(0.0,1.0,0.0)*time*0.2;
+ f += 0.12500*noise( q ); q = q*2.01 - vec3(0.0,1.0,0.0)*time*0.3;
+ f += 0.06250*noise( q ); q = q*2.02 - vec3(0.0,1.0,0.0)*time*0.3;
+ f += 0.03125*noise( q );
+ d = clamp( d + 4.5*f, 0.0, 1.0 );
+ vec3 col = mix( vec3(1.0,0.9,0.8), vec3(0.4,0.1,0.1), d ) + 0.05*sin(p);
+ return vec4( col, d );
+}
+
+vec3 cloudify( vec3 ro, vec3 rd )
+{
+ vec4 s = vec4( 0,0,0,0 );
+ float t = 0.0;
+ for( int i=0; i<128; i++ )
+ {
+ if( s.a > 0.99 ) break;
+ vec3 p = ro + t*rd;
+ vec4 k = map( p );
+ k.rgb *= mix( color*0.9, color, clamp( (p.y-0.2)*0.5, 0.0, 1.0 ) );
+ k.a *= 0.5;
+ k.rgb *= k.a;
+ s = s + k*(1.0-s.a);
+ t += 0.05;
+ }
+ return clamp( s.xyz, 0.0, 1.0 );
+}
+
+vec4 xfog(vec2 fragCoord)
+{
+ vec3 vo = vec3(0.0,4.9,-40.);
+ vec3 vd = normalize(vec3((0.7 * vFilterCoord.xy) * 1., 1.2)) * rotationMatrix * 1.5;
+ vec3 volume = cloudify( vo, vd );
+ volume = volume * 0.5 + 0.5 * volume * volume * (3.0 - 2.0 * volume);
+ return vec4( volume, 1.0 );
+}
+
+void main()
+{
+ vec4 pixel = texture2D(uSampler, vTextureCoord);
+ if (pixel.a == 0.) discard;
+ gl_FragColor = max( xfog(vFilterCoord), pixel)*pixel.a;
+}
+`;
\ No newline at end of file
diff --git a/tokenmagic/fx/presets/defaultpresets.js b/tokenmagic/fx/presets/defaultpresets.js
index 28a6e2d..15b0339 100644
--- a/tokenmagic/fx/presets/defaultpresets.js
+++ b/tokenmagic/fx/presets/defaultpresets.js
@@ -1,3 +1,8 @@
+export const PresetsLibrary = {
+ MAIN: "tmfx-main",
+ TEMPLATE: "tmfx-template"
+};
+
export var presets = [];
let params =
@@ -24,6 +29,7 @@ let params =
var presetObject = {};
presetObject.name = "bevel";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -54,6 +60,7 @@ params =
presetObject = new Object();
presetObject.name = "adjustment";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -92,6 +99,7 @@ params =
presetObject = new Object();
presetObject.name = "dropshadow";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -118,6 +126,7 @@ params =
presetObject = new Object();
presetObject.name = "outline";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -145,6 +154,7 @@ params =
presetObject = new Object();
presetObject.name = "glow";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -182,6 +192,7 @@ params =
presetObject = new Object();
presetObject.name = "bloom";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -202,6 +213,7 @@ params =
presetObject = new Object();
presetObject.name = "distortion";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -246,6 +258,7 @@ params =
presetObject = new Object();
presetObject.name = "oldfilm";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -270,6 +283,7 @@ params =
presetObject = new Object();
presetObject.name = "twist";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -296,6 +310,7 @@ params =
presetObject = new Object();
presetObject.name = "bulge";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -331,6 +346,7 @@ params =
presetObject = new Object();
presetObject.name = "blur";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -357,6 +373,7 @@ params =
presetObject = new Object();
presetObject.name = "zoomblur";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -385,6 +402,7 @@ params =
presetObject = new Object();
presetObject.name = "shockwave";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -397,6 +415,7 @@ params =
presetObject = new Object();
presetObject.name = "zapshadow";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -423,6 +442,7 @@ params =
presetObject = new Object();
presetObject.name = "rays";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -448,6 +468,7 @@ params =
presetObject = new Object();
presetObject.name = "fog";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -471,6 +492,7 @@ params =
presetObject = new Object();
presetObject.name = "fumes";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -495,6 +517,7 @@ params =
presetObject = new Object();
presetObject.name = "electric";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -538,6 +561,7 @@ params =
presetObject = new Object();
presetObject.name = "fire";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -583,6 +607,7 @@ params =
presetObject = new Object();
presetObject.name = "waves";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -610,6 +635,7 @@ params =
presetObject = new Object();
presetObject.name = "flood";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -635,6 +661,7 @@ params =
presetObject = new Object();
presetObject.name = "smoke";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -662,6 +689,7 @@ params =
presetObject = new Object();
presetObject.name = "images";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -732,6 +760,7 @@ params =
presetObject = new Object();
presetObject.name = "chaos-images";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -784,6 +813,7 @@ params =
presetObject = new Object();
presetObject.name = "spectral-images";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -815,6 +845,7 @@ params =
presetObject = new Object();
presetObject.name = "hexa-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -846,6 +877,7 @@ params =
presetObject = new Object();
presetObject.name = "fire-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -877,6 +909,7 @@ params =
presetObject = new Object();
presetObject.name = "smoke-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -908,6 +941,7 @@ params =
presetObject = new Object();
presetObject.name = "earth-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -940,6 +974,7 @@ params =
presetObject = new Object();
presetObject.name = "earth-field-top";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -971,6 +1006,7 @@ params =
presetObject = new Object();
presetObject.name = "air-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1002,6 +1038,7 @@ params =
presetObject = new Object();
presetObject.name = "magic-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1033,6 +1070,7 @@ params =
presetObject = new Object();
presetObject.name = "chromatic-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1064,6 +1102,7 @@ params =
presetObject = new Object();
presetObject.name = "water-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1101,6 +1140,7 @@ params =
presetObject = new Object();
presetObject.name = "evil-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1132,6 +1172,7 @@ params =
presetObject = new Object();
presetObject.name = "grid-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1163,6 +1204,7 @@ params =
presetObject = new Object();
presetObject.name = "warp-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1194,6 +1236,7 @@ params =
presetObject = new Object();
presetObject.name = "color-field";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1230,6 +1273,7 @@ params =
presetObject = new Object();
presetObject.name = "sunburst";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1273,6 +1317,7 @@ params =
presetObject = new Object();
presetObject.name = "clover";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1302,6 +1347,7 @@ params =
presetObject = new Object();
presetObject.name = "scan";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1345,6 +1391,7 @@ params =
presetObject = new Object();
presetObject.name = "blue-rays";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1379,6 +1426,7 @@ params =
presetObject = new Object();
presetObject.name = "spectral-body";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1421,6 +1469,7 @@ params =
presetObject = new Object();
presetObject.name = "mantle-of-madness";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1493,6 +1542,7 @@ params =
presetObject = new Object();
presetObject.name = "drift-in-plans";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1535,6 +1585,7 @@ params =
presetObject = new Object();
presetObject.name = "fire-aura";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1587,6 +1638,7 @@ params =
presetObject = new Object();
presetObject.name = "glacial-aura";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1653,6 +1705,7 @@ params =
presetObject = new Object();
presetObject.name = "anti-aura";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1732,6 +1785,7 @@ params =
presetObject = new Object();
presetObject.name = "pure-fire-aura";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1810,6 +1864,7 @@ params =
presetObject = new Object();
presetObject.name = "pure-fire-aura-2";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1886,6 +1941,7 @@ params =
presetObject = new Object();
presetObject.name = "pure-ice-aura";
+presetObject.library = PresetsLibrary.MAIN;
presetObject.params = params;
presets.push(presetObject);
@@ -1899,5 +1955,854 @@ params =
presetObject = new Object();
presetObject.name = "pixelate";
+presetObject.library = PresetsLibrary.MAIN;
+presetObject.params = params;
+presets.push(presetObject);
+
+export var templatePresets = [];
+
+// white : **electric , **waves, ***xrays, **liquid (normal), (clover)
+// black : **liquid (protoplasm), **smoke, **rays, outline, **fumes, **fog, **flood, **fire
+// no texture : **glow, **bulge, **blur, **bloom
+
+params =
+ [{
+ filterType: "flood",
+ filterId: "Watery Surface",
+ time: 0,
+ color: 0x0020BB,
+ billowy: 0.43,
+ tintIntensity: 0.72,
+ glint: 0.31,
+ scale: 70,
+ padding: 10,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0006,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Watery Surface";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "liquid",
+ filterId: "Protoplasm",
+ color: 0x20AAEE,
+ time: 0,
+ blend: 8,
+ intensity: 4,
+ spectral: true,
+ scale: 1.4,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0010,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Protoplasm";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "liquid",
+ filterId: "Watery Surface 2",
+ color: 0x20AAEE,
+ time: 0,
+ blend: 8,
+ intensity: 4,
+ spectral: false,
+ scale: 1.4,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0010,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Watery Surface 2";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "smoke",
+ filterId: "Smoky Area",
+ color: 0xAAAAAA,
+ time: 0,
+ blend: 2,
+ dimX: 1,
+ dimY: 1,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.002,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Smoky Area";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "electric",
+ filterId: "Shock",
+ color: 0xFFFFFF,
+ time: 0,
+ blend: 1,
+ intensity: 5,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0020,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Shock";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xray",
+ filterId: "Annihilating Rays",
+ time: 0,
+ color: 0xFFBB00,
+ blend: 9,
+ dimX: 1,
+ dimY: 1,
+ anchorX: 0,
+ anchorY: 0,
+ divisor: 6,
+ intensity: 4,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0012,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Annihilating Rays";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "ray",
+ filterId: "Classic Rays",
+ time: 0,
+ color: 0xCF8000,
+ alpha: 0.5,
+ divisor: 32,
+ anchorX: 0,
+ anchorY: 0,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0005,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Classic Rays";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "fumes",
+ filterId: "Smoke Filaments",
+ color: 0x808080,
+ time: 0,
+ blend: 8,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.001,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Smoke Filaments";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "fire",
+ filterId: "Flames",
+ intensity: 1.5,
+ color: 0xFFFFFF,
+ amplitude: 1.3,
+ time: 0,
+ blend: 2,
+ fireBlend: 1,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: -0.0016,
+ animType: "move"
+ },
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Flames";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xfog",
+ filterId: "Thick Fog",
+ autoFit: false,
+ color: 0x3090FF,
+ time: 0,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0006,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Thick Fog";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-vstrong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "glow",
+ filterId: "Glowing Outline",
+ outerStrength: 5.5,
+ innerStrength: 0,
+ color: 0x006000,
+ quality: 0.5,
+ padding: 10,
+ animated:
+ {
+ outerStrength:
+ {
+ active: true,
+ loopDuration: 3000,
+ animType: "syncCosOscillation",
+ val1: 5.5,
+ val2: 1.5
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Glowing Outline";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "wave",
+ filterId: "Waves",
+ time: 0,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ strength: 0.015,
+ frequency: 120,
+ color: 0xFFFFFF,
+ maxIntensity: 2.5,
+ minIntensity: 0.9,
+ padding: 10,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0085,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Waves";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
presetObject.params = params;
-presets.push(presetObject);
\ No newline at end of file
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "wave",
+ filterId: "Waves 2",
+ time: 0,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ strength: 0.014,
+ frequency: 400,
+ color: 0xFFFFFF,
+ maxIntensity: 2.4,
+ minIntensity: 0.8,
+ padding: 10,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0385,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Waves 2";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "wave",
+ filterId: "Waves 3",
+ time: 0,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ strength: 0.017,
+ frequency: 35,
+ color: 0xFFFFFF,
+ maxIntensity: 2.6,
+ minIntensity: 0.9,
+ padding: 20,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0085,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Waves 3";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xglow",
+ filterId: "Zone : Fire",
+ auraType: 1,
+ color: 0x903010,
+ scale: 1.5,
+ time: 0,
+ auraIntensity: 1.8,
+ subAuraIntensity: 0.25,
+ threshold: 0.6,
+ discard: false,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0027,
+ animType: "move"
+ },
+ thickness:
+ {
+ active: true,
+ loopDuration: 3000,
+ animType: "cosOscillation",
+ val1: 2,
+ val2: 5
+ }
+ }
+ },
+ {
+ filterType: "fire",
+ filterId: "Zone : Fire",
+ intensity: 1.5,
+ color: 0xFFFFFF,
+ amplitude: 1,
+ time: 0,
+ blend: 2,
+ fireBlend: 1,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: -0.0015,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Zone : Fire";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xglow",
+ filterId: "Zone : Electricity",
+ auraType: 2,
+ color: 0x303030,
+ scale: 1.5,
+ time: 0,
+ auraIntensity: 1,
+ subAuraIntensity: 0.9,
+ threshold: 0,
+ discard: true,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0027,
+ animType: "move"
+ },
+ thickness:
+ {
+ active: true,
+ loopDuration: 3000,
+ animType: "cosOscillation",
+ val1: 1,
+ val2: 2
+ }
+ }
+ },
+ {
+ filterType: "electric",
+ filterId: "Zone : Electricity",
+ color: 0xFFFFFF,
+ time: 0,
+ blend: 1,
+ intensity: 5,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0020,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Zone : Electricity";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xglow",
+ filterId: "Zone : Blizzard",
+ auraType: 1,
+ color: 0x5099DD,
+ thickness: 4.5,
+ scale: 5,
+ time: 0,
+ auraIntensity: 0.25,
+ subAuraIntensity: 1,
+ threshold: 0.5,
+ discard: false,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0018,
+ animType: "move"
+ },
+ thickness:
+ {
+ val1: 2, val2: 3.3,
+ animType: "cosOscillation",
+ loopDuration: 3000
+ },
+ subAuraIntensity:
+ {
+ val1: 0.05, val2: 0.1,
+ animType: "cosOscillation",
+ loopDuration: 6000
+ },
+ auraIntensity:
+ {
+ val1: 0.9, val2: 2.2,
+ animType: "cosOscillation",
+ loopDuration: 3000
+ }
+ }
+ },
+ {
+ filterType: "smoke",
+ filterId: "Zone : Blizzard",
+ color: 0x80CCFF,
+ time: 0,
+ blend: 2,
+ dimY: 1,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: -0.005,
+ animType: "move"
+ },
+ dimX:
+ {
+ val1: 0.4, val2: 0.2,
+ animType: "cosOscillation",
+ loopDuration: 3000
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Zone : Blizzard";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "bulgepinch",
+ filterId: "Bulging Out",
+ padding: 150,
+ strength: 0,
+ radiusPercent: 200,
+ animated:
+ {
+ strength:
+ {
+ active: true,
+ animType: "cosOscillation",
+ loopDuration: 2000,
+ val1: 0,
+ val2: 0.45
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Bulging Out";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "blur",
+ filterId: "Blurred Texture",
+ padding: 25,
+ quality: 4.0,
+ blur: 0,
+ blurX: 0,
+ blurY: 0,
+ animated:
+ {
+ blurX:
+ {
+ active: true,
+ animType: "syncCosOscillation",
+ loopDuration: 500,
+ val1: 0,
+ val2: 6
+ },
+ blurY:
+ {
+ active: true,
+ animType: "syncCosOscillation",
+ loopDuration: 750,
+ val1: 0,
+ val2: 6
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Blurred Texture";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "xbloom",
+ filterId: "Bloomed Texture",
+ threshold: 0.35,
+ bloomScale: 0,
+ brightness: 1,
+ blur: 0.1,
+ padding: 10,
+ quality: 15,
+ blendMode: 0,
+ animated:
+ {
+ bloomScale:
+ {
+ active: true,
+ loopDuration: 2000,
+ animType: "syncCosOscillation",
+ val1: 0,
+ val2: 2.1
+ },
+ threshold:
+ {
+ active: false,
+ loopDuration: 1000,
+ animType: "syncCosOscillation",
+ val1: 0.00,
+ val2: 1.90
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Bloomed Texture";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "liquid",
+ filterId: "Wild Magic",
+ color: 0xFF0000,
+ time: 0,
+ blend: 6,
+ intensity: 5,
+ spectral: false,
+ scale: 2.5,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0018,
+ animType: "move"
+ }
+ }
+ },
+ {
+ filterType: "wave",
+ filterId: "Wild Magic",
+ time: 0,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ strength: 0.014,
+ frequency: 10,
+ color: 0xFFFFFF,
+ maxIntensity: 1.3,
+ minIntensity: 0.6,
+ padding: 10,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0065,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Wild Magic";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "web",
+ filterId: "Spider Web 1",
+ anchorX: 0.5,
+ anchorY: 0.5,
+ color: 0xFFFFFF,
+ thickness: 2,
+ div2: 5,
+ time: 98.8,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ loopDuration: 5000,
+ animType: "cosOscillation",
+ val1: 98.8,
+ val2: 99.7
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Spider Web 1";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "web",
+ filterId: "Spider Web 2",
+ anchorX: 0.5,
+ anchorY: 0.5,
+ color: 0xCCCCCC,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0005,
+ animType: "move"
+ }
+ }
+ },
+ {
+ filterType: "liquid",
+ filterId: "Spider Web 2",
+ color: 0xFF0000,
+ time: 0,
+ blend: 4,
+ intensity: 8,
+ spectral: false,
+ scale: 0.2,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0005,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Spider Web 2";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+params =
+ [{
+ filterType: "web",
+ filterId: "Spider Web 3",
+ anchorX: 0.5,
+ anchorY: 0.5,
+ color: 0xCCCCCC,
+ time: 100,
+ },
+ {
+ filterType: "liquid",
+ filterId: "Spider Web 3",
+ color: 0xFF0000,
+ time: 0,
+ blend: 1,
+ intensity: 4,
+ spectral: true,
+ scale: 0.2,
+ animated:
+ {
+ time:
+ {
+ active: true,
+ speed: 0.0005,
+ animType: "move"
+ }
+ }
+ }];
+
+presetObject = {};
+presetObject.name = "Spider Web 3";
+presetObject.library = PresetsLibrary.TEMPLATE;
+presetObject.defaultTexture = "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png";
+presetObject.params = params;
+templatePresets.push(presetObject);
+
+export var allPresets = presets.concat(templatePresets);
\ No newline at end of file
diff --git a/tokenmagic/import/TMFX-default-presets.json b/tokenmagic/import/TMFX-default-presets.json
index f20716c..75bfcb6 100644
--- a/tokenmagic/import/TMFX-default-presets.json
+++ b/tokenmagic/import/TMFX-default-presets.json
@@ -20,7 +20,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "adjustment",
@@ -46,7 +47,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "dropshadow",
@@ -79,7 +81,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "outline",
@@ -101,7 +104,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "glow",
@@ -124,7 +128,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "bloom",
@@ -156,7 +161,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "distortion",
@@ -181,7 +187,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "oldfilm",
@@ -220,7 +227,8 @@
"color": 0,
"thickness": 0
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "twist",
@@ -240,7 +248,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "bulge",
@@ -262,7 +271,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "blur",
@@ -292,7 +302,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "zoomblur",
@@ -314,7 +325,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "shockwave",
@@ -339,7 +351,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "zapshadow",
@@ -349,7 +362,8 @@
"filterId": "zapshadow",
"alphaTolerance": 0.45
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "rays",
@@ -371,7 +385,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "fog",
@@ -392,7 +407,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "fumes",
@@ -411,7 +427,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "electric",
@@ -431,7 +448,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "fire",
@@ -467,7 +485,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "waves",
@@ -506,7 +525,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "flood",
@@ -529,7 +549,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "smoke",
@@ -550,7 +571,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "images",
@@ -573,7 +595,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "chaos-images",
@@ -634,7 +657,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "spectral-images",
@@ -682,7 +706,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "hexa-field",
@@ -709,7 +734,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "fire-field",
@@ -736,7 +762,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "smoke-field",
@@ -763,7 +790,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "earth-field",
@@ -790,7 +818,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "earth-field-top",
@@ -818,7 +847,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "air-field",
@@ -845,7 +875,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "magic-field",
@@ -872,7 +903,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "chromatic-field",
@@ -899,7 +931,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "water-field",
@@ -926,7 +959,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "evil-field",
@@ -959,7 +993,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "grid-field",
@@ -986,7 +1021,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "warp-field",
@@ -1013,7 +1049,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "color-field",
@@ -1040,7 +1077,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "sunburst",
@@ -1071,7 +1109,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "clover",
@@ -1108,7 +1147,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "scan",
@@ -1133,7 +1173,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "blue-rays",
@@ -1170,7 +1211,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "spectral-body",
@@ -1199,7 +1241,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "mantle-of-madness",
@@ -1235,7 +1278,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "drift-in-plans",
@@ -1298,7 +1342,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "fire-aura",
@@ -1335,7 +1380,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "glacial-aura",
@@ -1383,7 +1429,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "anti-aura",
@@ -1441,7 +1488,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "pure-fire-aura",
@@ -1509,7 +1557,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "pure-fire-aura-2",
@@ -1577,7 +1626,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "pure-ice-aura",
@@ -1647,7 +1697,8 @@
}
}
}
- ]
+ ],
+ "library": "tmfx-main"
},
{
"name": "pixelate",
@@ -1658,6 +1709,736 @@
"sizeX": 2.5,
"sizeY": 2.5
}
+ ],
+ "library": "tmfx-main"
+ },
+ {
+ "name": "Watery Surface",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "flood",
+ "filterId": "Watery Surface",
+ "time": 0,
+ "color": 8379,
+ "billowy": 0.43,
+ "tintIntensity": 0.72,
+ "glint": 0.31,
+ "scale": 70,
+ "padding": 10,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0006,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Protoplasm",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "liquid",
+ "filterId": "Protoplasm",
+ "color": 2140910,
+ "time": 0,
+ "blend": 8,
+ "intensity": 4,
+ "spectral": true,
+ "scale": 1.4,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.001,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Watery Surface 2",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "liquid",
+ "filterId": "Watery Surface 2",
+ "color": 2140910,
+ "time": 0,
+ "blend": 8,
+ "intensity": 4,
+ "spectral": false,
+ "scale": 1.4,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.001,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Smoky Area",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "smoke",
+ "filterId": "Smoky Area",
+ "color": 11184810,
+ "time": 0,
+ "blend": 2,
+ "dimX": 1,
+ "dimY": 1,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.002,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Shock",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "electric",
+ "filterId": "Shock",
+ "color": 16777215,
+ "time": 0,
+ "blend": 1,
+ "intensity": 5,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.002,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Annihilating Rays",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "xray",
+ "filterId": "Annihilating Rays",
+ "time": 0,
+ "color": 16759552,
+ "blend": 9,
+ "dimX": 1,
+ "dimY": 1,
+ "anchorX": 0,
+ "anchorY": 0,
+ "divisor": 6,
+ "intensity": 4,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0012,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Classic Rays",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "ray",
+ "filterId": "Classic Rays",
+ "time": 0,
+ "color": 13598720,
+ "alpha": 0.5,
+ "divisor": 32,
+ "anchorX": 0,
+ "anchorY": 0,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0005,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Smoke Filaments",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "fumes",
+ "filterId": "Smoke Filaments",
+ "color": 8421504,
+ "time": 0,
+ "blend": 8,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.001,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Flames",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "fire",
+ "filterId": "Flames",
+ "intensity": 1.5,
+ "color": 16777215,
+ "amplitude": 1.3,
+ "time": 0,
+ "blend": 2,
+ "fireBlend": 1,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": -0.0016,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Thick Fog",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-vstrong-opacity.png",
+ "params": [
+ {
+ "filterType": "xfog",
+ "filterId": "Thick Fog",
+ "autoFit": false,
+ "color": 3182847,
+ "time": 0,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0006,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Glowing Outline",
+ "library": "tmfx-template",
+ "params": [
+ {
+ "filterType": "glow",
+ "filterId": "Glowing Outline",
+ "outerStrength": 5.5,
+ "innerStrength": 0,
+ "color": 24576,
+ "quality": 0.5,
+ "padding": 10,
+ "animated": {
+ "outerStrength": {
+ "active": true,
+ "loopDuration": 3000,
+ "animType": "syncCosOscillation",
+ "val1": 5.5,
+ "val2": 1.5
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Waves",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "wave",
+ "filterId": "Waves",
+ "time": 0,
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "strength": 0.015,
+ "frequency": 120,
+ "color": 16777215,
+ "maxIntensity": 2.5,
+ "minIntensity": 0.9,
+ "padding": 10,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0085,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Waves 2",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "wave",
+ "filterId": "Waves 2",
+ "time": 0,
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "strength": 0.014,
+ "frequency": 400,
+ "color": 16777215,
+ "maxIntensity": 2.4,
+ "minIntensity": 0.8,
+ "padding": 10,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0385,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Waves 3",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "wave",
+ "filterId": "Waves 3",
+ "time": 0,
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "strength": 0.017,
+ "frequency": 35,
+ "color": 16777215,
+ "maxIntensity": 2.6,
+ "minIntensity": 0.9,
+ "padding": 20,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0085,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Zone : Fire",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "xglow",
+ "filterId": "Zone : Fire",
+ "auraType": 1,
+ "color": 9449488,
+ "scale": 1.5,
+ "time": 0,
+ "auraIntensity": 1.8,
+ "subAuraIntensity": 0.25,
+ "threshold": 0.6,
+ "discard": false,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0027,
+ "animType": "move"
+ },
+ "thickness": {
+ "active": true,
+ "loopDuration": 3000,
+ "animType": "cosOscillation",
+ "val1": 2,
+ "val2": 5
+ }
+ }
+ },
+ {
+ "filterType": "fire",
+ "filterId": "Zone : Fire",
+ "intensity": 1.5,
+ "color": 16777215,
+ "amplitude": 1,
+ "time": 0,
+ "blend": 2,
+ "fireBlend": 1,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": -0.0015,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Zone : Electricity",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/white-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "xglow",
+ "filterId": "Zone : Electricity",
+ "auraType": 2,
+ "color": 3158064,
+ "scale": 1.5,
+ "time": 0,
+ "auraIntensity": 1,
+ "subAuraIntensity": 0.9,
+ "threshold": 0,
+ "discard": true,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0027,
+ "animType": "move"
+ },
+ "thickness": {
+ "active": true,
+ "loopDuration": 3000,
+ "animType": "cosOscillation",
+ "val1": 1,
+ "val2": 2
+ }
+ }
+ },
+ {
+ "filterType": "electric",
+ "filterId": "Zone : Electricity",
+ "color": 16777215,
+ "time": 0,
+ "blend": 1,
+ "intensity": 5,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.002,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Zone : Blizzard",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "xglow",
+ "filterId": "Zone : Blizzard",
+ "auraType": 1,
+ "color": 5282269,
+ "thickness": 4.5,
+ "scale": 5,
+ "time": 0,
+ "auraIntensity": 0.25,
+ "subAuraIntensity": 1,
+ "threshold": 0.5,
+ "discard": false,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0018,
+ "animType": "move"
+ },
+ "thickness": {
+ "val1": 2,
+ "val2": 3.3,
+ "animType": "cosOscillation",
+ "loopDuration": 3000
+ },
+ "subAuraIntensity": {
+ "val1": 0.05,
+ "val2": 0.1,
+ "animType": "cosOscillation",
+ "loopDuration": 6000
+ },
+ "auraIntensity": {
+ "val1": 0.9,
+ "val2": 2.2,
+ "animType": "cosOscillation",
+ "loopDuration": 3000
+ }
+ }
+ },
+ {
+ "filterType": "smoke",
+ "filterId": "Zone : Blizzard",
+ "color": 8441087,
+ "time": 0,
+ "blend": 2,
+ "dimY": 1,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": -0.005,
+ "animType": "move"
+ },
+ "dimX": {
+ "val1": 0.4,
+ "val2": 0.2,
+ "animType": "cosOscillation",
+ "loopDuration": 3000
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Bulging Out",
+ "library": "tmfx-template",
+ "params": [
+ {
+ "filterType": "bulgepinch",
+ "filterId": "Bulging Out",
+ "padding": 150,
+ "strength": 0,
+ "radiusPercent": 200,
+ "animated": {
+ "strength": {
+ "active": true,
+ "animType": "cosOscillation",
+ "loopDuration": 2000,
+ "val1": 0,
+ "val2": 0.45
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Blurred Texture",
+ "library": "tmfx-template",
+ "params": [
+ {
+ "filterType": "blur",
+ "filterId": "Blurred Texture",
+ "padding": 25,
+ "quality": 4,
+ "blur": 0,
+ "blurX": 0,
+ "blurY": 0,
+ "animated": {
+ "blurX": {
+ "active": true,
+ "animType": "syncCosOscillation",
+ "loopDuration": 500,
+ "val1": 0,
+ "val2": 6
+ },
+ "blurY": {
+ "active": true,
+ "animType": "syncCosOscillation",
+ "loopDuration": 750,
+ "val1": 0,
+ "val2": 6
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Bloomed Texture",
+ "library": "tmfx-template",
+ "params": [
+ {
+ "filterType": "xbloom",
+ "filterId": "Bloomed Texture",
+ "threshold": 0.35,
+ "bloomScale": 0,
+ "brightness": 1,
+ "blur": 0.1,
+ "padding": 10,
+ "quality": 15,
+ "blendMode": 0,
+ "animated": {
+ "bloomScale": {
+ "active": true,
+ "loopDuration": 2000,
+ "animType": "syncCosOscillation",
+ "val1": 0,
+ "val2": 2.1
+ },
+ "threshold": {
+ "active": false,
+ "loopDuration": 1000,
+ "animType": "syncCosOscillation",
+ "val1": 0,
+ "val2": 1.9
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Wild Magic",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "liquid",
+ "filterId": "Wild Magic",
+ "color": 16711680,
+ "time": 0,
+ "blend": 6,
+ "intensity": 5,
+ "spectral": false,
+ "scale": 2.5,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0018,
+ "animType": "move"
+ }
+ }
+ },
+ {
+ "filterType": "wave",
+ "filterId": "Wild Magic",
+ "time": 0,
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "strength": 0.014,
+ "frequency": 10,
+ "color": 16777215,
+ "maxIntensity": 1.3,
+ "minIntensity": 0.6,
+ "padding": 10,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0065,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Spider Web 1",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "web",
+ "filterId": "Spider Web 1",
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0005,
+ "animType": "move"
+ }
+ }
+ },
+ {
+ "filterType": "blur",
+ "filterId": "Spider Web 1",
+ "padding": 10,
+ "quality": 5,
+ "blur": 1.4
+ },
+ {
+ "filterType": "liquid",
+ "filterId": "Spider Web 1",
+ "color": 16711680,
+ "time": 0,
+ "blend": 1,
+ "intensity": 8,
+ "spectral": false,
+ "scale": 0.2,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0005,
+ "animType": "move"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "name": "Spider Web 2",
+ "library": "tmfx-template",
+ "defaultTexture": "/modules/tokenmagic/fx/assets/templates/black-tone-strong-opacity.png",
+ "params": [
+ {
+ "filterType": "web",
+ "filterId": "Spider Web 2",
+ "anchorX": 0.5,
+ "anchorY": 0.5,
+ "time": 100
+ },
+ {
+ "filterType": "blur",
+ "filterId": "Spider Web 2",
+ "padding": 10,
+ "quality": 5,
+ "blur": 1.4
+ },
+ {
+ "filterType": "xfog",
+ "filterId": "Spider Web 2",
+ "autoFit": false,
+ "color": 9474192,
+ "time": 0,
+ "animated": {
+ "time": {
+ "active": true,
+ "speed": 0.0002,
+ "animType": "move"
+ }
+ }
+ },
+ {
+ "filterType": "bulgepinch",
+ "filterId": "Spider Web 2",
+ "strength": 0,
+ "padding": 50,
+ "radiusPercent": 120,
+ "animated": {
+ "strength": {
+ "active": true,
+ "animType": "cosOscillation",
+ "loopDuration": 3000,
+ "val1": 0.45,
+ "val2": 0
+ }
+ }
+ }
]
}
]
\ No newline at end of file
diff --git a/tokenmagic/lang/en.json b/tokenmagic/lang/en.json
index 541dc44..2a8586e 100644
--- a/tokenmagic/lang/en.json
+++ b/tokenmagic/lang/en.json
@@ -16,6 +16,9 @@
"TMFX.preset.reset.success": "Your preset library has been successfully reset.",
"TMFX.importOverwrite.name": "Overwrite on import",
"TMFX.importOverwrite.hint": "Check this option if you want to replace presets with the same name during an import.",
+ "TMFX.template.opacity": "Inner Opacity:",
+ "TMFX.template.fx": "Special Effects:",
+ "TMFX.template.tint": "Effect Tint:",
"TMFX.useMaxPadding.name": "FX in additive padding mode",
"TMFX.useMaxPadding.hint": "By default, FX paddings are additives when applied on a given placeable. If the checkbox is unchecked, the maximum padding is used.",
"TMFX.minPadding.name": "Minimum padding",
diff --git a/tokenmagic/lang/fr.json b/tokenmagic/lang/fr.json
index 6a4cff3..1f361cb 100644
--- a/tokenmagic/lang/fr.json
+++ b/tokenmagic/lang/fr.json
@@ -17,6 +17,9 @@
"TMFX.importOverwrite.name": "Écraser lors d'une importation",
"TMFX.importOverwrite.hint": "Cochez cette option si vous souhaitez écraser les prédéfinitions avec le même nom pendant une importation.",
"TMFX.useMaxPadding.name": "Effet en mode padding additif",
+ "TMFX.template.opacity": "Opacité Interne:",
+ "TMFX.template.fx": "Effets Spéciaux:",
+ "TMFX.template.tint": "Teinte de l'Effet:",
"TMFX.useMaxPadding.hint": "Par défaut, les effets additionnent leur padding en s'appliquant sur un objet donné. Si la case est décochée, c'est le padding maximum qui est utilisé.",
"TMFX.minPadding.name": "Padding minimum",
"TMFX.minPadding.hint": "Padding minimum appliqué aux effets.",
diff --git a/tokenmagic/migration/migration.js b/tokenmagic/migration/migration.js
new file mode 100644
index 0000000..62038d9
--- /dev/null
+++ b/tokenmagic/migration/migration.js
@@ -0,0 +1,58 @@
+import { isTheOne, log, warn, error } from "../module/tokenmagic.js";
+import { PresetsLibrary, templatePresets } from "../fx/presets/defaultpresets.js";
+
+export const DataVersion =
+{
+ ARCHAIC: "",
+ V030: "0.3.0"
+}
+
+// migration function - will evolve constantly
+export async function tmfxDataMigration() {
+ if (isTheOne()) {
+ var dataVersionNow;
+ try {
+ dataVersionNow = game.settings.get("tokenmagic", "migration");
+ } catch (e) {
+ dataVersionNow = DataVersion.ARCHAIC;
+ }
+ if (dataVersionNow < DataVersion.V030) {
+ await updatePresetsV030();
+ }
+ }
+}
+
+// migrating to the new presets data
+async function updatePresetsV030() {
+ var presets = game.settings.get("tokenmagic", "presets");
+
+ if (!(presets == null)) {
+ log(`Migration 0.3.0 - Launching presets data migration...`);
+
+ let foundTemplateLibrary = false;
+
+ for (const preset of presets) {
+ if (!preset.hasOwnProperty("library")) {
+ preset.library = PresetsLibrary.MAIN;
+ log(`Migration 0.3.0 - Adding ${preset.name} to ${PresetsLibrary.MAIN}`);
+ } else if (preset.library === PresetsLibrary.TEMPLATE && !foundTemplateLibrary) {
+ foundTemplateLibrary = true;
+ log(`Migration 0.3.0 - Found template presets. Templates will not be added.`);
+ }
+ }
+
+ if (!foundTemplateLibrary) log(`Migration 0.3.0 - Merging templates presets.`)
+
+ let newPresets =
+ (foundTemplateLibrary ? presets : presets.concat(templatePresets));
+
+ try {
+ await game.settings.set("tokenmagic", "presets", newPresets);
+ await game.settings.set("tokenmagic", "migration", DataVersion.V030);
+ log(`Migration 0.3.0 - Migration successful!`);
+ } catch (e) {
+ error(`Migration 0.3.0 - Migration failed.`);
+ error(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tokenmagic/module.json b/tokenmagic/module.json
index 9108c2f..fa736f8 100644
--- a/tokenmagic/module.json
+++ b/tokenmagic/module.json
@@ -2,7 +2,7 @@
"name": "tokenmagic",
"title": "Token Magic FX",
"description": "Add graphic filters and animations on your tokens and tiles.
",
- "version": "0.2.2b",
+ "version": "0.3.0",
"compatibleCoreVersion": "0.6.5",
"minimumCoreVersion": "0.6.0",
"author": "SecretFire",
@@ -27,6 +27,8 @@
"fx/glsl/fragmentshaders/mirrorimages.js",
"fx/glsl/fragmentshaders/xray.js",
"fx/glsl/fragmentshaders/magicglow.js",
+ "fx/glsl/fragmentshaders/spiderweb.js",
+ "fx/glsl/fragmentshaders/xfog.js",
"fx/filters/FilterBevel.js",
"fx/filters/FilterAdjustment.js",
"fx/filters/FilterAdvancedBloom.js",
@@ -42,6 +44,7 @@
"fx/filters/FilterRemoveShadow.js",
"fx/filters/FilterRays.js",
"fx/filters/FilterFog.js",
+ "fx/filters/FilterXFog.js",
"fx/filters/FilterElectric.js",
"fx/filters/FilterShockWave.js",
"fx/filters/FilterFumes.js",
@@ -55,6 +58,7 @@
"fx/filters/FilterLiquid.js",
"fx/filters/FilterGleamingGlow.js",
"fx/filters/FilterPixelate.js",
+ "fx/filters/FilterSpiderWeb.js",
"fx/filters/proto/FilterProto.js"
],
diff --git a/tokenmagic/module/proto/PlaceableObjectProto.js b/tokenmagic/module/proto/PlaceableObjectProto.js
index 401c064..51fa2a2 100644
--- a/tokenmagic/module/proto/PlaceableObjectProto.js
+++ b/tokenmagic/module/proto/PlaceableObjectProto.js
@@ -1,7 +1,8 @@
import { PlaceableType, Magic, broadcast, SocketAction, mustBroadCast, isTheOne } from "../tokenmagic.js";
+import { PresetsLibrary } from "../../fx/presets/defaultpresets.js";
-PlaceableObject.prototype.TMFXaddFilters = async function (paramsArray) {
- await Magic.addFilters(this, paramsArray);
+PlaceableObject.prototype.TMFXaddFilters = async function (paramsArray, replace = false) {
+ await Magic.addFilters(this, paramsArray, replace);
}
PlaceableObject.prototype.TMFXupdateFilters = async function (paramsArray) {
@@ -107,4 +108,25 @@ PlaceableObject.prototype._TMFXgetPlaceableType = function () {
.includes(this.constructor.embeddedName)) return this.constructor.embeddedName;
return PlaceableType.NOT_SUPPORTED;
-}
\ No newline at end of file
+}
+
+MeasuredTemplate.prototype.update = (function () {
+ const cachedMTU = MeasuredTemplate.prototype.update;
+ return async function (data, options) {
+ let hasTexture = data.hasOwnProperty("texture");
+ let hasPresetData = data.hasOwnProperty("tmfxPreset");
+ if (hasPresetData && data.tmfxPreset !== 'NOFX') {
+ let defaultTexture = Magic._getPresetTemplateDefaultTexture(data.tmfxPreset.slice(5));
+ if (!(defaultTexture == null)) {
+ if (data.texture === '' || data.texture.includes('/modules/tokenmagic/fx/assets/templates/'))
+ data.texture = defaultTexture;
+ }
+
+ } else if (hasTexture && data.texture.includes('/modules/tokenmagic/fx/assets/templates/')
+ && hasPresetData && data.tmfxPreset === 'NOFX') {
+ data.texture = '';
+ }
+
+ await cachedMTU.apply(this, arguments);
+ };
+})();
\ No newline at end of file
diff --git a/tokenmagic/module/tokenmagic.js b/tokenmagic/module/tokenmagic.js
index 671d510..1fdb516 100644
--- a/tokenmagic/module/tokenmagic.js
+++ b/tokenmagic/module/tokenmagic.js
@@ -14,6 +14,7 @@ import { FilterBulgePinch } from "../fx/filters/FilterBulgePinch.js";
import { FilterRemoveShadow } from "../fx/filters/FilterRemoveShadow.js";
import { FilterRays } from "../fx/filters/FilterRays.js";
import { FilterFog } from "../fx/filters/FilterFog.js";
+import { FilterXFog } from "../fx/filters/FilterXFog.js";
import { FilterElectric } from "../fx/filters/FilterElectric.js";
import { FilterWaves } from "../fx/filters/FilterWaves.js";
import { FilterFire } from "../fx/filters/FilterFire.js";
@@ -26,10 +27,19 @@ import { FilterXRays } from "../fx/filters/FilterXRays.js";
import { FilterLiquid } from "../fx/filters/FilterLiquid.js";
import { FilterGleamingGlow } from "../fx/filters/FilterGleamingGlow.js";
import { FilterPixelate } from "../fx/filters/FilterPixelate.js";
+import { FilterSpiderWeb } from "../fx/filters/FilterSpiderWeb.js";
import { Anime } from "../fx/Anime.js";
-import { presets as defaultPresets } from "../fx/presets/defaultpresets.js";
+import { presets as defaultPresets, allPresets, PresetsLibrary } from "../fx/presets/defaultpresets.js";
+import { tmfxDataMigration, DataVersion } from "../migration/migration.js";
import "./proto/PlaceableObjectProto.js";
+/*
+
+It's getting messy here !
+I will fix it in a future version (+ duplicated code to factorize)
+
+*/
+
const moduleTM = "module.tokenmagic";
// Filters Class Keys
@@ -49,6 +59,7 @@ export const FilterType = {
zapshadow: FilterRemoveShadow,
ray: FilterRays,
fog: FilterFog,
+ xfog: FilterXFog,
electric: FilterElectric,
wave: FilterWaves,
shockwave: FilterShockwave,
@@ -61,38 +72,10 @@ export const FilterType = {
xray: FilterXRays,
liquid: FilterLiquid,
xglow: FilterGleamingGlow,
- pixel: FilterPixelate
+ pixel: FilterPixelate,
+ web: FilterSpiderWeb,
};
-var cachedFilters = {};
-
-async function cacheFilters() {
- // Only caching filters with heavy shaders that takes time to compile
- // https://www.html5gamedevs.com/topic/43652-shader-compile-performance/
- let params =
- {
- filterType: "field",
- enabled: true,
- dummy: true
- };
- cachedFilters.filterForceField = new FilterForceField(params);
-
- params.filterType = "electric";
- cachedFilters.filterElectric = new FilterElectric(params);
-
- params.filterType = "xglow";
- cachedFilters.filterGleamingGlow = new FilterGleamingGlow(params);
-
- params.filterType = "fire";
- cachedFilters.filterFire = new FilterFire(params);
-
- params.filterType = "smoke";
- cachedFilters.filterSmoke = new FilterSmoke(params);
-
- params.filterType = "images";
- cachedFilters.filterImages = new FilterMirrorImages(params);
-}
-
export const PlaceableType = {
TOKEN: Token.embeddedName,
TILE: Tile.embeddedName,
@@ -163,6 +146,15 @@ function registerSettings() {
default: defaultPresets,
type: Object
});
+
+ game.settings.register("tokenmagic", "migration", {
+ name: "TMFX Data Version",
+ hint: "TMFX Data Version",
+ scope: "world",
+ config: false,
+ default: DataVersion.ARCHAIC,
+ type: String
+ });
}
export const SocketAction = {
@@ -295,168 +287,186 @@ export function objectAssign(target, ...sources) {
export function TokenMagic() {
- async function addFilterOnSelected(params) {
- if (params == null) return;
+ var _cachedFilters = {};
+
+ async function addFiltersOnSelected(paramsArray, replace = false) {
+
+ if (typeof paramsArray === "string") {
+ paramsArray = getPreset(paramsArray);
+ }
var controlled = getControlledPlaceables();
if (!(controlled == null) && controlled.length > 0) {
for (const placeable of controlled) {
- await addFilter(placeable, params);
+ await addFilters(placeable, paramsArray, replace);
}
}
};
- async function addUpdateFilterOnSelected(params) {
- if (params == null) return;
+ async function addUpdateFiltersOnSelected(paramsArray) {
+
+ if (typeof paramsArray === "string") {
+ paramsArray = getPreset(paramsArray);
+ }
var controlled = getControlledPlaceables();
if (!(controlled == null) && controlled.length > 0) {
for (const placeable of controlled) {
- await addUpdateFilter(placeable, params);
+ await addUpdateFilters(placeable, paramsArray);
}
}
};
- async function addFiltersOnSelected(paramsArray) {
+ async function addUpdateFiltersOnTargeted(paramsArray) {
if (typeof paramsArray === "string") {
paramsArray = getPreset(paramsArray);
}
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await addFilterOnSelected(params);
+ var targeted = getTargetedTokens();
+
+ if (!(targeted == null) && targeted.length > 0) {
+ for (const token of targeted) {
+ await addUpdateFilters(token, paramsArray);
}
}
};
- async function addUpdateFiltersOnSelected(paramsArray) {
+ async function addFiltersOnTargeted(paramsArray, replace = false) {
if (typeof paramsArray === "string") {
paramsArray = getPreset(paramsArray);
}
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await addUpdateFilterOnSelected(params);
- }
- }
- };
-
- async function addFilterOnTargeted(params) {
- if (params == null) return;
-
var targeted = getTargetedTokens();
if (!(targeted == null) && targeted.length > 0) {
for (const token of targeted) {
- await addFilter(token, params);
+ await addFilters(token, paramsArray, replace);
}
}
}
- async function addFiltersOnTargeted(paramsArray) {
+ async function addFilters(placeable, paramsArray, replace = false) {
if (typeof paramsArray === "string") {
paramsArray = getPreset(paramsArray);
}
+ if (!(paramsArray instanceof Array && paramsArray.length > 0)
+ || placeable == null) return;
+
+ var actualFlags = (replace ? null : placeable.getFlag("tokenmagic", "filters"));
+ var newFlags = [];
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await addFilterOnTargeted(params);
+ for (const params of paramsArray) {
+ if (!params.hasOwnProperty("filterType")
+ || !FilterType.hasOwnProperty(params.filterType)) {
+ // one invalid ? all rejected.
+ return;
}
- }
- }
- async function addFilter(placeable, params) {
- if (placeable == null
- || params == null
- || !params.hasOwnProperty("filterType")
- || !FilterType.hasOwnProperty(params.filterType)) {
- return;
- }
+ if (!params.hasOwnProperty("filterId") || params.filterId == null) {
+ params.filterId = randomID();
+ }
+
+ if (!params.hasOwnProperty("enabled") || !(typeof params.enabled === "boolean")) {
+ params.enabled = true;
+ }
- if (!params.hasOwnProperty("filterId") || params.filterId == null) {
- params.filterId = randomID();
+ params.placeableId = placeable.id;
+ params.filterInternalId = randomID();
+ params.filterOwner = game.data.userId;
+ params.placeableType = placeable._TMFXgetPlaceableType();
+
+ newFlags.push({
+ tmFilters: {
+ tmFilterId: params.filterId,
+ tmFilterInternalId: params.filterInternalId,
+ tmFilterType: params.filterType,
+ tmFilterOwner: params.filterOwner,
+ tmParams: params
+ }
+ });
}
- if (!params.hasOwnProperty("enabled") || !typeof params.enabled === "boolean") {
- params.enabled = true;
+ if (!(actualFlags == null)) {
+ newFlags = actualFlags.concat(newFlags);
}
- params.placeableId = placeable.id;
- params.filterInternalId = randomID();
- params.filterOwner = game.data.userId;
- params.placeableType = placeable._TMFXgetPlaceableType();
+ await placeable._TMFXsetFlag(newFlags);
+ }
- var placeableNewFlag = [{
- tmFilters: {
- tmFilterId: params.filterId,
- tmFilterInternalId: params.filterInternalId,
- tmFilterType: params.filterType,
- tmFilterOwner: params.filterOwner,
- tmParams: params
- }
- }];
+ async function addUpdateFilters(placeable, paramsArray) {
- var placeableFlag = null;
- var placeableActualFlag = placeable.getFlag("tokenmagic", "filters");
+ if (!paramsArray instanceof Array || paramsArray.length < 1) { return; }
- if (placeableActualFlag == null) {
- placeableFlag = placeableNewFlag;
- } else {
- placeableFlag = placeableActualFlag.concat(placeableNewFlag);
+ var flags = placeable.getFlag("tokenmagic", "filters");
+ var workingFlags = [];
+ if (flags) {
+ flags.forEach(flag => {
+ workingFlags.push(duplicate(flag));
+ });
}
- await placeable._TMFXsetFlag(placeableFlag);
- };
+ var newFlags = [];
+ var updateParams;
- async function addUpdateFilters(placeable, paramsArray) {
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await addUpdateFilter(placeable, params);
- }
- }
- };
+ for (const params of paramsArray) {
- async function addUpdateFilter(placeable, params) {
- if (placeable == null
- || params == null
- || !params.hasOwnProperty("filterType")
- || !FilterType.hasOwnProperty(params.filterType)) {
- return;
- }
+ updateParams = false;
- if (params.hasOwnProperty("filterId") && placeable.TMFXhasFilterId(params.filterId)
- && placeable.TMFXhasFilterType(params.filterType)) {
- await updateFilterByPlaceable(params, placeable);
- } else {
- await addFilter(placeable, params);
- }
- };
+ workingFlags.forEach(flag => {
+ if (flag.tmFilters.tmFilterId === params.filterId
+ && flag.tmFilters.tmFilterType === params.filterType) {
+ if (flag.tmFilters.hasOwnProperty("tmParams")) {
+ objectAssign(flag.tmFilters.tmParams, params);
+ updateParams = true;
+ }
+ }
+ });
- async function addFilters(placeable, paramsArray) {
- if (typeof paramsArray === "string") {
- paramsArray = getPreset(paramsArray);
- }
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await addFilter(placeable, params);
+ if (!updateParams) {
+ if (!params.hasOwnProperty("filterType")
+ || !FilterType.hasOwnProperty(params.filterType)) {
+ // one invalid ? all rejected (even the update)
+ return;
+ }
+
+ if (!params.hasOwnProperty("filterId") || params.filterId == null) {
+ params.filterId = randomID();
+ }
+
+ if (!params.hasOwnProperty("enabled") || !(typeof params.enabled === "boolean")) {
+ params.enabled = true;
+ }
+
+ params.placeableId = placeable.id;
+ params.filterInternalId = randomID();
+ params.filterOwner = game.data.userId;
+ params.placeableType = placeable._TMFXgetPlaceableType();
+
+ newFlags.push({
+ tmFilters: {
+ tmFilterId: params.filterId,
+ tmFilterInternalId: params.filterInternalId,
+ tmFilterType: params.filterType,
+ tmFilterOwner: params.filterOwner,
+ tmParams: params
+ }
+ });
}
}
- };
- async function updateFilters(paramsArray) {
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await updateFilter(params);
- }
+ if (newFlags.length > 0) {
+ workingFlags = newFlags.concat(workingFlags);
}
- }
- async function updateFilter(params) {
+ await placeable._TMFXsetFlag(workingFlags);
+ };
+
+ async function updateFilters(paramsArray) {
if (params == null
|| !params.hasOwnProperty("filterId")) {
return;
@@ -466,7 +476,8 @@ export function TokenMagic() {
if (animations.size <= 0) { return; }
animations.forEach((anime, id) => {
- if (anime.puppet.filterId === params.filterId) {
+ var filterIdMatch = (params) => params.filterId === anime.puppet.filterId;
+ if (paramsArray.some(filterIdMatch)) {
placeableIdSet.add(anime.puppet.placeableId);
}
});
@@ -477,14 +488,17 @@ export function TokenMagic() {
// we must browse the collection of placeables whatever their types
// we have just a filterId.
var placeable = getPlaceableById(placeableId, PlaceableType.TOKEN);
+ if (placeable == null) {
+ placeable = getPlaceableById(placeableId, PlaceableType.TEMPLATE);
+ }
if (placeable == null) {
placeable = getPlaceableById(placeableId, PlaceableType.TILE);
}
if (placeable == null) {
- placeable = getPlaceableById(placeableId, PlaceableType.TEMPLATE);
+ placeable = getPlaceableById(placeableId, PlaceableType.DRAWING);
}
if (!(placeable == null) && placeable instanceof PlaceableObject) {
- await updateFilterByPlaceable(params, placeable);
+ await updateFiltersByPlaceable(placeable, paramsArray);
}
}
};
@@ -499,41 +513,30 @@ export function TokenMagic() {
if (!paramsArray instanceof Array || paramsArray.length < 1) { return; }
for (const placeable of placeables) {
- for (const params of paramsArray) {
- await updateFilterByPlaceable(params, placeable);
- }
+ await updateFiltersByPlaceable(placeable, paramsArray);
}
}
async function updateFiltersOnTargeted(paramsArray) {
- var placeables = getTargetedTokens();
+ var targeted = getTargetedTokens();
+
+ if (targeted == null || targeted.length < 1) { return; }
- if (placeables == null || placeables.length < 1) { return; }
if (typeof paramsArray === "string") {
paramsArray = getPreset(paramsArray);
}
+
if (!paramsArray instanceof Array || paramsArray.length < 1) { return; }
- for (const placeable of placeables) {
- for (const params of paramsArray) {
- await updateFilterByPlaceable(params, placeable);
- }
+ for (const token of targeted) {
+ await updateFiltersByPlaceable(token, paramsArray);
}
}
async function updateFiltersByPlaceable(placeable, paramsArray) {
- if (typeof paramsArray === "string") {
- paramsArray = getPreset(paramsArray);
- }
- if (paramsArray instanceof Array && paramsArray.length > 0) {
- for (const params of paramsArray) {
- await updateFilterByPlaceable(params, placeable);
- }
- }
- }
+ if (!paramsArray instanceof Array || paramsArray.length < 1) { return; }
- async function updateFilterByPlaceable(params, placeable) {
var flags = placeable.getFlag("tokenmagic", "filters");
if (flags == null || !flags instanceof Array || flags.length < 1) { return; } // nothing to update...
@@ -542,17 +545,18 @@ export function TokenMagic() {
workingFlags.push(duplicate(flag));
});
- workingFlags.forEach(flag => {
- if (flag.tmFilters.tmFilterId === params.filterId
- && flag.tmFilters.tmFilterType === params.filterType) {
- if (flag.tmFilters.hasOwnProperty("tmParams")) {
- objectAssign(flag.tmFilters.tmParams, params);
+ for (const params of paramsArray) {
+ workingFlags.forEach(flag => {
+ if (flag.tmFilters.tmFilterId === params.filterId
+ && flag.tmFilters.tmFilterType === params.filterType) {
+ if (flag.tmFilters.hasOwnProperty("tmParams")) {
+ objectAssign(flag.tmFilters.tmParams, params);
+ }
}
- }
- });
+ });
+ }
await placeable._TMFXsetFlag(workingFlags);
- };
-
+ }
// Deleting filters on targeted tokens
async function deleteFiltersOnTargeted(filterId = null) {
@@ -614,11 +618,17 @@ export function TokenMagic() {
};
function hasFilterId(placeable, filterId) {
+ if (placeable == null
+ || !(placeable instanceof PlaceableObject)) { return null; }
+ var flags = placeable.getFlag("tokenmagic", "filters");
+ return _checkFilterId(placeable, filterId, flags);
+ };
+
+ function _checkFilterId(placeable, filterId, flags) {
if (placeable == null
|| filterId == null
|| !(placeable instanceof PlaceableObject)) { return null; }
- var flags = placeable.getFlag("tokenmagic", "filters");
if (flags == null || !flags instanceof Array || flags.length < 1) { return false; }
const found = flags.find(flag => flag.tmFilters.tmFilterId === filterId);
@@ -626,7 +636,7 @@ export function TokenMagic() {
return false;
}
return true;
- };
+ }
function setFilter(placeable, filter, params = {}) {
@@ -654,19 +664,23 @@ export function TokenMagic() {
function _loadFilters(placeables) {
if (!(placeables == null)) {
placeables.forEach((placeable) => {
- var filters = placeable.getFlag("tokenmagic", "filters");
- if (!(filters == null)) {
- _assignFilters(placeable, filters);
- }
+ _singleLoadFilters(placeable);
});
}
};
function _singleLoadFilters(placeable) {
+
+ var updateData = placeable.getFlag("tokenmagic", "templateData");
+ if (!(updateData == null)) {
+ placeable._TMFXgetSprite().alpha = updateData.opacity;
+ }
+
var filters = placeable.getFlag("tokenmagic", "filters");
if (!(filters == null)) {
_assignFilters(placeable, filters);
}
+ placeable.loadingRequest = false;
};
function _fxPseudoEqual(flagObject, filterObject) {
@@ -699,13 +713,29 @@ export function TokenMagic() {
return true;
};
- function _updateFilters(data, options, placeableType) {
+ function _updateTemplateData(data, options, placeableType) {
if (!options.hasOwnProperty("flags") || !options.flags.hasOwnProperty("tokenmagic")) { return; }
if (data == null || !data.hasOwnProperty("_id")) { return; }
var placeable = getPlaceableById(data._id, placeableType);
if (placeable == null) { return; }
+ var updateData = placeable.getFlag("tokenmagic", "templateData");
+ if (!(updateData == null)) {
+ placeable._TMFXgetSprite().alpha = updateData.opacity;
+ }
+ }
+
+ function _updateFilters(data, options, placeableType) {
+ if (!(options.hasOwnProperty("flags")
+ && options.flags.hasOwnProperty("tokenmagic")
+ && (options.flags.tokenmagic.hasOwnProperty("filters")
+ || options.flags.tokenmagic.hasOwnProperty("-=filters")))) { return; }
+ if (data == null || !data.hasOwnProperty("_id")) { return; }
+
+ var placeable = getPlaceableById(data._id, placeableType);
+ if (placeable == null) { return; }
+
// Shortcut when all filters are deleted
if (options.flags.tokenmagic.hasOwnProperty("-=filters")) {
Anime.removeAnimation(data._id); // removing animations on this placeable
@@ -872,7 +902,7 @@ export function TokenMagic() {
if (confirm(i18n("TMFX.preset.reset.message"))) {
try {
- await game.settings.set("tokenmagic", "presets", defaultPresets);
+ await game.settings.set("tokenmagic", "presets", allPresets);
ui.notifications.info(i18n("TMFX.preset.reset.success"));
} catch (e) {
error(e.message);
@@ -921,14 +951,58 @@ export function TokenMagic() {
exportObjectAsJson(pst, exportName);
}
+ function getPresets(libraryName = PresetsLibrary.MAIN) {
+ var pst = game.settings.get("tokenmagic", "presets");
+ if (pst == null || typeof pst !== "object") return [];
+ return pst.filter(preset => preset.library === libraryName);
+ };
+
+ function _getPresetTemplateDefaultTexture(presetName, presetLibrary = PresetsLibrary.TEMPLATE) {
+ var pst = game.settings.get("tokenmagic", "presets");
+ const preset = pst.find(el => el['name'] === presetName && el['library'] === presetLibrary);
+ if (!(preset == null) && preset.hasOwnProperty("defaultTexture")) return preset.defaultTexture;
+ else return null;
+ }
+
function getPreset(presetName) {
+
+ let pName = null, pLibrary = null;
+ let argIsObj = (presetName instanceof Object);
+ const { name, library, ...adjustmentProp } = argIsObj ? presetName : {};
+ if (argIsObj) {
+ if (presetName.hasOwnProperty("name")) {
+ pName = presetName.name;
+ }
+ if (presetName.hasOwnProperty("library")) {
+ pLibrary = presetName.library;
+ }
+ } else {
+ pName = presetName;
+ }
+
+ if (pLibrary == null || typeof pLibrary !== "string") {
+ pLibrary = PresetsLibrary.MAIN;
+ }
+
+ if (typeof pName !== "string") return undefined;
+
var pst = game.settings.get("tokenmagic", "presets");
if (pst == null || typeof pst !== "object") return undefined;
- const preset = pst.find(el => el['name'] === presetName);
+ const preset = pst.find(el => el['name'] === pName && el['library'] === pLibrary);
if (!(preset == null)
&& preset.hasOwnProperty("params")
- && preset.params instanceof Array) return preset.params;
+ && preset.params instanceof Array) {
+ for (const [filterProp, filterPropVal] of Object.entries(adjustmentProp)) {
+ //log(`getPreset ${filterProp}: ${filterPropVal}`);
+ for (const param of preset.params) {
+ if (param.hasOwnProperty(filterProp)) {
+ param[filterProp] = filterPropVal;
+ }
+ }
+ }
+ return preset.params;
+ }
return undefined;
};
@@ -938,7 +1012,24 @@ export function TokenMagic() {
return false;
}
- if (typeof presetName !== "string") {
+ let pName = null, pLibrary = null;
+
+ if (presetName instanceof Object) {
+ if (presetName.hasOwnProperty("name")) {
+ pName = presetName.name;
+ }
+ if (presetName.hasOwnProperty("library")) {
+ pLibrary = presetName.library;
+ }
+ } else {
+ pName = presetName;
+ }
+
+ if (pLibrary == null || typeof pLibrary !== "string") {
+ pLibrary = PresetsLibrary.MAIN;
+ }
+
+ if (typeof pName !== "string") {
if (!silent) ui.notifications.error(i18n("TMFX.preset.delete.params.failure"));
return false;
}
@@ -950,7 +1041,7 @@ export function TokenMagic() {
}
var state = true;
- const preset = pst.find(el => el['name'] === presetName);
+ const preset = pst.find(el => el['name'] === pName && el['library'] === pLibrary);
if (preset == null) {
if (!silent) ui.notifications.warn(i18n("TMFX.preset.delete.notfound.failure"));
@@ -978,26 +1069,54 @@ export function TokenMagic() {
return false;
}
- if (typeof presetName !== "string"
+ let pName = null, pLibrary = null, pDefaultTexture = null;
+ if (presetName instanceof Object) {
+ if (presetName.hasOwnProperty("name")) {
+ pName = presetName.name;
+ }
+ if (presetName.hasOwnProperty("library")) {
+ pLibrary = presetName.library;
+ }
+ if (presetName.hasOwnProperty("defaultTexture")) {
+ pDefaultTexture = presetName.defaultTexture;
+ }
+ } else {
+ pName = presetName;
+ }
+
+ if (pLibrary == null || typeof pLibrary !== "string") {
+ pLibrary = PresetsLibrary.MAIN;
+ }
+
+ if (typeof pDefaultTexture !== "string") {
+ pDefaultTexture = null;
+ }
+
+ if (typeof pName !== "string"
&& !(params instanceof Array)) {
if (!silent) ui.notifications.error(i18n("TMFX.preset.add.params.failure"));
return false;
}
for (const param of params) {
- param.filterId = presetName;
+ param.filterId = pName;
}
var pst = game.settings.get("tokenmagic", "presets");
var presetObject = {};
- presetObject.name = presetName;
+ presetObject.name = pName;
+ presetObject.library = pLibrary;
presetObject.params = params;
+ if (pDefaultTexture != null) {
+ presetObject.defaultTexture = pDefaultTexture;
+ }
var state = true;
if (pst == null) {
pst = [presetObject];
} else {
- const preset = pst.find(el => el['name'] === presetName);
+ const preset =
+ pst.find(el => el['name'] === pName && el['library'] === pLibrary);
if (preset == null) pst.push(presetObject);
else {
if (!silent) ui.notifications.warn(i18n("TMFX.preset.add.duplicate.failure"));
@@ -1019,24 +1138,19 @@ export function TokenMagic() {
};
return {
- addFilter: addFilter,
addFilters: addFilters,
- addFilterOnSelected: addFilterOnSelected,
addFiltersOnSelected: addFiltersOnSelected,
addFiltersOnTargeted: addFiltersOnTargeted,
- addUpdateFiltersOnSelected: addUpdateFiltersOnSelected,
- addUpdateFilterOnSelected: addUpdateFilterOnSelected,
addUpdateFilters: addUpdateFilters,
- addUpdateFilter: addUpdateFilter,
+ addUpdateFiltersOnSelected: addUpdateFiltersOnSelected,
+ addUpdateFiltersOnTargeted: addUpdateFiltersOnTargeted,
deleteFilters: deleteFilters,
deleteFiltersOnSelected: deleteFiltersOnSelected,
deleteFiltersOnTargeted: deleteFiltersOnTargeted,
- updateFilter: updateFilter,
updateFilters: updateFilters,
updateFiltersOnSelected: updateFiltersOnSelected,
updateFiltersOnTargeted: updateFiltersOnTargeted,
updateFiltersByPlaceable: updateFiltersByPlaceable,
- updateFilterByPlaceable: updateFilterByPlaceable,
hasFilterType: hasFilterType,
hasFilterId: hasFilterId,
exportPresetLibrary: exportPresetLibrary,
@@ -1044,6 +1158,7 @@ export function TokenMagic() {
importPresetLibraryFromURL: importPresetLibraryFromURL,
importPresetLibraryFromPath: importPresetLibraryFromPath,
resetPresetLibrary: resetPresetLibrary,
+ getPresets: getPresets,
getPreset: getPreset,
addPreset: addPreset,
deletePreset: deletePreset,
@@ -1052,12 +1167,43 @@ export function TokenMagic() {
_clearImgFiltersByPlaceable: _clearImgFiltersByPlaceable,
_getAnimeMap: Anime.getAnimeMap,
_updateFilters: _updateFilters,
+ _updateTemplateData: _updateTemplateData,
_singleLoadFilters: _singleLoadFilters,
+ _cachedFilters: _cachedFilters,
+ _checkFilterId: _checkFilterId,
+ _getPresetTemplateDefaultTexture: _getPresetTemplateDefaultTexture,
};
}
export const Magic = TokenMagic();
+async function cacheFilters() {
+ // Only caching filters with heavy shaders that takes time to compile
+ // https://www.html5gamedevs.com/topic/43652-shader-compile-performance/
+ let params =
+ {
+ filterType: "field",
+ enabled: true,
+ dummy: true
+ };
+ Magic._cachedFilters.filterForceField = new FilterForceField(params);
+
+ params.filterType = "electric";
+ Magic._cachedFilters.filterElectric = new FilterElectric(params);
+
+ params.filterType = "xglow";
+ Magic._cachedFilters.filterGleamingGlow = new FilterGleamingGlow(params);
+
+ params.filterType = "fire";
+ Magic._cachedFilters.filterFire = new FilterFire(params);
+
+ params.filterType = "smoke";
+ Magic._cachedFilters.filterSmoke = new FilterSmoke(params);
+
+ params.filterType = "images";
+ Magic._cachedFilters.filterImages = new FilterMirrorImages(params);
+}
+
function initSocketListener() {
// Activate the listener only for the One
@@ -1096,7 +1242,7 @@ function initFurnaceDrawingsException() {
const cachedDCR = DrawingConfig.prototype.refresh;
return async function (html) {
- // Clear animations and filters
+ // Clear animations and filters if needed
let tmfxUpdate = false;
if (this.object.data.hasOwnProperty("flags")
&& this.object.data.flags.hasOwnProperty("tokenmagic")
@@ -1121,12 +1267,16 @@ function initFurnaceDrawingsException() {
async function requestLoadFilters(placeable, startTimeout = 0) {
var reqTimer;
+ placeable.loadingRequest = true;
function launchRequest(placeable) {
reqTimer = setTimeout(() => {
if (placeable == null) return;
var check = placeable._TMFXcheckSprite();
- if (check == null) return;
+ if (check == null) {
+ placeable.loadingRequest = false;
+ return;
+ }
else if (check) Magic._singleLoadFilters(placeable);
else launchRequest(placeable);
}, 35);
@@ -1144,15 +1294,109 @@ async function requestLoadFilters(placeable, startTimeout = 0) {
}, startTimeout);
};
+function getAnchor(direction, angle, shapeType) {
+ if (shapeType === "circle" || shapeType === "rect") return { x: 0.5, y: 0.5 };
+
+ // Compute emanation anchor point from the orthonormal bounding rect containing the polygon.
+ // Not complete (to rework later), but ok with cardinal and half-cardinal directions
+ let dirRad = direction * Math.PI / 180;
+ let angleRad = angle * Math.PI / 180;
+
+ let cosRa1 = Math.cos(dirRad - (angleRad / 2));
+ let rsinRa1 = -Math.sin(dirRad - (angleRad / 2));
+ let cosRa2 = Math.cos(dirRad + (angleRad / 2));
+ let rsinRa2 = -Math.sin(dirRad + (angleRad / 2));
+
+ let x = 0, y = 1;
+
+ if (cosRa1 < 0 && cosRa2 < 0) {
+ x = 1;
+ } else if (cosRa1 < 0 || cosRa2 < 0) {
+ x = (Math.sin(-dirRad - (Math.PI / 2)) + 1) / 2;
+ }
+
+ if (rsinRa1 < 0 && rsinRa2 < 0) {
+ y = 0;
+ } else if (rsinRa1 < 0 || rsinRa2 < 0) {
+ y = (Math.cos(-dirRad - (Math.PI / 2)) + 1) / 2;
+ }
+
+ return { x: x, y: y };
+}
+
+function onMeasuredTemplateConfig(data, html) {
+
+ function compare(a, b) {
+ if (a.name < b.name) return -1;
+ if (a.name > b.name) return 1;
+ return 0;
+ }
+
+ const tmTemplate = data.object;
+ var opacity = tmTemplate.template.alpha;
+ var tint = "";
+
+ // getting custom data
+ var tmfxTemplateData = tmTemplate.getFlag("tokenmagic", "templateData");
+ if (!(tmfxTemplateData == null) && tmfxTemplateData instanceof Object) {
+ opacity = tmTemplate.data.tmfxTextureAlpha = tmfxTemplateData.opacity;
+ tint = tmTemplate.data.tmfxTint = (tmfxTemplateData.tint ? PIXI.utils.hex2string(tmfxTemplateData.tint) : "");
+ }
+ var flag = tmTemplate.getFlag("tokenmagic", "filters");
+ var presets = Magic.getPresets(PresetsLibrary.TEMPLATE);
+
+ // forming our injected html
+ var tmfxValues;
+ var selected = '';
+ tmfxValues += '';
+ presets.sort(compare).forEach(preset => {
+ if (flag) (Magic._checkFilterId(tmTemplate, preset.name, flag) ? selected = ' selected' : selected = '');
+ tmfxValues += ``;
+ });
+
+ var divPreset = `
+
+
+
+
+
+
+
+
+ `;
+
+ // injecting
+ const htmlForm = html.find('.form-group');
+ htmlForm.last().after(divPreset);
+
+ $(html).css({ 'min-height': '490px' });
+}
+
Hooks.once("init", () => {
registerSettings();
});
Hooks.on("ready", () => {
log("Hook -> ready");
+ tmfxDataMigration();
initSocketListener();
initFurnaceDrawingsException();
window.TokenMagic = Magic;
+ Hooks.on("renderMeasuredTemplateConfig", onMeasuredTemplateConfig);
});
Hooks.on("canvasInit", (canvas) => {
@@ -1163,7 +1407,7 @@ Hooks.on("canvasInit", (canvas) => {
});
Hooks.once("canvasReady", (canvas) => {
- log("Init -> canvasReady -> caching shaders");
+ //log("Init -> canvasReady -> caching shaders");
cacheFilters();
});
@@ -1181,12 +1425,14 @@ Hooks.on("canvasReady", (canvas) => {
Magic._loadFilters(tiles);
var drawings = canvas.drawings.placeables;
Magic._loadFilters(drawings);
+ var templates = canvas.templates.placeables;
+ Magic._loadFilters(templates);
Anime.activateAnimation();
});
Hooks.on("deleteScene", (scene, data, options) => {
- log("Hook -> deleteScene");
+ //log("Hook -> deleteScene");
if (!(scene == null) && scene.id === game.user.viewedScene) {
Anime.desactivateAnimation();
@@ -1195,14 +1441,14 @@ Hooks.on("deleteScene", (scene, data, options) => {
});
Hooks.on("deleteToken", (parent, doc, options, userId) => {
- log("Hook -> deleteToken");
+ //log("Hook -> deleteToken");
if (!(doc == null || !doc.hasOwnProperty("_id"))) {
Anime.removeAnimation(doc._id);
}
});
Hooks.on("createToken", (scene, data, options) => {
- log("Hook -> createToken");
+ //log("Hook -> createToken");
if (!(scene == null)
&& scene.id === game.user.viewedScene
@@ -1217,8 +1463,40 @@ Hooks.on("createToken", (scene, data, options) => {
}
});
+Hooks.on("createTile", (scene, data, options) => {
+ //log("Hook -> createTile");
+
+ if (!(scene == null)
+ && scene.id === game.user.viewedScene
+ && data.hasOwnProperty("flags")
+ && data.flags.hasOwnProperty("tokenmagic")
+ && data.flags.tokenmagic.hasOwnProperty("filters")) {
+
+ var placeable = getPlaceableById(data._id, PlaceableType.TILE);
+
+ // request to load filters (when pixi containers are ready)
+ requestLoadFilters(placeable, 250);
+ }
+});
+
+Hooks.on("createDrawing", (scene, data, options) => {
+ //log("Hook -> createDrawing");
+
+ if (!(scene == null)
+ && scene.id === game.user.viewedScene
+ && data.hasOwnProperty("flags")
+ && data.flags.hasOwnProperty("tokenmagic")
+ && data.flags.tokenmagic.hasOwnProperty("filters")) {
+
+ var placeable = getPlaceableById(data._id, PlaceableType.DRAWING);
+
+ // request to load filters (when pixi containers are ready)
+ requestLoadFilters(placeable, 250);
+ }
+});
+
Hooks.on("updateToken", (scene, data, options) => {
- log("Hook -> updateToken");
+ //log("Hook -> updateToken");
if (scene.id !== game.user.viewedScene) return;
@@ -1243,14 +1521,14 @@ Hooks.on("updateToken", (scene, data, options) => {
});
Hooks.on("deleteTile", (parent, doc, options, userId) => {
- log("Hook -> deleteTile");
+ //log("Hook -> deleteTile");
if (!(doc == null || !doc.hasOwnProperty("_id"))) {
Anime.removeAnimation(doc._id);
}
});
Hooks.on("updateTile", (scene, data, options) => {
- log("Hook -> updateTile");
+ //log("Hook -> updateTile");
if (scene.id !== game.user.viewedScene) return;
@@ -1270,14 +1548,14 @@ Hooks.on("updateTile", (scene, data, options) => {
});
Hooks.on("deleteDrawing", (parent, doc, options, userId) => {
- log("Hook -> deleteDrawing");
+ //log("Hook -> deleteDrawing");
if (!(doc == null || !doc.hasOwnProperty("_id"))) {
Anime.removeAnimation(doc._id);
}
});
Hooks.on("updateDrawing", (scene, data, options, action) => {
- log("Hook -> updateDrawing");
+ //log("Hook -> updateDrawing");
if (scene.id !== game.user.viewedScene) return;
@@ -1301,6 +1579,241 @@ Hooks.on("updateDrawing", (scene, data, options, action) => {
}
});
+Hooks.on("preUpdateMeasuredTemplate", async (scene, measuredTemplate, updateData, options) => {
+ //log("Hook -> preUpdateMeasuredTemplate");
+
+ function getTint() {
+ if (updateData.hasOwnProperty("tmfxTint")) {
+ return updateData.tmfxTint;
+ } else if (measuredTemplate.hasOwnProperty("tmfxTint")) {
+ return measuredTemplate.tmfxTint;
+ } else return "";
+ }
+
+ function getFX() {
+ if (updateData.hasOwnProperty("tmfxPreset")) {
+ return updateData.tmfxPreset;
+ } else if (measuredTemplate.hasOwnProperty("tmfxPreset")) {
+ return measuredTemplate.tmfxPreset;
+ } else return "NOFX";
+ }
+
+ function getDirection() {
+ if (updateData.hasOwnProperty("direction")) {
+ return updateData.direction;
+ } else if (measuredTemplate.hasOwnProperty("direction")) {
+ return measuredTemplate.direction;
+ } else return 0;
+ }
+
+ function getAngle() {
+ if (updateData.hasOwnProperty("angle")) {
+ return updateData.angle;
+ } else if (measuredTemplate.hasOwnProperty("angle")) {
+ return measuredTemplate.angle;
+ } else return 0;
+ }
+
+ function getShapeType() {
+ if (updateData.hasOwnProperty("t")) {
+ return updateData.t;
+ } else if (measuredTemplate.hasOwnProperty("t")) {
+ return measuredTemplate.t;
+ } else return "ITSBAD";
+ }
+
+ let measuredTemplateInstance = canvas.templates.get(measuredTemplate._id);
+ let templateTint = getTint();
+ let updateTmfxData = {};
+ let presetUpdate = updateData.hasOwnProperty("tmfxPreset");
+ let tintUpdate = updateData.hasOwnProperty("tmfxTint");
+ let textureUpdate = updateData.hasOwnProperty("tmfxTextureAlpha");
+ let directionUpdate = updateData.hasOwnProperty("direction");
+ let angleUpdate = updateData.hasOwnProperty("angle");
+ let typeUpdate = updateData.hasOwnProperty("t");
+
+ if (textureUpdate)
+ updateTmfxData.opacity = updateData.tmfxTextureAlpha;
+
+ if (tintUpdate)
+ updateTmfxData.tint = (templateTint !== '' ? colorStringToHex(templateTint) : null);
+
+ if (Object.keys(updateTmfxData).length > 0)
+ await measuredTemplateInstance.setFlag("tokenmagic", "templateData", updateTmfxData);
+
+ if (presetUpdate || tintUpdate
+ || directionUpdate || typeUpdate || angleUpdate) {
+
+ let templateFX = getFX();
+ if (templateFX !== "NOFX") {
+ let anchor = getAnchor(getDirection(), getAngle(), getShapeType());
+ let presetOptions =
+ {
+ name: templateFX.slice(5),
+ library: PresetsLibrary.TEMPLATE,
+ anchorX: anchor.x,
+ anchorY: anchor.y
+ };
+ if (templateTint !== "") {
+ presetOptions.color = colorStringToHex(templateTint);
+ }
+ var preset = Magic.getPreset(presetOptions);
+ if (!(preset == null)) {
+ if (presetUpdate) setTimeout(() => { measuredTemplateInstance.TMFXaddFilters(preset, true) }, 150);
+ else setTimeout(() => { measuredTemplateInstance.TMFXaddUpdateFilters(preset) }, 150);
+ }
+ }
+ else setTimeout(() => { measuredTemplateInstance.TMFXdeleteFilters() }, 150);
+ }
+});
+
+Hooks.on("updateMeasuredTemplate", (scene, data, options) => {
+ //log("Hook -> updateMeasuredTemplate");
+
+ if (scene.id !== game.user.viewedScene) return;
+
+ var placeable = getPlaceableById(data._id, PlaceableType.TEMPLATE);
+ if (options.hasOwnProperty("texture")) {
+ //var placeable = getPlaceableById(data._id, PlaceableType.TEMPLATE);
+
+ // removing animations on this placeable
+ Anime.removeAnimation(data._id);
+
+ // clearing the filters (owned by tokenmagic)
+ Magic._clearImgFiltersByPlaceable(placeable);
+
+ // querying filters reload (when pixi containers are ready)
+ requestLoadFilters(placeable, 250);
+
+ } else {
+ if (!placeable.loadingRequest) {
+ Magic._updateFilters(data, options, PlaceableType.TEMPLATE);
+ Magic._updateTemplateData(data, options, PlaceableType.TEMPLATE);
+ }
+ }
+});
+
+Hooks.on("deleteMeasuredTemplate", (parent, doc, options, userId) => {
+ //log("Hook -> deleteMeasuredTemplate");
+ if (!(doc == null || !doc.hasOwnProperty("_id"))) {
+ Anime.removeAnimation(doc._id);
+ }
+});
+
+Hooks.on("createMeasuredTemplate", (scene, data, options) => {
+ //log("Hook -> createMeasuredTemplate");
+
+ if (!(scene == null)
+ && scene.id === game.user.viewedScene
+ && data.hasOwnProperty("flags")
+ && data.flags.hasOwnProperty("tokenmagic")
+ && data.flags.tokenmagic.hasOwnProperty("filters")) {
+
+ var placeable = getPlaceableById(data._id, PlaceableType.TEMPLATE);
+
+ // request to load filters (when pixi containers are ready)
+ requestLoadFilters(placeable, 250);
+ }
+});
+
+Hooks.on("preCreateMeasuredTemplate", (scene, data, options, user) => {
+ //log("Hook -> preCreateMeasuredTemplate");
+
+ let hasPreset = data.hasOwnProperty("tmfxPreset");
+ let hasTint = data.hasOwnProperty("tmfxTint");
+ let hasOpacity = data.hasOwnProperty("tmfxTextureAlpha");
+ let hasTexture = data.hasOwnProperty("texture") && data.texture !== '';
+ let newFlags = [];
+
+ let tmfxBaseFlags = { tokenmagic: { filters: null, templateData: null } };
+ if (data.hasOwnProperty("flags")) {
+ data.flags = mergeObject(data.flags, tmfxBaseFlags, true, true);
+ } else {
+ data.flags = {};
+ }
+
+ // FX to add ?
+ if (hasPreset) {
+
+ // Compute shader anchor point
+ let anchor = getAnchor(data.direction, data.angle, data.t);
+
+ // Constructing the preset search object
+ let pstSearch =
+ {
+ name: data.tmfxPreset,
+ library: PresetsLibrary.TEMPLATE,
+ anchorX: anchor.x,
+ anchorY: anchor.y
+ };
+
+ // Adding tint if needed
+ if (hasTint && typeof data.tmfxTint === "number")
+ pstSearch.color = data.tmfxTint;
+
+ // Retrieving the preset
+ let preset = Magic.getPreset(pstSearch);
+
+ if (!(preset == null) && preset instanceof Array) {
+
+ let defaultTex = Magic._getPresetTemplateDefaultTexture(pstSearch.name);
+ if (!(defaultTex == null) && !hasTexture) {
+ data.texture = defaultTex;
+ }
+
+ let state = true;
+
+ // Constructing the filter flag parameters
+ for (const params of preset) {
+
+ if (!params.hasOwnProperty("filterType")
+ || !FilterType.hasOwnProperty(params.filterType)) {
+ // one invalid ? all rejected.
+ state = false;
+ break;
+ }
+
+ // getPreset MUST provide a filter id
+ if (!params.hasOwnProperty("filterId") || params.filterId == null) {
+ state = false;
+ break;
+ }
+
+ if (!params.hasOwnProperty("enabled") || !(typeof params.enabled === "boolean")) {
+ params.enabled = true;
+ }
+
+ params.placeableId = null;
+ params.filterInternalId = randomID();
+ params.filterOwner = game.data.userId;
+ params.placeableType = PlaceableType.TEMPLATE;
+
+ newFlags.push({
+ tmFilters: {
+ tmFilterId: params.filterId,
+ tmFilterInternalId: params.filterInternalId,
+ tmFilterType: params.filterType,
+ tmFilterOwner: params.filterOwner,
+ tmParams: params
+ }
+ });
+ }
+
+ if (state) {
+ data.flags = mergeObject(data.flags, { tokenmagic: { filters: newFlags } }, true, true);
+ }
+ }
+ }
+
+ let tmfxTemplateData = {
+ templateData: {
+ opacity: (hasOpacity ? data.tmfxTextureAlpha : 1),
+ tint: (hasTint ? data.tmfxTint : null)
+ }
+ };
+ data.flags = mergeObject(data.flags, { tokenmagic: tmfxTemplateData }, true, true);
+});
+
Hooks.on("closeSettingsConfig", () => {
autosetPaddingMode();
});
\ No newline at end of file
diff --git a/tokenmagic/packs/token-magic-portfolio.db b/tokenmagic/packs/tokenmagic-portfolio.db
similarity index 81%
rename from tokenmagic/packs/token-magic-portfolio.db
rename to tokenmagic/packs/tokenmagic-portfolio.db
index 3f4069c..dd8db53 100644
--- a/tokenmagic/packs/token-magic-portfolio.db
+++ b/tokenmagic/packs/tokenmagic-portfolio.db
@@ -5,29 +5,34 @@
{"_id":"4Ywsytul1no7EwKb","name":"24 - T10 - Evil Aura","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myEvilField\",\r\n shieldType: 9,\r\n gridPadding: 1,\r\n color: 0xFF3010,\r\n time: 0,\r\n blend: 5,\r\n intensity: 1,\r\n lightAlpha: 4,\r\n lightSize: 0.8,\r\n scale: 0.5,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n lightSize: \r\n {\r\n val1: 0.4, val2: 1.5,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 5000\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"6Do4AOxfbtCG8R4j","name":"24 - T06 - Air Bubble","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myAirField\",\r\n shieldType: 6,\r\n gridPadding: 1.2,\r\n color: 0x7090AA,\r\n time: 0,\r\n blend: 14,\r\n intensity: 1,\r\n lightAlpha: 1,\r\n lightSize: 0.7,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"6ZIpqLC3agLw2Vgx","name":"24 - T07 - Mage Armor","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myMageField\",\r\n shieldType: 7,\r\n gridPadding: 1.05,\r\n color: 0xFFFFFF,\r\n time: 0,\r\n blend: 10,\r\n intensity: 0.8,\r\n lightAlpha: 1,\r\n lightSize: 0.45,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"8KIRbHAgs6SCs8mT","name":"28 - Glory to Pixels","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"pixel\",\r\n filterId: \"pixelate\",\r\n sizeX: 2.5,\r\n sizeY: 2.5\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"8nsxKDYhS1Wcc139","name":"26 - T02 - Mantle of Madness (liquid)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"liquid\",\r\n filterId: \"myMantle\",\r\n color: 0x0090FF,\r\n time: 0,\r\n blend: 5,\r\n intensity: 0.0001,\r\n spectral: false,\r\n scale: 7,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n },\r\n intensity : \r\n { \r\n active: true, \r\n animType: \"syncCosOscillation\",\r\n loopDuration: 30000,\r\n val1: 0.0001, \r\n val2: 4 \r\n },\r\n scale: \r\n { \r\n active: true, \r\n animType: \"syncCosOscillation\",\r\n loopDuration: 30000,\r\n val1: 7, \r\n val2: 1 \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"AHoBr50LyDjnphDw","name":"07 - Distortion","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// you can change the mask of the filter\r\n// the mask must have a power of 2 h and w (512x512, 128x128, ...) \r\n// the distortion applies on black and white and shades of grey\r\n// after testing the first version of this macro try this :\r\n// -> maskPath: \"/modules/tokenmagic/fx/assets/waves-2.png\"\r\n\r\nlet params =\r\n{\r\n filterType: \"distortion\",\r\n filterId: \"myDistortion\",\r\n maskPath: \"/modules/tokenmagic/fx/assets/distortion-1.png\",\r\n maskSpriteScaleX: 5,\r\n maskSpriteScaleY: 5,\r\n padding: 20,\r\n animated:\r\n {\r\n maskSpriteX: { active: true, speed: 0.05, animType: \"move\" },\r\n maskSpriteY: { active: true, speed: 0.07, animType: \"move\" }\r\n }\r\n};\r\n\r\nTokenMagic.addUpdateFilterOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"AHoBr50LyDjnphDw","name":"07 - Distortion","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// you can change the mask of the filter\r\n// the mask must have a power of 2 h and w (512x512, 128x128, ...) \r\n// the distortion applies on black and white and shades of grey\r\n// after testing the first version of this macro try this :\r\n// -> maskPath: \"/modules/tokenmagic/fx/assets/waves-2.png\"\r\n\r\nlet params =\r\n[{\r\n filterType: \"distortion\",\r\n filterId: \"myDistortion\",\r\n maskPath: \"/modules/tokenmagic/fx/assets/distortion-1.png\",\r\n maskSpriteScaleX: 5,\r\n maskSpriteScaleY: 5,\r\n padding: 20,\r\n animated:\r\n {\r\n maskSpriteX: { active: true, speed: 0.05, animType: \"move\" },\r\n maskSpriteY: { active: true, speed: 0.07, animType: \"move\" }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"As1JrHLEm38Nm667","name":"F - 01 - Delete filters by Placeable","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Delete all filters on the placeable in parameter (token or tile)\r\nTokenMagic.deleteFilters(_token);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"BGz9j7xPy0H2QlBf","name":"E - Click, click, click and click !","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let glowFunc = async function() {\r\n\r\n const myTokens = canvas.tokens.placeables;\r\n\r\n for (const myToken of myTokens ){\r\n if (myToken.TMFXhasFilterId(\"funnyAlternateGlow\")) {\r\n await myToken.TMFXdeleteFilters(\"funnyAlternateGlow\");\r\n } else {\r\n let params =\r\n [{\r\n filterType: \"glow\",\r\n filterId: \"funnyAlternateGlow\",\r\n color: Math.floor(Math.random() * 16777215),\r\n animated: null\r\n }];\r\n await myToken.TMFXaddUpdateFilters(params);\r\n }\r\n }\r\n};\r\n\r\nglowFunc();","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"CdFhWPKBMb5wj7cM","name":"11 - Blur","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"blur\",\r\n filterId: \"myBlur\",\r\n padding: 10,\r\n quality: 4.0,\r\n blur: 0,\r\n blurX: 0,\r\n blurY: 0,\r\n animated:\r\n {\r\n blurX: \r\n { \r\n active: true, \r\n animType: \"syncCosOscillation\", \r\n loopDuration: 500, \r\n val1: 0, \r\n val2: 6\r\n },\r\n blurY: \r\n { \r\n active: true, \r\n animType: \"syncCosOscillation\", \r\n loopDuration: 750, \r\n val1: 0, \r\n val2: 6}\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"DCRnfJDBd25fOQxc","name":"F - 02 - Delete filters on Selected","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Delete all filters on the selected tokens/tiles\r\nTokenMagic.deleteFiltersOnSelected();","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"DM2OJyAsuxq6ytFf","name":"30 - T02 - Infernal Web (field+web+blur)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"field\",\r\n filterId: \"infernalWeb\",\r\n shieldType: 9,\r\n gridPadding: 1,\r\n color: 0xFF2050,\r\n time: 0,\r\n blend: 5,\r\n intensity: 1,\r\n lightAlpha: 4,\r\n lightSize: 0.8,\r\n scale: 0.5,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n lightSize: \r\n {\r\n val1: 0.4, val2: 1.5,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 5000\r\n }\r\n }\r\n}\r\n,{\r\n filterType: \"web\",\r\n filterId: \"infernalWeb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n},\r\n{\r\n filterType: \"blur\",\r\n filterId: \"infernalWeb\",\r\n padding: 10,\r\n quality: 8.0,\r\n blur: 0.7,\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"DoXvYWKPRcTpHbPG","name":"20 - Waves","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Below, you can turn on the anchor animation.\r\nlet params =\r\n[{\r\n filterType: \"wave\",\r\n filterId: \"myWaves\",\r\n time: 0,\r\n anchorX: 0.5,\r\n anchorY: 0.5,\r\n strength: 0.015,\r\n frequency: 120,\r\n color: 0xFFFFFF,\r\n maxIntensity: 2.5,\r\n minIntensity: 0.9,\r\n padding:10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0085, \r\n animType: \"move\" \r\n },\r\n anchorX :\r\n {\r\n active: false,\r\n val1: 0.15,\r\n val2: 0.85,\r\n animType: \"syncChaoticOscillation\",\r\n loopDuration: 20000\r\n },\r\n anchorY :\r\n {\r\n active: false,\r\n val1: 0.15,\r\n val2: 0.85,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 20000\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"Edw0KaZiBtWEG86g","name":"16 - Inner Fog","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fog\",\r\n filterId: \"myFog\",\r\n color: 0x000000,\r\n density: 0.65,\r\n time: 0,\r\n dimX: 1,\r\n dimY: 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 2.2, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"F47j6ivhmXxeYVmY","name":"19 - Fire","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fire\",\r\n filterId: \"myFire\",\r\n intensity: 1,\r\n color: 0xFFFFFF,\r\n amplitude: 1,\r\n time: 0,\r\n blend: 2,\r\n fireBlend : 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: -0.0024, \r\n animType: \"move\" \r\n },\r\n intensity:\r\n {\r\n active:true,\r\n loopDuration: 15000,\r\n val1: 0.8,\r\n val2: 2,\r\n animType: \"syncCosOscillation\"\r\n },\r\n amplitude:\r\n {\r\n active:true,\r\n loopDuration: 4400,\r\n val1: 1,\r\n val2: 1.4,\r\n animType: \"syncCosOscillation\"\r\n }\r\n \r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"FBQzhLveCvFKOvJ7","name":"10 - BulgePinch","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"bulgepinch\",\r\n filterId: \"myBulge\",\r\n padding: 150,\r\n strength: 0,\r\n zIndex: 2,\r\n radiusPercent: 200,\r\n animated:\r\n {\r\n strength: \r\n { \r\n active: true, \r\n animType: \"cosOscillation\", \r\n loopDuration: 2000, \r\n val1: 0, \r\n val2: 0.45\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"G0c3lYzkFH8BQG1H","name":"29 - T01 - Foul Fog (xfog)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"xfog\",\r\n filterId: \"foulfog\",\r\n color: 0xFFFFFF,\r\n time: 0,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0005,\r\n animType: \"move\"\r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"GHbWoqQWjeUjcStr","name":"24 - T13 - Simple Color","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"mySimpleField\",\r\n shieldType: 13,\r\n gridPadding: 2,\r\n color: 0x00CC00,\r\n time: 0,\r\n blend: 14,\r\n intensity: 1,\r\n lightAlpha: 0,\r\n lightSize: 0,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0009, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"GvYp56Thtf3n9RYy","name":"01 - Bevel","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"bevel\",\r\n filterId: \"myBevel\",\r\n rotation: 0,\r\n thickness: 5,\r\n lightColor: 0xFF0000,\r\n lightAlpha: 0.8,\r\n shadowColor: 0x00FF00,\r\n shadowAlpha: 0.5,\r\n animated :\r\n {\r\n rotation: \r\n { \r\n active: true,\r\n clockWise: true, \r\n loopDuration: 1600, \r\n animType: \"syncRotation\"\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);\r\n","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"Gzt5MfynWLcXDTZF","name":"23 - T03 - Spectral Images","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Another extreme example...\r\nlet params =\r\n[{\r\n filterType: \"images\",\r\n filterId: \"mySpectralImages\",\r\n time: 0, \r\n blend: 4,\r\n nbImage: 4, \r\n padding: 100,\r\n alphaImg: 0.5, \r\n alphaChr: 0.0,\r\n ampX: 0.10, \r\n ampY: 0.10,\r\n animated :\r\n {\r\n time: \r\n { \r\n speed: 0.0010, \r\n animType: \"move\" \r\n },\r\n ampX:\r\n {\r\n val1: 0, val2: 0.22,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500\r\n },\r\n ampY:\r\n {\r\n val1: 0, val2: 0.24,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500,\r\n pauseBetweenDuration: 2500\r\n },\r\n alphaChr: \r\n {\r\n val1: 1, val2: 0,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500\r\n },\r\n alphaImg: \r\n {\r\n val1: 0.2, val2: 0.8,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 2500\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Gzt5MfynWLcXDTZF","name":"23 - T03 - Spectral Images","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Another extreme example...\r\nlet params =\r\n[{\r\n filterType: \"images\",\r\n filterId: \"mySpectralImages\",\r\n time: 0, \r\n blend: 4,\r\n nbImage: 4, \r\n padding: 100,\r\n alphaImg: 0.5, \r\n alphaChr: 0.0,\r\n ampX: 0.10, \r\n ampY: 0.10,\r\n animated :\r\n {\r\n time: \r\n { \r\n speed: 0.0010, \r\n animType: \"move\" \r\n },\r\n ampX:\r\n {\r\n val1: 0, val2: 0.22,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500\r\n },\r\n ampY:\r\n {\r\n val1: 0, val2: 0.28,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500,\r\n },\r\n alphaChr: \r\n {\r\n val1: 1, val2: 0,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 2500\r\n },\r\n alphaImg: \r\n {\r\n val1: 0.2, val2: 0.8,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 2500\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"H3rF4XGEf76ZylwP","name":"14 - Remove Shadow","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// this simple filter remove pixels with a certain amount of alpha\r\n// it can be useful to remove shadows before using glow or outline filters.\r\n\r\nlet params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myZap\",\r\n alphaTolerance: 0.45\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"HjzhkTFUng8sxWkH","name":"D - Auto-Destroy Example","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"bevel\",\r\n autoDestroy: true,\r\n rotation: 0,\r\n thickness: 5,\r\n lightColor: 0x00FF00,\r\n lightAlpha: 0.7,\r\n shadowColor: 0xFF0000,\r\n shadowAlpha: 0.4,\r\n animated :\r\n {\r\n rotation: \r\n { \r\n active: true,\r\n clockWise: true, \r\n loopDuration: 1000,\r\n loops: 5,\r\n animType: \"rotation\"\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addFiltersOnSelected(params);\r\n","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"IA3ofbRDpi3Rjgcy","name":"24 - T02 - Fire Shield","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myFireField\",\r\n shieldType: 1,\r\n gridPadding: 2,\r\n color: 0xE58550,\r\n time: 0,\r\n blend: 2,\r\n intensity: 1.15,\r\n lightAlpha: 2,\r\n lightSize: 0.7,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"IEl6F5dtFcYBZDDZ","name":"25 - T01 - Sunburst Rays (xray)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"xray\",\r\n filterId: \"mySunburstRays\",\r\n time: 0,\r\n color: 0xFFBB00,\r\n blend: 9,\r\n dimX: 1,\r\n dimY: 1,\r\n anchorX: 0,\r\n anchorY: 0,\r\n divisor: 36,\r\n intensity: 4,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n anchorX:\r\n {\r\n animType: \"syncCosOscillation\",\r\n loopDuration : 6000,\r\n val1: 0.40,\r\n val2: 0.60\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"Ia0tPcllVQq96yXF","name":"C - Electric Multi-Filters","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// works better with tokens or tiles with no shadows\r\nlet params =\r\n[{\r\n filterType: \"shadow\",\r\n blur: 2,\r\n quality: 5,\r\n distance: 0,\r\n alpha: 1.,\r\n padding: 100,\r\n color: 0xFFFFFF,\r\n animated:\r\n {\r\n blur: \r\n { \r\n active: true, \r\n loopDuration: 500, \r\n animType: \"syncCosOscillation\", \r\n val1: 2, \r\n val2: 4\r\n },\r\n }\r\n},\r\n{\r\n filterType: \"electric\",\r\n color: 0xFFFFFF,\r\n time: 0,\r\n blend: 2,\r\n intensity: 5,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0020, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"name":"29 - T02 - Phase Spider Web (xfog+web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"phaseweb\",\r\n time: 0,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0005,\r\n animType: \"move\"\r\n }\r\n }\r\n},\r\n{\r\n filterType: \"xfog\",\r\n filterId: \"phaseweb\",\r\n color: 0x30FF30,\r\n time: 0,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0005,\r\n animType: \"move\"\r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"KfdgrXDga6Qb1sbA"}
{"_id":"Ku4jBl972O7hHczs","name":"F - 03 - Export FX Presets","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"TokenMagic.exportPresetLibrary();","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"LrfXNjrImAWK5Hb2","name":"24 - T05 - Mega Chroma Shell (on top)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myEarthFieldTop\",\r\n shieldType: 5,\r\n gridPadding: 3,\r\n color: 0xAAAAAA,\r\n time: 0,\r\n blend: 5,\r\n intensity: 1.9,\r\n lightAlpha: 1,\r\n lightSize: 0.7,\r\n scale: 1,\r\n radius: 1,\r\n zIndex: 5,\r\n chromatic: true,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"OWgJD9lvBlDzXALz","name":"09 - Twist","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"twist\",\r\n filterId: \"myTwist\",\r\n radiusPercent: 120,\r\n angle: 0,\r\n animated:\r\n {\r\n angle: \r\n { \r\n active: true, \r\n animType: \"sinOscillation\",\r\n loopDuration: 10000, \r\n val1: -0.6*Math.PI, \r\n val2: +0.6*Math.PI\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web+blur)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n},\r\n{\r\n filterType: \"blur\",\r\n filterId: \"simpleweb\",\r\n padding: 10,\r\n quality: 8.0,\r\n blur: 0.7,\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"QzFJd7hkaYesE7Ud","name":"F - 04 - Import FX Presets (local)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Open the console (F12) to check the state of the import\r\n// You can configure in the module option panel the \"overwrite mode on import\"\r\n\r\nTokenMagic.importPresetLibrary();","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"SSY0fjib0PgJaKEK","name":"24 - T03 - Poisoned Smoke","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"mySmokeField\",\r\n shieldType: 3,\r\n gridPadding: 10,\r\n color: 0x60CC70,\r\n time: 0,\r\n blend: 2,\r\n intensity: 0.9,\r\n lightAlpha: 1,\r\n lightSize: 0.7,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"SSY0fjib0PgJaKEK","name":"24 - T03 - Poisoned Smoke","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"mySmokeField\",\r\n shieldType: 3,\r\n gridPadding: 1,\r\n color: 0x60CC70,\r\n time: 0,\r\n blend: 2,\r\n intensity: 0.9,\r\n lightAlpha: 1,\r\n lightSize: 0.7,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"SpHEaIwubKpbwzvV","name":"25 - T04 - Blue Rays ! (xray)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"xray\",\r\n filterId: \"myBlueRay\",\r\n time: 0,\r\n color: 0x1030FF,\r\n blend: 9,\r\n dimX: 1,\r\n dimY: 1,\r\n anchorX: 0,\r\n anchorY: 0,\r\n divisor: 24,\r\n intensity: 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0002, \r\n animType: \"move\" \r\n },\r\n anchorX:\r\n {\r\n animType: \"syncCosOscillation\",\r\n loopDuration : 18000,\r\n val1: 0.05,\r\n val2: 0.95\r\n },\r\n anchorY:\r\n {\r\n animType: \"syncSinOscillation\",\r\n loopDuration : 18000,\r\n val1: 0.05,\r\n val2: 0.95\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"SpvVIO1eHYG96TGX","name":"26 - T01 - Spectral Body (liquid)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"liquid\",\r\n filterId: \"mySpectralBody\",\r\n color: 0x20AAEE,\r\n time: 0,\r\n blend: 8,\r\n intensity: 4,\r\n spectral: true,\r\n scale: 0.9,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0010, \r\n animType: \"move\" \r\n },\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 6000, \r\n animType: \"colorOscillation\", \r\n val1:0xFFFFFF, \r\n val2:0x00AAFF\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"T953GJB235BbrCll","name":"26 - T03 - Drift in Plans (liquid+waves)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"wave\",\r\n filterId: \"myDriftWaves\",\r\n time: 0,\r\n anchorX: 0.5,\r\n anchorY: 0.5,\r\n strength: 0.035,\r\n frequency: 20,\r\n color: 0xFFFFFF,\r\n maxIntensity: 1.5,\r\n minIntensity: 0.5,\r\n padding:10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0085, \r\n animType: \"move\" \r\n },\r\n anchorX :\r\n {\r\n active: true,\r\n val1: 0.35,\r\n val2: 0.65,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 10000\r\n },\r\n anchorY :\r\n {\r\n active: true,\r\n val1: 0.35,\r\n val2: 0.65,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 10000\r\n }\r\n }\r\n},\r\n{\r\n filterType: \"liquid\",\r\n filterId: \"myDriftLiquid\",\r\n color: 0xFF0000,\r\n time: 0,\r\n blend: 6,\r\n intensity: 5,\r\n spectral: false,\r\n scale: 2.5,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0018, \r\n animType: \"move\" \r\n },\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 9000, \r\n animType: \"colorOscillation\", \r\n val1:0xFF0000, \r\n val2:0xFFFFFF\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
@@ -40,7 +45,7 @@
{"_id":"bFFSpcJSickAe2Tr","name":"27 - T06 - Pure Ice (xglow+smoke)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n [{\r\n filterType: \"zapshadow\",\r\n filterId: \"myPureIceZapShadow\",\r\n alphaTolerance: 0.50\r\n },\r\n {\r\n filterType: \"xglow\",\r\n filterId: \"myPureIceAura\",\r\n auraType: 1,\r\n color: 0x5099DD,\r\n thickness: 4.5,\r\n scale: 10,\r\n time: 0,\r\n auraIntensity: 0.25,\r\n subAuraIntensity: 1,\r\n threshold: 0.5,\r\n discard: false,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0018,\r\n animType: \"move\"\r\n },\r\n thickness:\r\n {\r\n val1: 2, val2: 3.3,\r\n animType: \"cosOscillation\",\r\n loopDuration: 3000\r\n },\r\n subAuraIntensity:\r\n {\r\n val1: 0.45, val2: 0.65,\r\n animType: \"cosOscillation\",\r\n loopDuration: 6000\r\n },\r\n auraIntensity:\r\n {\r\n val1: 0.9, val2: 2.2,\r\n animType: \"cosOscillation\",\r\n loopDuration: 3000\r\n }\r\n }\r\n },\r\n {\r\n filterType: \"smoke\",\r\n filterId: \"myPureIceSmoke\",\r\n color: 0x80CCFF,\r\n time: 0,\r\n blend: 2,\r\n dimX: 0.3,\r\n dimY: 1,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: -0.006,\r\n animType: \"move\"\r\n },\r\n dimX:\r\n {\r\n val1: 0.4, val2: 0.2,\r\n animType: \"cosOscillation\",\r\n loopDuration: 3000\r\n }\r\n }\r\n }];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"cCEOQFsJvjhSTbbM","name":"06 - Bloom","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"xbloom\",\r\n filterId: \"letsShine\",\r\n threshold: 0.35,\r\n bloomScale: 0,\r\n brightness: 1,\r\n blur: 0.1,\r\n padding: 10,\r\n quality: 15,\r\n blendMode: 0,\r\n animated:\r\n {\r\n bloomScale: \r\n { \r\n active: true, \r\n loopDuration: 2000, \r\n animType: \"syncCosOscillation\", \r\n val1: 0, \r\n val2: 2.1\r\n },\r\n threshold: \r\n { \r\n active: false, \r\n loopDuration: 1000, \r\n animType: \"syncCosOscillation\", \r\n val1: 0.00, \r\n val2: 1.90\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);\r\n","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"cOaB7NxSQ5jNDd5g","name":"27 - T01 - Burning Aura (xglow)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myZapShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myBurningAura\",\r\n auraType: 2,\r\n color: 0x903010,\r\n thickness: 9.8,\r\n scale: 4.,\r\n time: 0,\r\n auraIntensity: 2,\r\n subAuraIntensity: 1.5,\r\n threshold: 0.40,\r\n discard: true,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0027, \r\n animType: \"move\" \r\n },\r\n thickness:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"cosOscillation\", \r\n val1:2, \r\n val2:5\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"eJQSmnIitUUQMKDS","name":"27 - T04 - Pure Fire (xglow+fire)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fire\",\r\n filterId: \"myPureFire\",\r\n intensity: 1,\r\n color: 0xFFFFFF,\r\n amplitude: 1,\r\n time: 0,\r\n blend: 2,\r\n fireBlend : 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: -0.0024, \r\n animType: \"move\" \r\n },\r\n intensity:\r\n {\r\n active:true,\r\n loopDuration: 15000,\r\n val1: 0.8,\r\n val2: 2,\r\n animType: \"syncCosOscillation\"\r\n },\r\n amplitude:\r\n {\r\n active:true,\r\n loopDuration: 4400,\r\n val1: 1,\r\n val2: 1.4,\r\n animType: \"syncCosOscillation\"\r\n }\r\n \r\n }\r\n},\r\n{\r\n filterType: \"zapshadow\",\r\n filterId: \"myPureFireShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myPureFireAura\",\r\n auraType: 2,\r\n color: 0x903010,\r\n thickness: 9.8,\r\n scale: 4.,\r\n time: 0,\r\n auraIntensity: 2,\r\n subAuraIntensity: 1.5,\r\n threshold: 0.40,\r\n discard: true,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0027, \r\n animType: \"move\" \r\n },\r\n thickness:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"cosOscillation\", \r\n val1:2, \r\n val2:5\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"eJQSmnIitUUQMKDS","name":"27 - T04 - Pure Fire (xglow+fire)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fire\",\r\n filterId: \"myPureFire\",\r\n intensity: 1,\r\n color: 0xFFFFFF,\r\n amplitude: 1,\r\n time: 0,\r\n blend: 2,\r\n fireBlend : 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: -0.0024, \r\n animType: \"move\" \r\n },\r\n intensity:\r\n {\r\n active:true,\r\n loopDuration: 15000,\r\n val1: 0.8,\r\n val2: 2,\r\n animType: \"syncCosOscillation\"\r\n },\r\n amplitude:\r\n {\r\n active:true,\r\n loopDuration: 4400,\r\n val1: 1,\r\n val2: 1.4,\r\n animType: \"syncCosOscillation\"\r\n }\r\n \r\n }\r\n},\r\n{\r\n filterType: \"zapshadow\",\r\n filterId: \"myPureFireShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myPureFireAura\",\r\n auraType: 2,\r\n color: 0x903010,\r\n thickness: 9.8,\r\n scale: 3.,\r\n time: 0,\r\n auraIntensity: 2,\r\n subAuraIntensity: 1.5,\r\n threshold: 0.50,\r\n discard: true,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0027, \r\n animType: \"move\" \r\n },\r\n thickness:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"cosOscillation\", \r\n val1:2, \r\n val2:3\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"eJnsq5g4Pldh8Z6Q","name":"B - Multi-Filters Example","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"distortion\",\r\n maskPath: \"/modules/tokenmagic/fx/assets/waves-2.png\",\r\n maskSpriteScaleX: 7,\r\n maskSpriteScaleY: 7,\r\n padding: 50,\r\n animated:\r\n {\r\n maskSpriteX: { active: true, speed: 0.05, animType: \"move\" },\r\n maskSpriteY: { active: true, speed: 0.07, animType: \"move\" }\r\n }\r\n},\r\n{\r\n filterType: \"ray\",\r\n time: 0,\r\n color: 0xEF9000,\r\n alpha: 0.25,\r\n divisor: 32,\r\n anchorY: 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n},\r\n{\r\n filterType: \"glow\",\r\n distance: 10,\r\n outerStrength: 8,\r\n innerStrength: 0,\r\n color: 0xB03000,\r\n quality: 0.5,\r\n animated:\r\n {\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 3000, \r\n animType: \"colorOscillation\", \r\n val1:0xB03000, \r\n val2:0xFFD010\r\n }\r\n }\r\n}\r\n];\r\n\r\nTokenMagic.addFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"ebWbFeiJP8UZG4Fd","name":"17 - Fumes","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fumes\",\r\n filterId: \"myFumes\",\r\n color: 0x808080,\r\n time: 0,\r\n blend: 8,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.001, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"f74nx1SMT5m8RRn8","name":"24 - T08 - Chromatic Bubble","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myChromaField\",\r\n shieldType: 8,\r\n gridPadding: 2,\r\n color: 0xAAAAAA,\r\n time: 0,\r\n blend: 0,\r\n intensity: 1,\r\n lightAlpha: 0,\r\n lightSize: 0,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: true,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0045, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
@@ -51,7 +56,7 @@
{"_id":"r3JzTibAUnlpgPsD","name":"13 - Shockwave","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"shockwave\",\r\n filterId: \"myShockwave\",\r\n time: 0,\r\n amplitude: 8,\r\n wavelength: 75,\r\n radius: 500,\r\n brightness: 1.5,\r\n speed: 25,\r\n padding: 0,\r\n animated:\r\n {\r\n time: \r\n { \r\n animType: \"cosOscillation\",\r\n active: true, \r\n loopDuration: 1800, \r\n val1: 0, val2: 10\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"s01RgeSRy4En1aKP","name":"23 - T01 - Mirror Images","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"images\",\r\n filterId: \"myMirrorImages\",\r\n time: 0,\r\n nbImage: 4,\r\n alphaImg: 1.0,\r\n alphaChr: 0.0,\r\n blend: 4,\r\n ampX: 0.10,\r\n ampY: 0.10,\r\n animated :\r\n {\r\n time: \r\n { \r\n active: true, \r\n speed: 0.0010, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"sZmVZvLEYmlEC1bK","name":"F - 05 - Import FX Presets (URL)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// Replace the dummy url with a valid url that points to a Token Magic FX presets file (json)\r\n// Open the console (F12) to check the state of the import\r\n// You can configure in the module option panel the \"overwrite mode on import\"\r\n\r\n// TokenMagic.importPresetLibraryFromURL(\"https://presets-to-import-url\");\r\n\r\nui.notifications.warn(\"Open this macro and read the instructions.\");","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"sbP8KX50YRYtxVyB","name":"24 - T01 - Hexa Force Field","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myHexaField\",\r\n shieldType: 2,\r\n gridPadding: 3,\r\n color: 0xCC00CC,\r\n time: 0,\r\n blend: 3,\r\n intensity: 1,\r\n lightAlpha: 0.5,\r\n lightSize: 0.5,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"sbP8KX50YRYtxVyB","name":"24 - T01 - Hexa Force Field","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"field\",\r\n filterId: \"myHexaField\",\r\n shieldType: 2,\r\n gridPadding: 2,\r\n color: 0xCC00CC,\r\n time: 0,\r\n blend: 3,\r\n intensity: 1,\r\n lightAlpha: 0.5,\r\n lightSize: 0.5,\r\n scale: 1,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0015, \r\n animType: \"move\" \r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"t2MjFs4cVUCYsbMr","name":"12 - Zoom Blur","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"zoomblur\",\r\n filterId: \"myZoomBlur\",\r\n strength: 0.15,\r\n innerRadiusPercent: 65,\r\n radiusPercent: 100,\r\n padding: 30,\r\n animated:\r\n {\r\n innerRadiusPercent: \r\n { \r\n active: true, \r\n animType: \"sinOscillation\", \r\n loopDuration: 500, \r\n val1: 65, \r\n val2: 75\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"tvDGSwbeQ97HNS8v","name":"A - Multi-Filters Example","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"fog\",\r\n color: 0x00FF50,\r\n density: 0.20,\r\n time: 0,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 1.2, \r\n animType: \"move\" \r\n }\r\n }\r\n},\r\n{\r\n filterType: \"ray\",\r\n time: 0,\r\n color: 0x00DE50,\r\n alpha: 0.25,\r\n divisor: 32,\r\n anchorY: 0,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n},\r\n{\r\n filterType: \"glow\",\r\n distance: 10,\r\n outerStrength: 8,\r\n innerStrength: 0,\r\n color: 0x003000,\r\n quality: 0.5,\r\n padding: 10,\r\n animated:\r\n {\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 3000, \r\n animType: \"colorOscillation\", \r\n val1:0x003000, \r\n val2:0x00EF00\r\n }\r\n }\r\n}\r\n];\r\n\r\nTokenMagic.addFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"wRWqUK0wliNZSsgl","name":"27 - T05 - Pure Fire v2 (xglow+fire)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// In this version, the glow is blending with the fire\r\n// This is to show that the order of the filters is important\r\nlet params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myPureFireShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myPureFireAura\",\r\n auraType: 2,\r\n color: 0x903010,\r\n thickness: 9.8,\r\n scale: 3.,\r\n time: 0,\r\n auraIntensity: 1,\r\n subAuraIntensity: 0.3,\r\n threshold: 0.25,\r\n discard: true,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0027, \r\n animType: \"move\" \r\n },\r\n thickness:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"cosOscillation\", \r\n val1:2, \r\n val2:3.6\r\n }\r\n }\r\n},\r\n{\r\n filterType: \"fire\",\r\n filterId: \"myPureFire\",\r\n intensity: 1,\r\n color: 0xFFFFFF,\r\n amplitude: 1,\r\n time: 0,\r\n blend: 2,\r\n fireBlend : 1,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: -0.0024, \r\n animType: \"move\" \r\n },\r\n intensity:\r\n {\r\n active:true,\r\n loopDuration: 15000,\r\n val1: 0.8,\r\n val2: 3,\r\n animType: \"syncCosOscillation\"\r\n },\r\n amplitude:\r\n {\r\n active:true,\r\n loopDuration: 4400,\r\n val1: 1,\r\n val2: 1.6,\r\n animType: \"syncCosOscillation\"\r\n }\r\n \r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
@@ -59,10 +64,13 @@
{"_id":"ydY1XOCO4yIhunkj","name":"27 - T03 - Ugly Villains Aura (xglow)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myUglyZapShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myUglyGlow\",\r\n auraType: 2,\r\n color: 0x050505,\r\n thickness: 2.7,\r\n scale: 7,\r\n time: 0,\r\n auraIntensity: 5,\r\n subAuraIntensity: 2,\r\n threshold: 0.08,\r\n discard: false,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n auraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:5, \r\n val2:0\r\n },\r\n subAuraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:2, \r\n val2:0\r\n },\r\n color:\r\n {\r\n active: true,\r\n loopDuration: 6000, \r\n animType: \"syncColorOscillation\", \r\n val1:0x050505, \r\n val2:0x200000\r\n },\r\n threshold:\r\n {\r\n active: true,\r\n loopDuration: 1500, \r\n animType: \"syncCosOscillation\", \r\n val1:0.02, \r\n val2:0.50\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"yl0TtF0CKuOkOPZv","name":"23 - T02 - Chaotic Images","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"// This is an extreme example...\r\nlet params =\r\n[{\r\n filterType: \"images\",\r\n filterId: \"myChaoticImages\",\r\n time: 0,\r\n nbImage: 4,\r\n alphaImg: 1.0,\r\n alphaChr: 0.0,\r\n blend: 4,\r\n ampX: 0.10,\r\n ampY: 0.10,\r\n padding: 80,\r\n animated :\r\n {\r\n time: \r\n { \r\n active: true, \r\n speed: 0.0010, \r\n animType: \"move\" \r\n },\r\n ampX:\r\n {\r\n active: true,\r\n val1: 0.00,\r\n val2: 0.30,\r\n chaosFactor: 0.03,\r\n animType: \"syncChaoticOscillation\",\r\n loopDuration: 2000\r\n },\r\n ampY:\r\n {\r\n active: true,\r\n val1: 0.00,\r\n val2: 0.30,\r\n chaosFactor: 0.04,\r\n animType: \"syncChaoticOscillation\",\r\n loopDuration: 1650\r\n },\r\n alphaChr: \r\n { \r\n active: true, \r\n animType: \"randomNumberPerLoop\", \r\n val1: 0.0, \r\n val2: 1,\r\n loopDuration: 250\r\n },\r\n alphaImg: \r\n { \r\n active: true, \r\n animType: \"randomNumberPerLoop\", \r\n val1: 0.8, \r\n val2: 1,\r\n loopDuration: 250\r\n },\r\n nbImage:\r\n {\r\n active: true,\r\n val1: 1,\r\n val2: 9,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 1400\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"zCCp4x0EResFji7O","name":"21 - Flood","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"flood\",\r\n filterId: \"myFlood\",\r\n time: 0,\r\n color: 0x0020BB,\r\n billowy: 0.43,\r\n tintIntensity: 0.72,\r\n glint: 0.31,\r\n scale: 70,\r\n padding: 10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0006, \r\n animType: \"move\"\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"Ku4jBl972O7hHczs","name":"F - 03 - Export FX Presets","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"TokenMagic.exportPresetLibrary();","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"T953GJB235BbrCll","name":"26 - T03 - Drift in Plans (liquid+waves)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"wave\",\r\n filterId: \"myDriftWaves\",\r\n time: 0,\r\n anchorX: 0.5,\r\n anchorY: 0.5,\r\n strength: 0.035,\r\n frequency: 20,\r\n color: 0xFFFFFF,\r\n maxIntensity: 1.5,\r\n minIntensity: 0.5,\r\n padding:10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0085, \r\n animType: \"move\" \r\n },\r\n anchorX :\r\n {\r\n active: true,\r\n val1: 0.35,\r\n val2: 0.65,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 10000\r\n },\r\n anchorY :\r\n {\r\n active: true,\r\n val1: 0.35,\r\n val2: 0.65,\r\n animType: \"syncSinOscillation\",\r\n loopDuration: 10000\r\n }\r\n }\r\n},\r\n{\r\n filterType: \"liquid\",\r\n filterId: \"myDriftLiquid\",\r\n color: 0xFF0000,\r\n time: 0,\r\n blend: 6,\r\n intensity: 5,\r\n spectral: false,\r\n scale: 2.5,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0018, \r\n animType: \"move\" \r\n },\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 9000, \r\n animType: \"colorOscillation\", \r\n val1:0xFF0000, \r\n val2:0xFFFFFF\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"ydY1XOCO4yIhunkj","name":"27 - T03 - Ugly Villains Aura (xglow)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myUglyZapShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myUglyGlow\",\r\n auraType: 2,\r\n color: 0x050505,\r\n thickness: 2.7,\r\n scale: 7,\r\n time: 0,\r\n auraIntensity: 5,\r\n subAuraIntensity: 2,\r\n threshold: 0.08,\r\n discard: false,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n auraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:5, \r\n val2:0\r\n },\r\n subAuraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:2, \r\n val2:0\r\n },\r\n color:\r\n {\r\n active: true,\r\n loopDuration: 6000, \r\n animType: \"syncColorOscillation\", \r\n val1:0x050505, \r\n val2:0x200000\r\n },\r\n threshold:\r\n {\r\n active: true,\r\n loopDuration: 1500, \r\n animType: \"syncCosOscillation\", \r\n val1:0.02, \r\n val2:0.50\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"ydY1XOCO4yIhunkj","name":"27 - T03 - Ugly Villains Aura (xglow)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"zapshadow\",\r\n filterId: \"myUglyZapShadow\",\r\n alphaTolerance: 0.50\r\n},\r\n{\r\n filterType: \"xglow\",\r\n filterId: \"myUglyGlow\",\r\n auraType: 2,\r\n color: 0x050505,\r\n thickness: 2.7,\r\n scale: 7,\r\n time: 0,\r\n auraIntensity: 5,\r\n subAuraIntensity: 2,\r\n threshold: 0.08,\r\n discard: false,\r\n animated:\r\n {\r\n time : \r\n { \r\n active: true,\r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n auraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:5, \r\n val2:0\r\n },\r\n subAuraIntensity:\r\n {\r\n active: true,\r\n loopDuration: 3000, \r\n animType: \"syncCosOscillation\", \r\n val1:2, \r\n val2:0\r\n },\r\n color:\r\n {\r\n active: true,\r\n loopDuration: 6000, \r\n animType: \"syncColorOscillation\", \r\n val1:0x050505, \r\n val2:0x200000\r\n },\r\n threshold:\r\n {\r\n active: true,\r\n loopDuration: 1500, \r\n animType: \"syncCosOscillation\", \r\n val1:0.02, \r\n val2:0.50\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"_id":"SpvVIO1eHYG96TGX","name":"26 - T01 - Spectral Body (liquid)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params =\r\n[{\r\n filterType: \"liquid\",\r\n filterId: \"mySpectralBody\",\r\n color: 0x20AAEE,\r\n time: 0,\r\n blend: 8,\r\n intensity: 4,\r\n spectral: true,\r\n scale: 0.9,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0010, \r\n animType: \"move\" \r\n },\r\n color: \r\n {\r\n active: true, \r\n loopDuration: 6000, \r\n animType: \"colorOscillation\", \r\n val1:0xFFFFFF, \r\n val2:0x00AAFF\r\n }\r\n }\r\n}];\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
-{"name":"28 - Glory to Pixels","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"pixel\",\r\n filterId: \"pixelate\",\r\n sizeX: 2.5,\r\n sizeY: 2.5\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"8KIRbHAgs6SCs8mT"}
-{"_id":"8KIRbHAgs6SCs8mT","name":"28 - Glory to Pixels","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"pixel\",\r\n filterId: \"pixelate\",\r\n sizeX: 2.5,\r\n sizeY: 2.5\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"DM2OJyAsuxq6ytFf","name":"30 - T02 - Infernal Web (field+web+blur)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"field\",\r\n filterId: \"infernalWeb\",\r\n shieldType: 9,\r\n gridPadding: 1,\r\n color: 0xFF2050,\r\n time: 0,\r\n blend: 5,\r\n intensity: 1,\r\n lightAlpha: 4,\r\n lightSize: 0.8,\r\n scale: 0.5,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n lightSize: \r\n {\r\n val1: 0.4, val2: 1.5,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 5000\r\n }\r\n }\r\n}\r\n,{\r\n filterType: \"web\",\r\n filterId: \"infernalWeb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"DM2OJyAsuxq6ytFf","name":"30 - T02 - Infernal Web (field+web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"field\",\r\n filterId: \"infernalWeb\",\r\n shieldType: 9,\r\n gridPadding: 1,\r\n color: 0xFF2050,\r\n time: 0,\r\n blend: 5,\r\n intensity: 1,\r\n lightAlpha: 4,\r\n lightSize: 0.8,\r\n scale: 0.5,\r\n radius: 1,\r\n chromatic: false,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0012, \r\n animType: \"move\" \r\n },\r\n lightSize: \r\n {\r\n val1: 0.4, val2: 1.5,\r\n animType: \"syncCosOscillation\",\r\n loopDuration: 5000\r\n }\r\n }\r\n}\r\n,{\r\n filterType: \"web\",\r\n filterId: \"infernalWeb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n div2: 20,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n div1: 20,\r\n div2: 10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n div1: 20,\r\n div2: 10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"Om9Wz7CpAV9Ia3PL","name":"30 - T01 - Simple Web (web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"simpleweb\",\r\n time: 100,\r\n div1: 20,\r\n div2: 10,\r\n animated :\r\n {\r\n time : \r\n { \r\n active: true, \r\n speed: 0.0005, \r\n animType: \"move\" \r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
+{"_id":"KfdgrXDga6Qb1sbA","name":"29 - T02 - Phase Spider Web (xfog+web)","permission":{"default":0,"Njc5YzFjZDI5NjZl":3},"type":"script","flags":{},"scope":"global","command":"let params = \r\n[{\r\n filterType: \"web\",\r\n filterId: \"phaseweb\",\r\n time: 0,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0005,\r\n animType: \"move\"\r\n }\r\n }\r\n},\r\n{\r\n filterType: \"xfog\",\r\n filterId: \"phaseweb\",\r\n color: 0x30FF30,\r\n time: 0,\r\n animated:\r\n {\r\n time:\r\n {\r\n active: true,\r\n speed: 0.0005,\r\n animType: \"move\"\r\n }\r\n }\r\n}]\r\n\r\nTokenMagic.addUpdateFiltersOnSelected(params);","author":"Njc5YzFjZDI5NjZl","img":"icons/svg/dice-target.svg","actorIds":[]}
diff --git a/tokenmagic/updates/UPDATE-0.3.0.md b/tokenmagic/updates/UPDATE-0.3.0.md
new file mode 100644
index 0000000..ef627bf
--- /dev/null
+++ b/tokenmagic/updates/UPDATE-0.3.0.md
@@ -0,0 +1,226 @@
+# Token Magic FX - Update v0.3.0-alpha
+
+*New Features :*
+- Template support with an updated user interface.
+ - Combo-box to choose the FX you want to apply.
+ - Color picker to choose tint of the FX.
+ - Slider to change opacity of the inner texture and/or FX.
+ - 23 new presets, specifically designed for templates.
+ - Possibility to add your own presets into the library of templates effects.
+ - 100% Compatible with mess' module (and video textures !)
+
+*New FX :*
+- Spider-Web filter
+ - To stick the characters of your players
+- XFog filter
+ - A thick and shifting fog.
+- Macro examples with the new FX have been added to the TMFX compendium.
+
+*Fixed issues :*
+- Some critical issues in filters Shockwave and Twist (regression of v0.2.2).
+- Adding filters triggered too many updates (one by filter).
+
+![Templates Ex](../../images/templates-ex.png)
+
+## Managing Presets
+
+The notion of preset library has been added. Token Magic FX comes with two libraries: A main library with all the presets common to drawings, tokens and tiles, and the one where the presets for the templates are stored.
+
+*Added new functions :*
+
+To retrieve the presets of a library (search by default in the main library : "tmfx-main"). Returns an array.
+```javascript
+TokenMagic.getPresets(optional )
+```
+
+```javascript
+// Example to get the main presets
+let tmfxMainPresets = TokenMagic.getPresets();
+// Equivalent to TokenMagic.getPresets("tmfx-main");
+```
+
+```javascript
+// Example to get the template presets
+let tmfxTemplatePresets = TokenMagic.getPresets("tmfx-template");
+
+```
+*updated functions :*
+
+It is now possible to pass an object as parameter. The object must contain the name and optionnaly, the library and various properties.
+If you don't specify a library, getPreset will look for the main library by default.
+
+```javascript
+TokenMagic.getPreset(|);
+```
+```javascript
+// Example 1:
+// Classic method, still OK
+// Search in the main library
+let myFx = TokenMagic.getPreset("myFX");
+```
+```javascript
+// Example 2:
+// You want to get a "Wild Magic" preset in the template library
+let pstParams =
+{
+ name: "Wild Magic",
+ library: "tmfx-template"
+};
+let tmfxWildMagicPst = TokenMagic.getPreset(pstParams);
+```
+```javascript
+// Example 3:
+// You can override properties in the presets
+// All filters of the preset containing the properties will be changed
+// Currently does not work on nested properties, will come in a later version
+let pstParams =
+{
+ name: "Wild Magic",
+ library: "tmfx-template",
+ color: 0x00FF00
+};
+let tmfxWildMagicPst = TokenMagic.getPreset(pstParams);
+// all colors properties values in the preset have been changed to 0x00FF00
+```
+To add a preset, you can now specify a library in an object (same as getPreset).
+Also, when you create a preset for a template (template library), you can add a default texture (used if no texture is setted for a given template)
+idem when deleting a preset
+
+```javascript
+TokenMagic.addPreset(|