Skip to content

Commit

Permalink
Beta Fix - undeletable tokens after duplicating a scene.
Browse files Browse the repository at this point in the history
  • Loading branch information
Azmoria committed Oct 10, 2023
1 parent 2ea6570 commit 67ece53
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 @@ -3568,9 +3568,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 67ece53

Please sign in to comment.