diff --git a/ScenesPanel.js b/ScenesPanel.js index e2e77682c..115586833 100644 --- a/ScenesPanel.js +++ b/ScenesPanel.js @@ -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]); diff --git a/Token.js b/Token.js index 5981b4831..8c44b3241 100644 --- a/Token.js +++ b/Token.js @@ -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 }