Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert some Callables to callable_mp() #79373

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions scene/3d/label_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}

Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions scene/3d/sprite_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions scene/scene_string_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 0 additions & 2 deletions scene/scene_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ class SceneStringNames {

StringName _get_minimum_size;

StringName _im_update;

StringName baked_light_changed;
StringName _baked_light_changed;

Expand Down