Skip to content

Commit dcfa490

Browse files
committed
Add Object::is_class as a faster, static version of object->is_class.
1 parent 8bd9cde commit dcfa490

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+109
-102
lines changed

core/io/resource_loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ bool ResourceLoader::add_custom_resource_format_loader(const String &script_path
14611461

14621462
Ref<Resource> res = ResourceLoader::load(script_path);
14631463
ERR_FAIL_COND_V(res.is_null(), false);
1464-
ERR_FAIL_COND_V(!res->is_class("Script"), false);
1464+
ERR_FAIL_COND_V(!Object::is_class<Script>(res.ptr()), false);
14651465

14661466
Ref<Script> s = res;
14671467
StringName ibt = s->get_instance_base_type();

core/io/resource_saver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ bool ResourceSaver::add_custom_resource_format_saver(const String &script_path)
233233

234234
Ref<Resource> res = ResourceLoader::load(script_path);
235235
ERR_FAIL_COND_V(res.is_null(), false);
236-
ERR_FAIL_COND_V(!res->is_class("Script"), false);
236+
ERR_FAIL_COND_V(!Object::is_class<Script>(res.ptr()), false);
237237

238238
Ref<Script> s = res;
239239
StringName ibt = s->get_instance_base_type();

core/object/object.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
542542

543543
_get_property_listv(p_list, p_reversed);
544544

545-
if (!is_class("Script")) { // can still be set, but this is for user-friendliness
545+
if (!Object::is_class<Script>(this)) { // can still be set, but this is for user-friendliness
546546
p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NEVER_DUPLICATE));
547547
}
548548

