fix: preserve entity references during template revert all#1756
Open
willeastcott wants to merge 1 commit intomainfrom
Open
fix: preserve entity references during template revert all#1756willeastcott wants to merge 1 commit intomainfrom
willeastcott wants to merge 1 commit intomainfrom
Conversation
When Revert All is pressed on a template instance, the entity is deleted and re-created with the same resource_id values. The delete operation was nullifying all entity attribute references pointing to the deleted entities before they were re-created, causing those references to be permanently lost. Add a preserveEntityReferences option to the entity delete API that skips reference nullification. Use it in the revert all redo/undo paths where entities are immediately re-created with identical IDs. Fixed #691 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
entity) that point to entities within the template hierarchytemplates:revertAllredo and undo paths, where entities are immediately re-created with the sameresource_idvaluesRoot Cause
When Revert All deletes the template instance,
deleteEntities()finds all entity references in the scene and sets any pointing to the deleted entities tonull. The entities are then re-created with the same IDs viainstantiateTemplate(), but by that point the references have already been permanently lost.Fix
Skip reference nullification when the caller knows the entities will be immediately re-created with identical
resource_idvalues, which is always the case during template revert.Fixes #691
Test plan