The main goal of this patch is that the column widths and ordering is not reset every time one switches between different contexts. It does that by keeping track of multiple `SpreadsheetTable`. There is one for each table that is viewed (so e.g. the point and edge domain of the same mesh are two different tables). Each table has an identifier and an array of columns. There is some garbage collection in place so that the number of stored tables does not increase unbounded. This also comes with an updated Python API: ```python import bpy spreadsheet = bpy.context.screen.areas[...].spaces.active active_table = spreadsheet.tables.active print(active_table.id.type) print(active_table.id.attribute_domain) print(active_table.columns[0].id.name) ``` In the future, we might add some smarter logic to keep tables with different identifiers more in sync. We don't have a great heuristic for that yet. Pull Request: https://projects.blender.org/blender/blender/pulls/139205
19 lines
463 B
C++
19 lines
463 B
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
struct ID;
|
|
struct SpaceSpreadsheet;
|
|
struct SpreadsheetTable;
|
|
|
|
namespace blender::ed::spreadsheet {
|
|
|
|
ID *get_current_id(const SpaceSpreadsheet *sspreadsheet);
|
|
|
|
SpreadsheetTable *get_active_table(SpaceSpreadsheet &sspreadsheet);
|
|
const SpreadsheetTable *get_active_table(const SpaceSpreadsheet &sspreadsheet);
|
|
|
|
} // namespace blender::ed::spreadsheet
|