/multi-token-edit

FoundryVTT module for editing multiple placeables at the same time.

Primary LanguageJavaScript

GitHub Latest Version GitHub Latest Release GitHub All Releases Forge Installs

Baileywiki Mass Edit

FoundryVTT module for searching and editing multiple placeables at the same time and storing them as presets to be re-used.

Mass Edit is now Baileywiki Mass Edit! See the announcement in the video below. As part of the transition to the Baileywiki family of content, Mass Edit will be converting to entirely for free. Enjoy!

Baileywiki Mass Edit

Support the continuing development of the module by subscribing to Baileywiki over at Patreon.

Note that all keybindings referenced bellow can be changed via 'Configure Controls'

Recommended modules:

Showcases by Foundry community members

  • v1.9.1 covered by BaileyWiki YouTube.
  • v1.13.0 covered in German by TomVTT YouTube
  • Configure TMFX filters with Mass Edit by BaileyWiki YouTube

Editing

Select the placeables you wish to edit and press 'Shift+E'.

You will be presented with the following modified 'Configuration' window:

image

Common data shared between all placeables will be highlighted as green, differing data as orange, and flags as purple. The newly added checkboxes to the right indicate which fields will be saved on Apply.

In addition to this key-binding Token and Tile HUDs will contain a new button if multiple tokens or tiles are selected which will also open up this modified configuration window.

simpleEdit

Search

An alternative to selecting placeables manually is to press 'Shift+F' to open a configuration window which will allow you to perform scene and world wide searches using the selected fields.

Text fields allow the use of wildcards: *

  • Goblin*
  • *Goblin
  • *Go*n*

simpleSearch

Copy/Paste

Field can be copied from opened Mass Edit forms using 'Ctrl+C'. Data copied this way can be pasted onto any selected or hovered over placeables using 'Ctrl+V'. Each placeable type has it's own "clipboard" from which data will be pasted. You can also paste this data as plaintext in and out of foundry.

copytPaste

Presets

Any configuration window opened using the module will have a 'Presets' header button. It will open up a window where you can store currently selected fields and re-use them later. Alternatively you can drag in a placeable from the canvas onto the form to create a preset from it.

image

The window can also be opened using Scene controls

image

and a keybind (Shift+X by default)

image

Short video clip: https://youtu.be/MRjHXc3MJWA

API

  • MassEdit.getPreset
  • MassEdit.getPresets
  • MassEdit.spawnPreset
  • MassEdit.createPreset
Documentation
/**
 * Retrieve preset
 * @param {object} [options={}]
 * @param {String} [options.uuid]    Preset UUID
 * @param {String} [options.name]    Preset name
 * @param {String} [options.type]    Preset type ("Token", "Tile", etc)
 * @param {String} [options.folder]  Folder name
 * @returns {Preset}
 */
static async getPreset({ uuid, name, type, folder } = {})

/**
 * Retrieve presets
 * @param {object} [options={}]
 * @param {String} [options.uuid]    Preset UUID
 * @param {String} [options.name]    Preset name
 * @param {String} [options.type]    Preset type ("Token", "Tile", etc)
 * @param {String} [options.folder]  Folder name
 * @param {String} [options.format]  The form to return placeables in ('preset', 'name', 'nameAndFolder')
 * @returns {Array[Preset]|Array[String]|Array[Object]}
 */
static async getPresets({ uuid, name, type, folder, format = 'preset' } = {})

/**
 * Spawn a preset on the scene (id, name or preset itself are required).
 * By default the current mouse position is used.
 * @param {object} [options={}]
 * @param {Preset} [options.preset]             Preset
 * @param {String} [options.uuid]               Preset UUID
 * @param {String} [options.name]               Preset name
 * @param {String} [options.type]               Preset type ("Token", "Tile", etc)
 * @param {Number} [options.x]                  Spawn canvas x coordinate (mouse position used if x or y are null)
 * @param {Number} [options.y]                  Spawn canvas y coordinate (mouse position used if x or y are null)
 * @param {Boolean} [options.snapToGrid]        If 'true' snaps spawn position to the grid.
 * @param {Boolean} [options.hidden]            If 'true' preset will be spawned hidden.
 * @param {Boolean} [options.layerSwitch]       If 'true' the layer of the spawned preset will be activated.
 * @param {Boolean} [options.coordPicker]       If 'true' a crosshair and preview will be enabled allowing spawn position to be picked
 * @param {String} [options.pickerLabel]          Label displayed above crosshair when `coordPicker` is enabled
 * @param {String} [options.taPreview]            Designates the preview placeable when spawning a `Token Attacher` prefab. e.g. "Tile", "Tile.1", "MeasuredTemplate.3"
 * @returns {Array[Document]}
 */
