Skip to content

Commit ecfe34f

Browse files
authored
Merge pull request #110892 from AThousandShips/fix_build_2d
Revert "Replace many uses of `is_class` with `derives_from`."
2 parents 6e4e807 + bd65cfa commit ecfe34f

Some content is hidden

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

43 files changed

+82
-82
lines changed

core/io/resource_format_binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
22202220
#ifdef REAL_T_IS_DOUBLE
22212221
format_flags |= FORMAT_FLAG_REAL_T_IS_DOUBLE;
22222222
#endif
2223-
if (!p_resource->derives_from<PackedScene>()) {
2223+
if (!p_resource->is_class("PackedScene")) {
22242224
Ref<Script> s = p_resource->get_script();
22252225
if (s.is_valid()) {
22262226
script_class = s->get_global_name();

core/io/resource_loader.cpp

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

14401440
Ref<Resource> res = ResourceLoader::load(script_path);
14411441
ERR_FAIL_COND_V(res.is_null(), false);
1442-
ERR_FAIL_COND_V(!res->derives_from<Script>(), false);
1442+
ERR_FAIL_COND_V(!res->is_class("Script"), false);
14431443

14441444
Ref<Script> s = res;
14451445
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->derives_from<Script>(), false);
236+
ERR_FAIL_COND_V(!res->is_class("Script"), false);
237237

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

core/object/object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
562562

563563
_get_property_listv(p_list, p_reversed);
564564

565-
if (!derives_from<Script>()) { // can still be set, but this is for user-friendliness
565+
if (!is_class("Script")) { // can still be set, but this is for user-friendliness
566566
p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NEVER_DUPLICATE));
567567
}
568568

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->derives_from<ImageTexture>());
76+
return (p_resource.is_valid() && p_resource->is_class("ImageTexture"));
7777
}
7878

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

editor/animation/animation_player_editor_plugin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ AnimationMixer *AnimationPlayerEditor::fetch_mixer_for_library() const {
19361936
return nullptr;
19371937
}
19381938
// Does AnimationTree have AnimationPlayer?
1939-
if (original_node->derives_from<AnimationTree>()) {
1939+
if (original_node->is_class("AnimationTree")) {
19401940
AnimationTree *src_tree = Object::cast_to<AnimationTree>(original_node);
19411941
Node *src_player = src_tree->get_node_or_null(src_tree->get_animation_player());
19421942
if (src_player) {
@@ -2339,7 +2339,7 @@ void AnimationPlayerEditorPlugin::edit(Object *p_object) {
23392339

23402340
AnimationMixer *src_node = Object::cast_to<AnimationMixer>(p_object);
23412341
bool is_dummy = false;
2342-
if (!p_object->derives_from<AnimationPlayer>()) {
2342+
if (!p_object->is_class("AnimationPlayer")) {
23432343
// If it needs dummy AnimationPlayer, assign original AnimationMixer to LibraryEditor.
23442344
_update_dummy_player(src_node);
23452345

@@ -2409,7 +2409,7 @@ void AnimationPlayerEditorPlugin::_update_dummy_player(AnimationMixer *p_mixer)
24092409
}
24102410

24112411
bool AnimationPlayerEditorPlugin::handles(Object *p_object) const {
2412-
return p_object->derives_from<AnimationPlayer>() || p_object->derives_from<AnimationTree>() || p_object->derives_from<AnimationMixer>();
2412+
return p_object->is_class("AnimationPlayer") || p_object->is_class("AnimationTree") || p_object->is_class("AnimationMixer");
24132413
}
24142414

24152415
void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
@@ -2455,7 +2455,7 @@ AnimationTrackKeyEditEditorPlugin::AnimationTrackKeyEditEditorPlugin() {
24552455
}
24562456

24572457
bool AnimationTrackKeyEditEditorPlugin::handles(Object *p_object) const {
2458-
return p_object->derives_from<AnimationTrackKeyEdit>();
2458+
return p_object->is_class("AnimationTrackKeyEdit");
24592459
}
24602460

24612461
bool EditorInspectorPluginAnimationMarkerKeyEdit::can_handle(Object *p_object) {
@@ -2476,5 +2476,5 @@ AnimationMarkerKeyEditEditorPlugin::AnimationMarkerKeyEditEditorPlugin() {
24762476
}
24772477

24782478
bool AnimationMarkerKeyEditEditorPlugin::handles(Object *p_object) const {
2479-
return p_object->derives_from<AnimationMarkerKeyEdit>();
2479+
return p_object->is_class("AnimationMarkerKeyEdit");
24802480
}

editor/animation/animation_state_machine_editor.cpp

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

917917
Ref<StyleBox> AnimationNodeStateMachineEditor::_adjust_stylebox_opacity(Ref<StyleBox> p_style, float p_opacity) {
918918
Ref<StyleBox> style = p_style->duplicate();
919-
if (style->derives_from<StyleBoxFlat>()) {
919+
if (style->is_class("StyleBoxFlat")) {
920920
Ref<StyleBoxFlat> flat_style = style;
921921
Color bg_color = flat_style->get_bg_color();
922922
Color border_color = flat_style->get_border_color();

editor/animation/animation_track_editor.cpp

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

5448-
if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !node->derives_from<MeshInstance3D>()) {
5448+
if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !node->is_class("MeshInstance3D")) {
54495449
EditorNode::get_singleton()->show_warning(TTR("Blend Shape tracks only apply to MeshInstance3D nodes."));
54505450
return;
54515451
}
54525452

5453-
if ((adding_track_type == Animation::TYPE_POSITION_3D || adding_track_type == Animation::TYPE_ROTATION_3D || adding_track_type == Animation::TYPE_SCALE_3D) && !node->derives_from<Node3D>()) {
5453+
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")) {
54545454
EditorNode::get_singleton()->show_warning(TTR("Position/Rotation/Scale 3D tracks only apply to 3D-based nodes."));
54555455
return;
54565456
}
@@ -5509,7 +5509,7 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
55095509

55105510
} break;
55115511
case Animation::TYPE_ANIMATION: {
5512-
if (!node->derives_from<AnimationPlayer>()) {
5512+
if (!node->is_class("AnimationPlayer")) {
55135513
EditorNode::get_singleton()->show_warning(TTR("Animation tracks can only point to AnimationPlayer nodes."));
55145514
return;
55155515
}

editor/animation/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->derives_from<Sprite2D>() || p_object->derives_from<Sprite3D>() || p_object->derives_from<AnimatedSprite2D>() || p_object->derives_from<AnimatedSprite3D>())) {
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"))) {
13341334
AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
13351335
sprite->set_node(p_object);
13361336
return sprite;
13371337
}
13381338

1339-
if (p_property == "frame_coords" && (p_object->derives_from<Sprite2D>() || p_object->derives_from<Sprite3D>())) {
1339+
if (p_property == "frame_coords" && (p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D"))) {
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->derives_from<AnimationPlayer>())) {
1346+
if (p_property == "current_animation" && (p_object->is_class("AnimationPlayer"))) {
13471347
AnimationTrackEditSubAnim *player = memnew(AnimationTrackEditSubAnim);
13481348
player->set_node(p_object);
13491349
return player;

editor/animation/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->derives_from<AnimationTree>();
285+
return p_object->is_class("AnimationTree");
286286
}
287287

288288
void AnimationTreeEditorPlugin::make_visible(bool p_visible) {

0 commit comments

Comments
 (0)