diff options
77 files changed, 382 insertions, 380 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index a0412e91ff..a116c9c270 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -291,7 +291,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) { } } } else { - if (p_name == CoreStringNames::get_singleton()->_custom_features) { + if (p_name == CoreStringName(_custom_features)) { Vector<String> custom_feature_array = String(p_value).split(","); for (int i = 0; i < custom_feature_array.size(); i++) { custom_features.insert(custom_feature_array[i]); @@ -875,7 +875,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const RBMap<S if (!p_custom_features.is_empty()) { // Store how many properties are saved, add one for custom features, which must always go first. file->store_32(count + 1); - String key = CoreStringNames::get_singleton()->_custom_features; + String key = CoreStringName(_custom_features); file->store_pascal_string(key); int len; diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index 21645e5efc..1ffe76495d 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -33,12 +33,10 @@ CoreStringNames *CoreStringNames::singleton = nullptr; CoreStringNames::CoreStringNames() : - _free(StaticCString::create("free")), + free_(StaticCString::create("free")), changed(StaticCString::create("changed")), - _script(StaticCString::create("script")), + script(StaticCString::create("script")), script_changed(StaticCString::create("script_changed")), - ___pdcdata(StaticCString::create("___pdcdata")), - __getvar(StaticCString::create("__getvar")), _iter_init(StaticCString::create("_iter_init")), _iter_next(StaticCString::create("_iter_next")), _iter_get(StaticCString::create("_iter_get")), diff --git a/core/core_string_names.h b/core/core_string_names.h index 1c77cef567..d7ddc39f5e 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -50,12 +50,10 @@ public: static CoreStringNames *singleton; - StringName _free; + StringName free_; // "free", conflict with C++ keyword. StringName changed; - StringName _script; + StringName script; StringName script_changed; - StringName ___pdcdata; - StringName __getvar; StringName _iter_init; StringName _iter_next; StringName _iter_get; @@ -98,4 +96,6 @@ public: StringName property_list_changed; }; +#define CoreStringName(m_name) CoreStringNames::get_singleton()->m_name + #endif // CORE_STRING_NAMES_H diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 2cdfacae17..1928f86d6a 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1696,7 +1696,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo Variant value; - if (E.name == CoreStringNames::get_singleton()->_script) { + if (E.name == CoreStringName(script)) { Ref<Script> script = obj->get_script(); if (script.is_valid()) { String path = script->get_path(); diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 4c3cfeaa58..24ff0e83d2 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -43,9 +43,9 @@ void Resource::emit_changed() { if (ResourceLoader::is_within_load() && !Thread::is_main_thread()) { // Let the connection happen on the main thread, later, since signals are not thread-safe. - call_deferred("emit_signal", CoreStringNames::get_singleton()->changed); + call_deferred("emit_signal", CoreStringName(changed)); } else { - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } } @@ -172,8 +172,8 @@ void Resource::connect_changed(const Callable &p_callable, uint32_t p_flags) { callable_mp(this, &Resource::connect_changed).call_deferred(p_callable, p_flags); return; } - if (!is_connected(CoreStringNames::get_singleton()->changed, p_callable) || p_flags & CONNECT_REFERENCE_COUNTED) { - connect(CoreStringNames::get_singleton()->changed, p_callable, p_flags); + if (!is_connected(CoreStringName(changed), p_callable) || p_flags & CONNECT_REFERENCE_COUNTED) { + connect(CoreStringName(changed), p_callable, p_flags); } } @@ -183,8 +183,8 @@ void Resource::disconnect_changed(const Callable &p_callable) { callable_mp(this, &Resource::disconnect_changed).call_deferred(p_callable); return; } - if (is_connected(CoreStringNames::get_singleton()->changed, p_callable)) { - disconnect(CoreStringNames::get_singleton()->changed, p_callable); + if (is_connected(CoreStringName(changed), p_callable)) { + disconnect(CoreStringName(changed), p_callable); } } diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 6b84dfcee9..7ea26c3fc5 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1554,7 +1554,7 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia } // The "free()" method is special, so we assume it exists and return a Callable. - if (p_property == CoreStringNames::get_singleton()->_free) { + if (p_property == CoreStringName(free_)) { r_value = Callable(p_object, p_property); return true; } diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp index 90536e58ff..6fab934395 100644 --- a/core/object/message_queue.cpp +++ b/core/object/message_queue.cpp @@ -197,7 +197,7 @@ Error CallQueue::push_notification(ObjectID p_id, int p_notification) { Message *msg = memnew_placement(buffer_end, Message); msg->type = TYPE_NOTIFICATION; - msg->callable = Callable(p_id, CoreStringNames::get_singleton()->notification); //name is meaningless but callable needs it + msg->callable = Callable(p_id, CoreStringName(notification)); //name is meaningless but callable needs it //msg->target; msg->notification = p_notification; diff --git a/core/object/object.cpp b/core/object/object.cpp index 5125ab8a6e..57f8766509 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -260,7 +260,7 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid } } - if (p_name == CoreStringNames::get_singleton()->_script) { + if (p_name == CoreStringName(script)) { set_script(p_value); if (r_valid) { *r_valid = true; @@ -351,7 +351,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { } } - if (p_name == CoreStringNames::get_singleton()->_script) { + if (p_name == CoreStringName(script)) { ret = get_script(); if (r_valid) { *r_valid = true; @@ -672,7 +672,7 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Call } bool Object::has_method(const StringName &p_method) const { - if (p_method == CoreStringNames::get_singleton()->_free) { + if (p_method == CoreStringName(free_)) { return true; } @@ -698,7 +698,7 @@ int Object::_get_method_argument_count_bind(const StringName &p_method) const { } int Object::get_method_argument_count(const StringName &p_method, bool *r_is_valid) const { - if (p_method == CoreStringNames::get_singleton()->_free) { + if (p_method == CoreStringName(free_)) { if (r_is_valid) { *r_is_valid = true; } @@ -787,7 +787,7 @@ Variant Object::callv(const StringName &p_method, const Array &p_args) { Variant Object::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { r_error.error = Callable::CallError::CALL_OK; - if (p_method == CoreStringNames::get_singleton()->_free) { + if (p_method == CoreStringName(free_)) { //free must be here, before anything, always ready #ifdef DEBUG_ENABLED if (p_argcount != 0) { @@ -850,7 +850,7 @@ Variant Object::callp(const StringName &p_method, const Variant **p_args, int p_ Variant Object::call_const(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { r_error.error = Callable::CallError::CALL_OK; - if (p_method == CoreStringNames::get_singleton()->_free) { + if (p_method == CoreStringName(free_)) { // Free is not const, so fail. r_error.error = Callable::CallError::CALL_ERROR_METHOD_NOT_CONST; return Variant(); @@ -979,7 +979,7 @@ void Object::set_script(const Variant &p_script) { } notify_property_list_changed(); //scripts may add variables, so refresh is desired - emit_signal(CoreStringNames::get_singleton()->script_changed); + emit_signal(CoreStringName(script_changed)); } void Object::set_script_instance(ScriptInstance *p_instance) { @@ -1654,7 +1654,7 @@ void Object::clear_internal_resource_paths() { } void Object::notify_property_list_changed() { - emit_signal(CoreStringNames::get_singleton()->property_list_changed); + emit_signal(CoreStringName(property_list_changed)); } void Object::_bind_methods() { diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 3a499a2bcd..8be00b1358 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -2121,7 +2121,7 @@ Variant::operator ::RID() const { } #endif Callable::CallError ce; - Variant ret = _get_obj().obj->callp(CoreStringNames::get_singleton()->get_rid, nullptr, 0, ce); + Variant ret = _get_obj().obj->callp(CoreStringName(get_rid), nullptr, 0, ce); if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::RID) { return ret; } diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index 96c52260d9..48176163a1 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -1384,7 +1384,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { ref.push_back(r_iter); Variant vref = ref; const Variant *refp[] = { &vref }; - Variant ret = _get_obj().obj->callp(CoreStringNames::get_singleton()->_iter_init, refp, 1, ce); + Variant ret = _get_obj().obj->callp(CoreStringName(_iter_init), refp, 1, ce); if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { valid = false; @@ -1619,7 +1619,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { ref.push_back(r_iter); Variant vref = ref; const Variant *refp[] = { &vref }; - Variant ret = _get_obj().obj->callp(CoreStringNames::get_singleton()->_iter_next, refp, 1, ce); + Variant ret = _get_obj().obj->callp(CoreStringName(_iter_next), refp, 1, ce); if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { valid = false; @@ -1811,7 +1811,7 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { Callable::CallError ce; ce.error = Callable::CallError::CALL_OK; const Variant *refp[] = { &r_iter }; - Variant ret = _get_obj().obj->callp(CoreStringNames::get_singleton()->_iter_get, refp, 1, ce); + Variant ret = _get_obj().obj->callp(CoreStringName(_iter_get), refp, 1, ce); if (ce.error != Callable::CallError::CALL_OK) { r_valid = false; diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 7856d454d0..a949899ac4 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -547,8 +547,8 @@ ActionMapEditor::ActionMapEditor() { action_list_search_by_event->set_h_size_flags(Control::SIZE_EXPAND_FILL); action_list_search_by_event->set_stretch_ratio(0.75); action_list_search_by_event->connect("event_changed", callable_mp(this, &ActionMapEditor::_search_by_event)); - action_list_search_by_event->connect(SceneStringNames::get_singleton()->focus_entered, callable_mp(this, &ActionMapEditor::_on_filter_focused)); - action_list_search_by_event->connect(SceneStringNames::get_singleton()->focus_exited, callable_mp(this, &ActionMapEditor::_on_filter_unfocused)); + action_list_search_by_event->connect(SceneStringName(focus_entered), callable_mp(this, &ActionMapEditor::_on_filter_focused)); + action_list_search_by_event->connect(SceneStringName(focus_exited), callable_mp(this, &ActionMapEditor::_on_filter_unfocused)); top_hbox->add_child(action_list_search_by_event); Button *clear_all_search = memnew(Button); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f21a0816ca..28aef2789b 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -2932,7 +2932,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) { } if (selected || editor->is_selection_active()) { AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (!player->has_animation(SceneStringNames::get_singleton()->RESET) || animation != player->get_animation(SceneStringNames::get_singleton()->RESET)) { + if (!player->has_animation(SceneStringName(RESET)) || animation != player->get_animation(SceneStringName(RESET))) { menu->add_icon_item(get_editor_theme_icon(SNAME("Reload")), TTR("Add RESET Value(s)"), MENU_KEY_ADD_RESET); } @@ -3691,8 +3691,8 @@ void AnimationTrackEditor::_animation_track_remove_request(int p_track, Ref<Anim // Remove corresponding reset tracks if they are no longer needed. AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation(SceneStringNames::get_singleton()->RESET)) { - Ref<Animation> reset = player->get_animation(SceneStringNames::get_singleton()->RESET); + if (player->has_animation(SceneStringName(RESET))) { + Ref<Animation> reset = player->get_animation(SceneStringName(RESET)); if (reset != p_from_animation) { for (int i = 0; i < reset->get_track_count(); i++) { if (reset->track_get_path(i) == p_from_animation->track_get_path(p_track)) { @@ -3798,7 +3798,7 @@ void AnimationTrackEditor::make_insert_queue() { void AnimationTrackEditor::commit_insert_queue() { bool reset_allowed = true; AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation(SceneStringNames::get_singleton()->RESET) && player->get_animation(SceneStringNames::get_singleton()->RESET) == animation) { + if (player->has_animation(SceneStringName(RESET)) && player->get_animation(SceneStringName(RESET)) == animation) { // Avoid messing with the reset animation itself. reset_allowed = false; } else { @@ -4207,8 +4207,8 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari Ref<Animation> AnimationTrackEditor::_create_and_get_reset_animation() { AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation(SceneStringNames::get_singleton()->RESET)) { - return player->get_animation(SceneStringNames::get_singleton()->RESET); + if (player->has_animation(SceneStringName(RESET))) { + return player->get_animation(SceneStringName(RESET)); } else { Ref<AnimationLibrary> al; AnimationMixer *mixer = AnimationPlayerEditor::get_singleton()->fetch_mixer_for_library(); @@ -4224,9 +4224,9 @@ Ref<Animation> AnimationTrackEditor::_create_and_get_reset_animation() { reset_anim.instantiate(); reset_anim->set_length(ANIM_MIN_LENGTH); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - undo_redo->add_do_method(al.ptr(), "add_animation", SceneStringNames::get_singleton()->RESET, reset_anim); + undo_redo->add_do_method(al.ptr(), "add_animation", SceneStringName(RESET), reset_anim); undo_redo->add_do_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player); - undo_redo->add_undo_method(al.ptr(), "remove_animation", SceneStringNames::get_singleton()->RESET); + undo_redo->add_undo_method(al.ptr(), "remove_animation", SceneStringName(RESET)); undo_redo->add_undo_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player); return reset_anim; } @@ -5024,8 +5024,8 @@ void AnimationTrackEditor::_add_track(int p_type) { void AnimationTrackEditor::_fetch_value_track_options(const NodePath &p_path, Animation::UpdateMode *r_update_mode, Animation::InterpolationType *r_interpolation_type, bool *r_loop_wrap) { AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation(SceneStringNames::get_singleton()->RESET)) { - Ref<Animation> reset_anim = player->get_animation(SceneStringNames::get_singleton()->RESET); + if (player->has_animation(SceneStringName(RESET))) { + Ref<Animation> reset_anim = player->get_animation(SceneStringName(RESET)); int rt = reset_anim->find_track(p_path, Animation::TrackType::TYPE_VALUE); if (rt >= 0) { *r_update_mode = reset_anim->value_track_get_update_mode(rt); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 816d3d7778..67bfeed8be 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3141,7 +3141,7 @@ void EditorPropertyResource::_resource_changed(const Ref<Resource> &p_resource) // Changing the value of Script-type exported variables of the main script should not trigger saving/reloading properties. bool is_script = false; Ref<Script> s = p_resource; - if (get_edited_object() && s.is_valid() && get_edited_property() == CoreStringNames::get_singleton()->_script) { + if (get_edited_object() && s.is_valid() && get_edited_property() == CoreStringName(script)) { is_script = true; InspectorDock::get_singleton()->store_script_properties(get_edited_object()); s->call("set_instance_base_type", get_edited_object()->get_class()); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 8de00dfcd1..43d8bc332c 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -984,12 +984,12 @@ void AnimationPlayerEditor::_update_animation_list_icons() { Ref<Texture2D> icon; if (anim_name == player->get_autoplay()) { - if (anim_name == SceneStringNames::get_singleton()->RESET) { + if (anim_name == SceneStringName(RESET)) { icon = autoplay_reset_icon; } else { icon = autoplay_icon; } - } else if (anim_name == SceneStringNames::get_singleton()->RESET) { + } else if (anim_name == SceneStringName(RESET)) { icon = reset_icon; } @@ -1459,7 +1459,7 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { onion.enabled = !onion.enabled; if (onion.enabled) { - if (get_player() && !get_player()->has_animation(SceneStringNames::get_singleton()->RESET)) { + if (get_player() && !get_player()->has_animation(SceneStringName(RESET))) { EditorNode::get_singleton()->show_warning(TTR("Onion skinning requires a RESET animation.")); } _start_onion_skinning(); // It will check for RESET animation anyway. @@ -1592,7 +1592,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_1() { return; } - if (!onion.enabled || !is_visible() || !get_player() || !get_player()->has_animation(SceneStringNames::get_singleton()->RESET)) { + if (!onion.enabled || !is_visible() || !get_player() || !get_player()->has_animation(SceneStringName(RESET))) { _stop_onion_skinning(); return; } @@ -1783,7 +1783,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_epilog() { } void AnimationPlayerEditor::_start_onion_skinning() { - if (get_player() && !get_player()->has_animation(SceneStringNames::get_singleton()->RESET)) { + if (get_player() && !get_player()->has_animation(SceneStringName(RESET))) { onion.enabled = false; onion_toggle->set_pressed_no_signal(false); return; diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index f24747d903..1314b26b1a 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -119,7 +119,7 @@ String AnimationNodeStateMachineEditor::_get_root_playback_path(String &r_node_d if (node_directory_path.size()) { r_node_directory += "/"; } - base_path = !edited_path.size() ? String(SceneStringNames::get_singleton()->parameters_base_path) + "playback" : String(SceneStringNames::get_singleton()->parameters_base_path) + base_path + "/playback"; + base_path = !edited_path.size() ? String(SceneStringName(parameters_base_path)) + "playback" : String(SceneStringName(parameters_base_path)) + base_path + "/playback"; } else { // Hmmm, we have to return Grouped state machine playback... // It will give the user the error that Root/Nested state machine should be retrieved, that would be kind :-) diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index c7f132bec1..08e3cb34a4 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -221,7 +221,7 @@ void AnimationTreeEditor::remove_plugin(AnimationTreeNodeEditorPlugin *p_editor) } String AnimationTreeEditor::get_base_path() { - String path = SceneStringNames::get_singleton()->parameters_base_path; + String path = SceneStringName(parameters_base_path); for (int i = 0; i < edited_path.size(); i++) { path += edited_path[i] + "/"; } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 258396ff31..b2ff03a6d3 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -387,7 +387,7 @@ void CollisionShape2DEditor::_shape_changed() { canvas_item_editor->update_viewport(); if (current_shape.is_valid()) { - current_shape->disconnect(SceneStringNames::get_singleton()->changed, callable_mp(canvas_item_editor, &CanvasItemEditor::update_viewport)); + current_shape->disconnect_changed(callable_mp(canvas_item_editor, &CanvasItemEditor::update_viewport)); current_shape = Ref<Shape2D>(); shape_type = -1; } @@ -399,7 +399,7 @@ void CollisionShape2DEditor::_shape_changed() { current_shape = node->get_shape(); if (current_shape.is_valid()) { - current_shape->connect(SceneStringNames::get_singleton()->changed, callable_mp(canvas_item_editor, &CanvasItemEditor::update_viewport)); + current_shape->connect_changed(callable_mp(canvas_item_editor, &CanvasItemEditor::update_viewport)); } else { return; } diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 92c9572a02..ce99b87a60 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -172,14 +172,14 @@ void MeshInstance3DEditor::_create_collision_shape() { ur->add_do_method(instance, "add_child", body, true); ur->add_do_method(body, "set_owner", owner); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, body); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), body); for (Ref<Shape3D> shape : shapes) { CollisionShape3D *cshape = memnew(CollisionShape3D); cshape->set_shape(shape); body->add_child(cshape, true); ur->add_do_method(cshape, "set_owner", owner); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, cshape); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), cshape); } ur->add_do_reference(body); ur->add_undo_method(instance, "remove_child", body); @@ -191,7 +191,7 @@ void MeshInstance3DEditor::_create_collision_shape() { cshape->set_transform(node->get_transform()); ur->add_do_method(E, "add_sibling", cshape, true); ur->add_do_method(cshape, "set_owner", owner); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, cshape); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), cshape); ur->add_do_reference(cshape); ur->add_undo_method(node->get_parent(), "remove_child", cshape); } @@ -232,7 +232,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { ur->add_do_method(node, "add_child", nmi, true); ur->add_do_method(nmi, "set_owner", owner); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, nmi); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), nmi); ur->add_do_reference(nmi); ur->add_undo_method(node, "remove_child", nmi); @@ -509,7 +509,7 @@ void MeshInstance3DEditor::_create_outline_mesh() { ur->add_do_method(node, "add_child", mi, true); ur->add_do_method(mi, "set_owner", owner); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, mi); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), mi); ur->add_do_reference(mi); ur->add_undo_method(node, "remove_child", mi); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 723dbf5d6c..23937fa330 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -973,7 +973,7 @@ void ScriptEditor::_queue_close_tabs() { // Maybe there are unsaved changes. if (se->is_unsaved()) { _ask_close_current_unsaved_tab(se); - erase_tab_confirm->connect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &ScriptEditor::_queue_close_tabs), CONNECT_ONE_SHOT); + erase_tab_confirm->connect(SceneStringName(visibility_changed), callable_mp(this, &ScriptEditor::_queue_close_tabs), CONNECT_ONE_SHOT); break; } } @@ -4238,7 +4238,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { autosave_timer = memnew(Timer); autosave_timer->set_one_shot(false); - autosave_timer->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &ScriptEditor::_update_autosave_timer)); + autosave_timer->connect(SceneStringName(tree_entered), callable_mp(this, &ScriptEditor::_update_autosave_timer)); autosave_timer->connect("timeout", callable_mp(this, &ScriptEditor::_autosave_scripts)); add_child(autosave_timer); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 1bd6b4e5b1..c80dc1ea77 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -410,8 +410,8 @@ void Skeleton3DEditor::create_physical_skeleton() { ur->add_do_method(physical_bone, "set_joint_type", PhysicalBone3D::JOINT_TYPE_PIN); } - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, physical_bone); - ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, collision_shape); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), physical_bone); + ur->add_do_method(Node3DEditor::get_singleton(), SceneStringName(_request_gizmo), collision_shape); ur->add_do_reference(physical_bone); ur->add_undo_method(simulator, "remove_child", physical_bone); @@ -842,10 +842,10 @@ void Skeleton3DEditor::_notification(int p_what) { joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed)); joint_tree->connect("item_mouse_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_rmb_select)); #ifdef TOOLS_ENABLED - skeleton->connect(SceneStringNames::get_singleton()->pose_updated, callable_mp(this, &Skeleton3DEditor::_draw_gizmo)); - skeleton->connect(SceneStringNames::get_singleton()->pose_updated, callable_mp(this, &Skeleton3DEditor::_update_properties)); - skeleton->connect(SceneStringNames::get_singleton()->bone_enabled_changed, callable_mp(this, &Skeleton3DEditor::_bone_enabled_changed)); - skeleton->connect(SceneStringNames::get_singleton()->show_rest_only_changed, callable_mp(this, &Skeleton3DEditor::_update_gizmo_visible)); + skeleton->connect(SceneStringName(pose_updated), callable_mp(this, &Skeleton3DEditor::_draw_gizmo)); + skeleton->connect(SceneStringName(pose_updated), callable_mp(this, &Skeleton3DEditor::_update_properties)); + skeleton->connect(SceneStringName(bone_enabled_changed), callable_mp(this, &Skeleton3DEditor::_bone_enabled_changed)); + skeleton->connect(SceneStringName(show_rest_only_changed), callable_mp(this, &Skeleton3DEditor::_update_gizmo_visible)); #endif get_tree()->connect("node_removed", callable_mp(this, &Skeleton3DEditor::_node_removed), Object::CONNECT_ONE_SHOT); @@ -870,10 +870,10 @@ void Skeleton3DEditor::_notification(int p_what) { if (skeleton) { select_bone(-1); // Requires that the joint_tree has not been deleted. #ifdef TOOLS_ENABLED - skeleton->disconnect(SceneStringNames::get_singleton()->show_rest_only_changed, callable_mp(this, &Skeleton3DEditor::_update_gizmo_visible)); - skeleton->disconnect(SceneStringNames::get_singleton()->bone_enabled_changed, callable_mp(this, &Skeleton3DEditor::_bone_enabled_changed)); - skeleton->disconnect(SceneStringNames::get_singleton()->pose_updated, callable_mp(this, &Skeleton3DEditor::_draw_gizmo)); - skeleton->disconnect(SceneStringNames::get_singleton()->pose_updated, callable_mp(this, &Skeleton3DEditor::_update_properties)); + skeleton->disconnect(SceneStringName(show_rest_only_changed), callable_mp(this, &Skeleton3DEditor::_update_gizmo_visible)); + skeleton->disconnect(SceneStringName(bone_enabled_changed), callable_mp(this, &Skeleton3DEditor::_bone_enabled_changed)); + skeleton->disconnect(SceneStringName(pose_updated), callable_mp(this, &Skeleton3DEditor::_draw_gizmo)); + skeleton->disconnect(SceneStringName(pose_updated), callable_mp(this, &Skeleton3DEditor::_update_properties)); skeleton->set_transform_gizmo_visible(true); #endif if (handles_mesh_instance->get_parent()) { diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 1a1b14bb84..2878472c7b 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -135,7 +135,7 @@ void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::edit(Ref<TileSet> // Disconnect to changes. if (tile_set_atlas_source.is_valid()) { - tile_set_atlas_source->disconnect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + tile_set_atlas_source->disconnect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } tile_set = p_tile_set; @@ -144,8 +144,8 @@ void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::edit(Ref<TileSet> // Connect to changes. if (tile_set_atlas_source.is_valid()) { - if (!tile_set_atlas_source->is_connected(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed))) { - tile_set_atlas_source->connect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + if (!tile_set_atlas_source->is_connected(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed))) { + tile_set_atlas_source->connect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } } @@ -522,8 +522,8 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(Ref<TileSetAtlasSource if (tile_set_atlas_source.is_valid() && tile_set_atlas_source->has_tile(coords) && tile_set_atlas_source->has_alternative_tile(coords, alternative)) { TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative); - if (tile_data->is_connected(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed))) { - tile_data->disconnect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + if (tile_data->is_connected(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed))) { + tile_data->disconnect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } } } @@ -538,8 +538,8 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(Ref<TileSetAtlasSource if (tile_set_atlas_source->has_tile(coords) && tile_set_atlas_source->has_alternative_tile(coords, alternative)) { TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative); - if (!tile_data->is_connected(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed))) { - tile_data->connect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + if (!tile_data->is_connected(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed))) { + tile_data->connect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } } } diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index e0151351b5..f42fac6d59 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -117,7 +117,7 @@ void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::ed // Disconnect to changes. if (tile_set_scenes_collection_source) { - tile_set_scenes_collection_source->disconnect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + tile_set_scenes_collection_source->disconnect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } tile_set = p_tile_set; @@ -126,8 +126,8 @@ void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::ed // Connect to changes. if (tile_set_scenes_collection_source) { - if (!tile_set_scenes_collection_source->is_connected(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed))) { - tile_set_scenes_collection_source->connect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + if (!tile_set_scenes_collection_source->is_connected(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed))) { + tile_set_scenes_collection_source->connect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } } diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 19b264d764..88383554b6 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2038,15 +2038,15 @@ void GDScriptInstance::notification(int p_notification, bool p_reversed) { } String GDScriptInstance::to_string(bool *r_valid) { - if (has_method(CoreStringNames::get_singleton()->_to_string)) { + if (has_method(CoreStringName(_to_string))) { Callable::CallError ce; - Variant ret = callp(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce); + Variant ret = callp(CoreStringName(_to_string), nullptr, 0, ce); if (ce.error == Callable::CallError::CALL_OK) { if (ret.get_type() != Variant::STRING) { if (r_valid) { *r_valid = false; } - ERR_FAIL_V_MSG(String(), "Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String."); + ERR_FAIL_V_MSG(String(), "Wrong type for " + CoreStringName(_to_string) + ", must be a String."); } if (r_valid) { *r_valid = true; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 4b6cc47218..ac5564cf12 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -231,7 +231,7 @@ bool GDScriptAnalyzer::has_member_name_conflict_in_native_type(const StringName if (ClassDB::has_integer_constant(p_native_type_string, p_member_name)) { return true; } - if (p_member_name == CoreStringNames::get_singleton()->_script) { + if (p_member_name == CoreStringName(script)) { return true; } @@ -2172,7 +2172,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) { List<GDScriptParser::DataType> par_types; int default_arg_count = 0; BitField<MethodFlags> method_flags; - if (get_function_signature(p_for->list, false, list_type, CoreStringNames::get_singleton()->_iter_get, return_type, par_types, default_arg_count, method_flags)) { + if (get_function_signature(p_for->list, false, list_type, CoreStringName(_iter_get), return_type, par_types, default_arg_count, method_flags)) { variable_type = return_type; variable_type.type_source = list_type.type_source; } else if (!list_type.is_hard_type()) { diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 01e5751dc8..4f8a554ce1 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -346,7 +346,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code scr = scr->_base; } - if (nc && (identifier == CoreStringNames::get_singleton()->_free || ClassDB::has_signal(nc->get_name(), identifier) || ClassDB::has_method(nc->get_name(), identifier))) { + if (nc && (identifier == CoreStringName(free_) || ClassDB::has_signal(nc->get_name(), identifier) || ClassDB::has_method(nc->get_name(), identifier))) { // Get like it was a property. GDScriptCodeGenerator::Address temp = codegen.add_temporary(); // TODO: Get type here. GDScriptCodeGenerator::Address self(GDScriptCodeGenerator::Address::SELF); diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 11bd1d224a..1efa9ece0d 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -1741,7 +1741,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a if (base_type == Variant::OBJECT) { if (base_obj) { MethodBind *method = ClassDB::get_method(base_class, *methodname); - if (*methodname == CoreStringNames::get_singleton()->_free || (method && !method->has_return())) { + if (*methodname == CoreStringName(free_) || (method && !method->has_return())) { err_text = R"(Trying to get a return value of a method that returns "void")"; OPCODE_BREAK; } @@ -3097,7 +3097,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a const Variant *args[] = { &vref }; Callable::CallError ce; - Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_init, args, 1, ce); + Variant has_next = obj->callp(CoreStringName(_iter_init), args, 1, ce); #ifdef DEBUG_ENABLED if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { @@ -3113,7 +3113,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a *counter = ref[0]; GET_VARIANT_PTR(iterator, 2); - *iterator = obj->callp(CoreStringNames::get_singleton()->_iter_get, (const Variant **)&counter, 1, ce); + *iterator = obj->callp(CoreStringName(_iter_get), (const Variant **)&counter, 1, ce); #ifdef DEBUG_ENABLED if (ce.error != Callable::CallError::CALL_OK) { err_text = vformat(R"(There was an error calling "_iter_get" on iterator object of type %s.)", *container); @@ -3431,7 +3431,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a const Variant *args[] = { &vref }; Callable::CallError ce; - Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_next, args, 1, ce); + Variant has_next = obj->callp(CoreStringName(_iter_next), args, 1, ce); #ifdef DEBUG_ENABLED if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { @@ -3447,7 +3447,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a *counter = ref[0]; GET_VARIANT_PTR(iterator, 2); - *iterator = obj->callp(CoreStringNames::get_singleton()->_iter_get, (const Variant **)&counter, 1, ce); + *iterator = obj->callp(CoreStringName(_iter_get), (const Variant **)&counter, 1, ce); #ifdef DEBUG_ENABLED if (ce.error != Callable::CallError::CALL_OK) { err_text = vformat(R"(There was an error calling "_iter_get" on iterator object of type %s.)", *container); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index d53bf7f7ec..49c90cc775 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -949,7 +949,7 @@ void GridMapEditor::_update_mesh_library() { void GridMapEditor::edit(GridMap *p_gridmap) { if (node) { node->disconnect(SNAME("cell_size_changed"), callable_mp(this, &GridMapEditor::_draw_grids)); - node->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GridMapEditor::_update_mesh_library)); + node->disconnect(CoreStringName(changed), callable_mp(this, &GridMapEditor::_update_mesh_library)); if (mesh_library.is_valid()) { mesh_library->disconnect_changed(callable_mp(this, &GridMapEditor::update_palette)); mesh_library = Ref<MeshLibrary>(); @@ -987,7 +987,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) { update_grid(); node->connect(SNAME("cell_size_changed"), callable_mp(this, &GridMapEditor::_draw_grids)); - node->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GridMapEditor::_update_mesh_library)); + node->connect(CoreStringName(changed), callable_mp(this, &GridMapEditor::_update_mesh_library)); _update_mesh_library(); } diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 25519c6e3c..abfbfebc02 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -266,7 +266,7 @@ void GridMap::set_mesh_library(const Ref<MeshLibrary> &p_mesh_library) { } _recreate_octant_data(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } Ref<MeshLibrary> GridMap::get_mesh_library() const { @@ -1136,7 +1136,7 @@ void GridMap::_bind_methods() { BIND_CONSTANT(INVALID_CELL_ITEM); ADD_SIGNAL(MethodInfo("cell_size_changed", PropertyInfo(Variant::VECTOR3, "cell_size"))); - ADD_SIGNAL(MethodInfo(CoreStringNames::get_singleton()->changed)); + ADD_SIGNAL(MethodInfo(CoreStringName(changed))); } void GridMap::set_cell_scale(float p_scale) { diff --git a/modules/multiplayer/multiplayer_spawner.cpp b/modules/multiplayer/multiplayer_spawner.cpp index 6c0669b2f3..b871025491 100644 --- a/modules/multiplayer/multiplayer_spawner.cpp +++ b/modules/multiplayer/multiplayer_spawner.cpp @@ -216,7 +216,7 @@ void MultiplayerSpawner::_notification(int p_what) { for (const KeyValue<ObjectID, SpawnInfo> &E : tracked_nodes) { Node *node = Object::cast_to<Node>(ObjectDB::get_instance(E.key)); ERR_CONTINUE(!node); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &MultiplayerSpawner::_node_exit)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &MultiplayerSpawner::_node_exit)); get_multiplayer()->object_configuration_remove(node, this); } tracked_nodes.clear(); @@ -258,7 +258,7 @@ void MultiplayerSpawner::_track(Node *p_node, const Variant &p_argument, int p_s ObjectID oid = p_node->get_instance_id(); if (!tracked_nodes.has(oid)) { tracked_nodes[oid] = SpawnInfo(p_argument.duplicate(true), p_scene_id); - p_node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &MultiplayerSpawner::_node_exit).bind(p_node->get_instance_id()), CONNECT_ONE_SHOT); + p_node->connect(SceneStringName(tree_exiting), callable_mp(this, &MultiplayerSpawner::_node_exit).bind(p_node->get_instance_id()), CONNECT_ONE_SHOT); _spawn_notify(p_node->get_instance_id()); } } diff --git a/modules/multiplayer/scene_cache_interface.cpp b/modules/multiplayer/scene_cache_interface.cpp index c08ccbe4cc..39443029d3 100644 --- a/modules/multiplayer/scene_cache_interface.cpp +++ b/modules/multiplayer/scene_cache_interface.cpp @@ -42,7 +42,7 @@ SceneCacheInterface::NodeCache &SceneCacheInterface::_track(Node *p_node) { NodeCache *nc = nodes_cache.getptr(oid); if (!nc) { nodes_cache[oid] = NodeCache(); - p_node->connect(SceneStringNames::get_singleton()->tree_exited, callable_mp(this, &SceneCacheInterface::_remove_node_cache).bind(oid), Object::CONNECT_ONE_SHOT); + p_node->connect(SceneStringName(tree_exited), callable_mp(this, &SceneCacheInterface::_remove_node_cache).bind(oid), Object::CONNECT_ONE_SHOT); } return nodes_cache[oid]; } @@ -286,7 +286,7 @@ void SceneCacheInterface::clear() { for (KeyValue<ObjectID, NodeCache> &E : nodes_cache) { Object *obj = ObjectDB::get_instance(E.key); ERR_CONTINUE(!obj); - obj->disconnect(SceneStringNames::get_singleton()->tree_exited, callable_mp(this, &SceneCacheInterface::_remove_node_cache)); + obj->disconnect(SceneStringName(tree_exited), callable_mp(this, &SceneCacheInterface::_remove_node_cache)); } peers_info.clear(); nodes_cache.clear(); diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index 182e9b455c..f1a43a68b9 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -57,7 +57,7 @@ SceneReplicationInterface::TrackedNode &SceneReplicationInterface::_track(const if (!tracked_nodes.has(p_id)) { tracked_nodes[p_id] = TrackedNode(p_id); Node *node = get_id_as<Node>(p_id); - node->connect(SceneStringNames::get_singleton()->tree_exited, callable_mp(this, &SceneReplicationInterface::_untrack).bind(p_id), Node::CONNECT_ONE_SHOT); + node->connect(SceneStringName(tree_exited), callable_mp(this, &SceneReplicationInterface::_untrack).bind(p_id), Node::CONNECT_ONE_SHOT); } return tracked_nodes[p_id]; } @@ -135,8 +135,8 @@ void SceneReplicationInterface::on_network_process() { for (const ObjectID &oid : spawn_queue) { Node *node = get_id_as<Node>(oid); ERR_CONTINUE(!node); - if (node->is_connected(SceneStringNames::get_singleton()->ready, callable_mp(this, &SceneReplicationInterface::_node_ready))) { - node->disconnect(SceneStringNames::get_singleton()->ready, callable_mp(this, &SceneReplicationInterface::_node_ready)); + if (node->is_connected(SceneStringName(ready), callable_mp(this, &SceneReplicationInterface::_node_ready))) { + node->disconnect(SceneStringName(ready), callable_mp(this, &SceneReplicationInterface::_node_ready)); } } spawn_queue.clear(); @@ -168,7 +168,7 @@ Error SceneReplicationInterface::on_spawn(Object *p_obj, Variant p_config) { ERR_FAIL_COND_V(tobj.spawner != ObjectID(), ERR_ALREADY_IN_USE); tobj.spawner = spawner->get_instance_id(); spawn_queue.insert(oid); - node->connect(SceneStringNames::get_singleton()->ready, callable_mp(this, &SceneReplicationInterface::_node_ready).bind(oid), Node::CONNECT_ONE_SHOT); + node->connect(SceneStringName(ready), callable_mp(this, &SceneReplicationInterface::_node_ready).bind(oid), Node::CONNECT_ONE_SHOT); return OK; } diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 37e9d1f8c1..f543412962 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -202,7 +202,7 @@ void AnimatedSprite2D::_notification(int p_what) { } else { frame = last_frame; pause(); - emit_signal(SceneStringNames::get_singleton()->animation_finished); + emit_signal(SceneStringName(animation_finished)); return; } } else { @@ -211,7 +211,7 @@ void AnimatedSprite2D::_notification(int p_what) { _calc_frame_speed_scale(); frame_progress = 0.0; queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining); frame_progress += to_process * abs_speed; @@ -226,7 +226,7 @@ void AnimatedSprite2D::_notification(int p_what) { } else { frame = 0; pause(); - emit_signal(SceneStringNames::get_singleton()->animation_finished); + emit_signal(SceneStringName(animation_finished)); return; } } else { @@ -235,7 +235,7 @@ void AnimatedSprite2D::_notification(int p_what) { _calc_frame_speed_scale(); frame_progress = 1.0; queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } double to_process = MIN(frame_progress / abs_speed, remaining); frame_progress -= to_process * abs_speed; @@ -291,12 +291,12 @@ void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) { } if (frames.is_valid()) { - frames->disconnect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite2D::_res_changed)); + frames->disconnect(SceneStringName(changed), callable_mp(this, &AnimatedSprite2D::_res_changed)); } stop(); frames = p_frames; if (frames.is_valid()) { - frames->connect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite2D::_res_changed)); + frames->connect(SceneStringName(changed), callable_mp(this, &AnimatedSprite2D::_res_changed)); List<StringName> al; frames->get_animation_list(&al); @@ -363,7 +363,7 @@ void AnimatedSprite2D::set_frame_and_progress(int p_frame, real_t p_progress) { return; // No change, don't redraw. } queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } void AnimatedSprite2D::set_speed_scale(float p_speed_scale) { diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 4fc0fe0268..fb632e8f64 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -81,10 +81,10 @@ StringName AudioStreamPlayer2D::_get_actual_bus() { //check if any area is diverting sound into a bus Ref<World2D> world_2d = get_world_2d(); - ERR_FAIL_COND_V(world_2d.is_null(), SceneStringNames::get_singleton()->Master); + ERR_FAIL_COND_V(world_2d.is_null(), SceneStringName(Master)); PhysicsDirectSpaceState2D *space_state = PhysicsServer2D::get_singleton()->space_get_direct_state(world_2d->get_space()); - ERR_FAIL_NULL_V(space_state, SceneStringNames::get_singleton()->Master); + ERR_FAIL_COND_V(space_state, SceneStringName(Master)); PhysicsDirectSpaceState2D::ShapeResult sr[MAX_INTERSECT_AREAS]; PhysicsDirectSpaceState2D::PointParameters point_params; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 2cd59776ec..3df635d75a 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -997,7 +997,7 @@ void CPUParticles2D::_particles_process(double p_delta) { } if (!Math::is_equal_approx(time, 0.0) && active && !should_be_active) { active = false; - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringName(finished)); } } diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index bc39513c03..caac564500 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -731,7 +731,7 @@ void GPUParticles2D::_notification(int p_what) { } if (time > active_time) { if (active && !signal_canceled) { - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringName(finished)); } active = false; if (!emitting) { diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index 4fc375ff8d..28af4184ca 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -70,7 +70,7 @@ void MeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) { } texture = p_texture; queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->texture_changed); + emit_signal(SceneStringName(texture_changed)); } Ref<Texture2D> MeshInstance2D::get_texture() const { diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp index 9631b2cc4e..695e44664e 100644 --- a/scene/2d/multimesh_instance_2d.cpp +++ b/scene/2d/multimesh_instance_2d.cpp @@ -79,7 +79,7 @@ void MultiMeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) { } texture = p_texture; queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->texture_changed); + emit_signal(SceneStringName(texture_changed)); } Ref<Texture2D> MultiMeshInstance2D::get_texture() const { diff --git a/scene/2d/physics/area_2d.cpp b/scene/2d/physics/area_2d.cpp index b1ff94dda4..3ed579b3b1 100644 --- a/scene/2d/physics/area_2d.cpp +++ b/scene/2d/physics/area_2d.cpp @@ -142,9 +142,9 @@ void Area2D::_body_enter_tree(ObjectID p_id) { ERR_FAIL_COND(E->value.in_tree); E->value.in_tree = true; - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_entered), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); } } @@ -156,9 +156,9 @@ void Area2D::_body_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->value.in_tree); E->value.in_tree = false; - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_exited), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); } } @@ -172,9 +172,9 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i lock_callback(); locked = true; if (body_in) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, (Node *)nullptr, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, (Node *)nullptr, p_body_shape, p_area_shape); } else { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, (Node *)nullptr, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, (Node *)nullptr, p_body_shape, p_area_shape); } locked = false; unlock_callback(); @@ -200,10 +200,10 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i E->value.rc = 0; E->value.in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_body_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_body_exit_tree).bind(objid)); if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); } } } @@ -213,7 +213,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i } if (!node || E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, node, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, node, p_body_shape, p_area_shape); } } else { @@ -227,15 +227,15 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i if (E->value.rc == 0) { body_map.remove(E); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_body_exit_tree)); if (in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_exited, obj); + emit_signal(SceneStringName(body_exited), obj); } } } if (!node || in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, obj, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, obj, p_body_shape, p_area_shape); } } @@ -253,9 +253,9 @@ void Area2D::_area_enter_tree(ObjectID p_id) { ERR_FAIL_COND(E->value.in_tree); E->value.in_tree = true; - emit_signal(SceneStringNames::get_singleton()->area_entered, node); + emit_signal(SceneStringName(area_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_entered), E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); } } @@ -267,9 +267,9 @@ void Area2D::_area_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->value.in_tree); E->value.in_tree = false; - emit_signal(SceneStringNames::get_singleton()->area_exited, node); + emit_signal(SceneStringName(area_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_exited), E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); } } @@ -283,9 +283,9 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i lock_callback(); locked = true; if (area_in) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, p_area, (Node *)nullptr, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_entered), p_area, (Node *)nullptr, p_area_shape, p_self_shape); } else { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, p_area, (Node *)nullptr, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_exited), p_area, (Node *)nullptr, p_area_shape, p_self_shape); } locked = false; unlock_callback(); @@ -311,10 +311,10 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i E->value.rc = 0; E->value.in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_area_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_area_exit_tree).bind(objid)); if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_entered, node); + emit_signal(SceneStringName(area_entered), node); } } } @@ -324,7 +324,7 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i } if (!node || E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, p_area, node, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_entered), p_area, node, p_area_shape, p_self_shape); } } else { @@ -338,15 +338,15 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i if (E->value.rc == 0) { area_map.remove(E); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_area_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_area_exit_tree)); if (in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_exited, obj); + emit_signal(SceneStringName(area_exited), obj); } } } if (!node || in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, p_area, obj, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_exited), p_area, obj, p_area_shape, p_self_shape); } } @@ -370,18 +370,18 @@ void Area2D::_clear_monitoring() { continue; } - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_body_exit_tree)); if (!E.value.in_tree) { continue; } for (int i = 0; i < E.value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E.value.rid, node, E.value.shapes[i].body_shape, E.value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_exited), E.value.rid, node, E.value.shapes[i].body_shape, E.value.shapes[i].area_shape); } - emit_signal(SceneStringNames::get_singleton()->body_exited, obj); + emit_signal(SceneStringName(body_exited), obj); } } @@ -398,18 +398,18 @@ void Area2D::_clear_monitoring() { continue; } - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area2D::_area_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area2D::_area_exit_tree)); if (!E.value.in_tree) { continue; } for (int i = 0; i < E.value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, E.value.rid, node, E.value.shapes[i].area_shape, E.value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_exited), E.value.rid, node, E.value.shapes[i].area_shape, E.value.shapes[i].self_shape); } - emit_signal(SceneStringNames::get_singleton()->area_exited, obj); + emit_signal(SceneStringName(area_exited), obj); } } } @@ -538,7 +538,7 @@ StringName Area2D::get_audio_bus_name() const { return audio_bus; } } - return SceneStringNames::get_singleton()->Master; + return SceneStringName(Master); } void Area2D::_validate_property(PropertyInfo &p_property) const { diff --git a/scene/2d/physics/collision_object_2d.cpp b/scene/2d/physics/collision_object_2d.cpp index 4e5852984b..35704ae382 100644 --- a/scene/2d/physics/collision_object_2d.cpp +++ b/scene/2d/physics/collision_object_2d.cpp @@ -519,27 +519,27 @@ bool CollisionObject2D::is_pickable() const { void CollisionObject2D::_input_event_call(Viewport *p_viewport, const Ref<InputEvent> &p_input_event, int p_shape) { GDVIRTUAL_CALL(_input_event, p_viewport, p_input_event, p_shape); - emit_signal(SceneStringNames::get_singleton()->input_event, p_viewport, p_input_event, p_shape); + emit_signal(SceneStringName(input_event), p_viewport, p_input_event, p_shape); } void CollisionObject2D::_mouse_enter() { GDVIRTUAL_CALL(_mouse_enter); - emit_signal(SceneStringNames::get_singleton()->mouse_entered); + emit_signal(SceneStringName(mouse_entered)); } void CollisionObject2D::_mouse_exit() { GDVIRTUAL_CALL(_mouse_exit); - emit_signal(SceneStringNames::get_singleton()->mouse_exited); + emit_signal(SceneStringName(mouse_exited)); } void CollisionObject2D::_mouse_shape_enter(int p_shape) { GDVIRTUAL_CALL(_mouse_shape_enter, p_shape); - emit_signal(SceneStringNames::get_singleton()->mouse_shape_entered, p_shape); + emit_signal(SceneStringName(mouse_shape_entered), p_shape); } void CollisionObject2D::_mouse_shape_exit(int p_shape) { GDVIRTUAL_CALL(_mouse_shape_exit, p_shape); - emit_signal(SceneStringNames::get_singleton()->mouse_shape_exited, p_shape); + emit_signal(SceneStringName(mouse_shape_exited), p_shape); } void CollisionObject2D::set_only_update_transform_changes(bool p_enable) { diff --git a/scene/2d/physics/joints/joint_2d.cpp b/scene/2d/physics/joints/joint_2d.cpp index 1afac7c150..5f61bebbb1 100644 --- a/scene/2d/physics/joints/joint_2d.cpp +++ b/scene/2d/physics/joints/joint_2d.cpp @@ -37,13 +37,13 @@ void Joint2D::_disconnect_signals() { Node *node_a = get_node_or_null(a); PhysicsBody2D *body_a = Object::cast_to<PhysicsBody2D>(node_a); if (body_a) { - body_a->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree)); + body_a->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Joint2D::_body_exit_tree)); } Node *node_b = get_node_or_null(b); PhysicsBody2D *body_b = Object::cast_to<PhysicsBody2D>(node_b); if (body_b) { - body_b->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree)); + body_b->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Joint2D::_body_exit_tree)); } } @@ -117,8 +117,8 @@ void Joint2D::_update_joint(bool p_only_free) { ba = body_a->get_rid(); bb = body_b->get_rid(); - body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree)); - body_b->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree)); + body_a->connect(SceneStringName(tree_exiting), callable_mp(this, &Joint2D::_body_exit_tree)); + body_b->connect(SceneStringName(tree_exiting), callable_mp(this, &Joint2D::_body_exit_tree)); PhysicsServer2D::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision); } diff --git a/scene/2d/physics/rigid_body_2d.cpp b/scene/2d/physics/rigid_body_2d.cpp index 5e05c563a4..2495e7bc18 100644 --- a/scene/2d/physics/rigid_body_2d.cpp +++ b/scene/2d/physics/rigid_body_2d.cpp @@ -44,10 +44,10 @@ void RigidBody2D::_body_enter_tree(ObjectID p_id) { contact_monitor->locked = true; E->value.in_scene = true; - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); + emit_signal(SceneStringName(body_shape_entered), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); } contact_monitor->locked = false; @@ -65,10 +65,10 @@ void RigidBody2D::_body_exit_tree(ObjectID p_id) { contact_monitor->locked = true; - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); + emit_signal(SceneStringName(body_shape_exited), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); } contact_monitor->locked = false; @@ -93,10 +93,10 @@ void RigidBody2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan //E->value.rc=0; E->value.in_scene = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody2D::_body_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody2D::_body_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &RigidBody2D::_body_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody2D::_body_exit_tree).bind(objid)); if (E->value.in_scene) { - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); } } @@ -108,7 +108,7 @@ void RigidBody2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan } if (E->value.in_scene) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, node, p_body_shape, p_local_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, node, p_body_shape, p_local_shape); } } else { @@ -122,17 +122,17 @@ void RigidBody2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan if (E->value.shapes.is_empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody2D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody2D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &RigidBody2D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody2D::_body_exit_tree)); if (in_scene) { - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); } } contact_monitor->body_map.remove(E); } if (node && in_scene) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, node, p_body_shape, p_local_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, node, p_body_shape, p_local_shape); } } } @@ -158,7 +158,7 @@ void RigidBody2D::_sync_body_state(PhysicsDirectBodyState2D *p_state) { if (sleeping != p_state->is_sleeping()) { sleeping = p_state->is_sleeping(); - emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); + emit_signal(SceneStringName(sleeping_state_changed)); } } @@ -605,8 +605,8 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { Node *node = Object::cast_to<Node>(obj); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody2D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody2D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &RigidBody2D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody2D::_body_exit_tree)); } } diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 5745a59297..af40de1dd1 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -146,7 +146,7 @@ void Sprite2D::set_texture(const Ref<Texture2D> &p_texture) { } queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->texture_changed); + emit_signal(SceneStringName(texture_changed)); item_rect_changed(); } @@ -260,7 +260,7 @@ void Sprite2D::set_frame(int p_frame) { frame = p_frame; item_rect_changed(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } int Sprite2D::get_frame() const { diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index fbe7563e6b..3ea69fe17e 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -54,7 +54,7 @@ void TileMap::_tile_set_changed() { } void TileMap::_emit_changed() { - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMap::_set_tile_map_data_using_compatibility_format(int p_layer, TileMapDataFormat p_format, const Vector<int> &p_data) { @@ -360,7 +360,7 @@ void TileMap::add_layer(int p_to_pos) { for (uint32_t i = 0; i < layers.size(); i++) { layers[i]->set_as_tile_map_internal_node(i); } - new_layer->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TileMap::_emit_changed)); + new_layer->connect(CoreStringName(changed), callable_mp(this, &TileMap::_emit_changed)); notify_property_list_changed(); @@ -768,7 +768,7 @@ bool TileMap::_set(const StringName &p_name, const Variant &p_value) { new_layer->set_as_tile_map_internal_node(index); new_layer->set_name(vformat("Layer%d", index)); new_layer->set_tile_set(tile_set); - new_layer->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TileMap::_emit_changed)); + new_layer->connect(CoreStringName(changed), callable_mp(this, &TileMap::_emit_changed)); layers.push_back(new_layer); } @@ -1051,7 +1051,7 @@ void TileMap::_bind_methods() { ADD_PROPERTY_DEFAULT("format", TileMapDataFormat::TILE_MAP_DATA_FORMAT_1); - ADD_SIGNAL(MethodInfo(CoreStringNames::get_singleton()->changed)); + ADD_SIGNAL(MethodInfo(CoreStringName(changed))); BIND_ENUM_CONSTANT(VISIBILITY_MODE_DEFAULT); BIND_ENUM_CONSTANT(VISIBILITY_MODE_FORCE_HIDE); @@ -1064,7 +1064,7 @@ TileMap::TileMap() { new_layer->set_as_tile_map_internal_node(0); new_layer->set_name("Layer0"); new_layer->set_tile_set(tile_set); - new_layer->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TileMap::_emit_changed)); + new_layer->connect(CoreStringName(changed), callable_mp(this, &TileMap::_emit_changed)); layers.push_back(new_layer); if (!base_property_helper.is_initialized()) { diff --git a/scene/2d/tile_map_layer.cpp b/scene/2d/tile_map_layer.cpp index fd1a638b58..e3abbea43a 100644 --- a/scene/2d/tile_map_layer.cpp +++ b/scene/2d/tile_map_layer.cpp @@ -1598,11 +1598,11 @@ RBSet<TerrainConstraint> TileMapLayer::_get_terrain_constraints_from_painted_cel void TileMapLayer::_tile_set_changed() { dirty.flags[DIRTY_FLAGS_TILE_SET] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::_renamed() { - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::_update_notify_local_transform() { @@ -1805,7 +1805,7 @@ void TileMapLayer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "navigation_enabled"), "set_navigation_enabled", "is_navigation_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_visibility_mode", PROPERTY_HINT_ENUM, "Default,Force Show,Force Hide"), "set_navigation_visibility_mode", "get_navigation_visibility_mode"); - ADD_SIGNAL(MethodInfo(CoreStringNames::get_singleton()->changed)); + ADD_SIGNAL(MethodInfo(CoreStringName(changed))); ADD_PROPERTY_DEFAULT("tile_map_data_format", TileMapDataFormat::TILE_MAP_DATA_FORMAT_1); @@ -1819,7 +1819,7 @@ void TileMapLayer::_update_self_texture_filter(RS::CanvasItemTextureFilter p_tex CanvasItem::_update_self_texture_filter(p_texture_filter); dirty.flags[DIRTY_FLAGS_LAYER_TEXTURE_FILTER] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::_update_self_texture_repeat(RS::CanvasItemTextureRepeat p_texture_repeat) { @@ -1827,7 +1827,7 @@ void TileMapLayer::_update_self_texture_repeat(RS::CanvasItemTextureRepeat p_tex CanvasItem::_update_self_texture_repeat(p_texture_repeat); dirty.flags[DIRTY_FLAGS_LAYER_TEXTURE_REPEAT] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::set_as_tile_map_internal_node(int p_index) { @@ -2502,7 +2502,7 @@ void TileMapLayer::update_internals() { void TileMapLayer::notify_runtime_tile_data_update() { dirty.flags[TileMapLayer::DIRTY_FLAGS_LAYER_RUNTIME_UPDATE] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } Vector2i TileMapLayer::map_pattern(const Vector2i &p_position_in_tilemap, const Vector2i &p_coords_in_pattern, Ref<TileMapPattern> p_pattern) { @@ -2537,7 +2537,7 @@ void TileMapLayer::set_enabled(bool p_enabled) { enabled = p_enabled; dirty.flags[DIRTY_FLAGS_LAYER_ENABLED] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } bool TileMapLayer::is_enabled() const { @@ -2563,7 +2563,7 @@ void TileMapLayer::set_tile_set(const Ref<TileSet> &p_tile_set) { tile_set->connect_changed(callable_mp(this, &TileMapLayer::_tile_set_changed)); } - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); // Trigger updates for TileSet's read-only status. notify_property_list_changed(); @@ -2675,7 +2675,7 @@ void TileMapLayer::set_self_modulate(const Color &p_self_modulate) { CanvasItem::set_self_modulate(p_self_modulate); dirty.flags[DIRTY_FLAGS_LAYER_SELF_MODULATE] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::set_y_sort_enabled(bool p_y_sort_enabled) { @@ -2685,7 +2685,7 @@ void TileMapLayer::set_y_sort_enabled(bool p_y_sort_enabled) { CanvasItem::set_y_sort_enabled(p_y_sort_enabled); dirty.flags[DIRTY_FLAGS_LAYER_Y_SORT_ENABLED] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); _update_notify_local_transform(); } @@ -2697,7 +2697,7 @@ void TileMapLayer::set_y_sort_origin(int p_y_sort_origin) { y_sort_origin = p_y_sort_origin; dirty.flags[DIRTY_FLAGS_LAYER_Y_SORT_ORIGIN] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } int TileMapLayer::get_y_sort_origin() const { @@ -2711,7 +2711,7 @@ void TileMapLayer::set_z_index(int p_z_index) { CanvasItem::set_z_index(p_z_index); dirty.flags[DIRTY_FLAGS_LAYER_Z_INDEX] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::set_light_mask(int p_light_mask) { @@ -2721,7 +2721,7 @@ void TileMapLayer::set_light_mask(int p_light_mask) { CanvasItem::set_light_mask(p_light_mask); dirty.flags[DIRTY_FLAGS_LAYER_LIGHT_MASK] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } void TileMapLayer::set_rendering_quadrant_size(int p_size) { @@ -2733,7 +2733,7 @@ void TileMapLayer::set_rendering_quadrant_size(int p_size) { rendering_quadrant_size = p_size; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } int TileMapLayer::get_rendering_quadrant_size() const { @@ -2747,7 +2747,7 @@ void TileMapLayer::set_collision_enabled(bool p_enabled) { collision_enabled = p_enabled; dirty.flags[DIRTY_FLAGS_LAYER_COLLISION_ENABLED] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } bool TileMapLayer::is_collision_enabled() const { @@ -2758,7 +2758,7 @@ void TileMapLayer::set_use_kinematic_bodies(bool p_use_kinematic_bodies) { use_kinematic_bodies = p_use_kinematic_bodies; dirty.flags[DIRTY_FLAGS_LAYER_USE_KINEMATIC_BODIES] = p_use_kinematic_bodies; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } bool TileMapLayer::is_using_kinematic_bodies() const { @@ -2772,7 +2772,7 @@ void TileMapLayer::set_collision_visibility_mode(TileMapLayer::DebugVisibilityMo collision_visibility_mode = p_show_collision; dirty.flags[DIRTY_FLAGS_LAYER_COLLISION_VISIBILITY_MODE] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } TileMapLayer::DebugVisibilityMode TileMapLayer::get_collision_visibility_mode() const { @@ -2786,7 +2786,7 @@ void TileMapLayer::set_navigation_enabled(bool p_enabled) { navigation_enabled = p_enabled; dirty.flags[DIRTY_FLAGS_LAYER_NAVIGATION_ENABLED] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } bool TileMapLayer::is_navigation_enabled() const { @@ -2800,7 +2800,7 @@ void TileMapLayer::set_navigation_map(RID p_map) { navigation_map_override = p_map; dirty.flags[DIRTY_FLAGS_LAYER_NAVIGATION_MAP] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } RID TileMapLayer::get_navigation_map() const { @@ -2819,7 +2819,7 @@ void TileMapLayer::set_navigation_visibility_mode(TileMapLayer::DebugVisibilityM navigation_visibility_mode = p_show_navigation; dirty.flags[DIRTY_FLAGS_LAYER_NAVIGATION_VISIBILITY_MODE] = true; _queue_internal_update(); - emit_signal(CoreStringNames::get_singleton()->changed); + emit_signal(CoreStringName(changed)); } TileMapLayer::DebugVisibilityMode TileMapLayer::get_navigation_visibility_mode() const { diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 5ed7fadb2a..b7a47e8723 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -38,11 +38,11 @@ void TouchScreenButton::set_texture_normal(const Ref<Texture2D> &p_texture) { return; } if (texture_normal.is_valid()) { - texture_normal->disconnect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + texture_normal->disconnect(SceneStringName(changed), callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } texture_normal = p_texture; if (texture_normal.is_valid()) { - texture_normal->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); + texture_normal->connect(SceneStringName(changed), callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); } queue_redraw(); } @@ -56,11 +56,11 @@ void TouchScreenButton::set_texture_pressed(const Ref<Texture2D> &p_texture_pres return; } if (texture_pressed.is_valid()) { - texture_pressed->disconnect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + texture_pressed->disconnect(SceneStringName(changed), callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } texture_pressed = p_texture_pressed; if (texture_pressed.is_valid()) { - texture_pressed->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); + texture_pressed->connect(SceneStringName(changed), callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED); } queue_redraw(); } diff --git a/scene/2d/visible_on_screen_notifier_2d.cpp b/scene/2d/visible_on_screen_notifier_2d.cpp index 89b2c20b20..fd0f3a461e 100644 --- a/scene/2d/visible_on_screen_notifier_2d.cpp +++ b/scene/2d/visible_on_screen_notifier_2d.cpp @@ -48,7 +48,7 @@ void VisibleOnScreenNotifier2D::_visibility_enter() { } on_screen = true; - emit_signal(SceneStringNames::get_singleton()->screen_entered); + emit_signal(SceneStringName(screen_entered)); _screen_enter(); } void VisibleOnScreenNotifier2D::_visibility_exit() { @@ -57,7 +57,7 @@ void VisibleOnScreenNotifier2D::_visibility_exit() { } on_screen = false; - emit_signal(SceneStringNames::get_singleton()->screen_exited); + emit_signal(SceneStringName(screen_exited)); _screen_exit(); } diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 5aa50a4a21..71b96fc8ce 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -1156,7 +1156,7 @@ void CPUParticles3D::_particles_process(double p_delta) { } if (!Math::is_equal_approx(time, 0.0) && active && !should_be_active) { active = false; - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringName(finished)); } } diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 16813b9017..865d91e4cc 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -478,7 +478,7 @@ void GPUParticles3D::_notification(int p_what) { } if (time > active_time) { if (active && !signal_canceled) { - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringName(finished)); } active = false; if (!emitting) { diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index 98a5134283..9bc5dc09df 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -193,12 +193,12 @@ void Node3D::_notification(int p_what) { ERR_FAIL_NULL(data.viewport); if (get_script_instance()) { - get_script_instance()->call(SceneStringNames::get_singleton()->_enter_world); + get_script_instance()->call(SceneStringName(_enter_world)); } #ifdef TOOLS_ENABLED if (is_part_of_edited_scene()) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringNames::get_singleton()->_spatial_editor_group, SNAME("_request_gizmo_for_id"), get_instance_id()); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id()); } #endif } break; @@ -211,7 +211,7 @@ void Node3D::_notification(int p_what) { #endif if (get_script_instance()) { - get_script_instance()->call(SceneStringNames::get_singleton()->_exit_world); + get_script_instance()->call(SceneStringName(_exit_world)); } data.viewport = nullptr; @@ -564,7 +564,7 @@ void Node3D::update_gizmos() { } if (data.gizmos.is_empty()) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringNames::get_singleton()->_spatial_editor_group, SNAME("_request_gizmo_for_id"), get_instance_id()); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id()); return; } if (data.gizmos_dirty) { @@ -583,7 +583,7 @@ void Node3D::set_subgizmo_selection(Ref<Node3DGizmo> p_gizmo, int p_id, Transfor } if (is_part_of_edited_scene()) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_set_subgizmo_selection, this, p_gizmo, p_id, p_transform); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SceneStringName(_set_subgizmo_selection), this, p_gizmo, p_id, p_transform); } #endif } @@ -600,7 +600,7 @@ void Node3D::clear_subgizmo_selection() { } if (is_part_of_edited_scene()) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_clear_subgizmo_selection, this); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SceneStringName(_clear_subgizmo_selection), this); } #endif } @@ -777,7 +777,7 @@ Ref<World3D> Node3D::get_world_3d() const { void Node3D::_propagate_visibility_changed() { notification(NOTIFICATION_VISIBILITY_CHANGED); - emit_signal(SceneStringNames::get_singleton()->visibility_changed); + emit_signal(SceneStringName(visibility_changed)); #ifdef TOOLS_ENABLED if (!data.gizmos.is_empty()) { diff --git a/scene/3d/physics/area_3d.cpp b/scene/3d/physics/area_3d.cpp index 014c33cad0..8cb316a2fe 100644 --- a/scene/3d/physics/area_3d.cpp +++ b/scene/3d/physics/area_3d.cpp @@ -199,9 +199,9 @@ void Area3D::_body_enter_tree(ObjectID p_id) { ERR_FAIL_COND(E->value.in_tree); E->value.in_tree = true; - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_entered), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); } } @@ -213,9 +213,9 @@ void Area3D::_body_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->value.in_tree); E->value.in_tree = false; - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_exited), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].area_shape); } } @@ -229,9 +229,9 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i locked = true; // Emit the appropriate signals. if (body_in) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, (Node *)nullptr, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, (Node *)nullptr, p_body_shape, p_area_shape); } else { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, (Node *)nullptr, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, (Node *)nullptr, p_body_shape, p_area_shape); } locked = false; unlock_callback(); @@ -257,10 +257,10 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i E->value.rc = 0; E->value.in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_body_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_body_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_body_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_body_exit_tree).bind(objid)); if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); } } } @@ -270,7 +270,7 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i } if (!node || E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, node, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, node, p_body_shape, p_area_shape); } } else { @@ -284,15 +284,15 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i if (E->value.rc == 0) { body_map.remove(E); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_body_exit_tree)); if (in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_exited, obj); + emit_signal(SceneStringName(body_exited), obj); } } } if (!node || in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, obj, p_body_shape, p_area_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, obj, p_body_shape, p_area_shape); } } @@ -317,18 +317,18 @@ void Area3D::_clear_monitoring() { } //ERR_CONTINUE(!node); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_body_exit_tree)); if (!E.value.in_tree) { continue; } for (int i = 0; i < E.value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E.value.rid, node, E.value.shapes[i].body_shape, E.value.shapes[i].area_shape); + emit_signal(SceneStringName(body_shape_exited), E.value.rid, node, E.value.shapes[i].body_shape, E.value.shapes[i].area_shape); } - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); } } @@ -346,18 +346,18 @@ void Area3D::_clear_monitoring() { } //ERR_CONTINUE(!node); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_area_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_area_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_area_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_area_exit_tree)); if (!E.value.in_tree) { continue; } for (int i = 0; i < E.value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, E.value.rid, node, E.value.shapes[i].area_shape, E.value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_exited), E.value.rid, node, E.value.shapes[i].area_shape, E.value.shapes[i].self_shape); } - emit_signal(SceneStringNames::get_singleton()->area_exited, obj); + emit_signal(SceneStringName(area_exited), obj); } } } @@ -405,9 +405,9 @@ void Area3D::_area_enter_tree(ObjectID p_id) { ERR_FAIL_COND(E->value.in_tree); E->value.in_tree = true; - emit_signal(SceneStringNames::get_singleton()->area_entered, node); + emit_signal(SceneStringName(area_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_entered), E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); } } @@ -419,9 +419,9 @@ void Area3D::_area_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->value.in_tree); E->value.in_tree = false; - emit_signal(SceneStringNames::get_singleton()->area_exited, node); + emit_signal(SceneStringName(area_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); + emit_signal(SceneStringName(area_shape_exited), E->value.rid, node, E->value.shapes[i].area_shape, E->value.shapes[i].self_shape); } } @@ -435,9 +435,9 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i locked = true; // Emit the appropriate signals. if (area_in) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, p_area, (Node *)nullptr, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_entered), p_area, (Node *)nullptr, p_area_shape, p_self_shape); } else { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, p_area, (Node *)nullptr, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_exited), p_area, (Node *)nullptr, p_area_shape, p_self_shape); } locked = false; unlock_callback(); @@ -463,10 +463,10 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i E->value.rc = 0; E->value.in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_area_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_area_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_area_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_area_exit_tree).bind(objid)); if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_entered, node); + emit_signal(SceneStringName(area_entered), node); } } } @@ -476,7 +476,7 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i } if (!node || E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_shape_entered, p_area, node, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_entered), p_area, node, p_area_shape, p_self_shape); } } else { @@ -490,15 +490,15 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i if (E->value.rc == 0) { area_map.remove(E); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_area_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_area_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &Area3D::_area_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Area3D::_area_exit_tree)); if (in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_exited, obj); + emit_signal(SceneStringName(area_exited), obj); } } } if (!node || in_tree) { - emit_signal(SceneStringNames::get_singleton()->area_shape_exited, p_area, obj, p_area_shape, p_self_shape); + emit_signal(SceneStringName(area_shape_exited), p_area, obj, p_area_shape, p_self_shape); } } @@ -605,7 +605,7 @@ StringName Area3D::get_audio_bus_name() const { return audio_bus; } } - return SceneStringNames::get_singleton()->Master; + return SceneStringName(Master); } void Area3D::set_use_reverb_bus(bool p_enable) { @@ -626,7 +626,7 @@ StringName Area3D::get_reverb_bus_name() const { return reverb_bus; } } - return SceneStringNames::get_singleton()->Master; + return SceneStringName(Master); } void Area3D::set_reverb_amount(float p_amount) { @@ -812,6 +812,8 @@ void Area3D::_bind_methods() { Area3D::Area3D() : CollisionObject3D(PhysicsServer3D::get_singleton()->area_create(), true) { + audio_bus = SceneStringName(Master); + reverb_bus = SceneStringName(Master); set_gravity(9.8); set_gravity_direction(Vector3(0, -1, 0)); set_monitoring(true); diff --git a/scene/3d/physics/area_3d.h b/scene/3d/physics/area_3d.h index 41382b6128..bb3694dff3 100644 --- a/scene/3d/physics/area_3d.h +++ b/scene/3d/physics/area_3d.h @@ -135,10 +135,10 @@ private: void _clear_monitoring(); bool audio_bus_override = false; - StringName audio_bus = SceneStringNames::get_singleton()->Master; + StringName audio_bus; bool use_reverb_bus = false; - StringName reverb_bus = SceneStringNames::get_singleton()->Master; + StringName reverb_bus; float reverb_amount = 0.0; float reverb_uniformity = 0.0; diff --git a/scene/3d/physics/collision_object_3d.cpp b/scene/3d/physics/collision_object_3d.cpp index 54752b1281..324620df4f 100644 --- a/scene/3d/physics/collision_object_3d.cpp +++ b/scene/3d/physics/collision_object_3d.cpp @@ -291,17 +291,17 @@ void CollisionObject3D::_apply_enabled() { void CollisionObject3D::_input_event_call(Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) { GDVIRTUAL_CALL(_input_event, p_camera, p_input_event, p_pos, p_normal, p_shape); - emit_signal(SceneStringNames::get_singleton()->input_event, p_camera, p_input_event, p_pos, p_normal, p_shape); + emit_signal(SceneStringName(input_event), p_camera, p_input_event, p_pos, p_normal, p_shape); } void CollisionObject3D::_mouse_enter() { GDVIRTUAL_CALL(_mouse_enter); - emit_signal(SceneStringNames::get_singleton()->mouse_entered); + emit_signal(SceneStringName(mouse_entered)); } void CollisionObject3D::_mouse_exit() { GDVIRTUAL_CALL(_mouse_exit); - emit_signal(SceneStringNames::get_singleton()->mouse_exited); + emit_signal(SceneStringName(mouse_exited)); } void CollisionObject3D::set_body_mode(PhysicsServer3D::BodyMode p_mode) { diff --git a/scene/3d/physics/joints/joint_3d.cpp b/scene/3d/physics/joints/joint_3d.cpp index a9c2526bd0..dac52a4dd8 100644 --- a/scene/3d/physics/joints/joint_3d.cpp +++ b/scene/3d/physics/joints/joint_3d.cpp @@ -36,13 +36,13 @@ void Joint3D::_disconnect_signals() { Node *node_a = get_node_or_null(a); PhysicsBody3D *body_a = Object::cast_to<PhysicsBody3D>(node_a); if (body_a) { - body_a->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree)); + body_a->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Joint3D::_body_exit_tree)); } Node *node_b = get_node_or_null(b); PhysicsBody3D *body_b = Object::cast_to<PhysicsBody3D>(node_b); if (body_b) { - body_b->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree)); + body_b->disconnect(SceneStringName(tree_exiting), callable_mp(this, &Joint3D::_body_exit_tree)); } } @@ -108,12 +108,12 @@ void Joint3D::_update_joint(bool p_only_free) { if (body_a) { ba = body_a->get_rid(); - body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree)); + body_a->connect(SceneStringName(tree_exiting), callable_mp(this, &Joint3D::_body_exit_tree)); } if (body_b) { bb = body_b->get_rid(); - body_b->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree)); + body_b->connect(SceneStringName(tree_exiting), callable_mp(this, &Joint3D::_body_exit_tree)); } PhysicsServer3D::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision); diff --git a/scene/3d/physics/rigid_body_3d.cpp b/scene/3d/physics/rigid_body_3d.cpp index 6cd621c1c7..a06680767c 100644 --- a/scene/3d/physics/rigid_body_3d.cpp +++ b/scene/3d/physics/rigid_body_3d.cpp @@ -45,10 +45,10 @@ void RigidBody3D::_body_enter_tree(ObjectID p_id) { contact_monitor->locked = true; - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); + emit_signal(SceneStringName(body_shape_entered), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); } contact_monitor->locked = false; @@ -66,10 +66,10 @@ void RigidBody3D::_body_exit_tree(ObjectID p_id) { contact_monitor->locked = true; - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); for (int i = 0; i < E->value.shapes.size(); i++) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); + emit_signal(SceneStringName(body_shape_exited), E->value.rid, node, E->value.shapes[i].body_shape, E->value.shapes[i].local_shape); } contact_monitor->locked = false; @@ -94,10 +94,10 @@ void RigidBody3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan //E->value.rc=0; E->value.in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody3D::_body_enter_tree).bind(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody3D::_body_exit_tree).bind(objid)); + node->connect(SceneStringName(tree_entered), callable_mp(this, &RigidBody3D::_body_enter_tree).bind(objid)); + node->connect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody3D::_body_exit_tree).bind(objid)); if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_entered, node); + emit_signal(SceneStringName(body_entered), node); } } } @@ -107,7 +107,7 @@ void RigidBody3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan } if (E->value.in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_entered, p_body, node, p_body_shape, p_local_shape); + emit_signal(SceneStringName(body_shape_entered), p_body, node, p_body_shape, p_local_shape); } } else { @@ -121,17 +121,17 @@ void RigidBody3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instan if (E->value.shapes.is_empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody3D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody3D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &RigidBody3D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody3D::_body_exit_tree)); if (in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_exited, node); + emit_signal(SceneStringName(body_exited), node); } } contact_monitor->body_map.remove(E); } if (node && in_tree) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, p_body, obj, p_body_shape, p_local_shape); + emit_signal(SceneStringName(body_shape_exited), p_body, obj, p_body_shape, p_local_shape); } } } @@ -157,7 +157,7 @@ void RigidBody3D::_sync_body_state(PhysicsDirectBodyState3D *p_state) { if (sleeping != p_state->is_sleeping()) { sleeping = p_state->is_sleeping(); - emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); + emit_signal(SceneStringName(sleeping_state_changed)); } } @@ -613,8 +613,8 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) { Node *node = Object::cast_to<Node>(obj); if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &RigidBody3D::_body_enter_tree)); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &RigidBody3D::_body_exit_tree)); + node->disconnect(SceneStringName(tree_entered), callable_mp(this, &RigidBody3D::_body_enter_tree)); + node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &RigidBody3D::_body_exit_tree)); } } diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 72b5b53b19..cd0aafbf29 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -314,7 +314,7 @@ void Skeleton3D::_notification(int p_what) { _process_modifiers(); } - emit_signal(SceneStringNames::get_singleton()->skeleton_updated); + emit_signal(SceneStringName(skeleton_updated)); // Update skins. RenderingServer *rs = RenderingServer::get_singleton(); @@ -605,7 +605,7 @@ void Skeleton3D::set_bone_enabled(int p_bone, bool p_enabled) { ERR_FAIL_INDEX(p_bone, bone_size); bones.write[p_bone].enabled = p_enabled; - emit_signal(SceneStringNames::get_singleton()->bone_enabled_changed, p_bone); + emit_signal(SceneStringName(bone_enabled_changed), p_bone); _make_dirty(); } @@ -617,7 +617,7 @@ bool Skeleton3D::is_bone_enabled(int p_bone) const { void Skeleton3D::set_show_rest_only(bool p_enabled) { show_rest_only = p_enabled; - emit_signal(SceneStringNames::get_singleton()->show_rest_only_changed); + emit_signal(SceneStringName(show_rest_only_changed)); _make_dirty(); } @@ -840,7 +840,7 @@ void Skeleton3D::force_update_all_bone_transforms() { if (updating) { return; } - emit_signal(SceneStringNames::get_singleton()->pose_updated); + emit_signal(SceneStringName(pose_updated)); } void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 7d2a821d16..6ccb0ee134 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -796,15 +796,15 @@ void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) { return; } if (texture.is_valid()) { - texture->disconnect(SceneStringNames::get_singleton()->changed, callable_mp((SpriteBase3D *)this, &Sprite3D::_queue_redraw)); + texture->disconnect(SceneStringName(changed), callable_mp((SpriteBase3D *)this, &Sprite3D::_queue_redraw)); } texture = p_texture; if (texture.is_valid()) { - texture->connect(SceneStringNames::get_singleton()->changed, callable_mp((SpriteBase3D *)this, &Sprite3D::_queue_redraw)); + texture->connect(SceneStringName(changed), callable_mp((SpriteBase3D *)this, &Sprite3D::_queue_redraw)); } _queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->texture_changed); + emit_signal(SceneStringName(texture_changed)); } Ref<Texture2D> Sprite3D::get_texture() const { @@ -849,7 +849,7 @@ void Sprite3D::set_frame(int p_frame) { frame = p_frame; _queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } int Sprite3D::get_frame() const { @@ -1122,7 +1122,7 @@ void AnimatedSprite3D::_notification(int p_what) { } else { frame = last_frame; pause(); - emit_signal(SceneStringNames::get_singleton()->animation_finished); + emit_signal(SceneStringName(animation_finished)); return; } } else { @@ -1131,7 +1131,7 @@ void AnimatedSprite3D::_notification(int p_what) { _calc_frame_speed_scale(); frame_progress = 0.0; _queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining); frame_progress += to_process * abs_speed; @@ -1146,7 +1146,7 @@ void AnimatedSprite3D::_notification(int p_what) { } else { frame = 0; pause(); - emit_signal(SceneStringNames::get_singleton()->animation_finished); + emit_signal(SceneStringName(animation_finished)); return; } } else { @@ -1155,7 +1155,7 @@ void AnimatedSprite3D::_notification(int p_what) { _calc_frame_speed_scale(); frame_progress = 1.0; _queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } double to_process = MIN(frame_progress / abs_speed, remaining); frame_progress -= to_process * abs_speed; @@ -1177,12 +1177,12 @@ void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) { } if (frames.is_valid()) { - frames->disconnect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite3D::_res_changed)); + frames->disconnect(SceneStringName(changed), callable_mp(this, &AnimatedSprite3D::_res_changed)); } stop(); frames = p_frames; if (frames.is_valid()) { - frames->connect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite3D::_res_changed)); + frames->connect(SceneStringName(changed), callable_mp(this, &AnimatedSprite3D::_res_changed)); List<StringName> al; frames->get_animation_list(&al); @@ -1249,7 +1249,7 @@ void AnimatedSprite3D::set_frame_and_progress(int p_frame, real_t p_progress) { return; // No change, don't redraw. } _queue_redraw(); - emit_signal(SceneStringNames::get_singleton()->frame_changed); + emit_signal(SceneStringName(frame_changed)); } void AnimatedSprite3D::set_speed_scale(float p_speed_scale) { diff --git a/scene/3d/visible_on_screen_notifier_3d.cpp b/scene/3d/visible_on_screen_notifier_3d.cpp index 272852e8fa..36a1771b96 100644 --- a/scene/3d/visible_on_screen_notifier_3d.cpp +++ b/scene/3d/visible_on_screen_notifier_3d.cpp @@ -38,7 +38,7 @@ void VisibleOnScreenNotifier3D::_visibility_enter() { } on_screen = true; - emit_signal(SceneStringNames::get_singleton()->screen_entered); + emit_signal(SceneStringName(screen_entered)); _screen_enter(); } void VisibleOnScreenNotifier3D::_visibility_exit() { @@ -47,7 +47,7 @@ void VisibleOnScreenNotifier3D::_visibility_exit() { } on_screen = false; - emit_signal(SceneStringNames::get_singleton()->screen_exited); + emit_signal(SceneStringName(screen_exited)); _screen_exit(); } diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index e0dc300a6b..84ae8f1f4f 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -169,11 +169,11 @@ VisualInstance3D::~VisualInstance3D() { void GeometryInstance3D::set_material_override(const Ref<Material> &p_material) { if (material_override.is_valid()) { - material_override->disconnect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + material_override->disconnect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } material_override = p_material; if (material_override.is_valid()) { - material_override->connect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + material_override->connect(CoreStringName(property_list_changed), callable_mp((Object *)this, &Object::notify_property_list_changed)); } RS::get_singleton()->instance_geometry_set_material_override(get_instance(), p_material.is_valid() ? p_material->get_rid() : RID()); } @@ -279,12 +279,12 @@ bool GeometryInstance3D::_set(const StringName &p_name, const Variant &p_value) return true; } #ifndef DISABLE_DEPRECATED - if (p_name == SceneStringNames::get_singleton()->use_in_baked_light && bool(p_value)) { + if (p_name == SceneStringName(use_in_baked_light) && bool(p_value)) { set_gi_mode(GI_MODE_STATIC); return true; } - if (p_name == SceneStringNames::get_singleton()->use_dynamic_gi && bool(p_value)) { + if (p_name == SceneStringName(use_dynamic_gi) && bool(p_value)) { set_gi_mode(GI_MODE_DYNAMIC); return true; } diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index f3385b4cdc..ab9cb61044 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -1421,7 +1421,7 @@ AnimationNodeOutput::AnimationNodeOutput() { void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNode> p_node, const Vector2 &p_position) { ERR_FAIL_COND(nodes.has(p_name)); ERR_FAIL_COND(p_node.is_null()); - ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); + ERR_FAIL_COND(p_name == SceneStringName(output)); ERR_FAIL_COND(String(p_name).contains("/")); Node n; @@ -1491,7 +1491,7 @@ Vector<StringName> AnimationNodeBlendTree::get_node_connection_array(const Strin void AnimationNodeBlendTree::remove_node(const StringName &p_name) { ERR_FAIL_COND(!nodes.has(p_name)); - ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); //can't delete output + ERR_FAIL_COND(p_name == SceneStringName(output)); //can't delete output { Ref<AnimationNode> node = nodes[p_name].node; @@ -1520,8 +1520,8 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) { void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringName &p_new_name) { ERR_FAIL_COND(!nodes.has(p_name)); ERR_FAIL_COND(nodes.has(p_new_name)); - ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); - ERR_FAIL_COND(p_new_name == SceneStringNames::get_singleton()->output); + ERR_FAIL_COND(p_name == SceneStringName(output)); + ERR_FAIL_COND(p_new_name == SceneStringName(output)); nodes[p_name].node->disconnect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed)); @@ -1546,7 +1546,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN void AnimationNodeBlendTree::connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) { ERR_FAIL_COND(!nodes.has(p_output_node)); ERR_FAIL_COND(!nodes.has(p_input_node)); - ERR_FAIL_COND(p_output_node == SceneStringNames::get_singleton()->output); + ERR_FAIL_COND(p_output_node == SceneStringName(output)); ERR_FAIL_COND(p_input_node == p_output_node); Ref<AnimationNode> input = nodes[p_input_node].node; @@ -1574,7 +1574,7 @@ void AnimationNodeBlendTree::disconnect_node(const StringName &p_node, int p_inp } AnimationNodeBlendTree::ConnectionError AnimationNodeBlendTree::can_connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) const { - if (!nodes.has(p_output_node) || p_output_node == SceneStringNames::get_singleton()->output) { + if (!nodes.has(p_output_node) || p_output_node == SceneStringName(output)) { return CONNECTION_ERROR_NO_OUTPUT; } @@ -1627,8 +1627,8 @@ String AnimationNodeBlendTree::get_caption() const { } AnimationNode::NodeTimeInfo AnimationNodeBlendTree::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) { - Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node; - node_state.connections = nodes[SceneStringNames::get_singleton()->output].connections; + Ref<AnimationNodeOutput> output = nodes[SceneStringName(output)].node; + node_state.connections = nodes[SceneStringName(output)].connections; ERR_FAIL_COND_V(output.is_null(), NodeTimeInfo()); AnimationMixer::PlaybackInfo pi = p_playback_info; diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index d22b58346f..1671192fd9 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -628,9 +628,9 @@ bool AnimationMixer::_update_caches() { #endif Ref<Animation> reset_anim; - bool has_reset_anim = has_animation(SceneStringNames::get_singleton()->RESET); + bool has_reset_anim = has_animation(SceneStringName(RESET)); if (has_reset_anim) { - reset_anim = get_animation(SceneStringNames::get_singleton()->RESET); + reset_anim = get_animation(SceneStringName(RESET)); } for (const StringName &E : sname) { Ref<Animation> anim = get_animation(E); @@ -1926,7 +1926,7 @@ bool AnimationMixer::is_reset_on_save_enabled() const { } bool AnimationMixer::can_apply_reset() const { - return has_animation(SceneStringNames::get_singleton()->RESET); + return has_animation(SceneStringName(RESET)); } void AnimationMixer::_build_backup_track_cache() { @@ -2013,7 +2013,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() { Ref<AnimatedValuesBackup> backup; backup.instantiate(); - Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation; + Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation; ERR_FAIL_COND_V(reset_anim.is_null(), Ref<AnimatedValuesBackup>()); _blend_init(); @@ -2022,7 +2022,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() { pi.delta = 0; pi.seeked = true; pi.weight = 1.0; - make_animation_instance(SceneStringNames::get_singleton()->RESET, pi); + make_animation_instance(SceneStringName(RESET), pi); _build_backup_track_cache(); backup->set_data(track_cache); @@ -2034,7 +2034,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() { void AnimationMixer::reset() { ERR_FAIL_COND(!can_apply_reset()); - Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation; + Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation; ERR_FAIL_COND(reset_anim.is_null()); Node *root_node_object = get_node_or_null(root_node); @@ -2044,11 +2044,11 @@ void AnimationMixer::reset() { root_node_object->add_child(aux_player); Ref<AnimationLibrary> al; al.instantiate(); - al->add_animation(SceneStringNames::get_singleton()->RESET, reset_anim); + al->add_animation(SceneStringName(RESET), reset_anim); aux_player->set_reset_on_save_enabled(false); aux_player->set_root_node(aux_player->get_path_to(root_node_object)); aux_player->add_animation_library("", al); - aux_player->set_assigned_animation(SceneStringNames::get_singleton()->RESET); + aux_player->set_assigned_animation(SceneStringName(RESET)); aux_player->seek(0.0f, true); aux_player->queue_free(); } @@ -2068,7 +2068,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::apply_reset(bool p_user_initiated) { } ERR_FAIL_COND_V(!can_apply_reset(), Ref<AnimatedValuesBackup>()); - Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation; + Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation; ERR_FAIL_COND_V(reset_anim.is_null(), Ref<AnimatedValuesBackup>()); Ref<AnimatedValuesBackup> backup_current = make_backup(); @@ -2286,7 +2286,7 @@ void AnimationMixer::_bind_methods() { } AnimationMixer::AnimationMixer() { - root_node = SceneStringNames::get_singleton()->path_pp; + root_node = SceneStringName(path_pp); } AnimationMixer::~AnimationMixer() { diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 2213800476..2b6c9a335d 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -41,7 +41,7 @@ bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) { } else if (name.begins_with("next/")) { String which = name.get_slicec('/', 1); animation_set_next(which, p_value); - } else if (p_name == SceneStringNames::get_singleton()->blend_times) { + } else if (p_name == SceneStringName(blend_times)) { Array array = p_value; int len = array.size(); ERR_FAIL_COND_V(len % 3, false); @@ -326,14 +326,14 @@ void AnimationPlayer::_blend_post_process() { String new_name = playback.assigned; playback_queue.pop_front(); if (end_notify) { - emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name); + emit_signal(SceneStringName(animation_changed), old, new_name); } } else { _clear_caches(); playing = false; _set_process(false); if (end_notify) { - emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned); + emit_signal(SceneStringName(animation_finished), playback.assigned); if (movie_quit_on_finish && OS::get_singleton()->has_feature("movie")) { print_line(vformat("Movie Maker mode is enabled. Quitting on animation finish as requested by: %s", get_path())); get_tree()->quit(); @@ -463,7 +463,7 @@ void AnimationPlayer::_play(const StringName &p_name, double p_custom_blend, flo _set_process(true); // Always process when starting an animation. playing = true; - emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned); + emit_signal(SceneStringName(animation_started), c.assigned); if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) { return; // No next in this case. diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 28a163768f..8fe05d9d1f 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -627,7 +627,7 @@ bool AnimationTree::_blend_pre_process(double p_delta, int p_track_count, const for (int i = 0; i < p_track_count; i++) { src_blendsw[i] = 1.0; // By default all go to 1 for the root input. } - root_animation_node->node_state.base_path = SceneStringNames::get_singleton()->parameters_base_path; + root_animation_node->node_state.base_path = SceneStringName(parameters_base_path); root_animation_node->node_state.parent = nullptr; } @@ -788,7 +788,7 @@ void AnimationTree::_update_properties() { input_activity_map_get.clear(); if (root_animation_node.is_valid()) { - _update_properties_for_node(SceneStringNames::get_singleton()->parameters_base_path, root_animation_node); + _update_properties_for_node(SceneStringName(parameters_base_path), root_animation_node); } properties_dirty = false; @@ -810,7 +810,7 @@ void AnimationTree::_notification(int p_what) { void AnimationTree::set_animation_player(const NodePath &p_path) { animation_player = p_path; if (p_path.is_empty()) { - set_root_node(SceneStringNames::get_singleton()->path_pp); + set_root_node(SceneStringName(path_pp)); while (animation_libraries.size()) { remove_animation_library(animation_libraries[0].name); } diff --git a/scene/audio/audio_stream_player_internal.cpp b/scene/audio/audio_stream_player_internal.cpp index 19b3ec481b..ed3c43818e 100644 --- a/scene/audio/audio_stream_player_internal.cpp +++ b/scene/audio/audio_stream_player_internal.cpp @@ -307,14 +307,14 @@ StringName AudioStreamPlayerInternal::get_bus() const { return bus; } } - return SceneStringNames::get_singleton()->Master; + return SceneStringName(Master); } AudioStreamPlayerInternal::AudioStreamPlayerInternal(Node *p_node, const Callable &p_play_callable, bool p_physical) { node = p_node; play_callable = p_play_callable; physical = p_physical; - bus = SceneStringNames::get_singleton()->Master; + bus = SceneStringName(Master); AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp((Object *)node, &Object::notify_property_list_changed)); AudioServer::get_singleton()->connect("bus_renamed", callable_mp((Object *)node, &Object::notify_property_list_changed).unbind(3)); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 5db8d69eef..625964c5e3 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -86,10 +86,10 @@ void Container::_sort_children() { } notification(NOTIFICATION_PRE_SORT_CHILDREN); - emit_signal(SceneStringNames::get_singleton()->pre_sort_children); + emit_signal(SceneStringName(pre_sort_children)); notification(NOTIFICATION_SORT_CHILDREN); - emit_signal(SceneStringNames::get_singleton()->sort_children); + emit_signal(SceneStringName(sort_children)); pending_sort = false; } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2dd12b92f3..9c27f46467 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1606,7 +1606,7 @@ void Control::_update_minimum_size() { if (minsize != data.last_minimum_size) { data.last_minimum_size = minsize; _size_changed(); - emit_signal(SceneStringNames::get_singleton()->minimum_size_changed); + emit_signal(SceneStringName(minimum_size_changed)); } } @@ -1770,7 +1770,7 @@ void Control::set_h_size_flags(BitField<SizeFlags> p_flags) { return; } data.h_size_flags = p_flags; - emit_signal(SceneStringNames::get_singleton()->size_flags_changed); + emit_signal(SceneStringName(size_flags_changed)); } BitField<Control::SizeFlags> Control::get_h_size_flags() const { @@ -1784,7 +1784,7 @@ void Control::set_v_size_flags(BitField<SizeFlags> p_flags) { return; } data.v_size_flags = p_flags; - emit_signal(SceneStringNames::get_singleton()->size_flags_changed); + emit_signal(SceneStringName(size_flags_changed)); } BitField<Control::SizeFlags> Control::get_v_size_flags() const { @@ -1799,7 +1799,7 @@ void Control::set_stretch_ratio(real_t p_ratio) { } data.expand = p_ratio; - emit_signal(SceneStringNames::get_singleton()->size_flags_changed); + emit_signal(SceneStringName(size_flags_changed)); } real_t Control::get_stretch_ratio() const { @@ -1811,7 +1811,7 @@ real_t Control::get_stretch_ratio() const { void Control::_call_gui_input(const Ref<InputEvent> &p_event) { if (p_event->get_device() != InputEvent::DEVICE_ID_INTERNAL) { - emit_signal(SceneStringNames::get_singleton()->gui_input, p_event); // Signal should be first, so it's possible to override an event (and then accept it). + emit_signal(SceneStringName(gui_input), p_event); // Signal should be first, so it's possible to override an event (and then accept it). } if (!is_inside_tree() || get_viewport()->is_input_handled()) { return; // Input was handled, abort. @@ -3299,7 +3299,7 @@ void Control::_notification(int p_notification) { } break; case NOTIFICATION_RESIZED: { - emit_signal(SceneStringNames::get_singleton()->resized); + emit_signal(SceneStringName(resized)); } break; case NOTIFICATION_DRAW: { @@ -3309,25 +3309,25 @@ void Control::_notification(int p_notification) { } break; case NOTIFICATION_MOUSE_ENTER: { - emit_signal(SceneStringNames::get_singleton()->mouse_entered); + emit_signal(SceneStringName(mouse_entered)); } break; case NOTIFICATION_MOUSE_EXIT: { - emit_signal(SceneStringNames::get_singleton()->mouse_exited); + emit_signal(SceneStringName(mouse_exited)); } break; case NOTIFICATION_FOCUS_ENTER: { - emit_signal(SceneStringNames::get_singleton()->focus_entered); + emit_signal(SceneStringName(focus_entered)); queue_redraw(); } break; case NOTIFICATION_FOCUS_EXIT: { - emit_signal(SceneStringNames::get_singleton()->focus_exited); + emit_signal(SceneStringName(focus_exited)); queue_redraw(); } break; case NOTIFICATION_THEME_CHANGED: { - emit_signal(SceneStringNames::get_singleton()->theme_changed); + emit_signal(SceneStringName(theme_changed)); _invalidate_theme_cache(); _update_theme_item_cache(); diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index e2ae824e60..7ebf8a63c2 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -111,7 +111,7 @@ void NinePatchRect::set_texture(const Ref<Texture2D> &p_tex) { queue_redraw(); update_minimum_size(); - emit_signal(SceneStringNames::get_singleton()->texture_changed); + emit_signal(SceneStringName(texture_changed)); } Ref<Texture2D> NinePatchRect::get_texture() const { diff --git a/scene/gui/video_stream_player.cpp b/scene/gui/video_stream_player.cpp index 687a9e46a0..e581d0b5db 100644 --- a/scene/gui/video_stream_player.cpp +++ b/scene/gui/video_stream_player.cpp @@ -163,7 +163,7 @@ void VideoStreamPlayer::_notification(int p_notification) { play(); return; } - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringName(finished)); } } break; @@ -460,7 +460,7 @@ StringName VideoStreamPlayer::get_bus() const { return bus; } } - return SceneStringNames::get_singleton()->Master; + return SceneStringName(Master); } void VideoStreamPlayer::_validate_property(PropertyInfo &p_property) const { diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index cabba0f2ed..821b670cb0 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -95,7 +95,7 @@ void CanvasItem::_handle_visibility_change(bool p_visible) { if (p_visible) { queue_redraw(); } else { - emit_signal(SceneStringNames::get_singleton()->hidden); + emit_signal(SceneStringName(hidden)); } _block(); @@ -141,7 +141,7 @@ void CanvasItem::_redraw_callback() { drawing = true; current_item_drawn = this; notification(NOTIFICATION_DRAW); - emit_signal(SceneStringNames::get_singleton()->draw); + emit_signal(SceneStringName(draw)); GDVIRTUAL_CALL(_draw); current_item_drawn = nullptr; drawing = false; @@ -309,7 +309,7 @@ void CanvasItem::_notification(int p_what) { window = Object::cast_to<Window>(viewport); if (window) { - window->connect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed)); + window->connect(SceneStringName(visibility_changed), callable_mp(this, &CanvasItem::_window_visibility_changed)); parent_visible_in_tree = window->is_visible(); } else { parent_visible_in_tree = true; @@ -363,7 +363,7 @@ void CanvasItem::_notification(int p_what) { C = nullptr; } if (window) { - window->disconnect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed)); + window->disconnect(SceneStringName(visibility_changed), callable_mp(this, &CanvasItem::_window_visibility_changed)); window = nullptr; } _set_global_invalid(true); @@ -383,7 +383,7 @@ void CanvasItem::_notification(int p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { ERR_MAIN_THREAD_GUARD; - emit_signal(SceneStringNames::get_singleton()->visibility_changed); + emit_signal(SceneStringName(visibility_changed)); } break; case NOTIFICATION_WORLD_2D_CHANGED: { ERR_MAIN_THREAD_GUARD; @@ -555,7 +555,7 @@ void CanvasItem::item_rect_changed(bool p_size_changed) { if (p_size_changed) { queue_redraw(); } - emit_signal(SceneStringNames::get_singleton()->item_rect_changed); + emit_signal(SceneStringName(item_rect_changed)); } void CanvasItem::set_z_index(int p_z) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index e54209c1dd..c326ca77f5 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -266,7 +266,7 @@ void Node::_propagate_ready() { if (data.ready_first) { data.ready_first = false; notification(NOTIFICATION_READY); - emit_signal(SceneStringNames::get_singleton()->ready); + emit_signal(SceneStringName(ready)); } } @@ -295,7 +295,7 @@ void Node::_propagate_enter_tree() { GDVIRTUAL_CALL(_enter_tree); - emit_signal(SceneStringNames::get_singleton()->tree_entered); + emit_signal(SceneStringName(tree_entered)); data.tree->node_added(this); @@ -350,7 +350,7 @@ void Node::_propagate_after_exit_tree() { data.blocked--; - emit_signal(SceneStringNames::get_singleton()->tree_exited); + emit_signal(SceneStringName(tree_exited)); } void Node::_propagate_exit_tree() { @@ -372,7 +372,7 @@ void Node::_propagate_exit_tree() { GDVIRTUAL_CALL(_exit_tree); - emit_signal(SceneStringNames::get_singleton()->tree_exiting); + emit_signal(SceneStringName(tree_exiting)); notification(NOTIFICATION_EXIT_TREE, true); if (data.tree) { @@ -1738,11 +1738,11 @@ Node *Node::get_node_or_null(const NodePath &p_path) const { StringName name = p_path.get_name(i); Node *next = nullptr; - if (name == SceneStringNames::get_singleton()->dot) { // . + if (name == SceneStringName(dot)) { // . next = current; - } else if (name == SceneStringNames::get_singleton()->doubledot) { // .. + } else if (name == SceneStringName(doubledot)) { // .. if (current == nullptr || !current->data.parent) { return nullptr; @@ -2667,7 +2667,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c node->data.editable_instance = data.editable_instance; } - StringName script_property_name = CoreStringNames::get_singleton()->_script; + StringName script_property_name = CoreStringName(script); List<const Node *> hidden_roots; List<const Node *> node_tree; @@ -3323,7 +3323,7 @@ void Node::update_configuration_warnings() { return; } if (get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { - get_tree()->emit_signal(SceneStringNames::get_singleton()->node_configuration_warning_changed, this); + get_tree()->emit_signal(SceneStringName(node_configuration_warning_changed), this); } #endif } diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp index 091e6249bf..372d4c6640 100644 --- a/scene/main/shader_globals_override.cpp +++ b/scene/main/shader_globals_override.cpp @@ -223,11 +223,11 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const void ShaderGlobalsOverride::_activate() { ERR_FAIL_NULL(get_tree()); List<Node *> nodes; - get_tree()->get_nodes_in_group(SceneStringNames::get_singleton()->shader_overrides_group_active, &nodes); + get_tree()->get_nodes_in_group(SceneStringName(shader_overrides_group_active), &nodes); if (nodes.size() == 0) { //good we are the only override, enable all active = true; - add_to_group(SceneStringNames::get_singleton()->shader_overrides_group_active); + add_to_group(SceneStringName(shader_overrides_group_active)); for (const KeyValue<StringName, Override> &E : overrides) { const Override *o = &E.value; @@ -248,7 +248,7 @@ void ShaderGlobalsOverride::_activate() { void ShaderGlobalsOverride::_notification(int p_what) { switch (p_what) { case Node::NOTIFICATION_ENTER_TREE: { - add_to_group(SceneStringNames::get_singleton()->shader_overrides_group); + add_to_group(SceneStringName(shader_overrides_group)); _activate(); } break; @@ -263,9 +263,9 @@ void ShaderGlobalsOverride::_notification(int p_what) { } } - remove_from_group(SceneStringNames::get_singleton()->shader_overrides_group_active); - remove_from_group(SceneStringNames::get_singleton()->shader_overrides_group); - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringNames::get_singleton()->shader_overrides_group, "_activate"); //another may want to activate when this is removed + remove_from_group(SceneStringName(shader_overrides_group_active)); + remove_from_group(SceneStringName(shader_overrides_group)); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(shader_overrides_group), "_activate"); //another may want to activate when this is removed active = false; } break; } diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 929720fcf4..5ec300faee 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -846,7 +846,7 @@ void Window::set_visible(bool p_visible) { focused = false; } notification(NOTIFICATION_VISIBILITY_CHANGED); - emit_signal(SceneStringNames::get_singleton()->visibility_changed); + emit_signal(SceneStringName(visibility_changed)); RS::get_singleton()->viewport_set_active(get_viewport_rid(), visible); @@ -1321,7 +1321,7 @@ void Window::_notification(int p_what) { } if (visible) { notification(NOTIFICATION_VISIBILITY_CHANGED); - emit_signal(SceneStringNames::get_singleton()->visibility_changed); + emit_signal(SceneStringName(visibility_changed)); RS::get_singleton()->viewport_set_active(get_viewport_rid(), true); } @@ -1337,7 +1337,7 @@ void Window::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - emit_signal(SceneStringNames::get_singleton()->theme_changed); + emit_signal(SceneStringName(theme_changed)); _invalidate_theme_cache(); _update_theme_item_cache(); } break; @@ -1404,11 +1404,11 @@ void Window::_notification(int p_what) { } break; case NOTIFICATION_VP_MOUSE_ENTER: { - emit_signal(SceneStringNames::get_singleton()->mouse_entered); + emit_signal(SceneStringName(mouse_entered)); } break; case NOTIFICATION_VP_MOUSE_EXIT: { - emit_signal(SceneStringNames::get_singleton()->mouse_exited); + emit_signal(SceneStringName(mouse_exited)); } break; } } @@ -1622,7 +1622,7 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) { _input_from_window(p_ev); if (p_ev->get_device() != InputEvent::DEVICE_ID_INTERNAL && is_inside_tree()) { - emit_signal(SceneStringNames::get_singleton()->window_input, p_ev); + emit_signal(SceneStringName(window_input), p_ev); } if (is_inside_tree()) { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 407b12d72f..4158b178aa 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -328,7 +328,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { ERR_FAIL_INDEX_V(nprops[j].name, sname_count, nullptr); - if (snames[nprops[j].name] == CoreStringNames::get_singleton()->_script) { + if (snames[nprops[j].name] == CoreStringName(script)) { //work around to avoid old script variables from disappearing, should be the proper fix to: //https://github.com/godotengine/godot/issues/2958 diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp index 42ffa2d25a..6e43ea9b17 100644 --- a/scene/resources/sprite_frames.cpp +++ b/scene/resources/sprite_frames.cpp @@ -277,5 +277,5 @@ void SpriteFrames::_bind_methods() { } SpriteFrames::SpriteFrames() { - add_animation(SceneStringNames::get_singleton()->_default); + add_animation(SceneStringName(default_)); } diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 5610b2f642..d40cb9ab6c 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -196,7 +196,7 @@ SceneStringNames::SceneStringNames() { // Audio bus name. Master = StaticCString::create("Master"); - _default = StaticCString::create("default"); + default_ = StaticCString::create("default"); _window_group = StaticCString::create("_window_group"); _window_input = StaticCString::create("_window_input"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 60254e3006..0e3a2a403e 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -198,7 +198,7 @@ public: NodePath path_pp; - StringName _default; + StringName default_; // "default", conflict with C++ keyword. StringName node_configuration_warning_changed; @@ -224,4 +224,6 @@ public: #endif }; +#define SceneStringName(m_name) SceneStringNames::get_singleton()->m_name + #endif // SCENE_STRING_NAMES_H diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 820e0bbeb6..d37836ed96 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -762,7 +762,7 @@ void AudioServer::set_bus_count(int p_count) { buses[i]->bypass = false; buses[i]->volume_db = 0; if (i > 0) { - buses[i]->send = SceneStringNames::get_singleton()->Master; + buses[i]->send = SceneStringName(Master); } bus_map[attempt] = buses[i]; @@ -1600,7 +1600,7 @@ void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout) { for (int i = 0; i < p_bus_layout->buses.size(); i++) { Bus *bus = memnew(Bus); if (i == 0) { - bus->name = SceneStringNames::get_singleton()->Master; + bus->name = SceneStringName(Master); } else { bus->name = p_bus_layout->buses[i].name; bus->send = p_bus_layout->buses[i].send; @@ -1923,5 +1923,5 @@ void AudioBusLayout::_get_property_list(List<PropertyInfo> *p_list) const { AudioBusLayout::AudioBusLayout() { buses.resize(1); - buses.write[0].name = SceneStringNames::get_singleton()->Master; + buses.write[0].name = SceneStringName(Master); } diff --git a/tests/core/object/test_object.h b/tests/core/object/test_object.h index d714d71416..2a629642d4 100644 --- a/tests/core/object/test_object.h +++ b/tests/core/object/test_object.h @@ -251,7 +251,7 @@ TEST_CASE("[Object] Script property setter") { Variant script; bool valid = false; - object.set(CoreStringNames::get_singleton()->_script, script, &valid); + object.set(CoreStringName(script), script, &valid); CHECK(valid); CHECK_MESSAGE( object.get_script() == script, @@ -264,7 +264,7 @@ TEST_CASE("[Object] Script property getter") { object.set_script(script); bool valid = false; - const Variant &actual_value = object.get(CoreStringNames::get_singleton()->_script, &valid); + const Variant &actual_value = object.get(CoreStringName(script), &valid); CHECK(valid); CHECK_MESSAGE( actual_value == script, |