diff options
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r-- | editor/editor_inspector.cpp | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 65c65a517f..94dd4d0606 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -783,9 +783,9 @@ Variant EditorProperty::get_drag_data(const Point2 &p_point) { dp["property"] = property; dp["value"] = object->get(property); - Label *label = memnew(Label); - label->set_text(property); - set_drag_preview(label); + Label *drag_label = memnew(Label); + drag_label->set_text(property); + set_drag_preview(drag_label); return dp; } @@ -1061,11 +1061,9 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St } bool EditorInspectorPlugin::can_handle(Object *p_object) { - bool success; - if (GDVIRTUAL_CALL(_can_handle, p_object, success)) { - return success; - } - return false; + bool success = false; + GDVIRTUAL_CALL(_can_handle, p_object, success); + return success; } void EditorInspectorPlugin::parse_begin(Object *p_object) { @@ -1081,11 +1079,9 @@ void EditorInspectorPlugin::parse_group(Object *p_object, const String &p_group) } bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) { - bool ret; - if (GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret); + return ret; } void EditorInspectorPlugin::parse_end(Object *p_object) { @@ -1575,9 +1571,9 @@ int EditorInspectorArray::_get_array_count() { return _extract_properties_as_array(object_property_list).size(); } else if (mode == MODE_USE_COUNT_PROPERTY) { bool valid; - int count = object->get(count_property, &valid); + int count_val = object->get(count_property, &valid); ERR_FAIL_COND_V_MSG(!valid, 0, vformat("%s is not a valid property to be used as array count.", count_property)); - return count; + return count_val; } return 0; } @@ -2527,7 +2523,7 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, EditorIn if (ep) { ep->object = object; - ep->connect("property_changed", callable_mp(this, &EditorInspector::_property_changed)); + ep->connect("property_changed", callable_mp(this, &EditorInspector::_property_changed).bind(false)); ep->connect("property_keyed", callable_mp(this, &EditorInspector::_property_keyed)); ep->connect("property_deleted", callable_mp(this, &EditorInspector::_property_deleted), CONNECT_DEFERRED); ep->connect("property_keyed_with_value", callable_mp(this, &EditorInspector::_property_keyed_with_value)); @@ -2768,13 +2764,13 @@ void EditorInspector::update_tree() { // Set the category icon. if (!EditorNode::get_editor_data().is_type_recognized(type) && p.hint_string.length() && FileAccess::exists(p.hint_string)) { // If we have a category inside a script, search for the first script with a valid icon. - Ref<Script> script = ResourceLoader::load(p.hint_string, "Script"); + Ref<Script> scr = ResourceLoader::load(p.hint_string, "Script"); StringName base_type; StringName name; - if (script.is_valid()) { - base_type = script->get_instance_base_type(); - name = EditorNode::get_editor_data().script_class_get_name(script->get_path()); - Vector<DocData::ClassDoc> docs = script->get_documentation(); + if (scr.is_valid()) { + base_type = scr->get_instance_base_type(); + name = EditorNode::get_editor_data().script_class_get_name(scr->get_path()); + Vector<DocData::ClassDoc> docs = scr->get_documentation(); if (!docs.is_empty()) { doc_name = docs[0].name; } @@ -2782,20 +2778,20 @@ void EditorInspector::update_tree() { label = name; } } - while (script.is_valid()) { - name = EditorNode::get_editor_data().script_class_get_name(script->get_path()); + while (scr.is_valid()) { + name = EditorNode::get_editor_data().script_class_get_name(scr->get_path()); String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name); if (name != StringName() && !icon_path.is_empty()) { category->icon = ResourceLoader::load(icon_path, "Texture"); break; } - const EditorData::CustomType *ctype = EditorNode::get_editor_data().get_custom_type_by_path(script->get_path()); + const EditorData::CustomType *ctype = EditorNode::get_editor_data().get_custom_type_by_path(scr->get_path()); if (ctype) { category->icon = ctype->icon; break; } - script = script->get_base_script(); + scr = scr->get_base_script(); } if (category->icon.is_null() && has_theme_icon(base_type, SNAME("EditorIcons"))) { category->icon = get_theme_icon(base_type, SNAME("EditorIcons")); @@ -3876,7 +3872,7 @@ void EditorInspector::_notification(int p_what) { update_scroll_request = -1; } if (update_tree_pending) { - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } else if (refresh_countdown > 0) { refresh_countdown -= get_process_delta_time(); if (refresh_countdown <= 0) { @@ -3889,7 +3885,7 @@ void EditorInspector::_notification(int p_what) { } } } - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } } @@ -4095,7 +4091,7 @@ EditorInspector::EditorInspector() { get_v_scroll_bar()->connect("value_changed", callable_mp(this, &EditorInspector::_vscroll_changed)); update_scroll_request = -1; if (EditorSettings::get_singleton()) { - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } else { //used when class is created by the docgen to dump default values of everything bindable, editorsettings may not be created refresh_countdown = 0.33; |