Blender  V3.3
space_spreadsheet.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <cstring>
4 
5 #include "BLI_listbase.h"
6 
7 #include "BKE_lib_remap.h"
8 #include "BKE_screen.h"
9 
10 #include "ED_screen.h"
11 #include "ED_space_api.h"
12 #include "ED_spreadsheet.h"
13 
14 #include "DNA_scene_types.h"
15 #include "DNA_screen_types.h"
16 #include "DNA_space_types.h"
17 
18 #include "MEM_guardedalloc.h"
19 
20 #include "UI_interface.h"
21 #include "UI_resources.h"
22 #include "UI_view2d.h"
23 
24 #include "DEG_depsgraph_query.h"
25 
26 #include "RNA_access.h"
27 
28 #include "WM_api.h"
29 #include "WM_types.h"
30 
31 #include "BLT_translation.h"
32 
33 #include "BLF_api.h"
34 
35 #include "spreadsheet_context.hh"
38 #include "spreadsheet_intern.hh"
39 #include "spreadsheet_layout.hh"
42 
43 using namespace blender;
44 using namespace blender::ed::spreadsheet;
45 
47 {
48  SpaceSpreadsheet *spreadsheet_space = MEM_cnew<SpaceSpreadsheet>("spreadsheet space");
49  spreadsheet_space->spacetype = SPACE_SPREADSHEET;
50 
51  spreadsheet_space->filter_flag = SPREADSHEET_FILTER_ENABLE;
52 
53  {
54  /* Header. */
55  ARegion *region = MEM_cnew<ARegion>("spreadsheet header");
56  BLI_addtail(&spreadsheet_space->regionbase, region);
57  region->regiontype = RGN_TYPE_HEADER;
59  }
60 
61  {
62  /* Footer. */
63  ARegion *region = MEM_cnew<ARegion>("spreadsheet footer region");
64  BLI_addtail(&spreadsheet_space->regionbase, region);
65  region->regiontype = RGN_TYPE_FOOTER;
67  }
68 
69  {
70  /* Dataset Region */
71  ARegion *region = MEM_cnew<ARegion>("spreadsheet dataset region");
72  BLI_addtail(&spreadsheet_space->regionbase, region);
73  region->regiontype = RGN_TYPE_TOOLS;
74  region->alignment = RGN_ALIGN_LEFT;
75  }
76 
77  {
78  /* Properties region. */
79  ARegion *region = MEM_cnew<ARegion>("spreadsheet right region");
80  BLI_addtail(&spreadsheet_space->regionbase, region);
81  region->regiontype = RGN_TYPE_UI;
82  region->alignment = RGN_ALIGN_RIGHT;
83  region->flag = RGN_FLAG_HIDDEN;
84  }
85 
86  {
87  /* Main window. */
88  ARegion *region = MEM_cnew<ARegion>("spreadsheet main region");
89  BLI_addtail(&spreadsheet_space->regionbase, region);
90  region->regiontype = RGN_TYPE_WINDOW;
91  }
92 
93  return (SpaceLink *)spreadsheet_space;
94 }
95 
96 static void spreadsheet_free(SpaceLink *sl)
97 {
98  SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
99 
100  MEM_delete(sspreadsheet->runtime);
101 
102  LISTBASE_FOREACH_MUTABLE (SpreadsheetRowFilter *, row_filter, &sspreadsheet->row_filters) {
103  spreadsheet_row_filter_free(row_filter);
104  }
105  LISTBASE_FOREACH_MUTABLE (SpreadsheetColumn *, column, &sspreadsheet->columns) {
106  spreadsheet_column_free(column);
107  }
110  }
111 }
112 
114 {
115  SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)area->spacedata.first;
116  if (sspreadsheet->runtime == nullptr) {
117  sspreadsheet->runtime = MEM_new<SpaceSpreadsheet_Runtime>(__func__);
118  }
119 }
120 
122 {
123  const SpaceSpreadsheet *sspreadsheet_old = (SpaceSpreadsheet *)sl;
124  SpaceSpreadsheet *sspreadsheet_new = (SpaceSpreadsheet *)MEM_dupallocN(sspreadsheet_old);
125  if (sspreadsheet_old->runtime) {
126  sspreadsheet_new->runtime = MEM_new<SpaceSpreadsheet_Runtime>(__func__,
127  *sspreadsheet_old->runtime);
128  }
129  else {
130  sspreadsheet_new->runtime = MEM_new<SpaceSpreadsheet_Runtime>(__func__);
131  }
132 
133  BLI_listbase_clear(&sspreadsheet_new->row_filters);
134  LISTBASE_FOREACH (const SpreadsheetRowFilter *, src_filter, &sspreadsheet_old->row_filters) {
135  SpreadsheetRowFilter *new_filter = spreadsheet_row_filter_copy(src_filter);
136  BLI_addtail(&sspreadsheet_new->row_filters, new_filter);
137  }
138  BLI_listbase_clear(&sspreadsheet_new->columns);
139  LISTBASE_FOREACH (SpreadsheetColumn *, src_column, &sspreadsheet_old->columns) {
140  SpreadsheetColumn *new_column = spreadsheet_column_copy(src_column);
141  BLI_addtail(&sspreadsheet_new->columns, new_column);
142  }
143 
144  BLI_listbase_clear(&sspreadsheet_new->context_path);
145  LISTBASE_FOREACH_MUTABLE (SpreadsheetContext *, src_context, &sspreadsheet_old->context_path) {
146  SpreadsheetContext *new_context = spreadsheet_context_copy(src_context);
147  BLI_addtail(&sspreadsheet_new->context_path, new_context);
148  }
149 
150  return (SpaceLink *)sspreadsheet_new;
151 }
152 
153 static void spreadsheet_keymap(wmKeyConfig *keyconf)
154 {
155  /* Entire editor only. */
156  WM_keymap_ensure(keyconf, "Spreadsheet Generic", SPACE_SPREADSHEET, 0);
157 }
158 
160  SpaceLink *slink,
161  const IDRemapper *mappings)
162 {
163  SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)slink;
165  if (context->type != SPREADSHEET_CONTEXT_OBJECT) {
166  continue;
167  }
169 
170  if (object_context->object != nullptr && GS(object_context->object->id.name) != ID_OB) {
171  object_context->object = nullptr;
172  continue;
173  }
174 
175  BKE_id_remapper_apply(mappings, ((ID **)&object_context->object), ID_REMAP_APPLY_DEFAULT);
176  }
177 }
178 
180 {
184  region->v2d.keeptot = V2D_KEEPTOT_STRICT;
185  region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
186 
187  UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
188 
189  {
190  wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "View2D Buttons List", 0, 0);
191  WM_event_add_keymap_handler(&region->handlers, keymap);
192  }
193  {
194  wmKeyMap *keymap = WM_keymap_ensure(
195  wm->defaultconf, "Spreadsheet Generic", SPACE_SPREADSHEET, 0);
196  WM_event_add_keymap_handler(&region->handlers, keymap);
197  }
198 }
199 
201 {
202  if (BLI_listbase_is_empty(&sspreadsheet->context_path)) {
203  return nullptr;
204  }
205  SpreadsheetContext *root_context = (SpreadsheetContext *)sspreadsheet->context_path.first;
206  if (root_context->type != SPREADSHEET_CONTEXT_OBJECT) {
207  return nullptr;
208  }
209  SpreadsheetContextObject *object_context = (SpreadsheetContextObject *)root_context;
210  return (ID *)object_context->object;
211 }
212 
213 /* Check if the pinned context still exists. If it doesn't try to find a new context. */
215 {
217  Main *bmain = CTX_data_main(C);
218  if (!ED_spreadsheet_context_path_exists(bmain, sspreadsheet)) {
219  ED_spreadsheet_context_path_guess(C, sspreadsheet);
220  if (ED_spreadsheet_context_path_update_tag(sspreadsheet)) {
222  }
223  }
224 
225  if (BLI_listbase_is_empty(&sspreadsheet->context_path)) {
226  /* Don't pin empty context_path, that could be annoying. */
227  sspreadsheet->flag &= ~SPREADSHEET_FLAG_PINNED;
228  }
229 }
230 
232 {
234  if (!ED_spreadsheet_context_path_is_active(C, sspreadsheet)) {
235  ED_spreadsheet_context_path_guess(C, sspreadsheet);
236  if (ED_spreadsheet_context_path_update_tag(sspreadsheet)) {
238  }
239  }
240 }
241 
243 {
245  if (sspreadsheet->flag & SPREADSHEET_FLAG_PINNED) {
247  }
248  else {
250  }
251 }
252 
254  const Depsgraph *depsgraph)
255 {
256  ID *used_id = ED_spreadsheet_get_current_id(sspreadsheet);
257  if (used_id == nullptr) {
258  return nullptr;
259  }
260  const ID_Type id_type = GS(used_id->name);
261  if (id_type != ID_OB) {
262  return nullptr;
263  }
264  Object *object_orig = (Object *)used_id;
265  if (!ELEM(object_orig->type,
266  OB_MESH,
268  OB_VOLUME,
270  OB_FONT,
271  OB_CURVES)) {
272  return nullptr;
273  }
274 
275  Object *object_eval = DEG_get_evaluated_object(depsgraph, object_orig);
276  if (object_eval == nullptr) {
277  return nullptr;
278  }
279 
280  return object_eval;
281 }
282 
283 static std::unique_ptr<DataSource> get_data_source(const bContext *C)
284 {
287 
288  Object *object_eval = spreadsheet_get_object_eval(sspreadsheet, depsgraph);
289  if (object_eval) {
290  return data_source_from_geometry(C, object_eval);
291  }
292  return {};
293 }
294 
295 static float get_default_column_width(const ColumnValues &values)
296 {
297  if (values.default_width > 0.0f) {
298  return values.default_width;
299  }
300  static const float float_width = 3;
301  switch (values.type()) {
303  return 2.0f;
306  return float_width;
308  return float_width;
310  return 2.0f * float_width;
312  return 3.0f * float_width;
315  return 4.0f * float_width;
317  return 8.0f;
319  return 5.0f;
321  return 2.0f;
322  }
323  return float_width;
324 }
325 
326 static float get_column_width(const ColumnValues &values)
327 {
328  float data_width = get_default_column_width(values);
329  const int fontid = UI_style_get()->widget.uifont_id;
330  BLF_size(fontid, UI_DEFAULT_TEXT_POINTS, U.dpi);
331  const StringRefNull name = values.name();
332  const float name_width = BLF_width(fontid, name.data(), name.size());
333  return std::max<float>(name_width / UI_UNIT_X + 1.0f, data_width);
334 }
335 
336 static float get_column_width_in_pixels(const ColumnValues &values)
337 {
338  return get_column_width(values) * SPREADSHEET_WIDTH_UNIT;
339 }
340 
341 static int get_index_column_width(const int tot_rows)
342 {
343  const int fontid = UI_style_get()->widget.uifont_id;
344  BLF_size(fontid, UI_style_get_dpi()->widget.points * U.pixelsize, U.dpi);
345  return std::to_string(std::max(0, tot_rows - 1)).size() * BLF_width(fontid, "0", 1) +
346  UI_UNIT_X * 0.75;
347 }
348 
349 static void update_visible_columns(ListBase &columns, DataSource &data_source)
350 {
351  Set<SpreadsheetColumnID> used_ids;
352  LISTBASE_FOREACH_MUTABLE (SpreadsheetColumn *, column, &columns) {
353  std::unique_ptr<ColumnValues> values = data_source.get_column_values(*column->id);
354  /* Remove columns that don't exist anymore. */
355  if (!values) {
356  BLI_remlink(&columns, column);
357  spreadsheet_column_free(column);
358  continue;
359  }
360 
361  if (!used_ids.add(*column->id)) {
362  /* Remove duplicate columns for now. */
363  BLI_remlink(&columns, column);
364  spreadsheet_column_free(column);
365  continue;
366  }
367  }
368 
369  data_source.foreach_default_column_ids(
370  [&](const SpreadsheetColumnID &column_id, const bool is_extra) {
371  std::unique_ptr<ColumnValues> values = data_source.get_column_values(column_id);
372  if (values) {
373  if (used_ids.add(column_id)) {
374  SpreadsheetColumnID *new_id = spreadsheet_column_id_copy(&column_id);
375  SpreadsheetColumn *new_column = spreadsheet_column_new(new_id);
376  if (is_extra) {
377  BLI_addhead(&columns, new_column);
378  }
379  else {
380  BLI_addtail(&columns, new_column);
381  }
382  }
383  }
384  });
385 }
386 
387 static void spreadsheet_main_region_draw(const bContext *C, ARegion *region)
388 {
390  sspreadsheet->runtime->cache.set_all_unused();
392 
393  std::unique_ptr<DataSource> data_source = get_data_source(C);
394  if (!data_source) {
395  data_source = std::make_unique<DataSource>();
396  }
397 
398  update_visible_columns(sspreadsheet->columns, *data_source);
399 
400  SpreadsheetLayout spreadsheet_layout;
401  ResourceScope scope;
402 
403  LISTBASE_FOREACH (SpreadsheetColumn *, column, &sspreadsheet->columns) {
404  std::unique_ptr<ColumnValues> values_ptr = data_source->get_column_values(*column->id);
405  /* Should have been removed before if it does not exist anymore. */
406  BLI_assert(values_ptr);
407  const ColumnValues *values = scope.add(std::move(values_ptr));
408  const int width = get_column_width_in_pixels(*values);
409  spreadsheet_layout.columns.append({values, width});
410 
411  spreadsheet_column_assign_runtime_data(column, values->type(), values->name());
412  }
413 
414  const int tot_rows = data_source->tot_rows();
415  spreadsheet_layout.index_column_width = get_index_column_width(tot_rows);
416  spreadsheet_layout.row_indices = spreadsheet_filter_rows(
417  *sspreadsheet, spreadsheet_layout, *data_source, scope);
418 
419  sspreadsheet->runtime->tot_columns = spreadsheet_layout.columns.size();
420  sspreadsheet->runtime->tot_rows = tot_rows;
421  sspreadsheet->runtime->visible_rows = spreadsheet_layout.row_indices.size();
422 
423  std::unique_ptr<SpreadsheetDrawer> drawer = spreadsheet_drawer_from_layout(spreadsheet_layout);
424  draw_spreadsheet_in_region(C, region, *drawer);
425 
426  /* Tag other regions for redraw, because the main region updates data for them. */
428  ED_region_tag_redraw(footer);
430  ED_region_tag_redraw(sidebar);
431 
432  /* Free all cache items that have not been used. */
433  sspreadsheet->runtime->cache.remove_all_unused();
434 }
435 
437 {
438  ARegion *region = params->region;
439  wmNotifier *wmn = params->notifier;
440 
441  switch (wmn->category) {
442  case NC_SCENE: {
443  switch (wmn->data) {
444  case ND_MODE:
445  case ND_FRAME:
446  case ND_OB_ACTIVE: {
447  ED_region_tag_redraw(region);
448  break;
449  }
450  }
451  break;
452  }
453  case NC_OBJECT: {
454  ED_region_tag_redraw(region);
455  break;
456  }
457  case NC_SPACE: {
458  if (wmn->data == ND_SPACE_SPREADSHEET) {
459  ED_region_tag_redraw(region);
460  }
461  break;
462  }
463  case NC_TEXTURE:
464  case NC_GEOM: {
465  ED_region_tag_redraw(region);
466  break;
467  }
468  }
469 }
470 
472 {
473  ED_region_header_init(region);
474 }
475 
476 static void spreadsheet_header_region_draw(const bContext *C, ARegion *region)
477 {
479  ED_region_header(C, region);
480 }
481 
483 {
484 }
485 
487 {
488  ARegion *region = params->region;
489  wmNotifier *wmn = params->notifier;
490 
491  switch (wmn->category) {
492  case NC_SCENE: {
493  switch (wmn->data) {
494  case ND_MODE:
495  case ND_OB_ACTIVE: {
496  ED_region_tag_redraw(region);
497  break;
498  }
499  }
500  break;
501  }
502  case NC_OBJECT: {
503  ED_region_tag_redraw(region);
504  break;
505  }
506  case NC_SPACE: {
507  if (wmn->data == ND_SPACE_SPREADSHEET) {
508  ED_region_tag_redraw(region);
509  }
510  break;
511  }
512  case NC_GEOM: {
513  ED_region_tag_redraw(region);
514  break;
515  }
516  }
517 }
518 
520 {
521  ED_region_header_init(region);
522 }
523 
524 static void spreadsheet_footer_region_draw(const bContext *C, ARegion *region)
525 {
527  SpaceSpreadsheet_Runtime *runtime = sspreadsheet->runtime;
528  std::stringstream ss;
529  ss << "Rows: ";
530  if (runtime->visible_rows != runtime->tot_rows) {
531  char visible_rows_str[16];
532  BLI_str_format_int_grouped(visible_rows_str, runtime->visible_rows);
533  ss << visible_rows_str << " / ";
534  }
535  char tot_rows_str[16];
536  BLI_str_format_int_grouped(tot_rows_str, runtime->tot_rows);
537  ss << tot_rows_str << " | Columns: " << runtime->tot_columns;
538  std::string stats_str = ss.str();
539 
541 
542  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
543  const uiStyle *style = UI_style_get_dpi();
544  uiLayout *layout = UI_block_layout(block,
548  region->winy - (region->winy - UI_UNIT_Y) / 2.0f,
549  region->winx,
550  1,
551  0,
552  style);
553  uiItemSpacer(layout);
555  uiItemL(layout, stats_str.c_str(), ICON_NONE);
556  UI_block_layout_resolve(block, nullptr, nullptr);
557  UI_block_align_end(block);
558  UI_block_end(C, block);
559  UI_block_draw(C, block);
560 }
561 
563 {
564 }
565 
567 {
568 }
569 
571 {
572  ARegion *region = params->region;
573  wmNotifier *wmn = params->notifier;
574 
575  switch (wmn->category) {
576  case NC_SCENE: {
577  switch (wmn->data) {
578  case ND_FRAME:
579  ED_region_tag_redraw(region);
580  break;
581  }
582  break;
583  }
584  case NC_TEXTURE:
585  ED_region_tag_redraw(region);
586  break;
587  }
588 
590 }
591 
592 static void spreadsheet_dataset_region_draw(const bContext *C, ARegion *region)
593 {
595  ED_region_panels(C, region);
596 }
597 
599 {
600  UI_panel_category_active_set_default(region, "Filters");
601  ED_region_panels_init(wm, region);
602 
603  wmKeyMap *keymap = WM_keymap_ensure(
604  wm->defaultconf, "Spreadsheet Generic", SPACE_SPREADSHEET, 0);
605  WM_event_add_keymap_handler(&region->handlers, keymap);
606 }
607 
609 {
610 }
611 
613 {
614 }
615 
617 {
618  SpaceType *st = MEM_cnew<SpaceType>("spacetype spreadsheet");
619  ARegionType *art;
620 
621  st->spaceid = SPACE_SPREADSHEET;
622  strncpy(st->name, "Spreadsheet", BKE_ST_MAXNAME);
623 
624  st->create = spreadsheet_create;
625  st->free = spreadsheet_free;
626  st->init = spreadsheet_init;
627  st->duplicate = spreadsheet_duplicate;
628  st->operatortypes = spreadsheet_operatortypes;
629  st->keymap = spreadsheet_keymap;
630  st->id_remap = spreadsheet_id_remap;
631 
632  /* regions: main window */
633  art = MEM_cnew<ARegionType>("spacetype spreadsheet region");
634  art->regionid = RGN_TYPE_WINDOW;
636 
640  BLI_addhead(&st->regiontypes, art);
641 
642  /* regions: header */
643  art = MEM_cnew<ARegionType>("spacetype spreadsheet header region");
644  art->regionid = RGN_TYPE_HEADER;
645  art->prefsizey = HEADERY;
646  art->keymapflag = 0;
648 
653  BLI_addhead(&st->regiontypes, art);
654 
655  /* regions: footer */
656  art = MEM_cnew<ARegionType>("spacetype spreadsheet footer region");
657  art->regionid = RGN_TYPE_FOOTER;
658  art->prefsizey = HEADERY;
659  art->keymapflag = 0;
661 
666  BLI_addhead(&st->regiontypes, art);
667 
668  /* regions: right panel buttons */
669  art = MEM_cnew<ARegionType>("spacetype spreadsheet right region");
670  art->regionid = RGN_TYPE_UI;
673 
679  BLI_addhead(&st->regiontypes, art);
680 
682 
683  /* regions: channels */
684  art = MEM_cnew<ARegionType>("spreadsheet dataset region");
685  art->regionid = RGN_TYPE_TOOLS;
686  art->prefsizex = 150 + V2D_SCROLL_WIDTH;
687  art->keymapflag = ED_KEYMAP_UI;
692  BLI_addhead(&st->regiontypes, art);
693 
695 }
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct SpaceSpreadsheet * CTX_wm_space_spreadsheet(const bContext *C)
Definition: context.c:941
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
@ ID_REMAP_APPLY_DEFAULT
IDRemapperApplyResult BKE_id_remapper_apply(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options)
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
#define BKE_ST_MAXNAME
Definition: BKE_screen.h:53
void BKE_spacetype_register(struct SpaceType *st)
Definition: screen.c:391
float BLF_width(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:688
void BLF_size(int fontid, float size, int dpi)
Definition: blf.c:363
#define BLI_assert(a)
Definition: BLI_assert.h:46
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:60
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
size_t BLI_str_format_int_grouped(char dst[16], int num) ATTR_NONNULL()
Definition: string.c:1114
#define UNUSED(x)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
ID_Type
Definition: DNA_ID_enums.h:44
@ ID_OB
Definition: DNA_ID_enums.h:47
@ OB_FONT
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
#define HEADERY
@ RGN_FLAG_HIDDEN
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ SPREADSHEET_CONTEXT_OBJECT
@ SPACE_SPREADSHEET
@ SPREADSHEET_FILTER_ENABLE
@ SPREADSHEET_VALUE_TYPE_INT8
@ SPREADSHEET_VALUE_TYPE_FLOAT
@ SPREADSHEET_VALUE_TYPE_BYTE_COLOR
@ SPREADSHEET_VALUE_TYPE_UNKNOWN
@ SPREADSHEET_VALUE_TYPE_FLOAT3
@ SPREADSHEET_VALUE_TYPE_BOOL
@ SPREADSHEET_VALUE_TYPE_STRING
@ SPREADSHEET_VALUE_TYPE_INT32
@ SPREADSHEET_VALUE_TYPE_FLOAT2
@ SPREADSHEET_VALUE_TYPE_COLOR
@ SPREADSHEET_VALUE_TYPE_INSTANCES
#define SPREADSHEET_WIDTH_UNIT
@ SPREADSHEET_FLAG_PINNED
@ USER_HEADER_BOTTOM
@ V2D_KEEPTOT_STRICT
@ V2D_LIMITZOOM
@ V2D_LOCKZOOM_X
@ V2D_KEEPASPECT
@ V2D_LOCKZOOM_Y
@ V2D_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
@ V2D_ALIGN_NO_NEG_X
@ V2D_ALIGN_NO_POS_Y
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
@ ED_KEYMAP_UI
Definition: ED_screen.h:691
@ ED_KEYMAP_HEADER
Definition: ED_screen.h:697
@ ED_KEYMAP_VIEW2D
Definition: ED_screen.h:694
@ ED_KEYMAP_FRAMES
Definition: ED_screen.h:696
void ED_region_header(const struct bContext *C, struct ARegion *region)
void ED_region_panels(const struct bContext *C, struct ARegion *region)
void ED_region_panels_draw(const struct bContext *C, struct ARegion *region)
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region)
Definition: area.c:3153
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
void ED_region_header_init(struct ARegion *region)
Definition: area.c:3417
void ED_region_panels_layout(const struct bContext *C, struct ARegion *region)
bool ED_spreadsheet_context_path_update_tag(struct SpaceSpreadsheet *sspreadsheet)
bool ED_spreadsheet_context_path_is_active(const struct bContext *C, struct SpaceSpreadsheet *sspreadsheet)
bool ED_spreadsheet_context_path_exists(struct Main *bmain, struct SpaceSpreadsheet *sspreadsheet)
void ED_spreadsheet_context_path_guess(const struct bContext *C, struct SpaceSpreadsheet *sspreadsheet)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
@ UI_LAYOUT_ALIGN_RIGHT
@ UI_LAYOUT_HORIZONTAL
void UI_panel_category_active_set_default(struct ARegion *region, const char *idname)
#define UI_UNIT_Y
#define UI_SIDEBAR_PANEL_WIDTH
Definition: UI_interface.h:242
@ UI_EMBOSS
Definition: UI_interface.h:108
const struct uiStyle * UI_style_get_dpi(void)
void uiItemL(uiLayout *layout, const char *name, int icon)
const struct uiStyle * UI_style_get(void)
@ UI_LAYOUT_HEADER
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
#define UI_HEADER_OFFSET
void UI_block_end(const struct bContext *C, uiBlock *block)
void uiItemSpacer(uiLayout *layout)
void UI_block_draw(const struct bContext *C, struct uiBlock *block)
uiLayout * UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, const struct uiStyle *style)
uiBlock * UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, eUIEmbossType emboss)
void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y)
#define UI_DEFAULT_TEXT_POINTS
Definition: UI_interface.h:235
#define UI_UNIT_X
void UI_block_align_end(uiBlock *block)
Definition: interface.cc:3923
@ TH_BACK
Definition: UI_resources.h:39
void UI_ThemeClearColor(int colorid)
Definition: resources.c:1448
void UI_view2d_region_reinit(struct View2D *v2d, short type, int winx, int winy)
Definition: view2d.cc:217
#define V2D_SCROLL_WIDTH
Definition: UI_view2d.h:55
@ V2D_COMMONVIEW_LIST
Definition: UI_view2d.h:38
#define NC_GEOM
Definition: WM_types.h:343
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define ND_MODE
Definition: WM_types.h:393
#define NC_SCENE
Definition: WM_types.h:328
#define ND_FRAME
Definition: WM_types.h:382
#define NC_TEXTURE
Definition: WM_types.h:331
#define ND_SPACE_SPREADSHEET
Definition: WM_types.h:484
#define NC_OBJECT
Definition: WM_types.h:329
#define NC_SPACE
Definition: WM_types.h:342
unsigned int U
Definition: btGjkEpa3.h:78
int64_t size() const
T * add(std::unique_ptr< T > resource)
bool add(const Key &key)
Definition: BLI_set.hh:253
constexpr int64_t size() const
constexpr const char * data() const
eSpreadsheetColumnValueType type() const
virtual void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)>) const
virtual std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &) const
Scene scene
const Depsgraph * depsgraph
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition: iris.c:225
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
static void area(int d1, int d2, int e1, int e2, float weights[2])
SpreadsheetContext * spreadsheet_context_copy(const SpreadsheetContext *old_context)
void spreadsheet_context_free(SpreadsheetContext *context)
IndexMask spreadsheet_filter_rows(const SpaceSpreadsheet &sspreadsheet, const SpreadsheetLayout &spreadsheet_layout, const DataSource &data_source, ResourceScope &scope)
void draw_spreadsheet_in_region(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer)
SpreadsheetRowFilter * spreadsheet_row_filter_copy(const SpreadsheetRowFilter *src_row_filter)
std::unique_ptr< DataSource > data_source_from_geometry(const bContext *C, Object *object_eval)
void spreadsheet_column_free(SpreadsheetColumn *column)
std::unique_ptr< SpreadsheetDrawer > spreadsheet_drawer_from_layout(const SpreadsheetLayout &spreadsheet_layout)
void spreadsheet_row_filter_free(SpreadsheetRowFilter *row_filter)
void spreadsheet_column_assign_runtime_data(SpreadsheetColumn *column, const eSpreadsheetColumnValueType data_type, const StringRefNull display_name)
void spreadsheet_data_set_region_panels_register(ARegionType &region_type)
SpreadsheetColumn * spreadsheet_column_copy(const SpreadsheetColumn *src_column)
std::string to_string(const T &n)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
static std::unique_ptr< DataSource > get_data_source(const bContext *C)
static void spreadsheet_free(SpaceLink *sl)
static void spreadsheet_init(wmWindowManager *UNUSED(wm), ScrArea *area)
static void spreadsheet_keymap(wmKeyConfig *keyconf)
static void spreadsheet_right_region_listener(const wmRegionListenerParams *UNUSED(params))
static int get_index_column_width(const int tot_rows)
void spreadsheet_update_context_path(const bContext *C)
static void spreadsheet_footer_region_listener(const wmRegionListenerParams *UNUSED(params))
static void spreadsheet_header_region_listener(const wmRegionListenerParams *params)
static void spreadsheet_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
static void spreadsheet_main_region_init(wmWindowManager *wm, ARegion *region)
ID * ED_spreadsheet_get_current_id(const struct SpaceSpreadsheet *sspreadsheet)
static void spreadsheet_sidebar_init(wmWindowManager *wm, ARegion *region)
void ED_spacetype_spreadsheet()
static void spreadsheet_footer_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
static void spreadsheet_main_region_draw(const bContext *C, ARegion *region)
static void spreadsheet_dataset_region_draw(const bContext *C, ARegion *region)
Object * spreadsheet_get_object_eval(const SpaceSpreadsheet *sspreadsheet, const Depsgraph *depsgraph)
static void spreadsheet_footer_region_free(ARegion *UNUSED(region))
static void spreadsheet_dataset_region_listener(const wmRegionListenerParams *params)
static SpaceLink * spreadsheet_duplicate(SpaceLink *sl)
static float get_column_width_in_pixels(const ColumnValues &values)
static float get_column_width(const ColumnValues &values)
static float get_default_column_width(const ColumnValues &values)
static SpaceLink * spreadsheet_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
static void spreadsheet_footer_region_draw(const bContext *C, ARegion *region)
static void update_context_path_from_context(const bContext *C)
static void spreadsheet_header_region_draw(const bContext *C, ARegion *region)
static void spreadsheet_header_region_free(ARegion *UNUSED(region))
static void spreadsheet_main_region_listener(const wmRegionListenerParams *params)
static void update_visible_columns(ListBase &columns, DataSource &data_source)
static void spreadsheet_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, const IDRemapper *mappings)
static void spreadsheet_right_region_free(ARegion *UNUSED(region))
static void update_pinned_context_path_if_outdated(const bContext *C)
void spreadsheet_operatortypes()
void register_row_filter_panels(ARegionType &region_type)
void(* draw)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:151
void(* listener)(const wmRegionListenerParams *params)
Definition: BKE_screen.h:165
int keymapflag
Definition: BKE_screen.h:208
void(* free)(struct ARegion *)
Definition: BKE_screen.h:169
void(* layout)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:161
void(* init)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:147
ListBase handlers
short alignment
short regiontype
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
blender::ed::spreadsheet::SpreadsheetCache cache
SpaceSpreadsheet_Runtime * runtime
float minzoom
short align
short keeptot
short keepzoom
short scroll
float maxzoom
uiFontStyle widget
unsigned int data
Definition: WM_types.h:308
unsigned int category
Definition: WM_types.h:308
struct wmKeyConfig * defaultconf
float max
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852