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

Code before:
	if (!checkable) {
		return;
	}

	bool valid = false;
	Variant value_checked = object->get(related_enable_property, &valid);

	if (valid) {
		set_checked(value_checked.operator bool());
	}
}

void EditorInspectorSection::_update_popup() {
	if (menu) {
		menu->clear();
	} else {
		menu = memnew(PopupMenu);
		add_child(menu);
		menu->connect(SceneStringName(id_pressed), callable_mp(this, &EditorInspectorSection::menu_option));
	}

	menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionCopy")), ED_GET_SHORTCUT("property_editor/copy_group_values"), MENU_COPY_VALUE);
	menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionPaste")), ED_GET_SHORTCUT("property_editor/paste_group_values"), MENU_PASTE_VALUE);
}

void EditorInspectorSection::_collect_properties(Vector<String> &p_properties) const {
	List<PropertyInfo> property_list;
	object->get_property_list(&property_list, true);

	String current_category = "";
	String current_group = "";
	for (const PropertyInfo &prop_info : property_list) {
		if (prop_info.usage & PROPERTY_USAGE_GROUP) {
			current_group = prop_info.name;
			continue;
		}
		if (prop_info.usage & PROPERTY_USAGE_CATEGORY) {
			current_category = prop_info.name;
			current_group = "";

			continue;
		}
		if (!(prop_info.usage & PROPERTY_USAGE_EDITOR)) {
			continue;
		}
		if (!(current_category + "/" + current_group).begins_with(get_inspector_path())) {
			if (current_category.ends_with(".gd")) {
				String section_path = inspector_path;
				section_path = section_path.replace(section_path.split("/")[0] + "/", "");
				if (!current_group.begins_with(section_path)) {
					continue;

Review comment (suggestion):
```suggestion
void EditorInspectorSection::_collect_properties(LocalVector<String> &r_properties) const {
```

Code after:
			if (should_unfold) {
				unfold();
			} else {
				fold();
			}
		}
	}

	Ref<InputEventMouseButton> mb = p_event;
	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
		Vector2 pos = mb->get_position();

		if (object->editor_is_section_unfolded(section)) {
			int header_height = _get_header_height();

			if (pos.y >= header_height) {
				return;
			}
		}

		accept_event();

		if (checkable && check_rect.has_point(pos)) {
			checked = !checked;
			emit_signal(SNAME("section_toggled_by_user"), related_enable_property, checked);
			if (checked) {
				unfold();
			} else if (!checkbox_only) {
				vbox->hide();
			}
		} else if (keying && keying_rect.has_point(pos)) {
			emit_signal(SNAME("property_keyed"), related_enable_property, false);
		} else if (foldable) {
			bool should_unfold = can_click_unfold && !object->editor_is_section_unfolded(section);
			if (should_unfold) {
				unfold();
			} else {
				fold();
			}
		}
	} else if ((!checkable || checked) && !inspector_path.is_empty() && mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
		accept_event();
		_update_popup();
		menu->set_position(get_screen_position() + get_local_mouse_position());
		menu->reset_size();
		menu->popup();
	} else if (mb.is_valid() && !mb->is_pressed()) {
		queue_redraw();
	}
}