Repository navigation
Set pivot: keep the mesh in place in other scenes and prefabs - #319
Merged
Merged
Conversation
Every scene and prefab file of the project holding an object that draws the pivoted mesh is rewritten with the same compensation as the open scene (the object moves onto the new pivot, its children back by it), through a FileSwapsCommand in the same undo step, so one undo puts every file back byte for byte. Files that do not draw the mesh are not written. All files are worked out before anything is written; one that cannot be read or written stops the whole operation with an error naming it. Prefab instances in the open scene are no longer refused: an instance whose prefab's root draws the mesh moves where it is placed, and its content comes from the rewritten prefab file. In prefab mode, a scene or prefab waiting behind the open prefab that draws the mesh refuses, since it is held in memory. reimportWithSettings' sceneFirst can now return an error to stop.
testSetPivotOtherFiles: the cube drawn in the open scene, in another scene directly and through instances, at a prefab's root and deeper in another prefab; after Bottom centre every world vertex is unchanged in every file, undo restores every file byte for byte, and a scene without the mesh is never written. testSetPivotBrokenFile: an unreadable scene or prefab stops it, nothing changed. testSetPivotPrefabMode: refused when the scene behind the open prefab draws the mesh, done when it does not.
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.
Closes #316. Set pivot now also moves every object that draws the mesh in the project's other
.sceneand.prefabfiles, so nothing shifts when they are opened later. Those files change in the same undo step as the open scene, and undo restores their bytes. Files without such an object keep their bytes and timestamp. An unreadable scene or prefab stops the whole operation with nothing changed; the error message names that file. Unity YAML prefabs in the project are skipped.Set pivot now works on prefab instances: it compensates the instance's transform and rewrites the prefab file. With a prefab open for editing, it refuses if the scene behind it draws the mesh. Loading and re-saving the 15 repo and sample scenes loses nothing: 7 come back identical and 8 gain only keys at the loader's defaults. Tests: testSetPivotOtherFiles, testSetPivotBrokenFile, testSetPivotPrefabMode (editor_tests 11795).