static async spawnPreset({ uuid, preset, name, type, folder, x, y, coordPicker = false, pickerLabel, taPreview, snapToGrid = true, hidden = false, layerSwitch = false,
} = {})

/**
 * Create Presets from passed in placeables
 * @param {PlaceableObject|Array[PlaceableObject]} placeables Placeable/s to create the presets from.
 * @param {object} [options={}]                               Optional Preset information
 * @param {String} [options.name]                             Preset name
 * @param {String} [options.img]                              Preset thumbnail image
 * @returns {Preset|Array[Preset]}
 */
static async createPreset(placeables, options = {})

Adding/Subtracting

Numerical fields can be added and subtracted instead of overriding the current value. This can be done by right-clicking the numerical controls in the Mass-Edit form. Green background indicating addition, and red subtraction.

addSubtract

Text fields will instead append or remove the entereed text from all selected placeables. By default appending will be done to the end of the string, but this can be changed by adding >> to the start of the field.

Appended to the end: image

Appended to the start: image

Brush Tool

This tool can be activated by clicking the brush icon in the header of Mass Edit forms

Once selected your cursor will be transformed into a brush allowing you click and drag over placeables on the canvas to apply fields selected in the form onto them.

brushTool.mp4

The brush can also be accessed via the Preset window

Permission Editing

Note, Token and Actor forms will contain a 'Permissions' header button allowing you to quickly change access permissions.

Permissions

Macro Generator

Using the selected fields the module will generate simple macros that will update, toggle, delete, or open Mass Edit forms.

Target

Define the target for the generated macro

  • ALL - All documents within the selected scope
  • IDs of Current Selected - IDs of documents are stored within the macro and will be looked up at run-time
  • Search - A search will be performed within the selected scope using configured fields
    • Search Fields - A sub-menu made available when Search is selected. Enter key-value pairs to be used in the search
  • Tagger - A search will be performed within the selected scope using Tagger module's 'tags'.
    • Tags - A sub-menu made available when Tagger is selected. Define a comma separated list of tags to be used in the search.
    • Must Match - A sub-menu made available when Tagger is selected. Select whether any one (Any Tag) or all (All Tags) tags must be contained within the document for a successful match.

Scope

Limit the scope of documents affected by the macro.

  • Selected - Only selected documents at macro run-time will be considered
  • Active Scene - All documents in the currently active scene
  • World - All documents throughout the game world

Action

The action you want the macro to perform on all documents that matched based on Target and Scope

  • Update - Updates the documents using the data in the text box
  • Toggle - Alternates document updates between the data in the two text boxes
    • Toggle Detection - A sub-menu made available when Toggle is selected. How should the macro determine whether a particular document has been toggle on or off.
      • Field Compare - Check if the data within the text box matches the document
      • Flag - Apply a unique flag to track whether data has been already applied to the document
  • Open Mass Edit Form - Opens the Mass Edit form (Shift+E)
  • Delete - Deletes the documents

In addition to the above, if Update or Toggle are selected you'll also get an option to select the matched documents and/or run another macro. Useful if you have macros that require placeables to be under control for them to execute. For example filters in the Token Magic FX compendium.

Randomization and Add/Subtract operators are supported but will add a dependency on Mass Edit to be active when the macro is run.

Example video:

macroGenerator.mp4

Example Video

The video bellow shows off Mass Search and Edit being used on various placeables:

multiPlaceableEdit.mp4

Randomization

Randomize any numerical, color, text, image, drop-down, or coordinate values.

meRandomizationShowcase.mp4

Select Tool

Select Tool is added for AmbientLight, AmbientSound, MeasuredTemplate, Note and Region layers.