@@ -1701,7 +1701,8 @@ void Object::notify_property_list_changed() {
17011701

17021702
void Object::_bind_methods() {
17031703
ClassDB::bind_method(D_METHOD("get_class"), &Object::get_class);
1704-
ClassDB::bind_method(D_METHOD("is_class", "class"), &Object::is_class);
1704+
bool (Object::*is_class_function)(const String &) const = &Object::is_class;
1705+
ClassDB::bind_method(D_METHOD("is_class", "class"), is_class_function);
17051706
ClassDB::bind_method(D_METHOD("set", "property", "value"), &Object::_set_bind);
17061707
ClassDB::bind_method(D_METHOD("get", "property"), &Object::_get_bind);
17071708
ClassDB::bind_method(D_METHOD("set_indexed", "property_path", "value"), &Object::_set_indexed_bind);

core/object/object.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,20 +788,23 @@ class Object {
788788
void detach_from_objectdb();
789789
_FORCE_INLINE_ ObjectID get_instance_id() const { return _instance_id; }
790790

791+
template <typename T>
792+
static bool is_class(const Object *p_object) {
793+
static_assert(std::is_base_of_v<Object, T>, "T must be derived from Object");
794+
static_assert(std::is_same_v<std::decay_t<T>, typename T::self_type>, "T must use GDCLASS or GDSOFTCLASS");
795+
return p_object && p_object->is_class_ptr(T::get_class_ptr_static());
796+
}
797+
791798
template <typename T>
792799
static T *cast_to(Object *p_object) {
793800
// This is like dynamic_cast, but faster.
794801
// The reason is that we can assume no virtual and multiple inheritance.
795-
static_assert(std::is_base_of_v<Object, T>, "T must be derived from Object");
796-
static_assert(std::is_same_v<std::decay_t<T>, typename T::self_type>, "T must use GDCLASS or GDSOFTCLASS");
797-
return p_object && p_object->is_class_ptr(T::get_class_ptr_static()) ? static_cast<T *>(p_object) : nullptr;
802+
return Object::is_class<T>(p_object) ? static_cast<T *>(p_object) : nullptr;
798803
}
799804

800805
template <typename T>
801806
static const T *cast_to(const Object *p_object) {
802-
static_assert(std::is_base_of_v<Object, T>, "T must be derived from Object");
803-
static_assert(std::is_same_v<std::decay_t<T>, typename T::self_type>, "T must use GDCLASS or GDSOFTCLASS");
804-
return p_object && p_object->is_class_ptr(T::get_class_ptr_static()) ? static_cast<const T *>(p_object) : nullptr;
807+
return Object::is_class<T>(p_object) ? static_cast<const T *>(p_object) : nullptr;
805808
}
806809

807810
enum {

drivers/png/resource_saver_png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img)
7373
}
7474

7575
bool ResourceSaverPNG::recognize(const Ref<Resource> &p_resource) const {
76-
return (p_resource.is_valid() && p_resource->is_class("ImageTexture"));
76+
return (p_resource.is_valid() && Object::is_class<ImageTexture>(p_resource.ptr()));
7777
}
7878

7979
void ResourceSaverPNG::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {

editor/animation_track_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5263,12 +5263,12 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
52635263
ERR_FAIL_NULL(node);
52645264
NodePath path_to = root->get_path_to(node, true);
52655265

5266-
if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !node->is_class("MeshInstance3D")) {
5266+
if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !Object::is_class<MeshInstance3D>(node)) {
52675267
EditorNode::get_singleton()->show_warning(TTR("Blend Shape tracks only apply to MeshInstance3D nodes."));
52685268
return;
52695269
}
52705270

5271-
if ((adding_track_type == Animation::TYPE_POSITION_3D || adding_track_type == Animation::TYPE_ROTATION_3D || adding_track_type == Animation::TYPE_SCALE_3D) && !node->is_class("Node3D")) {
5271+
if ((adding_track_type == Animation::TYPE_POSITION_3D || adding_track_type == Animation::TYPE_ROTATION_3D || adding_track_type == Animation::TYPE_SCALE_3D) && !Object::is_class<Node3D>(node)) {
52725272
EditorNode::get_singleton()->show_warning(TTR("Position/Rotation/Scale 3D tracks only apply to 3D-based nodes."));
52735273
return;
52745274
}
@@ -5327,7 +5327,7 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
53275327

53285328
} break;
53295329
case Animation::TYPE_ANIMATION: {
5330-
if (!node->is_class("AnimationPlayer")) {
5330+
if (!Object::is_class<AnimationPlayer>(node)) {
53315331
EditorNode::get_singleton()->show_warning(TTR("Animation tracks can only point to AnimationPlayer nodes."));
53325332
return;
53335333
}

editor/animation_track_editor_plugins.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,20 +1330,20 @@ AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_value_track_edit(Obj
13301330
return audio;
13311331
}
13321332

1333-
if (p_property == "frame" && (p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D") || p_object->is_class("AnimatedSprite2D") || p_object->is_class("AnimatedSprite3D"))) {
1333+
if (p_property == "frame" && (Object::is_class<Sprite2D>(p_object) || Object::is_class<Sprite3D>(p_object) || Object::is_class<AnimatedSprite2D>(p_object) || Object::is_class<AnimatedSprite3D>(p_object))) {
13341334
AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
13351335
sprite->set_node(p_object);
13361336
return sprite;
13371337
}
13381338

1339-
if (p_property == "frame_coords" && (p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D"))) {
1339+
if (p_property == "frame_coords" && (Object::is_class<Sprite2D>(p_object) || Object::is_class<Sprite3D>(p_object))) {
13401340
AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
13411341
sprite->set_as_coords();
13421342
sprite->set_node(p_object);
13431343
return sprite;
13441344
}
13451345

1346-
if (p_property == "current_animation" && (p_object->is_class("AnimationPlayer"))) {
1346+
if (p_property == "current_animation" && (Object::is_class<AnimationPlayer>(p_object))) {
13471347
AnimationTrackEditSubAnim *player = memnew(AnimationTrackEditSubAnim);
13481348
player->set_node(p_object);
13491349
return player;

editor/editor_node.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
15411541

15421542
List<String> preferred;
15431543
for (const String &E : extensions) {
1544-
if (p_resource->is_class("Script") && (E == "tres" || E == "res")) {
1544+
if (Object::is_class<Script>(p_resource.ptr()) && (E == "tres" || E == "res")) {
15451545
// This serves no purpose and confused people.
15461546
continue;
15471547
}
@@ -1779,13 +1779,13 @@ void EditorNode::_save_edited_subresources(Node *scene, HashMap<Ref<Resource>, b
17791779
}
17801780

17811781
void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) {
1782-
if (p_node->is_class("Viewport") || (p_node != editor_data.get_edited_scene_root() && p_node->get_owner() != editor_data.get_edited_scene_root())) {
1782+
if (Object::is_class<Viewport>(p_node) || (p_node != editor_data.get_edited_scene_root() && p_node->get_owner() != editor_data.get_edited_scene_root())) {
17831783
return;
17841784
}
17851785

1786-
if (p_node->is_class("CanvasItem")) {
1786+
if (Object::is_class<CanvasItem>(p_node)) {
17871787
count_2d++;
1788-
} else if (p_node->is_class("Node3D")) {
1788+
} else if (Object::is_class<Node3D>(p_node)) {
17891789
count_3d++;
17901790
}
17911791

@@ -2658,13 +2658,13 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
26582658
}
26592659

26602660
// Update the use folding setting and state.
2661-
bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")) || current_obj->is_class("EditorDebuggerRemoteObjects");
2661+
bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")) || Object::is_class<EditorDebuggerRemoteObjects>(current_obj);
26622662
if (InspectorDock::get_inspector_singleton()->is_using_folding() == disable_folding) {
26632663
InspectorDock::get_inspector_singleton()->set_use_folding(!disable_folding, false);
26642664
}
26652665

2666-
bool is_resource = current_obj->is_class("Resource");
2667-
bool is_node = current_obj->is_class("Node");
2666+
bool is_resource = Object::is_class<Resource>(current_obj);
2667+
bool is_node = Object::is_class<Node>(current_obj);
26682668
bool stay_in_script_editor_on_node_selected = bool(EDITOR_GET("text_editor/behavior/navigation/stay_in_script_editor_on_node_selected"));
26692669
bool skip_main_plugin = false;
26702670

@@ -2739,7 +2739,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
27392739
Node *selected_node = nullptr;
27402740

27412741
Vector<Node *> multi_nodes;
2742-
if (current_obj->is_class("MultiNodeEdit")) {
2742+
if (Object::is_class<MultiNodeEdit>(current_obj)) {
27432743
Node *scene = get_edited_scene();
27442744
if (scene) {
27452745
MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj);
@@ -2760,7 +2760,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
27602760
}
27612761
}
27622762

2763-
if (!current_obj->is_class("EditorDebuggerRemoteObjects")) {
2763+
if (!Object::is_class<EditorDebuggerRemoteObjects>(current_obj)) {
27642764
EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
27652765
}
27662766

@@ -2776,8 +2776,8 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
27762776
editable_info,
27772777
info_is_warning);
27782778

2779-
Object *editor_owner = (is_node || current_obj->is_class("MultiNodeEdit")) ? (Object *)SceneTreeDock::get_singleton() : is_resource ? (Object *)InspectorDock::get_inspector_singleton()
2780-
: (Object *)this;
2779+
Object *editor_owner = (is_node || Object::is_class<MultiNodeEdit>(current_obj)) ? (Object *)SceneTreeDock::get_singleton() : is_resource ? (Object *)InspectorDock::get_inspector_singleton()
2780+
: (Object *)this;
27812781

27822782
// Take care of the main editor plugin.
27832783

@@ -5088,7 +5088,7 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
50885088
return get_class_icon(class_name, p_fallback);
50895089
}
50905090

5091-
if (scr.is_null() && p_object->is_class("Script")) {
5091+
if (scr.is_null() && Object::is_class<Script>(p_object)) {
50925092
scr = p_object;
50935093
}
50945094

editor/gui/scene_tree_editor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
133133
undo_redo->add_undo_method(this, "emit_signal", "node_changed");
134134
undo_redo->commit_action();
135135
} else if (p_id == BUTTON_PIN) {
136-
if (n->is_class("AnimationMixer")) {
136+
if (Object::is_class<AnimationMixer>(n)) {
137137
AnimationPlayerEditor::get_singleton()->unpin();
138138
_update_tree();
139139
}
140140

141141
} else if (p_id == BUTTON_GROUP) {
142142
undo_redo->create_action(TTR("Ungroup Children"));
143143

144-
if (n->is_class("CanvasItem") || n->is_class("Node3D")) {
144+
if (Object::is_class<CanvasItem>(n) || Object::is_class<Node3D>(n)) {
145145
undo_redo->add_do_method(n, "remove_meta", "_edit_group_");
146146
undo_redo->add_undo_method(n, "set_meta", "_edit_group_", true);
147147
undo_redo->add_do_method(this, "_update_tree");
@@ -606,7 +606,7 @@ void SceneTreeEditor::_update_node(Node *p_node, TreeItem *p_item, bool p_part_o
606606
_update_visibility_color(p_node, p_item);
607607
}
608608

609-
if (p_node->is_class("AnimationMixer")) {
609+
if (Object::is_class<AnimationMixer>(p_node)) {
610610
bool is_pinned = AnimationPlayerEditor::get_singleton()->get_editing_node() == p_node && AnimationPlayerEditor::get_singleton()->is_pinned();
611611

612612
if (is_pinned) {
@@ -707,7 +707,7 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
707707

708708
if (p_node->has_method("is_visible")) {
709709
node_visible = p_node->call("is_visible");
710-
if (p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
710+
if (Object::is_class<CanvasItem>(p_node) || p_node->is_class("CanvasLayer") || Object::is_class<Window>(p_node)) {
711711
CanvasItemEditor::get_singleton()->get_viewport_control()->queue_redraw();
712712
}
713713
}

editor/inspector_dock.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void InspectorDock::_prepare_history() {
353353
}
354354
} else if (Object::cast_to<Node>(obj)) {
355355
text = Object::cast_to<Node>(obj)->get_name();
356-
} else if (obj->is_class("EditorDebuggerRemoteObjects")) {
356+
} else if (Object::is_class<EditorDebuggerRemoteObjects>(obj)) {
357357
text = obj->call("get_title");
358358
} else {
359359
text = obj->get_class();
@@ -551,9 +551,9 @@ void InspectorDock::update(Object *p_object) {
551551
current = p_object;
552552

553553
const bool is_object = p_object != nullptr;
554-
const bool is_resource = is_object && p_object->is_class("Resource");
555-
const bool is_text_file = is_object && p_object->is_class("TextFile");
556-
const bool is_node = is_object && p_object->is_class("Node");
554+
const bool is_resource = is_object && Object::is_class<Resource>(p_object);
555+
const bool is_text_file = is_object && Object::is_class<TextFile>(p_object);
556+
const bool is_node = is_object && Object::is_class<Node>(p_object);
557557

558558
object_menu->set_disabled(!is_object || is_text_file);
559559
search->set_editable(is_object && !is_text_file);

editor/plugins/animation_player_editor_plugin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ AnimationMixer *AnimationPlayerEditor::fetch_mixer_for_library() const {
19211921
return nullptr;
19221922
}
19231923
// Does AnimationTree have AnimationPlayer?
1924-
if (original_node->is_class("AnimationTree")) {
1924+
if (Object::is_class<AnimationTree>(original_node)) {
19251925
AnimationTree *src_tree = Object::cast_to<AnimationTree>(original_node);
19261926
Node *src_player = src_tree->get_node_or_null(src_tree->get_animation_player());
19271927
if (src_player) {
@@ -2322,7 +2322,7 @@ void AnimationPlayerEditorPlugin::edit(Object *p_object) {
23222322

23232323
AnimationMixer *src_node = Object::cast_to<AnimationMixer>(p_object);
23242324
bool is_dummy = false;
2325-
if (!p_object->is_class("AnimationPlayer")) {
2325+
if (!Object::is_class<AnimationPlayer>(p_object)) {
23262326
// If it needs dummy AnimationPlayer, assign original AnimationMixer to LibraryEditor.
23272327
_update_dummy_player(src_node);
23282328

@@ -2392,7 +2392,7 @@ void AnimationPlayerEditorPlugin::_update_dummy_player(AnimationMixer *p_mixer)
23922392
}
23932393

23942394
bool AnimationPlayerEditorPlugin::handles(Object *p_object) const {
2395-
return p_object->is_class("AnimationPlayer") || p_object->is_class("AnimationTree") || p_object->is_class("AnimationMixer");
2395+
return Object::is_class<AnimationPlayer>(p_object) || Object::is_class<AnimationTree>(p_object) || Object::is_class<AnimationMixer>(p_object);
23962396
}
23972397

23982398
void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
@@ -2434,7 +2434,7 @@ AnimationTrackKeyEditEditorPlugin::AnimationTrackKeyEditEditorPlugin() {
24342434
}
24352435

24362436
bool AnimationTrackKeyEditEditorPlugin::handles(Object *p_object) const {
2437-
return p_object->is_class("AnimationTrackKeyEdit");
2437+
return Object::is_class<AnimationTrackKeyEdit>(p_object);
24382438
}
24392439

24402440
bool EditorInspectorPluginAnimationMarkerKeyEdit::can_handle(Object *p_object) {
@@ -2455,5 +2455,5 @@ AnimationMarkerKeyEditEditorPlugin::AnimationMarkerKeyEditEditorPlugin() {
24552455
}
24562456

24572457
bool AnimationMarkerKeyEditEditorPlugin::handles(Object *p_object) const {
2458-
return p_object->is_class("AnimationMarkerKeyEdit");
2458+
return Object::is_class<AnimationMarkerKeyEdit>(p_object);
24592459
}

editor/plugins/animation_state_machine_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ void AnimationNodeStateMachineEditor::_clip_dst_line_to_rect(const Vector2 &p_fr
964964

965965
Ref<StyleBox> AnimationNodeStateMachineEditor::_adjust_stylebox_opacity(Ref<StyleBox> p_style, float p_opacity) {
966966
Ref<StyleBox> style = p_style->duplicate();
967-
if (style->is_class("StyleBoxFlat")) {
967+
if (Object::is_class<StyleBoxFlat>(style.ptr())) {
968968
Ref<StyleBoxFlat> flat_style = style;
969969
Color bg_color = flat_style->get_bg_color();
970970
Color border_color = flat_style->get_border_color();

editor/plugins/animation_tree_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void AnimationTreeEditorPlugin::edit(Object *p_object) {
282282
}
283283

284284
bool AnimationTreeEditorPlugin::handles(Object *p_object) const {
285-
return p_object->is_class("AnimationTree");
285+
return Object::is_class<AnimationTree>(p_object);
286286
}
287287

288288
void AnimationTreeEditorPlugin::make_visible(bool p_visible) {

editor/plugins/camera_2d_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void Camera2DEditorPlugin::edit(Object *p_object) {
137137
}
138138

139139
bool Camera2DEditorPlugin::handles(Object *p_object) const {
140-
return p_object->is_class("Camera2D");
140+
return Object::is_class<Camera2D>(p_object);
141141
}
142142

143143
void Camera2DEditorPlugin::make_visible(bool p_visible) {

editor/plugins/camera_3d_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void Camera3DEditorPlugin::edit(Object *p_object) {
112112
}
113113

114114
bool Camera3DEditorPlugin::handles(Object *p_object) const {
115-
return p_object->is_class("Camera3D");
115+
return Object::is_class<Camera3D>(p_object);
116116
}
117117

118118
void Camera3DEditorPlugin::make_visible(bool p_visible) {

editor/plugins/canvas_item_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5746,7 +5746,7 @@ void CanvasItemEditorPlugin::edit(Object *p_object) {
57465746
}
57475747

57485748
bool CanvasItemEditorPlugin::handles(Object *p_object) const {
5749-
return p_object->is_class("CanvasItem");
5749+
return Object::is_class<CanvasItem>(p_object);
57505750
}
57515751

57525752
void CanvasItemEditorPlugin::make_visible(bool p_visible) {

editor/plugins/collision_shape_2d_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ void CollisionShape2DEditorPlugin::edit(Object *p_obj) {
651651
}
652652

653653
bool CollisionShape2DEditorPlugin::handles(Object *p_obj) const {
654-
return p_obj->is_class("CollisionShape2D");
654+
return Object::is_class<CollisionShape2D>(p_obj);
655655
}
656656

657657
void CollisionShape2DEditorPlugin::make_visible(bool visible) {

editor/plugins/font_config_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ void FontPreview::_notification(int p_what) {
915915
} else {
916916
name = vformat("%s (%s)", prev_font->get_font_name(), prev_font->get_font_style_name());
917917
}
918-
if (prev_font->is_class("FontVariation")) {
918+
if (Object::is_class<FontVariation>(prev_font.ptr())) {
919919
// TRANSLATORS: This refers to variable font config, appended to the font name.
920920
name += " - " + TTR("Variation");
921921
}

editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::edit(Object *p_object) {
6464
}
6565

6666
bool GPUParticlesCollisionSDF3DEditorPlugin::handles(Object *p_object) const {
67-
return p_object->is_class("GPUParticlesCollisionSDF3D");
67+
return Object::is_class<GPUParticlesCollisionSDF3D>(p_object);
6868
}
6969

7070
void GPUParticlesCollisionSDF3DEditorPlugin::_notification(int p_what) {

editor/plugins/lightmap_gi_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void LightmapGIEditorPlugin::edit(Object *p_object) {
139139
}
140140

141141
bool LightmapGIEditorPlugin::handles(Object *p_object) const {
142-
return p_object->is_class("LightmapGI");
142+
return Object::is_class<LightmapGI>(p_object);
143143
}
144144

145145
void LightmapGIEditorPlugin::make_visible(bool p_visible) {

editor/plugins/mesh_library_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void MeshLibraryEditorPlugin::edit(Object *p_node) {
309309
}
310310

311311
bool MeshLibraryEditorPlugin::handles(Object *p_node) const {
312-
return p_node->is_class("MeshLibrary");
312+
return Object::is_class<MeshLibrary>(p_node);
313313
}
314314

315315
void MeshLibraryEditorPlugin::make_visible(bool p_visible) {

0 commit comments

Comments
 (0)