diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 125d7c021721..920d94081ebd 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -77,10 +77,10 @@ void AnimationTrackKeyEdit::_fix_node_path(Variant &value) { Node *root = EditorNode::get_singleton()->get_tree()->get_root(); Node *np_node = root->get_node(np); - ERR_FAIL_COND(!np_node); + ERR_FAIL_NULL(np_node); Node *edited_node = root->get_node(base); - ERR_FAIL_COND(!edited_node); + ERR_FAIL_NULL(edited_node); value = edited_node->get_path_to(np_node); } @@ -656,10 +656,10 @@ void AnimationMultiTrackKeyEdit::_fix_node_path(Variant &value, NodePath &base) Node *root = EditorNode::get_singleton()->get_tree()->get_root(); Node *np_node = root->get_node(np); - ERR_FAIL_COND(!np_node); + ERR_FAIL_NULL(np_node); Node *edited_node = root->get_node(base); - ERR_FAIL_COND(!edited_node); + ERR_FAIL_NULL(edited_node); value = edited_node->get_path_to(np_node); } @@ -3703,7 +3703,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi } void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value) { - ERR_FAIL_COND(!root); + ERR_FAIL_NULL(root); ERR_FAIL_COND_MSG( (p_type != Animation::TYPE_POSITION_3D && p_type != Animation::TYPE_ROTATION_3D && p_type != Animation::TYPE_SCALE_3D), "Track type must be Position/Rotation/Scale 3D."); @@ -3746,7 +3746,7 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_ } bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type) { - ERR_FAIL_COND_V(!root, false); + ERR_FAIL_NULL_V(root, false); if (!keying) { return false; } @@ -3802,7 +3802,7 @@ void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant } void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists) { - ERR_FAIL_COND(!root); + ERR_FAIL_NULL(root); // Let's build a node path. Node *node = p_node; @@ -3899,7 +3899,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p void AnimationTrackEditor::insert_value_key(const String &p_property, const Variant &p_value, bool p_advance) { EditorSelectionHistory *history = EditorNode::get_singleton()->get_editor_selection_history(); - ERR_FAIL_COND(!root); + ERR_FAIL_NULL(root); ERR_FAIL_COND(history->get_path_size() == 0); Object *obj = ObjectDB::get_instance(history->get_path_object(0)); ERR_FAIL_COND(!Object::cast_to(obj)); @@ -4685,9 +4685,9 @@ void AnimationTrackEditor::_dropped_track(int p_from_track, int p_to_track) { } void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) { - ERR_FAIL_COND(!root); + ERR_FAIL_NULL(root); Node *node = get_node(p_path); - ERR_FAIL_COND(!node); + ERR_FAIL_NULL(node); NodePath path_to = root->get_path_to(node, true); if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !node->is_class("MeshInstance3D")) { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 11fc5efd623b..752585c73cf9 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -858,7 +858,7 @@ void ConnectionsDock::_filter_changed(const String &p_text) { void ConnectionsDock::_make_or_edit_connection() { NodePath dst_path = connect_dialog->get_dst_path(); Node *target = selected_node->get_node(dst_path); - ERR_FAIL_COND(!target); + ERR_FAIL_NULL(target); ConnectDialog::ConnectionData cd; cd.source = connect_dialog->get_source(); @@ -1066,7 +1066,7 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &p_item) { */ void ConnectionsDock::_open_edit_connection_dialog(TreeItem &p_item) { TreeItem *signal_item = p_item.get_parent(); - ERR_FAIL_COND(!signal_item); + ERR_FAIL_NULL(signal_item); Connection connection = p_item.get_metadata(0); ConnectDialog::ConnectionData cd = connection; diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 607f8f073ee5..a327fd778bf3 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -51,7 +51,7 @@ template void _for_all(TabContainer *p_node, const Func &p_func) { for (int i = 0; i < p_node->get_tab_count(); i++) { ScriptEditorDebugger *dbg = Object::cast_to(p_node->get_tab_control(i)); - ERR_FAIL_COND(!dbg); + ERR_FAIL_NULL(dbg); p_func(dbg); } } @@ -133,7 +133,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { void EditorDebuggerNode::_stack_frame_selected(int p_debugger) { const ScriptEditorDebugger *dbg = get_debugger(p_debugger); - ERR_FAIL_COND(!dbg); + ERR_FAIL_NULL(dbg); if (dbg != get_current_debugger()) { return; } @@ -405,7 +405,7 @@ void EditorDebuggerNode::_update_errors() { void EditorDebuggerNode::_debugger_stopped(int p_id) { ScriptEditorDebugger *dbg = get_debugger(p_id); - ERR_FAIL_COND(!dbg); + ERR_FAIL_NULL(dbg); bool found = false; _for_all(tabs, [&](ScriptEditorDebugger *p_debugger) { @@ -603,7 +603,7 @@ void EditorDebuggerNode::_remote_tree_button_pressed(Object *p_item, int p_colum } TreeItem *item = Object::cast_to(p_item); - ERR_FAIL_COND(!item); + ERR_FAIL_NULL(item); if (p_id == EditorDebuggerTree::BUTTON_SUBSCENE) { remote_scene_tree->emit_signal(SNAME("open"), item->get_meta("scene_file_path")); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 2e24a233a1a2..6305b7435aea 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -300,7 +300,7 @@ String EditorDebuggerTree::get_selected_path() { } String EditorDebuggerTree::_get_path(TreeItem *p_item) { - ERR_FAIL_COND_V(!p_item, ""); + ERR_FAIL_NULL_V(p_item, ""); if (p_item->get_parent() == nullptr) { return "/root"; diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index e6e9d4e33dec..e93369179cec 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -47,7 +47,7 @@ EditorPerformanceProfiler::Monitor::Monitor(String p_name, String p_base, int p_ } void EditorPerformanceProfiler::Monitor::update_value(float p_value) { - ERR_FAIL_COND(!item); + ERR_FAIL_NULL(item); String label = EditorPerformanceProfiler::_create_label(p_value, type); String tooltip = label; switch (type) { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 8b60ac405af3..246338609501 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -545,9 +545,9 @@ void EditorAudioBus::_effect_add(int p_which) { StringName name = effect_options->get_item_metadata(p_which); Object *fx = ClassDB::instantiate(name); - ERR_FAIL_COND(!fx); + ERR_FAIL_NULL(fx); AudioEffect *afx = Object::cast_to(fx); - ERR_FAIL_COND(!afx); + ERR_FAIL_NULL(afx); Ref afxr = Ref(afx); afxr->set_name(effect_options->get_item_text(p_which)); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 24daab3c1230..6658669d668b 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -425,14 +425,14 @@ Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { Object *obj = ClassDB::instantiate(ibt); - ERR_FAIL_COND_V_MSG(!obj, nullptr, vformat("Cannot instance script for Autoload, expected 'Node' inheritance, got: %s.", ibt)); + ERR_FAIL_NULL_V_MSG(obj, nullptr, vformat("Cannot instance script for Autoload, expected 'Node' inheritance, got: %s.", ibt)); n = Object::cast_to(obj); n->set_script(scr); } } - ERR_FAIL_COND_V_MSG(!n, nullptr, vformat("Path in Autoload not a node or script: %s.", p_path)); + ERR_FAIL_NULL_V_MSG(n, nullptr, vformat("Path in Autoload not a node or script: %s.", p_path)); return n; } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index d8749aa29026..e4f198a52905 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -106,7 +106,7 @@ void EditorSelectionHistory::cleanup_history() { void EditorSelectionHistory::add_object(ObjectID p_object, const String &p_property, bool p_inspector_only) { Object *obj = ObjectDB::get_instance(p_object); - ERR_FAIL_COND(!obj); + ERR_FAIL_NULL(obj); RefCounted *r = Object::cast_to(obj); _Object o; if (r) { @@ -700,7 +700,7 @@ bool EditorData::check_and_update_scene(int p_idx) { ERR_FAIL_COND_V(err != OK, false); ep.step(TTR("Updating scene..."), 1); Node *new_scene = pscene->instantiate(PackedScene::GEN_EDIT_STATE_MAIN); - ERR_FAIL_COND_V(!new_scene, false); + ERR_FAIL_NULL_V(new_scene, false); // Transfer selection. List new_selection; diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 199866e1f7cd..3fa3768d4b80 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3955,7 +3955,7 @@ void EditorInspector::_property_pinned(const String &p_path, bool p_pinned) { } Node *node = Object::cast_to(object); - ERR_FAIL_COND(!node); + ERR_FAIL_NULL(node); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(vformat(p_pinned ? TTR("Pinned %s") : TTR("Unpinned %s"), p_path)); diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index f8b1e1d2fbf8..cb8f91007496 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -480,7 +480,7 @@ void EditorInterface::create() { } void EditorInterface::free() { - ERR_FAIL_COND(singleton == nullptr); + ERR_FAIL_NULL(singleton); memdelete(singleton); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index df58f93bf462..5341d73fe438 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2003,7 +2003,7 @@ void EditorNode::_dialog_action(String p_file) { saving_resource = Ref(); ObjectID current_id = editor_history.get_current(); Object *current_obj = current_id.is_valid() ? ObjectDB::get_instance(current_id) : nullptr; - ERR_FAIL_COND(!current_obj); + ERR_FAIL_NULL(current_obj); current_obj->notify_property_list_changed(); } break; case SETTINGS_LAYOUT_SAVE: { @@ -2281,7 +2281,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { if (is_resource) { Resource *current_res = Object::cast_to(current_obj); - ERR_FAIL_COND(!current_res); + ERR_FAIL_NULL(current_res); InspectorDock::get_inspector_singleton()->edit(current_res); SceneTreeDock::get_singleton()->set_selected(nullptr); @@ -2315,7 +2315,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { } } else if (is_node) { Node *current_node = Object::cast_to(current_obj); - ERR_FAIL_COND(!current_node); + ERR_FAIL_NULL(current_node); InspectorDock::get_inspector_singleton()->edit(current_node); if (current_node->is_inside_tree()) { @@ -2950,9 +2950,9 @@ void EditorNode::_screenshot(bool p_use_utc) { void EditorNode::_save_screenshot(NodePath p_path) { Control *editor_main_screen = EditorInterface::get_singleton()->get_editor_main_screen(); - ERR_FAIL_COND_MSG(!editor_main_screen, "Cannot get the editor main screen control."); + ERR_FAIL_NULL_MSG(editor_main_screen, "Cannot get the editor main screen control."); Viewport *viewport = editor_main_screen->get_viewport(); - ERR_FAIL_COND_MSG(!viewport, "Cannot get a viewport from the editor main screen."); + ERR_FAIL_NULL_MSG(viewport, "Cannot get a viewport from the editor main screen."); Ref texture = viewport->get_texture(); ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get a viewport texture from the editor main screen."); Ref img = texture->get_image(); @@ -3136,7 +3136,7 @@ void EditorNode::editor_select(int p_which) { selecting = false; EditorPlugin *new_editor = editor_table[p_which]; - ERR_FAIL_COND(!new_editor); + ERR_FAIL_NULL(new_editor); if (editor_plugin_screen == new_editor) { return; @@ -4169,7 +4169,7 @@ void EditorNode::stop_child_process(OS::ProcessID p_pid) { } Ref