Expose additional functions for the EditorPlugin class
(cherry picked from commit 104653f9eb
)
This commit is contained in:
parent
e26acc39da
commit
743c63670e
2 changed files with 26 additions and 3 deletions
|
@ -211,15 +211,22 @@ void EditorPlugin::clear() {
|
|||
|
||||
}
|
||||
|
||||
void EditorPlugin::save_external_data() {} // if editor references external resources/scenes, save them
|
||||
// if editor references external resources/scenes, save them
|
||||
void EditorPlugin::save_external_data() {
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("save_external_data")) {
|
||||
get_script_instance()->call("save_external_data");
|
||||
}
|
||||
}
|
||||
|
||||
// if changes are pending in editor, apply them
|
||||
void EditorPlugin::apply_changes() {
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("apply_changes")) {
|
||||
get_script_instance()->call("apply_changes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // if changes are pending in editor, apply them
|
||||
void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) {
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) {
|
||||
|
@ -239,10 +246,21 @@ void EditorPlugin::save_global_state() {}
|
|||
|
||||
void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) {
|
||||
get_script_instance()->call("set_window_layout", p_layout);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout){
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("get_window_layout")) {
|
||||
get_script_instance()->call("get_window_layout", p_layout);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPlugin::queue_save_layout() const {
|
||||
|
||||
EditorNode::get_singleton()->save_layout();
|
||||
}
|
||||
|
||||
EditorSelection* EditorPlugin::get_selection() {
|
||||
|
@ -302,6 +320,7 @@ void EditorPlugin::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
|
||||
ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection);
|
||||
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings);
|
||||
ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout);
|
||||
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
|
||||
|
@ -317,8 +336,11 @@ void EditorPlugin::_bind_methods() {
|
|||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::DICTIONARY,"get_state"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("set_state",PropertyInfo(Variant::DICTIONARY,"state")));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("clear"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("save_external_data"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("apply_changes"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING_ARRAY,"get_breakpoints"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("set_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile")));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("get_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile")));
|
||||
|
||||
BIND_CONSTANT( CONTAINER_TOOLBAR );
|
||||
BIND_CONSTANT( CONTAINER_SPATIAL_EDITOR_MENU );
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
virtual void get_window_layout(Ref<ConfigFile> p_layout);
|
||||
virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them
|
||||
|
||||
void queue_save_layout() const;
|
||||
|
||||
Control *get_base_control();
|
||||
|
||||
|
|
Loading…
Reference in a new issue