[Editor] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable

This commit is contained in:
A Thousand Ships 2023-09-09 17:24:40 +02:00
parent 5f1e56ff26
commit 75ee58fd04
61 changed files with 217 additions and 217 deletions

View file

@ -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<Node>(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")) {

View file

@ -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;

View file

@ -51,7 +51,7 @@ template <typename Func>
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<ScriptEditorDebugger>(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<TreeItem>(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"));

View file

@ -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";

View file

@ -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) {

View file

@ -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<AudioEffect>(fx);
ERR_FAIL_COND(!afx);
ERR_FAIL_NULL(afx);
Ref<AudioEffect> afxr = Ref<AudioEffect>(afx);
afxr->set_name(effect_options->get_item_text(p_which));

View file

@ -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<Node>(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;
}

View file

@ -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<RefCounted>(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<Node *> new_selection;

View file

@ -3955,7 +3955,7 @@ void EditorInspector::_property_pinned(const String &p_path, bool p_pinned) {
}
Node *node = Object::cast_to<Node>(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));

View file

@ -480,7 +480,7 @@ void EditorInterface::create() {
}
void EditorInterface::free() {
ERR_FAIL_COND(singleton == nullptr);
ERR_FAIL_NULL(singleton);
memdelete(singleton);
}

View file

@ -2003,7 +2003,7 @@ void EditorNode::_dialog_action(String p_file) {
saving_resource = Ref<Resource>();
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<Resource>(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<Node>(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<ViewportTexture> texture = viewport->get_texture();
ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get a viewport texture from the editor main screen.");
Ref<Image> 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<Script> EditorNode::get_object_custom_type_base(const Object *p_object) const {
ERR_FAIL_COND_V(!p_object, nullptr);
ERR_FAIL_NULL_V(p_object, nullptr);
Ref<Script> scr = p_object->get_script();
@ -4201,7 +4201,7 @@ Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) cons
}
StringName EditorNode::get_object_custom_type_name(const Object *p_object) const {
ERR_FAIL_COND_V(!p_object, StringName());
ERR_FAIL_NULL_V(p_object, StringName());
Ref<Script> scr = p_object->get_script();
if (scr.is_null() && Object::cast_to<Script>(p_object)) {
@ -4341,7 +4341,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
bool EditorNode::is_object_of_custom_type(const Object *p_object, const StringName &p_class) {
ERR_FAIL_COND_V(!p_object, false);
ERR_FAIL_NULL_V(p_object, false);
Ref<Script> scr = p_object->get_script();
if (scr.is_null() && Object::cast_to<Script>(p_object)) {
@ -4631,7 +4631,7 @@ void EditorNode::_dock_make_selected_float() {
}
void EditorNode::_dock_make_float(Control *p_dock, int p_slot_index, bool p_show_window) {
ERR_FAIL_COND(!p_dock);
ERR_FAIL_NULL(p_dock);
Size2 borders = Size2(4, 4) * EDSCALE;
// Remember size and position before removing it from the main window.
@ -5810,7 +5810,7 @@ void EditorNode::remove_control_from_dock(Control *p_control) {
}
}
ERR_FAIL_COND_MSG(!dock, "Control was not in dock.");
ERR_FAIL_NULL_MSG(dock, "Control was not in dock.");
dock->remove_child(p_control);
_update_dock_slots_visibility();
@ -6207,7 +6207,7 @@ void EditorNode::reload_instances_with_path_in_edited_scenes(const String &p_ins
instantiated_node = current_packed_scene->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE);
}
ERR_FAIL_COND(!instantiated_node);
ERR_FAIL_NULL(instantiated_node);
bool original_node_is_displayed_folded = original_node->is_displayed_folded();
bool original_node_scene_instance_load_placeholder = original_node->get_scene_instance_load_placeholder();

View file

@ -95,7 +95,7 @@ void EditorPaths::create() {
}
void EditorPaths::free() {
ERR_FAIL_COND(singleton == nullptr);
ERR_FAIL_NULL(singleton);
memdelete(singleton);
}

View file

@ -137,7 +137,7 @@ void EditorPluginSettings::_plugin_activity_changed() {
}
TreeItem *ti = plugin_list->get_edited();
ERR_FAIL_COND(!ti);
ERR_FAIL_NULL(ti);
bool active = ti->is_checked(3);
String name = ti->get_metadata(0);

View file

@ -2786,7 +2786,7 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
if (!base_node && Object::cast_to<RefCounted>(get_edited_object())) {
Node *to_node = get_node(p_path);
ERR_FAIL_COND(!to_node);
ERR_FAIL_NULL(to_node);
path = get_tree()->get_edited_scene_root()->get_path_to(to_node);
}
@ -2899,7 +2899,7 @@ void EditorPropertyNodePath::update_property() {
}
Node *target_node = base_node->get_node(p);
ERR_FAIL_COND(!target_node);
ERR_FAIL_NULL(target_node);
if (String(target_node->get_name()).contains("@")) {
assign->set_icon(Ref<Texture2D>());

View file

@ -1111,7 +1111,7 @@ void EditorPropertyDictionary::update_property() {
}
}
ERR_FAIL_COND(!prop);
ERR_FAIL_NULL(prop);
prop->set_read_only(is_read_only());

View file

@ -500,7 +500,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
return;
}
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND_MSG(!ti, "Object passed is not a TreeItem");
ERR_FAIL_NULL_MSG(ti, "Object passed is not a TreeItem.");
ShortcutButton button_idx = (ShortcutButton)p_idx;

View file

@ -756,7 +756,7 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
Ref<PackedScene> ps = ResourceLoader::load(p_path, "PackedScene", ResourceFormatLoader::CACHE_MODE_IGNORE);
ERR_FAIL_COND_V(ps.is_null(), p_path);
Node *node = ps->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE); // Make sure the child scene root gets the correct inheritance chain.
ERR_FAIL_COND_V(node == nullptr, p_path);
ERR_FAIL_NULL_V(node, p_path);
if (!customize_scenes_plugins.is_empty()) {
for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
Node *customized = plugin->_customize_scene(node, p_path);

View file

@ -2349,7 +2349,7 @@ void FileSystemDock::_resource_created() {
ERR_FAIL_COND(!c);
Resource *r = Object::cast_to<Resource>(c);
ERR_FAIL_COND(!r);
ERR_FAIL_NULL(r);
PackedScene *scene = Object::cast_to<PackedScene>(r);
if (scene) {

View file

@ -501,8 +501,8 @@ void FindInFilesDialog::custom_action(const String &p_action) {
}
void FindInFilesDialog::_on_search_text_modified(String text) {
ERR_FAIL_COND(!_find_button);
ERR_FAIL_COND(!_replace_button);
ERR_FAIL_NULL(_find_button);
ERR_FAIL_NULL(_replace_button);
_find_button->set_disabled(get_search_text().is_empty());
_replace_button->set_disabled(get_search_text().is_empty());

View file

@ -456,7 +456,7 @@ void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_t
// Retrieve the label back, then update the text.
Label *message_label = toasts[control].message_label;
ERR_FAIL_COND(!message_label);
ERR_FAIL_NULL(message_label);
message_label->set_text(p_message);
message_label->set_text_overrun_behavior(TextServer::OVERRUN_NO_TRIMMING);
message_label->set_custom_minimum_size(Size2());

View file

@ -66,12 +66,12 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
}
TreeItem *item = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!item);
ERR_FAIL_NULL(item);
NodePath np = item->get_metadata(0);
Node *n = get_node(np);
ERR_FAIL_COND(!n);
ERR_FAIL_NULL(n);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
if (p_id == BUTTON_SUBSCENE) {
@ -94,7 +94,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() > 1 && selection.find(n) != nullptr) {
for (Node *nv : selection) {
ERR_FAIL_COND(!nv);
ERR_FAIL_NULL(nv);
if (nv == n) {
continue;
}
@ -826,7 +826,7 @@ void SceneTreeEditor::_tree_changed() {
void SceneTreeEditor::_selected_changed() {
TreeItem *s = tree->get_selected();
ERR_FAIL_COND(!s);
ERR_FAIL_NULL(s);
NodePath np = s->get_metadata(0);
Node *n = get_node(np);
@ -852,7 +852,7 @@ void SceneTreeEditor::_deselect_items() {
void SceneTreeEditor::_cell_multi_selected(Object *p_object, int p_cell, bool p_selected) {
TreeItem *item = Object::cast_to<TreeItem>(p_object);
ERR_FAIL_COND(!item);
ERR_FAIL_NULL(item);
if (!item->is_visible()) {
return;
@ -980,7 +980,7 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
void SceneTreeEditor::_rename_node(Node *p_node, const String &p_name) {
TreeItem *item = _find(tree->get_root(), p_node->get_path());
ERR_FAIL_COND(!item);
ERR_FAIL_NULL(item);
String new_name = p_name.validate_node_name();
if (new_name != p_name) {
@ -1060,10 +1060,10 @@ void SceneTreeEditor::_rename_node(Node *p_node, const String &p_name) {
void SceneTreeEditor::_renamed() {
TreeItem *which = tree->get_edited();
ERR_FAIL_COND(!which);
ERR_FAIL_NULL(which);
NodePath np = which->get_metadata(0);
Node *n = get_node(np);
ERR_FAIL_COND(!n);
ERR_FAIL_NULL(n);
String new_name = which->get_text(0);
@ -1131,7 +1131,7 @@ void SceneTreeEditor::set_editor_selection(EditorSelection *p_selection) {
}
void SceneTreeEditor::_update_selection(TreeItem *item) {
ERR_FAIL_COND(!item);
ERR_FAIL_NULL(item);
NodePath np = item->get_metadata(0);
@ -1196,7 +1196,7 @@ void SceneTreeEditor::_cell_collapsed(Object *p_obj) {
NodePath np = ti->get_metadata(0);
Node *n = get_node(np);
ERR_FAIL_COND(!n);
ERR_FAIL_NULL(n);
n->set_display_folded(collapsed);
}

View file

@ -2196,7 +2196,7 @@ bool Collada::_move_geometry_to_skeletons(VisualScene *p_vscene, Node *p_node, L
ERR_FAIL_COND_V(!state.scene_map.has(nodeid), false); //weird, it should have it...
NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]);
ERR_FAIL_COND_V(!nj, false);
ERR_FAIL_NULL_V(nj, false);
ERR_FAIL_COND_V(!nj->owner, false); //weird, node should have a skeleton owner
NodeSkeleton *sk = nj->owner;

View file

@ -1107,7 +1107,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(node);
ERR_FAIL_COND_V(!mi, ERR_BUG);
ERR_FAIL_NULL_V(mi, ERR_BUG);
Collada::SkinControllerData *skin = nullptr;
Collada::MorphControllerData *morph = nullptr;
@ -1131,7 +1131,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
ERR_FAIL_COND_V(!node_map.has(skname), ERR_INVALID_DATA);
NodeMap nmsk = node_map[skname];
Skeleton3D *sk = Object::cast_to<Skeleton3D>(nmsk.node);
ERR_FAIL_COND_V(!sk, ERR_INVALID_DATA);
ERR_FAIL_NULL_V(sk, ERR_INVALID_DATA);
ERR_FAIL_COND_V(!skeleton_bone_map.has(sk), ERR_INVALID_DATA);
HashMap<String, int> &bone_remap_map = skeleton_bone_map[sk];

View file

@ -155,11 +155,11 @@ Variant EditorScenePostImportPlugin::get_option_value(const StringName &p_name)
return Variant();
}
void EditorScenePostImportPlugin::add_import_option(const String &p_name, Variant p_default_value) {
ERR_FAIL_COND_MSG(current_option_list == nullptr, "add_import_option() can only be called from get_import_options()");
ERR_FAIL_NULL_MSG(current_option_list, "add_import_option() can only be called from get_import_options().");
add_import_option_advanced(p_default_value.get_type(), p_name, p_default_value);
}
void EditorScenePostImportPlugin::add_import_option_advanced(Variant::Type p_type, const String &p_name, Variant p_default_value, PropertyHint p_hint, const String &p_hint_string, int p_usage_flags) {
ERR_FAIL_COND_MSG(current_option_list == nullptr, "add_import_option_advanced() can only be called from get_import_options()");
ERR_FAIL_NULL_MSG(current_option_list, "add_import_option_advanced() can only be called from get_import_options().");
current_option_list->push_back(ResourceImporter::ImportOption(PropertyInfo(p_type, p_name, p_hint, p_hint_string, p_usage_flags), p_default_value));
}
@ -356,7 +356,7 @@ static String _fixstr(const String &p_what, const String &p_str) {
}
static void _pre_gen_shape_list(Ref<ImporterMesh> &mesh, Vector<Ref<Shape3D>> &r_shape_list, bool p_convex) {
ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value.");
if (!p_convex) {
Ref<ConcavePolygonShape3D> shape = mesh->create_trimesh_shape();
r_shape_list.push_back(shape);
@ -2143,7 +2143,7 @@ void ResourceImporterScene::_optimize_track_usage(AnimationPlayer *p_player, Ani
List<StringName> anims;
p_player->get_animation_list(&anims);
Node *parent = p_player->get_parent();
ERR_FAIL_COND(parent == nullptr);
ERR_FAIL_NULL(parent);
HashMap<NodePath, uint32_t> used_tracks[TRACK_CHANNEL_MAX];
bool tracks_to_add = false;
static const Animation::TrackType track_types[TRACK_CHANNEL_MAX] = { Animation::TYPE_POSITION_3D, Animation::TYPE_ROTATION_3D, Animation::TYPE_SCALE_3D, Animation::TYPE_BLEND_SHAPE };
@ -2727,7 +2727,7 @@ Node *EditorSceneFormatImporterESCN::import_scene(const String &p_path, uint32_t
}
}
ERR_FAIL_COND_V(!scene, nullptr);
ERR_FAIL_NULL_V(scene, nullptr);
return scene;
}

View file

@ -205,7 +205,7 @@ void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) {
default: {
if (p_option >= OBJECT_METHOD_BASE) {
ERR_FAIL_COND(!current);
ERR_FAIL_NULL(current);
int idx = p_option - OBJECT_METHOD_BASE;
@ -373,7 +373,7 @@ void InspectorDock::_resource_created() {
ERR_FAIL_COND(!c);
Resource *r = Object::cast_to<Resource>(c);
ERR_FAIL_COND(!r);
ERR_FAIL_NULL(r);
EditorNode::get_singleton()->push_item(r);
}

View file

@ -101,7 +101,7 @@ void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p
}
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!ti);
ERR_FAIL_NULL(ti);
int idx = ti->get_metadata(0);
@ -163,7 +163,7 @@ void LocalizationEditor::_translation_res_option_add(const PackedStringArray &p_
Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
ERR_FAIL_NULL(k);
String key = k->get_metadata(0);
@ -194,7 +194,7 @@ void LocalizationEditor::_translation_res_select() {
void LocalizationEditor::_translation_res_option_popup(bool p_arrow_clicked) {
TreeItem *ed = translation_remap_options->get_edited();
ERR_FAIL_COND(!ed);
ERR_FAIL_NULL(ed);
locale_select->set_locale(ed->get_tooltip_text(1));
locale_select->popup_locale_dialog();
@ -202,7 +202,7 @@ void LocalizationEditor::_translation_res_option_popup(bool p_arrow_clicked) {
void LocalizationEditor::_translation_res_option_selected(const String &p_locale) {
TreeItem *ed = translation_remap_options->get_edited();
ERR_FAIL_COND(!ed);
ERR_FAIL_NULL(ed);
ed->set_text(1, TranslationServer::get_singleton()->get_locale_name(p_locale));
ed->set_tooltip_text(1, p_locale);
@ -222,9 +222,9 @@ void LocalizationEditor::_translation_res_option_changed() {
Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
ERR_FAIL_NULL(k);
TreeItem *ed = translation_remap_options->get_edited();
ERR_FAIL_COND(!ed);
ERR_FAIL_NULL(ed);
String key = k->get_metadata(0);
int idx = ed->get_metadata(0);
@ -299,9 +299,9 @@ void LocalizationEditor::_translation_res_option_delete(Object *p_item, int p_co
Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
ERR_FAIL_NULL(k);
TreeItem *ed = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!ed);
ERR_FAIL_NULL(ed);
String key = k->get_metadata(0);
int idx = ed->get_metadata(0);
@ -348,7 +348,7 @@ void LocalizationEditor::_pot_delete(Object *p_item, int p_column, int p_button,
}
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!ti);
ERR_FAIL_NULL(ti);
int idx = ti->get_metadata(0);

View file

@ -423,9 +423,9 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) {
String type = menu->get_item_metadata(p_index);
Object *obj = ClassDB::instantiate(type);
ERR_FAIL_COND(!obj);
ERR_FAIL_NULL(obj);
AnimationNode *an = Object::cast_to<AnimationNode>(obj);
ERR_FAIL_COND(!an);
ERR_FAIL_NULL(an);
node = Ref<AnimationNode>(an);
}

View file

@ -349,9 +349,9 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) {
String type = menu->get_item_metadata(p_index);
Object *obj = ClassDB::instantiate(type);
ERR_FAIL_COND(!obj);
ERR_FAIL_NULL(obj);
AnimationNode *an = Object::cast_to<AnimationNode>(obj);
ERR_FAIL_COND(!an);
ERR_FAIL_NULL(an);
node = Ref<AnimationNode>(an);
}

View file

@ -325,14 +325,14 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
base_name = anode->get_class();
} else if (!add_options[p_idx].type.is_empty()) {
AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instantiate(add_options[p_idx].type));
ERR_FAIL_COND(!an);
ERR_FAIL_NULL(an);
anode = Ref<AnimationNode>(an);
base_name = add_options[p_idx].name;
} else {
ERR_FAIL_COND(add_options[p_idx].script.is_null());
StringName base_type = add_options[p_idx].script->get_instance_base_type();
AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instantiate(base_type));
ERR_FAIL_COND(!an);
ERR_FAIL_NULL(an);
anode = Ref<AnimationNode>(an);
anode->set_script(add_options[p_idx].script);
base_name = add_options[p_idx].name;
@ -568,7 +568,7 @@ void AnimationNodeBlendTreeEditor::_node_selected(Object *p_node) {
}
GraphNode *gn = Object::cast_to<GraphNode>(p_node);
ERR_FAIL_COND(!gn);
ERR_FAIL_NULL(gn);
String name = gn->get_name();
@ -598,7 +598,7 @@ void AnimationNodeBlendTreeEditor::_filter_toggled() {
void AnimationNodeBlendTreeEditor::_filter_edited() {
TreeItem *edited = filters->get_edited();
ERR_FAIL_COND(!edited);
ERR_FAIL_NULL(edited);
NodePath edited_path = edited->get_metadata(0);
bool filtered = edited->is_checked(0);
@ -966,7 +966,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
String prev_name = blend_tree->get_node_name(p_node);
ERR_FAIL_COND(prev_name.is_empty());
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
ERR_FAIL_COND(!gn);
ERR_FAIL_NULL(gn);
const String &new_name = p_text;

View file

@ -621,7 +621,7 @@ void AnimationLibraryEditor::update_tree() {
}
tree->clear();
ERR_FAIL_COND(!player);
ERR_FAIL_NULL(player);
Color ss_color = get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor));

View file

@ -2013,7 +2013,7 @@ bool EditorInspectorPluginAnimationTrackKeyEdit::can_handle(Object *p_object) {
void EditorInspectorPluginAnimationTrackKeyEdit::parse_begin(Object *p_object) {
AnimationTrackKeyEdit *atk = Object::cast_to<AnimationTrackKeyEdit>(p_object);
ERR_FAIL_COND(!atk);
ERR_FAIL_NULL(atk);
atk_editor = memnew(AnimationTrackKeyEditEditor(atk->animation, atk->track, atk->key_ofs, atk->use_fps));
add_custom_control(atk_editor);

View file

@ -708,9 +708,9 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
String type = menu->get_item_metadata(p_index);
Object *obj = ClassDB::instantiate(type);
ERR_FAIL_COND(!obj);
ERR_FAIL_NULL(obj);
AnimationNode *an = Object::cast_to<AnimationNode>(obj);
ERR_FAIL_COND(!an);
ERR_FAIL_NULL(an);
node = Ref<AnimationNode>(an);
base_name = type.replace_first("AnimationNode", "");

View file

@ -661,7 +661,7 @@ void EditorAssetLibrary::shortcut_input(const Ref<InputEvent> &p_event) {
}
void EditorAssetLibrary::_install_asset() {
ERR_FAIL_COND(!description);
ERR_FAIL_NULL(description);
EditorAssetLibraryItemDownload *d = _get_asset_in_progress(description->get_asset_id());
if (d) {

View file

@ -808,7 +808,7 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retrieve_lock
}
Vector2 CanvasItemEditor::_anchor_to_position(const Control *p_control, Vector2 anchor) {
ERR_FAIL_COND_V(!p_control, Vector2());
ERR_FAIL_NULL_V(p_control, Vector2());
Transform2D parent_transform = p_control->get_transform().affine_inverse();
Rect2 parent_rect = p_control->get_parent_anchorable_rect();
@ -821,7 +821,7 @@ Vector2 CanvasItemEditor::_anchor_to_position(const Control *p_control, Vector2
}
Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 position) {
ERR_FAIL_COND_V(!p_control, Vector2());
ERR_FAIL_NULL_V(p_control, Vector2());
Rect2 parent_rect = p_control->get_parent_anchorable_rect();
@ -3608,7 +3608,7 @@ void CanvasItemEditor::_draw_axis() {
}
void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
ERR_FAIL_COND(!p_node);
ERR_FAIL_NULL(p_node);
Node *scene = EditorNode::get_singleton()->get_edited_scene();
if (p_node != scene && p_node->get_owner() != scene && !scene->is_editable_instance(p_node->get_owner())) {
@ -3739,7 +3739,7 @@ void CanvasItemEditor::_draw_transform_message() {
}
void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
ERR_FAIL_COND(!p_node);
ERR_FAIL_NULL(p_node);
Node *scene = EditorNode::get_singleton()->get_edited_scene();
if (p_node != scene && p_node->get_owner() != scene && !scene->is_editable_instance(p_node->get_owner())) {

View file

@ -817,7 +817,7 @@ void ControlEditorToolbar::_container_flags_selected(int p_flags, bool p_vertica
}
Vector2 ControlEditorToolbar::_position_to_anchor(const Control *p_control, Vector2 position) {
ERR_FAIL_COND_V(!p_control, Vector2());
ERR_FAIL_NULL_V(p_control, Vector2());
Rect2 parent_rect = p_control->get_parent_anchorable_rect();

View file

@ -1041,7 +1041,7 @@ bool EditorInspectorPluginCurve::can_handle(Object *p_object) {
void EditorInspectorPluginCurve::parse_begin(Object *p_object) {
Curve *curve = Object::cast_to<Curve>(p_object);
ERR_FAIL_COND(!curve);
ERR_FAIL_NULL(curve);
Ref<Curve> c(curve);
CurveEditor *editor = memnew(CurveEditor);

View file

@ -76,27 +76,27 @@ void EditorDebuggerSession::remove_session_tab(Control *p_tab) {
}
void EditorDebuggerSession::send_message(const String &p_message, const Array &p_args) {
ERR_FAIL_COND_MSG(!debugger, "Plugin is not attached to debugger");
ERR_FAIL_NULL_MSG(debugger, "Plugin is not attached to debugger.");
debugger->send_message(p_message, p_args);
}
void EditorDebuggerSession::toggle_profiler(const String &p_profiler, bool p_enable, const Array &p_data) {
ERR_FAIL_COND_MSG(!debugger, "Plugin is not attached to debugger");
ERR_FAIL_NULL_MSG(debugger, "Plugin is not attached to debugger.");
debugger->toggle_profiler(p_profiler, p_enable, p_data);
}
bool EditorDebuggerSession::is_breaked() {
ERR_FAIL_COND_V_MSG(!debugger, false, "Plugin is not attached to debugger");
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_breaked();
}
bool EditorDebuggerSession::is_debuggable() {
ERR_FAIL_COND_V_MSG(!debugger, false, "Plugin is not attached to debugger");
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_debuggable();
}
bool EditorDebuggerSession::is_active() {
ERR_FAIL_COND_V_MSG(!debugger, false, "Plugin is not attached to debugger");
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_session_active();
}
@ -121,7 +121,7 @@ void EditorDebuggerSession::_debugger_gone_away() {
}
EditorDebuggerSession::EditorDebuggerSession(ScriptEditorDebugger *p_debugger) {
ERR_FAIL_COND(!p_debugger);
ERR_FAIL_NULL(p_debugger);
debugger = p_debugger;
debugger->connect("started", callable_mp(this, &EditorDebuggerSession::_started));
debugger->connect("stopped", callable_mp(this, &EditorDebuggerSession::_stopped));

View file

@ -970,7 +970,7 @@ bool EditorInspectorPluginFontPreview::can_handle(Object *p_object) {
void EditorInspectorPluginFontPreview::parse_begin(Object *p_object) {
Font *fd = Object::cast_to<Font>(p_object);
ERR_FAIL_COND(!fd);
ERR_FAIL_NULL(fd);
FontPreview *editor = memnew(FontPreview);
editor->set_data(fd);

View file

@ -127,12 +127,12 @@ void GPUParticlesCollisionSDF3DEditorPlugin::bake_func_begin(int p_steps) {
}
void GPUParticlesCollisionSDF3DEditorPlugin::bake_func_step(int p_step, const String &p_description) {
ERR_FAIL_COND(tmp_progress == nullptr);
ERR_FAIL_NULL(tmp_progress);
tmp_progress->step(p_description, p_step, false);
}
void GPUParticlesCollisionSDF3DEditorPlugin::bake_func_end() {
ERR_FAIL_COND(tmp_progress == nullptr);
ERR_FAIL_NULL(tmp_progress);
memdelete(tmp_progress);
tmp_progress = nullptr;
}

View file

@ -143,7 +143,7 @@ EditorProgress *LightmapGIEditorPlugin::tmp_progress = nullptr;
bool LightmapGIEditorPlugin::bake_func_step(float p_progress, const String &p_description, void *, bool p_refresh) {
if (!tmp_progress) {
tmp_progress = memnew(EditorProgress("bake_lightmaps", TTR("Bake Lightmaps"), 1000, false));
ERR_FAIL_COND_V(tmp_progress == nullptr, false);
ERR_FAIL_NULL_V(tmp_progress, false);
}
return tmp_progress->step(p_description, p_progress * 1000, p_refresh);
}

View file

@ -211,7 +211,7 @@ void MeshLibraryEditor::_import_scene_cbk(const String &p_str) {
ERR_FAIL_COND(ps.is_null());
Node *scene = ps->instantiate();
ERR_FAIL_COND_MSG(!scene, "Cannot create an instance from PackedScene '" + p_str + "'.");
ERR_FAIL_NULL_MSG(scene, "Cannot create an instance from PackedScene '" + p_str + "'.");
_import_scene(scene, mesh_library, option == MENU_OPTION_UPDATE_FROM_SCENE, apply_xforms);

View file

@ -82,7 +82,7 @@ void NavigationObstacle3DEditor::_menu_option(int p_option) {
}
void NavigationObstacle3DEditor::_wip_close() {
ERR_FAIL_COND_MSG(!obstacle_node, "Edited NavigationObstacle3D is not valid.");
ERR_FAIL_NULL_MSG(obstacle_node, "Edited NavigationObstacle3D is not valid.");
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Set NavigationObstacle3D Vertices"));
undo_redo->add_undo_method(obstacle_node, "set_vertices", obstacle_node->get_vertices());
@ -344,12 +344,12 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditor::forward_3d_gui_input(Cam
}
PackedVector2Array NavigationObstacle3DEditor::_get_polygon() {
ERR_FAIL_COND_V_MSG(!obstacle_node, PackedVector2Array(), "Edited object is not valid.");
ERR_FAIL_NULL_V_MSG(obstacle_node, PackedVector2Array(), "Edited object is not valid.");
return PackedVector2Array(obstacle_node->call("get_polygon"));
}
void NavigationObstacle3DEditor::_set_polygon(PackedVector2Array p_poly) {
ERR_FAIL_COND_MSG(!obstacle_node, "Edited object is not valid.");
ERR_FAIL_NULL_MSG(obstacle_node, "Edited object is not valid.");
obstacle_node->call("set_polygon", p_poly);
}

View file

@ -41,7 +41,7 @@
#define HANDLE_HALF_SIZE 9.5
bool EditorNode3DGizmo::is_editable() const {
ERR_FAIL_COND_V(!spatial_node, false);
ERR_FAIL_NULL_V(spatial_node, false);
Node *edited_root = spatial_node->get_tree()->get_edited_scene_root();
if (spatial_node == edited_root) {
return true;
@ -77,7 +77,7 @@ void EditorNode3DGizmo::clear() {
void EditorNode3DGizmo::redraw() {
if (!GDVIRTUAL_CALL(_redraw)) {
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->redraw(this);
}
@ -92,7 +92,7 @@ String EditorNode3DGizmo::get_handle_name(int p_id, bool p_secondary) const {
return ret;
}
ERR_FAIL_COND_V(!gizmo_plugin, "");
ERR_FAIL_NULL_V(gizmo_plugin, "");
return gizmo_plugin->get_handle_name(this, p_id, p_secondary);
}
@ -102,7 +102,7 @@ bool EditorNode3DGizmo::is_handle_highlighted(int p_id, bool p_secondary) const
return success;
}
ERR_FAIL_COND_V(!gizmo_plugin, false);
ERR_FAIL_NULL_V(gizmo_plugin, false);
return gizmo_plugin->is_handle_highlighted(this, p_id, p_secondary);
}
@ -112,7 +112,7 @@ Variant EditorNode3DGizmo::get_handle_value(int p_id, bool p_secondary) const {
return value;
}
ERR_FAIL_COND_V(!gizmo_plugin, Variant());
ERR_FAIL_NULL_V(gizmo_plugin, Variant());
return gizmo_plugin->get_handle_value(this, p_id, p_secondary);
}
@ -121,7 +121,7 @@ void EditorNode3DGizmo::begin_handle_action(int p_id, bool p_secondary) {
return;
}
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->begin_handle_action(this, p_id, p_secondary);
}
@ -130,7 +130,7 @@ void EditorNode3DGizmo::set_handle(int p_id, bool p_secondary, Camera3D *p_camer
return;
}
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->set_handle(this, p_id, p_secondary, p_camera, p_point);
}
@ -139,7 +139,7 @@ void EditorNode3DGizmo::commit_handle(int p_id, bool p_secondary, const Variant
return;
}
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->commit_handle(this, p_id, p_secondary, p_restore, p_cancel);
}
@ -149,7 +149,7 @@ int EditorNode3DGizmo::subgizmos_intersect_ray(Camera3D *p_camera, const Vector2
return id;
}
ERR_FAIL_COND_V(!gizmo_plugin, -1);
ERR_FAIL_NULL_V(gizmo_plugin, -1);
return gizmo_plugin->subgizmos_intersect_ray(this, p_camera, p_point);
}
@ -164,7 +164,7 @@ Vector<int> EditorNode3DGizmo::subgizmos_intersect_frustum(const Camera3D *p_cam
return ret;
}
ERR_FAIL_COND_V(!gizmo_plugin, Vector<int>());
ERR_FAIL_NULL_V(gizmo_plugin, Vector<int>());
return gizmo_plugin->subgizmos_intersect_frustum(this, p_camera, p_frustum);
}
@ -174,7 +174,7 @@ Transform3D EditorNode3DGizmo::get_subgizmo_transform(int p_id) const {
return ret;
}
ERR_FAIL_COND_V(!gizmo_plugin, Transform3D());
ERR_FAIL_NULL_V(gizmo_plugin, Transform3D());
return gizmo_plugin->get_subgizmo_transform(this, p_id);
}
@ -183,7 +183,7 @@ void EditorNode3DGizmo::set_subgizmo_transform(int p_id, Transform3D p_transform
return;
}
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->set_subgizmo_transform(this, p_id, p_transform);
}
@ -198,7 +198,7 @@ void EditorNode3DGizmo::commit_subgizmos(const Vector<int> &p_ids, const Vector<
return;
}
ERR_FAIL_COND(!gizmo_plugin);
ERR_FAIL_NULL(gizmo_plugin);
gizmo_plugin->commit_subgizmos(this, p_ids, p_restore, p_cancel);
}
@ -224,7 +224,7 @@ void EditorNode3DGizmo::Instance::create_instance(Node3D *p_base, bool p_hidden)
}
void EditorNode3DGizmo::add_mesh(const Ref<Mesh> &p_mesh, const Ref<Material> &p_material, const Transform3D &p_xform, const Ref<SkinReference> &p_skin_reference) {
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
ERR_FAIL_COND_MSG(!p_mesh.is_valid(), "EditorNode3DGizmo.add_mesh() requires a valid Mesh resource.");
Instance ins;
@ -253,7 +253,7 @@ void EditorNode3DGizmo::add_vertices(const Vector<Vector3> &p_vertices, const Re
return;
}
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
Instance ins;
Ref<ArrayMesh> mesh = memnew(ArrayMesh);
@ -300,7 +300,7 @@ void EditorNode3DGizmo::add_vertices(const Vector<Vector3> &p_vertices, const Re
}
void EditorNode3DGizmo::add_unscaled_billboard(const Ref<Material> &p_material, real_t p_scale, const Color &p_modulate) {
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
Instance ins;
Vector<Vector3> vs = {
@ -454,7 +454,7 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
}
void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p_size, Vector3 p_position, const Transform3D &p_xform) {
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
BoxMesh box_mesh;
box_mesh.set_size(p_size);
@ -475,7 +475,7 @@ void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p
}
bool EditorNode3DGizmo::intersect_frustum(const Camera3D *p_camera, const Vector<Plane> &p_frustum) {
ERR_FAIL_COND_V(!spatial_node, false);
ERR_FAIL_NULL_V(spatial_node, false);
ERR_FAIL_COND_V(!valid, false);
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) {
@ -556,7 +556,7 @@ void EditorNode3DGizmo::handles_intersect_ray(Camera3D *p_camera, const Vector2
r_id = -1;
r_secondary = false;
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
ERR_FAIL_COND(!valid);
if (hidden) {
@ -615,7 +615,7 @@ void EditorNode3DGizmo::handles_intersect_ray(Camera3D *p_camera, const Vector2
}
bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal) {
ERR_FAIL_COND_V(!spatial_node, false);
ERR_FAIL_NULL_V(spatial_node, false);
ERR_FAIL_COND_V(!valid, false);
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) {
@ -739,7 +739,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
bool EditorNode3DGizmo::is_subgizmo_selected(int p_id) const {
Node3DEditor *ed = Node3DEditor::get_singleton();
ERR_FAIL_COND_V(!ed, false);
ERR_FAIL_NULL_V(ed, false);
return ed->is_current_selected_gizmo(this) && ed->is_subgizmo_selected(p_id);
}
@ -747,7 +747,7 @@ Vector<int> EditorNode3DGizmo::get_subgizmo_selection() const {
Vector<int> ret;
Node3DEditor *ed = Node3DEditor::get_singleton();
ERR_FAIL_COND_V(!ed, ret);
ERR_FAIL_NULL_V(ed, ret);
if (ed->is_current_selected_gizmo(this)) {
ret = ed->get_subgizmo_selection();
@ -757,7 +757,7 @@ Vector<int> EditorNode3DGizmo::get_subgizmo_selection() const {
}
void EditorNode3DGizmo::create() {
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
ERR_FAIL_COND(valid);
valid = true;
@ -769,7 +769,7 @@ void EditorNode3DGizmo::create() {
}
void EditorNode3DGizmo::transform() {
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
ERR_FAIL_COND(!valid);
for (int i = 0; i < instances.size(); i++) {
RS::get_singleton()->instance_set_transform(instances[i].instance, spatial_node->get_global_transform() * instances[i].xform);
@ -778,7 +778,7 @@ void EditorNode3DGizmo::transform() {
void EditorNode3DGizmo::free() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_COND(!spatial_node);
ERR_FAIL_NULL(spatial_node);
ERR_FAIL_COND(!valid);
for (int i = 0; i < instances.size(); i++) {

View file

@ -7499,7 +7499,7 @@ void Node3DEditor::_add_sun_to_scene(bool p_already_added_environment) {
SceneTreeDock::get_singleton()->add_root_node(memnew(Node3D));
base = get_tree()->get_edited_scene_root();
}
ERR_FAIL_COND(!base);
ERR_FAIL_NULL(base);
Node *new_sun = preview_sun->duplicate();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
@ -7528,7 +7528,7 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
SceneTreeDock::get_singleton()->add_root_node(memnew(Node3D));
base = get_tree()->get_edited_scene_root();
}
ERR_FAIL_COND(!base);
ERR_FAIL_NULL(base);
WorldEnvironment *new_env = memnew(WorldEnvironment);
new_env->set_environment(preview_environment->get_environment()->duplicate(true));

View file

@ -95,7 +95,7 @@ void Polygon3DEditor::_menu_option(int p_option) {
void Polygon3DEditor::_wip_close() {
Object *obj = node_resource.is_valid() ? (Object *)node_resource.ptr() : node;
ERR_FAIL_COND_MSG(!obj, "Edited object is not valid.");
ERR_FAIL_NULL_MSG(obj, "Edited object is not valid.");
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Create Polygon3D"));
undo_redo->add_undo_method(obj, "set_polygon", obj->call("get_polygon"));
@ -349,7 +349,7 @@ EditorPlugin::AfterGUIInput Polygon3DEditor::forward_3d_gui_input(Camera3D *p_ca
float Polygon3DEditor::_get_depth() {
Object *obj = node_resource.is_valid() ? (Object *)node_resource.ptr() : node;
ERR_FAIL_COND_V_MSG(!obj, 0.0f, "Edited object is not valid.");
ERR_FAIL_NULL_V_MSG(obj, 0.0f, "Edited object is not valid.");
if (bool(obj->call("_has_editable_3d_polygon_no_depth"))) {
return 0.0f;
@ -360,13 +360,13 @@ float Polygon3DEditor::_get_depth() {
PackedVector2Array Polygon3DEditor::_get_polygon() {
Object *obj = node_resource.is_valid() ? (Object *)node_resource.ptr() : node;
ERR_FAIL_COND_V_MSG(!obj, PackedVector2Array(), "Edited object is not valid.");
ERR_FAIL_NULL_V_MSG(obj, PackedVector2Array(), "Edited object is not valid.");
return PackedVector2Array(obj->call("get_polygon"));
}
void Polygon3DEditor::_set_polygon(PackedVector2Array p_poly) {
Object *obj = node_resource.is_valid() ? (Object *)node_resource.ptr() : node;
ERR_FAIL_COND_MSG(!obj, "Edited object is not valid.");
ERR_FAIL_NULL_MSG(obj, "Edited object is not valid.");
obj->call("set_polygon", p_poly);
}

View file

@ -225,7 +225,7 @@ void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column,
}
TreeItem *item = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!item);
ERR_FAIL_NULL(item);
if (p_id == BUTTON_OPEN_SCENE) {
String rpath = item->get_text(p_column);

View file

@ -2376,7 +2376,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
break;
}
}
ERR_FAIL_COND_V(!se, false);
ERR_FAIL_NULL_V(se, false);
se->set_edited_resource(p_resource);
@ -2695,7 +2695,7 @@ void ScriptEditor::_editor_stop() {
}
void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PackedStringArray &p_args) {
ERR_FAIL_COND(!p_obj);
ERR_FAIL_NULL(p_obj);
Ref<Script> scr = p_obj->get_script();
ERR_FAIL_COND(!scr.is_valid());

View file

@ -1122,7 +1122,7 @@ bool EditorInspectorPluginSkeleton::can_handle(Object *p_object) {
void EditorInspectorPluginSkeleton::parse_begin(Object *p_object) {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_object);
ERR_FAIL_COND(!skeleton);
ERR_FAIL_NULL(skeleton);
skel_editor = memnew(Skeleton3DEditor(this, skeleton));
add_custom_control(skel_editor);
@ -1244,7 +1244,7 @@ int Skeleton3DGizmoPlugin::get_priority() const {
int Skeleton3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gizmo, Camera3D *p_camera, const Vector2 &p_point) const {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_gizmo->get_node_3d());
ERR_FAIL_COND_V(!skeleton, -1);
ERR_FAIL_NULL_V(skeleton, -1);
Skeleton3DEditor *se = Skeleton3DEditor::get_singleton();
@ -1285,14 +1285,14 @@ int Skeleton3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gi
Transform3D Skeleton3DGizmoPlugin::get_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id) const {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_gizmo->get_node_3d());
ERR_FAIL_COND_V(!skeleton, Transform3D());
ERR_FAIL_NULL_V(skeleton, Transform3D());
return skeleton->get_bone_global_pose(p_id);
}
void Skeleton3DGizmoPlugin::set_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id, Transform3D p_transform) {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_gizmo->get_node_3d());
ERR_FAIL_COND(!skeleton);
ERR_FAIL_NULL(skeleton);
// Prepare for global to local.
Transform3D original_to_local;
@ -1321,7 +1321,7 @@ void Skeleton3DGizmoPlugin::set_subgizmo_transform(const EditorNode3DGizmo *p_gi
void Skeleton3DGizmoPlugin::commit_subgizmos(const EditorNode3DGizmo *p_gizmo, const Vector<int> &p_ids, const Vector<Transform3D> &p_restore, bool p_cancel) {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_gizmo->get_node_3d());
ERR_FAIL_COND(!skeleton);
ERR_FAIL_NULL(skeleton);
Skeleton3DEditor *se = Skeleton3DEditor::get_singleton();
Node3DEditor *ne = Node3DEditor::get_singleton();

View file

@ -74,7 +74,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
ClipperLib::PolyNode *p = solution.GetFirst();
ERR_FAIL_COND_V(!p, points);
ERR_FAIL_NULL_V(p, points);
while (p->IsHole()) {
p = p->GetNext();
@ -97,7 +97,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
Vector<Vector2> outPoints;
ClipperLib::PolyNode *p2 = out.GetFirst();
ERR_FAIL_COND_V(!p2, points);
ERR_FAIL_NULL_V(p2, points);
while (p2->IsHole()) {
p2 = p2->GetNext();

View file

@ -855,7 +855,7 @@ void SpriteFramesEditor::_animation_selected() {
}
TreeItem *selected = animations->get_selected();
ERR_FAIL_COND(!selected);
ERR_FAIL_NULL(selected);
edited_anim = selected->get_text(0);
if (animated_sprite) {

View file

@ -167,7 +167,7 @@ void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
Ref<Image> image(Object::cast_to<Image>(p_object));
texture = ImageTexture::create_from_image(image);
ERR_FAIL_COND_MSG(texture == nullptr, "Failed to create the texture from an invalid image.");
ERR_FAIL_NULL_MSG(texture, "Failed to create the texture from an invalid image.");
}
add_custom_control(memnew(TexturePreview(texture, true)));

View file

@ -948,19 +948,19 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
}
void TileDataDefaultEditor::_property_value_changed(StringName p_property, Variant p_value, StringName p_field) {
ERR_FAIL_COND(!dummy_object);
ERR_FAIL_NULL(dummy_object);
dummy_object->set(p_property, p_value);
emit_signal(SNAME("needs_redraw"));
}
Variant TileDataDefaultEditor::_get_painted_value() {
ERR_FAIL_COND_V(!dummy_object, Variant());
ERR_FAIL_NULL_V(dummy_object, Variant());
return dummy_object->get(property);
}
void TileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Variant value = tile_data->get(property);
dummy_object->set(property, value);
if (property_editor) {
@ -970,13 +970,13 @@ void TileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_at
void TileDataDefaultEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
tile_data->set(property, p_value);
}
Variant TileDataDefaultEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND_V(!tile_data, Variant());
ERR_FAIL_NULL_V(tile_data, Variant());
return tile_data->get(property);
}
@ -1186,7 +1186,7 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie
void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
bool valid;
Variant value = tile_data->get(property, &valid);
@ -1315,7 +1315,7 @@ TileDataDefaultEditor::~TileDataDefaultEditor() {
void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Vector2i tile_set_tile_size = tile_set->get_tile_size();
Color color = Color(1.0, 1.0, 1.0);
@ -1349,7 +1349,7 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran
void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
bool valid;
Variant value = tile_data->get(property, &valid);
@ -1370,7 +1370,7 @@ void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform
void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Color color = Color(1.0, 1.0, 1.0);
if (p_selected) {
@ -1397,7 +1397,7 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D
void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
@ -1429,7 +1429,7 @@ Variant TileDataOcclusionShapeEditor::_get_painted_value() {
void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Ref<OccluderPolygon2D> occluder_polygon = tile_data->get_occluder(occlusion_layer);
polygon_editor->clear_polygons();
@ -1441,7 +1441,7 @@ void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile
void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Ref<OccluderPolygon2D> occluder_polygon = p_value;
tile_data->set_occluder(occlusion_layer, occluder_polygon);
@ -1450,7 +1450,7 @@ void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atl
Variant TileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND_V(!tile_data, Variant());
ERR_FAIL_NULL_V(tile_data, Variant());
return tile_data->get_occluder(occlusion_layer);
}
@ -1571,7 +1571,7 @@ Variant TileDataCollisionEditor::_get_painted_value() {
void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
polygon_editor->clear_polygons();
for (int i = 0; i < tile_data->get_collision_polygons_count(physics_layer); i++) {
@ -1597,7 +1597,7 @@ void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_
void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Dictionary dict = p_value;
tile_data->set_constant_linear_velocity(physics_layer, dict["linear_velocity"]);
@ -1616,7 +1616,7 @@ void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_so
Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND_V(!tile_data, Variant());
ERR_FAIL_NULL_V(tile_data, Variant());
Dictionary dict;
dict["linear_velocity"] = tile_data->get_constant_linear_velocity(physics_layer);
@ -1717,7 +1717,7 @@ TileDataCollisionEditor::~TileDataCollisionEditor() {
void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
// Draw all shapes.
Vector<Color> color;
@ -2767,7 +2767,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
tile_set->draw_terrains(p_canvas_item, p_transform, tile_data);
}
@ -2835,7 +2835,7 @@ Variant TileDataNavigationEditor::_get_painted_value() {
void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Ref<NavigationPolygon> nav_polygon = tile_data->get_navigation_polygon(navigation_layer);
polygon_editor->clear_polygons();
@ -2849,7 +2849,7 @@ void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set
void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
Ref<NavigationPolygon> nav_polygon = p_value;
tile_data->set_navigation_polygon(navigation_layer, nav_polygon);
@ -2858,7 +2858,7 @@ void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_s
Variant TileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile);
ERR_FAIL_COND_V(!tile_data, Variant());
ERR_FAIL_NULL_V(tile_data, Variant());
return tile_data->get_navigation_polygon(navigation_layer);
}
@ -2893,7 +2893,7 @@ TileDataNavigationEditor::TileDataNavigationEditor() {
void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
// Draw all shapes.
RenderingServer::get_singleton()->canvas_item_add_set_transform(p_canvas_item->get_canvas_item(), p_transform);

View file

@ -367,7 +367,7 @@ void TileMapEditorTilesPlugin::_update_atlas_view() {
int source_id = sources_list->get_item_metadata(sources_list->get_current());
TileSetSource *source = *tile_set->get_source(source_id);
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
ERR_FAIL_COND(!atlas_source);
ERR_FAIL_NULL(atlas_source);
tile_atlas_view->set_atlas_source(*tile_map->get_tileset(), atlas_source, source_id);
TilesEditorUtils::get_singleton()->synchronize_atlas_view(tile_atlas_view);
@ -388,7 +388,7 @@ void TileMapEditorTilesPlugin::_update_scenes_collection_view() {
int source_id = sources_list->get_item_metadata(sources_list->get_current());
TileSetSource *source = *tile_set->get_source(source_id);
TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source);
ERR_FAIL_COND(!scenes_collection_source);
ERR_FAIL_NULL(scenes_collection_source);
// Clear the list.
scene_tiles_list->clear();
@ -448,7 +448,7 @@ void TileMapEditorTilesPlugin::_scenes_list_multi_selected(int p_index, bool p_s
int source_id = sources_list->get_item_metadata(sources_list->get_current());
TileSetSource *source = *tile_set->get_source(source_id);
TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source);
ERR_FAIL_COND(!scenes_collection_source);
ERR_FAIL_NULL(scenes_collection_source);
TileMapCell selected = TileMapCell(source_id, Vector2i(), scene_id);
@ -1028,7 +1028,7 @@ TileMapCell TileMapEditorTilesPlugin::_pick_random_tile(Ref<TileMapPattern> p_pa
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
TileData *tile_data = atlas_source->get_tile_data(atlas_coords, alternative_tile);
ERR_FAIL_COND_V(!tile_data, TileMapCell());
ERR_FAIL_NULL_V(tile_data, TileMapCell());
sum += tile_data->get_probability();
} else {
sum += 1.0;
@ -3735,7 +3735,7 @@ void TileMapEditor::_update_bottom_panel() {
}
Vector<Vector2i> TileMapEditor::get_line(TileMap *p_tile_map, Vector2i p_from_cell, Vector2i p_to_cell) {
ERR_FAIL_COND_V(!p_tile_map, Vector<Vector2i>());
ERR_FAIL_NULL_V(p_tile_map, Vector<Vector2i>());
Ref<TileSet> tile_set = p_tile_map->get_tileset();
ERR_FAIL_COND_V(!tile_set.is_valid(), Vector<Vector2i>());

View file

@ -295,7 +295,7 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_na
bool valid = false;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND_V(!tile_data, false);
ERR_FAIL_NULL_V(tile_data, false);
tile_data->set(p_name, p_value, &valid);
any_valid |= valid;
@ -383,7 +383,7 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_get(const StringName &p_na
const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND_V(!tile_data, false);
ERR_FAIL_NULL_V(tile_data, false);
bool valid = false;
r_ret = tile_data->get(p_name, &valid);
@ -461,7 +461,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
List<PropertyInfo> list;
tile_data->get_property_list(&list);
@ -2157,7 +2157,7 @@ Vector2i TileSetAtlasSourceEditor::_get_drag_offset_tile_coords(const Vector2i &
void TileSetAtlasSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id) {
ERR_FAIL_COND(!p_tile_set.is_valid());
ERR_FAIL_COND(!p_tile_set_atlas_source);
ERR_FAIL_NULL(p_tile_set_atlas_source);
ERR_FAIL_COND(p_source_id < 0);
ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_atlas_source);
@ -2771,7 +2771,7 @@ void EditorPropertyTilePolygon::_polygons_changed() {
void EditorPropertyTilePolygon::update_property() {
TileSetAtlasSourceEditor::AtlasTileProxyObject *atlas_tile_proxy_object = Object::cast_to<TileSetAtlasSourceEditor::AtlasTileProxyObject>(get_edited_object());
ERR_FAIL_COND(!atlas_tile_proxy_object);
ERR_FAIL_NULL(atlas_tile_proxy_object);
ERR_FAIL_COND(atlas_tile_proxy_object->get_edited_tiles().is_empty());
Ref<TileSetAtlasSource> tile_set_atlas_source = atlas_tile_proxy_object->get_edited_tile_set_atlas_source();

View file

@ -568,7 +568,7 @@ void TileSetEditor::_move_tile_set_array_element(Object *p_undo_redo, Object *p_
for (int k = 0; k < tas->get_alternative_tiles_count(tile_id); k++) {
int alternative_id = tas->get_alternative_tile_id(tile_id, k);
TileData *tile_data = tas->get_tile_data(tile_id, alternative_id);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
// Actually saving stuff.
if (p_array_prefix == "occlusion_layer_") {
@ -687,7 +687,7 @@ void TileSetEditor::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p
for (int k = 0; k < tas->get_alternative_tiles_count(tile_id); k++) {
int alternative_id = tas->get_alternative_tile_id(tile_id, k);
TileData *tile_data = tas->get_tile_data(tile_id, alternative_id);
ERR_FAIL_COND(!tile_data);
ERR_FAIL_NULL(tile_data);
if (components.size() == 2 && components[0].begins_with("terrain_set_") && components[0].trim_prefix("terrain_set_").is_valid_int() && components[1] == "mode") {
ADD_UNDO(tile_data, "terrain_set");

View file

@ -107,7 +107,7 @@ void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::_b
void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id) {
ERR_FAIL_COND(!p_tile_set.is_valid());
ERR_FAIL_COND(!p_tile_set_scenes_collection_source);
ERR_FAIL_NULL(p_tile_set_scenes_collection_source);
ERR_FAIL_COND(p_source_id < 0);
ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_scenes_collection_source);
@ -197,7 +197,7 @@ void TileSetScenesCollectionSourceEditor::SceneTileProxyObject::_get_property_li
}
void TileSetScenesCollectionSourceEditor::SceneTileProxyObject::edit(TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_scene_id) {
ERR_FAIL_COND(!p_tile_set_scenes_collection_source);
ERR_FAIL_NULL(p_tile_set_scenes_collection_source);
ERR_FAIL_COND(!p_tile_set_scenes_collection_source->has_scene_tile_id(p_scene_id));
if (tile_set_scenes_collection_source == p_tile_set_scenes_collection_source && scene_id == p_scene_id) {
@ -390,7 +390,7 @@ void TileSetScenesCollectionSourceEditor::_notification(int p_what) {
void TileSetScenesCollectionSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id) {
ERR_FAIL_COND(!p_tile_set.is_valid());
ERR_FAIL_COND(!p_tile_set_scenes_collection_source);
ERR_FAIL_NULL(p_tile_set_scenes_collection_source);
ERR_FAIL_COND(p_source_id < 0);
ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_scenes_collection_source);

View file

@ -164,8 +164,8 @@ void TilesEditorUtils::set_sources_lists_current(int p_current) {
void TilesEditorUtils::synchronize_sources_list(Object *p_current_list, Object *p_current_sort_button) {
ItemList *item_list = Object::cast_to<ItemList>(p_current_list);
MenuButton *sorting_button = Object::cast_to<MenuButton>(p_current_sort_button);
ERR_FAIL_COND(!item_list);
ERR_FAIL_COND(!sorting_button);
ERR_FAIL_NULL(item_list);
ERR_FAIL_NULL(sorting_button);
if (sorting_button->is_visible_in_tree()) {
for (int i = 0; i != SOURCE_SORT_MAX; i++) {
@ -196,7 +196,7 @@ void TilesEditorUtils::set_atlas_view_transform(float p_zoom, Vector2 p_scroll)
void TilesEditorUtils::synchronize_atlas_view(Object *p_current) {
TileAtlasView *tile_atlas_view = Object::cast_to<TileAtlasView>(p_current);
ERR_FAIL_COND(!tile_atlas_view);
ERR_FAIL_NULL(tile_atlas_view);
if (tile_atlas_view->is_visible_in_tree()) {
tile_atlas_view->set_transform(atlas_view_zoom, atlas_view_scroll);

View file

@ -2152,7 +2152,7 @@ void VisualShaderEditor::_change_input_port_name(const String &p_text, Object *p
}
LineEdit *line_edit = Object::cast_to<LineEdit>(p_line_edit);
ERR_FAIL_COND(!line_edit);
ERR_FAIL_NULL(line_edit);
String validated_name = visual_shader->validate_port_name(p_text, node.ptr(), p_port_id, false);
if (validated_name.is_empty() || prev_name == validated_name) {
@ -2179,7 +2179,7 @@ void VisualShaderEditor::_change_output_port_name(const String &p_text, Object *
}
LineEdit *line_edit = Object::cast_to<LineEdit>(p_line_edit);
ERR_FAIL_COND(!line_edit);
ERR_FAIL_NULL(line_edit);
String validated_name = visual_shader->validate_port_name(p_text, node.ptr(), p_port_id, true);
if (validated_name.is_empty() || prev_name == validated_name) {
@ -3036,7 +3036,7 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector<Variant> &p_ops, Stri
if (!is_custom && !add_options[p_idx].type.is_empty()) {
VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instantiate(add_options[p_idx].type));
ERR_FAIL_COND(!vsn);
ERR_FAIL_NULL(vsn);
if (!p_ops.is_empty()) {
_setup_node(vsn, p_ops);
}
@ -3074,13 +3074,13 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector<Variant> &p_ops, Stri
base_type = add_options[p_idx].script->get_instance_base_type();
}
VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instantiate(base_type));
ERR_FAIL_COND(!vsn);
ERR_FAIL_NULL(vsn);
vsnode = Ref<VisualShaderNode>(vsn);
if (!is_native) {
vsnode->set_script(add_options[p_idx].script);
}
VisualShaderNodeCustom *custom_node = Object::cast_to<VisualShaderNodeCustom>(vsn);
ERR_FAIL_COND(!custom_node);
ERR_FAIL_NULL(custom_node);
custom_node->update_ports();
}
@ -3846,7 +3846,7 @@ void VisualShaderEditor::_node_selected(Object *p_node) {
VisualShader::Type type = get_current_shader_type();
GraphElement *graph_element = Object::cast_to<GraphElement>(p_node);
ERR_FAIL_COND(!graph_element);
ERR_FAIL_NULL(graph_element);
int id = String(graph_element->get_name()).to_int();

View file

@ -153,12 +153,12 @@ void VoxelGIEditorPlugin::bake_func_begin(int p_steps) {
}
void VoxelGIEditorPlugin::bake_func_step(int p_step, const String &p_description) {
ERR_FAIL_COND(tmp_progress == nullptr);
ERR_FAIL_NULL(tmp_progress);
tmp_progress->step(p_description, p_step, false);
}
void VoxelGIEditorPlugin::bake_func_end() {
ERR_FAIL_COND(tmp_progress == nullptr);
ERR_FAIL_NULL(tmp_progress);
memdelete(tmp_progress);
tmp_progress = nullptr;
}

View file

@ -189,7 +189,7 @@ void SceneTreeDock::instantiate_scenes(const Vector<String> &p_files, Node *p_pa
}
void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, Node *parent, int p_pos) {
ERR_FAIL_COND(!parent);
ERR_FAIL_NULL(parent);
Vector<Node *> instances;
@ -1255,7 +1255,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
ERR_FAIL_INDEX(idx, subresources.size());
Object *obj = ObjectDB::get_instance(subresources[idx]);
ERR_FAIL_COND(!obj);
ERR_FAIL_NULL(obj);
_push_item(obj);
}
@ -1881,7 +1881,7 @@ bool SceneTreeDock::_validate_no_instance() {
void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
Node *new_parent = scene_root->get_node(p_path);
ERR_FAIL_COND(!new_parent);
ERR_FAIL_NULL(new_parent);
List<Node *> selection = editor_selection->get_selected_node_list();
@ -1900,7 +1900,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform) {
Node *new_parent = p_new_parent;
ERR_FAIL_COND(!new_parent);
ERR_FAIL_NULL(new_parent);
if (p_nodes.size() == 0) {
return; // Nothing to reparent.
@ -2297,7 +2297,7 @@ void SceneTreeDock::_selection_changed() {
void SceneTreeDock::_do_create(Node *p_parent) {
Variant c = create_dialog->instantiate_selected();
Node *child = Object::cast_to<Node>(c);
ERR_FAIL_COND(!child);
ERR_FAIL_NULL(child);
String new_name = p_parent->validate_child_name(child);
if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
@ -2365,7 +2365,7 @@ void SceneTreeDock::_create() {
} else {
// If no root exist in edited scene
parent = scene_root;
ERR_FAIL_COND(!parent);
ERR_FAIL_NULL(parent);
}
_do_create(parent);
@ -2378,13 +2378,13 @@ void SceneTreeDock::_create() {
ur->create_action(TTR("Change type of node(s)"), UndoRedo::MERGE_DISABLE, selection.front()->get());
for (Node *n : selection) {
ERR_FAIL_COND(!n);
ERR_FAIL_NULL(n);
Variant c = create_dialog->instantiate_selected();
ERR_FAIL_COND(!c);
Node *new_node = Object::cast_to<Node>(c);
ERR_FAIL_COND(!new_node);
ERR_FAIL_NULL(new_node);
replace_node(n, new_node);
}
@ -2397,13 +2397,13 @@ void SceneTreeDock::_create() {
bool only_one_top_node = true;
Node *first = selection.front()->get();
ERR_FAIL_COND(!first);
ERR_FAIL_NULL(first);
int smaller_path_to_top = first->get_path_to(scene_root).get_name_count();
Node *top_node = first;
for (List<Node *>::Element *E = selection.front()->next(); E; E = E->next()) {
Node *n = E->get();
ERR_FAIL_COND(!n);
ERR_FAIL_NULL(n);
int path_length = n->get_path_to(scene_root).get_name_count();
@ -2759,7 +2759,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_type) {
Node *node = get_node(p_to);
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
if (scene_tree->get_scene_tree()->get_drop_mode_flags() & Tree::DROP_MODE_INBETWEEN) {
// Dropped PackedScene, instance it.
@ -3230,7 +3230,7 @@ void SceneTreeDock::save_branch_to_file(String p_directory) {
void SceneTreeDock::_focus_node() {
Node *node = scene_tree->get_selected();
ERR_FAIL_COND(!node);
ERR_FAIL_NULL(node);
if (node->is_class("CanvasItem")) {
CanvasItemEditorPlugin *editor = Object::cast_to<CanvasItemEditorPlugin>(editor_data->get_editor_by_name("2D"));
@ -3754,7 +3754,7 @@ void SceneTreeDock::_edit_subresource(int p_idx, const PopupMenu *p_from_menu) {
const ObjectID &id = p_from_menu->get_item_metadata(p_idx);
Object *obj = ObjectDB::get_instance(id);
ERR_FAIL_COND(!obj);
ERR_FAIL_NULL(obj);
_push_item(obj);
}

View file

@ -59,7 +59,7 @@ class ShortcutBin : public Node {
return;
}
Window *grandparent_window = get_window()->get_parent_visible_window();
ERR_FAIL_COND(!grandparent_window);
ERR_FAIL_NULL(grandparent_window);
if (Object::cast_to<InputEventKey>(p_event.ptr()) || Object::cast_to<InputEventShortcut>(p_event.ptr())) {
// HACK: Propagate the window input to the editor main window to handle global shortcuts.