diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 37f78434df..c4dbfc8018 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -174,7 +174,7 @@ #include <stdio.h> #include <stdlib.h> -EditorNode *EditorNode::singleton = NULL; +EditorNode *EditorNode::singleton = nullptr; void EditorNode::_update_scene_tabs() { @@ -387,7 +387,7 @@ void EditorNode::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { editor_data.save_editor_external_data(); - FileAccess::set_file_close_fail_notify_callback(NULL); + FileAccess::set_file_close_fail_notify_callback(nullptr); log->deinit(); // do not get messages anymore editor_data.clear_edited_scenes(); } break; @@ -864,7 +864,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String file->set_current_path(p_resource->get_path()); if (extensions.size()) { String ext = p_resource->get_path().get_extension().to_lower(); - if (extensions.find(ext) == NULL) { + if (extensions.find(ext) == nullptr) { file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); } } @@ -1121,7 +1121,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { EditorProgress save("save", TTR("Saving Scene"), 4); - if (editor_data.get_edited_scene_root() != NULL) { + if (editor_data.get_edited_scene_root() != nullptr) { save.step(TTR("Analyzing"), 0); int c2d = 0; @@ -1560,7 +1560,7 @@ void EditorNode::_dialog_action(String p_file) { save_resource_in_path(saving_resource, p_file); saving_resource = Ref<Resource>(); ObjectID current = editor_history.get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; ERR_FAIL_COND(!current_obj); current_obj->_change_notify(); } break; @@ -1706,10 +1706,10 @@ void EditorNode::edit_item(Object *p_object) { void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) { if (!p_object) { - get_inspector()->edit(NULL); - node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); - inspector_dock->update(NULL); + get_inspector()->edit(nullptr); + node_dock->set_node(nullptr); + scene_tree_dock->set_selected(nullptr); + inspector_dock->update(nullptr); return; } @@ -1770,17 +1770,17 @@ static bool overrides_external_editor(Object *p_object) { void EditorNode::_edit_current() { ObjectID current = editor_history.get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; bool inspector_only = editor_history.is_current_inspector_only(); this->current = current_obj; if (!current_obj) { - scene_tree_dock->set_selected(NULL); - get_inspector()->edit(NULL); - node_dock->set_node(NULL); - inspector_dock->update(NULL); + scene_tree_dock->set_selected(nullptr); + get_inspector()->edit(nullptr); + node_dock->set_node(nullptr); + inspector_dock->update(nullptr); _display_top_editors(false); @@ -1801,9 +1801,9 @@ void EditorNode::_edit_current() { Resource *current_res = Object::cast_to<Resource>(current_obj); ERR_FAIL_COND(!current_res); get_inspector()->edit(current_res); - scene_tree_dock->set_selected(NULL); - node_dock->set_node(NULL); - inspector_dock->update(NULL); + scene_tree_dock->set_selected(nullptr); + node_dock->set_node(nullptr); + inspector_dock->update(nullptr); EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path()); int subr_idx = current_res->get_path().find("::"); @@ -1832,9 +1832,9 @@ void EditorNode::_edit_current() { scene_tree_dock->set_selected(current_node); inspector_dock->update(current_node); } else { - node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); - inspector_dock->update(NULL); + node_dock->set_node(nullptr); + scene_tree_dock->set_selected(nullptr); + inspector_dock->update(nullptr); } if (get_edited_scene() && get_edited_scene()->get_filename() != String()) { @@ -1846,7 +1846,7 @@ void EditorNode::_edit_current() { } else { - Node *selected_node = NULL; + Node *selected_node = nullptr; if (current_obj->is_class("EditorDebuggerRemoteObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); @@ -1875,9 +1875,9 @@ void EditorNode::_edit_current() { } get_inspector()->edit(current_obj); - node_dock->set_node(NULL); + node_dock->set_node(nullptr); scene_tree_dock->set_selected(selected_node); - inspector_dock->update(NULL); + inspector_dock->update(nullptr); } if (current_obj == prev_inspected_object) { @@ -1903,7 +1903,7 @@ void EditorNode::_edit_current() { for (int i = 0; i < editor_table.size(); i++) { if (editor_table[i] == main_plugin && !main_editor_buttons[i]->is_visible()) { - main_plugin = NULL; //if button is not visible, then no plugin active + main_plugin = nullptr; //if button is not visible, then no plugin active } } @@ -2232,7 +2232,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->set_current_path(scene->get_filename()); if (extensions.size()) { String ext = scene->get_filename().get_extension().to_lower(); - if (extensions.find(ext) == NULL) { + if (extensions.find(ext) == nullptr) { file->set_current_path(scene->get_filename().replacen("." + ext, "." + extensions.front()->get())); } } @@ -2742,7 +2742,7 @@ void EditorNode::_discard_changes(const String &p_str) { case SCENE_TAB_CLOSE: { Node *scene = editor_data.get_edited_scene_root(tab_closing); - if (scene != NULL) { + if (scene != nullptr) { String scene_filename = scene->get_filename(); if (scene_filename != "") { previous_scenes.push_back(scene_filename); @@ -3122,7 +3122,7 @@ Dictionary EditorNode::_get_main_scene_state() { void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) { - if (get_edited_scene() != p_for_scene && p_for_scene != NULL) + if (get_edited_scene() != p_for_scene && p_for_scene != nullptr) return; //not for this scene changing_scene = false; @@ -3417,7 +3417,7 @@ void EditorNode::open_request(const String &p_path) { if (!opening_prev) { List<String>::Element *prev_scene = previous_scenes.find(p_path); - if (prev_scene != NULL) { + if (prev_scene != nullptr) { prev_scene->erase(); } } @@ -3639,7 +3639,7 @@ void EditorNode::stop_child_process(OS::ProcessID p_pid) { } Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) const { - ERR_FAIL_COND_V(!p_object, NULL); + ERR_FAIL_COND_V(!p_object, nullptr); Ref<Script> script = p_object->get_script(); @@ -3666,7 +3666,7 @@ Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) cons } } - return NULL; + return nullptr; } StringName EditorNode::get_object_custom_type_name(const Object *p_object) const { @@ -3712,11 +3712,11 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons return icon; } } - return NULL; + return nullptr; } Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const { - ERR_FAIL_COND_V(!p_object || !gui_base, NULL); + ERR_FAIL_COND_V(!p_object || !gui_base, nullptr); Ref<Script> script = p_object->get_script(); if (script.is_null() && p_object->is_class("Script")) { @@ -3757,11 +3757,11 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String if (p_fallback.length()) return gui_base->get_theme_icon(p_fallback, "EditorIcons"); - return NULL; + return nullptr; } Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const { - ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty."); + ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty."); if (gui_base->has_theme_icon(p_class, "EditorIcons")) { return gui_base->get_theme_icon(p_class, "EditorIcons"); @@ -3778,7 +3778,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p while (script.is_valid()) { String current_icon_path; - script->get_language()->get_global_class_name(script->get_path(), NULL, ¤t_icon_path); + script->get_language()->get_global_class_name(script->get_path(), nullptr, ¤t_icon_path); icon = _load_custom_class_icon(current_icon_path); if (icon.is_valid()) { return icon; @@ -3808,7 +3808,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) return gui_base->get_theme_icon(p_fallback, "EditorIcons"); - return NULL; + return nullptr; } void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { @@ -4394,7 +4394,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String String name = names[j]; //find it, in a horribly inefficient way int atidx = -1; - Control *node = NULL; + Control *node = nullptr; for (int k = 0; k < DOCK_SLOT_MAX; k++) { if (!dock_slot[k]->has_node(name)) continue; @@ -4960,7 +4960,7 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) { void EditorNode::remove_control_from_dock(Control *p_control) { - Control *dock = NULL; + Control *dock = nullptr; for (int i = 0; i < DOCK_SLOT_MAX; i++) { if (p_control->get_parent() == dock_slot[i]) { dock = dock_slot[i]; @@ -5083,7 +5083,7 @@ void EditorNode::add_tool_menu_item(const String &p_name, Object *p_handler, con void EditorNode::add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu) { ERR_FAIL_NULL(p_submenu); - ERR_FAIL_COND(p_submenu->get_parent() != NULL); + ERR_FAIL_COND(p_submenu->get_parent() != nullptr); tool_menu->add_child(p_submenu); tool_menu->add_submenu_item(p_name, p_submenu->get_name(), TOOLS_CUSTOM); @@ -5470,7 +5470,7 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err static void _execute_thread(void *p_ud) { EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud; - Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex); + Error err = OS::get_singleton()->execute(eta->path, eta->args, true, nullptr, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex); print_verbose("Thread exit status: " + itos(eta->exitcode)); if (err != OK) { eta->exitcode = err; @@ -6690,7 +6690,7 @@ EditorNode::EditorNode() { update_spinner_step_frame = Engine::get_singleton()->get_frames_drawn(); update_spinner_step = 0; - editor_plugin_screen = NULL; + editor_plugin_screen = nullptr; editor_plugins_over = memnew(EditorPluginList); editor_plugins_force_over = memnew(EditorPluginList); editor_plugins_force_input_forwarding = memnew(EditorPluginList); @@ -6701,7 +6701,7 @@ EditorNode::EditorNode() { EditorExport::get_singleton()->add_export_plugin(export_text_to_binary_plugin); _edit_current(); - current = NULL; + current = nullptr; saving_resource = Ref<Resource>(); reference_resource_mem = true; @@ -6718,7 +6718,7 @@ EditorNode::EditorNode() { saved_version = 1; unsaved_cache = true; - _last_instanced_scene = NULL; + _last_instanced_scene = nullptr; quick_open = memnew(EditorQuickOpen); gui_base->add_child(quick_open); |