diff options
Diffstat (limited to 'editor')
176 files changed, 1248 insertions, 1185 deletions
diff --git a/editor/SCsub b/editor/SCsub index 72a168efe2..13ae85bbf0 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -19,7 +19,7 @@ def _make_doc_data_class_path(to_path): g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n") for c in sorted(env.doc_class_path): g.write('\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n') - g.write("\t{NULL, NULL}\n") + g.write("\t{nullptr, nullptr}\n") g.write("};\n") g.close() diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index f3e3025e81..e6a020bf41 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -277,7 +277,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { { NodePath path = animation->track_get_path(track); - Node *node = NULL; + Node *node = nullptr; if (root && root->has_node(path)) { node = root->get_node(path); @@ -1162,11 +1162,11 @@ void AnimationBezierTrackEdit::_bind_methods() { } AnimationBezierTrackEdit::AnimationBezierTrackEdit() { - undo_redo = NULL; - timeline = NULL; - root = NULL; - menu = NULL; - block_animation_update_ptr = NULL; + undo_redo = nullptr; + timeline = nullptr; + root = nullptr; + menu = nullptr; + block_animation_update_ptr = nullptr; moving_selection_attempt = false; moving_selection = false; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 4f06a753a7..f10e439f10 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -242,7 +242,7 @@ public: args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err); } else { - args.write[idx] = Variant::construct(t, NULL, 0, err); + args.write[idx] = Variant::construct(t, nullptr, 0, err); } change_notify_deserved = true; d_new["args"] = args; @@ -693,7 +693,7 @@ public: key_ofs = 0; track = -1; setting = false; - root_path = NULL; + root_path = nullptr; } }; @@ -905,7 +905,7 @@ public: args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err); } else { - args.write[idx] = Variant::construct(t, NULL, 0, err); + args.write[idx] = Variant::construct(t, nullptr, 0, err); } change_notify_deserved = true; d_new["args"] = args; @@ -1389,7 +1389,7 @@ public: AnimationMultiTrackKeyEdit() { use_fps = false; setting = false; - root_path = NULL; + root_path = nullptr; } }; @@ -1402,7 +1402,7 @@ void AnimationTimelineEdit::_zoom_changed(double) { float AnimationTimelineEdit::get_zoom_scale() const { - float zv = zoom->get_value(); + float zv = zoom->get_max() - zoom->get_value(); if (zv < 1) { zv = 1.0 - zv; return Math::pow(1.0f + zv, 8.0f) * 100; @@ -1859,7 +1859,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { use_fps = false; editing = false; name_limit = 150 * EDSCALE; - zoom = NULL; + zoom = nullptr; play_position_pos = 0; play_position = memnew(Control); @@ -1958,7 +1958,7 @@ void AnimationTrackEdit::_notification(int p_what) { ofs += type_icon->get_width() + hsep; NodePath path = animation->track_get_path(track); - Node *node = NULL; + Node *node = nullptr; if (root && root->has_node(path)) { node = root->get_node(path); } @@ -2483,7 +2483,7 @@ bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant Vector<StringName> leftover_path; Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path); - Object *obj = NULL; + Object *obj = nullptr; if (res.is_valid()) { obj = res.ptr(); } else if (node) { @@ -3090,12 +3090,12 @@ void AnimationTrackEdit::_bind_methods() { } AnimationTrackEdit::AnimationTrackEdit() { - undo_redo = NULL; - timeline = NULL; - root = NULL; - path = NULL; - path_popup = NULL; - menu = NULL; + undo_redo = nullptr; + timeline = nullptr; + root = nullptr; + path = nullptr; + path_popup = nullptr; + menu = nullptr; clicking_on_name = false; dropping_at = 0; @@ -3140,7 +3140,7 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_value_track_edit(Object *p_ Callable::CallError ce; return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_value_track_edit", (const Variant **)&argptrs, 6, ce).operator Object *()); } - return NULL; + return nullptr; } AnimationTrackEdit *AnimationTrackEditPlugin::create_audio_track_edit() { @@ -3148,14 +3148,14 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_audio_track_edit() { if (get_script_instance()) { return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_audio_track_edit").operator Object *()); } - return NULL; + return nullptr; } AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object *p_object) { if (get_script_instance()) { return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_animation_track_edit", p_object).operator Object *()); } - return NULL; + return nullptr; } /////////////////////////////////////// @@ -3304,7 +3304,7 @@ Ref<Animation> AnimationTrackEditor::get_current_animation() const { } void AnimationTrackEditor::_root_removed(Node *p_root) { - root = NULL; + root = nullptr; } void AnimationTrackEditor::set_root(Node *p_root) { @@ -3902,7 +3902,7 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b return PropertyInfo(); } -static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool *r_valid = NULL) { +static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool *r_valid = nullptr) { Vector<String> subindices; if (r_valid) { *r_valid = true; @@ -4123,7 +4123,7 @@ void AnimationTrackEditor::_update_tracks() { bool use_filter = selected_filter->is_pressed(); for (int i = 0; i < animation->get_track_count(); i++) { - AnimationTrackEdit *track_edit = NULL; + AnimationTrackEdit *track_edit = nullptr; //find hint and info for plugin @@ -4184,7 +4184,7 @@ void AnimationTrackEditor::_update_tracks() { if (animation->track_get_type(i) == Animation::TYPE_ANIMATION) { NodePath path = animation->track_get_path(i); - Node *node = NULL; + Node *node = nullptr; if (root && root->has_node(path)) { node = root->get_node(path); } @@ -4199,7 +4199,7 @@ void AnimationTrackEditor::_update_tracks() { } } - if (track_edit == NULL) { + if (track_edit == nullptr) { //no valid plugin_found track_edit = memnew(AnimationTrackEdit); } @@ -4752,7 +4752,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) { params.push_back(arg); } else { Callable::CallError ce; - Variant arg = Variant::construct(E->get().arguments[i].type, NULL, 0, ce); + Variant arg = Variant::construct(E->get().arguments[i].type, nullptr, 0, ce); params.push_back(arg); } } @@ -4838,21 +4838,21 @@ void AnimationTrackEditor::_clear_key_edit() { if (key_edit) { //if key edit is the object being inspected, remove it first if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) { - EditorNode::get_singleton()->push_item(NULL); + EditorNode::get_singleton()->push_item(nullptr); } //then actually delete it memdelete(key_edit); - key_edit = NULL; + key_edit = nullptr; } if (multi_key_edit) { if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) { - EditorNode::get_singleton()->push_item(NULL); + EditorNode::get_singleton()->push_item(nullptr); } memdelete(multi_key_edit); - multi_key_edit = NULL; + multi_key_edit = nullptr; } } @@ -5264,7 +5264,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { for (int i = 0; i < animation->get_track_count(); i++) { NodePath path = animation->track_get_path(i); - Node *node = NULL; + Node *node = nullptr; if (root && root->has_node(path)) { node = root->get_node(path); @@ -5361,7 +5361,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { undo_redo->create_action(TTR("Paste Tracks")); for (int i = 0; i < track_clipboard.size(); i++) { undo_redo->add_do_method(animation.ptr(), "add_track", track_clipboard[i].track_type); - Node *exists = NULL; + Node *exists = nullptr; NodePath path = track_clipboard[i].base_path; if (root) { @@ -5607,7 +5607,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) { bool prop_exists = false; Variant::Type valid_type = Variant::NIL; - Object *obj = NULL; + Object *obj = nullptr; RES res; Vector<StringName> leftover_path; @@ -5753,7 +5753,7 @@ void AnimationTrackEditor::_bind_methods() { } AnimationTrackEditor::AnimationTrackEditor() { - root = NULL; + root = nullptr; undo_redo = EditorNode::get_singleton()->get_undo_redo(); @@ -5945,8 +5945,8 @@ AnimationTrackEditor::AnimationTrackEditor() { icvb->add_child(insert_confirm_bezier); keying = false; moving_selection = 0; - key_edit = NULL; - multi_key_edit = NULL; + key_edit = nullptr; + multi_key_edit = nullptr; box_selection = memnew(Control); add_child(box_selection); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 7c4cc6db53..96a60cc135 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -379,7 +379,7 @@ class AnimationTrackEditor : public VBoxContainer { void _root_removed(Node *p_root); - PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = NULL); + PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr); void _timeline_value_changed(double); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 4467366c3f..695c294ad2 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -1335,7 +1335,7 @@ AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_value_track_edit(Obj return memnew(AnimationTrackEditColor); } - return NULL; + return nullptr; } AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_audio_track_edit() { diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index f14b12b132..9f6785ec06 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -43,7 +43,7 @@ Variant ArrayPropertyEdit::get_array() const { Variant arr = o->get(property); if (!arr.is_array()) { Callable::CallError ce; - arr = Variant::construct(default_type, NULL, 0, ce); + arr = Variant::construct(default_type, nullptr, 0, ce); } return arr; } @@ -110,7 +110,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) { new_type = arr.get(size - 1).get_type(); } if (new_type != Variant::NIL) { - init = Variant::construct(new_type, NULL, 0, ce); + init = Variant::construct(new_type, nullptr, 0, ce); for (int i = size; i < newsize; i++) { ur->add_do_method(this, "_set_value", i, init); } @@ -140,7 +140,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) { Variant value = arr.get(idx); if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) { Callable::CallError ce; - Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce); + Variant new_value = Variant::construct(Variant::Type(type), nullptr, 0, ce); UndoRedo *ur = EditorNode::get_undo_redo(); ur->create_action(TTR("Change Array Value Type")); diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp index 64d435a901..fe28c913a7 100644 --- a/editor/audio_stream_preview.cpp +++ b/editor/audio_stream_preview.cpp @@ -212,7 +212,7 @@ void AudioStreamPreviewGenerator::_bind_methods() { ADD_SIGNAL(MethodInfo("preview_updated", PropertyInfo(Variant::INT, "obj_id"))); } -AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = NULL; +AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr; void AudioStreamPreviewGenerator::_notification(int p_what) { if (p_what == NOTIFICATION_PROCESS) { @@ -221,7 +221,7 @@ void AudioStreamPreviewGenerator::_notification(int p_what) { if (!E->get().generating) { if (E->get().thread) { Thread::wait_to_finish(E->get().thread); - E->get().thread = NULL; + E->get().thread = nullptr; } if (!ObjectDB::get_instance(E->key())) { //no longer in use, get rid of preview to_erase.push_back(E->key()); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 26bc6dfaf2..77e20b971c 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -82,7 +82,7 @@ GotoLineDialog::GotoLineDialog() { line = memnew(LineEdit); vbc->add_child(line); register_text_enter(line); - text_editor = NULL; + text_editor = nullptr; set_hide_on_ok(false); } @@ -226,6 +226,10 @@ void FindReplaceBar::_replace_all() { text_edit->begin_complex_operation(); + if (selection_enabled && is_selection_only()) { + text_edit->cursor_set_line(selection_begin.width); + text_edit->cursor_set_column(selection_begin.height); + } if (search_current()) { do { // replace area @@ -243,7 +247,7 @@ void FindReplaceBar::_replace_all() { if (selection_enabled && is_selection_only()) { if (match_from < selection_begin || match_to > selection_end) { - continue; + break; // Done. } // Replace but adjust selection bounds. @@ -289,6 +293,10 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { r_line = text_edit->cursor_get_line(); r_col = text_edit->cursor_get_column(); + if (text_edit->is_selection_active() && is_selection_only()) { + return; + } + if (r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) { r_col = result_col; } @@ -1656,7 +1664,7 @@ void CodeTextEditor::update_toggle_scripts_button() { CodeTextEditor::CodeTextEditor() { - code_complete_func = NULL; + code_complete_func = nullptr; ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL); ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS); ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD | KEY_0); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 7f03fd30f0..bef5c3c2b0 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -40,7 +40,7 @@ static Node *_find_first_script(Node *p_root, Node *p_node) { if (p_node != p_root && p_node->get_owner() != p_root) { - return NULL; + return nullptr; } if (!p_node->get_script().is_null()) { return p_node; @@ -54,7 +54,7 @@ static Node *_find_first_script(Node *p_root, Node *p_node) { } } - return NULL; + return nullptr; } class ConnectDialogBinds : public Object { @@ -315,7 +315,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) { source = static_cast<Node *>(c.source); signal = c.signal; - tree->set_selected(NULL); + tree->set_selected(nullptr); tree->set_marked(source, true); if (c.target) { @@ -574,7 +574,7 @@ void ConnectionsDock::_make_or_edit_connection() { } // IMPORTANT NOTE: _disconnect and _connect cause an update_tree, which will delete the object "it" is pointing to. - it = NULL; + it = nullptr; if (add_script_function) { editor->emit_signal("script_add_function_request", target, cToMake.method, script_function_args); @@ -924,7 +924,7 @@ void ConnectionsDock::update_tree() { icon = get_theme_icon("Object", "EditorIcons"); } - TreeItem *pitem = NULL; + TreeItem *pitem = nullptr; if (node_signals2.size()) { pitem = tree->create_item(root); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 8f29a4f720..91d0d5c32c 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -203,7 +203,7 @@ public: void set_node(Node *p_node); void update_tree(); - ConnectionsDock(EditorNode *p_editor = NULL); + ConnectionsDock(EditorNode *p_editor = nullptr); ~ConnectionsDock(); }; diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 6210b580ba..6cbb1b1791 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -314,7 +314,7 @@ void CreateDialog::_update_search() { root->set_icon(0, search_options->get_theme_icon(base_type, "EditorIcons")); } - TreeItem *to_select = search_box->get_text() == base_type ? root : NULL; + TreeItem *to_select = search_box->get_text() == base_type ? root : nullptr; for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) { @@ -417,7 +417,7 @@ void CreateDialog::_update_search() { favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1); } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void CreateDialog::_confirmed() { @@ -538,7 +538,7 @@ Object *CreateDialog::instance_selected() { } } - return NULL; + return nullptr; } void CreateDialog::_item_selected() { diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 9587daf93e..00ed2bbc4c 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -125,7 +125,7 @@ void EditorDebuggerInspector::_object_selected(ObjectID p_object) { } ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { - EditorDebuggerRemoteObject *debugObj = NULL; + EditorDebuggerRemoteObject *debugObj = nullptr; SceneDebuggerObject obj; obj.deserialize(p_arr); @@ -211,7 +211,7 @@ void EditorDebuggerInspector::clear_cache() { for (Map<ObjectID, EditorDebuggerRemoteObject *>::Element *E = remote_objects.front(); E; E = E->next()) { EditorNode *editor = EditorNode::get_singleton(); if (editor->get_editor_history()->get_current() == E->value()->get_instance_id()) { - editor->push_item(NULL); + editor->push_item(nullptr); } memdelete(E->value()); } @@ -221,7 +221,7 @@ void EditorDebuggerInspector::clear_cache() { Object *EditorDebuggerInspector::get_object(ObjectID p_id) { if (remote_objects.has(p_id)) return remote_objects[p_id]; - return NULL; + return nullptr; } void EditorDebuggerInspector::add_stack_variable(const Array &p_array) { diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5c9b977247..3302b50103 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -47,7 +47,7 @@ void _for_all(TabContainer *p_node, const Func &p_func) { } } -EditorDebuggerNode *EditorDebuggerNode::singleton = NULL; +EditorDebuggerNode *EditorDebuggerNode::singleton = nullptr; EditorDebuggerNode::EditorDebuggerNode() { if (!singleton) @@ -291,13 +291,13 @@ void EditorDebuggerNode::_notification(int p_what) { // Take connections. if (server->is_connection_available()) { - ScriptEditorDebugger *debugger = NULL; + ScriptEditorDebugger *debugger = nullptr; _for_all(tabs, [&](ScriptEditorDebugger *dbg) { if (debugger || dbg->is_session_active()) return; debugger = dbg; }); - if (debugger == NULL) { + if (debugger == nullptr) { if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active. debugger = _add_debugger(); } else { @@ -356,7 +356,7 @@ void EditorDebuggerNode::_debugger_changed(int p_tab) { if (get_inspected_remote_object()) { // Clear inspected object, you can only inspect objects in selected debugger. // Hopefully, in the future, we will have one inspector per debugger. - EditorNode::get_singleton()->push_item(NULL); + EditorNode::get_singleton()->push_item(nullptr); } if (remote_scene_tree->is_visible_in_tree()) { get_current_debugger()->request_remote_tree(); diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 6181ccdb5f..9467442c9a 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -85,9 +85,9 @@ private: }; Ref<EditorDebuggerServer> server; - TabContainer *tabs = NULL; - Button *debugger_button = NULL; - MenuButton *script_menu = NULL; + TabContainer *tabs = nullptr; + Button *debugger_button = nullptr; + MenuButton *script_menu = nullptr; Ref<Script> stack_script; // Why?!? @@ -95,7 +95,7 @@ private: int last_warning_count = 0; float inspect_edited_object_timeout = 0; - EditorDebuggerTree *remote_scene_tree = NULL; + EditorDebuggerTree *remote_scene_tree = nullptr; float remote_scene_tree_timeout = 0.0; bool auto_switch_remote_scene_tree = false; bool debug_with_external_editor = false; diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 427b929ccb..c2b94c79bb 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -135,7 +135,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Nodes are in a flatten list, depth first. Use a stack of parents, avoid recursion. List<Pair<TreeItem *, int>> parents; for (int i = 0; i < p_tree->nodes.size(); i++) { - TreeItem *parent = NULL; + TreeItem *parent = nullptr; if (parents.size()) { // Find last parent. Pair<TreeItem *, int> &p = parents[0]; parent = p.first; @@ -191,7 +191,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Check if parent expects more children. for (int j = 0; j < parents.size(); j++) { if (parents[j].first == item) { - parent = NULL; + parent = nullptr; break; // Might have more children. } } @@ -211,7 +211,7 @@ String EditorDebuggerTree::get_selected_path() { String EditorDebuggerTree::_get_path(TreeItem *p_item) { ERR_FAIL_COND_V(!p_item, ""); - if (p_item->get_parent() == NULL) { + if (p_item->get_parent() == nullptr) { return "/root"; } String text = p_item->get_text(0); diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index d9084bc596..342eb23194 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -50,8 +50,8 @@ private: int debugger_id = 0; bool updating_scene_tree = false; Set<ObjectID> unfold_cache; - PopupMenu *item_menu = NULL; - EditorFileDialog *file_dialog = NULL; + PopupMenu *item_menu = nullptr; + EditorFileDialog *file_dialog = nullptr; String _get_path(TreeItem *p_item); void _scene_tree_folded(Object *p_obj); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index bdb1ebd4d7..1971abadc4 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -138,7 +138,7 @@ void ScriptEditorDebugger::update_tabs() { } void ScriptEditorDebugger::clear_style() { - tabs->add_theme_style_override("panel", NULL); + tabs->add_theme_style_override("panel", nullptr); } void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) { @@ -923,7 +923,7 @@ void ScriptEditorDebugger::stop() { res_path_cache.clear(); profiler_signature.clear(); - inspector->edit(NULL); + inspector->edit(nullptr); _update_buttons_state(); } @@ -973,7 +973,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { msg.push_back(frame); _put_msg("get_stack_frame_vars", msg); } else { - inspector->edit(NULL); + inspector->edit(nullptr); } } diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index 7944d7cb99..9cb7dc2edf 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -107,7 +107,7 @@ private: Button *docontinue; // Reference to "Remote" tab in scene tree. Needed by _live_edit_set and buttons state. // Each debugger should have it's tree in the future I guess. - const Tree *editor_remote_tree = NULL; + const Tree *editor_remote_tree = nullptr; List<Vector<float>> perf_history; Vector<float> perf_max; @@ -255,7 +255,7 @@ public: bool is_skip_breakpoints(); virtual Size2 get_minimum_size() const; - ScriptEditorDebugger(EditorNode *p_editor = NULL); + ScriptEditorDebugger(EditorNode *p_editor = nullptr); ~ScriptEditorDebugger(); }; diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 8ba706d4b3..2302fb0780 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -592,7 +592,7 @@ void DependencyErrorDialog::show(Mode p_mode, const String &p_for_file, const Ve set_title(TTR("Error loading:") + " " + p_for_file.get_file()); files->clear(); - TreeItem *root = files->create_item(NULL); + TreeItem *root = files->create_item(nullptr); for (int i = 0; i < report.size(); i++) { String dep; @@ -674,7 +674,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa for (int i = 0; i < efsd->get_subdir_count(); i++) { - TreeItem *dir_item = NULL; + TreeItem *dir_item = nullptr; if (p_parent) { dir_item = files->create_item(p_parent); dir_item->set_text(0, efsd->get_subdir(i)->get_name()); @@ -730,7 +730,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa void OrphanResourcesDialog::refresh() { HashMap<String, int> refs; - _fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, NULL); + _fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, nullptr); files->clear(); TreeItem *root = files->create_item(); _fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, root); diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp index 82db639379..7169986b14 100644 --- a/editor/dictionary_property_edit.cpp +++ b/editor/dictionary_property_edit.cpp @@ -96,7 +96,7 @@ Node *DictionaryPropertyEdit::get_node() { Object *o = ObjectDB::get_instance(obj); if (!o) - return NULL; + return nullptr; return cast_to<Node>(o); } diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp index 845e7725f3..096be1fe4b 100644 --- a/editor/doc_data.cpp +++ b/editor/doc_data.cpp @@ -265,7 +265,7 @@ void DocData::generate(bool p_basic_types) { List<PropertyInfo>::Element *EO = own_properties.front(); for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { - bool inherited = EO == NULL; + bool inherited = EO == nullptr; if (EO && EO->get() == E->get()) { inherited = false; EO = EO->next(); @@ -534,7 +534,7 @@ void DocData::generate(bool p_basic_types) { c.name = cname; Callable::CallError cerror; - Variant v = Variant::construct(Variant::Type(i), NULL, 0, cerror); + Variant v = Variant::construct(Variant::Type(i), nullptr, 0, cerror); List<MethodInfo> method_list; v.get_method_list(&method_list); diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 33ee95c2d8..b0bcc2b448 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -100,7 +100,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); il->add_theme_constant_override("hseparation", 16 * EDSCALE); while (*names_ptr) { - il->add_item(String::utf8(*names_ptr++), NULL, false); + il->add_item(String::utf8(*names_ptr++), nullptr, false); } il->set_max_columns(il->get_item_count() < 4 || single_column ? 1 : 16); vbc->add_child(il); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index d61fe8f08a..74c4102003 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -85,7 +85,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { package_path = p_path; Set<String> files_sorted; - FileAccess *src_f = NULL; + FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(p_path.utf8().get_data(), &io); @@ -102,7 +102,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { //get filename unz_file_info info; char fname[16384]; - unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); String name = fname; files_sorted.insert(name); @@ -212,7 +212,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { void EditorAssetInstaller::ok_pressed() { - FileAccess *src_f = NULL; + FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(package_path.utf8().get_data(), &io); @@ -234,7 +234,7 @@ void EditorAssetInstaller::ok_pressed() { //get filename unz_file_info info; char fname[16384]; - ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); String name = fname; @@ -297,10 +297,10 @@ void EditorAssetInstaller::ok_pressed() { } msg += failed_files[i]; } - if (EditorNode::get_singleton() != NULL) + if (EditorNode::get_singleton() != nullptr) EditorNode::get_singleton()->show_warning(msg); } else { - if (EditorNode::get_singleton() != NULL) + if (EditorNode::get_singleton() != nullptr) EditorNode::get_singleton()->show_warning(TTR("Package installed successfully!"), TTR("Success!")); } EditorFileSystem::get_singleton()->scan_changes(); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 55bdd2070b..7e499facd5 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1007,7 +1007,7 @@ void EditorAudioBuses::_update_buses() { memdelete(bus_hb->get_child(0)); } - drop_end = NULL; + drop_end = nullptr; for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { @@ -1045,7 +1045,7 @@ void EditorAudioBuses::_notification(int p_what) { if (drop_end) { drop_end->queue_delete(); - drop_end = NULL; + drop_end = nullptr; } } break; case NOTIFICATION_PROCESS: { @@ -1296,7 +1296,7 @@ void EditorAudioBuses::_bind_methods() { EditorAudioBuses::EditorAudioBuses() { - drop_end = NULL; + drop_end = nullptr; top_hb = memnew(HBoxContainer); add_child(top_hb); @@ -1402,7 +1402,7 @@ void AudioBusesEditorPlugin::edit(Object *p_node) { bool AudioBusesEditorPlugin::handles(Object *p_node) const { - return (Object::cast_to<AudioBusLayout>(p_node) != NULL); + return (Object::cast_to<AudioBusLayout>(p_node) != nullptr); } void AudioBusesEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index 72098c7232..be1551629d 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -133,7 +133,7 @@ public: void update_bus(); void update_send(); - EditorAudioBus(EditorAudioBuses *p_buses = NULL, bool p_is_master = false); + EditorAudioBus(EditorAudioBuses *p_buses = nullptr, bool p_is_master = false); }; class EditorAudioBusDrop : public Control { diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index a6a383ba58..6917b2b775 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -48,8 +48,6 @@ void EditorAutoloadSettings::_notification(int p_what) { ResourceLoader::get_recognized_extensions_for_type("Script", &afn); ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn); - EditorFileDialog *file_dialog = autoload_add_path->get_file_dialog(); - for (List<String>::Element *E = afn.front(); E; E = E->next()) { file_dialog->add_filter("*." + E->get()); @@ -61,6 +59,9 @@ void EditorAutoloadSettings::_notification(int p_what) { get_tree()->get_root()->call_deferred("add_child", info.node); } } + browse_button->set_icon(get_theme_icon("Folder", "EditorIcons")); + } else if (p_what == NOTIFICATION_THEME_CHANGED) { + browse_button->set_icon(get_theme_icon("Folder", "EditorIcons")); } } @@ -116,8 +117,8 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin void EditorAutoloadSettings::_autoload_add() { - if (autoload_add(autoload_add_name->get_text(), autoload_add_path->get_line_edit()->get_text())) - autoload_add_path->get_line_edit()->set_text(""); + if (autoload_add(autoload_add_name->get_text(), autoload_add_path->get_text())) + autoload_add_path->set_text(""); autoload_add_name->set_text(""); add_autoload->set_disabled(true); @@ -240,7 +241,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu case BUTTON_MOVE_UP: case BUTTON_MOVE_DOWN: { - TreeItem *swap = NULL; + TreeItem *swap = nullptr; if (p_button == BUTTON_MOVE_UP) { swap = ti->get_prev(); @@ -326,7 +327,7 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) { void EditorAutoloadSettings::_autoload_text_entered(const String p_name) { - if (autoload_add_path->get_line_edit()->get_text() != "" && _autoload_name_is_valid(p_name, NULL)) { + if (autoload_add_path->get_text() != "" && _autoload_name_is_valid(p_name, nullptr)) { _autoload_add(); } } @@ -334,19 +335,19 @@ void EditorAutoloadSettings::_autoload_text_entered(const String p_name) { void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) { add_autoload->set_disabled( - p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), NULL)); + p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr)); } void EditorAutoloadSettings::_autoload_text_changed(const String p_name) { add_autoload->set_disabled( - autoload_add_path->get_line_edit()->get_text() == "" || !_autoload_name_is_valid(p_name, NULL)); + autoload_add_path->get_text() == "" || !_autoload_name_is_valid(p_name, nullptr)); } Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { RES res = ResourceLoader::load(p_path); - ERR_FAIL_COND_V_MSG(res.is_null(), NULL, "Can't autoload: " + p_path + "."); - Node *n = NULL; + ERR_FAIL_COND_V_MSG(res.is_null(), nullptr, "Can't autoload: " + p_path + "."); + Node *n = nullptr; if (res->is_class("PackedScene")) { Ref<PackedScene> ps = res; n = ps->instance(); @@ -354,17 +355,17 @@ Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { Ref<Script> s = res; StringName ibt = s->get_instance_base_type(); bool valid_type = ClassDB::is_parent_class(ibt, "Node"); - ERR_FAIL_COND_V_MSG(!valid_type, NULL, "Script does not inherit a Node: " + p_path + "."); + ERR_FAIL_COND_V_MSG(!valid_type, nullptr, "Script does not inherit a Node: " + p_path + "."); Object *obj = ClassDB::instance(ibt); - ERR_FAIL_COND_V_MSG(obj == NULL, NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + "."); + ERR_FAIL_COND_V_MSG(obj == nullptr, nullptr, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + "."); n = Object::cast_to<Node>(obj); n->set_script(s); } - ERR_FAIL_COND_V_MSG(!n, NULL, "Path in autoload not a node or script: " + p_path + "."); + ERR_FAIL_COND_V_MSG(!n, nullptr, "Path in autoload not a node or script: " + p_path + "."); return n; } @@ -429,7 +430,7 @@ void EditorAutoloadSettings::update_autoload() { to_remove.erase(name); need_to_add = false; } else { - info.node = NULL; + info.node = nullptr; } } } @@ -474,7 +475,7 @@ void EditorAutoloadSettings::update_autoload() { if (info.node) { info.node->queue_delete(); - info.node = NULL; + info.node = nullptr; } } @@ -505,7 +506,7 @@ void EditorAutoloadSettings::update_autoload() { if (!info->in_editor && !info->is_singleton) { // No reason to keep this node memdelete(info->node); - info->node = NULL; + info->node = nullptr; } } @@ -523,7 +524,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control PackedStringArray autoloads; - TreeItem *next = tree->get_next_selected(NULL); + TreeItem *next = tree->get_next_selected(nullptr); while (next) { autoloads.push_back(next->get_text(0)); @@ -604,7 +605,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & int order = ProjectSettings::get_singleton()->get_order("autoload/" + name); AutoLoadInfo aux; - List<AutoLoadInfo>::Element *E = NULL; + List<AutoLoadInfo>::Element *E = nullptr; if (!move_to_back) { aux.order = order; @@ -805,9 +806,9 @@ EditorAutoloadSettings::EditorAutoloadSettings() { } } - if (!info.is_singleton && !info.in_editor && info.node != NULL) { + if (!info.is_singleton && !info.in_editor && info.node != nullptr) { memdelete(info.node); - info.node = NULL; + info.node = nullptr; } } @@ -823,13 +824,24 @@ EditorAutoloadSettings::EditorAutoloadSettings() { l->set_text(TTR("Path:")); hbc->add_child(l); - autoload_add_path = memnew(EditorLineEditFileChooser); - autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); - autoload_add_path->get_file_dialog()->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); - autoload_add_path->get_file_dialog()->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_autoload_file_callback)); - autoload_add_path->get_line_edit()->connect("text_changed", callable_mp(this, &EditorAutoloadSettings::_autoload_path_text_changed)); - + autoload_add_path = memnew(LineEdit); hbc->add_child(autoload_add_path); + autoload_add_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + autoload_add_path->connect("text_changed", callable_mp(this, &EditorAutoloadSettings::_autoload_path_text_changed)); + + browse_button = memnew(Button); + hbc->add_child(browse_button); + browse_button->connect("pressed", callable_mp(this, &EditorAutoloadSettings::_browse_autoload_add_path)); + + file_dialog = memnew(EditorFileDialog); + hbc->add_child(file_dialog); + file_dialog->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_set_autoload_add_path)); + file_dialog->connect("dir_selected", callable_mp(this, &EditorAutoloadSettings::_set_autoload_add_path)); + file_dialog->connect("files_selected", callable_mp(this, &EditorAutoloadSettings::_set_autoload_add_path)); + + hbc->set_h_size_flags(SIZE_EXPAND_FILL); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); + file_dialog->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_autoload_file_callback)); l = memnew(Label); l->set_text(TTR("Node Name:")); @@ -890,3 +902,14 @@ EditorAutoloadSettings::~EditorAutoloadSettings() { } } } + +void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) { + + autoload_add_path->set_text(p_text); + autoload_add_path->emit_signal("text_entered", p_text); +} + +void EditorAutoloadSettings::_browse_autoload_add_path() { + + file_dialog->popup_centered_ratio(); +}
\ No newline at end of file diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index 653a1b0a78..94a581401c 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -63,7 +63,7 @@ class EditorAutoloadSettings : public VBoxContainer { AutoLoadInfo() { is_singleton = false; in_editor = false; - node = NULL; + node = nullptr; } }; @@ -74,11 +74,13 @@ class EditorAutoloadSettings : public VBoxContainer { String selected_autoload; Tree *tree; - EditorLineEditFileChooser *autoload_add_path; LineEdit *autoload_add_name; Button *add_autoload; + LineEdit *autoload_add_path; + Button *browse_button; + EditorFileDialog *file_dialog; - bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL); + bool _autoload_name_is_valid(const String &p_name, String *r_error = nullptr); void _autoload_add(); void _autoload_selected(); @@ -96,6 +98,9 @@ class EditorAutoloadSettings : public VBoxContainer { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control); + void _set_autoload_add_path(const String &p_text); + void _browse_autoload_add_path(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 0c9cf91b2f..ea32e24f6e 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -115,7 +115,7 @@ def make_translations_header(target, source, env, category): g.write( '\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0]) ) - g.write("\t{NULL, 0, 0, NULL}\n") + g.write("\t{nullptr, 0, 0, nullptr}\n") g.write("};\n") g.write("#endif") diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 1c19327da7..942b4a8ee6 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -270,7 +270,7 @@ EditorPlugin *EditorData::get_editor(Object *p_object) { return editor_plugins[i]; } - return NULL; + return nullptr; } EditorPlugin *EditorData::get_subeditor(Object *p_object) { @@ -281,7 +281,7 @@ EditorPlugin *EditorData::get_subeditor(Object *p_object) { return editor_plugins[i]; } - return NULL; + return nullptr; } Vector<EditorPlugin *> EditorData::get_subeditors(Object *p_object) { @@ -302,7 +302,7 @@ EditorPlugin *EditorData::get_editor(String p_name) { return editor_plugins[i]; } - return NULL; + return nullptr; } void EditorData::copy_object_params(Object *p_object) { @@ -464,7 +464,7 @@ UndoRedo &EditorData::get_undo_redo() { void EditorData::remove_editor_plugin(EditorPlugin *p_plugin) { - p_plugin->undo_redo = NULL; + p_plugin->undo_redo = nullptr; editor_plugins.erase(p_plugin); } @@ -479,7 +479,7 @@ int EditorData::get_editor_plugin_count() const { } EditorPlugin *EditorData::get_editor_plugin(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, editor_plugins.size(), NULL); + ERR_FAIL_INDEX_V(p_idx, editor_plugins.size(), nullptr); return editor_plugins[p_idx]; } @@ -506,7 +506,7 @@ Object *EditorData::instance_custom_type(const String &p_type, const String &p_i Ref<Script> script = get_custom_types()[p_inherits][i].script; Object *ob = ClassDB::instance(p_inherits); - ERR_FAIL_COND_V(!ob, NULL); + ERR_FAIL_COND_V(!ob, nullptr); if (ob->is_class("Node")) { ob->call("set_name", p_type); } @@ -516,7 +516,7 @@ Object *EditorData::instance_custom_type(const String &p_type, const String &p_i } } - return NULL; + return nullptr; } void EditorData::remove_custom_type(const String &p_type) { @@ -540,7 +540,7 @@ int EditorData::add_edited_scene(int p_at_pos) { if (p_at_pos < 0) p_at_pos = edited_scene.size(); EditedScene es; - es.root = NULL; + es.root = nullptr; es.path = String(); es.history_current = -1; es.version = 0; @@ -680,10 +680,10 @@ void EditorData::set_edited_scene(int p_idx) { } Node *EditorData::get_edited_scene_root(int p_idx) { if (p_idx < 0) { - ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), NULL); + ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), nullptr); return edited_scene[current_edited_scene].root; } else { - ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), NULL); + ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), nullptr); return edited_scene[p_idx].root; } } @@ -915,7 +915,7 @@ Object *EditorData::script_class_instance(const String &p_class) { return obj; } } - return NULL; + return nullptr; } Ref<Script> EditorData::script_class_load_script(const String &p_class) const { @@ -1018,7 +1018,7 @@ void EditorSelection::add_node(Node *p_node) { changed = true; nl_changed = true; - Object *meta = NULL; + Object *meta = nullptr; for (List<Object *>::Element *E = editor_plugins.front(); E; E = E->next()) { meta = E->get()->call("_get_editor_data", p_node); diff --git a/editor/editor_data.h b/editor/editor_data.h index 5095ea8479..4f5d68bfed 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -265,7 +265,7 @@ public: template <class T> T *get_node_editor_data(Node *p_node) { if (!selection.has(p_node)) - return NULL; + return nullptr; return Object::cast_to<T>(selection[p_node]); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 5883b5eb1e..e8167070d4 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -358,12 +358,12 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat zipOpenNewFileInZip(zip, path.utf8().get_data(), - NULL, - NULL, + nullptr, + nullptr, 0, - NULL, + nullptr, 0, - NULL, + nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION); @@ -582,6 +582,14 @@ String EditorExportPlugin::get_ios_cpp_code() const { return ios_cpp_code; } +void EditorExportPlugin::add_ios_project_static_lib(const String &p_path) { + ios_project_static_libs.push_back(p_path); +} + +Vector<String> EditorExportPlugin::get_ios_project_static_libs() const { + return ios_project_static_libs; +} + void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) { if (get_script_instance()) { @@ -617,6 +625,7 @@ void EditorExportPlugin::skip() { void EditorExportPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_shared_object", "path", "tags"), &EditorExportPlugin::add_shared_object); + ClassDB::bind_method(D_METHOD("add_ios_project_static_lib", "path"), &EditorExportPlugin::add_ios_project_static_lib); ClassDB::bind_method(D_METHOD("add_file", "path", "file", "remap"), &EditorExportPlugin::add_file); ClassDB::bind_method(D_METHOD("add_ios_framework", "path"), &EditorExportPlugin::add_ios_framework); ClassDB::bind_method(D_METHOD("add_ios_plist_content", "plist_content"), &EditorExportPlugin::add_ios_plist_content); @@ -1070,7 +1079,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co FileAccess *src_f; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); - zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io); + zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io); ZipData zd; zd.ep = &ep; @@ -1080,7 +1089,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co if (err != OK && err != ERR_SKIP) ERR_PRINT("Failed to export project files"); - zipClose(zip, NULL); + zipClose(zip, nullptr); return OK; } @@ -1153,7 +1162,7 @@ EditorExportPlatform::EditorExportPlatform() { //// -EditorExport *EditorExport::singleton = NULL; +EditorExport *EditorExport::singleton = nullptr; void EditorExport::_save() { @@ -1686,7 +1695,7 @@ void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_ EditorExportPlatformPC::EditorExportPlatformPC() { chmod_flags = -1; - fixup_embedded_pck_func = NULL; + fixup_embedded_pck_func = nullptr; } /////////////////////// diff --git a/editor/editor_export.h b/editor/editor_export.h index 81790eb0a4..f47fe9c95e 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -212,7 +212,7 @@ protected: FeatureContainers get_feature_containers(const Ref<EditorExportPreset> &p_preset); bool exists_export_template(String template_file_name, String *err) const; - String find_export_template(String template_file_name, String *err = NULL) const; + String find_export_template(String template_file_name, String *err = nullptr) const; void gen_export_flags(Vector<String> &r_flags, int p_flags); public: @@ -238,9 +238,9 @@ public: virtual String get_name() const = 0; virtual Ref<Texture2D> get_logo() const = 0; - Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = NULL); + Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr); - Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL, bool p_embed = false, int64_t *r_embedded_start = NULL, int64_t *r_embedded_size = NULL); + Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr); Error save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path); virtual bool poll_export() { return false; } @@ -291,6 +291,7 @@ class EditorExportPlugin : public Reference { bool skipped; Vector<String> ios_frameworks; + Vector<String> ios_project_static_libs; String ios_plist_content; String ios_linker_flags; Vector<String> ios_bundle_files; @@ -322,6 +323,7 @@ protected: void add_shared_object(const String &p_path, const Vector<String> &tags); void add_ios_framework(const String &p_path); + void add_ios_project_static_lib(const String &p_path); void add_ios_plist_content(const String &p_plist_content); void add_ios_linker_flags(const String &p_flags); void add_ios_bundle_file(const String &p_path); @@ -336,6 +338,7 @@ protected: public: Vector<String> get_ios_frameworks() const; + Vector<String> get_ios_project_static_libs() const; String get_ios_plist_content() const; String get_ios_linker_flags() const; Vector<String> get_ios_bundle_files() const; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 6e13ec7967..e2b79efb43 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -787,7 +787,7 @@ Ref<EditorFeatureProfile> EditorFeatureProfileManager::get_current_profile() { return current; } -EditorFeatureProfileManager *EditorFeatureProfileManager::singleton = NULL; +EditorFeatureProfileManager *EditorFeatureProfileManager::singleton = nullptr; void EditorFeatureProfileManager::_bind_methods() { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index fca59946ae..6a06c6657e 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -44,11 +44,11 @@ #include "scene/gui/margin_container.h" #include "servers/display_server.h" -EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = NULL; -EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = NULL; +EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = nullptr; +EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = nullptr; -EditorFileDialog::RegisterFunc EditorFileDialog::register_func = NULL; -EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = NULL; +EditorFileDialog::RegisterFunc EditorFileDialog::register_func = nullptr; +EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = nullptr; VBoxContainer *EditorFileDialog::get_vbox() { return vbox; @@ -1579,6 +1579,7 @@ EditorFileDialog::EditorFileDialog() { drives = memnew(OptionButton); drives->connect("item_selected", callable_mp(this, &EditorFileDialog::_select_drive)); + pathhb->add_child(drives); makedir = memnew(Button); makedir->set_text(TTR("Create Folder")); @@ -1733,42 +1734,3 @@ EditorFileDialog::~EditorFileDialog() { unregister_func(this); memdelete(dir_access); } - -void EditorLineEditFileChooser::_notification(int p_what) { - - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) - button->set_icon(get_theme_icon("Folder", "EditorIcons")); -} - -void EditorLineEditFileChooser::_bind_methods() { - - ClassDB::bind_method(D_METHOD("get_button"), &EditorLineEditFileChooser::get_button); - ClassDB::bind_method(D_METHOD("get_line_edit"), &EditorLineEditFileChooser::get_line_edit); - ClassDB::bind_method(D_METHOD("get_file_dialog"), &EditorLineEditFileChooser::get_file_dialog); -} - -void EditorLineEditFileChooser::_chosen(const String &p_text) { - - line_edit->set_text(p_text); - line_edit->emit_signal("text_entered", p_text); -} - -void EditorLineEditFileChooser::_browse() { - - dialog->popup_centered_ratio(); -} - -EditorLineEditFileChooser::EditorLineEditFileChooser() { - - line_edit = memnew(LineEdit); - add_child(line_edit); - line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); - button = memnew(Button); - add_child(button); - button->connect("pressed", callable_mp(this, &EditorLineEditFileChooser::_browse)); - dialog = memnew(EditorFileDialog); - add_child(dialog); - dialog->connect("file_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); - dialog->connect("dir_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); - dialog->connect("files_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); -} diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index ed23f14ebe..8efb8f5368 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -245,28 +245,6 @@ public: ~EditorFileDialog(); }; -class EditorLineEditFileChooser : public HBoxContainer { - - GDCLASS(EditorLineEditFileChooser, HBoxContainer); - Button *button; - LineEdit *line_edit; - EditorFileDialog *dialog; - - void _chosen(const String &p_text); - void _browse(); - -protected: - void _notification(int p_what); - static void _bind_methods(); - -public: - Button *get_button() { return button; } - LineEdit *get_line_edit() { return line_edit; } - EditorFileDialog *get_file_dialog() { return dialog; } - - EditorLineEditFileChooser(); -}; - VARIANT_ENUM_CAST(EditorFileDialog::FileMode); VARIANT_ENUM_CAST(EditorFileDialog::Access); VARIANT_ENUM_CAST(EditorFileDialog::DisplayMode); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index ad34b59c5c..c211d5852a 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -41,7 +41,7 @@ #include "editor_resource_preview.h" #include "editor_settings.h" -EditorFileSystem *EditorFileSystem::singleton = NULL; +EditorFileSystem *EditorFileSystem::singleton = nullptr; //the name is the version, to keep compatibility with different versions of Godot #define CACHE_FILE_NAME "filesystem_cache6" @@ -75,7 +75,7 @@ int EditorFileSystemDirectory::get_subdir_count() const { EditorFileSystemDirectory *EditorFileSystemDirectory::get_subdir(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, subdirs.size(), NULL); + ERR_FAIL_INDEX_V(p_idx, subdirs.size(), nullptr); return subdirs[p_idx]; } @@ -176,7 +176,7 @@ void EditorFileSystemDirectory::_bind_methods() { EditorFileSystemDirectory::EditorFileSystemDirectory() { modified_time = 0; - parent = NULL; + parent = nullptr; verified = false; } @@ -300,7 +300,7 @@ void EditorFileSystem::_scan_filesystem() { sp.progress = &scan_progress; new_filesystem = memnew(EditorFileSystemDirectory); - new_filesystem->parent = NULL; + new_filesystem->parent = nullptr; DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); d->change_dir("res://"); @@ -383,7 +383,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo next_tag.fields.clear(); next_tag.name = String(); - err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true); + err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true); if (err == ERR_FILE_EOF) { break; } else if (err != OK) { @@ -430,7 +430,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo next_tag.fields.clear(); next_tag.name = String(); - err = VariantParser::parse_tag_assign_eof(&md5_stream, lines, error_text, next_tag, assign, value, NULL, true); + err = VariantParser::parse_tag_assign_eof(&md5_stream, lines, error_text, next_tag, assign, value, nullptr, true); if (err == ERR_FILE_EOF) { break; @@ -622,7 +622,7 @@ void EditorFileSystem::scan() { memdelete(filesystem); //file_type_cache.clear(); filesystem = new_filesystem; - new_filesystem = NULL; + new_filesystem = nullptr; _update_scan_actions(); scanning = false; emit_signal("filesystem_changed"); @@ -1124,8 +1124,8 @@ void EditorFileSystem::_notification(int p_what) { } Thread::wait_to_finish(active_thread); memdelete(active_thread); - thread = NULL; - thread_sources = NULL; + thread = nullptr; + thread_sources = nullptr; WARN_PRINT("Scan thread aborted..."); set_process(false); } @@ -1134,8 +1134,8 @@ void EditorFileSystem::_notification(int p_what) { memdelete(filesystem); if (new_filesystem) memdelete(new_filesystem); - filesystem = NULL; - new_filesystem = NULL; + filesystem = nullptr; + new_filesystem = nullptr; } break; case NOTIFICATION_PROCESS: { @@ -1152,7 +1152,7 @@ void EditorFileSystem::_notification(int p_what) { Thread::wait_to_finish(thread_sources); memdelete(thread_sources); - thread_sources = NULL; + thread_sources = nullptr; if (_update_scan_actions()) emit_signal("filesystem_changed"); emit_signal("sources_changed", sources_changed.size() > 0); @@ -1166,10 +1166,10 @@ void EditorFileSystem::_notification(int p_what) { if (filesystem) memdelete(filesystem); filesystem = new_filesystem; - new_filesystem = NULL; + new_filesystem = nullptr; Thread::wait_to_finish(thread); memdelete(thread); - thread = NULL; + thread = nullptr; _update_scan_actions(); emit_signal("filesystem_changed"); emit_signal("sources_changed", sources_changed.size() > 0); @@ -1308,7 +1308,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector String EditorFileSystem::get_file_type(const String &p_file) const { - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; if (!_find_file(p_file, &fs, cpos)) { @@ -1322,13 +1322,13 @@ String EditorFileSystem::get_file_type(const String &p_file) const { EditorFileSystemDirectory *EditorFileSystem::find_file(const String &p_file, int *r_index) const { if (!filesystem || scanning) - return NULL; + return nullptr; - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; if (!_find_file(p_file, &fs, cpos)) { - return NULL; + return nullptr; } if (r_index) @@ -1340,12 +1340,12 @@ EditorFileSystemDirectory *EditorFileSystem::find_file(const String &p_file, int EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p_path) { if (!filesystem || scanning) - return NULL; + return nullptr; String f = ProjectSettings::get_singleton()->localize_path(p_path); if (!f.begins_with("res://")) - return NULL; + return nullptr; f = f.substr(6, f.length()); f = f.replace("\\", "/"); @@ -1358,7 +1358,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p Vector<String> path = f.split("/"); if (path.size() == 0) - return NULL; + return nullptr; EditorFileSystemDirectory *fs = filesystem; @@ -1374,7 +1374,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p } if (idx == -1) { - return NULL; + return nullptr; } else { fs = fs->get_subdir(idx); @@ -1483,7 +1483,7 @@ void EditorFileSystem::_queue_update_script_classes() { void EditorFileSystem::update_file(const String &p_file) { - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; if (!_find_file(p_file, &fs, cpos)) { @@ -1684,7 +1684,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector } md5s->close(); - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; bool found = _find_file(file, &fs, cpos); ERR_FAIL_COND_V_MSG(!found, ERR_UNCONFIGURED, "Can't find file '" + file + "'."); @@ -1718,7 +1718,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector void EditorFileSystem::_reimport_file(const String &p_file) { - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; bool found = _find_file(p_file, &fs, cpos); ERR_FAIL_COND_MSG(!found, "Can't find file '" + p_file + "'."); @@ -1980,7 +1980,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) { } //group may have changed, so also update group reference - EditorFileSystemDirectory *fs = NULL; + EditorFileSystemDirectory *fs = nullptr; int cpos = -1; if (_find_file(p_files[i], &fs, cpos)) { @@ -2131,14 +2131,14 @@ EditorFileSystem::EditorFileSystem() { singleton = this; filesystem = memnew(EditorFileSystemDirectory); //like, empty - filesystem->parent = NULL; + filesystem->parent = nullptr; - thread = NULL; + thread = nullptr; scanning = false; importing = false; use_threads = true; - thread_sources = NULL; - new_filesystem = NULL; + thread_sources = nullptr; + new_filesystem = nullptr; abort_scan = false; scanning_changes = false; diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 9789dacdc1..55a2ed3d09 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -129,9 +129,9 @@ class EditorFileSystem : public Node { ItemAction() { action = ACTION_NONE; - dir = NULL; - new_dir = NULL; - new_file = NULL; + dir = nullptr; + new_dir = nullptr; + new_file = nullptr; } }; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 9d8c46cc2d..a36e2f360e 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -39,10 +39,8 @@ #include "editor_settings.h" #define CONTRIBUTE_URL "https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html" -#define CONTRIBUTE2_URL "https://github.com/godotengine/godot-docs" -#define REQUEST_URL "https://github.com/godotengine/godot-docs/issues/new" -DocData *EditorHelp::doc = NULL; +DocData *EditorHelp::doc = nullptr; void EditorHelp::_init_colors() { @@ -109,7 +107,7 @@ void EditorHelp::_class_desc_select(const String &p_select) { String link = p_select.substr(tag_end + 1, p_select.length()).lstrip(" "); String topic; - Map<String, int> *table = NULL; + Map<String, int> *table = nullptr; if (tag == "method") { topic = "class_method"; diff --git a/editor/editor_help.h b/editor/editor_help.h index d9c7194003..2e053e674f 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -192,9 +192,9 @@ public: ~EditorHelp(); }; -class EditorHelpBit : public PanelContainer { +class EditorHelpBit : public MarginContainer { - GDCLASS(EditorHelpBit, PanelContainer); + GDCLASS(EditorHelpBit, MarginContainer); RichTextLabel *rich_text; void _go_to_help(String p_what); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 6fba5b1b4c..01a50cad2c 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -317,7 +317,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { iterator_doc = EditorHelp::get_doc_data()->class_list.front(); matches.clear(); - matched_item = NULL; + matched_item = nullptr; return true; } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 013ba88c30..a0f8b59117 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -71,7 +71,7 @@ Size2 EditorProperty::get_minimum_size() const { ms.width += check->get_width() + get_theme_constant("hseparation", "CheckBox") + get_theme_constant("hseparator", "Tree"); } - if (bottom_editor != NULL && bottom_editor->is_visible()) { + if (bottom_editor != nullptr && bottom_editor->is_visible()) { ms.height += get_theme_constant("vseparation", "Tree"); Size2 bems = bottom_editor->get_combined_minimum_size(); //bems.width += get_constant("item_margin", "Tree"); @@ -856,7 +856,7 @@ void EditorProperty::_bind_methods() { EditorProperty::EditorProperty() { draw_top_bg = true; - object = NULL; + object = nullptr; split_ratio = 0.5; selectable = true; text_size = 0; @@ -873,8 +873,8 @@ EditorProperty::EditorProperty() { property_usage = 0; selected = false; selected_focusable = -1; - label_reference = NULL; - bottom_editor = NULL; + label_reference = nullptr; + bottom_editor = nullptr; } //////////////////////////////////////////////// //////////////////////////////////////////////// @@ -888,7 +888,7 @@ void EditorInspectorPlugin::add_custom_control(Control *control) { void EditorInspectorPlugin::add_property_editor(const String &p_for_property, Control *p_prop) { - ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == NULL); + ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == nullptr); AddedEditor ae; ae.properties.push_back(p_for_property); @@ -1257,7 +1257,7 @@ void EditorInspectorSection::_bind_methods() { } EditorInspectorSection::EditorInspectorSection() { - object = NULL; + object = nullptr; foldable = false; vbox = memnew(VBoxContainer); vbox_added = false; @@ -1297,7 +1297,7 @@ EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, V } } } - return NULL; + return nullptr; } void EditorInspector::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) { @@ -1473,12 +1473,14 @@ void EditorInspector::update_tree() { } } - // TreeItem *current_category = NULL; + // TreeItem *current_category = nullptr; String filter = search_box ? search_box->get_text() : ""; String group; String group_base; - VBoxContainer *category_vbox = NULL; + String subgroup; + String subgroup_base; + VBoxContainer *category_vbox = nullptr; List<PropertyInfo> plist; @@ -1503,10 +1505,19 @@ void EditorInspector::update_tree() { //make sure the property can be edited - if (p.usage & PROPERTY_USAGE_GROUP) { + if (p.usage & PROPERTY_USAGE_SUBGROUP) { + + subgroup = p.name; + subgroup_base = p.hint_string; + + continue; + + } else if (p.usage & PROPERTY_USAGE_GROUP) { group = p.name; group_base = p.hint_string; + subgroup = ""; + subgroup_base = ""; continue; @@ -1514,6 +1525,8 @@ void EditorInspector::update_tree() { group = ""; group_base = ""; + subgroup = ""; + subgroup_base = ""; if (!show_categories) continue; @@ -1535,7 +1548,7 @@ void EditorInspector::update_tree() { EditorInspectorCategory *category = memnew(EditorInspectorCategory); main_vbox->add_child(category); - category_vbox = NULL; //reset + category_vbox = nullptr; //reset String type = p.name; category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); @@ -1577,18 +1590,33 @@ void EditorInspector::update_tree() { } String basename = p.name; + + if (subgroup != "") { + if (subgroup_base != "") { + if (basename.begins_with(subgroup_base)) { + basename = basename.replace_first(subgroup_base, ""); + } else if (subgroup_base.begins_with(basename)) { + //keep it, this is used pretty often + } else { + subgroup = ""; //no longer using subgroup base, clear + } + } + } if (group != "") { - if (group_base != "") { + if (group_base != "" && subgroup == "") { if (basename.begins_with(group_base)) { basename = basename.replace_first(group_base, ""); } else if (group_base.begins_with(basename)) { //keep it, this is used pretty often } else { group = ""; //no longer using group base, clear + subgroup = ""; } } } - + if (subgroup != "") { + basename = subgroup + "/" + basename; + } if (group != "") { basename = group + "/" + basename; } @@ -1621,7 +1649,7 @@ void EditorInspector::update_tree() { continue; } - if (category_vbox == NULL) { + if (category_vbox == nullptr) { category_vbox = memnew(VBoxContainer); main_vbox->add_child(category_vbox); } @@ -1659,7 +1687,7 @@ void EditorInspector::update_tree() { if (current_vbox == main_vbox) { //do not add directly to the main vbox, given it has no spacing - if (category_vbox == NULL) { + if (category_vbox == nullptr) { category_vbox = memnew(VBoxContainer); } current_vbox = category_vbox; @@ -2143,7 +2171,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { if (E->get().name == p_path) { Callable::CallError ce; - to_create = Variant::construct(E->get().type, NULL, 0, ce); + to_create = Variant::construct(E->get().type, nullptr, 0, ce); break; } } @@ -2191,7 +2219,7 @@ void EditorInspector::_resource_selected(const String &p_path, RES p_resource) { void EditorInspector::_node_removed(Node *p_node) { if (p_node == object) { - edit(NULL); + edit(nullptr); } } @@ -2211,14 +2239,14 @@ void EditorInspector::_notification(int p_what) { } } if (p_what == NOTIFICATION_PREDELETE) { - edit(NULL); //just in case + edit(nullptr); //just in case } if (p_what == NOTIFICATION_EXIT_TREE) { if (!sub_inspector) { get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed)); } - edit(NULL); + edit(nullptr); } if (p_what == NOTIFICATION_PROCESS) { @@ -2328,8 +2356,8 @@ void EditorInspector::_bind_methods() { } EditorInspector::EditorInspector() { - object = NULL; - undo_redo = NULL; + object = nullptr; + undo_redo = nullptr; main_vbox = memnew(VBoxContainer); main_vbox->set_h_size_flags(SIZE_EXPAND_FILL); main_vbox->add_theme_constant_override("separation", 0); @@ -2349,7 +2377,7 @@ EditorInspector::EditorInspector() { update_tree_pending = false; refresh_countdown = 0; read_only = false; - search_box = NULL; + search_box = nullptr; keying = false; _prop_edited = "property_edited"; set_process(true); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 91e53edeac..c89a7bcf23 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -66,7 +66,7 @@ void EditorLog::_notification(int p_what) { } else if (p_what == NOTIFICATION_THEME_CHANGED) { Ref<DynamicFont> df_output_code = get_theme_font("output_source", "EditorFonts"); if (df_output_code.is_valid()) { - if (log != NULL) { + if (log != nullptr) { log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts")); } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 37f78434df..d8f0a2764a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -174,7 +174,7 @@ #include <stdio.h> #include <stdlib.h> -EditorNode *EditorNode::singleton = NULL; +EditorNode *EditorNode::singleton = nullptr; void EditorNode::_update_scene_tabs() { @@ -365,9 +365,17 @@ void EditorNode::_notification(int p_what) { RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter); RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size")); RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve")); - bool glow_bicubic = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0; RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic); + RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(GLOBAL_GET("rendering/quality/screen_space_reflection/roughness_quality"))); + RS::get_singleton()->environment_set_ssr_roughness_quality(ssr_roughness_quality); + RS::SubSurfaceScatteringQuality sss_quality = RS::SubSurfaceScatteringQuality(int(GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_quality"))); + RS::get_singleton()->sub_surface_scattering_set_quality(sss_quality); + float sss_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_scale"); + float sss_depth_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_depth_scale"); + RS::get_singleton()->sub_surface_scattering_set_scale(sss_scale, sss_depth_scale); + RS::ShadowFilter shadow_filter = RS::ShadowFilter(int(GLOBAL_GET("rendering/quality/shadows/filter_mode"))); + RS::get_singleton()->shadow_filter_set(shadow_filter); } ResourceImporterTexture::get_singleton()->update_imports(); @@ -387,7 +395,7 @@ void EditorNode::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { editor_data.save_editor_external_data(); - FileAccess::set_file_close_fail_notify_callback(NULL); + FileAccess::set_file_close_fail_notify_callback(nullptr); log->deinit(); // do not get messages anymore editor_data.clear_edited_scenes(); } break; @@ -514,7 +522,9 @@ void EditorNode::_notification(int p_what) { p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_theme_icon("HelpSearch", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon("Instance", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon("Instance", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_REPORT_A_BUG), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_SEND_DOCS_FEEDBACK), gui_base->get_theme_icon("Instance", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon("Instance", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons")); @@ -864,7 +874,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String file->set_current_path(p_resource->get_path()); if (extensions.size()) { String ext = p_resource->get_path().get_extension().to_lower(); - if (extensions.find(ext) == NULL) { + if (extensions.find(ext) == nullptr) { file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); } } @@ -1121,7 +1131,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { EditorProgress save("save", TTR("Saving Scene"), 4); - if (editor_data.get_edited_scene_root() != NULL) { + if (editor_data.get_edited_scene_root() != nullptr) { save.step(TTR("Analyzing"), 0); int c2d = 0; @@ -1560,7 +1570,7 @@ void EditorNode::_dialog_action(String p_file) { save_resource_in_path(saving_resource, p_file); saving_resource = Ref<Resource>(); ObjectID current = editor_history.get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; ERR_FAIL_COND(!current_obj); current_obj->_change_notify(); } break; @@ -1706,10 +1716,10 @@ void EditorNode::edit_item(Object *p_object) { void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) { if (!p_object) { - get_inspector()->edit(NULL); - node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); - inspector_dock->update(NULL); + get_inspector()->edit(nullptr); + node_dock->set_node(nullptr); + scene_tree_dock->set_selected(nullptr); + inspector_dock->update(nullptr); return; } @@ -1770,17 +1780,17 @@ static bool overrides_external_editor(Object *p_object) { void EditorNode::_edit_current() { ObjectID current = editor_history.get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; bool inspector_only = editor_history.is_current_inspector_only(); this->current = current_obj; if (!current_obj) { - scene_tree_dock->set_selected(NULL); - get_inspector()->edit(NULL); - node_dock->set_node(NULL); - inspector_dock->update(NULL); + scene_tree_dock->set_selected(nullptr); + get_inspector()->edit(nullptr); + node_dock->set_node(nullptr); + inspector_dock->update(nullptr); _display_top_editors(false); @@ -1801,9 +1811,9 @@ void EditorNode::_edit_current() { Resource *current_res = Object::cast_to<Resource>(current_obj); ERR_FAIL_COND(!current_res); get_inspector()->edit(current_res); - scene_tree_dock->set_selected(NULL); - node_dock->set_node(NULL); - inspector_dock->update(NULL); + scene_tree_dock->set_selected(nullptr); + node_dock->set_node(nullptr); + inspector_dock->update(nullptr); EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path()); int subr_idx = current_res->get_path().find("::"); @@ -1832,9 +1842,9 @@ void EditorNode::_edit_current() { scene_tree_dock->set_selected(current_node); inspector_dock->update(current_node); } else { - node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); - inspector_dock->update(NULL); + node_dock->set_node(nullptr); + scene_tree_dock->set_selected(nullptr); + inspector_dock->update(nullptr); } if (get_edited_scene() && get_edited_scene()->get_filename() != String()) { @@ -1846,7 +1856,7 @@ void EditorNode::_edit_current() { } else { - Node *selected_node = NULL; + Node *selected_node = nullptr; if (current_obj->is_class("EditorDebuggerRemoteObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); @@ -1875,9 +1885,9 @@ void EditorNode::_edit_current() { } get_inspector()->edit(current_obj); - node_dock->set_node(NULL); + node_dock->set_node(nullptr); scene_tree_dock->set_selected(selected_node); - inspector_dock->update(NULL); + inspector_dock->update(nullptr); } if (current_obj == prev_inspected_object) { @@ -1903,7 +1913,7 @@ void EditorNode::_edit_current() { for (int i = 0; i < editor_table.size(); i++) { if (editor_table[i] == main_plugin && !main_editor_buttons[i]->is_visible()) { - main_plugin = NULL; //if button is not visible, then no plugin active + main_plugin = nullptr; //if button is not visible, then no plugin active } } @@ -2232,7 +2242,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->set_current_path(scene->get_filename()); if (extensions.size()) { String ext = scene->get_filename().get_extension().to_lower(); - if (extensions.find(ext) == NULL) { + if (extensions.find(ext) == nullptr) { file->set_current_path(scene->get_filename().replacen("." + ext, "." + extensions.front()->get())); } } @@ -2632,9 +2642,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case HELP_QA: { OS::get_singleton()->shell_open("https://godotengine.org/qa/"); } break; - case HELP_ISSUES: { + case HELP_REPORT_A_BUG: { OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues"); } break; + case HELP_SEND_DOCS_FEEDBACK: { + OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues"); + } break; case HELP_COMMUNITY: { OS::get_singleton()->shell_open("https://godotengine.org/community"); } break; @@ -2742,7 +2755,7 @@ void EditorNode::_discard_changes(const String &p_str) { case SCENE_TAB_CLOSE: { Node *scene = editor_data.get_edited_scene_root(tab_closing); - if (scene != NULL) { + if (scene != nullptr) { String scene_filename = scene->get_filename(); if (scene_filename != "") { previous_scenes.push_back(scene_filename); @@ -3122,7 +3135,7 @@ Dictionary EditorNode::_get_main_scene_state() { void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) { - if (get_edited_scene() != p_for_scene && p_for_scene != NULL) + if (get_edited_scene() != p_for_scene && p_for_scene != nullptr) return; //not for this scene changing_scene = false; @@ -3417,7 +3430,7 @@ void EditorNode::open_request(const String &p_path) { if (!opening_prev) { List<String>::Element *prev_scene = previous_scenes.find(p_path); - if (prev_scene != NULL) { + if (prev_scene != nullptr) { prev_scene->erase(); } } @@ -3639,7 +3652,7 @@ void EditorNode::stop_child_process(OS::ProcessID p_pid) { } Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) const { - ERR_FAIL_COND_V(!p_object, NULL); + ERR_FAIL_COND_V(!p_object, nullptr); Ref<Script> script = p_object->get_script(); @@ -3666,7 +3679,7 @@ Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) cons } } - return NULL; + return nullptr; } StringName EditorNode::get_object_custom_type_name(const Object *p_object) const { @@ -3712,11 +3725,11 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons return icon; } } - return NULL; + return nullptr; } Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const { - ERR_FAIL_COND_V(!p_object || !gui_base, NULL); + ERR_FAIL_COND_V(!p_object || !gui_base, nullptr); Ref<Script> script = p_object->get_script(); if (script.is_null() && p_object->is_class("Script")) { @@ -3757,11 +3770,11 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String if (p_fallback.length()) return gui_base->get_theme_icon(p_fallback, "EditorIcons"); - return NULL; + return nullptr; } Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const { - ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty."); + ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty."); if (gui_base->has_theme_icon(p_class, "EditorIcons")) { return gui_base->get_theme_icon(p_class, "EditorIcons"); @@ -3778,7 +3791,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p while (script.is_valid()) { String current_icon_path; - script->get_language()->get_global_class_name(script->get_path(), NULL, ¤t_icon_path); + script->get_language()->get_global_class_name(script->get_path(), nullptr, ¤t_icon_path); icon = _load_custom_class_icon(current_icon_path); if (icon.is_valid()) { return icon; @@ -3808,7 +3821,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) return gui_base->get_theme_icon(p_fallback, "EditorIcons"); - return NULL; + return nullptr; } void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { @@ -3947,11 +3960,14 @@ void EditorNode::_copy_warning(const String &p_str) { } void EditorNode::_dock_floating_close_request(Control *p_control) { - Window *window = (Window *)p_control->get_parent(); + // Through the MarginContainer to the Window. + Window *window = (Window *)p_control->get_parent()->get_parent(); int window_slot = window->get_meta("dock_slot"); - window->remove_child(p_control); + p_control->get_parent()->remove_child(p_control); dock_slot[window_slot]->add_child(p_control); + dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_child_count())); + dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index")); window->queue_delete(); @@ -3964,10 +3980,12 @@ void EditorNode::_dock_make_float() { Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control(); ERR_FAIL_COND(!dock); - Size2 dock_size = dock->get_size(); //remember size - Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position(); + const Size2i borders = Size2i(4, 4) * EDSCALE; + Size2 dock_size = dock->get_size() + borders * 2; //remember size + Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position() - borders; print_line("dock pos: " + dock->get_global_position() + " window pos: " + get_tree()->get_root()->get_position()); + int dock_index = dock->get_index(); dock_slot[dock_popup_selected]->remove_child(dock); Window *window = memnew(Window); @@ -3976,14 +3994,22 @@ void EditorNode::_dock_make_float() { p->set_mode(Panel::MODE_FOREGROUND); p->set_anchors_and_margins_preset(Control::PRESET_WIDE); window->add_child(p); + MarginContainer *margin = memnew(MarginContainer); + margin->set_anchors_and_margins_preset(Control::PRESET_WIDE); + margin->add_theme_constant_override("margin_right", borders.width); + margin->add_theme_constant_override("margin_top", borders.height); + margin->add_theme_constant_override("margin_left", borders.width); + margin->add_theme_constant_override("margin_bottom", borders.height); + window->add_child(margin); dock->set_anchors_and_margins_preset(Control::PRESET_WIDE); - window->add_child(dock); + margin->add_child(dock); window->set_wrap_controls(true); window->set_size(dock_size); window->set_position(dock_screen_pos); window->set_transient(true); window->connect("close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request), varray(dock)); window->set_meta("dock_slot", dock_popup_selected); + window->set_meta("dock_index", dock_index); gui_base->add_child(window); dock_select_popup->hide(); @@ -4394,7 +4420,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String String name = names[j]; //find it, in a horribly inefficient way int atidx = -1; - Control *node = NULL; + Control *node = nullptr; for (int k = 0; k < DOCK_SLOT_MAX; k++) { if (!dock_slot[k]->has_node(name)) continue; @@ -4960,7 +4986,7 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) { void EditorNode::remove_control_from_dock(Control *p_control) { - Control *dock = NULL; + Control *dock = nullptr; for (int i = 0; i < DOCK_SLOT_MAX; i++) { if (p_control->get_parent() == dock_slot[i]) { dock = dock_slot[i]; @@ -5083,7 +5109,7 @@ void EditorNode::add_tool_menu_item(const String &p_name, Object *p_handler, con void EditorNode::add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu) { ERR_FAIL_NULL(p_submenu); - ERR_FAIL_COND(p_submenu->get_parent() != NULL); + ERR_FAIL_COND(p_submenu->get_parent() != nullptr); tool_menu->add_child(p_submenu); tool_menu->add_submenu_item(p_name, p_submenu->get_name(), TOOLS_CUSTOM); @@ -5470,7 +5496,7 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err static void _execute_thread(void *p_ud) { EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud; - Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex); + Error err = OS::get_singleton()->execute(eta->path, eta->args, true, nullptr, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex); print_verbose("Thread exit status: " + itos(eta->exitcode)); if (err != OK) { eta->exitcode = err; @@ -5908,7 +5934,7 @@ EditorNode::EditorNode() { dock_vb->add_child(dock_select); dock_float = memnew(Button); - dock_float->set_text("Make Floating"); + dock_float->set_text(TTR("Make Floating")); dock_float->set_focus_mode(Control::FOCUS_NONE); dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER); dock_float->connect("pressed", callable_mp(this, &EditorNode::_dock_make_float)); @@ -6250,7 +6276,8 @@ EditorNode::EditorNode() { p->add_separator(); p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS); p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Q&A")), HELP_QA); - p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/issue_tracker", TTR("Issue Tracker")), HELP_ISSUES); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/report_a_bug", TTR("Report a Bug")), HELP_REPORT_A_BUG); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/send_docs_feedback", TTR("Send Docs Feedback")), HELP_SEND_DOCS_FEEDBACK); p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY); p->add_separator(); p->add_icon_shortcut(gui_base->get_theme_icon("Godot", "EditorIcons"), ED_SHORTCUT("editor/about", TTR("About")), HELP_ABOUT); @@ -6690,7 +6717,7 @@ EditorNode::EditorNode() { update_spinner_step_frame = Engine::get_singleton()->get_frames_drawn(); update_spinner_step = 0; - editor_plugin_screen = NULL; + editor_plugin_screen = nullptr; editor_plugins_over = memnew(EditorPluginList); editor_plugins_force_over = memnew(EditorPluginList); editor_plugins_force_input_forwarding = memnew(EditorPluginList); @@ -6701,7 +6728,7 @@ EditorNode::EditorNode() { EditorExport::get_singleton()->add_export_plugin(export_text_to_binary_plugin); _edit_current(); - current = NULL; + current = nullptr; saving_resource = Ref<Resource>(); reference_resource_mem = true; @@ -6718,7 +6745,7 @@ EditorNode::EditorNode() { saved_version = 1; unsaved_cache = true; - _last_instanced_scene = NULL; + _last_instanced_scene = nullptr; quick_open = memnew(EditorQuickOpen); gui_base->add_child(quick_open); diff --git a/editor/editor_node.h b/editor/editor_node.h index 9d251690d2..c6f04b0749 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -194,7 +194,8 @@ private: HELP_SEARCH, HELP_DOCS, HELP_QA, - HELP_ISSUES, + HELP_REPORT_A_BUG, + HELP_SEND_DOCS_FEEDBACK, HELP_COMMUNITY, HELP_ABOUT, diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 8faaabc1fb..746ebc8292 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -51,7 +51,7 @@ Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_ meshes.push_back(p_meshes[i]); } - Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, NULL, p_preview_size); + Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, nullptr, p_preview_size); Array ret; for (int i = 0; i < textures.size(); i++) { ret.push_back(textures[i]); @@ -97,7 +97,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh } Transform mesh_xform; - if (p_transforms != NULL) { + if (p_transforms != nullptr) { mesh_xform = (*p_transforms)[i]; } @@ -194,7 +194,7 @@ Array EditorInterface::get_open_scenes() const { int scns_amount = scenes.size(); for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) { - if (scenes[idx_scn].root == NULL) + if (scenes[idx_scn].root == nullptr) continue; ret.push_back(scenes[idx_scn].root->get_filename()); } @@ -278,7 +278,7 @@ void EditorInterface::set_distraction_free_mode(bool p_enter) { EditorNode::get_singleton()->set_distraction_free_mode(p_enter); } -EditorInterface *EditorInterface::singleton = NULL; +EditorInterface *EditorInterface::singleton = nullptr; void EditorInterface::_bind_methods() { @@ -337,7 +337,7 @@ void EditorPlugin::remove_autoload_singleton(const String &p_name) { } ToolButton *EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) { - ERR_FAIL_NULL_V(p_control, NULL); + ERR_FAIL_NULL_V(p_control, nullptr); return EditorNode::get_singleton()->add_bottom_panel_item(p_title, p_control); } @@ -914,7 +914,7 @@ void EditorPlugin::_bind_methods() { } EditorPlugin::EditorPlugin() : - undo_redo(NULL), + undo_redo(nullptr), input_event_forwarding_always_enabled(false), force_draw_over_forwarding_enabled(false), last_main_screen_name("") { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 12b042d0e5..2ca96ceed2 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -268,7 +268,7 @@ class EditorPlugins { public: static int get_plugin_count() { return creation_func_count; } static EditorPlugin *create(int p_idx, EditorNode *p_editor) { - ERR_FAIL_INDEX_V(p_idx, creation_func_count, NULL); + ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr); return creation_funcs[p_idx](p_editor); } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index af83e808fc..cf478f20e5 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -165,8 +165,8 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() { open_big_text = memnew(ToolButton); open_big_text->connect("pressed", callable_mp(this, &EditorPropertyMultilineText::_open_big_text)); hb->add_child(open_big_text); - big_text_dialog = NULL; - big_text = NULL; + big_text_dialog = nullptr; + big_text = nullptr; } ///////////////////// TEXT ENUM ///////////////////////// @@ -303,7 +303,7 @@ EditorPropertyPath::EditorPropertyPath() { path_edit->set_clip_text(true); path_hb->add_child(path_edit); add_focusable(path); - dialog = NULL; + dialog = nullptr; path_edit->connect("pressed", callable_mp(this, &EditorPropertyPath::_path_pressed)); folder = false; global = false; @@ -448,7 +448,7 @@ void EditorPropertyMember::_bind_methods() { } EditorPropertyMember::EditorPropertyMember() { - selector = NULL; + selector = nullptr; property = memnew(Button); property->set_clip_text(true); add_child(property); @@ -1882,7 +1882,7 @@ EditorPropertyColor::EditorPropertyColor() { void EditorPropertyNodePath::_node_selected(const NodePath &p_path) { NodePath path = p_path; - Node *base_node = NULL; + Node *base_node = nullptr; if (!use_path_from_scene_root) { base_node = Object::cast_to<Node>(get_edited_object()); @@ -1945,7 +1945,7 @@ void EditorPropertyNodePath::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); @@ -2008,7 +2008,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() { hbc->add_child(clear); use_path_from_scene_root = false; - scene_tree = NULL; //do not allocate unnecessarily + scene_tree = nullptr; //do not allocate unnecessarily } ///////////////////// RID ///////////////////////// @@ -2196,7 +2196,7 @@ void EditorPropertyResource::_menu_option(int p_which) { file_system_dock->navigate_to_path(res->get_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; default: { @@ -2248,7 +2248,7 @@ void EditorPropertyResource::_menu_option(int p_which) { return; } - Object *obj = NULL; + Object *obj = nullptr; if (ScriptServer::is_global_class(intype)) { obj = ClassDB::instance(ScriptServer::get_global_class_native_base(intype)); @@ -2598,10 +2598,10 @@ void EditorPropertyResource::update_property() { sub_inspector->refresh(); } else { if (sub_inspector) { - set_bottom_editor(NULL); + set_bottom_editor(nullptr); memdelete(sub_inspector_vbox); - sub_inspector = NULL; - sub_inspector_vbox = NULL; + sub_inspector = nullptr; + sub_inspector_vbox = nullptr; if (opened_editor) { EditorNode::get_singleton()->hide_top_editors(); opened_editor = false; @@ -2823,8 +2823,8 @@ void EditorPropertyResource::_bind_methods() { EditorPropertyResource::EditorPropertyResource() { opened_editor = false; - sub_inspector = NULL; - sub_inspector_vbox = NULL; + sub_inspector = nullptr; + sub_inspector_vbox = nullptr; use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector")); HBoxContainer *hbc = memnew(HBoxContainer); @@ -2860,8 +2860,8 @@ EditorPropertyResource::EditorPropertyResource() { edit->connect("gui_input", callable_mp(this, &EditorPropertyResource::_button_input)); add_focusable(edit); - file = NULL; - scene_tree = NULL; + file = nullptr; + scene_tree = nullptr; dropping = false; add_to_group("_editor_resource_properties"); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 13eb2e19d6..b4ce60171b 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -199,7 +199,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) { Variant value; Callable::CallError ce; - value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); + value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce); Variant array = object->get_array(); array.set(changing_type_idx, value); @@ -263,9 +263,9 @@ void EditorPropertyArray::update_property() { edit->set_text(String("(Nil) ") + arrtype); edit->set_pressed(false); if (vbox) { - set_bottom_editor(NULL); + set_bottom_editor(nullptr); memdelete(vbox); - vbox = NULL; + vbox = nullptr; } return; } @@ -340,7 +340,7 @@ void EditorPropertyArray::update_property() { for (int i = 0; i < amount; i++) { String prop_name = "indices/" + itos(i + offset); - EditorProperty *prop = NULL; + EditorProperty *prop = nullptr; Variant value = array.get(i + offset); Variant::Type value_type = value.get_type(); @@ -353,7 +353,7 @@ void EditorPropertyArray::update_property() { editor->setup("Object"); prop = editor; } else { - prop = EditorInspector::instantiate_property_editor(NULL, value_type, "", subtype_hint, subtype_hint_string, 0); + prop = EditorInspector::instantiate_property_editor(nullptr, value_type, "", subtype_hint, subtype_hint_string, 0); } prop->set_object_and_property(object.ptr(), prop_name); @@ -391,9 +391,9 @@ void EditorPropertyArray::update_property() { } else { if (vbox) { - set_bottom_editor(NULL); + set_bottom_editor(nullptr); memdelete(vbox); - vbox = NULL; + vbox = nullptr; } } } @@ -419,7 +419,7 @@ void EditorPropertyArray::_edit_pressed() { Variant array = get_edited_object()->get(get_edited_property()); if (!array.is_array()) { Callable::CallError ce; - array = Variant::construct(array_type, NULL, 0, ce); + array = Variant::construct(array_type, nullptr, 0, ce); get_edited_object()->set(get_edited_property(), array); } @@ -450,7 +450,7 @@ void EditorPropertyArray::_length_changed(double p_page) { for (int i = previous_size; i < size; i++) { if (array.get(i).get_type() == Variant::NIL) { Callable::CallError ce; - array.set(i, Variant::construct(subtype, NULL, 0, ce)); + array.set(i, Variant::construct(subtype, nullptr, 0, ce)); } } } @@ -460,7 +460,7 @@ void EditorPropertyArray::_length_changed(double p_page) { // Pool*Array don't initialize their elements, have to do it manually for (int i = previous_size; i < size; i++) { Callable::CallError ce; - array.set(i, Variant::construct(array.get(i).get_type(), NULL, 0, ce)); + array.set(i, Variant::construct(array.get(i).get_type(), nullptr, 0, ce)); } } @@ -505,9 +505,9 @@ EditorPropertyArray::EditorPropertyArray() { edit->set_toggle_mode(true); add_child(edit); add_focusable(edit); - vbox = NULL; - page = NULL; - length = NULL; + vbox = nullptr; + page = nullptr; + length = nullptr; updating = false; change_type = memnew(PopupMenu); add_child(change_type); @@ -585,7 +585,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) { if (changing_type_idx < 0) { Variant value; Callable::CallError ce; - value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); + value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce); if (changing_type_idx == -1) { object->set_new_item_key(value); } else { @@ -601,7 +601,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) { Variant value; Callable::CallError ce; - value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); + value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce); Variant key = dict.get_key_at_index(changing_type_idx); dict[key] = value; } else { @@ -624,9 +624,9 @@ void EditorPropertyDictionary::update_property() { edit->set_text("Dictionary (Nil)"); //This provides symmetry with the array property. edit->set_pressed(false); if (vbox) { - set_bottom_editor(NULL); + set_bottom_editor(nullptr); memdelete(vbox); - vbox = NULL; + vbox = nullptr; } return; } @@ -683,7 +683,7 @@ void EditorPropertyDictionary::update_property() { dict = dict.duplicate(); object->set_dict(dict); - VBoxContainer *add_vbox = NULL; + VBoxContainer *add_vbox = nullptr; for (int i = 0; i < amount + 2; i++) { String prop_name; @@ -702,7 +702,7 @@ void EditorPropertyDictionary::update_property() { value = object->get_new_item_value(); } - EditorProperty *prop = NULL; + EditorProperty *prop = nullptr; switch (value.get_type()) { case Variant::NIL: { @@ -962,9 +962,9 @@ void EditorPropertyDictionary::update_property() { } else { if (vbox) { - set_bottom_editor(NULL); + set_bottom_editor(nullptr); memdelete(vbox); - vbox = NULL; + vbox = nullptr; } } } @@ -981,7 +981,7 @@ void EditorPropertyDictionary::_edit_pressed() { Variant prop_val = get_edited_object()->get(get_edited_property()); if (prop_val.get_type() == Variant::NIL) { Callable::CallError ce; - prop_val = Variant::construct(Variant::DICTIONARY, NULL, 0, ce); + prop_val = Variant::construct(Variant::DICTIONARY, nullptr, 0, ce); get_edited_object()->set(get_edited_property(), prop_val); } @@ -1012,8 +1012,8 @@ EditorPropertyDictionary::EditorPropertyDictionary() { edit->set_toggle_mode(true); add_child(edit); add_focusable(edit); - vbox = NULL; - page = NULL; + vbox = nullptr; + page = nullptr; updating = false; change_type = memnew(PopupMenu); add_child(change_type); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 4db8fb98f1..2a4300f833 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -99,7 +99,7 @@ void EditorResourcePreviewGenerator::_bind_methods() { EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() { } -EditorResourcePreview *EditorResourcePreview::singleton = NULL; +EditorResourcePreview *EditorResourcePreview::singleton = nullptr; void EditorResourcePreview::_thread_func(void *ud) { @@ -469,12 +469,12 @@ void EditorResourcePreview::stop() { } Thread::wait_to_finish(thread); memdelete(thread); - thread = NULL; + thread = nullptr; } } EditorResourcePreview::EditorResourcePreview() { - thread = NULL; + thread = nullptr; singleton = this; order = 0; exit = false; diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp index 628055cac6..c03fd4f6f5 100644 --- a/editor/editor_run_script.cpp +++ b/editor/editor_run_script.cpp @@ -56,7 +56,7 @@ Node *EditorScript::get_scene() { if (!editor) { EditorNode::add_io_error("EditorScript::get_scene: " + TTR("Write your logic in the _run() method.")); - return NULL; + return nullptr; } return editor->get_edited_scene(); @@ -73,7 +73,7 @@ void EditorScript::_run() { Callable::CallError ce; ce.error = Callable::CallError::CALL_OK; - get_script_instance()->call("_run", NULL, 0, ce); + get_script_instance()->call("_run", nullptr, 0, ce); if (ce.error != Callable::CallError::CALL_OK) { EditorNode::add_io_error(TTR("Couldn't run script:") + "\n " + s->get_path() + "\n" + TTR("Did you forget the '_run' method?")); @@ -95,5 +95,5 @@ void EditorScript::_bind_methods() { EditorScript::EditorScript() { - editor = NULL; + editor = nullptr; } diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index 2c895a3e9d..bccc38ca1b 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -127,7 +127,7 @@ public: } SectionedInspectorFilter() { - edited = NULL; + edited = nullptr; } }; @@ -142,7 +142,7 @@ void SectionedInspector::_section_selected() { return; selected_category = sections->get_selected()->get_metadata(0); - filter->set_section(selected_category, sections->get_selected()->get_children() == NULL); + filter->set_section(selected_category, sections->get_selected()->get_children() == nullptr); inspector->set_property_prefix(selected_category + "/"); } @@ -177,8 +177,8 @@ void SectionedInspector::edit(Object *p_object) { obj = ObjectID(); sections->clear(); - filter->set_edited(NULL); - inspector->edit(NULL); + filter->set_edited(nullptr); + inspector->edit(nullptr); return; } @@ -308,7 +308,7 @@ SectionedInspector::SectionedInspector() : sections(memnew(Tree)), filter(memnew(SectionedInspectorFilter)), inspector(memnew(EditorInspector)), - search_box(NULL) { + search_box(nullptr) { add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up VBoxContainer *left_vb = memnew(VBoxContainer); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 286ca7b184..5d5bb1242d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -53,7 +53,7 @@ // PRIVATE METHODS -Ref<EditorSettings> EditorSettings::singleton = NULL; +Ref<EditorSettings> EditorSettings::singleton = nullptr; // Properties @@ -177,7 +177,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { _THREAD_SAFE_METHOD_ - const String *k = NULL; + const String *k = nullptr; Set<_EVCSort> vclist; while ((k = props.next(k))) { @@ -341,6 +341,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["interface/editor/unfocused_low_processor_mode_sleep_usec"] = PropertyInfo(Variant::FLOAT, "interface/editor/unfocused_low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/separate_distraction_mode", false); _initial_set("interface/editor/automatically_open_screenshots", true); + _initial_set("interface/editor/single_window_mode", false); + hints["interface/editor/single_window_mode"] = PropertyInfo(Variant::BOOL, "interface/editor/single_window_mode", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/hide_console_window", false); _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression _initial_set("interface/editor/quit_confirmation", true); @@ -778,7 +780,7 @@ void EditorSettings::create() { if (singleton.ptr()) return; //pointless - DirAccess *dir = NULL; + DirAccess *dir = nullptr; String data_path; String data_dir; @@ -1524,7 +1526,7 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) { Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) { if (!EditorSettings::get_singleton()) { - return NULL; + return nullptr; } Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path); diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 2c115c66cb..4eefe844d2 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -362,7 +362,7 @@ void EditorSpinSlider::_evaluate_input_text() { return; } - Variant v = expr->execute(Array(), NULL, false); + Variant v = expr->execute(Array(), nullptr, false); if (v.get_type() == Variant::NIL) return; set_value(v); diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index cd5768551f..1205e0b37c 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -46,7 +46,7 @@ void EditorSubScene::_path_changed(const String &p_path) { if (scene) { memdelete(scene); - scene = NULL; + scene = nullptr; } if (p_path == "") @@ -61,7 +61,7 @@ void EditorSubScene::_path_changed(const String &p_path) { if (!scene) return; - _fill_tree(scene, NULL); + _fill_tree(scene, nullptr); } void EditorSubScene::_path_browse() { @@ -72,7 +72,7 @@ void EditorSubScene::_path_browse() { void EditorSubScene::_notification(int p_what) { if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible() && scene == NULL) { + if (is_visible() && scene == nullptr) { _path_browse(); } } @@ -209,7 +209,7 @@ void EditorSubScene::move(Node *p_new_parent, Node *p_new_owner) { if (!is_root) { memdelete(scene); } - scene = NULL; + scene = nullptr; //return selnode; } @@ -226,7 +226,7 @@ void EditorSubScene::_bind_methods() { EditorSubScene::EditorSubScene() { - scene = NULL; + scene = nullptr; is_root = false; set_title(TTR("Select Node(s) to Import")); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ac902854b7..576ee436de 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -248,7 +248,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = } } - ImageLoaderSVG::set_convert_colors(NULL); + ImageLoaderSVG::set_convert_colors(nullptr); #else WARN_PRINT("SVG support disabled, editor icons won't be rendered."); #endif @@ -418,7 +418,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { //Register icons + font // the resolution and the icon color (dark_theme bool) has not changed, so we do not regenerate the icons - if (p_theme != NULL && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) { + if (p_theme != nullptr && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) { // register already generated icons for (int i = 0; i < editor_icons_count; i++) { theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons")); @@ -427,7 +427,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { editor_register_and_generate_icons(theme, dark_theme, thumb_size); } // thumbnail size has changed, so we regenerate the medium sizes - if (p_theme != NULL && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) { + if (p_theme != nullptr && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) { editor_register_and_generate_icons(p_theme, dark_theme, thumb_size, true); } @@ -961,12 +961,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); theme->set_stylebox("slider", "HSlider", make_flat_stylebox(dark_color_3, 0, default_margin_size / 2, 0, default_margin_size / 2)); theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2)); + theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2)); // VSlider theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); theme->set_stylebox("slider", "VSlider", make_flat_stylebox(dark_color_3, default_margin_size / 2, 0, default_margin_size / 2, 0)); theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0)); + theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0)); //RichTextLabel theme->set_color("default_color", "RichTextLabel", font_color); @@ -977,8 +979,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); - theme->set_stylebox("panel", "EditorHelpBit", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); - theme->set_color("headline_color", "EditorHelp", mono_color); // Panel @@ -997,6 +997,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // LinkButton theme->set_stylebox("focus", "LinkButton", style_empty); theme->set_color("font_color", "LinkButton", font_color); + theme->set_color("font_color_hover", "LinkButton", font_color_hl); + theme->set_color("font_color_pressed", "LinkButton", accent_color); + theme->set_color("font_color_disabled", "LinkButton", font_color_disabled); // TooltipPanel Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate(); diff --git a/editor/editor_themes.h b/editor/editor_themes.h index 6e9630804f..4d9bfc56c8 100644 --- a/editor/editor_themes.h +++ b/editor/editor_themes.h @@ -33,8 +33,8 @@ #include "scene/resources/theme.h" -Ref<Theme> create_editor_theme(Ref<Theme> p_theme = NULL); +Ref<Theme> create_editor_theme(Ref<Theme> p_theme = nullptr); -Ref<Theme> create_custom_theme(Ref<Theme> p_theme = NULL); +Ref<Theme> create_custom_theme(Ref<Theme> p_theme = nullptr); #endif diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp index c420cf44e7..6f3a8d9ea7 100644 --- a/editor/editor_vcs_interface.cpp +++ b/editor/editor_vcs_interface.cpp @@ -30,7 +30,7 @@ #include "editor_vcs_interface.h" -EditorVCSInterface *EditorVCSInterface::singleton = NULL; +EditorVCSInterface *EditorVCSInterface::singleton = nullptr; void EditorVCSInterface::_bind_methods() { diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 61ec9c44c2..7cb18432a7 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -184,7 +184,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ // unzClose() will take care of closing the file stored in the unzFile, // so we don't need to `memdelete(fa)` in this method. - FileAccess *fa = NULL; + FileAccess *fa = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&fa); unzFile pkg = unzOpen2(p_file.utf8().get_data(), &io); @@ -203,7 +203,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ unz_file_info info; char fname[16384]; - ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); String file = fname; @@ -258,7 +258,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ ret = unzGoToFirstFile(pkg); - EditorProgress *p = NULL; + EditorProgress *p = nullptr; if (p_use_progress) { p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc)); } @@ -270,7 +270,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ //get filename unz_file_info info; char fname[16384]; - unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); String file_path(String(fname).simplify_path()); @@ -587,7 +587,7 @@ Error ExportTemplateManager::install_android_template() { const String &source_zip = templates_path.plus_file("android_source.zip"); ERR_FAIL_COND_V(!FileAccess::exists(source_zip), ERR_CANT_OPEN); - FileAccess *src_f = NULL; + FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(source_zip.utf8().get_data(), &io); @@ -611,7 +611,7 @@ Error ExportTemplateManager::install_android_template() { // Get file path. unz_file_info info; char fpath[16384]; - ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, NULL, 0, NULL, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, nullptr, 0, nullptr, 0); String path = fpath; String base_dir = path.get_base_dir(); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e1fcddda3a..236ae16ccf 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -843,7 +843,7 @@ void FileSystemDock::_tree_activate_file() { if (selected) { String path = selected->get_metadata(0); TreeItem *parent = selected->get_parent(); - bool is_favorite = parent != NULL && parent->get_metadata(0) == "Favorites"; + bool is_favorite = parent != nullptr && parent->get_metadata(0) == "Favorites"; if ((!is_favorite && path.ends_with("/")) || path == "Favorites") { bool collapsed = selected->is_collapsed(); @@ -955,7 +955,7 @@ void FileSystemDock::_push_to_history() { } void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const { - if (efsd == NULL) + if (efsd == nullptr) return; for (int i = 0; i < efsd->get_subdir_count(); i++) { @@ -1871,7 +1871,7 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) return Variant(); } - bool is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent(); + bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_children() == selected->get_parent(); all_favorites &= is_favorite; all_not_favorites &= !is_favorite; selected = tree->get_next_selected(selected); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 61afc9115f..d73180c831 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -708,7 +708,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin TreeItem *file_item; Map<String, TreeItem *>::Element *E = _file_items.find(fpath); - if (E == NULL) { + if (E == nullptr) { file_item = _results_display->create_item(); file_item->set_text(0, fpath); file_item->set_metadata(0, fpath); @@ -813,7 +813,7 @@ void FindInFilesPanel::_on_result_selected() { TreeItem *item = _results_display->get_selected(); Map<TreeItem *, Result>::Element *E = _result_items.find(item); - if (E == NULL) + if (E == nullptr) return; Result r = E->value(); @@ -845,7 +845,7 @@ void FindInFilesPanel::_on_replace_all_clicked() { continue; Map<TreeItem *, Result>::Element *F = _result_items.find(item); - ERR_FAIL_COND(F == NULL); + ERR_FAIL_COND(F == nullptr); locations.push_back(F->value()); } diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 686ca869a6..7e5d2e87d6 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -68,7 +68,7 @@ void GroupDialog::_load_nodes(Node *p_current) { keep = false; } - TreeItem *node = NULL; + TreeItem *node = nullptr; NodePath path = scene_tree->get_edited_scene_root()->get_path_to(p_current); if (keep && p_current->is_in_group(selected_group)) { if (remove_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) { @@ -122,7 +122,7 @@ bool GroupDialog::_can_edit(Node *p_node, String p_group) { } void GroupDialog::_add_pressed() { - TreeItem *selected = nodes_to_add->get_next_selected(NULL); + TreeItem *selected = nodes_to_add->get_next_selected(nullptr); if (!selected) { return; @@ -151,7 +151,7 @@ void GroupDialog::_add_pressed() { } void GroupDialog::_removed_pressed() { - TreeItem *selected = nodes_to_remove->get_next_selected(NULL); + TreeItem *selected = nodes_to_remove->get_next_selected(nullptr); if (!selected) { return; @@ -662,7 +662,7 @@ void GroupsEditor::_bind_methods() { GroupsEditor::GroupsEditor() { - node = NULL; + node = nullptr; VBoxContainer *vbc = this; diff --git a/editor/icons/AcceptDialog.svg b/editor/icons/AcceptDialog.svg index e0bf7b8336..07e54d722f 100644 --- a/editor/icons/AcceptDialog.svg +++ b/editor/icons/AcceptDialog.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/ConfirmationDialog.svg b/editor/icons/ConfirmationDialog.svg index d1f13fbb3b..2d6e45b51f 100644 --- a/editor/icons/ConfirmationDialog.svg +++ b/editor/icons/ConfirmationDialog.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm6.9863 1.002c.34689-.0022844.6986.055762 1.0391.17969 1.3618.4956 2.1813 1.9126 1.9297 3.3398-.19105 1.0835-.96172 1.9461-1.9551 2.3008v.17773h-1-1v-.8418a1.0001 1.0001 0 0 1 1-1.1582c.49193 0 .89895-.34177.98438-.82617.085424-.4845-.18031-.94508-.64258-1.1133-.46227-.1683-.96106.013453-1.207.43945a1.0002 1.0002 0 0 1 -1.7324-1c.54346-.94148 1.5433-1.4912 2.584-1.498zm-.98633 6.998h2v1h-2z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm6.9863 1.002c.34689-.0022844.6986.055762 1.0391.17969 1.3618.4956 2.1813 1.9126 1.9297 3.3398-.19105 1.0835-.96172 1.9461-1.9551 2.3008v.17773h-1-1v-.8418a1.0001 1.0001 0 0 1 1-1.1582c.49193 0 .89895-.34177.98438-.82617.085424-.4845-.18031-.94508-.64258-1.1133-.46227-.1683-.96106.013453-1.207.43945a1.0002 1.0002 0 0 1 -1.7324-1c.54346-.94148 1.5433-1.4912 2.584-1.498zm-.98633 6.998h2v1h-2z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/PopupDialog.svg b/editor/icons/EditorFileDialog.svg index d871e56a63..95906234ab 100644 --- a/editor/icons/PopupDialog.svg +++ b/editor/icons/EditorFileDialog.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm6 1h2v5h-2zm0 6h2v2h-2z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm3 2h3c1 0 1 2 2 2h3v4h-8z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/FileDialog.svg b/editor/icons/FileDialog.svg index 7708659c21..95906234ab 100644 --- a/editor/icons/FileDialog.svg +++ b/editor/icons/FileDialog.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm3 2h3c1 0 1 2 2 2h3v4h-8z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm3 2h3c1 0 1 2 2 2h3v4h-8z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/Popup.svg b/editor/icons/Popup.svg index 93f7e5000d..a497b7a7fc 100644 --- a/editor/icons/Popup.svg +++ b/editor/icons/Popup.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h10c1.1046 0 2-.89543 2-2v-10c0-1.1046-.89543-2-2-2zm4 2h2v6h-2zm0 8h2v2h-2z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h10c1.1046 0 2-.89543 2-2v-10c0-1.1046-.89543-2-2-2zm4 2h2v6h-2zm0 8h2v2h-2z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/PopupMenu.svg b/editor/icons/PopupMenu.svg index dd7b2bb0fd..ebf62208e0 100644 --- a/editor/icons/PopupMenu.svg +++ b/editor/icons/PopupMenu.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v4h6v-4zm1 1h4l-2 2zm0 4a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-7a1 1 0 0 0 -1-1zm1 2h10v2h-10zm0 3h10v2h-10z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v4h6v-4zm1 1h4l-2 2zm0 4a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-7a1 1 0 0 0 -1-1zm1 2h10v2h-10zm0 3h10v2h-10z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/PopupPanel.svg b/editor/icons/PopupPanel.svg index 47a5448f5b..b45a3c9c3c 100644 --- a/editor/icons/PopupPanel.svg +++ b/editor/icons/PopupPanel.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v4h6v-4zm1 1h4l-2 2zm0 4c-.55228 0-1 .44772-1 1v7c0 .55228.44772 1 1 1h12c.55228 0 1-.44772 1-1v-7c0-.55228-.44772-1-1-1z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v4h6v-4zm1 1h4l-2 2zm0 4c-.55228 0-1 .44772-1 1v7c0 .55228.44772 1 1 1h12c.55228 0 1-.44772 1-1v-7c0-.55228-.44772-1-1-1z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/ScriptCreateDialog.svg b/editor/icons/ScriptCreateDialog.svg index 751b799ba9..78a69c5e59 100644 --- a/editor/icons/ScriptCreateDialog.svg +++ b/editor/icons/ScriptCreateDialog.svg @@ -1 +1 @@ -<svg height="17.067" viewBox="0 0 16 16" width="17.067" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1036.4)"><path d="m6 1v1c-.55228 0-1 .44772-1 1v10h-1v-2h-2v2c.0002826.35698.19084.68674.5.86523.15194.088045.32439.13452.5.13477v1h6v-5l3-2v-3h3v-2c0-1.1046-.89543-2-2-2z" fill="#a5efac" transform="translate(0 1036.4)"/><path d="m6 1c-1.1046 0-2 .89543-2 2v7h-3v3c0 1.1046.89543 2 2 2s2-.89543 2-2v-10c0-.55228.44772-1 1-1s1 .44772 1 1v3h5v-1h-4v-2c0-1.1046-.89543-2-2-2zm-4 10h2v2c0 .55228-.44772 1-1 1s-1-.44772-1-1z" fill="#87e29f" transform="translate(0 1036.4)"/><circle cx="3" cy="1048.4" fill="#e0e0e0" r="0"/><g fill="#87e29f"><ellipse cx="12" cy="1048.4" rx=".5" ry="3"/><ellipse cx="913.91" cy="513.79" rx=".5" ry="3" transform="matrix(.5 .8660254 -.8660254 .5 0 0)"/><ellipse cx="901.91" cy="-534.57" rx=".5" ry="3" transform="matrix(-.5 .8660254 -.8660254 -.5 0 0)"/></g></g></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8zm5.5722656 1h3.9980464a1.1426143 1.1426143 0 0 1 1.142579 1.1425781v1.1425781h-1.712891-2.2851562v-.5703124-.5722657c0-.6310659-.5115295-1.1425781-1.1425782-1.1425781zm0 .5722656c.3155215 0 .5703125.254791.5703125.5703125v.5722657.5703124.5722657h.5722657 2.2851562v3.9980471a1.1426143 1.1426143 0 0 1 -1.1425781 1.142578h-4c.6310487 0 1.1425781-.511529 1.1425781-1.142578v-5.7128909c0-.0785019.01823-.1545692.046875-.2226562v-.0019531c.02868-.0672829.0683226-.1266374.1191406-.1777344.00097-.00096.0029352-.0010048.0039063-.0019532.0513303-.0508898.1121075-.0944618.1796875-.1230468.0683505-.028909.1437752-.0429688.2226562-.0429688zm-2.2851562 5.1406254h1.1425781v1.142578c0 .315522-.2567441.572265-.5722656.572265-.0776611 0-.15125-.016852-.21875-.044922-.00206-.000799-.0038594-.003049-.0058594-.003906-.0656506-.028192-.1236101-.067817-.1738281-.117187a.57130715.57130715 0 0 1 -.0097656-.009766c-.0490902-.050487-.0893425-.107988-.1171876-.173828-.028908-.06835-.0449218-.143776-.0449218-.222656z"/><circle cx="-23.915255" cy="3.118624" r="0"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/SubViewport.svg b/editor/icons/SubViewport.svg new file mode 100644 index 0000000000..103b1006ad --- /dev/null +++ b/editor/icons/SubViewport.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 2c-.5304.0000801-1.0390625.2108475-1.4140625.5859375-.37509.37501-.5858575.8836225-.5859375 1.4140625v8c.0000803.5304.2108475 1.039063.5859375 1.414062.37501.375091.8836225.585858 1.4140625.585938h10c1.1046 0 2-.89543 2-2v-8c0-1.1046-.89543-2-2-2zm0 1h10c.55228.0000096.99999.44772 1 1v8c-.00001.55228-.44772.99999-1 1h-10c-.55228-.00001-.99999-.44772-1-1v-8c.0000096-.55228.44772-.99999 1-1zm3 1c-.5304.0001-1.0390625.2108375-1.4140625.5859375-.37509.375-.5858575.8836225-.5859375 1.4140625v4c.00008.5304.2108475 1.039062.5859375 1.414062.37501.3751.8836225.585838 1.4140625.585938h4c1.1046 0 2-.8954 2-2v-4c0-1.1046-.89543-2-2-2zm0 1h4c.55228 0 .99999.4477 1 1v4c-.00001.5523-.44772 1-1 1h-4c-.55228 0-.99999-.4477-1-1v-4c.00001-.5523.44772-1 1-1z" fill="#e0e0e0" fill-opacity=".996078"/></svg>
\ No newline at end of file diff --git a/editor/icons/ViewportContainer.svg b/editor/icons/SubViewportContainer.svg index 18dcddc15f..18dcddc15f 100644 --- a/editor/icons/ViewportContainer.svg +++ b/editor/icons/SubViewportContainer.svg diff --git a/editor/icons/WindowDialog.svg b/editor/icons/Window.svg index 3c7be2a58d..a02a86d56a 100644 --- a/editor/icons/WindowDialog.svg +++ b/editor/icons/Window.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8z" fill="#a5efac"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1c-1.1046 0-2 .8954-2 2v1h14v-1c0-1.1046-.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2v-8z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/ARVRAnchor.svg b/editor/icons/XRAnchor3D.svg index f1571b3fcc..f1571b3fcc 100644 --- a/editor/icons/ARVRAnchor.svg +++ b/editor/icons/XRAnchor3D.svg diff --git a/editor/icons/ARVRCamera.svg b/editor/icons/XRCamera3D.svg index f59a8c8b4a..f59a8c8b4a 100644 --- a/editor/icons/ARVRCamera.svg +++ b/editor/icons/XRCamera3D.svg diff --git a/editor/icons/ARVRController.svg b/editor/icons/XRController3D.svg index 40e5b8dce1..40e5b8dce1 100644 --- a/editor/icons/ARVRController.svg +++ b/editor/icons/XRController3D.svg diff --git a/editor/icons/ARVROrigin.svg b/editor/icons/XROrigin3D.svg index dbb93ba7a5..dbb93ba7a5 100644 --- a/editor/icons/ARVROrigin.svg +++ b/editor/icons/XROrigin3D.svg diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp index 8ef9d17083..9e49fa9066 100644 --- a/editor/import/collada.cpp +++ b/editor/import/collada.cpp @@ -1540,7 +1540,7 @@ Collada::Node *Collada::_parse_visual_node_instance_data(XMLParser &parser) { } if (parser.is_empty()) //nothing else to parse... - return NULL; + return nullptr; while (parser.read() == OK) { @@ -1548,7 +1548,7 @@ Collada::Node *Collada::_parse_visual_node_instance_data(XMLParser &parser) { break; } - return NULL; + return nullptr; } Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) { @@ -1572,7 +1572,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) { String empty_draw_type = ""; - Node *node = NULL; + Node *node = nullptr; name = parser.has_attribute("name") ? parser.get_attribute_value_safe("name") : parser.get_attribute_value_safe("id"); if (name == "") { @@ -2140,7 +2140,7 @@ void Collada::_create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton NodeJoint *nj = static_cast<NodeJoint *>(node); nj->owner = p_skeleton; } else { - p_skeleton = NULL; + p_skeleton = nullptr; } for (int i = 0; i < node->children.size(); i++) { @@ -2240,7 +2240,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) { SkinControllerData &cd = E->get(); - NodeSkeleton *skeleton = NULL; + NodeSkeleton *skeleton = nullptr; for (Map<String, Transform>::Element *F = cd.bone_rest_map.front(); F; F = F->next()) { @@ -2257,7 +2257,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) { Node *node = state.scene_map[name]; ERR_CONTINUE(node->type != Node::TYPE_JOINT); - NodeSkeleton *sk = NULL; + NodeSkeleton *sk = nullptr; while (node && !sk) { diff --git a/editor/import/collada.h b/editor/import/collada.h index 4707d7d779..b74332fb22 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -404,7 +404,7 @@ public: Node() { noname = false; type = TYPE_NODE; - parent = NULL; + parent = nullptr; ignore_anim = false; } virtual ~Node() { @@ -424,7 +424,7 @@ public: String sid; NodeJoint() { type = TYPE_JOINT; - owner = NULL; + owner = nullptr; } }; @@ -631,7 +631,7 @@ private: // private stuff String _read_empty_draw_type(XMLParser &parser); void _joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner); - void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton = NULL); + void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton = nullptr); void _find_morph_nodes(VisualScene *p_vscene, Node *p_node); bool _remove_node(Node *p_parent, Node *p_node); void _remove_node(VisualScene *p_vscene, Node *p_node); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index f16c3a9e68..697ddfba96 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -58,7 +58,7 @@ struct ColladaImport { List<int> anim_tracks; NodeMap() { - node = NULL; + node = nullptr; bone = -1; } }; @@ -195,7 +195,7 @@ Error ColladaImport::_create_scene_skeletons(Collada::Node *p_node) { Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) { - Node3D *node = NULL; + Node3D *node = nullptr; switch (p_node->type) { @@ -536,7 +536,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me /* NORMAL SOURCE */ - const Collada::MeshData::Source *normal_src = NULL; + const Collada::MeshData::Source *normal_src = nullptr; int normal_ofs = 0; if (p.sources.has("NORMAL")) { @@ -547,7 +547,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me normal_src = &meshdata.sources[normal_source_id]; } - const Collada::MeshData::Source *binormal_src = NULL; + const Collada::MeshData::Source *binormal_src = nullptr; int binormal_ofs = 0; if (p.sources.has("TEXBINORMAL")) { @@ -558,7 +558,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me binormal_src = &meshdata.sources[binormal_source_id]; } - const Collada::MeshData::Source *tangent_src = NULL; + const Collada::MeshData::Source *tangent_src = nullptr; int tangent_ofs = 0; if (p.sources.has("TEXTANGENT")) { @@ -569,7 +569,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me tangent_src = &meshdata.sources[tangent_source_id]; } - const Collada::MeshData::Source *uv_src = NULL; + const Collada::MeshData::Source *uv_src = nullptr; int uv_ofs = 0; if (p.sources.has("TEXCOORD0")) { @@ -580,7 +580,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me uv_src = &meshdata.sources[uv_source_id]; } - const Collada::MeshData::Source *uv2_src = NULL; + const Collada::MeshData::Source *uv2_src = nullptr; int uv2_ofs = 0; if (p.sources.has("TEXCOORD1")) { @@ -591,7 +591,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me uv2_src = &meshdata.sources[uv2_source_id]; } - const Collada::MeshData::Source *color_src = NULL; + const Collada::MeshData::Source *color_src = nullptr; int color_ofs = 0; if (p.sources.has("COLOR")) { @@ -614,7 +614,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me if (p_skin_controller) { - const Collada::SkinControllerData::Source *weight_src = NULL; + const Collada::SkinControllerData::Source *weight_src = nullptr; int weight_ofs = 0; if (p_skin_controller->weights.sources.has("WEIGHT")) { @@ -1047,7 +1047,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres const Collada::CurveData::Source &interps = cd.sources[cd.control_vertices["INTERPOLATION"]]; ERR_FAIL_COND_V(interps.stride != 1, ERR_INVALID_DATA); - const Collada::CurveData::Source *tilts = NULL; + const Collada::CurveData::Source *tilts = nullptr; if (cd.control_vertices.has("TILT") && cd.sources.has(cd.control_vertices["TILT"])) tilts = &cd.sources[cd.control_vertices["TILT"]]; @@ -1091,8 +1091,8 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres ERR_FAIL_COND_V(!mi, ERR_BUG); - Collada::SkinControllerData *skin = NULL; - Collada::MorphControllerData *morph = NULL; + Collada::SkinControllerData *skin = nullptr; + Collada::MorphControllerData *morph = nullptr; String meshid; Transform apply_xform; Vector<int> bone_remap; @@ -1173,7 +1173,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2]; mesh->set_name(meshdata.name); - Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh>>(), false); + Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, nullptr, Vector<Ref<ArrayMesh>>(), false); ERR_FAIL_COND_V(err, err); morphs.push_back(mesh); @@ -1777,7 +1777,7 @@ Node *EditorSceneImporterCollada::import_scene(const String &p_path, uint32_t p_ Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_flags & EditorSceneImporter::IMPORT_USE_COMPRESSION); - ERR_FAIL_COND_V_MSG(err != OK, NULL, "Cannot load scene from file '" + p_path + "'."); + ERR_FAIL_COND_V_MSG(err != OK, nullptr, "Cannot load scene from file '" + p_path + "'."); if (state.missing_textures.size()) { diff --git a/editor/import/editor_import_collada.h b/editor/import/editor_import_collada.h index 822a6450be..932a064e76 100644 --- a/editor/import/editor_import_collada.h +++ b/editor/import/editor_import_collada.h @@ -40,7 +40,7 @@ class EditorSceneImporterCollada : public EditorSceneImporter { public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = NULL, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr); virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps); EditorSceneImporterCollada(); diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h index 4383b1b084..be4679b6d3 100644 --- a/editor/import/editor_import_plugin.h +++ b/editor/import/editor_import_plugin.h @@ -52,7 +52,7 @@ public: virtual int get_import_order() const; virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = nullptr); }; #endif //EDITOR_IMPORT_PLUGIN_H diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 208dc8fc26..6ad2aa4142 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1266,7 +1266,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b } Vector<uint8_t> data; - const uint8_t *data_ptr = NULL; + const uint8_t *data_ptr = nullptr; int data_size = 0; if (d.has("uri")) { @@ -1307,7 +1307,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b if (mimetype.findn("png") != -1) { //is a png - ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, ERR_UNAVAILABLE); const Ref<Image> img = Image::_png_mem_loader_func(data_ptr, data_size); @@ -1323,7 +1323,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b if (mimetype.findn("jpeg") != -1) { //is a jpg - ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, ERR_UNAVAILABLE); const Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size); @@ -2985,19 +2985,19 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla //text file Error err = _parse_glb(p_path, state); if (err) - return NULL; + return nullptr; } else { //text file Error err = _parse_json(p_path, state); if (err) - return NULL; + return nullptr; } - ERR_FAIL_COND_V(!state.json.has("asset"), NULL); + ERR_FAIL_COND_V(!state.json.has("asset"), nullptr); Dictionary asset = state.json["asset"]; - ERR_FAIL_COND_V(!asset.has("version"), NULL); + ERR_FAIL_COND_V(!asset.has("version"), nullptr); String version = asset["version"]; @@ -3008,77 +3008,77 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla /* STEP 0 PARSE SCENE */ Error err = _parse_scenes(state); if (err != OK) - return NULL; + return nullptr; /* STEP 1 PARSE NODES */ err = _parse_nodes(state); if (err != OK) - return NULL; + return nullptr; /* STEP 2 PARSE BUFFERS */ err = _parse_buffers(state, p_path.get_base_dir()); if (err != OK) - return NULL; + return nullptr; /* STEP 3 PARSE BUFFER VIEWS */ err = _parse_buffer_views(state); if (err != OK) - return NULL; + return nullptr; /* STEP 4 PARSE ACCESSORS */ err = _parse_accessors(state); if (err != OK) - return NULL; + return nullptr; /* STEP 5 PARSE IMAGES */ err = _parse_images(state, p_path.get_base_dir()); if (err != OK) - return NULL; + return nullptr; /* STEP 6 PARSE TEXTURES */ err = _parse_textures(state); if (err != OK) - return NULL; + return nullptr; /* STEP 7 PARSE TEXTURES */ err = _parse_materials(state); if (err != OK) - return NULL; + return nullptr; /* STEP 9 PARSE SKINS */ err = _parse_skins(state); if (err != OK) - return NULL; + return nullptr; /* STEP 10 DETERMINE SKELETONS */ err = _determine_skeletons(state); if (err != OK) - return NULL; + return nullptr; /* STEP 11 CREATE SKELETONS */ err = _create_skeletons(state); if (err != OK) - return NULL; + return nullptr; /* STEP 12 CREATE SKINS */ err = _create_skins(state); if (err != OK) - return NULL; + return nullptr; /* STEP 13 PARSE MESHES (we have enough info now) */ err = _parse_meshes(state); if (err != OK) - return NULL; + return nullptr; /* STEP 14 PARSE CAMERAS */ err = _parse_cameras(state); if (err != OK) - return NULL; + return nullptr; /* STEP 15 PARSE ANIMATIONS */ err = _parse_animations(state); if (err != OK) - return NULL; + return nullptr; /* STEP 16 ASSIGN SCENE NAMES */ _assign_scene_names(state); diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h index 79395cca93..d127a87782 100644 --- a/editor/import/editor_scene_importer_gltf.h +++ b/editor/import/editor_scene_importer_gltf.h @@ -415,7 +415,7 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = NULL, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr); virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps); EditorSceneImporterGLTF(); diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h index dd95cb687a..927fac566e 100644 --- a/editor/import/resource_importer_bitmask.h +++ b/editor/import/resource_importer_bitmask.h @@ -51,7 +51,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterBitMap(); ~ResourceImporterBitMap(); diff --git a/editor/import/resource_importer_csv.h b/editor/import/resource_importer_csv.h index 2030dd1f99..7aa48f68de 100644 --- a/editor/import/resource_importer_csv.h +++ b/editor/import/resource_importer_csv.h @@ -49,7 +49,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterCSV(); }; diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h index ec33d6aa16..742f6b8f60 100644 --- a/editor/import/resource_importer_csv_translation.h +++ b/editor/import/resource_importer_csv_translation.h @@ -49,7 +49,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterCSVTranslation(); }; diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h index 6ad77eec1b..abb74d0665 100644 --- a/editor/import/resource_importer_image.h +++ b/editor/import/resource_importer_image.h @@ -50,7 +50,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterImage(); }; diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index d472070808..a4cbc81b26 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -259,7 +259,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const Ref<Image> image; image.instance(); - Error err = ImageLoader::load_image(p_source_file, image, NULL, false, 1.0); + Error err = ImageLoader::load_image(p_source_file, image, nullptr, false, 1.0); if (err != OK) return err; @@ -383,7 +383,7 @@ const char *ResourceImporterLayeredTexture::compression_formats[] = { "etc", "etc2", "pvrtc", - NULL + nullptr }; String ResourceImporterLayeredTexture::get_import_settings_string() const { @@ -438,7 +438,7 @@ bool ResourceImporterLayeredTexture::are_import_settings_valid(const String &p_p return valid; } -ResourceImporterLayeredTexture *ResourceImporterLayeredTexture::singleton = NULL; +ResourceImporterLayeredTexture *ResourceImporterLayeredTexture::singleton = nullptr; ResourceImporterLayeredTexture::ResourceImporterLayeredTexture() { diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h index 6a6bc89a81..40e5c9023e 100644 --- a/editor/import/resource_importer_layered_texture.h +++ b/editor/import/resource_importer_layered_texture.h @@ -114,7 +114,7 @@ public: void _save_tex(const Vector<Ref<Image> > &p_images, const String &p_to_path, int p_compress_mode, Image::CompressMode p_vram_compression, bool p_mipmaps); - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); void update_imports(); diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 4be6f2ed80..6a6eadfa5c 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -428,7 +428,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in if (r_err) { *r_err = err; } - return NULL; + return nullptr; } Node3D *scene = memnew(Node3D); @@ -502,7 +502,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s List<Ref<Mesh>> meshes; - Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["optimize_mesh"], p_options["scale_mesh"], p_options["offset_mesh"], NULL); + Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["optimize_mesh"], p_options["scale_mesh"], p_options["offset_mesh"], nullptr); ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG); diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index 678be45106..7485e60f7b 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -40,7 +40,7 @@ class EditorOBJImporter : public EditorSceneImporter { public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr); virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps); EditorOBJImporter(); @@ -62,7 +62,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterOBJ(); }; diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 7a1de78001..b5766a48a0 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -72,7 +72,7 @@ Node *EditorSceneImporter::import_scene(const String &p_path, uint32_t p_flags, return get_script_instance()->call("_import_scene", p_path, p_flags, p_bake_fps); } - ERR_FAIL_V(NULL); + ERR_FAIL_V(nullptr); } Ref<Animation> EditorSceneImporter::import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) { @@ -81,7 +81,7 @@ Ref<Animation> EditorSceneImporter::import_animation(const String &p_path, uint3 return get_script_instance()->call("_import_animation", p_path, p_flags); } - ERR_FAIL_V(NULL); + ERR_FAIL_V(nullptr); } //for documenters, these functions are useful when an importer calls an external conversion helper (like, fbx2gltf), @@ -311,7 +311,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> if (!isroot && _teststr(name, "noimp")) { memdelete(p_node); - return NULL; + return nullptr; } if (Object::cast_to<MeshInstance3D>(p_node)) { @@ -400,7 +400,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> fixed_name = _fixstr(name, "convcolonly"); } - ERR_FAIL_COND_V(fixed_name == String(), NULL); + ERR_FAIL_COND_V(fixed_name == String(), nullptr); if (shapes.size()) { @@ -432,7 +432,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> Object::cast_to<Node3D>(sb)->set_transform(Object::cast_to<Node3D>(p_node)->get_transform()); p_node->replace_by(sb); memdelete(p_node); - p_node = NULL; + p_node = nullptr; CollisionShape3D *colshape = memnew(CollisionShape3D); if (empty_draw_type == "CUBE") { BoxShape3D *boxShape = memnew(BoxShape3D); @@ -558,7 +558,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node); Ref<ArrayMesh> mesh = mi->get_mesh(); - ERR_FAIL_COND_V(mesh.is_null(), NULL); + ERR_FAIL_COND_V(mesh.is_null(), nullptr); NavigationRegion3D *nmi = memnew(NavigationRegion3D); nmi->set_name(_fixstr(name, "navmesh")); @@ -1229,7 +1229,7 @@ Node *ResourceImporterScene::import_scene_from_other_importer(EditorSceneImporte break; } - ERR_FAIL_COND_V(!importer.is_valid(), NULL); + ERR_FAIL_COND_V(!importer.is_valid(), nullptr); List<String> missing; Error err; @@ -1261,7 +1261,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito break; } - ERR_FAIL_COND_V(!importer.is_valid(), NULL); + ERR_FAIL_COND_V(!importer.is_valid(), nullptr); return importer->import_animation(p_path, p_flags, p_bake_fps); } @@ -1327,7 +1327,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p String root_type = p_options["nodes/root_type"]; root_type = root_type.split(" ")[0]; // full root_type is "ClassName (filename.gd)" for a script global class. - Ref<Script> root_script = NULL; + Ref<Script> root_script = nullptr; if (ScriptServer::is_global_class(root_type)) { root_script = ResourceLoader::load(ScriptServer::get_global_class_path(root_type)); root_type = ScriptServer::get_global_class_base(root_type); @@ -1533,7 +1533,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p return OK; } -ResourceImporterScene *ResourceImporterScene::singleton = NULL; +ResourceImporterScene *ResourceImporterScene::singleton = nullptr; ResourceImporterScene::ResourceImporterScene() { singleton = this; @@ -1550,10 +1550,10 @@ Node *EditorSceneImporterESCN::import_scene(const String &p_path, uint32_t p_fla Error error; Ref<PackedScene> ps = ResourceFormatLoaderText::singleton->load(p_path, p_path, &error); - ERR_FAIL_COND_V_MSG(!ps.is_valid(), NULL, "Cannot load scene as text resource from path '" + p_path + "'."); + ERR_FAIL_COND_V_MSG(!ps.is_valid(), nullptr, "Cannot load scene as text resource from path '" + p_path + "'."); Node *scene = ps->instance(); - ERR_FAIL_COND_V(!scene, NULL); + ERR_FAIL_COND_V(!scene, nullptr); return scene; } diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index bb01725854..f48f181951 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -66,7 +66,7 @@ public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr); virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps); EditorSceneImporter() {} @@ -154,7 +154,7 @@ public: void _filter_tracks(Node *scene, const String &p_text); void _optimize_animations(Node *scene, float p_max_lin_error, float p_max_ang_error, float p_max_angle); - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); Node *import_scene_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps); Ref<Animation> import_animation_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps); @@ -168,7 +168,7 @@ class EditorSceneImporterESCN : public EditorSceneImporter { public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr); virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps); }; diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c218697423..f8ed9304b6 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -424,7 +424,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String String normal_map = p_options["roughness/src_normal"]; Ref<Image> normal_image; - Image::RoughnessChannel roughness_channel; + Image::RoughnessChannel roughness_channel = Image::ROUGHNESS_CHANNEL_R; if (mipmaps && roughness > 1 && FileAccess::exists(normal_map)) { normal_image.instance(); @@ -434,7 +434,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String } Ref<Image> image; image.instance(); - Error err = ImageLoader::load_image(p_source_file, image, NULL, hdr_as_srgb, scale); + Error err = ImageLoader::load_image(p_source_file, image, nullptr, hdr_as_srgb, scale); if (err != OK) return err; @@ -575,7 +575,7 @@ const char *ResourceImporterTexture::compression_formats[] = { "etc", "etc2", "pvrtc", - NULL + nullptr }; String ResourceImporterTexture::get_import_settings_string() const { @@ -630,7 +630,7 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co return valid; } -ResourceImporterTexture *ResourceImporterTexture::singleton = NULL; +ResourceImporterTexture *ResourceImporterTexture::singleton = nullptr; ResourceImporterTexture::ResourceImporterTexture() { diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index 5f5fb75585..e1c71ff1b8 100644 --- a/editor/import/resource_importer_texture.h +++ b/editor/import/resource_importer_texture.h @@ -104,7 +104,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); void update_imports(); diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h index a36cae5872..c61fa5c040 100644 --- a/editor/import/resource_importer_texture_atlas.h +++ b/editor/import/resource_importer_texture_atlas.h @@ -63,7 +63,7 @@ public: virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; virtual String get_option_group_file() const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths); ResourceImporterTextureAtlas(); diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h index 6df5b88b13..bc2f023e6b 100644 --- a/editor/import/resource_importer_wav.h +++ b/editor/import/resource_importer_wav.h @@ -162,7 +162,7 @@ public: } } - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterWAV(); }; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 23be42aaea..22f6aedeaa 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -450,8 +450,8 @@ void ImportDock::_reimport() { String importer_name = params->importer->get_importer_name(); - if (params->checking) { - //update only what edited (checkboxes) + if (params->checking && config->get_value("remap", "importer") == params->importer->get_importer_name()) { + //update only what is edited (checkboxes) if the importer is the same for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) { if (params->checked.has(E->get().name)) { config->set_value("params", E->get().name, params->values[E->get().name]); @@ -558,7 +558,7 @@ ImportDock::ImportDock() { hb->add_spacer(); reimport_confirm = memnew(ConfirmationDialog); - reimport_confirm->get_ok()->set_text(TTR("Save scenes, re-import and restart")); + reimport_confirm->get_ok()->set_text(TTR("Save Scenes, Re-Import, and Restart")); add_child(reimport_confirm); reimport_confirm->connect("confirmed", callable_mp(this, &ImportDock::_reimport_and_restart)); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 223e7a841f..3715547bdc 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -112,7 +112,7 @@ void InspectorDock::_menu_option(int p_option) { editor_data->get_undo_redo().clear_history(); - editor->get_editor_plugins_over()->edit(NULL); + editor->get_editor_plugins_over()->edit(nullptr); editor->get_editor_plugins_over()->edit(current); } break; @@ -166,7 +166,7 @@ void InspectorDock::_resource_file_selected(String p_file) { void InspectorDock::_save_resource(bool save_as) const { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); @@ -180,7 +180,7 @@ void InspectorDock::_save_resource(bool save_as) const { void InspectorDock::_unref_resource() const { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); @@ -191,7 +191,7 @@ void InspectorDock::_unref_resource() const { void InspectorDock::_copy_resource() const { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); - Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL; + Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); @@ -397,7 +397,7 @@ void InspectorDock::update(Object *p_object) { editor_path->set_disabled(true); editor_path->set_text(""); editor_path->set_tooltip(""); - editor_path->set_icon(NULL); + editor_path->set_icon(nullptr); return; } diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index b0f7d2e460..c06e5f3741 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -773,17 +773,17 @@ EditorNode3DGizmo::EditorNode3DGizmo() { valid = false; billboard_handle = false; hidden = false; - base = NULL; + base = nullptr; selected = false; instanced = false; - spatial_node = NULL; - gizmo_plugin = NULL; + spatial_node = nullptr; + gizmo_plugin = nullptr; selectable_icon_size = -1.0f; } EditorNode3DGizmo::~EditorNode3DGizmo() { - if (gizmo_plugin != NULL) gizmo_plugin->unregister_gizmo(this); + if (gizmo_plugin != nullptr) gizmo_plugin->unregister_gizmo(this); clear(); } @@ -796,7 +796,7 @@ Vector3 EditorNode3DGizmo::get_handle_pos(int p_idx) const { //// light gizmo -LightNode3DGizmoPlugin::LightNode3DGizmoPlugin() { +Light3DGizmoPlugin::Light3DGizmoPlugin() { // Enable vertex colors for the materials below as the gizmo color depends on the light color. create_material("lines_primary", Color(1, 1, 1), false, false, true); @@ -811,19 +811,19 @@ LightNode3DGizmoPlugin::LightNode3DGizmoPlugin() { create_handle_material("handles_billboard", true); } -bool LightNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Light3D>(p_spatial) != NULL; +bool Light3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Light3D>(p_spatial) != nullptr; } -String LightNode3DGizmoPlugin::get_name() const { - return "Lights"; +String Light3DGizmoPlugin::get_name() const { + return "Light3D"; } -int LightNode3DGizmoPlugin::get_priority() const { +int Light3DGizmoPlugin::get_priority() const { return -1; } -String LightNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String Light3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { if (p_idx == 0) return "Radius"; @@ -831,7 +831,7 @@ String LightNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, return "Aperture"; } -Variant LightNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant Light3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { Light3D *light = Object::cast_to<Light3D>(p_gizmo->get_spatial_node()); if (p_idx == 0) @@ -871,7 +871,7 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vec return a * 180.0 / Math_PI; } -void LightNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void Light3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { Light3D *light = Object::cast_to<Light3D>(p_gizmo->get_spatial_node()); Transform gt = light->get_global_transform(); @@ -919,7 +919,7 @@ void LightNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, C } } -void LightNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void Light3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { Light3D *light = Object::cast_to<Light3D>(p_gizmo->get_spatial_node()); if (p_cancel) { @@ -943,7 +943,7 @@ void LightNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx } } -void LightNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Light3D *light = Object::cast_to<Light3D>(p_gizmo->get_spatial_node()); @@ -1086,7 +1086,7 @@ void LightNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// //// player gizmo -AudioStreamPlayer3DNode3DGizmoPlugin::AudioStreamPlayer3DNode3DGizmoPlugin() { +AudioStreamPlayer3DGizmoPlugin::AudioStreamPlayer3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1)); @@ -1096,29 +1096,29 @@ AudioStreamPlayer3DNode3DGizmoPlugin::AudioStreamPlayer3DNode3DGizmoPlugin() { create_handle_material("handles"); } -bool AudioStreamPlayer3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<AudioStreamPlayer3D>(p_spatial) != NULL; +bool AudioStreamPlayer3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<AudioStreamPlayer3D>(p_spatial) != nullptr; } -String AudioStreamPlayer3DNode3DGizmoPlugin::get_name() const { +String AudioStreamPlayer3DGizmoPlugin::get_name() const { return "AudioStreamPlayer3D"; } -int AudioStreamPlayer3DNode3DGizmoPlugin::get_priority() const { +int AudioStreamPlayer3DGizmoPlugin::get_priority() const { return -1; } -String AudioStreamPlayer3DNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String AudioStreamPlayer3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { return "Emission Radius"; } -Variant AudioStreamPlayer3DNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant AudioStreamPlayer3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node()); return player->get_emission_angle(); } -void AudioStreamPlayer3DNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void AudioStreamPlayer3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node()); @@ -1157,7 +1157,7 @@ void AudioStreamPlayer3DNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo } } -void AudioStreamPlayer3DNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void AudioStreamPlayer3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node()); @@ -1175,7 +1175,7 @@ void AudioStreamPlayer3DNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gi } } -void AudioStreamPlayer3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { const AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node()); @@ -1233,7 +1233,7 @@ void AudioStreamPlayer3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// -CameraNode3DGizmoPlugin::CameraNode3DGizmoPlugin() { +Camera3DGizmoPlugin::Camera3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/camera", Color(0.8, 0.4, 0.8)); @@ -1241,19 +1241,19 @@ CameraNode3DGizmoPlugin::CameraNode3DGizmoPlugin() { create_handle_material("handles"); } -bool CameraNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Camera3D>(p_spatial) != NULL; +bool Camera3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Camera3D>(p_spatial) != nullptr; } -String CameraNode3DGizmoPlugin::get_name() const { +String Camera3DGizmoPlugin::get_name() const { return "Camera3D"; } -int CameraNode3DGizmoPlugin::get_priority() const { +int Camera3DGizmoPlugin::get_priority() const { return -1; } -String CameraNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String Camera3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node()); @@ -1264,7 +1264,7 @@ String CameraNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo } } -Variant CameraNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant Camera3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node()); @@ -1276,7 +1276,7 @@ Variant CameraNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, in } } -void CameraNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void Camera3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node()); @@ -1307,7 +1307,7 @@ void CameraNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, } } -void CameraNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void Camera3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node()); @@ -1339,7 +1339,7 @@ void CameraNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_id } } -void CameraNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node()); @@ -1489,26 +1489,26 @@ void CameraNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// -MeshInstanceNode3DGizmoPlugin::MeshInstanceNode3DGizmoPlugin() { +MeshInstance3DGizmoPlugin::MeshInstance3DGizmoPlugin() { } -bool MeshInstanceNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<MeshInstance3D>(p_spatial) != NULL && Object::cast_to<SoftBody3D>(p_spatial) == NULL; +bool MeshInstance3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<MeshInstance3D>(p_spatial) != nullptr && Object::cast_to<SoftBody3D>(p_spatial) == nullptr; } -String MeshInstanceNode3DGizmoPlugin::get_name() const { +String MeshInstance3DGizmoPlugin::get_name() const { return "MeshInstance3D"; } -int MeshInstanceNode3DGizmoPlugin::get_priority() const { +int MeshInstance3DGizmoPlugin::get_priority() const { return -1; } -bool MeshInstanceNode3DGizmoPlugin::can_be_hidden() const { +bool MeshInstance3DGizmoPlugin::can_be_hidden() const { return false; } -void MeshInstanceNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void MeshInstance3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { MeshInstance3D *mesh = Object::cast_to<MeshInstance3D>(p_gizmo->get_spatial_node()); @@ -1526,26 +1526,26 @@ void MeshInstanceNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } ///// -Sprite3DNode3DGizmoPlugin::Sprite3DNode3DGizmoPlugin() { +Sprite3DGizmoPlugin::Sprite3DGizmoPlugin() { } -bool Sprite3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Sprite3D>(p_spatial) != NULL; +bool Sprite3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Sprite3D>(p_spatial) != nullptr; } -String Sprite3DNode3DGizmoPlugin::get_name() const { +String Sprite3DGizmoPlugin::get_name() const { return "Sprite3D"; } -int Sprite3DNode3DGizmoPlugin::get_priority() const { +int Sprite3DGizmoPlugin::get_priority() const { return -1; } -bool Sprite3DNode3DGizmoPlugin::can_be_hidden() const { +bool Sprite3DGizmoPlugin::can_be_hidden() const { return false; } -void Sprite3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Sprite3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Sprite3D *sprite = Object::cast_to<Sprite3D>(p_gizmo->get_spatial_node()); @@ -1559,7 +1559,7 @@ void Sprite3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { /// -Position3DNode3DGizmoPlugin::Position3DNode3DGizmoPlugin() { +Position3DGizmoPlugin::Position3DGizmoPlugin() { pos3d_mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); cursor_points = Vector<Vector3>(); @@ -1592,19 +1592,19 @@ Position3DNode3DGizmoPlugin::Position3DNode3DGizmoPlugin() { pos3d_mesh->surface_set_material(0, mat); } -bool Position3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Position3D>(p_spatial) != NULL; +bool Position3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Position3D>(p_spatial) != nullptr; } -String Position3DNode3DGizmoPlugin::get_name() const { +String Position3DGizmoPlugin::get_name() const { return "Position3D"; } -int Position3DNode3DGizmoPlugin::get_priority() const { +int Position3DGizmoPlugin::get_priority() const { return -1; } -void Position3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Position3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->clear(); p_gizmo->add_mesh(pos3d_mesh); @@ -1613,25 +1613,25 @@ void Position3DNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// -SkeletonNode3DGizmoPlugin::SkeletonNode3DGizmoPlugin() { +Skeleton3DGizmoPlugin::Skeleton3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/skeleton", Color(1, 0.8, 0.4)); create_material("skeleton_material", gizmo_color); } -bool SkeletonNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Skeleton3D>(p_spatial) != NULL; +bool Skeleton3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Skeleton3D>(p_spatial) != nullptr; } -String SkeletonNode3DGizmoPlugin::get_name() const { +String Skeleton3DGizmoPlugin::get_name() const { return "Skeleton3D"; } -int SkeletonNode3DGizmoPlugin::get_priority() const { +int Skeleton3DGizmoPlugin::get_priority() const { return -1; } -void SkeletonNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Skeleton3D *skel = Object::cast_to<Skeleton3D>(p_gizmo->get_spatial_node()); @@ -1822,23 +1822,23 @@ void SkeletonNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// -PhysicalBoneNode3DGizmoPlugin::PhysicalBoneNode3DGizmoPlugin() { +PhysicalBone3DGizmoPlugin::PhysicalBone3DGizmoPlugin() { create_material("joint_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); } -bool PhysicalBoneNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<PhysicalBone3D>(p_spatial) != NULL; +bool PhysicalBone3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<PhysicalBone3D>(p_spatial) != nullptr; } -String PhysicalBoneNode3DGizmoPlugin::get_name() const { - return "PhysicalBones"; +String PhysicalBone3DGizmoPlugin::get_name() const { + return "PhysicalBone3D"; } -int PhysicalBoneNode3DGizmoPlugin::get_priority() const { +int PhysicalBone3DGizmoPlugin::get_priority() const { return -1; } -void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void PhysicalBone3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->clear(); @@ -1864,12 +1864,12 @@ void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { switch (physical_bone->get_joint_type()) { case PhysicalBone3D::JOINT_TYPE_PIN: { - JointNode3DGizmoPlugin::CreatePinJointGizmo(physical_bone->get_joint_offset(), points); + Joint3DGizmoPlugin::CreatePinJointGizmo(physical_bone->get_joint_offset(), points); } break; case PhysicalBone3D::JOINT_TYPE_CONE: { const PhysicalBone3D::ConeJointData *cjd(static_cast<const PhysicalBone3D::ConeJointData *>(physical_bone->get_joint_data())); - JointNode3DGizmoPlugin::CreateConeTwistJointGizmo( + Joint3DGizmoPlugin::CreateConeTwistJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), pb->get_global_transform(), @@ -1882,7 +1882,7 @@ void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { case PhysicalBone3D::JOINT_TYPE_HINGE: { const PhysicalBone3D::HingeJointData *hjd(static_cast<const PhysicalBone3D::HingeJointData *>(physical_bone->get_joint_data())); - JointNode3DGizmoPlugin::CreateHingeJointGizmo( + Joint3DGizmoPlugin::CreateHingeJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), pb->get_global_transform(), @@ -1897,7 +1897,7 @@ void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { case PhysicalBone3D::JOINT_TYPE_SLIDER: { const PhysicalBone3D::SliderJointData *sjd(static_cast<const PhysicalBone3D::SliderJointData *>(physical_bone->get_joint_data())); - JointNode3DGizmoPlugin::CreateSliderJointGizmo( + Joint3DGizmoPlugin::CreateSliderJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), pb->get_global_transform(), @@ -1913,7 +1913,7 @@ void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { case PhysicalBone3D::JOINT_TYPE_6DOF: { const PhysicalBone3D::SixDOFJointData *sdofjd(static_cast<const PhysicalBone3D::SixDOFJointData *>(physical_bone->get_joint_data())); - JointNode3DGizmoPlugin::CreateGeneric6DOFJointGizmo( + Joint3DGizmoPlugin::CreateGeneric6DOFJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), @@ -1957,7 +1957,7 @@ void PhysicalBoneNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// -RayCastNode3DGizmoPlugin::RayCastNode3DGizmoPlugin() { +RayCast3DGizmoPlugin::RayCast3DGizmoPlugin() { const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); @@ -1966,19 +1966,19 @@ RayCastNode3DGizmoPlugin::RayCastNode3DGizmoPlugin() { create_material("shape_material_disabled", gizmo_color_disabled); } -bool RayCastNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<RayCast3D>(p_spatial) != NULL; +bool RayCast3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<RayCast3D>(p_spatial) != nullptr; } -String RayCastNode3DGizmoPlugin::get_name() const { +String RayCast3DGizmoPlugin::get_name() const { return "RayCast3D"; } -int RayCastNode3DGizmoPlugin::get_priority() const { +int RayCast3DGizmoPlugin::get_priority() const { return -1; } -void RayCastNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void RayCast3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { RayCast3D *raycast = Object::cast_to<RayCast3D>(p_gizmo->get_spatial_node()); @@ -1998,7 +1998,7 @@ void RayCastNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// -void SpringArmNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { SpringArm3D *spring_arm = Object::cast_to<SpringArm3D>(p_gizmo->get_spatial_node()); @@ -2015,44 +2015,44 @@ void SpringArmNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_collision_segments(lines); } -SpringArmNode3DGizmoPlugin::SpringArmNode3DGizmoPlugin() { +SpringArm3DGizmoPlugin::SpringArm3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); } -bool SpringArmNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<SpringArm3D>(p_spatial) != NULL; +bool SpringArm3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<SpringArm3D>(p_spatial) != nullptr; } -String SpringArmNode3DGizmoPlugin::get_name() const { +String SpringArm3DGizmoPlugin::get_name() const { return "SpringArm3D"; } -int SpringArmNode3DGizmoPlugin::get_priority() const { +int SpringArm3DGizmoPlugin::get_priority() const { return -1; } ///// -VehicleWheelNode3DGizmoPlugin::VehicleWheelNode3DGizmoPlugin() { +VehicleWheel3DGizmoPlugin::VehicleWheel3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); } -bool VehicleWheelNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<VehicleWheel3D>(p_spatial) != NULL; +bool VehicleWheel3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<VehicleWheel3D>(p_spatial) != nullptr; } -String VehicleWheelNode3DGizmoPlugin::get_name() const { +String VehicleWheel3DGizmoPlugin::get_name() const { return "VehicleWheel3D"; } -int VehicleWheelNode3DGizmoPlugin::get_priority() const { +int VehicleWheel3DGizmoPlugin::get_priority() const { return -1; } -void VehicleWheelNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void VehicleWheel3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { VehicleWheel3D *car_wheel = Object::cast_to<VehicleWheel3D>(p_gizmo->get_spatial_node()); @@ -2108,29 +2108,29 @@ void VehicleWheelNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { /////////// -SoftBodyNode3DGizmoPlugin::SoftBodyNode3DGizmoPlugin() { +SoftBody3DGizmoPlugin::SoftBody3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); create_handle_material("handles"); } -bool SoftBodyNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<SoftBody3D>(p_spatial) != NULL; +bool SoftBody3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<SoftBody3D>(p_spatial) != nullptr; } -String SoftBodyNode3DGizmoPlugin::get_name() const { +String SoftBody3DGizmoPlugin::get_name() const { return "SoftBody3D"; } -int SoftBodyNode3DGizmoPlugin::get_priority() const { +int SoftBody3DGizmoPlugin::get_priority() const { return -1; } -bool SoftBodyNode3DGizmoPlugin::is_selectable_when_hidden() const { +bool SoftBody3DGizmoPlugin::is_selectable_when_hidden() const { return true; } -void SoftBodyNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void SoftBody3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_spatial_node()); p_gizmo->clear(); @@ -2161,28 +2161,28 @@ void SoftBodyNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_collision_triangles(tm); } -String SoftBodyNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String SoftBody3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { return "SoftBody3D pin point"; } -Variant SoftBodyNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant SoftBody3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_spatial_node()); return Variant(soft_body->is_point_pinned(p_idx)); } -void SoftBodyNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void SoftBody3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_spatial_node()); soft_body->pin_point_toggle(p_idx); } -bool SoftBodyNode3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int idx) const { +bool SoftBody3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int idx) const { SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_spatial_node()); return soft_body->is_point_pinned(idx); } /////////// -VisibilityNotifierGizmoPlugin::VisibilityNotifierGizmoPlugin() { +VisibilityNotifier3DGizmoPlugin::VisibilityNotifier3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/visibility_notifier", Color(0.8, 0.5, 0.7)); create_material("visibility_notifier_material", gizmo_color); gizmo_color.a = 0.1; @@ -2190,19 +2190,19 @@ VisibilityNotifierGizmoPlugin::VisibilityNotifierGizmoPlugin() { create_handle_material("handles"); } -bool VisibilityNotifierGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<VisibilityNotifier3D>(p_spatial) != NULL; +bool VisibilityNotifier3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<VisibilityNotifier3D>(p_spatial) != nullptr; } -String VisibilityNotifierGizmoPlugin::get_name() const { +String VisibilityNotifier3DGizmoPlugin::get_name() const { return "VisibilityNotifier3D"; } -int VisibilityNotifierGizmoPlugin::get_priority() const { +int VisibilityNotifier3DGizmoPlugin::get_priority() const { return -1; } -String VisibilityNotifierGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String VisibilityNotifier3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { case 0: return "Size X"; @@ -2216,12 +2216,12 @@ String VisibilityNotifierGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p return ""; } -Variant VisibilityNotifierGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant VisibilityNotifier3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { VisibilityNotifier3D *notifier = Object::cast_to<VisibilityNotifier3D>(p_gizmo->get_spatial_node()); return notifier->get_aabb(); } -void VisibilityNotifierGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void VisibilityNotifier3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { VisibilityNotifier3D *notifier = Object::cast_to<VisibilityNotifier3D>(p_gizmo->get_spatial_node()); @@ -2274,7 +2274,7 @@ void VisibilityNotifierGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p } } -void VisibilityNotifierGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void VisibilityNotifier3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { VisibilityNotifier3D *notifier = Object::cast_to<VisibilityNotifier3D>(p_gizmo->get_spatial_node()); @@ -2290,7 +2290,7 @@ void VisibilityNotifierGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, in ur->commit_action(); } -void VisibilityNotifierGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void VisibilityNotifier3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { VisibilityNotifier3D *notifier = Object::cast_to<VisibilityNotifier3D>(p_gizmo->get_spatial_node()); @@ -2347,7 +2347,7 @@ CPUParticles3DGizmoPlugin::CPUParticles3DGizmoPlugin() { } bool CPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<CPUParticles3D>(p_spatial) != NULL; + return Object::cast_to<CPUParticles3D>(p_spatial) != nullptr; } String CPUParticles3DGizmoPlugin::get_name() const { @@ -2379,7 +2379,7 @@ GPUParticles3DGizmoPlugin::GPUParticles3DGizmoPlugin() { } bool GPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<GPUParticles3D>(p_spatial) != NULL; + return Object::cast_to<GPUParticles3D>(p_spatial) != nullptr; } String GPUParticles3DGizmoPlugin::get_name() const { @@ -2548,7 +2548,7 @@ ReflectionProbeGizmoPlugin::ReflectionProbeGizmoPlugin() { } bool ReflectionProbeGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<ReflectionProbe>(p_spatial) != NULL; + return Object::cast_to<ReflectionProbe>(p_spatial) != nullptr; } String ReflectionProbeGizmoPlugin::get_name() const { @@ -2736,7 +2736,7 @@ GIProbeGizmoPlugin::GIProbeGizmoPlugin() { } bool GIProbeGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<GIProbe>(p_spatial) != NULL; + return Object::cast_to<GIProbe>(p_spatial) != nullptr; } String GIProbeGizmoPlugin::get_name() const { @@ -2980,7 +2980,7 @@ void BakedIndirectLightGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, in } bool BakedIndirectLightGizmoPlugin::has_gizmo(Spatial *p_spatial) { - return Object::cast_to<BakedLightmap>(p_spatial) != NULL; + return Object::cast_to<BakedLightmap>(p_spatial) != nullptr; } String BakedIndirectLightGizmoPlugin::get_name() const { @@ -3034,7 +3034,7 @@ void BakedIndirectLightGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { #endif //// -CollisionShapeNode3DGizmoPlugin::CollisionShapeNode3DGizmoPlugin() { +CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); @@ -3043,19 +3043,19 @@ CollisionShapeNode3DGizmoPlugin::CollisionShapeNode3DGizmoPlugin() { create_handle_material("handles"); } -bool CollisionShapeNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<CollisionShape3D>(p_spatial) != NULL; +bool CollisionShape3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<CollisionShape3D>(p_spatial) != nullptr; } -String CollisionShapeNode3DGizmoPlugin::get_name() const { +String CollisionShape3DGizmoPlugin::get_name() const { return "CollisionShape3D"; } -int CollisionShapeNode3DGizmoPlugin::get_priority() const { +int CollisionShape3DGizmoPlugin::get_priority() const { return -1; } -String CollisionShapeNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String CollisionShape3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { const CollisionShape3D *cs = Object::cast_to<CollisionShape3D>(p_gizmo->get_spatial_node()); @@ -3091,7 +3091,7 @@ String CollisionShapeNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo return ""; } -Variant CollisionShapeNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant CollisionShape3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { CollisionShape3D *cs = Object::cast_to<CollisionShape3D>(p_gizmo->get_spatial_node()); @@ -3131,7 +3131,7 @@ Variant CollisionShapeNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_g return Variant(); } -void CollisionShapeNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void CollisionShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { CollisionShape3D *cs = Object::cast_to<CollisionShape3D>(p_gizmo->get_spatial_node()); @@ -3244,7 +3244,7 @@ void CollisionShapeNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int cs2->set_height(d * 2.0); } } -void CollisionShapeNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void CollisionShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { CollisionShape3D *cs = Object::cast_to<CollisionShape3D>(p_gizmo->get_spatial_node()); @@ -3351,7 +3351,7 @@ void CollisionShapeNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, ur->commit_action(); } } -void CollisionShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { CollisionShape3D *cs = Object::cast_to<CollisionShape3D>(p_gizmo->get_spatial_node()); @@ -3663,7 +3663,7 @@ void CollisionShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// -CollisionPolygonNode3DGizmoPlugin::CollisionPolygonNode3DGizmoPlugin() { +CollisionPolygon3DGizmoPlugin::CollisionPolygon3DGizmoPlugin() { const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); @@ -3671,19 +3671,19 @@ CollisionPolygonNode3DGizmoPlugin::CollisionPolygonNode3DGizmoPlugin() { create_material("shape_material_disabled", gizmo_color_disabled); } -bool CollisionPolygonNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<CollisionPolygon3D>(p_spatial) != NULL; +bool CollisionPolygon3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<CollisionPolygon3D>(p_spatial) != nullptr; } -String CollisionPolygonNode3DGizmoPlugin::get_name() const { +String CollisionPolygon3DGizmoPlugin::get_name() const { return "CollisionPolygon3D"; } -int CollisionPolygonNode3DGizmoPlugin::get_priority() const { +int CollisionPolygon3DGizmoPlugin::get_priority() const { return -1; } -void CollisionPolygonNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void CollisionPolygon3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { CollisionPolygon3D *polygon = Object::cast_to<CollisionPolygon3D>(p_gizmo->get_spatial_node()); @@ -3713,26 +3713,26 @@ void CollisionPolygonNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// -NavigationMeshNode3DGizmoPlugin::NavigationMeshNode3DGizmoPlugin() { +NavigationRegion3DGizmoPlugin::NavigationRegion3DGizmoPlugin() { create_material("navigation_edge_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge", Color(0.5, 1, 1))); create_material("navigation_edge_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge_disabled", Color(0.7, 0.7, 0.7))); create_material("navigation_solid_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid", Color(0.5, 1, 1, 0.4))); create_material("navigation_solid_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid_disabled", Color(0.7, 0.7, 0.7, 0.4))); } -bool NavigationMeshNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<NavigationRegion3D>(p_spatial) != NULL; +bool NavigationRegion3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<NavigationRegion3D>(p_spatial) != nullptr; } -String NavigationMeshNode3DGizmoPlugin::get_name() const { +String NavigationRegion3DGizmoPlugin::get_name() const { return "NavigationRegion3D"; } -int NavigationMeshNode3DGizmoPlugin::get_priority() const { +int NavigationRegion3DGizmoPlugin::get_priority() const { return -1; } -void NavigationMeshNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { NavigationRegion3D *navmesh = Object::cast_to<NavigationRegion3D>(p_gizmo->get_spatial_node()); @@ -4078,35 +4078,35 @@ void JointGizmosDrawer::draw_cone(const Transform &p_offset, const Basis &p_base //// -JointNode3DGizmoPlugin::JointNode3DGizmoPlugin() { +Joint3DGizmoPlugin::Joint3DGizmoPlugin() { create_material("joint_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); create_material("joint_body_a_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_a", Color(0.6, 0.8, 1))); create_material("joint_body_b_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_b", Color(0.6, 0.9, 1))); } -bool JointNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to<Joint3D>(p_spatial) != NULL; +bool Joint3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<Joint3D>(p_spatial) != nullptr; } -String JointNode3DGizmoPlugin::get_name() const { - return "Joints"; +String Joint3DGizmoPlugin::get_name() const { + return "Joint3D"; } -int JointNode3DGizmoPlugin::get_priority() const { +int Joint3DGizmoPlugin::get_priority() const { return -1; } -void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Joint3D *joint = Object::cast_to<Joint3D>(p_gizmo->get_spatial_node()); p_gizmo->clear(); - Node3D *node_body_a = NULL; + Node3D *node_body_a = nullptr; if (!joint->get_node_a().is_empty()) { node_body_a = Object::cast_to<Node3D>(joint->get_node(joint->get_node_a())); } - Node3D *node_body_b = NULL; + Node3D *node_body_b = nullptr; if (!joint->get_node_b().is_empty()) { node_body_b = Object::cast_to<Node3D>(joint->get_node(joint->get_node_b())); } @@ -4141,8 +4141,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { hinge->get_param(HingeJoint3D::PARAM_LIMIT_UPPER), hinge->get_flag(HingeJoint3D::FLAG_USE_LIMIT), points, - node_body_a ? &body_a_points : NULL, - node_body_b ? &body_b_points : NULL); + node_body_a ? &body_a_points : nullptr, + node_body_b ? &body_b_points : nullptr); p_gizmo->add_collision_segments(points); p_gizmo->add_collision_segments(body_a_points); @@ -4166,8 +4166,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { slider->get_param(SliderJoint3D::PARAM_LINEAR_LIMIT_LOWER), slider->get_param(SliderJoint3D::PARAM_LINEAR_LIMIT_UPPER), points, - node_body_a ? &body_a_points : NULL, - node_body_b ? &body_b_points : NULL); + node_body_a ? &body_a_points : nullptr, + node_body_b ? &body_b_points : nullptr); p_gizmo->add_collision_segments(points); p_gizmo->add_collision_segments(body_a_points); @@ -4188,8 +4188,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { node_body_b ? node_body_b->get_global_transform() : Transform(), cone->get_param(ConeTwistJoint3D::PARAM_SWING_SPAN), cone->get_param(ConeTwistJoint3D::PARAM_TWIST_SPAN), - node_body_a ? &body_a_points : NULL, - node_body_b ? &body_b_points : NULL); + node_body_a ? &body_a_points : nullptr, + node_body_b ? &body_b_points : nullptr); p_gizmo->add_collision_segments(body_a_points); p_gizmo->add_collision_segments(body_b_points); @@ -4229,8 +4229,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { gen->get_flag_z(Generic6DOFJoint3D::FLAG_ENABLE_LINEAR_LIMIT), points, - node_body_a ? &body_a_points : NULL, - node_body_a ? &body_b_points : NULL); + node_body_a ? &body_a_points : nullptr, + node_body_a ? &body_b_points : nullptr); p_gizmo->add_collision_segments(points); p_gizmo->add_collision_segments(body_a_points); @@ -4242,7 +4242,7 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } } -void JointNode3DGizmoPlugin::CreatePinJointGizmo(const Transform &p_offset, Vector<Vector3> &r_cursor_points) { +void Joint3DGizmoPlugin::CreatePinJointGizmo(const Transform &p_offset, Vector<Vector3> &r_cursor_points) { float cs = 0.25; r_cursor_points.push_back(p_offset.translated(Vector3(+cs, 0, 0)).origin); @@ -4253,7 +4253,7 @@ void JointNode3DGizmoPlugin::CreatePinJointGizmo(const Transform &p_offset, Vect r_cursor_points.push_back(p_offset.translated(Vector3(0, 0, -cs)).origin); } -void JointNode3DGizmoPlugin::CreateHingeJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { +void Joint3DGizmoPlugin::CreateHingeJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { r_common_points.push_back(p_offset.translated(Vector3(0, 0, 0.5)).origin); r_common_points.push_back(p_offset.translated(Vector3(0, 0, -0.5)).origin); @@ -4285,7 +4285,7 @@ void JointNode3DGizmoPlugin::CreateHingeJointGizmo(const Transform &p_offset, co } } -void JointNode3DGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { +void Joint3DGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { p_linear_limit_lower = -p_linear_limit_lower; p_linear_limit_upper = -p_linear_limit_upper; @@ -4345,7 +4345,7 @@ void JointNode3DGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset, c true); } -void JointNode3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { +void Joint3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) { if (r_body_a_points) JointGizmosDrawer::draw_cone( @@ -4364,7 +4364,7 @@ void JointNode3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset *r_body_b_points); } -void JointNode3DGizmoPlugin::CreateGeneric6DOFJointGizmo( +void Joint3DGizmoPlugin::CreateGeneric6DOFJointGizmo( const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, diff --git a/editor/node_3d_editor_gizmos.h b/editor/node_3d_editor_gizmos.h index f8339b4c6c..889b0e8315 100644 --- a/editor/node_3d_editor_gizmos.h +++ b/editor/node_3d_editor_gizmos.h @@ -36,9 +36,9 @@ class Camera3D; -class LightNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Light3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(LightNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Light3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -51,12 +51,12 @@ public: void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); void redraw(EditorNode3DGizmo *p_gizmo); - LightNode3DGizmoPlugin(); + Light3DGizmoPlugin(); }; -class AudioStreamPlayer3DNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class AudioStreamPlayer3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(AudioStreamPlayer3DNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(AudioStreamPlayer3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -69,12 +69,12 @@ public: void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); void redraw(EditorNode3DGizmo *p_gizmo); - AudioStreamPlayer3DNode3DGizmoPlugin(); + AudioStreamPlayer3DGizmoPlugin(); }; -class CameraNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Camera3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CameraNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Camera3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -87,12 +87,12 @@ public: void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); void redraw(EditorNode3DGizmo *p_gizmo); - CameraNode3DGizmoPlugin(); + Camera3DGizmoPlugin(); }; -class MeshInstanceNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class MeshInstance3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(MeshInstanceNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(MeshInstance3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -101,12 +101,12 @@ public: bool can_be_hidden() const; void redraw(EditorNode3DGizmo *p_gizmo); - MeshInstanceNode3DGizmoPlugin(); + MeshInstance3DGizmoPlugin(); }; -class Sprite3DNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Sprite3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(Sprite3DNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Sprite3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -115,12 +115,12 @@ public: bool can_be_hidden() const; void redraw(EditorNode3DGizmo *p_gizmo); - Sprite3DNode3DGizmoPlugin(); + Sprite3DGizmoPlugin(); }; -class Position3DNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Position3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(Position3DNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Position3DGizmoPlugin, EditorNode3DGizmoPlugin); Ref<ArrayMesh> pos3d_mesh; Vector<Vector3> cursor_points; @@ -131,12 +131,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - Position3DNode3DGizmoPlugin(); + Position3DGizmoPlugin(); }; -class SkeletonNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Skeleton3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(SkeletonNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Skeleton3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -144,12 +144,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - SkeletonNode3DGizmoPlugin(); + Skeleton3DGizmoPlugin(); }; -class PhysicalBoneNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class PhysicalBone3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(PhysicalBoneNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(PhysicalBone3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -157,12 +157,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - PhysicalBoneNode3DGizmoPlugin(); + PhysicalBone3DGizmoPlugin(); }; -class RayCastNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class RayCast3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(RayCastNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(RayCast3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -170,12 +170,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - RayCastNode3DGizmoPlugin(); + RayCast3DGizmoPlugin(); }; -class SpringArmNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class SpringArm3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(SpringArmNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(SpringArm3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -183,12 +183,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - SpringArmNode3DGizmoPlugin(); + SpringArm3DGizmoPlugin(); }; -class VehicleWheelNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class VehicleWheel3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(VehicleWheelNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(VehicleWheel3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -196,12 +196,12 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - VehicleWheelNode3DGizmoPlugin(); + VehicleWheel3DGizmoPlugin(); }; -class SoftBodyNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class SoftBody3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(SoftBodyNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(SoftBody3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -215,12 +215,12 @@ public: void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel); bool is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int idx) const; - SoftBodyNode3DGizmoPlugin(); + SoftBody3DGizmoPlugin(); }; -class VisibilityNotifierGizmoPlugin : public EditorNode3DGizmoPlugin { +class VisibilityNotifier3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(VisibilityNotifierGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(VisibilityNotifier3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -233,7 +233,7 @@ public: void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point); void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); - VisibilityNotifierGizmoPlugin(); + VisibilityNotifier3DGizmoPlugin(); }; class CPUParticles3DGizmoPlugin : public EditorNode3DGizmoPlugin { @@ -322,9 +322,9 @@ public: BakedIndirectLightGizmoPlugin(); }; #endif -class CollisionShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class CollisionShape3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CollisionShapeNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(CollisionShape3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -337,23 +337,23 @@ public: void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point); void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); - CollisionShapeNode3DGizmoPlugin(); + CollisionShape3DGizmoPlugin(); }; -class CollisionPolygonNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CollisionPolygonNode3DGizmoPlugin, EditorNode3DGizmoPlugin); +class CollisionPolygon3DGizmoPlugin : public EditorNode3DGizmoPlugin { + GDCLASS(CollisionPolygon3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); String get_name() const; int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - CollisionPolygonNode3DGizmoPlugin(); + CollisionPolygon3DGizmoPlugin(); }; -class NavigationMeshNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class NavigationRegion3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(NavigationMeshNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(NavigationRegion3DGizmoPlugin, EditorNode3DGizmoPlugin); struct _EdgeKey { @@ -369,7 +369,7 @@ public: int get_priority() const; void redraw(EditorNode3DGizmo *p_gizmo); - NavigationMeshNode3DGizmoPlugin(); + NavigationRegion3DGizmoPlugin(); }; class JointGizmosDrawer { @@ -387,9 +387,9 @@ public: static void draw_cone(const Transform &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points); }; -class JointNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class Joint3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(JointNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(Joint3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -428,7 +428,7 @@ public: Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points); - JointNode3DGizmoPlugin(); + Joint3DGizmoPlugin(); }; #endif // SPATIAL_EDITOR_GIZMOS_H diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 0c511e4819..a076b1eecc 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -60,7 +60,7 @@ void NodeDock::_notification(int p_what) { } } -NodeDock *NodeDock::singleton = NULL; +NodeDock *NodeDock::singleton = nullptr; void NodeDock::update_lists() { 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..eb14495b9c 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" @@ -95,6 +95,7 @@ void MaterialEditor::_button_pressed(Node *p_button) { sphere_instance->hide(); box_switch->set_pressed(true); sphere_switch->set_pressed(false); + EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", false); } if (p_button == sphere_switch) { @@ -102,6 +103,7 @@ void MaterialEditor::_button_pressed(Node *p_button) { sphere_instance->show(); box_switch->set_pressed(false); sphere_switch->set_pressed(true); + EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", true); } } @@ -110,7 +112,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); @@ -155,7 +157,6 @@ MaterialEditor::MaterialEditor() { sphere_instance->set_mesh(sphere_mesh); box_mesh.instance(); box_instance->set_mesh(box_mesh); - box_instance->hide(); set_custom_minimum_size(Size2(1, 150) * EDSCALE); @@ -194,6 +195,15 @@ MaterialEditor::MaterialEditor() { light_2_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(light_2_switch)); first_enter = true; + + if (EditorSettings::get_singleton()->get_project_metadata("inspector_options", "material_preview_on_sphere", true)) { + box_instance->hide(); + } else { + box_instance->show(); + sphere_instance->hide(); + box_switch->set_pressed(true); + sphere_switch->set_pressed(false); + } } /////////////////////// 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 f7a90b8ab3..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,18 +337,15 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { const Vector2 *r = uv.ptr(); Vector<int> indices = a[Mesh::ARRAY_INDEX]; - const int *ri; + const int *ri = nullptr; int ic; - bool use_indices; if (indices.size()) { ic = indices.size(); ri = indices.ptr(); - use_indices = true; } else { ic = uv.size(); - use_indices = false; } for (int j = 0; j < ic; j += 3) { @@ -356,7 +353,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { for (int k = 0; k < 3; k++) { MeshInstance3DEditorEdgeSort edge; - if (use_indices) { + if (ri) { edge.a = r[ri[j + k]]; edge.b = r[ri[j + ((k + 1) % 3)]]; } else { @@ -514,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..2871e15bab 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" @@ -347,7 +347,7 @@ void Node3DEditorViewport::_update_camera(float p_interp_delta) { if (orthogonal) { float half_fov = Math::deg2rad(get_fov()) / 2.0; float height = 2.0 * cursor.distance * Math::tan(half_fov); - camera->set_orthogonal(height, 0.1, 8192); + camera->set_orthogonal(height, get_znear(), get_zfar()); } else { camera->set_perspective(get_fov(), get_znear(), get_zfar()); } @@ -364,7 +364,7 @@ Transform Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) cons camera_transform.basis.rotate(Vector3(0, 1, 0), -p_cursor.y_rot); if (orthogonal) - camera_transform.translate(0, 0, 4096); + camera_transform.translate(0, 0, (get_zfar() - get_znear()) / 2.0); else camera_transform.translate(0, 0, p_cursor.distance); @@ -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 f570baa885..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; + const float *weight_r = nullptr; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1044,7 +1044,6 @@ void Polygon2DEditor::_uv_draw() { } if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) { - weight_r = node->get_bone_weights(bone_selected).ptr(); } } @@ -1250,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); diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index 859718cba4..86df069b8b 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -135,7 +135,7 @@ void BackgroundProgress::end_task(const String &p_task) { //////////////////////////////////////////////// -ProgressDialog *ProgressDialog::singleton = NULL; +ProgressDialog *ProgressDialog::singleton = nullptr; void ProgressDialog::_notification(int p_what) { } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 39c24519c0..04ec5ae043 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -196,7 +196,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { name->set_editable(false); export_path->hide(); runnable->set_disabled(true); - parameters->edit(NULL); + parameters->edit(nullptr); presets->unselect_all(); duplicate_preset->set_disabled(true); delete_preset->set_disabled(true); @@ -1205,12 +1205,9 @@ ProjectExportDialog::ProjectExportDialog() { custom_features = memnew(LineEdit); custom_features->connect("text_changed", callable_mp(this, &ProjectExportDialog::_custom_features_changed)); feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features); - Panel *features_panel = memnew(Panel); custom_feature_display = memnew(RichTextLabel); - features_panel->add_child(custom_feature_display); - custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE); custom_feature_display->set_v_size_flags(Control::SIZE_EXPAND_FILL); - feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true); + feature_vb->add_margin_child(TTR("Feature List:"), custom_feature_display, true); sections->add_child(feature_vb); // Script export parameters. @@ -1244,7 +1241,7 @@ ProjectExportDialog::ProjectExportDialog() { delete_preset->set_disabled(true); script_key_error->hide(); sections->hide(); - parameters->edit(NULL); + parameters->edit(nullptr); // Deletion dialog. diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d3856cf778..0ca540a33f 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -191,7 +191,7 @@ private: if (valid_path != "" && !d->file_exists("project.godot")) { if (valid_path.ends_with(".zip")) { - FileAccess *src_f = NULL; + FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io); @@ -208,7 +208,7 @@ private: while (ret == UNZ_OK) { unz_file_info info; char fname[16384]; - ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); if (String(fname).ends_with("project.godot")) { break; @@ -522,7 +522,7 @@ private: zip_path = project_path->get_text(); } - FileAccess *src_f = NULL; + FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io); @@ -543,7 +543,7 @@ private: //get filename unz_file_info info; char fname[16384]; - ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); String path = fname; @@ -955,8 +955,8 @@ public: bool hover; ProjectListItemControl() { - favorite_button = NULL; - icon = NULL; + favorite_button = nullptr; + icon = nullptr; icon_needs_reload = true; hover = false; } @@ -1036,7 +1036,7 @@ public: grayed = p_grayed; missing = p_missing; version = p_version; - control = NULL; + control = nullptr; } _FORCE_INLINE_ bool operator==(const Item &l) const { @@ -1236,7 +1236,7 @@ void ProjectList::load_projects() { // Clear whole list for (int i = 0; i < _projects.size(); ++i) { Item &project = _projects.write[i]; - CRASH_COND(project.control == NULL); + CRASH_COND(project.control == nullptr); memdelete(project.control); // Why not queue_free()? } _projects.clear(); @@ -1346,7 +1346,7 @@ void ProjectList::create_project_item_control(int p_index) { ERR_FAIL_COND(p_index != _scroll_children->get_child_count()); Item &item = _projects.write[p_index]; - ERR_FAIL_COND(item.control != NULL); // Already created + ERR_FAIL_COND(item.control != nullptr); // Already created Ref<Texture2D> favorite_icon = get_theme_icon("Favorites", "EditorIcons"); Color font_color = get_theme_color("font_color", "Tree"); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index dfecadeda5..42493191a8 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -41,7 +41,7 @@ #include "scene/gui/margin_container.h" #include "scene/gui/tab_container.h" -ProjectSettingsEditor *ProjectSettingsEditor::singleton = NULL; +ProjectSettingsEditor *ProjectSettingsEditor::singleton = nullptr; static const char *_button_names[JOY_BUTTON_MAX] = { "DualShock Cross, Xbox A, Nintendo B", @@ -750,7 +750,7 @@ void ProjectSettingsEditor::_update_actions() { item->set_range(1, action["deadzone"]); item->set_custom_bg_color(1, input_editor->get_theme_color("prop_subsection", "Editor")); - const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL; + const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != nullptr; const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove"); item->add_button(2, input_editor->get_theme_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); item->add_button(2, input_editor->get_theme_icon("Remove", "EditorIcons"), 2, false, tooltip); @@ -883,7 +883,7 @@ void ProjectSettingsEditor::_item_add() { // Initialize the property with the default value for the given type. // The type list starts at 1 (as we exclude Nil), so add 1 to the selected value. Callable::CallError ce; - const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce); + const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), nullptr, 0, ce); String catname = category->get_text().strip_edges(); String propname = property->get_text().strip_edges(); @@ -1537,7 +1537,7 @@ void ProjectSettingsEditor::_update_translations() { updating_translations = true; translation_list->clear(); - TreeItem *root = translation_list->create_item(NULL); + TreeItem *root = translation_list->create_item(nullptr); translation_list->set_hide_root(true); if (ProjectSettings::get_singleton()->has_setting("locale/translations")) { @@ -1589,7 +1589,7 @@ void ProjectSettingsEditor::_update_translations() { translation_locales_list_created = true; translation_filter->clear(); - root = translation_filter->create_item(NULL); + root = translation_filter->create_item(nullptr); translation_filter->set_hide_root(true); translation_filter_treeitems.clear(); for (int i = 0; i < s; i++) { @@ -1622,8 +1622,8 @@ void ProjectSettingsEditor::_update_translations() { translation_remap->clear(); translation_remap_options->clear(); - root = translation_remap->create_item(NULL); - TreeItem *root2 = translation_remap_options->create_item(NULL); + root = translation_remap->create_item(nullptr); + TreeItem *root2 = translation_remap_options->create_item(nullptr); translation_remap->set_hide_root(true); translation_remap_options->set_hide_root(true); translation_res_option_add_button->set_disabled(true); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 8c5b078de0..978c95b9c8 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -257,7 +257,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { file_system_dock->navigate_to_path(r->get_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; default: { @@ -1194,7 +1194,7 @@ void CustomPropertyEditor::_node_path_selected(NodePath p_path) { } else if (owner) { - Node *node = NULL; + Node *node = nullptr; if (owner->is_class("Node")) node = Object::cast_to<Node>(owner); @@ -1541,7 +1541,7 @@ void CustomPropertyEditor::_modified(String p_string) { v = value_editor[0]->get_text().to_int(); return; } else { - v = expr->execute(Array(), NULL, false); + v = expr->execute(Array(), nullptr, false); } emit_signal("variant_changed"); @@ -1713,7 +1713,7 @@ real_t CustomPropertyEditor::_parse_real_expression(String text) { if (err != OK) { out = value_editor[0]->get_text().to_double(); } else { - out = expr->execute(Array(), NULL, false); + out = expr->execute(Array(), nullptr, false); } return out; } @@ -1924,7 +1924,7 @@ CustomPropertyEditor::CustomPropertyEditor() { action_buttons[i]->set_flat(true); } - color_picker = NULL; + color_picker = nullptr; file = memnew(EditorFileDialog); add_child(file); @@ -1963,7 +1963,7 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(menu); menu->connect("id_pressed", callable_mp(this, &CustomPropertyEditor::_menu_option)); - evaluator = NULL; + evaluator = nullptr; spinbox = memnew(SpinBox); add_child(spinbox); @@ -1975,6 +1975,6 @@ CustomPropertyEditor::CustomPropertyEditor() { slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5); slider->connect("value_changed", callable_mp(this, &CustomPropertyEditor::_range_modified)); - create_dialog = NULL; - property_select = NULL; + create_dialog = nullptr; + property_select = nullptr; } diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 54b94ebb95..1960ecc604 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -96,7 +96,7 @@ void PropertySelector::_update_search() { } else if (type != Variant::NIL) { Variant v; Callable::CallError ce; - v = Variant::construct(type, NULL, 0, ce); + v = Variant::construct(type, nullptr, 0, ce); v.get_property_list(&props); } else { @@ -116,7 +116,7 @@ void PropertySelector::_update_search() { } } - TreeItem *category = NULL; + TreeItem *category = nullptr; bool found = false; @@ -152,7 +152,7 @@ void PropertySelector::_update_search() { for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { if (E->get().usage == PROPERTY_USAGE_CATEGORY) { - if (category && category->get_children() == NULL) { + if (category && category->get_children() == nullptr) { memdelete(category); //old category was unused } category = search_options->create_item(root); @@ -191,7 +191,7 @@ void PropertySelector::_update_search() { item->set_selectable(0, true); } - if (category && category->get_children() == NULL) { + if (category && category->get_children() == nullptr) { memdelete(category); //old category was unused } } else { @@ -201,7 +201,7 @@ void PropertySelector::_update_search() { if (type != Variant::NIL) { Variant v; Callable::CallError ce; - v = Variant::construct(type, NULL, 0, ce); + v = Variant::construct(type, nullptr, 0, ce); v.get_method_list(&methods); } else { @@ -220,14 +220,14 @@ void PropertySelector::_update_search() { } } - TreeItem *category = NULL; + TreeItem *category = nullptr; bool found = false; bool script_methods = false; for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { if (E->get().name.begins_with("*")) { - if (category && category->get_children() == NULL) { + if (category && category->get_children() == nullptr) { memdelete(category); //old category was unused } category = search_options->create_item(root); @@ -310,12 +310,12 @@ void PropertySelector::_update_search() { } } - if (category && category->get_children() == NULL) { + if (category && category->get_children() == nullptr) { memdelete(category); //old category was unused } } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void PropertySelector::_confirmed() { @@ -410,7 +410,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const type = Variant::NIL; script = ObjectID(); properties = false; - instance = NULL; + instance = nullptr; virtuals_only = p_virtuals_only; popup_centered_ratio(0.6); @@ -427,7 +427,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co type = Variant::NIL; script = p_script->get_instance_id(); properties = false; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); @@ -443,7 +443,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const type = p_type; script = ObjectID(); properties = false; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); @@ -464,7 +464,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str script = scr->get_instance_id(); } properties = false; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); @@ -480,7 +480,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons type = Variant::NIL; script = ObjectID(); properties = true; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); @@ -498,7 +498,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script, type = Variant::NIL; script = p_script->get_instance_id(); properties = true; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); @@ -515,7 +515,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con type = p_type; script = ObjectID(); properties = true; - instance = NULL; + instance = nullptr; virtuals_only = false; popup_centered_ratio(0.6); diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp index f9efe6a50d..1363fe2942 100644 --- a/editor/pvrtc_compress.cpp +++ b/editor/pvrtc_compress.cpp @@ -38,8 +38,8 @@ #include "editor_settings.h" #include "scene/resources/texture.h" -static void (*_base_image_compress_pvrtc2_func)(Image *) = NULL; -static void (*_base_image_compress_pvrtc4_func)(Image *) = NULL; +static void (*_base_image_compress_pvrtc2_func)(Image *) = nullptr; +static void (*_base_image_compress_pvrtc4_func)(Image *) = nullptr; static void _compress_image(Image::CompressMode p_mode, Image *p_image) { diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index 58bb061b58..1b4439f0a8 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -241,7 +241,7 @@ void EditorQuickOpen::_update_search() { ti->set_as_cursor(0); } - get_ok()->set_disabled(root->get_children() == NULL); + get_ok()->set_disabled(root->get_children() == nullptr); } void EditorQuickOpen::_confirmed() { @@ -265,8 +265,7 @@ void EditorQuickOpen::_notification(int p_what) { connect("confirmed", callable_mp(this, &EditorQuickOpen::_confirmed)); search_box->set_clear_button_enabled(true); - [[fallthrough]]; - } + } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &EditorQuickOpen::_confirmed)); } break; diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index c14462f07d..0266ef6a2b 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -45,7 +45,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und scene_tree_editor = p_scene_tree_editor; undo_redo = p_undo_redo; - preview_node = NULL; + preview_node = nullptr; set_title(TTR("Batch Rename")); @@ -369,7 +369,7 @@ void RenameDialog::_update_substitute() { void RenameDialog::_post_popup() { EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection(); - preview_node = NULL; + preview_node = nullptr; Array selected_node_list = editor_selection->get_selected_nodes(); ERR_FAIL_COND(selected_node_list.size() == 0); @@ -386,7 +386,7 @@ void RenameDialog::_update_preview_int(int new_value) { void RenameDialog::_update_preview(String new_text) { - if (lock_preview_update || preview_node == NULL) + if (lock_preview_update || preview_node == nullptr) return; has_errors = false; diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h index 1cd0a2cb0f..194dd57648 100644 --- a/editor/rename_dialog.h +++ b/editor/rename_dialog.h @@ -110,7 +110,7 @@ public: void reset(); void rename(); - RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo = NULL); + RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo = nullptr); ~RenameDialog(){}; }; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 4b382f09f4..a729f62123 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -438,7 +438,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { return; editor_data->get_undo_redo().create_action(TTR("Clear Script")); - editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)NULL); + editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)nullptr); for (int i = 0; i < selection.size(); i++) { @@ -495,7 +495,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (index < lowest_id) lowest_id = index; if (E->get()->get_parent() != common_parent) - common_parent = NULL; + common_parent = nullptr; } if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0)) @@ -548,7 +548,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().create_action(TTR("Duplicate Node(s)")); editor_data->get_undo_redo().add_do_method(editor_selection, "clear"); - Node *dupsingle = NULL; + Node *dupsingle = nullptr; List<Node *> editable_children; selection.sort_custom<Node::Comparator>(); @@ -675,7 +675,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_do_method(node, "add_child", root); editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename()); editor_data->get_undo_redo().add_do_method(root, "set_filename", String()); - editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)NULL); + editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)nullptr); editor_data->get_undo_redo().add_do_method(root, "set_owner", node); _node_replace_owner(root, root, node, MODE_DO); @@ -685,7 +685,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "move_child", node, node->get_index()); - editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)NULL); + editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)nullptr); editor_data->get_undo_redo().add_undo_method(node, "set_owner", root); _node_replace_owner(root, root, root, MODE_UNDO); @@ -962,7 +962,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { case TOOL_CREATE_USER_INTERFACE: case TOOL_CREATE_FAVORITE: { - Node *new_node = NULL; + Node *new_node = nullptr; if (TOOL_CREATE_FAVORITE == p_tool) { String name = selected_favorite_root.get_slicec(' ', 0); @@ -998,7 +998,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", new_node); editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree"); editor_data->get_undo_redo().add_do_reference(new_node); - 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); editor_data->get_undo_redo().commit_action(); editor->edit_node(new_node); @@ -1144,7 +1144,7 @@ void SceneTreeDock::_notification(int p_what) { } break; case NOTIFICATION_PROCESS: { - bool show_create_root = bool(EDITOR_GET("interface/editors/show_scene_tree_root_selection")) && get_tree()->get_edited_scene_root() == NULL; + bool show_create_root = bool(EDITOR_GET("interface/editors/show_scene_tree_root_selection")) && get_tree()->get_edited_scene_root() == nullptr; if (show_create_root != create_root_dialog->is_visible_in_tree() && !remote_tree->is_visible()) { if (show_create_root) { @@ -1202,7 +1202,7 @@ void SceneTreeDock::_node_selected() { if (!node) { - editor->push_item(NULL); + editor->push_item(nullptr); return; } @@ -1466,7 +1466,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) { for (int i = 0; i < p_node->get_child_count(); i++) _fill_path_renames(base_path, new_base_path, p_node->get_child(i), &path_renames); - perform_node_renames(NULL, &path_renames); + perform_node_renames(nullptr, &path_renames); } bool SceneTreeDock::_validate_no_foreign() { @@ -1535,7 +1535,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V if (p_nodes[ni] == p_new_parent) return; // Attempt to reparent to itself. - if (p_nodes[ni]->get_parent() != p_new_parent || p_position_in_parent + ni != p_nodes[ni]->get_position_in_parent()) + if (p_nodes[ni]->get_parent() != p_new_parent || p_position_in_parent + ni != p_nodes[ni]->get_index()) no_change = false; } @@ -1644,7 +1644,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V owners.push_back(E->get()); } - int child_pos = node->get_position_in_parent(); + int child_pos = node->get_index(); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "move_child", node, child_pos); @@ -1662,7 +1662,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V } } - perform_node_renames(NULL, &path_renames); + perform_node_renames(nullptr, &path_renames); editor_data->get_undo_redo().commit_action(); } @@ -1805,7 +1805,7 @@ void SceneTreeDock::_delete_confirm() { if (entire_scene) { - editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", (Object *)NULL); + editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", (Object *)nullptr); editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", edited_scene); editor_data->get_undo_redo().add_undo_method(edited_scene, "set_owner", edited_scene->get_owner()); editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree"); @@ -1822,10 +1822,10 @@ void SceneTreeDock::_delete_confirm() { if (!n->is_inside_tree() || !n->get_parent()) continue; - fill_path_renames(n, NULL, &path_renames); + fill_path_renames(n, nullptr, &path_renames); } - perform_node_renames(NULL, &path_renames); + perform_node_renames(nullptr, &path_renames); //delete for read for (List<Node *>::Element *E = remove_list.front(); E; E = E->next()) { Node *n = E->get(); @@ -1859,7 +1859,7 @@ void SceneTreeDock::_delete_confirm() { if (CanvasItemEditor *editor = CanvasItemEditor::get_singleton()) editor->get_viewport_control()->update(); - editor->push_item(NULL); + editor->push_item(nullptr); // Fixes the EditorHistory from still offering deleted notes EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history(); @@ -1908,7 +1908,7 @@ void SceneTreeDock::_selection_changed() { } else if (selection_size == 1) { editor->push_item(EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]); } else { - editor->push_item(NULL); + editor->push_item(nullptr); } _update_script_button(); } @@ -1918,7 +1918,7 @@ Node *SceneTreeDock::_get_selection_group_tail(Node *p_node, List<Node *> p_list Node *tail = p_node; Node *parent = tail->get_parent(); - for (int i = p_node->get_position_in_parent(); i < parent->get_child_count(); i++) { + for (int i = p_node->get_index(); i < parent->get_child_count(); i++) { Node *sibling = parent->get_child(i); if (p_list.find(sibling)) @@ -1958,7 +1958,7 @@ void SceneTreeDock::_do_create(Node *p_parent) { editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child); editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree"); 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); } editor_data->get_undo_redo().commit_action(); @@ -1982,7 +1982,7 @@ void SceneTreeDock::_create() { if (current_option == TOOL_NEW) { - Node *parent = NULL; + Node *parent = nullptr; if (edited_scene) { // If root exists in edited scene @@ -2052,7 +2052,7 @@ void SceneTreeDock::_create() { } } - Node *parent = NULL; + Node *parent = nullptr; if (only_one_top_node) parent = top_node->get_parent(); else @@ -2096,7 +2096,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop memdelete(default_oldnode); } - editor->push_item(NULL); + editor->push_item(nullptr); //reconnect signals List<MethodInfo> sl; @@ -2120,7 +2120,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop List<Node *> to_erase; for (int i = 0; i < n->get_child_count(); i++) { - if (n->get_child(i)->get_owner() == NULL && n->is_owned_by_parent()) { + if (n->get_child(i)->get_owner() == nullptr && n->is_owned_by_parent()) { to_erase.push_back(n->get_child(i)); } } @@ -2267,7 +2267,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) { if (p_type == -1) { //drop at above selected node if (to_node == EditorNode::get_singleton()->get_edited_scene()) { - to_node = NULL; + to_node = nullptr; ERR_FAIL_MSG("Cannot perform drop above the root node!"); } @@ -2282,7 +2282,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) { return; } - Node *lower_sibling = NULL; + Node *lower_sibling = nullptr; if (_has_visible_children(to_node)) { to_pos = 0; @@ -2500,8 +2500,8 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { bool is_external = (selection[0]->get_filename() != ""); if (is_external) { - bool is_inherited = selection[0]->get_scene_inherited_state() != NULL; - bool is_top_level = selection[0]->get_owner() == NULL; + bool is_inherited = selection[0]->get_scene_inherited_state() != nullptr; + bool is_top_level = selection[0]->get_owner() == nullptr; if (is_inherited && is_top_level) { menu->add_separator(); if (profile_allow_editing) { @@ -2634,7 +2634,7 @@ void SceneTreeDock::open_script_dialog(Node *p_for_node, bool p_extend) { } void SceneTreeDock::add_remote_tree_editor(Control *p_remote) { - ERR_FAIL_COND(remote_tree != NULL); + ERR_FAIL_COND(remote_tree != nullptr); add_child(p_remote); remote_tree = p_remote; remote_tree->hide(); @@ -2787,7 +2787,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel set_name("Scene"); editor = p_editor; - edited_scene = NULL; + edited_scene = nullptr; editor_data = &p_editor_data; editor_selection = p_editor_selection; scene_root = p_scene_root; @@ -2869,7 +2869,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel edit_local->set_toggle_mode(true); edit_local->connect("pressed", callable_mp(this, &SceneTreeDock::_local_tree_selected)); - remote_tree = NULL; + remote_tree = nullptr; button_hb->hide(); create_root_dialog = memnew(VBoxContainer); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index e41ea1ce97..31ef1ce7d0 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -247,10 +247,10 @@ public: void import_subscene(); void set_edited_scene(Node *p_scene); void instance(const String &p_file); - void instance_scenes(const Vector<String> &p_files, Node *p_parent = NULL); + void instance_scenes(const Vector<String> &p_files, Node *p_parent = nullptr); void set_selected(Node *p_node, bool p_emit_selected = false); void fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath>> *p_renames); - void perform_node_renames(Node *p_base, List<Pair<NodePath, NodePath>> *p_renames, Map<Ref<Animation>, Set<int>> *r_rem_anims = NULL); + void perform_node_renames(Node *p_base, List<Pair<NodePath, NodePath>> *p_renames, Map<Ref<Animation>, Set<int>> *r_rem_anims = nullptr); SceneTreeEditor *get_tree_editor() { return scene_tree; } EditorData *get_editor_data() { return editor_data; } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 831b7b6775..251c911038 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -42,7 +42,7 @@ Node *SceneTreeEditor::get_scene_node() { - ERR_FAIL_COND_V(!is_inside_tree(), NULL); + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); return get_tree()->get_edited_scene_root(); } @@ -78,7 +78,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i undo_redo->create_action(TTR("Toggle Visible")); _toggle_visible(n); List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.size() > 1 && selection.find(n) != NULL) { + if (selection.size() > 1 && selection.find(n) != nullptr) { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { Node *nv = E->get(); ERR_FAIL_COND(!nv); @@ -504,7 +504,7 @@ void SceneTreeEditor::_node_removed(Node *p_node) { } if (p_node == selected) { - selected = NULL; + selected = nullptr; emit_signal("node_selected"); } } @@ -529,7 +529,7 @@ void SceneTreeEditor::_update_tree() { updating_tree = true; tree->clear(); if (get_scene_node()) { - _add_nodes(get_scene_node(), NULL); + _add_nodes(get_scene_node(), nullptr); last_hash = hash_djb2_one_64(0); _compute_hash(get_scene_node(), last_hash); } @@ -667,7 +667,7 @@ void SceneTreeEditor::_notification(int p_what) { TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) { if (!p_node) - return NULL; + return nullptr; NodePath np = p_node->get_metadata(0); if (np == p_path) @@ -682,7 +682,7 @@ TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) { children = children->get_next(); } - return NULL; + return nullptr; } void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) { @@ -697,7 +697,7 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) { if (selected == p_node) return; - TreeItem *item = p_node ? _find(tree->get_root(), p_node->get_path()) : NULL; + TreeItem *item = p_node ? _find(tree->get_root(), p_node->get_path()) : nullptr; if (item) { // make visible when it's collapsed @@ -713,7 +713,7 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) { } else { if (!p_node) - selected = NULL; + selected = nullptr; _update_tree(); selected = p_node; } @@ -906,7 +906,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from Vector<Node *> selected; Vector<Ref<Texture2D>> icons; - TreeItem *next = tree->get_next_selected(NULL); + TreeItem *next = tree->get_next_selected(nullptr); while (next) { NodePath np = next->get_metadata(0); @@ -1117,16 +1117,16 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope connect_to_script_mode = false; connecting_signal = false; - undo_redo = NULL; + undo_redo = nullptr; tree_dirty = true; - selected = NULL; + selected = nullptr; marked_selectable = false; marked_children_selectable = false; can_rename = p_can_rename; can_open_instance = p_can_open_instance; display_foreign = false; - editor_selection = NULL; + editor_selection = nullptr; if (p_label) { Label *label = memnew(Label); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 82199fc1f1..12b21d871b 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -689,6 +689,8 @@ void ScriptCreateDialog::_update_dialog() { // Is Script created or loaded from existing file? + builtin_warning_label->set_visible(is_built_in); + if (is_built_in) { get_ok()->set_text(TTR("Create")); parent_name->set_editable(true); @@ -756,6 +758,13 @@ ScriptCreateDialog::ScriptCreateDialog() { path_error_label = memnew(Label); vb->add_child(path_error_label); + builtin_warning_label = memnew(Label); + builtin_warning_label->set_text( + TTR("Note: Built-in scripts have some limitations and can't be edited using an external editor.")); + vb->add_child(builtin_warning_label); + builtin_warning_label->set_autowrap(true); + builtin_warning_label->hide(); + status_panel = memnew(PanelContainer); status_panel->set_h_size_flags(Control::SIZE_FILL); status_panel->add_child(vb); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index f164cd2a15..63a30eba88 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -49,6 +49,7 @@ class ScriptCreateDialog : public ConfirmationDialog { LineEdit *class_name; Label *error_label; Label *path_error_label; + Label *builtin_warning_label; PanelContainer *status_panel; LineEdit *parent_name; Button *parent_browse_button; diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 6bd06aff64..8910e8ec3a 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -125,8 +125,8 @@ void EditorSettingsDialog::_notification(int p_what) { } } break; case NOTIFICATION_READY: { - undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, NULL); - undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, NULL); + undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr); + undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr); undo_redo->set_commit_notify_callback(_undo_redo_callback, this); } break; case NOTIFICATION_ENTER_TREE: { @@ -263,7 +263,7 @@ void EditorSettingsDialog::_update_shortcuts() { // remove sections with no shortcuts for (Map<String, TreeItem *>::Element *E = sections.front(); E; E = E->next()) { TreeItem *section = E->get(); - if (section->get_children() == NULL) { + if (section->get_children() == nullptr) { root->remove_child(section); } } @@ -362,7 +362,7 @@ void EditorSettingsDialog::_tabs_tab_changed(int p_tab) { void EditorSettingsDialog::_focus_current_search_box() { Control *tab = tabs->get_current_tab_control(); - LineEdit *current_search_box = NULL; + LineEdit *current_search_box = nullptr; if (tab == tab_general) current_search_box = search_box; else if (tab == tab_shortcuts) |