Skip to content
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

Link Terrain3D object when creating UndoRedo action to mark scene as unsaved #508

Merged

Conversation

Xtarsia
Copy link
Contributor

@Xtarsia Xtarsia commented Oct 4, 2024

closes #184

This moves the undo/redo history from global to the scene containing the object linked.

@@ -508,7 +508,7 @@ void Terrain3DEditor::_store_undo() {
EditorUndoRedoManager *undo_redo = _terrain->get_plugin()->get_undo_redo();
String action_name = String("Terrain3D ") + OPNAME[_operation] + String(" ") + TOOLNAME[_tool];
LOG(DEBUG, "Creating undo action: '", action_name, "'");
undo_redo->create_action(action_name);
undo_redo->create_action(action_name, UndoRedo::MERGE_DISABLE, get_terrain());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also just provide _terrain.

But more importantly how does this tell godot to mark scenes as edited? I haven't tried it yet. The docs only say, "If custom_context object is provided, it will be used for deducing target history (instead of using the first operation).".

Is there a PR or some other documentation that shows how custom_context object connects to save status?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based off this comment on the PR mentioned before, just gave it a go and the results were desirable:

godotengine/godot-proposals#2153 (comment)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link. I filed a doc issue:
godotengine/godot-docs#10043

@TokisanGames TokisanGames changed the title link terrain object when creating undoredo action Link Terrain3D object when creating UndoRedo action to mark scene as unsaved Oct 4, 2024
@TokisanGames TokisanGames force-pushed the link-undoredo-to-terrain-object branch from aa76ecc to 2999179 Compare October 4, 2024 14:54
@TokisanGames TokisanGames merged commit a6d0366 into TokisanGames:main Oct 4, 2024
@TokisanGames
Copy link
Owner

Great, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement _get_unsaved_status()
2 participants