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

Add ability to create a new inherited scene from code #90057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryevdokimov
Copy link
Contributor

@ryevdokimov ryevdokimov commented Mar 30, 2024

Implements: #3907

Supersedes: #64217

This is done by adding an inherit parameter to open_scene_from_path()

This will allow plugins to be able to create new inherited scenes, which can enhance user workflows.

@kitbdev
Copy link
Contributor

kitbdev commented Mar 31, 2024

To fix the compilation error, you need to add compatibility method bindings in a new editor_interface.compat.inc file.
I recommend looking at how it was done for editor_plugin in https://github.com/godotengine/godot/pull/88081/files#diff-005a1ef5a7f4fa8db6b115528dbd935d1fc2836bf579c3ceb72f77ad848a4161.
The number at the end of the compat methods should be this PR number, so it would be _open_scene_from_path_90057(const String &scene_path).
The errors should also be added to misc\extension_api_validation\4.2-stable.expected

@ryevdokimov ryevdokimov changed the title Add inherit parameter to open_scene_from_path Add ability to create a new inherited scene from code Apr 1, 2024
@ryevdokimov ryevdokimov force-pushed the fix-inherit2 branch 3 times, most recently from 472b636 to 58007d6 Compare April 4, 2024 21:16
Copy link
Contributor

@passivestar passivestar left a comment

Choose a reason for hiding this comment

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

Tested, it works. I managed to make a button that creates an inherited scene from gltf at the same path like so:

var path = EditorInterface.get_selected_paths()[0]
var new_path = path.get_basename() + ".tscn"
var main_scene_path = EditorInterface.get_edited_scene_root().scene_file_path
EditorInterface.open_scene_from_path(path, true)
EditorInterface.save_scene_as.call_deferred(new_path, false)
EditorInterface.open_scene_from_path.call_deferred(main_scene_path)

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

Successfully merging this pull request may close these issues.

4 participants