-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: Fix persistent history. #28405
Conversation
|
||
} ); | ||
|
||
signals.scriptRemoved.add( function () { | ||
|
||
signals.objectChanged.dispatch( editor.selected ); | ||
if ( editor.selected !== null ) signals.objectChanged.dispatch( editor.selected ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumptions made in #28270 are not right. When scripts are added or removed, an object is not necessarily selected. So when undo/redo script commands, editor.selected
can be null
. In this case, a runtime error occurs in Viewport.Controls.js
.
Would you mind explain how this approach is less confusing than #28345 (comment) ? and how it is simpler than #28360 (comment) ? Thanks. |
I'm little lost, because other related PRs just all get closed in a sudden without a reason 🤔 |
They were closed because the changes should not be necessary anymore. When you look at the constructor code of the commands, it already handled undefined arguments. This PR just introduced real default values instead of checking the So I think this solution better fits to what already has been implemented. |
Even if your PRs were not merged, they were very helpful to understand the issues in the editor and developing this solution. When writing the release notes, I'll definitely add your as a contributor for this PR. |
If I understand correctly, this solution cannot reflect the fact that constructor parameters other than
By reading the constructor signature, ... and there ...
"How to explain that non optional parameters have default values?"
I appreciate that you submit a solution to show your though, but this solution is not being less confusing than the other solutions; Since this solution had been adopted and others had been rejected, so could we reach a consensus on that 'confusion' doesn't matter now? [Yes/No] The reply would help others to find a better solution in the future. Thanks :) |
Fixed #28395.
Closes #28360. Closes #28398. Closes #28362.
Description
This PR ensures commands can now properly serialized/deserialized when persistent history is enabled.
It makes sure all commands have proper default values and don't throw exceptions in their ctors when default parameters are used.
The PR also makes sure material commands use the correct material reference. This is done by not caching the material in the command but the material slot instead. With this information, the correct material can be requested with the object. Meaning this pattern: