Skip to content

Commit

Permalink
Merge pull request #1606 from Azmoria/Beta-Fix---undeletable-tokens-a…
Browse files Browse the repository at this point in the history
…fter-duplicating-a-scene-

Beta Fix - undeletable tokens after duplicating a scene.
  • Loading branch information
Azmoria authored Oct 10, 2023
2 parents b1dd226 + 67ece53 commit e596a97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions ScenesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,17 @@ async function duplicate_scene(sceneId) {
id: uuid()
}

for(token in aboveSceneData.tokens){
let oldId = aboveSceneData.tokens[token].id;
let newId = uuid();
for(noteID in window.JOURNAL.notes){
if(oldId == noteID){
window.JOURNAL.notes[newId] = {...window.JOURNAL.notes[noteID]};
}
}
window.JOURNAL.persist();
aboveSceneData.tokens[token].id = newId;
}

await AboveApi.migrateScenes(window.gameId, [aboveSceneData]);

Expand Down
6 changes: 3 additions & 3 deletions Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -3573,9 +3573,9 @@ function delete_selected_tokens() {
tokensToDelete.forEach(t => window.TOKEN_OBJECTS_RECENTLY_DELETED[t.options.id] = Object.assign({}, t.options));
console.log("delete_selected_tokens", window.TOKEN_OBJECTS_RECENTLY_DELETED);

for (let i = 0; i < tokensToDelete.length; i++) {
tokensToDelete[i].delete(true);
}
for (let i = 0; i < tokensToDelete.length; i++) {
tokensToDelete[i].delete(true);
}
draw_selected_token_bounding_box(); // redraw the selection box
}

Expand Down

0 comments on commit e596a97

Please sign in to comment.