diff options
Diffstat (limited to 'editor/plugins')
58 files changed, 336 insertions, 333 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index e3e9eae31a..c26daa3857 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -218,7 +218,7 @@ void AbstractPolygon2DEditor::_notification(int p_what) { void AbstractPolygon2DEditor::_node_removed(Node *p_node) { if (p_node == _get_node()) { - edit(NULL); + edit(nullptr); hide(); canvas_item_editor->update_viewport(); @@ -690,7 +690,7 @@ void AbstractPolygon2DEditor::edit(Node *p_polygon) { canvas_item_editor->update_viewport(); } else { - _set_node(NULL); + _set_node(nullptr); } } @@ -801,7 +801,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive) { - canvas_item_editor = NULL; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = EditorNode::get_undo_redo(); @@ -854,7 +854,7 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) { } else { polygon_editor->hide(); - polygon_editor->edit(NULL); + polygon_editor->edit(nullptr); } } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 86c43ea9ab..eb50df2166 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -589,7 +589,7 @@ void AnimationNodeBlendSpace1DEditor::edit(const Ref<AnimationNode> &p_node) { } } -AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = NULL; +AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = nullptr; AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { singleton = this; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 843beacfd6..4343535eb6 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -810,7 +810,7 @@ void AnimationNodeBlendSpace2DEditor::_open_editor() { } void AnimationNodeBlendSpace2DEditor::_removed_from_graph() { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() { @@ -833,7 +833,7 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() { ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph); } -AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; +AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = nullptr; AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 4491c002e3..54c60aba71 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -579,7 +579,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano for (Set<String>::Element *E = paths.front(); E; E = E->next()) { NodePath path = E->get(); - TreeItem *ti = NULL; + TreeItem *ti = nullptr; String accum; for (int i = 0; i < path.get_name_count(); i++) { String name = path.get_name(i); @@ -608,7 +608,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano } } - Node *node = NULL; + Node *node = nullptr; if (base->has_node(accum)) { node = base->get_node(accum); } @@ -710,7 +710,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) { void AnimationNodeBlendTreeEditor::_removed_from_graph() { if (is_visible()) { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } } @@ -756,7 +756,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { } AnimationTree *graph_player = AnimationTreeEditor::get_singleton()->get_tree(); - AnimationPlayer *player = NULL; + AnimationPlayer *player = nullptr; if (graph_player->has_node(graph_player->get_animation_player())) { player = Object::cast_to<AnimationPlayer>(graph_player->get_node(graph_player->get_animation_player())); } @@ -802,7 +802,7 @@ void AnimationNodeBlendTreeEditor::_bind_methods() { ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters); } -AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL; +AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = nullptr; void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 0b0f93bcb5..d96a3b0bab 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -46,12 +46,12 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) { if (player && player == p_node) { - player = NULL; + player = nullptr; set_process(false); track_editor->set_animation(Ref<Animation>()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); track_editor->show_select_node_warning(true); _update_player(); } @@ -299,7 +299,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { } else { track_editor->set_animation(Ref<Animation>()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); } autoplay->set_pressed(current == player->get_autoplay()); @@ -407,7 +407,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) 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())); } } @@ -729,7 +729,7 @@ void AnimationPlayerEditor::_animation_edit() { } } else { track_editor->set_animation(Ref<Animation>()); - track_editor->set_root(NULL); + track_editor->set_root(nullptr); } } @@ -845,10 +845,10 @@ void AnimationPlayerEditor::_update_player() { frame->set_editable(animlist.size() != 0); animation->set_disabled(animlist.size() == 0); autoplay->set_disabled(animlist.size() == 0); - tool_anim->set_disabled(player == NULL); + tool_anim->set_disabled(player == nullptr); onion_toggle->set_disabled(animlist.size() == 0); onion_skinning->set_disabled(animlist.size() == 0); - pin->set_disabled(player == NULL); + pin->set_disabled(player == nullptr); if (!player) { AnimationPlayerEditor::singleton->get_track_editor()->update_keying(); @@ -1549,7 +1549,7 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning); } -AnimationPlayerEditor *AnimationPlayerEditor::singleton = NULL; +AnimationPlayerEditor *AnimationPlayerEditor::singleton = nullptr; AnimationPlayer *AnimationPlayerEditor::get_player() const { @@ -1565,7 +1565,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay set_focus_mode(FOCUS_ALL); - player = NULL; + player = nullptr; HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 8ff8c92f4d..c06f62a8c1 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1082,7 +1082,7 @@ void AnimationNodeStateMachineEditor::_open_editor(const String &p_name) { void AnimationNodeStateMachineEditor::_removed_from_graph() { - EditorNode::get_singleton()->edit_item(NULL); + EditorNode::get_singleton()->edit_item(nullptr); } void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { @@ -1241,7 +1241,7 @@ void AnimationNodeStateMachineEditor::_bind_methods() { ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor); } -AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = NULL; +AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = nullptr; AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { @@ -1362,7 +1362,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { name_edit = memnew(LineEdit); name_edit_popup->add_child(name_edit); name_edit->set_anchors_and_margins_preset(PRESET_WIDE); - name_edit_popup->add_child(name_edit); name_edit->connect("text_entered", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited)); name_edit->connect("focus_exited", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited_focus_out)); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 605696aa75..e771c5610f 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -169,7 +169,7 @@ void AnimationTreeEditor::_notification(int p_what) { void AnimationTreeEditor::_bind_methods() { } -AnimationTreeEditor *AnimationTreeEditor::singleton = NULL; +AnimationTreeEditor *AnimationTreeEditor::singleton = nullptr; void AnimationTreeEditor::add_plugin(AnimationTreeNodeEditorPlugin *p_editor) { ERR_FAIL_COND(p_editor->get_parent()); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3b104e34b2..14c44b7973 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -635,7 +635,7 @@ void EditorAssetLibrary::_install_asset() { EditorAssetLibraryItemDownload *d = Object::cast_to<EditorAssetLibraryItemDownload>(downloads_hb->get_child(i)); if (d && d->get_asset_id() == description->get_asset_id()) { - if (EditorNode::get_singleton() != NULL) + if (EditorNode::get_singleton() != nullptr) EditorNode::get_singleton()->show_warning(TTR("Download for this asset is already in progress!")); return; } @@ -1305,7 +1305,7 @@ void EditorAssetLibrary::_asset_file_selected(const String &p_file) { if (asset_installer) { memdelete(asset_installer); - asset_installer = NULL; + asset_installer = nullptr; } asset_installer = memnew(EditorAssetInstaller); @@ -1500,7 +1500,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { error_tr->set_v_size_flags(Control::SIZE_SHRINK_CENTER); error_hb->add_child(error_tr); - description = NULL; + description = nullptr; set_process(true); set_process_unhandled_input(true); @@ -1520,7 +1520,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { add_child(asset_open); asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected)); - asset_installer = NULL; + asset_installer = nullptr; } /////// diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index 6bc9562c5a..ba161244d6 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -81,25 +81,25 @@ void BakedLightmapEditorPlugin::make_visible(bool p_visible) { } } -EditorProgress *BakedLightmapEditorPlugin::tmp_progress = NULL; +EditorProgress *BakedLightmapEditorPlugin::tmp_progress = nullptr; void BakedLightmapEditorPlugin::bake_func_begin(int p_steps) { - ERR_FAIL_COND(tmp_progress != NULL); + ERR_FAIL_COND(tmp_progress != nullptr); tmp_progress = memnew(EditorProgress("bake_lightmaps", TTR("Bake Lightmaps"), p_steps, true)); } bool BakedLightmapEditorPlugin::bake_func_step(int p_step, const String &p_description) { - ERR_FAIL_COND_V(tmp_progress == NULL, false); + ERR_FAIL_COND_V(tmp_progress == nullptr, false); return tmp_progress->step(p_description, p_step, false); } void BakedLightmapEditorPlugin::bake_func_end() { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); memdelete(tmp_progress); - tmp_progress = NULL; + tmp_progress = nullptr; } void BakedLightmapEditorPlugin::_bind_methods() { @@ -116,7 +116,7 @@ BakedLightmapEditorPlugin::BakedLightmapEditorPlugin(EditorNode *p_node) { bake->hide(); bake->connect("pressed", this, "_bake"); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake); - lightmap = NULL; + lightmap = nullptr; BakedLightmap::bake_begin_function = bake_func_begin; BakedLightmap::bake_step_function = bake_func_step; diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp index 759f01135e..8bc1374269 100644 --- a/editor/plugins/camera_3d_editor_plugin.cpp +++ b/editor/plugins/camera_3d_editor_plugin.cpp @@ -35,15 +35,15 @@ void Camera3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; - Node3DEditor::get_singleton()->set_custom_camera(NULL); + node = nullptr; + Node3DEditor::get_singleton()->set_custom_camera(nullptr); hide(); } } void Camera3DEditor::_pressed() { - Node *sn = (node && preview->is_pressed()) ? node : NULL; + Node *sn = (node && preview->is_pressed()) ? node : nullptr; Node3DEditor::get_singleton()->set_custom_camera(sn); } @@ -56,13 +56,13 @@ void Camera3DEditor::edit(Node *p_camera) { if (!node) { preview->set_pressed(false); - Node3DEditor::get_singleton()->set_custom_camera(NULL); + Node3DEditor::get_singleton()->set_custom_camera(nullptr); } else { if (preview->is_pressed()) Node3DEditor::get_singleton()->set_custom_camera(p_camera); else - Node3DEditor::get_singleton()->set_custom_camera(NULL); + Node3DEditor::get_singleton()->set_custom_camera(nullptr); } } @@ -98,7 +98,7 @@ void Camera3DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object)); } else { - Node3DEditor::get_singleton()->set_can_preview(NULL); + Node3DEditor::get_singleton()->set_can_preview(nullptr); } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c7ddcd5e46..2f7747d0ff 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -48,7 +48,7 @@ #include "scene/2d/touch_screen_button.h" #include "scene/gui/grid_container.h" #include "scene/gui/nine_patch_rect.h" -#include "scene/gui/viewport_container.h" +#include "scene/gui/subviewport_container.h" #include "scene/main/canvas_layer.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" @@ -503,7 +503,7 @@ Object *CanvasItemEditor::_get_editor_data(Object *p_what) { CanvasItem *ci = Object::cast_to<CanvasItem>(p_what); if (!ci) - return NULL; + return nullptr; return memnew(CanvasItemEditorSelectedItem); } @@ -667,7 +667,7 @@ void CanvasItemEditor::_get_bones_at_pos(const Point2 &p_pos, Vector<_SelectResu Node2D *from_node = Object::cast_to<Node2D>(ObjectDB::get_instance(E->key().from)); Vector<Vector2> bone_shape; - if (!_get_bone_shape(&bone_shape, NULL, E)) + if (!_get_bone_shape(&bone_shape, nullptr, E)) continue; // Check if the point is inside the Polygon2D @@ -1343,7 +1343,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) { if (drag_selection.size() == 1) { new_pos = snap_point(drag_from, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection[0]); } else { - new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, NULL, drag_selection); + new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, nullptr, drag_selection); } for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get(); @@ -2031,7 +2031,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { Vector<List<Dictionary>> all_bones_ik_states; for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) { List<Dictionary> bones_ik_states; - _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states); + _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states); all_bones_ik_states.push_back(bones_ik_states); } @@ -2046,7 +2046,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { previous_pos = _get_encompassing_rect_from_list(drag_selection).position; } - Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, NULL, drag_selection); + Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, nullptr, drag_selection); if (drag_type == DRAG_MOVE_X) { new_pos.y = previous_pos.y; @@ -2133,7 +2133,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { Vector<List<Dictionary>> all_bones_ik_states; for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) { List<Dictionary> bones_ik_states; - _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states); + _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states); all_bones_ik_states.push_back(bones_ik_states); } @@ -2299,7 +2299,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { return true; // Find the item to select - CanvasItem *canvas_item = NULL; + CanvasItem *canvas_item = nullptr; // Retrieve the bones Vector<_SelectResult> selection = Vector<_SelectResult>(); @@ -5434,7 +5434,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport_scrollable->set_h_size_flags(Control::SIZE_EXPAND_FILL); viewport_scrollable->connect("draw", callable_mp(this, &CanvasItemEditor::_update_scrollbars)); - ViewportContainer *scene_tree = memnew(ViewportContainer); + SubViewportContainer *scene_tree = memnew(SubViewportContainer); viewport_scrollable->add_child(scene_tree); scene_tree->set_stretch(true); scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE); @@ -5800,7 +5800,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { call_deferred("set_state", get_state()); } -CanvasItemEditor *CanvasItemEditor::singleton = NULL; +CanvasItemEditor *CanvasItemEditor::singleton = nullptr; void CanvasItemEditorPlugin::edit(Object *p_object) { @@ -5886,8 +5886,8 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) cons ERR_FAIL_COND(res.is_null()); Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res)); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); - if (texture != NULL || scene != NULL) { - if (texture != NULL) { + if (texture != nullptr || scene != nullptr) { + if (texture != nullptr) { Sprite2D *sprite = memnew(Sprite2D); sprite->set_texture(texture); sprite->set_modulate(Color(1, 1, 1, 0.7f)); @@ -5953,7 +5953,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child); editor_data->get_undo_redo().add_do_method(child, "set_owner", editor->get_edited_scene()); editor_data->get_undo_redo().add_do_reference(child); - editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL); + editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)nullptr); } if (parent) { @@ -6064,7 +6064,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { continue; } Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); - if (scene != NULL && scene.is_valid()) { + if (scene != nullptr && scene.is_valid()) { if (!target_node) { // Without root node act the same as "Load Inherited Scene" Error err = EditorNode::get_singleton()->load_scene(path, false, true); @@ -6079,7 +6079,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { } } else { Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res)); - if (texture != NULL && texture.is_valid()) { + if (texture != nullptr && texture.is_valid()) { Node *child; if (default_type == "Light2D") child = memnew(Light2D); @@ -6209,7 +6209,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p list.push_back(root_node); } else { drop_pos = p_point; - target_node = NULL; + target_node = nullptr; } } @@ -6258,7 +6258,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TextureRect"); types.push_back("NinePatchRect"); - target_node = NULL; + target_node = nullptr; editor = p_node; editor_data = editor->get_scene_tree_dock()->get_editor_data(); canvas_item_editor = p_canvas_item_editor; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 34965868e0..9f1a92f563 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -613,7 +613,7 @@ public: SNAP_DEFAULT = SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL, }; - Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = NULL, List<CanvasItem *> p_other_nodes_exceptions = List<CanvasItem *>()); + Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, List<CanvasItem *> p_other_nodes_exceptions = List<CanvasItem *>()); float snap_angle(float p_target, float p_start = 0) const; Transform2D get_canvas_transform() const { return transform; } diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 3d32c0b698..87e9987aa1 100644 --- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -42,7 +42,7 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) { CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index 5b35a4826c..26adc5156b 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -66,7 +66,7 @@ void CollisionPolygon3DEditor::_notification(int p_what) { void CollisionPolygon3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; if (imgeom->get_parent() == p_node) p_node->remove_child(imgeom); hide(); @@ -507,7 +507,7 @@ void CollisionPolygon3DEditor::edit(Node *p_collision_polygon) { prev_depth = -1; } else { - node = NULL; + node = nullptr; if (imgeom->get_parent()) imgeom->get_parent()->remove_child(imgeom); @@ -523,7 +523,7 @@ void CollisionPolygon3DEditor::_bind_methods() { CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) { - node = NULL; + node = nullptr; editor = p_editor; undo_redo = EditorNode::get_undo_redo(); @@ -591,7 +591,7 @@ void Polygon3DEditorPlugin::make_visible(bool p_visible) { } else { collision_polygon_editor->hide(); - collision_polygon_editor->edit(NULL); + collision_polygon_editor->edit(nullptr); } } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 2d1d6de574..594dd0d0cb 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -42,7 +42,7 @@ void CollisionShape2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; } } @@ -561,7 +561,7 @@ void CollisionShape2DEditor::edit(Node *p_node) { edit_handle = -1; shape_type = -1; - node = NULL; + node = nullptr; } canvas_item_editor->update_viewport(); @@ -574,8 +574,8 @@ void CollisionShape2DEditor::_bind_methods() { CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) { - node = NULL; - canvas_item_editor = NULL; + node = nullptr; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = p_editor->get_undo_redo(); @@ -597,7 +597,7 @@ bool CollisionShape2DEditorPlugin::handles(Object *p_obj) const { void CollisionShape2DEditorPlugin::make_visible(bool visible) { if (!visible) { - edit(NULL); + edit(nullptr); } } diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 022663a61d..b005519a5e 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -251,7 +251,7 @@ void CPUParticles2DEditorPlugin::_bind_methods() { CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { - particles = NULL; + particles = nullptr; editor = p_node; undo_redo = editor->get_undo_redo(); diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp index 887e9e48df..0c2fbaf62a 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp @@ -35,7 +35,7 @@ void CPUParticles3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -128,7 +128,7 @@ void CPUParticles3DEditorPlugin::make_visible(bool p_visible) { } else { particles_editor->particles_editor_hb->hide(); particles_editor->hide(); - particles_editor->edit(NULL); + particles_editor->edit(nullptr); } } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 0fd8ea4fb5..71c5a78e0b 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -755,7 +755,7 @@ void CurveEditor::_bind_methods() { bool EditorInspectorPluginCurve::can_handle(Object *p_object) { - return Object::cast_to<Curve>(p_object) != NULL; + return Object::cast_to<Curve>(p_object) != nullptr; } void EditorInspectorPluginCurve::parse_begin(Object *p_object) { diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 908a32fdb6..6a171c4703 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -113,25 +113,25 @@ void GIProbeEditorPlugin::make_visible(bool p_visible) { } } -EditorProgress *GIProbeEditorPlugin::tmp_progress = NULL; +EditorProgress *GIProbeEditorPlugin::tmp_progress = nullptr; void GIProbeEditorPlugin::bake_func_begin(int p_steps) { - ERR_FAIL_COND(tmp_progress != NULL); + ERR_FAIL_COND(tmp_progress != nullptr); tmp_progress = memnew(EditorProgress("bake_gi", TTR("Bake GI Probe"), p_steps)); } void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); tmp_progress->step(p_description, p_step, false); } void GIProbeEditorPlugin::bake_func_end() { - ERR_FAIL_COND(tmp_progress == NULL); + ERR_FAIL_COND(tmp_progress == nullptr); memdelete(tmp_progress); - tmp_progress = NULL; + tmp_progress = nullptr; } void GIProbeEditorPlugin::_giprobe_save_path_and_bake(const String &p_path) { @@ -163,7 +163,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake_hb->add_child(bake_info); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb); - gi_probe = NULL; + gi_probe = nullptr; probe_file = memnew(EditorFileDialog); probe_file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); probe_file->add_filter("*.res"); diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 89bff7ccab..29c47a2b67 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -360,7 +360,7 @@ void GPUParticles2DEditorPlugin::_bind_methods() { GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) { - particles = NULL; + particles = nullptr; editor = p_node; undo_redo = editor->get_undo_redo(); diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp index 655f03b7e0..534a228098 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp @@ -236,7 +236,7 @@ GPUParticles3DEditorBase::GPUParticles3DEditorBase() { void GPUParticles3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -424,7 +424,7 @@ void GPUParticles3DEditor::_bind_methods() { GPUParticles3DEditor::GPUParticles3DEditor() { - node = NULL; + node = nullptr; particles_editor_hb = memnew(HBoxContainer); Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb); options = memnew(MenuButton); @@ -476,7 +476,7 @@ void GPUParticles3DEditorPlugin::make_visible(bool p_visible) { } else { particles_editor->particles_editor_hb->hide(); particles_editor->hide(); - particles_editor->edit(NULL); + particles_editor->edit(nullptr); } } diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index 54b7840124..67de610ae7 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -79,7 +79,7 @@ GradientEditor::GradientEditor() { bool EditorInspectorPluginGradient::can_handle(Object *p_object) { - return Object::cast_to<Gradient>(p_object) != NULL; + return Object::cast_to<Gradient>(p_object) != nullptr; } void EditorInspectorPluginGradient::parse_begin(Object *p_object) { diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index 9ae4d2ae9d..1dbc78804b 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -163,7 +163,7 @@ void ItemListOptionButtonPlugin::erase(int p_idx) { ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() { - ob = NULL; + ob = nullptr; } /////////////////////////////////////////////////////////////// @@ -205,7 +205,7 @@ void ItemListPopupMenuPlugin::erase(int p_idx) { ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() { - pp = NULL; + pp = nullptr; } /////////////////////////////////////////////////////////////// @@ -244,7 +244,7 @@ void ItemListItemListPlugin::erase(int p_idx) { ItemListItemListPlugin::ItemListItemListPlugin() { - pp = NULL; + pp = nullptr; } /////////////////////////////////////////////////////////////// @@ -254,7 +254,7 @@ ItemListItemListPlugin::ItemListItemListPlugin() { void ItemListEditor::_node_removed(Node *p_node) { if (p_node == item_list) { - item_list = NULL; + item_list = nullptr; hide(); dialog->hide(); } @@ -311,7 +311,7 @@ void ItemListEditor::edit(Node *p_item_list) { if (!item_list) { selected_idx = -1; - property_editor->edit(NULL); + property_editor->edit(nullptr); return; } @@ -329,7 +329,7 @@ void ItemListEditor::edit(Node *p_item_list) { } selected_idx = -1; - property_editor->edit(NULL); + property_editor->edit(nullptr); } bool ItemListEditor::handles(Object *p_object) const { @@ -349,7 +349,7 @@ void ItemListEditor::_bind_methods() { ItemListEditor::ItemListEditor() { selected_idx = -1; - item_list = NULL; + item_list = nullptr; toolbar_button = memnew(ToolButton); toolbar_button->set_text(TTR("Items")); @@ -408,7 +408,7 @@ void ItemListEditorPlugin::make_visible(bool p_visible) { } else { item_list_editor->hide(); - item_list_editor->edit(NULL); + item_list_editor->edit(nullptr); } } diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp index 22df287f97..f8550a884b 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -112,7 +112,7 @@ void LightOccluder2DEditor::_create_resource() { LightOccluder2DEditor::LightOccluder2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } LightOccluder2DEditorPlugin::LightOccluder2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index 4ac9d0af3b..5b887390a6 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -64,7 +64,7 @@ void Line2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, con Line2DEditor::Line2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } Line2DEditorPlugin::Line2DEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 5623805201..00e8a05e4e 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "material_editor_plugin.h" #include "editor/editor_scale.h" -#include "scene/gui/viewport_container.h" +#include "scene/gui/subviewport_container.h" #include "scene/resources/particles_material.h" #include "scene/resources/sky_material.h" @@ -110,7 +110,7 @@ void MaterialEditor::_bind_methods() { MaterialEditor::MaterialEditor() { - vc = memnew(ViewportContainer); + vc = memnew(SubViewportContainer); vc->set_stretch(true); add_child(vc); vc->set_anchors_and_margins_preset(PRESET_WIDE); diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 0938e79ca2..50036e4f72 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -41,13 +41,13 @@ #include "scene/3d/mesh_instance_3d.h" #include "scene/resources/material.h" -class ViewportContainer; +class SubViewportContainer; class MaterialEditor : public Control { GDCLASS(MaterialEditor, Control); - ViewportContainer *vc; + SubViewportContainer *vc; SubViewport *viewport; MeshInstance3D *sphere_instance; MeshInstance3D *box_instance; diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index a8b455fdd2..5e657c3b71 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -173,7 +173,7 @@ MeshEditor::MeshEditor() { bool EditorInspectorPluginMesh::can_handle(Object *p_object) { - return Object::cast_to<Mesh>(p_object) != NULL; + return Object::cast_to<Mesh>(p_object) != nullptr; } void EditorInspectorPluginMesh::parse_begin(Object *p_object) { diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h index 59810517d9..072e21f260 100644 --- a/editor/plugins/mesh_editor_plugin.h +++ b/editor/plugins/mesh_editor_plugin.h @@ -36,12 +36,12 @@ #include "scene/3d/camera_3d.h" #include "scene/3d/light_3d.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/gui/viewport_container.h" +#include "scene/gui/subviewport_container.h" #include "scene/resources/material.h" -class MeshEditor : public ViewportContainer { +class MeshEditor : public SubViewportContainer { - GDCLASS(MeshEditor, ViewportContainer); + GDCLASS(MeshEditor, SubViewportContainer); float rot_x; float rot_y; diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index ccefdcd28f..7819f62bc7 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -40,7 +40,7 @@ void MeshInstance3DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; options->hide(); } } @@ -337,7 +337,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { const Vector2 *r = uv.ptr(); Vector<int> indices = a[Mesh::ARRAY_INDEX]; - const int *ri = NULL; + const int *ri = nullptr; int ic; @@ -511,7 +511,7 @@ void MeshInstance3DEditorPlugin::make_visible(bool p_visible) { } else { mesh_editor->options->hide(); - mesh_editor->edit(NULL); + mesh_editor->edit(nullptr); } } diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 3257db8751..4f482c2b43 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -37,7 +37,7 @@ void MultiMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -371,7 +371,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_dialog->add_child(std); std->connect("selected", callable_mp(this, &MultiMeshEditor::_browsed)); - _last_pp_node = NULL; + _last_pp_node = nullptr; err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -394,7 +394,7 @@ void MultiMeshEditorPlugin::make_visible(bool p_visible) { } else { multimesh_editor->options->hide(); - multimesh_editor->edit(NULL); + multimesh_editor->edit(nullptr); } } diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index 6671d0b6b4..e41b32ac86 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -123,7 +123,7 @@ void NavigationPolygonEditor::_create_resource() { NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; } NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) : diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 01868ba77e..1c16ed6b58 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -48,7 +48,7 @@ #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/physics_body_3d.h" #include "scene/3d/visual_instance_3d.h" -#include "scene/gui/viewport_container.h" +#include "scene/gui/subviewport_container.h" #include "scene/resources/packed_scene.h" #include "scene/resources/surface_tool.h" #include "servers/display_server.h" @@ -418,12 +418,12 @@ Vector3 Node3DEditorViewport::_get_camera_position() const { Point2 Node3DEditorViewport::_point_to_screen(const Vector3 &p_point) { - return camera->unproject_position(p_point) * viewport_container->get_stretch_shrink(); + return camera->unproject_position(p_point) * subviewport_container->get_stretch_shrink(); } Vector3 Node3DEditorViewport::_get_ray_pos(const Vector2 &p_pos) const { - return camera->project_ray_origin(p_pos / viewport_container->get_stretch_shrink()); + return camera->project_ray_origin(p_pos / subviewport_container->get_stretch_shrink()); } Vector3 Node3DEditorViewport::_get_camera_normal() const { @@ -433,7 +433,7 @@ Vector3 Node3DEditorViewport::_get_camera_normal() const { Vector3 Node3DEditorViewport::_get_ray(const Vector2 &p_pos) const { - return camera->project_ray_normal(p_pos / viewport_container->get_stretch_shrink()); + return camera->project_ray_normal(p_pos / subviewport_container->get_stretch_shrink()); } void Node3DEditorViewport::_clear_selected() { @@ -494,14 +494,14 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b Vector3 ray = _get_ray(p_pos); Vector3 pos = _get_ray_pos(p_pos); - Vector2 shrinked_pos = p_pos / viewport_container->get_stretch_shrink(); + Vector2 shrinked_pos = p_pos / subviewport_container->get_stretch_shrink(); Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario()); Set<Ref<EditorNode3DGizmo>> found_gizmos; Node *edited_scene = get_tree()->get_edited_scene_root(); ObjectID closest; - Node *item = NULL; + Node *item = nullptr; float closest_dist = 1e20; int selected_handle = -1; @@ -588,7 +588,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_inclu Vector3 normal; int handle = -1; - bool inters = seg->intersect_ray(camera, p_pos, point, normal, NULL, p_alt_select); + bool inters = seg->intersect_ray(camera, p_pos, point, normal, nullptr, p_alt_select); if (!inters) continue; @@ -2273,7 +2273,7 @@ static bool is_shortcut_pressed(const String &p_path) { return false; } InputEventKey *k = Object::cast_to<InputEventKey>(shortcut->get_shortcut().ptr()); - if (k == NULL) { + if (k == nullptr) { return false; } const InputFilter &input = *InputFilter::get_singleton(); @@ -2386,11 +2386,11 @@ void Node3DEditorViewport::_notification(int p_what) { _update_freelook(delta); Node *scene_root = editor->get_scene_tree_dock()->get_editor_data()->get_edited_scene_root(); - if (previewing_cinema && scene_root != NULL) { + if (previewing_cinema && scene_root != nullptr) { Camera3D *cam = scene_root->get_viewport()->get_camera(); - if (cam != NULL && cam != previewing) { + if (cam != nullptr && cam != previewing) { //then switch the viewport's camera to the scene's viewport camera - if (previewing != NULL) { + if (previewing != nullptr) { previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); } previewing = cam; @@ -2472,8 +2472,8 @@ void Node3DEditorViewport::_notification(int p_what) { bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION)); - if (shrink != (viewport_container->get_stretch_shrink() > 1)) { - viewport_container->set_stretch_shrink(shrink ? 2 : 1); + if (shrink != (subviewport_container->get_stretch_shrink() > 1)) { + subviewport_container->set_stretch_shrink(shrink ? 2 : 1); } //update msaa if changed @@ -2950,7 +2950,7 @@ void Node3DEditorViewport::_menu_option(int p_option) { if (current) { preview_camera->hide(); } else { - if (previewing != NULL) + if (previewing != nullptr) preview_camera->show(); } } break; @@ -3000,6 +3000,7 @@ void Node3DEditorViewport::_menu_option(int p_option) { case VIEW_DISPLAY_DEBUG_GIPROBE_EMISSION: case VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE: case VIEW_DISPLAY_DEBUG_SSAO: + case VIEW_DISPLAY_DEBUG_PSSM_SPLITS: case VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER: { static const int display_options[] = { @@ -3018,6 +3019,7 @@ void Node3DEditorViewport::_menu_option(int p_option) { VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE, VIEW_DISPLAY_DEBUG_SSAO, VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER, + VIEW_DISPLAY_DEBUG_PSSM_SPLITS, VIEW_MAX }; static const Viewport::DebugDraw debug_draw_modes[] = { @@ -3036,6 +3038,7 @@ void Node3DEditorViewport::_menu_option(int p_option) { Viewport::DEBUG_DRAW_SCENE_LUMINANCE, Viewport::DEBUG_DRAW_SSAO, Viewport::DEBUG_DRAW_ROUGHNESS_LIMITER, + Viewport::DEBUG_DRAW_PSSM_SPLITS, }; int idx = 0; @@ -3137,7 +3140,7 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); - previewing = NULL; + previewing = nullptr; RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) preview_camera->hide(); @@ -3157,10 +3160,10 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) { previewing_cinema = p_activate; if (!previewing_cinema) { - if (previewing != NULL) + if (previewing != nullptr) previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); - previewing = NULL; + previewing = nullptr; RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore preview_camera->set_pressed(false); if (!preview) { @@ -3237,8 +3240,8 @@ void Node3DEditorViewport::update_transform_gizmo_view() { const int viewport_base_height = 400 * MAX(1, EDSCALE); gizmo_scale = (gizmo_size / Math::abs(dd)) * MAX(1, EDSCALE) * - MIN(viewport_base_height, viewport_container->get_size().height) / viewport_base_height / - viewport_container->get_stretch_shrink(); + MIN(viewport_base_height, subviewport_container->get_size().height) / viewport_base_height / + subviewport_container->get_stretch_shrink(); Vector3 scale = Vector3(1, 1, 1) * gizmo_scale; xform.basis.scale(scale); @@ -3398,7 +3401,7 @@ Dictionary Node3DEditorViewport::get_state() const { d["gizmos"] = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_GIZMOS)); d["information"] = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION)); d["fps"] = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_FPS)); - d["half_res"] = viewport_container->get_stretch_shrink() > 1; + d["half_res"] = subviewport_container->get_stretch_shrink() > 1; d["cinematic_preview"] = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_CINEMATIC_PREVIEW)); if (previewing) d["previewing"] = EditorNode::get_singleton()->get_edited_scene()->get_path_to(previewing); @@ -3503,7 +3506,7 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const Vector3 hit_point; Vector3 hit_normal; - bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, NULL, false); + bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, nullptr, false); if (!inters) continue; @@ -3568,8 +3571,8 @@ void Node3DEditorViewport::_create_preview(const Vector<String> &files) const { ERR_CONTINUE(res.is_null()); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); - if (mesh != NULL || scene != NULL) { - if (mesh != NULL) { + if (mesh != nullptr || scene != nullptr) { + if (mesh != nullptr) { MeshInstance3D *mesh_instance = memnew(MeshInstance3D); mesh_instance->set_mesh(mesh); preview_node->add_child(mesh_instance); @@ -3620,10 +3623,10 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); - Node *instanced_scene = NULL; + Node *instanced_scene = nullptr; - if (mesh != NULL || scene != NULL) { - if (mesh != NULL) { + if (mesh != nullptr || scene != nullptr) { + if (mesh != nullptr) { MeshInstance3D *mesh_instance = memnew(MeshInstance3D); mesh_instance->set_mesh(mesh); mesh_instance->set_name(path.get_file().get_basename()); @@ -3637,7 +3640,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po } } - if (instanced_scene == NULL) { + if (instanced_scene == nullptr) { return false; } @@ -3648,7 +3651,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po } } - if (scene != NULL) { + if (scene != nullptr) { instanced_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path)); } @@ -3689,7 +3692,7 @@ void Node3DEditorViewport::_perform_drop_data() { } Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); - if (mesh != NULL || scene != NULL) { + if (mesh != nullptr || scene != nullptr) { bool success = _create_instance(target_node, path, drop_pos); if (!success) { error_files.push_back(path); @@ -3829,8 +3832,8 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito zoom_indicator_delay = 0.0; spatial_editor = p_spatial_editor; - ViewportContainer *c = memnew(ViewportContainer); - viewport_container = c; + SubViewportContainer *c = memnew(SubViewportContainer); + subviewport_container = c; c->set_stretch(true); add_child(c); c->set_anchors_and_margins_preset(Control::PRESET_WIDE); @@ -3887,6 +3890,8 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_lighting", TTR("Display Lighting")), VIEW_DISPLAY_LIGHTING); view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_unshaded", TTR("Display Unshaded")), VIEW_DISPLAY_SHADELESS); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL), true); + display_submenu->add_radio_check_item(TTR("Directional Shadow Splits"), VIEW_DISPLAY_DEBUG_PSSM_SPLITS); + display_submenu->add_separator(); display_submenu->add_radio_check_item(TTR("Normal Buffer"), VIEW_DISPLAY_NORMAL_BUFFER); display_submenu->add_separator(); display_submenu->add_radio_check_item(TTR("Shadow Atlas"), VIEW_DISPLAY_DEBUG_SHADOW_ATLAS); @@ -3964,10 +3969,10 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito preview_camera->set_h_size_flags(0); preview_camera->hide(); preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview)); - previewing = NULL; + previewing = nullptr; gizmo_scale = 1.0; - preview_node = NULL; + preview_node = nullptr; info_label = memnew(Label); info_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE); @@ -4030,7 +4035,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito surface->add_child(top_right_vbox); - accept = NULL; + accept = nullptr; freelook_active = false; freelook_speed = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_base_speed"); @@ -4393,7 +4398,7 @@ Node3DEditorViewportContainer::Node3DEditorViewportContainer() { /////////////////////////////////////////////////////////////////// -Node3DEditor *Node3DEditor::singleton = NULL; +Node3DEditor *Node3DEditor::singleton = nullptr; Node3DEditorSelectedItem::~Node3DEditorSelectedItem() { @@ -4479,7 +4484,7 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) { Node3D *sp = Object::cast_to<Node3D>(p_what); if (!sp) - return NULL; + return nullptr; Node3DEditorSelectedItem *si = memnew(Node3DEditorSelectedItem); @@ -5903,32 +5908,32 @@ void Node3DEditor::_toggle_maximize_view(Object *p_viewport) { void Node3DEditor::_node_removed(Node *p_node) { if (p_node == selected) - selected = NULL; + selected = nullptr; } void Node3DEditor::_register_all_gizmos() { - add_gizmo_plugin(Ref<CameraNode3DGizmoPlugin>(memnew(CameraNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<LightNode3DGizmoPlugin>(memnew(LightNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<AudioStreamPlayer3DNode3DGizmoPlugin>(memnew(AudioStreamPlayer3DNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<MeshInstanceNode3DGizmoPlugin>(memnew(MeshInstanceNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<SoftBodyNode3DGizmoPlugin>(memnew(SoftBodyNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<Sprite3DNode3DGizmoPlugin>(memnew(Sprite3DNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<SkeletonNode3DGizmoPlugin>(memnew(SkeletonNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<Position3DNode3DGizmoPlugin>(memnew(Position3DNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<RayCastNode3DGizmoPlugin>(memnew(RayCastNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<SpringArmNode3DGizmoPlugin>(memnew(SpringArmNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<VehicleWheelNode3DGizmoPlugin>(memnew(VehicleWheelNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<VisibilityNotifierGizmoPlugin>(memnew(VisibilityNotifierGizmoPlugin))); + add_gizmo_plugin(Ref<Camera3DGizmoPlugin>(memnew(Camera3DGizmoPlugin))); + add_gizmo_plugin(Ref<Light3DGizmoPlugin>(memnew(Light3DGizmoPlugin))); + add_gizmo_plugin(Ref<AudioStreamPlayer3DGizmoPlugin>(memnew(AudioStreamPlayer3DGizmoPlugin))); + add_gizmo_plugin(Ref<MeshInstance3DGizmoPlugin>(memnew(MeshInstance3DGizmoPlugin))); + add_gizmo_plugin(Ref<SoftBody3DGizmoPlugin>(memnew(SoftBody3DGizmoPlugin))); + add_gizmo_plugin(Ref<Sprite3DGizmoPlugin>(memnew(Sprite3DGizmoPlugin))); + add_gizmo_plugin(Ref<Skeleton3DGizmoPlugin>(memnew(Skeleton3DGizmoPlugin))); + add_gizmo_plugin(Ref<Position3DGizmoPlugin>(memnew(Position3DGizmoPlugin))); + add_gizmo_plugin(Ref<RayCast3DGizmoPlugin>(memnew(RayCast3DGizmoPlugin))); + add_gizmo_plugin(Ref<SpringArm3DGizmoPlugin>(memnew(SpringArm3DGizmoPlugin))); + add_gizmo_plugin(Ref<VehicleWheel3DGizmoPlugin>(memnew(VehicleWheel3DGizmoPlugin))); + add_gizmo_plugin(Ref<VisibilityNotifier3DGizmoPlugin>(memnew(VisibilityNotifier3DGizmoPlugin))); add_gizmo_plugin(Ref<GPUParticles3DGizmoPlugin>(memnew(GPUParticles3DGizmoPlugin))); add_gizmo_plugin(Ref<CPUParticles3DGizmoPlugin>(memnew(CPUParticles3DGizmoPlugin))); add_gizmo_plugin(Ref<ReflectionProbeGizmoPlugin>(memnew(ReflectionProbeGizmoPlugin))); add_gizmo_plugin(Ref<GIProbeGizmoPlugin>(memnew(GIProbeGizmoPlugin))); // add_gizmo_plugin(Ref<BakedIndirectLightGizmoPlugin>(memnew(BakedIndirectLightGizmoPlugin))); - add_gizmo_plugin(Ref<CollisionShapeNode3DGizmoPlugin>(memnew(CollisionShapeNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<CollisionPolygonNode3DGizmoPlugin>(memnew(CollisionPolygonNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<NavigationMeshNode3DGizmoPlugin>(memnew(NavigationMeshNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<JointNode3DGizmoPlugin>(memnew(JointNode3DGizmoPlugin))); - add_gizmo_plugin(Ref<PhysicalBoneNode3DGizmoPlugin>(memnew(PhysicalBoneNode3DGizmoPlugin))); + add_gizmo_plugin(Ref<CollisionShape3DGizmoPlugin>(memnew(CollisionShape3DGizmoPlugin))); + add_gizmo_plugin(Ref<CollisionPolygon3DGizmoPlugin>(memnew(CollisionPolygon3DGizmoPlugin))); + add_gizmo_plugin(Ref<NavigationRegion3DGizmoPlugin>(memnew(NavigationRegion3DGizmoPlugin))); + add_gizmo_plugin(Ref<Joint3DGizmoPlugin>(memnew(Joint3DGizmoPlugin))); + add_gizmo_plugin(Ref<PhysicalBone3DGizmoPlugin>(memnew(PhysicalBone3DGizmoPlugin))); } void Node3DEditor::_bind_methods() { @@ -5979,7 +5984,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { undo_redo = p_editor->get_undo_redo(); VBoxContainer *vbc = this; - custom_camera = NULL; + custom_camera = nullptr; singleton = this; editor = p_editor; editor_selection = editor->get_editor_selection(); @@ -6315,7 +6320,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { scenario_debug = RenderingServer::SCENARIO_DEBUG_DISABLED; - selected = NULL; + selected = nullptr; set_process_unhandled_key_input(true); add_to_group("_spatial_editor_group"); @@ -6761,8 +6766,8 @@ EditorNode3DGizmoPlugin::EditorNode3DGizmoPlugin() { EditorNode3DGizmoPlugin::~EditorNode3DGizmoPlugin() { for (int i = 0; i < current_gizmos.size(); ++i) { - current_gizmos[i]->set_plugin(NULL); - current_gizmos[i]->get_spatial_node()->set_gizmo(NULL); + current_gizmos[i]->set_plugin(nullptr); + current_gizmos[i]->get_spatial_node()->set_gizmo(nullptr); } if (Node3DEditor::get_singleton()) { Node3DEditor::get_singleton()->update_all_gizmos(); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 4b9f5a605b..bb83e7f626 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -43,7 +43,7 @@ class Camera3D; class Node3DEditor; class EditorNode3DGizmoPlugin; class Node3DEditorViewport; -class ViewportContainer; +class SubViewportContainer; class EditorNode3DGizmo : public Node3DGizmo { @@ -123,7 +123,7 @@ public: Ref<EditorNode3DGizmoPlugin> get_plugin() const { return gizmo_plugin; } Vector3 get_handle_pos(int p_idx) const; bool intersect_frustum(const Camera3D *p_camera, const Vector<Plane> &p_frustum); - bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false); + bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = nullptr, bool p_sec_first = false); virtual void clear(); virtual void create(); @@ -218,6 +218,7 @@ class Node3DEditorViewport : public Control { VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE, VIEW_DISPLAY_DEBUG_SSAO, VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER, + VIEW_DISPLAY_DEBUG_PSSM_SPLITS, VIEW_LOCK_ROTATION, VIEW_CINEMATIC_PREVIEW, VIEW_AUTO_ORTHOGONAL, @@ -256,7 +257,7 @@ private: UndoRedo *undo_redo; CheckBox *preview_camera; - ViewportContainer *viewport_container; + SubViewportContainer *subviewport_container; MenuButton *view_menu; PopupMenu *display_submenu; @@ -295,7 +296,7 @@ private: void _clear_selected(); void _select_clicked(bool p_append, bool p_single, bool p_allow_locked = false); void _select(Node *p_node, bool p_append, bool p_single); - ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = NULL, bool p_alt_select = false); + ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = nullptr, bool p_alt_select = false); void _find_items_at_pos(const Point2 &p_pos, bool &r_includes_current, Vector<_RayResult> &results, bool p_alt_select = false); Vector3 _get_ray_pos(const Vector2 &p_pos) const; Vector3 _get_ray(const Vector2 &p_pos) const; @@ -487,7 +488,7 @@ public: RID sbox_instance; Node3DEditorSelectedItem() { - sp = NULL; + sp = nullptr; last_xform_dirty = true; } ~Node3DEditorSelectedItem(); @@ -761,7 +762,7 @@ public: Ref<ArrayMesh> get_scale_plane_gizmo(int idx) const { return scale_plane_gizmo[idx]; } void update_transform_gizmo(); - void update_all_gizmos(Node *p_node = NULL); + void update_all_gizmos(Node *p_node = nullptr); void snap_selected_nodes_to_floor(); void select_gizmo_highlight_axis(int p_axis); void set_custom_camera(Node *p_camera) { custom_camera = p_camera; } @@ -788,7 +789,7 @@ public: void set_can_preview(Camera3D *p_preview); Node3DEditorViewport *get_editor_viewport(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), NULL); + ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), nullptr); return viewports[p_idx]; } diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 75c5fcb994..4516b7035b 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -56,7 +56,7 @@ void Path2DEditor::_notification(int p_what) { void Path2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; hide(); } } @@ -288,7 +288,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { Vector2 gpoint = mm->get_position(); Ref<Curve2D> curve = node->get_curve(); - if (curve == NULL) return true; + if (curve == nullptr) return true; if (curve->get_point_count() < 2) return true; // Find edge @@ -449,7 +449,7 @@ void Path2DEditor::edit(Node *p_path2d) { // node may have been deleted at this point if (node && node->is_connected("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed))) node->disconnect("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed)); - node = NULL; + node = nullptr; } } @@ -532,7 +532,7 @@ void Path2DEditor::_handle_option_pressed(int p_option) { Path2DEditor::Path2DEditor(EditorNode *p_editor) { - canvas_item_editor = NULL; + canvas_item_editor = nullptr; editor = p_editor; undo_redo = editor->get_undo_redo(); mirror_handle_angle = true; @@ -620,7 +620,7 @@ void Path2DEditorPlugin::make_visible(bool p_visible) { path2d_editor->hide(); path2d_editor->base_hb->hide(); - path2d_editor->edit(NULL); + path2d_editor->edit(nullptr); } } diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index cf8ddb84cd..d3ece9556d 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -34,7 +34,7 @@ #include "node_3d_editor_plugin.h" #include "scene/resources/curve.h" -String PathNode3DGizmo::get_handle_name(int p_idx) const { +String Path3DGizmo::get_handle_name(int p_idx) const { Ref<Curve3D> c = path->get_curve(); if (c.is_null()) @@ -57,7 +57,7 @@ String PathNode3DGizmo::get_handle_name(int p_idx) const { return n; } -Variant PathNode3DGizmo::get_handle_value(int p_idx) { +Variant Path3DGizmo::get_handle_value(int p_idx) { Ref<Curve3D> c = path->get_curve(); if (c.is_null()) @@ -84,7 +84,7 @@ Variant PathNode3DGizmo::get_handle_value(int p_idx) { return ofs; } -void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void Path3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point) { Ref<Curve3D> c = path->get_curve(); if (c.is_null()) @@ -154,7 +154,7 @@ void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_ } } -void PathNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) { +void Path3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) { Ref<Curve3D> c = path->get_curve(); if (c.is_null()) @@ -217,7 +217,7 @@ void PathNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_ } } -void PathNode3DGizmo::redraw() { +void Path3DGizmo::redraw() { clear(); @@ -286,7 +286,7 @@ void PathNode3DGizmo::redraw() { } } -PathNode3DGizmo::PathNode3DGizmo(Path3D *p_path) { +Path3DGizmo::Path3DGizmo(Path3D *p_path) { path = p_path; set_spatial_node(p_path); @@ -460,7 +460,7 @@ void Path3DEditorPlugin::edit(Object *p_object) { } } else { Path3D *pre = path; - path = NULL; + path = nullptr; if (pre) { pre->get_curve()->emit_signal("changed"); } @@ -494,7 +494,7 @@ void Path3DEditorPlugin::make_visible(bool p_visible) { { Path3D *pre = path; - path = NULL; + path = nullptr; if (pre && pre->get_curve().is_valid()) { pre->get_curve()->emit_signal("changed"); } @@ -553,17 +553,17 @@ void Path3DEditorPlugin::_notification(int p_what) { void Path3DEditorPlugin::_bind_methods() { } -Path3DEditorPlugin *Path3DEditorPlugin::singleton = NULL; +Path3DEditorPlugin *Path3DEditorPlugin::singleton = nullptr; Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) { - path = NULL; + path = nullptr; editor = p_node; singleton = this; mirror_handle_angle = true; mirror_handle_length = true; - Ref<PathNode3DGizmoPlugin> gizmo_plugin; + Ref<Path3DGizmoPlugin> gizmo_plugin; gizmo_plugin.instance(); Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); @@ -627,24 +627,24 @@ Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) { Path3DEditorPlugin::~Path3DEditorPlugin() { } -Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { - Ref<PathNode3DGizmo> ref; +Ref<EditorNode3DGizmo> Path3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { + Ref<Path3DGizmo> ref; Path3D *path = Object::cast_to<Path3D>(p_spatial); - if (path) ref = Ref<PathNode3DGizmo>(memnew(PathNode3DGizmo(path))); + if (path) ref = Ref<Path3DGizmo>(memnew(Path3DGizmo(path))); return ref; } -String PathNode3DGizmoPlugin::get_name() const { +String Path3DGizmoPlugin::get_name() const { return "Path3D"; } -int PathNode3DGizmoPlugin::get_priority() const { +int Path3DGizmoPlugin::get_priority() const { return -1; } -PathNode3DGizmoPlugin::PathNode3DGizmoPlugin() { +Path3DGizmoPlugin::Path3DGizmoPlugin() { Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8)); create_material("path_material", path_color); diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h index 15804faa47..3f18cadacd 100644 --- a/editor/plugins/path_3d_editor_plugin.h +++ b/editor/plugins/path_3d_editor_plugin.h @@ -34,9 +34,9 @@ #include "editor/node_3d_editor_gizmos.h" #include "scene/3d/path_3d.h" -class PathNode3DGizmo : public EditorNode3DGizmo { +class Path3DGizmo : public EditorNode3DGizmo { - GDCLASS(PathNode3DGizmo, EditorNode3DGizmo); + GDCLASS(Path3DGizmo, EditorNode3DGizmo); Path3D *path; mutable Vector3 original; @@ -50,12 +50,12 @@ public: virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false); virtual void redraw(); - PathNode3DGizmo(Path3D *p_path = NULL); + Path3DGizmo(Path3D *p_path = nullptr); }; -class PathNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Path3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(PathNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Path3DGizmoPlugin, EditorNode3DGizmoPlugin); protected: Ref<EditorNode3DGizmo> create_gizmo(Node3D *p_spatial); @@ -63,7 +63,7 @@ protected: public: String get_name() const; int get_priority() const; - PathNode3DGizmoPlugin(); + Path3DGizmoPlugin(); }; class Path3DEditorPlugin : public EditorPlugin { diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index dd6d7b109b..6d38f7f318 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -49,7 +49,7 @@ void PhysicalBone3DEditor::_set_move_joint() { PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) : editor(p_editor), - selected(NULL) { + selected(nullptr) { spatial_editor_hb = memnew(HBoxContainer); spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -90,7 +90,7 @@ void PhysicalBone3DEditor::show() { PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin(EditorNode *p_editor) : editor(p_editor), - selected(NULL), + selected(nullptr), physical_bone_editor(editor) {} void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) { @@ -100,8 +100,8 @@ void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) { } else { physical_bone_editor.hide(); - physical_bone_editor.set_selected(NULL); - selected = NULL; + physical_bone_editor.set_selected(nullptr); + selected = nullptr; } } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index a5bd5aed6b..1f7a5b9968 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -107,7 +107,7 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_sync_bones() { - Skeleton2D *skeleton = NULL; + Skeleton2D *skeleton = nullptr; if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); error->popup_centered(); @@ -1031,7 +1031,7 @@ void Polygon2DEditor::_uv_draw() { uvs = node->get_polygon(); } - const float *weight_r = NULL; + const float *weight_r = nullptr; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1249,7 +1249,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : AbstractPolygon2DEditor(p_editor) { - node = NULL; + node = nullptr; snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2()); snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(10, 10)); use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 8def56f968..852feeb675 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -181,7 +181,7 @@ void ResourcePreloaderEditor::_update_library() { tree->clear(); tree->set_hide_root(true); - TreeItem *root = tree->create_item(NULL); + TreeItem *root = tree->create_item(nullptr); List<StringName> rnames; preloader->get_resource_list(&rnames); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 516c52a8a4..67e836082d 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -88,7 +88,7 @@ void EditorPropertyRootMotion::_node_assign() { for (Set<String>::Element *E = paths.front(); E; E = E->next()) { NodePath path = E->get(); - TreeItem *ti = NULL; + TreeItem *ti = nullptr; String accum; for (int i = 0; i < path.get_name_count(); i++) { String name = path.get_name(i); @@ -117,7 +117,7 @@ void EditorPropertyRootMotion::_node_assign() { } } - Node *node = NULL; + Node *node = nullptr; if (base->has_node(accum)) { node = base->get_node(accum); } @@ -212,7 +212,7 @@ void EditorPropertyRootMotion::update_property() { } assign->set_flat(true); - Node *base_node = NULL; + Node *base_node = nullptr; if (base_hint != NodePath()) { if (get_tree()->get_root()->has_node(base_hint)) { base_node = get_tree()->get_root()->get_node(base_hint); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 0e867f7b16..0b97ade278 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -193,7 +193,7 @@ void ScriptEditorQuickOpen::_update_search() { } } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void ScriptEditorQuickOpen::_confirmed() { @@ -252,7 +252,7 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { ///////////////////////////////// -ScriptEditor *ScriptEditor::script_editor = NULL; +ScriptEditor *ScriptEditor::script_editor = nullptr; /*** SCRIPT EDITOR ******/ @@ -321,7 +321,7 @@ void ScriptEditor::_set_execution(REF p_script, int p_line) { if (!se) continue; - if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { + if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { se->set_executing_line(p_line); } } @@ -337,7 +337,7 @@ void ScriptEditor::_clear_execution(REF p_script) { if (!se) continue; - if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { + if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) { se->clear_executing_line(); } } @@ -348,7 +348,7 @@ ScriptEditorBase *ScriptEditor::_get_current_editor() const { int selected = tab_container->get_current_tab(); if (selected < 0 || selected >= tab_container->get_child_count()) - return NULL; + return nullptr; return Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected)); } @@ -434,7 +434,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { Object::cast_to<ScriptEditorBase>(c)->ensure_focus(); Ref<Script> script = Object::cast_to<ScriptEditorBase>(c)->get_edited_resource(); - if (script != NULL) { + if (script != nullptr) { notify_script_changed(script); } @@ -575,7 +575,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { } Ref<Script> script = current->get_edited_resource(); - if (script != NULL) { + if (script != nullptr) { previous_scripts.push_back(script->get_path()); notify_script_close(script); } @@ -737,7 +737,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) { } Ref<TextFile> text_file = script; - if (text_file != NULL) { + if (text_file != nullptr) { se->apply_code(); _save_text_file(text_file, text_file->get_path()); break; @@ -775,7 +775,7 @@ void ScriptEditor::_reload_scripts() { } Ref<Script> script = edited_res; - if (script != NULL) { + if (script != nullptr) { Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), true); ERR_CONTINUE(!rel_script.is_valid()); script->set_source_code(rel_script->get_source_code()); @@ -784,7 +784,7 @@ void ScriptEditor::_reload_scripts() { } Ref<TextFile> text_file = edited_res; - if (text_file != NULL) { + if (text_file != nullptr) { Error err; Ref<TextFile> rel_text_file = _load_text_file(text_file->get_path(), &err); ERR_CONTINUE(!rel_text_file.is_valid()); @@ -961,9 +961,9 @@ Ref<Script> ScriptEditor::_get_current_script() { if (current) { Ref<Script> script = current->get_edited_resource(); - return script != NULL ? script : NULL; + return script != nullptr ? script : nullptr; } else { - return NULL; + return nullptr; } } @@ -1093,11 +1093,6 @@ void ScriptEditor::_menu_option(int p_option) { OS::get_singleton()->shell_open("https://docs.godotengine.org/"); } break; - case REQUEST_DOCS: { - - OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues/new"); - } break; - case WINDOW_NEXT: { _history_forward(); @@ -1145,7 +1140,7 @@ void ScriptEditor::_menu_option(int p_option) { } Ref<TextFile> text_file = current->get_edited_resource(); - if (text_file != NULL) { + if (text_file != nullptr) { current->apply_code(); _save_text_file(text_file, text_file->get_path()); break; @@ -1169,7 +1164,7 @@ void ScriptEditor::_menu_option(int p_option) { } Ref<TextFile> text_file = current->get_edited_resource(); - if (text_file != NULL) { + if (text_file != nullptr) { file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = FILE_SAVE_AS; @@ -1198,7 +1193,7 @@ void ScriptEditor::_menu_option(int p_option) { case FILE_RUN: { Ref<Script> scr = current->get_edited_resource(); - if (scr == NULL || scr.is_null()) { + if (scr == nullptr || scr.is_null()) { EditorNode::get_singleton()->show_warning(TTR("Can't obtain the script for running.")); break; } @@ -1248,7 +1243,7 @@ void ScriptEditor::_menu_option(int p_option) { file_system_dock->navigate_to_path(path); // Ensure that the FileSystem dock is visible. TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_position_in_parent()); + tab_container->set_current_tab(file_system_dock->get_index()); } } break; case CLOSE_DOCS: { @@ -1398,7 +1393,6 @@ void ScriptEditor::_notification(int p_what) { help_search->set_icon(get_theme_icon("HelpSearch", "EditorIcons")); site_search->set_icon(get_theme_icon("Instance", "EditorIcons")); - request_docs->set_icon(get_theme_icon("Issue", "EditorIcons")); script_forward->set_icon(get_theme_icon("Forward", "EditorIcons")); script_back->set_icon(get_theme_icon("Back", "EditorIcons")); @@ -1467,7 +1461,7 @@ void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) { if (se) { Ref<Script> script = se->get_edited_resource(); - if (script == NULL || !script.is_valid()) + if (script == nullptr || !script.is_valid()) continue; if (script->get_path().find("::") != -1 && script->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed @@ -1500,7 +1494,7 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) { continue; Ref<Script> script = se->get_edited_resource(); - if (script == NULL) { + if (script == nullptr) { continue; } @@ -1992,7 +1986,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra const bool should_open = open_dominant || !EditorNode::get_singleton()->is_changing_scene(); - if (script != NULL && script->get_language()->overrides_external_editor()) { + if (script != nullptr && script->get_language()->overrides_external_editor()) { if (should_open) { Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col); if (err != OK) @@ -2070,7 +2064,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra if (!se) continue; - if ((script != NULL && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) { + if ((script != nullptr && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) { if (should_open) { if (tab_container->get_current_tab() != i) { @@ -2092,7 +2086,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra // doesn't have it, make a new one - ScriptEditorBase *se = NULL; + ScriptEditorBase *se = nullptr; for (int i = script_editor_func_count - 1; i >= 0; i--) { se = script_editor_funcs[i](p_resource); @@ -2107,7 +2101,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra SyntaxHighlighter *highlighter = syntax_highlighters_funcs[i](); se->add_syntax_highlighter(highlighter); - if (script != NULL && !highlighter_set) { + if (script != nullptr && !highlighter_set) { List<String> languages = highlighter->get_supported_languages(); if (languages.find(script->get_language()->get_name())) { se->set_syntax_highlighter(highlighter); @@ -2188,7 +2182,7 @@ void ScriptEditor::save_all_scripts() { if (edited_res->get_path() != "" && edited_res->get_path().find("local://") == -1 && edited_res->get_path().find("::") == -1) { Ref<TextFile> text_file = edited_res; - if (text_file != NULL) { + if (text_file != nullptr) { _save_text_file(text_file, text_file->get_path()); continue; } @@ -2574,7 +2568,7 @@ void ScriptEditor::_make_script_list_context_menu() { context_menu->add_separator(); if (se) { Ref<Script> scr = se->get_edited_resource(); - if (scr != NULL) { + if (scr != nullptr) { context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/reload_script_soft"), FILE_TOOL_RELOAD_SOFT); if (!scr.is_null() && scr->is_tool()) { context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/run_file"), FILE_RUN); @@ -2831,7 +2825,7 @@ void ScriptEditor::_update_history_pos(int p_new_pos) { Object::cast_to<ScriptEditorBase>(n)->ensure_focus(); Ref<Script> script = Object::cast_to<ScriptEditorBase>(n)->get_edited_resource(); - if (script != NULL) { + if (script != nullptr) { notify_script_changed(script); } } @@ -2872,7 +2866,7 @@ Vector<Ref<Script>> ScriptEditor::get_open_scripts() const { continue; Ref<Script> script = se->get_edited_resource(); - if (script != NULL) { + if (script != nullptr) { out_scripts.push_back(script); } } @@ -3260,12 +3254,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(site_search); site_search->set_tooltip(TTR("Open Godot online documentation.")); - request_docs = memnew(ToolButton); - request_docs->set_text(TTR("Request Docs")); - request_docs->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(REQUEST_DOCS)); - menu_hb->add_child(request_docs); - request_docs->set_tooltip(TTR("Help improve the Godot documentation by giving feedback.")); - help_search = memnew(ToolButton); help_search->set_text(TTR("Search Help")); help_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_HELP)); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index ec598f0b42..e895867268 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -159,7 +159,6 @@ class ScriptEditor : public PanelContainer { REPLACE_IN_FILES, SEARCH_HELP, SEARCH_WEBSITE, - REQUEST_DOCS, HELP_SEARCH_FIND, HELP_SEARCH_FIND_NEXT, HELP_SEARCH_FIND_PREVIOUS, @@ -204,7 +203,6 @@ class ScriptEditor : public PanelContainer { Button *help_search; Button *site_search; - Button *request_docs; EditorHelpSearch *help_search_dialog; ItemList *script_list; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 2e95bb92f4..4b8383e1e5 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -747,7 +747,7 @@ static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, c static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) { if (p_current->get_owner() != p_base && p_base != p_current) - return NULL; + return nullptr; Ref<Script> c = p_current->get_script(); if (c == p_script) return p_current; @@ -757,7 +757,7 @@ static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Scri return found; } - return NULL; + return nullptr; } static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, Set<Ref<Script>> &r_scripts) { @@ -999,7 +999,7 @@ void ScriptTextEditor::_validate_symbol(const String &p_symbol) { } void ScriptTextEditor::update_toggle_scripts_button() { - if (code_editor != NULL) { + if (code_editor != nullptr) { code_editor->update_toggle_scripts_button(); } } @@ -1436,7 +1436,7 @@ void ScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { TextEdit *te = code_editor->get_text_edit(); te->_set_syntax_highlighting(p_highlighter); - if (p_highlighter != NULL) + if (p_highlighter != nullptr) highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true); else highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(TTR("Standard")), true); @@ -1444,7 +1444,7 @@ void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) void ScriptTextEditor::_change_syntax_highlighter(int p_idx) { Map<String, SyntaxHighlighter *>::Element *el = highlighters.front(); - while (el != NULL) { + while (el != nullptr) { highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false); el = el->next(); } @@ -1517,7 +1517,7 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) { if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) - return NULL; + return nullptr; Ref<Script> scr = p_current_node->get_script(); @@ -1530,7 +1530,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const return n; } - return NULL; + return nullptr; } void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { @@ -1877,7 +1877,7 @@ ScriptTextEditor::ScriptTextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE); convert_case->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); - highlighters[TTR("Standard")] = NULL; + highlighters[TTR("Standard")] = nullptr; highlighter_menu = memnew(PopupMenu); highlighter_menu->set_name("highlighter_menu"); edit_menu->get_popup()->add_child(highlighter_menu); @@ -1944,7 +1944,7 @@ ScriptTextEditor::ScriptTextEditor() { ScriptTextEditor::~ScriptTextEditor() { for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) { - if (E->get() != NULL) { + if (E->get() != nullptr) { memdelete(E->get()); } } @@ -1956,7 +1956,7 @@ static ScriptEditorBase *create_editor(const RES &p_resource) { if (Object::cast_to<Script>(*p_resource)) { return memnew(ScriptTextEditor); } - return NULL; + return nullptr; } void ScriptTextEditor::register_editor() { diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 29ebfc8f7a..2a36700105 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -716,7 +716,7 @@ void ShaderEditorPlugin::edit(Object *p_object) { bool ShaderEditorPlugin::handles(Object *p_object) const { Shader *shader = Object::cast_to<Shader>(p_object); - return shader != NULL && shader->is_text_shader(); + return shader != nullptr && shader->is_text_shader(); } void ShaderEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index 96b2e56538..c81d3f787e 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -38,7 +38,7 @@ void Skeleton2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; options->hide(); } } @@ -131,7 +131,7 @@ void Skeleton2DEditorPlugin::make_visible(bool p_visible) { } else { sprite_editor->options->hide(); - sprite_editor->edit(NULL); + sprite_editor->edit(nullptr); } } diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index ae289dae4b..fac4cb19d8 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -144,7 +144,7 @@ void Skeleton3DEditor::_notification(int p_what) { void Skeleton3DEditor::_node_removed(Node *p_node) { if (p_node == skeleton) { - skeleton = NULL; + skeleton = nullptr; options->hide(); } } @@ -153,7 +153,7 @@ void Skeleton3DEditor::_bind_methods() { } Skeleton3DEditor::Skeleton3DEditor() { - skeleton = NULL; + skeleton = nullptr; options = memnew(MenuButton); Node3DEditor::get_singleton()->add_control_to_menu_panel(options); @@ -182,7 +182,7 @@ void Skeleton3DEditorPlugin::make_visible(bool p_visible) { } else { skeleton_editor->options->hide(); - skeleton_editor->edit(NULL); + skeleton_editor->edit(nullptr); } } diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 606e04bb79..2ba5a817bc 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -49,7 +49,7 @@ class Skeleton3DEditor : public Node { PhysicalBone3D *physical_bone; Transform relative_rest; // Relative to skeleton node BoneInfo() : - physical_bone(NULL) {} + physical_bone(nullptr) {} }; Skeleton3D *skeleton; diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp index 4b6a86bb5a..a22534eac0 100644 --- a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp @@ -90,7 +90,7 @@ SkeletonIK3DEditorPlugin::SkeletonIK3DEditorPlugin(EditorNode *p_node) { play_btn->hide(); play_btn->connect("pressed", callable_mp(this, &SkeletonIK3DEditorPlugin::_play)); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn); - skeleton_ik = NULL; + skeleton_ik = nullptr; } SkeletonIK3DEditorPlugin::~SkeletonIK3DEditorPlugin() {} diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index ce994ee6c7..ab0f15d3d0 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -42,7 +42,7 @@ void Sprite2DEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; options->hide(); } } @@ -593,7 +593,7 @@ void Sprite2DEditorPlugin::make_visible(bool p_visible) { } else { sprite_editor->options->hide(); - sprite_editor->edit(NULL); + sprite_editor->edit(nullptr); } } diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 41db0308c2..fbb6616dea 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -34,7 +34,7 @@ bool EditorInspectorPluginStyleBox::can_handle(Object *p_object) { - return Object::cast_to<StyleBox>(p_object) != NULL; + return Object::cast_to<StyleBox>(p_object) != nullptr; } void EditorInspectorPluginStyleBox::parse_begin(Object *p_object) { diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index aa86c48af1..2786a568ea 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -41,7 +41,7 @@ void TextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) { void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { TextEdit *te = code_editor->get_text_edit(); te->_set_syntax_highlighting(p_highlighter); - if (p_highlighter != NULL) { + if (p_highlighter != nullptr) { highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true); } else { highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text("Standard"), true); @@ -49,7 +49,7 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { // little work around. GDScript highlighter goes through text_edit for colours, // so to remove all colours we need to set and unset them here. - if (p_highlighter == NULL) { // standard + if (p_highlighter == nullptr) { // standard TextEdit *text_edit = code_editor->get_text_edit(); text_edit->add_theme_color_override("number_color", colors_cache.font_color); text_edit->add_theme_color_override("function_color", colors_cache.font_color); @@ -62,7 +62,7 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { void TextEditor::_change_syntax_highlighter(int p_idx) { Map<String, SyntaxHighlighter *>::Element *el = highlighters.front(); - while (el != NULL) { + while (el != nullptr) { highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false); el = el->next(); } @@ -533,7 +533,7 @@ static ScriptEditorBase *create_editor(const RES &p_resource) { if (Object::cast_to<TextFile>(*p_resource)) { return memnew(TextEditor); } - return NULL; + return nullptr; } void TextEditor::register_editor() { @@ -694,7 +694,7 @@ TextEditor::TextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE); convert_case->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); - highlighters["Standard"] = NULL; + highlighters["Standard"] = nullptr; highlighter_menu = memnew(PopupMenu); highlighter_menu->set_name("highlighter_menu"); edit_menu->get_popup()->add_child(highlighter_menu); @@ -727,7 +727,7 @@ TextEditor::TextEditor() { TextEditor::~TextEditor() { for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) { - if (E->get() != NULL) { + if (E->get() != nullptr) { memdelete(E->get()); } } diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 3f76854571..c1184c1c89 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -144,7 +144,7 @@ TextureEditor::~TextureEditor() { // bool EditorInspectorPluginTexture::can_handle(Object *p_object) { - return Object::cast_to<ImageTexture>(p_object) != NULL || Object::cast_to<AtlasTexture>(p_object) != NULL || Object::cast_to<StreamTexture>(p_object) != NULL || Object::cast_to<LargeTexture>(p_object) != NULL || Object::cast_to<AnimatedTexture>(p_object) != NULL; + return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<StreamTexture>(p_object) != nullptr || Object::cast_to<LargeTexture>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr; } void EditorInspectorPluginTexture::parse_begin(Object *p_object) { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index d453598e33..8892d13f51 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -49,7 +49,7 @@ void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) { } void TextureRegionEditor::_region_draw() { - Ref<Texture2D> base_tex = NULL; + Ref<Texture2D> base_tex = nullptr; if (node_sprite) base_tex = node_sprite->get_texture(); else if (node_sprite_3d) @@ -672,7 +672,7 @@ void TextureRegionEditor::_update_autoslice() { autoslice_is_dirty = false; autoslice_cache.clear(); - Ref<Texture2D> texture = NULL; + Ref<Texture2D> texture = nullptr; if (node_sprite) texture = node_sprite->get_texture(); else if (node_sprite_3d) @@ -767,11 +767,11 @@ void TextureRegionEditor::_notification(int p_what) { void TextureRegionEditor::_node_removed(Object *p_obj) { if (p_obj == node_sprite || p_obj == node_sprite_3d || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) { - node_sprite = NULL; - node_sprite_3d = NULL; - node_ninepatch = NULL; - obj_styleBox = Ref<StyleBox>(NULL); - atlas_tex = Ref<AtlasTexture>(NULL); + node_sprite = nullptr; + node_sprite_3d = nullptr; + node_ninepatch = nullptr; + obj_styleBox = Ref<StyleBox>(nullptr); + atlas_tex = Ref<AtlasTexture>(nullptr); hide(); } } @@ -793,7 +793,7 @@ bool TextureRegionEditor::is_atlas_texture() { } bool TextureRegionEditor::is_ninepatch() { - return node_ninepatch != NULL; + return node_ninepatch != nullptr; } Sprite3D *TextureRegionEditor::get_sprite_3d() { @@ -826,11 +826,11 @@ void TextureRegionEditor::edit(Object *p_obj) { p_obj->add_change_receptor(this); _edit_region(); } else { - node_sprite = NULL; - node_sprite_3d = NULL; - node_ninepatch = NULL; - obj_styleBox = Ref<StyleBoxTexture>(NULL); - atlas_tex = Ref<AtlasTexture>(NULL); + node_sprite = nullptr; + node_sprite_3d = nullptr; + node_ninepatch = nullptr; + obj_styleBox = Ref<StyleBoxTexture>(nullptr); + atlas_tex = Ref<AtlasTexture>(nullptr); } edit_draw->update(); if ((node_sprite && !node_sprite->is_region()) || (node_sprite_3d && !node_sprite_3d->is_region())) { @@ -850,7 +850,7 @@ void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_pro } void TextureRegionEditor::_edit_region() { - Ref<Texture2D> texture = NULL; + Ref<Texture2D> texture = nullptr; if (node_sprite) texture = node_sprite->get_texture(); else if (node_sprite_3d) @@ -896,11 +896,11 @@ Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const { } TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { - node_sprite = NULL; - node_sprite_3d = NULL; - node_ninepatch = NULL; - obj_styleBox = Ref<StyleBoxTexture>(NULL); - atlas_tex = Ref<AtlasTexture>(NULL); + node_sprite = nullptr; + node_sprite_3d = nullptr; + node_ninepatch = nullptr; + obj_styleBox = Ref<StyleBoxTexture>(nullptr); + atlas_tex = Ref<AtlasTexture>(nullptr); editor = p_editor; undo_redo = editor->get_undo_redo(); @@ -1030,6 +1030,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { hscroll->connect("value_changed", callable_mp(this, &TextureRegionEditor::_scroll_changed)); updating_scroll = false; + autoslice_is_dirty = true; } void TextureRegionEditorPlugin::edit(Object *p_object) { @@ -1057,7 +1058,7 @@ void TextureRegionEditorPlugin::make_visible(bool p_visible) { manually_hidden = false; } texture_region_button->hide(); - region_editor->edit(NULL); + region_editor->edit(nullptr); } } diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 6fa7955ee5..ce421ac0a5 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -41,7 +41,7 @@ void TileMapEditor::_node_removed(Node *p_node) { if (p_node == node) { - node = NULL; + node = nullptr; } } @@ -639,7 +639,7 @@ Vector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, if (r != bucket_cache_rect) _clear_bucket_cache(); // Cache grid is not initialized - if (bucket_cache_visited == NULL) { + if (bucket_cache_visited == nullptr) { bucket_cache_visited = new bool[area]; invalidate_cache = true; } @@ -906,7 +906,7 @@ void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Po void TileMapEditor::_clear_bucket_cache() { if (bucket_cache_visited) { delete[] bucket_cache_visited; - bucket_cache_visited = NULL; + bucket_cache_visited = nullptr; } } @@ -1785,7 +1785,7 @@ void TileMapEditor::edit(Node *p_tile_map) { _update_palette(); } else { - node = NULL; + node = nullptr; if (canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter))) canvas_item_editor_viewport->disconnect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)); @@ -1901,11 +1901,11 @@ void TileMapEditor::_clear_transform() { TileMapEditor::TileMapEditor(EditorNode *p_editor) { - node = NULL; + node = nullptr; manual_autotile = false; priority_atlastile = false; manual_position = Vector2(0, 0); - canvas_item_editor_viewport = NULL; + canvas_item_editor_viewport = nullptr; editor = p_editor; undo_redo = EditorNode::get_undo_redo(); @@ -1918,7 +1918,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { transpose = false; bucket_cache_tile = -1; - bucket_cache_visited = NULL; + bucket_cache_visited = nullptr; invalid_cell.resize(1); invalid_cell.write[0] = TileMap::INVALID_CELL; @@ -2154,7 +2154,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { tile_map_editor->get_toolbar()->hide(); tile_map_editor->get_toolbar_right()->hide(); tile_map_editor->get_tile_info()->hide(); - tile_map_editor->edit(NULL); + tile_map_editor->edit(nullptr); } } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index f479139e4d..d1dda68c1d 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -725,7 +725,7 @@ void TileSetEditor::_on_texture_list_selected(int p_index) { update_workspace_minsize(); } else { current_item_index = -1; - preview->set_texture(NULL); + preview->set_texture(nullptr); workspace->set_custom_minimum_size(Size2i()); update_workspace_tile_mode(); } @@ -3003,7 +3003,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) { } } if (!found_collision_shape) - _set_edited_collision_shape(Ref<ConvexPolygonShape2D>(NULL)); + _set_edited_collision_shape(Ref<ConvexPolygonShape2D>(nullptr)); if (edited_occlusion_shape != tileset->autotile_get_light_occluder(get_current_tile(), coord)) edited_occlusion_shape = tileset->autotile_get_light_occluder(get_current_tile(), coord); if (edited_navigation_shape != tileset->autotile_get_navigation_polygon(get_current_tile(), coord)) diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 3998a3233b..fe8392593b 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" -VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = NULL; +VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = nullptr; void VersionControlEditorPlugin::_bind_methods() { @@ -171,7 +171,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() { for (int i = 0; i < modified_file_paths.size(); i++) { file_path = modified_file_paths.get_key_at_index(i); - TreeItem *found = stage_files->search_item_text(file_path, 0, true); + TreeItem *found = stage_files->search_item_text(file_path, nullptr, true); if (!found) { ChangeType change_index = (ChangeType)(int)modified_file_paths.get_value_at_index(i); @@ -385,7 +385,7 @@ void VersionControlEditorPlugin::shut_down() { } EditorVCSInterface::get_singleton()->shut_down(); memdelete(EditorVCSInterface::get_singleton()); - EditorVCSInterface::set_singleton(NULL); + EditorVCSInterface::set_singleton(nullptr); EditorNode::get_singleton()->remove_control_from_dock(version_commit_dock); EditorNode::get_singleton()->remove_bottom_panel_item(version_control_dock); @@ -438,7 +438,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_choice->connect("item_selected", callable_mp(this, &VersionControlEditorPlugin::_selected_a_vcs)); set_up_hbc->add_child(set_up_choice); - set_up_init_settings = NULL; + set_up_init_settings = nullptr; set_up_init_button = memnew(Button); set_up_init_button->set_text(TTR("Initialize")); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 594dc400ec..294ce2c4cd 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -52,7 +52,7 @@ Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_res if (get_script_instance()) { return get_script_instance()->call("create_editor", p_parent_resource, p_node); } - return NULL; + return nullptr; } void VisualShaderNodePlugin::_bind_methods() { @@ -352,7 +352,7 @@ void VisualShaderEditor::_update_options_menu() { for (int i = 0; i < options.size(); i++) { String path = options[i].category; Vector<String> subfolders = path.split("/"); - TreeItem *category = NULL; + TreeItem *category = nullptr; if (!folders.has(path)) { category = root; @@ -536,7 +536,7 @@ void VisualShaderEditor::_update_graph() { node->connect("dragged", callable_mp(this, &VisualShaderEditor::_node_dragged), varray(nodes[n_i])); - Control *custom_editor = NULL; + Control *custom_editor = nullptr; int port_offset = 0; if (is_group) { @@ -556,6 +556,17 @@ void VisualShaderEditor::_update_graph() { uniform_name->connect("text_entered", callable_mp(this, &VisualShaderEditor::_line_edit_changed), varray(uniform_name, nodes[n_i])); uniform_name->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_line_edit_focus_out), varray(uniform_name, nodes[n_i])); + String error = vsnode->get_warning(visual_shader->get_mode(), type); + if (error != String()) { + offset = memnew(Control); + offset->set_custom_minimum_size(Size2(0, 4 * EDSCALE)); + node->add_child(offset); + Label *error_label = memnew(Label); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + error_label->set_text(error); + node->add_child(error_label); + } + if (vsnode->get_input_port_count() == 0 && vsnode->get_output_port_count() == 1 && vsnode->get_output_port_name(0) == "") { //shortcut VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0); @@ -584,7 +595,7 @@ void VisualShaderEditor::_update_graph() { custom_editor->call_deferred("_show_prop_names", true); continue; } - custom_editor = NULL; + custom_editor = nullptr; } if (is_group) { @@ -1087,7 +1098,7 @@ void VisualShaderEditor::_expression_focus_out(Object *text_edit, int p_node) { } void VisualShaderEditor::_rebuild() { - if (visual_shader != NULL) { + if (visual_shader != nullptr) { EditorNode::get_singleton()->get_log()->clear(); visual_shader->rebuild(); } @@ -1111,7 +1122,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p group_node->set_size(size); - GraphNode *gn = NULL; + GraphNode *gn = nullptr; if (edit_type->get_selected() == p_type) { // check - otherwise the error will be emitted Node *node2 = graph->get_node(itos(p_node)); gn = Object::cast_to<GraphNode>(node2); @@ -1126,7 +1137,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p if (!expression_node.is_null()) { Control *text_box = expression_node->get_control(0); Size2 box_size = size; - if (gn != NULL) { + if (gn != nullptr) { if (box_size.x < 150 * EDSCALE || box_size.y < 0) { box_size.x = gn->get_size().x; } @@ -1274,7 +1285,7 @@ void VisualShaderEditor::_edit_port_default_input(Object *p_button, int p_node, ERR_FAIL_COND(!button); Variant value = vsn->get_input_port_default_value(p_port); property_editor->set_position(button->get_screen_position() + Vector2(0, button->get_size().height)); - property_editor->edit(NULL, "", value.get_type(), value, 0, ""); + property_editor->edit(nullptr, "", value.get_type(), value, 0, ""); property_editor->popup(); editing_node = p_node; editing_port = p_port; @@ -1304,7 +1315,7 @@ void VisualShaderEditor::_add_texture_node(const String &p_path) { VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) { - ERR_FAIL_INDEX_V(p_idx, add_options.size(), NULL); + ERR_FAIL_INDEX_V(p_idx, add_options.size(), nullptr); Ref<VisualShaderNode> vsnode; @@ -1312,7 +1323,7 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) { if (!is_custom && add_options[p_idx].type != String()) { VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instance(add_options[p_idx].type)); - ERR_FAIL_COND_V(!vsn, NULL); + ERR_FAIL_COND_V(!vsn, nullptr); VisualShaderNodeFloatConstant *constant = Object::cast_to<VisualShaderNodeFloatConstant>(vsn); @@ -1410,10 +1421,10 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) { vsnode = Ref<VisualShaderNode>(vsn); } else { - ERR_FAIL_COND_V(add_options[p_idx].script.is_null(), NULL); + ERR_FAIL_COND_V(add_options[p_idx].script.is_null(), nullptr); String base_type = add_options[p_idx].script->get_instance_base_type(); VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instance(base_type)); - ERR_FAIL_COND_V(!vsn, NULL); + ERR_FAIL_COND_V(!vsn, nullptr); vsnode = Ref<VisualShaderNode>(vsn); vsnode->set_script(add_options[p_idx].script); } @@ -2068,7 +2079,7 @@ void VisualShaderEditor::_member_filter_changed(const String &p_text) { void VisualShaderEditor::_member_selected() { TreeItem *item = members->get_selected(); - if (item != NULL && item->has_meta("id")) { + if (item != nullptr && item->has_meta("id")) { members_dialog->get_ok()->set_disabled(false); highend_label->set_visible(add_options[item->get_meta("id")].highend); node_desc->set_text(_get_description(item->get_meta("id"))); @@ -2084,7 +2095,7 @@ void VisualShaderEditor::_member_unselected() { void VisualShaderEditor::_member_create() { TreeItem *item = members->get_selected(); - if (item != NULL && item->has_meta("id")) { + if (item != nullptr && item->has_meta("id")) { int idx = members->get_selected()->get_meta("id"); _add_node(idx, add_options[idx].sub_func); members_dialog->hide(); @@ -2298,7 +2309,7 @@ void VisualShaderEditor::_bind_methods() { ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available); } -VisualShaderEditor *VisualShaderEditor::singleton = NULL; +VisualShaderEditor *VisualShaderEditor::singleton = nullptr; VisualShaderEditor::VisualShaderEditor() { @@ -3129,7 +3140,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par Vector<StringName> properties = p_node->get_editable_properties(); if (properties.size() == 0) { - return NULL; + return nullptr; } List<PropertyInfo> props; @@ -3147,7 +3158,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par } if (pinfo.size() == 0) - return NULL; + return nullptr; properties.clear(); @@ -3158,7 +3169,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par EditorProperty *prop = EditorInspector::instantiate_property_editor(node.ptr(), pinfo[i].type, pinfo[i].name, pinfo[i].hint, pinfo[i].hint_string, pinfo[i].usage); if (!prop) - return NULL; + return nullptr; if (Object::cast_to<EditorPropertyResource>(prop)) { Object::cast_to<EditorPropertyResource>(prop)->set_use_sub_inspector(false); |