Skip to content

Cannot use multi-token-edit to change token vision #76

@KolIBS

Description

@KolIBS

I'm using Foundry V13.351, dnd5e v5.3.0, mass edit v2.7.15, and Vision5e v3.0.9. I can change a token's vision type (i.e. from truesight to normal vision) when I click it individually, but when I attempt to change it via mass edit, the change doesn't take hold. Opening the console, I get the following error message:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'parts') [Detected 1 package: vision-5e(3.0.9)] at MassConfig._onRender (token-config.mjs:6:22)

and clicking token-config.mjs:6:22 takes me to the token-config.mjs subfolder in vision-5e which reads as follows:

`export default (TokenConfig) => class extends TokenConfig {
/** @OverRide */
async _onRender(context, options) {
await super._onRender(context, options);

    if (!options.parts.includes("vision")) {
        return;
    }

    // Disable input fields that are automatically managed by Vision 5e
    for (const element of this.element.querySelectorAll(`[name="sight.range"],[name="sight.brightness"],[name="sight.saturation"],[name="sight.contrast"]`)) {
        element.disabled = true;
        element.dataset.tooltip = "VISION5E.TOOLTIPS.AutomaticallyManaged";
    }

    if (!this._preview) {
        return;
    }

    // Set vision range to the prepared preview vision range
    this.element.querySelector(`[name="sight.range"]`).value = this._preview.sight.range;
    this.element.querySelector(`[name="sight.visionMode"]`).value = this._preview.sight.visionMode;
}

/** @override */
_previewChanges(changes) {
    super._previewChanges(changes);

    if (!changes || !this._preview) {
        return;
    }

    // Set vision range to the prepared preview vision range
    this.element.querySelector(`[name="sight.range"]`).value = this._preview.sight.range;
}

};
`

With an X next to line 6 (if (!options.parts.includes("vision")) {)

How can I get around this incompatibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions