Merge pull request #79373 from KoBeWi/no_need

Convert some Callables to `callable_mp()`
This commit is contained in:
Yuri Sizov 2023-07-14 18:49:53 +02:00
commit 177768a7e4
4 changed files with 8 additions and 18 deletions

View File

@ -126,10 +126,6 @@ void Label3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &Label3D::generate_triangle_mesh);
ClassDB::bind_method(D_METHOD("_queue_update"), &Label3D::_queue_update);
ClassDB::bind_method(D_METHOD("_font_changed"), &Label3D::_font_changed);
ClassDB::bind_method(D_METHOD("_im_update"), &Label3D::_im_update);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "pixel_size", PROPERTY_HINT_RANGE, "0.0001,128,0.0001,suffix:m"), "set_pixel_size", "get_pixel_size");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset", PROPERTY_HINT_NONE, "suffix:px"), "set_offset", "get_offset");
@ -239,7 +235,7 @@ void Label3D::_queue_update() {
}
pending_update = true;
call_deferred(SceneStringNames::get_singleton()->_im_update);
callable_mp(this, &Label3D::_im_update).call_deferred();
}
AABB Label3D::get_aabb() const {
@ -766,12 +762,12 @@ void Label3D::_font_changed() {
void Label3D::set_font(const Ref<Font> &p_font) {
if (font_override != p_font) {
if (font_override.is_valid()) {
font_override->disconnect(CoreStringNames::get_singleton()->changed, Callable(this, "_font_changed"));
font_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Label3D::_font_changed));
}
font_override = p_font;
dirty_font = true;
if (font_override.is_valid()) {
font_override->connect(CoreStringNames::get_singleton()->changed, Callable(this, "_font_changed"));
font_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Label3D::_font_changed));
}
_queue_update();
}
@ -783,7 +779,7 @@ Ref<Font> Label3D::get_font() const {
Ref<Font> Label3D::_get_font_or_default() const {
if (theme_font.is_valid()) {
theme_font->disconnect(CoreStringNames::get_singleton()->changed, Callable(const_cast<Label3D *>(this), "_font_changed"));
theme_font->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast<Label3D *>(this), &Label3D::_font_changed));
theme_font.unref();
}
@ -801,7 +797,7 @@ Ref<Font> Label3D::_get_font_or_default() const {
Ref<Font> f = ThemeDB::get_singleton()->get_project_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", E);
if (f.is_valid()) {
theme_font = f;
theme_font->connect(CoreStringNames::get_singleton()->changed, Callable(const_cast<Label3D *>(this), "_font_changed"));
theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast<Label3D *>(this), &Label3D::_font_changed));
}
return f;
}
@ -818,7 +814,7 @@ Ref<Font> Label3D::_get_font_or_default() const {
Ref<Font> f = ThemeDB::get_singleton()->get_default_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", E);
if (f.is_valid()) {
theme_font = f;
theme_font->connect(CoreStringNames::get_singleton()->changed, Callable(const_cast<Label3D *>(this), "_font_changed"));
theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast<Label3D *>(this), &Label3D::_font_changed));
}
return f;
}
@ -829,7 +825,7 @@ Ref<Font> Label3D::_get_font_or_default() const {
Ref<Font> f = ThemeDB::get_singleton()->get_default_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", StringName());
if (f.is_valid()) {
theme_font = f;
theme_font->connect(CoreStringNames::get_singleton()->changed, Callable(const_cast<Label3D *>(this), "_font_changed"));
theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast<Label3D *>(this), &Label3D::_font_changed));
}
return f;
}

View File

@ -372,7 +372,7 @@ void SpriteBase3D::_queue_redraw() {
update_gizmos();
pending_update = true;
call_deferred(SceneStringNames::get_singleton()->_im_update);
callable_mp(this, &SpriteBase3D::_im_update).call_deferred();
}
AABB SpriteBase3D::get_aabb() const {
@ -577,8 +577,6 @@ void SpriteBase3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_rect"), &SpriteBase3D::get_item_rect);
ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &SpriteBase3D::generate_triangle_mesh);
ClassDB::bind_method(D_METHOD("_im_update"), &SpriteBase3D::_im_update);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset", PROPERTY_HINT_NONE, "suffix:px"), "set_offset", "get_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_h"), "set_flip_h", "is_flipped_h");

View File

@ -168,8 +168,6 @@ SceneStringNames::SceneStringNames() {
_drop_data = StaticCString::create("_drop_data");
_can_drop_data = StaticCString::create("_can_drop_data");
_im_update = StaticCString::create("_im_update"); // Sprite3D
baked_light_changed = StaticCString::create("baked_light_changed");
_baked_light_changed = StaticCString::create("_baked_light_changed");

View File

@ -180,8 +180,6 @@ public:
StringName _get_minimum_size;
StringName _im_update;
StringName baked_light_changed;
StringName _baked_light_changed;