3 Sync and Permissions
Flaig edited this page 2026-10-18 13:54:35 +02:00

Sync and Permissions

Where effects are stored

Saved effects live in the document's flags (flags.leanFX.effects), so they move with the document: copy, export or duplicate a Token, Tile, Drawing or Region and its effects come along. Foundry sends flag changes to every client, and each client builds the filters itself. Animation runs locally on each client from a shared clock; there is no network traffic per frame.

Do not edit flags.leanFX yourself; use the API.

Who can change effects

leanFX checks Foundry's normal permission: a user may change the effects of a document they can update. Players can change effects on their own tokens; GMs on everything.

Every saving call is sent through socketlib to the active GM (the one Foundry elects when several GMs are connected), also when another GM makes it. That GM's client checks the permission again and writes the change. This means:

  • A GM must be connected to save effects. Without one, the call is rejected; nothing changes silently.
  • Changes to the same document are applied one after another on the GM's client, each on the latest data, so parallel macros don't overwrite each other.
  • The promise resolves when the change is saved, so await means done.

Previews

leanFX.preview() is local: it needs no GM, saves nothing and is seen only by you. Use it to try out parameters before saving them.

Visibility

Token, Tile and Drawing effects follow their objects' visibility. Region effects are independent of editor Visibility, locking, selection and sidebar filters. Hidden Regions suppress effects for everyone, GMs included; viewed Levels still apply. Region rendering explains placement and lighting.

Scenes and levels

Effects are built when an object is drawn and removed when it is destroyed, when you switch scenes, or when an object is no longer part of the viewed level. Returning rebuilds them from the saved data.

The shared clock

Foundry's server time restarts from zero when the server restarts. leanFX stores the server's start time in a hidden world setting (written by the GM once per server start), so animation timelines continue across restarts.