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

Expose edit_node() for editor plugins #47709

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/classes/EditorInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
<tutorials>
</tutorials>
<methods>
<method name="edit_node">
<return type="void">
</return>
<argument index="0" name="node" type="Node">
</argument>
<description>
Edits the given [Node]. The node will be also selected if it's inside the scene tree.
</description>
</method>
<method name="edit_resource">
<return type="void">
</return>
Expand Down
1 change: 1 addition & 0 deletions doc/classes/EditorSelection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</argument>
<description>
Adds a node to the selection.
[b]Note:[/b] The newly selected node will not be automatically edited in the inspector. If you want to edit a node, use [method EditorInterface.edit_node].
</description>
</method>
<method name="clear">
Expand Down
5 changes: 5 additions & 0 deletions editor/editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ void EditorInterface::edit_resource(const Ref<Resource> &p_resource) {
EditorNode::get_singleton()->edit_resource(p_resource);
}

void EditorInterface::edit_node(Node *p_node) {
EditorNode::get_singleton()->edit_node(p_node);
}

void EditorInterface::open_scene_from_path(const String &scene_path) {
if (EditorNode::get_singleton()->is_changing_scene()) {
return;
Expand Down Expand Up @@ -312,6 +316,7 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_base_control"), &EditorInterface::get_base_control);
ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale);
ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource);
ClassDB::bind_method(D_METHOD("edit_node", "node"), &EditorInterface::edit_node);
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorInterface::open_scene_from_path);
ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorInterface::reload_scene_from_path);
ClassDB::bind_method(D_METHOD("play_main_scene"), &EditorInterface::play_main_scene);
Expand Down
1 change: 1 addition & 0 deletions editor/editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EditorInterface : public Node {

Control *get_editor_main_control();
void edit_resource(const Ref<Resource> &p_resource);
void edit_node(Node *p_node);
void open_scene_from_path(const String &scene_path);
void reload_scene_from_path(const String &scene_path);

Expand Down