Repository: godotengine/godot
File: editor/inspector/editor_inspector.cpp (C++)

Code before:
		}
		if (prop_info.usage & PROPERTY_USAGE_CATEGORY) {
			current_category = prop_info.name;
			continue;
		}
		if (!(prop_info.usage & PROPERTY_USAGE_EDITOR)) {
			continue;
		}
		if (current_category != label && !current_category.ends_with(".gd")) {
			continue;
		}

		p_properties.push_back(prop_info.name);
	}
}

void EditorInspectorCategory::_handle_menu_option(int p_option) {
	switch (p_option) {
		case MENU_COPY_VALUE: {
			Object *object = EditorInterface::get_singleton()->get_inspector()->get_edited_object();
			Dictionary clipboard;
			Vector<String> properties;
			_collect_properties(object, properties);

			clipboard["category_name"] = label;
			for (String property_name : properties) {
				clipboard[property_name] = object->get(property_name);
			}
			InspectorDock::get_inspector_singleton()->set_property_clipboard(clipboard);
		} break;

		case MENU_PASTE_VALUE: {
			Object *object = EditorInterface::get_singleton()->get_inspector()->get_edited_object();
			Dictionary clipboard = InspectorDock::get_inspector_singleton()->get_property_clipboard();
			String category_name = clipboard["category_name"];
			String action_name = "Set category " + category_name;

			EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
			undo_redo->create_action(action_name);

			for (String property_name : clipboard.keys()) {
				Variant value = clipboard[property_name];
				undo_redo->add_do_property(object, property_name, value);
				undo_redo->add_undo_property(object, property_name, object->get(property_name));
			}

			undo_redo->commit_action();
		} break;

		case MENU_OPEN_DOCS: {
			ScriptEditor::get_singleton()->goto_help("class:" + doc_class_name);

Review comment (suggestion):
```suggestion
			for (const String &property_name : properties) {
```

Code after:
				Size2 rect_size = Size2(icon_size, icon_size);
				Point2 rect_pos = Point2(ofs, (get_size().height - icon_size) / 2 + v_margin_offset).round();
				if (is_layout_rtl()) {
					rect_pos.x = get_size().width - rect_pos.x - icon_size;
				}
				draw_texture_rect(icon, Rect2(rect_pos, rect_size));

				ofs += hs + icon_size;
				w -= hs + icon_size;
			}

			if (is_layout_rtl()) {
				ofs = get_size().width - ofs - w;
			}

			// Use TextLine so we have access to accurate font metrics. This way,
			// we can ensure the line is vertically centered regardless of the font used
			// or its size.
			Ref<TextLine> tl;
			tl.instantiate();
			tl->add_string(label, font, font_size);
			tl->set_width(w);
			tl->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
			float text_pos_y = (get_size().height - tl->get_size().height) / 2 + v_margin_offset;
			Point2 text_pos = Point2(ofs, text_pos_y).round();
			tl->draw(get_canvas_item(), text_pos, theme_cache.font_color);
		} break;
	}
}

void EditorInspectorCategory::_accessibility_action_menu(const Variant &p_data) {
	_popup_context_menu(get_screen_position());
}

Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) const {
	// If it's not a doc tooltip, fallback to the default one.
	if (doc_class_name.is_empty()) {
		return nullptr;
	}

	return EditorHelpBitTooltip::make_tooltip(const_cast<EditorInspectorCategory *>(this), p_text);
}

void EditorInspectorCategory::set_as_favorite() {
	is_favorite = true;
	_update_icon();
}

void EditorInspectorCategory::set_property_info(const PropertyInfo &p_info) {
	info = p_info;