Merge pull request #110832 from Ivorforce/is-class-to-derives-from
Replace many uses of `is_class` with `derives_from`.
This commit is contained in:
@ -353,7 +353,7 @@ void InspectorDock::_prepare_history() {
|
||||
}
|
||||
} else if (Object::cast_to<Node>(obj)) {
|
||||
text = Object::cast_to<Node>(obj)->get_name();
|
||||
} else if (obj->is_class("EditorDebuggerRemoteObjects")) {
|
||||
} else if (obj->derives_from<EditorDebuggerRemoteObjects>()) {
|
||||
text = obj->call("get_title");
|
||||
} else {
|
||||
text = obj->get_class();
|
||||
@ -551,9 +551,9 @@ void InspectorDock::update(Object *p_object) {
|
||||
current = p_object;
|
||||
|
||||
const bool is_object = p_object != nullptr;
|
||||
const bool is_resource = is_object && p_object->is_class("Resource");
|
||||
const bool is_text_file = is_object && p_object->is_class("TextFile");
|
||||
const bool is_node = is_object && p_object->is_class("Node");
|
||||
const bool is_resource = is_object && p_object->derives_from<Resource>();
|
||||
const bool is_text_file = is_object && p_object->derives_from<TextFile>();
|
||||
const bool is_node = is_object && p_object->derives_from<Node>();
|
||||
|
||||
object_menu->set_disabled(!is_object || is_text_file);
|
||||
search->set_editable(is_object && !is_text_file);
|
||||
|
||||
@ -4125,7 +4125,7 @@ void SceneTreeDock::_focus_node() {
|
||||
Node *node = scene_tree->get_selected();
|
||||
ERR_FAIL_NULL(node);
|
||||
|
||||
if (node->is_class("CanvasItem")) {
|
||||
if (node->derives_from<CanvasItem>()) {
|
||||
CanvasItemEditorPlugin *editor = Object::cast_to<CanvasItemEditorPlugin>(editor_data->get_editor_by_name("2D"));
|
||||
editor->get_canvas_item_editor()->focus_selection();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user