Blender V5.3
spreadsheet_data_source_geometry.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <fmt/format.h>
6
7#include "BLI_listbase.hh"
8#include "BLI_math_matrix.hh"
10
11#include "BKE_attribute.hh"
12#include "BKE_context.hh"
13#include "BKE_curves.hh"
14#include "BKE_editmesh.hh"
16#include "BKE_geometry_set.hh"
18#include "BKE_global.hh"
19#include "BKE_grease_pencil.hh"
20#include "BKE_instances.hh"
21#include "BKE_lib_id.hh"
22#include "BKE_mesh.hh"
23#include "BKE_mesh_wrapper.hh"
24#include "BKE_modifier.hh"
25#include "BKE_object_types.hh"
26#include "BKE_volume.hh"
27#include "BKE_volume_grid.hh"
28
30#include "DNA_space_types.h"
31
33
34#include "ED_curves.hh"
35#include "ED_outliner.hh"
36
37#include "NOD_eval_log.hh"
41
42#include "BLT_translation.hh"
43
44#include "RNA_access.hh"
45#include "RNA_enum_types.hh"
46
47#include "UI_resources.hh"
48
49#include "bmesh.hh"
50
52#include "spreadsheet_intern.hh"
53
54namespace blender {
55
56uint64_t SpreadsheetInstanceID::hash() const
57{
59}
60
62{
63 return a.reference_index == b.reference_index;
64}
65
67{
68 return !(a == b);
69}
70
72{
73 return STREQ(a.identifier, b.identifier);
74}
75
77{
78 return !(a == b);
79}
80
81namespace ed::spreadsheet {
82
84 const Mesh &mesh,
85 const bke::AttrDomain domain,
86 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn)
87{
88 switch (domain) {
90 if (CustomData_has_layer(&mesh.vert_data, CD_ORIGINDEX)) {
91 fn({const_cast<char *>("Original Index")}, false);
92 }
93 if (CustomData_has_layer(&mesh.vert_data, CD_ORCO)) {
94 fn({const_cast<char *>("CD_ORCO")}, false);
95 }
96 if (CustomData_has_layer(&mesh.vert_data, CD_CLOTH_ORCO)) {
97 fn({const_cast<char *>("CD_CLOTH_ORCO")}, false);
98 }
99 break;
101 if (CustomData_has_layer(&mesh.edge_data, CD_ORIGINDEX)) {
102 fn({const_cast<char *>("Original Index")}, false);
103 }
104 break;
106 if (CustomData_has_layer(&mesh.face_data, CD_ORIGINDEX)) {
107 fn({const_cast<char *>("Original Index")}, false);
108 }
109 fn({const_cast<char *>("Corner Start")}, false);
110 fn({const_cast<char *>("Corner Size")}, false);
111 break;
113 if (CustomData_has_layer(&mesh.corner_data, CD_ORIGSPACE_MLOOP)) {
114 fn({const_cast<char *>("CD_ORIGSPACE_MLOOP")}, false);
115 }
116 break;
117 default:
119 break;
120 }
121}
122
123static std::unique_ptr<ColumnValues> build_mesh_debug_columns(const Mesh &mesh,
124 const bke::AttrDomain domain,
125 const StringRef name)
126{
127 switch (domain) {
129 if (name == "Original Index") {
130 const int *data = static_cast<const int *>(
132 if (data) {
133 return std::make_unique<ColumnValues>(name,
134 VArray<int>::from_span({data, mesh.verts_num}));
135 }
136 }
137 if (name == "CD_ORCO") {
138 const float3 *data = static_cast<const float3 *>(
139 CustomData_get_layer(&mesh.vert_data, CD_ORCO));
140 if (data) {
141 return std::make_unique<ColumnValues>(name,
142 VArray<float3>::from_span({data, mesh.verts_num}));
143 }
144 }
145 if (name == "CD_CLOTH_ORCO") {
146 const float3 *data = static_cast<const float3 *>(
148 if (data) {
149 return std::make_unique<ColumnValues>(name,
150 VArray<float3>::from_span({data, mesh.verts_num}));
151 }
152 }
153 return {};
154 }
156 if (name == "Original Index") {
157 const int *data = static_cast<const int *>(
159 if (data) {
160 return std::make_unique<ColumnValues>(name,
161 VArray<int>::from_span({data, mesh.edges_num}));
162 }
163 }
164 return {};
165 }
167 if (name == "Original Index") {
168 const int *data = static_cast<const int *>(
170 if (data) {
171 return std::make_unique<ColumnValues>(name,
172 VArray<int>::from_span({data, mesh.faces_num}));
173 }
174 }
175 if (name == "Corner Start") {
176 return std::make_unique<ColumnValues>(
177 name, VArray<int>::from_span(mesh.face_offsets().drop_back(1)));
178 }
179 if (name == "Corner Size") {
180 const OffsetIndices faces = mesh.faces();
181 return std::make_unique<ColumnValues>(
182 name, VArray<int>::from_std_func(faces.size(), [faces](int64_t index) {
183 return faces[index].size();
184 }));
185 }
186 return {};
187 }
189 if (name == "CD_ORIGSPACE_MLOOP") {
190 const float2 *data = static_cast<const float2 *>(
192 if (data) {
193 return std::make_unique<ColumnValues>(
194 name, VArray<float2>::from_span({data, mesh.corners_num}));
195 }
196 }
197 return {};
198 }
199 default:
201 return {};
202 }
203}
204
205bool GeometryDataSource::display_attribute(const StringRef name,
206 const bke::AttrDomain domain) const
207{
209 return false;
210 }
211 if (!show_internal_attributes_) {
213 return false;
214 }
215 if (domain == bke::AttrDomain::Instance && name == "instance_transform") {
216 /* Don't display the instance transform attribute, since matrix visualization in the
217 * spreadsheet isn't helpful. */
218 return false;
219 }
220 }
221 return true;
222}
223
225 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
226{
227 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
228 if (!attributes.has_value()) {
229 return;
230 }
231
232 if (component_->type() == bke::GeometryComponent::Type::Instance) {
233 fn({const_cast<char *>("Name")}, false);
234 }
235
236 if (component_->type() == bke::GeometryComponent::Type::GreasePencil) {
237 fn({const_cast<char *>("Name")}, false);
238 }
239
240 attributes->foreach_attribute([&](const bke::AttributeIter &iter) {
241 if (iter.domain != domain_) {
242 return;
243 }
244 if (!display_attribute(iter.name, iter.domain)) {
245 return;
246 }
247 SpreadsheetColumnID column_id;
248 column_id.name = const_cast<char *>(iter.name.data());
249 const bool is_front = iter.name == ".viewer";
250 fn(column_id, is_front);
251 });
252
253 if (component_->type() == bke::GeometryComponent::Type::Instance) {
254 fn({const_cast<char *>("Position")}, false);
255 fn({const_cast<char *>("Rotation")}, false);
256 fn({const_cast<char *>("Scale")}, false);
257 }
258 else if (G.debug_value == 4001 && component_->type() == bke::GeometryComponent::Type::Mesh) {
259 const bke::MeshComponent &component = static_cast<const bke::MeshComponent &>(*component_);
260 if (const Mesh *mesh = component.get()) {
262 }
263 }
264}
265
266std::unique_ptr<ColumnValues> GeometryDataSource::get_column_values(
267 const SpreadsheetColumnID &column_id) const
268{
269 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
270 if (!attributes.has_value()) {
271 return {};
272 }
273 const int domain_num = attributes->domain_size(domain_);
274 if (!display_attribute(column_id.name, domain_)) {
275 return {};
276 }
277
278 std::lock_guard lock{mutex_};
279
280 if (component_->type() == bke::GeometryComponent::Type::Instance) {
281 if (const bke::Instances *instances =
282 static_cast<const bke::InstancesComponent &>(*component_).get())
283 {
284 if (STREQ(column_id.name, "Name")) {
285 Span<int> reference_handles = instances->reference_handles();
286 Span<bke::InstanceReference> references = instances->references();
287 return std::make_unique<ColumnValues>(
288 column_id.name,
290 domain_num, [reference_handles, references](int64_t index) {
291 return references[reference_handles[index]];
292 }));
293 }
294 Span<float4x4> transforms = instances->transforms();
295 if (STREQ(column_id.name, "Position")) {
296 return std::make_unique<ColumnValues>(
297 column_id.name, VArray<float3>::from_std_func(domain_num, [transforms](int64_t index) {
298 return transforms[index].location();
299 }));
300 }
301 if (STREQ(column_id.name, "Rotation")) {
302 return std::make_unique<ColumnValues>(
303 column_id.name, VArray<float3>::from_std_func(domain_num, [transforms](int64_t index) {
304 return float3(math::to_euler(math::normalize(transforms[index])));
305 }));
306 }
307 if (STREQ(column_id.name, "Scale")) {
308 return std::make_unique<ColumnValues>(
309 column_id.name, VArray<float3>::from_std_func(domain_num, [transforms](int64_t index) {
310 return math::to_scale<true>(transforms[index]);
311 }));
312 }
313 }
314 }
315 else if (component_->type() == bke::GeometryComponent::Type::GreasePencil) {
316 if (const GreasePencil *grease_pencil =
317 static_cast<const bke::GreasePencilComponent &>(*component_).get())
318 {
319 if (domain_ == bke::AttrDomain::Layer && STREQ(column_id.name, "Name")) {
321 return std::make_unique<ColumnValues>(
322 column_id.name,
323 VArray<std::string>::from_std_func(domain_num, [layers](int64_t index) {
324 StringRefNull name = layers[index]->name();
325 if (name.is_empty()) {
326 name = IFACE_("(Layer)");
327 }
328 return std::string(name);
329 }));
330 }
331 }
332 }
333 else if (G.debug_value == 4001 && component_->type() == bke::GeometryComponent::Type::Mesh) {
334 const bke::MeshComponent &component = static_cast<const bke::MeshComponent &>(*component_);
335 if (const Mesh *mesh = component.get()) {
336 if (std::unique_ptr<ColumnValues> values = build_mesh_debug_columns(
337 *mesh, domain_, column_id.name))
338 {
339 return values;
340 }
341 }
342 }
343
344 bke::GAttributeReader attribute = attributes->lookup(column_id.name);
345 if (!attribute) {
346 return {};
347 }
348 GVArray varray = std::move(attribute.varray);
349 if (attribute.domain != domain_) {
350 return {};
351 }
352
353 StringRefNull column_display_name = column_id.name;
354 if (column_display_name == ".viewer") {
355 column_display_name = "Viewer";
356 }
357
358 StringRef description;
359 if (varray.is_single()) {
360 description = TIP_("Stored as single value");
361 }
362
363 return std::make_unique<ColumnValues>(column_display_name, std::move(varray), description);
364}
365
367{
368 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
369 if (!attributes.has_value()) {
370 return {};
371 }
372 return attributes->domain_size(domain_);
373}
374
376{
377 if (!object_orig_) {
378 return false;
379 }
380 switch (component_->type()) {
382 if (object_orig_->type != OB_MESH) {
383 return false;
384 }
385 if (object_orig_->mode != OB_MODE_EDIT) {
386 return false;
387 }
388 return true;
389 }
391 if (object_orig_->type != OB_CURVES) {
392 return false;
393 }
394 if (!ELEM(object_orig_->mode, OB_MODE_SCULPT_CURVES, OB_MODE_EDIT)) {
395 return false;
396 }
397 return true;
398 }
400 if (object_orig_->type != OB_POINTCLOUD) {
401 return false;
402 }
403 if (object_orig_->mode != OB_MODE_EDIT) {
404 return false;
405 }
406 return true;
407 }
408 default:
409 return false;
410 }
411}
412
414 const Mesh &mesh_orig,
415 LinearAllocator<> &memory)
416{
417 const bke::AttributeAccessor attributes_eval = mesh_eval.attributes();
418 const IndexRange range(attributes_eval.domain_size(bke::AttrDomain::Face));
419 BMesh *bm = const_cast<BMesh *>(BKE_editmesh_bmesh_get(&mesh_orig));
420
422 if (mesh_eval.faces_num == bm->totface) {
423 return IndexMask::from_predicate(range, memory, [&](const int i) {
424 const BMFace *face = BM_face_at_index(bm, i);
426 });
427 }
428 if (const int *orig_indices = static_cast<const int *>(
430 {
431 return IndexMask::from_predicate(range, memory, [&](const int i) {
432 const int orig = orig_indices[i];
433 if (orig == -1) {
434 return false;
435 }
436 const BMFace *face = BM_face_at_index(bm, orig);
438 });
439 }
440 return range;
441}
442
444 const Mesh &mesh_orig,
445 const bke::AttrDomain domain,
446 LinearAllocator<> &memory)
447{
448 const bke::AttributeAccessor attributes_eval = mesh_eval.attributes();
449 const IndexRange range(attributes_eval.domain_size(domain));
450 BMesh *bm = const_cast<BMesh *>(BKE_editmesh_bmesh_get(&mesh_orig));
451
452 switch (domain) {
455 if (mesh_eval.verts_num == bm->totvert) {
456 return IndexMask::from_predicate(range, memory, [&](const int i) {
457 const BMVert *vert = BM_vert_at_index(bm, i);
459 });
460 }
461 if (const int *orig_indices = static_cast<const int *>(
463 {
464 return IndexMask::from_predicate(range, memory, [&](const int i) {
465 const int orig = orig_indices[i];
466 if (orig == -1) {
467 return false;
468 }
469 const BMVert *vert = BM_vert_at_index(bm, orig);
471 });
472 }
473 return range;
474 }
477 if (mesh_eval.edges_num == bm->totedge) {
478 return IndexMask::from_predicate(range, memory, [&](const int i) {
479 const BMEdge *edge = BM_edge_at_index(bm, i);
481 });
482 }
483 if (const int *orig_indices = static_cast<const int *>(
485 {
486 return IndexMask::from_predicate(range, memory, [&](const int i) {
487 const int orig = orig_indices[i];
488 if (orig == -1) {
489 return false;
490 }
491 const BMEdge *edge = BM_edge_at_index(bm, orig);
493 });
494 }
495 return range;
496 }
498 return calc_mesh_selection_mask_faces(mesh_eval, mesh_orig, memory);
499 }
501 IndexMaskMemory face_memory;
503 mesh_eval, mesh_orig, face_memory);
504 if (face_mask.is_empty()) {
505 return {};
506 }
507 if (face_mask.size() == range.size()) {
508 return range;
509 }
510
511 Array<bool> face_selection(range.size(), false);
512 face_mask.to_bools(face_selection);
513
514 const VArray<bool> corner_selection = attributes_eval.adapt_domain<bool>(
516 return IndexMask::from_bools(corner_selection, memory);
517 }
518 default:
520 return range;
521 }
522}
523
525{
526 std::lock_guard lock{mutex_};
527 const IndexMask full_range(this->tot_rows());
528 if (full_range.is_empty()) {
529 return full_range;
530 }
531
532 switch (component_->type()) {
534 BLI_assert(object_orig_->type == OB_MESH);
535 BLI_assert(object_orig_->mode == OB_MODE_EDIT);
536 const Mesh *mesh_eval = geometry_set_.get_mesh();
537 const Mesh *mesh_orig = id_cast<const Mesh *>(object_orig_->data);
538 return calc_mesh_selection_mask(*mesh_eval, *mesh_orig, domain_, memory);
539 }
541 BLI_assert(object_orig_->type == OB_CURVES);
542 const bke::CurveComponent &component = static_cast<const bke::CurveComponent &>(*component_);
543 const Curves &curves_id = *component.get();
544 switch (domain_) {
546 return curves::retrieve_selected_points(curves_id, memory);
548 return curves::retrieve_selected_curves(curves_id, memory);
549 default:
551 }
552 return full_range;
553 }
555 BLI_assert(object_orig_->type == OB_POINTCLOUD);
556 const bke::AttributeAccessor attributes = *component_->attributes();
557 const VArray<bool> selection = *attributes.lookup_or_default(
558 ".selection", bke::AttrDomain::Point, true);
559 return IndexMask::from_bools(selection, memory);
560 }
561 default:
562 return full_range;
563 }
564}
565
566std::optional<const bke::AttributeAccessor> GeometryDataSource::get_component_attributes() const
567{
568 if (component_->type() != bke::GeometryComponent::Type::GreasePencil) {
569 return component_->attributes();
570 }
571 const GreasePencil *grease_pencil = geometry_set_.get_grease_pencil();
572 if (!grease_pencil) {
573 return {};
574 }
575 if (domain_ == bke::AttrDomain::Layer) {
576 return grease_pencil->attributes();
577 }
578 if (layer_index_ >= 0 && layer_index_ < grease_pencil->layers().size()) {
579 if (const bke::greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
580 grease_pencil->layer(layer_index_)))
581 {
582 return drawing->strokes().attributes();
583 }
584 }
585 return {};
586}
587
589 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
590{
591 if (component_->is_empty()) {
592 return;
593 }
594
595 for (const char *name : {"Grid Name",
596 "Data Type",
597 "Class",
598 "Voxel Extent",
599 "Min Voxel",
600 "Voxels",
601 "Leaf Voxels",
602 "Tiles",
603 "Size"})
604 {
605 SpreadsheetColumnID column_id{const_cast<char *>(name)};
606 fn(column_id, false);
607 }
608}
609
610#ifdef WITH_OPENVDB
611static StringRef grid_class_name(const bke::VolumeGridData &grid_data)
612{
613 openvdb::GridClass grid_class = grid_data.grid_class();
614 if (grid_class == openvdb::GridClass::GRID_FOG_VOLUME) {
615 return IFACE_("Fog Volume");
616 }
617 if (grid_class == openvdb::GridClass::GRID_LEVEL_SET) {
618 return IFACE_("Level Set");
619 }
620 return IFACE_("Unknown");
621}
622#endif
623
624std::unique_ptr<ColumnValues> VolumeDataSource::get_column_values(
625 const SpreadsheetColumnID &column_id) const
626{
627 const Volume *volume = component_->get();
628 if (volume == nullptr) {
629 return {};
630 }
631
632#ifdef WITH_OPENVDB
633 const int size = this->tot_rows();
634 if (STREQ(column_id.name, "Grid Name")) {
635 return std::make_unique<ColumnValues>(
636 IFACE_("Grid Name"), VArray<std::string>::from_std_func(size, [volume](int64_t index) {
637 const bke::VolumeGridData *volume_grid = BKE_volume_grid_get(volume, index);
638 return volume_grid->name();
639 }));
640 }
641 if (STREQ(column_id.name, "Data Type")) {
642 return std::make_unique<ColumnValues>(
643 IFACE_("Data Type"), VArray<std::string>::from_std_func(size, [volume](int64_t index) {
644 const bke::VolumeGridData *volume_grid = BKE_volume_grid_get(volume, index);
645 const VolumeGridType type = volume_grid->grid_type();
646 const char *name = nullptr;
648 return IFACE_(name);
649 }));
650 }
651 if (STREQ(column_id.name, "Class")) {
652 return std::make_unique<ColumnValues>(
653 IFACE_("Class"), VArray<std::string>::from_std_func(size, [volume](int64_t index) {
654 return grid_class_name(*BKE_volume_grid_get(volume, index));
655 }));
656 }
657 if (STREQ(column_id.name, "Voxels")) {
658 return std::make_unique<ColumnValues>(
659 IFACE_("Voxels"), VArray<int64_t>::from_std_func(size, [volume](const int64_t index) {
660 return BKE_volume_grid_get(volume, index)->active_voxels();
661 }));
662 }
663 if (STREQ(column_id.name, "Leaf Voxels")) {
664 return std::make_unique<ColumnValues>(
665 IFACE_("Leaf Voxels"), VArray<int64_t>::from_std_func(size, [volume](const int64_t index) {
666 return BKE_volume_grid_get(volume, index)->active_leaf_voxels();
667 }));
668 }
669 if (STREQ(column_id.name, "Tiles")) {
670 return std::make_unique<ColumnValues>(
671 IFACE_("Tiles"), VArray<int64_t>::from_std_func(size, [volume](const int64_t index) {
672 return BKE_volume_grid_get(volume, index)->active_tiles();
673 }));
674 }
675 if (STREQ(column_id.name, "Size")) {
676 return std::make_unique<ColumnValues>(
677 IFACE_("Size"),
679 size,
680 [volume](const int64_t index) {
681 return BKE_volume_grid_get(volume, index)->size_in_bytes();
682 }),
683 "",
685 }
686 if (STREQ(column_id.name, "Voxel Extent")) {
687 return std::make_unique<ColumnValues>(
688 IFACE_("Voxel Extent"), VArray<int3>::from_std_func(size, [volume](const int64_t index) {
689 return int3(BKE_volume_grid_get(volume, index)->active_bounds().dim().asPointer());
690 }));
691 }
692 if (STREQ(column_id.name, "Min Voxel")) {
693 return std::make_unique<ColumnValues>(
694 IFACE_("Min Voxel"), VArray<int3>::from_std_func(size, [volume](const int64_t index) {
695 const openvdb::CoordBBox &active_bounds =
696 BKE_volume_grid_get(volume, index)->active_bounds();
697 if (active_bounds.empty()) {
698 return int3(0, 0, 0);
699 }
700 return int3(active_bounds.min().asPointer());
701 }));
702 }
703#else
704 UNUSED_VARS(column_id);
705#endif
706
707 return {};
708}
709
711{
712 const Volume *volume = component_->get();
713 if (volume == nullptr) {
714 return 0;
715 }
716 return BKE_volume_num_grids(volume);
717}
718
719#ifdef WITH_OPENVDB
720
721VolumeGridDataSource::VolumeGridDataSource(const bke::GVolumeGrid &grid)
722 : grid_(std::make_unique<bke::GVolumeGrid>(grid))
723{
724}
725
726void VolumeGridDataSource::foreach_default_column_ids(
727 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
728{
729 if (!grid_) {
730 return;
731 }
732
733 for (const char *name : {"Data Type",
734 "Class",
735 "Voxel Extent",
736 "Min Voxel",
737 "Voxels",
738 "Leaf Voxels",
739 "Tiles",
740 "Size"})
741 {
742 SpreadsheetColumnID column_id{const_cast<char *>(name)};
743 fn(column_id, false);
744 }
745}
746
747std::unique_ptr<ColumnValues> VolumeGridDataSource::get_column_values(
748 const SpreadsheetColumnID &column_id) const
749{
750 const bke::VolumeGridData &grid = grid_->get();
751 if (STREQ(column_id.name, "Data Type")) {
752 const VolumeGridType type = grid.grid_type();
753 const char *name = nullptr;
755 return std::make_unique<ColumnValues>(IFACE_("Data Type"),
757 }
758 if (STREQ(column_id.name, "Class")) {
759 const StringRef name = grid_class_name(grid_->get());
760 return std::make_unique<ColumnValues>(IFACE_("Class"),
762 }
763 if (STREQ(column_id.name, "Voxels")) {
764 const int64_t active_voxels = grid.active_voxels();
765 return std::make_unique<ColumnValues>(IFACE_("Voxels"),
766 VArray<int64_t>::from_single(active_voxels, 1));
767 }
768 if (STREQ(column_id.name, "Leaf Voxels")) {
769 const int64_t active_leaf_voxels = grid.active_leaf_voxels();
770 return std::make_unique<ColumnValues>(IFACE_("Leaf Voxels"),
771 VArray<int64_t>::from_single(active_leaf_voxels, 1));
772 }
773 if (STREQ(column_id.name, "Tiles")) {
774 const int64_t active_tiles = grid.active_tiles();
775 return std::make_unique<ColumnValues>(IFACE_("Tiles"),
776 VArray<int64_t>::from_single(active_tiles, 1));
777 }
778 if (STREQ(column_id.name, "Size")) {
779 const int64_t size = grid.size_in_bytes();
780 return std::make_unique<ColumnValues>(
782 }
783 if (STREQ(column_id.name, "Voxel Extent")) {
784 const int3 extent = int3(grid.active_bounds().dim().asPointer());
785 return std::make_unique<ColumnValues>(IFACE_("Voxel Extent"),
786 VArray<int3>::from_single(extent, 1));
787 }
788 if (STREQ(column_id.name, "Min Voxel")) {
789 const openvdb::CoordBBox &active_bounds = grid.active_bounds();
790 if (active_bounds.empty()) {
791 return std::make_unique<ColumnValues>(IFACE_("Min Voxel"),
792 VArray<int3>::from_single(int3(0, 0, 0), 1));
793 }
794 const int3 min = int3(active_bounds.min().asPointer());
795 return std::make_unique<ColumnValues>(IFACE_("Min Voxel"), VArray<int3>::from_single(min, 1));
796 }
797 return {};
798}
799
800int VolumeGridDataSource::tot_rows() const
801{
802 return 1;
803}
804
805#endif
806
808
810 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
811{
812 if (!list_ || list_->size() == 0) {
813 return;
814 }
815
816 for (const char *name : {"Value"}) {
817 SpreadsheetColumnID column_id{const_cast<char *>(name)};
818 fn(column_id, false);
819 }
820}
821
822std::unique_ptr<ColumnValues> ListDataSource::get_column_values(
823 const SpreadsheetColumnID &column_id) const
824{
825 if (!list_) {
826 return {};
827 }
828 if (STREQ(column_id.name, "Value")) {
829 return std::make_unique<ColumnValues>(IFACE_("Value"), list_->varray());
830 }
831 return {};
832}
833
835{
836 if (!list_) {
837 return 0;
838 }
839 return list_->size();
840}
841
842BundleDataSource::BundleDataSource(nodes::BundlePtr bundle) : bundle_(std::move(bundle))
843{
844 this->collect_flat_items(*bundle_, "");
845}
846
848 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
849{
850 if (bundle_->is_empty()) {
851 return;
852 }
853
854 for (const char *name : {"Identifier", "Type", "Value"}) {
855 SpreadsheetColumnID column_id{const_cast<char *>(name)};
856 fn(column_id, false);
857 }
858}
859
860std::unique_ptr<ColumnValues> BundleDataSource::get_column_values(
861 const SpreadsheetColumnID &column_id) const
862{
863 if (STREQ(column_id.name, "Identifier")) {
864 return std::make_unique<ColumnValues>(IFACE_("Identifier"),
865 VArray<std::string>::from_span(flat_item_keys_));
866 }
867 if (STREQ(column_id.name, "Type")) {
868 return std::make_unique<ColumnValues>(
869 IFACE_("Type"),
871 flat_items_.size(), [items = flat_items_](int64_t index) -> std::string {
872 const nodes::BundleItemValue &value = *items[index];
873 if (const auto *socket_value = std::get_if<nodes::BundleItemSocketValue>(
874 &value.value)) {
875 const bke::SocketValueVariant &value_variant = socket_value->value;
876 const StringRef type_name = IFACE_(socket_value->type->label);
877 if (value_variant.is_single()) {
878 return type_name;
879 }
880 if (value_variant.is_context_dependent_field()) {
881 return fmt::format("{} {}", type_name, IFACE_("Field"));
882 }
883 if (value_variant.is_volume_grid()) {
884 return fmt::format("{} {}", type_name, IFACE_("Grid"));
885 }
886 if (value_variant.is_list()) {
887 return fmt::format("{} {}", type_name, IFACE_("List"));
888 }
889 return type_name;
890 }
891 if (const auto *internal_value = std::get_if<nodes::BundleItemInternalValue>(
892 &value.value)) {
893 return internal_value->value->type_name();
894 }
895 return "";
896 }));
897 }
898 if (STREQ(column_id.name, "Value")) {
899 return std::make_unique<ColumnValues>(
900 IFACE_("Value"),
902 flat_items_.size(),
903 [items = flat_items_](const int64_t index) -> nodes::BundleItemValue {
904 return *items[index];
905 }));
906 }
907 return {};
908}
909
911{
912 return flat_item_keys_.size();
913}
914
915void BundleDataSource::collect_flat_items(const nodes::Bundle &bundle, const StringRef parent_path)
916{
917 for (const auto &item : bundle.items()) {
918 const std::string path = parent_path.is_empty() ?
919 item.key.ustr().string() :
920 nodes::Bundle::combine_path({parent_path, item.key.ustr().ref()});
921 flat_item_keys_.append(path);
922 flat_items_.append(&item.value);
923 if (const auto *value = std::get_if<nodes::BundleItemSocketValue>(&item.value.value)) {
924 if (value->value.is_single()) {
925 const GPointer ptr = value->value.get();
926 if (ptr.is_type<nodes::BundlePtr>()) {
927 const nodes::BundlePtr child_bundle = *ptr.get<nodes::BundlePtr>();
928 if (child_bundle) {
929 this->collect_flat_items(*child_bundle, path);
930 }
931 }
932 }
933 }
934 }
935}
936
939 : closure_(std::move(closure)), in_out_(in_out)
940{
941}
942
944 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
945{
946 Vector<StringRefNull> columns_names;
947 if (in_out_ == SPREADSHEET_CLOSURE_NONE) {
948 columns_names.append("Interface");
949 }
950 columns_names.extend({"Identifier", "Type"});
951
952 for (const StringRefNull name : columns_names) {
953 SpreadsheetColumnID column_id{const_cast<char *>(name.c_str())};
954 fn(column_id, false);
955 }
956}
957
959 const SpreadsheetColumnID &column_id) const
960{
961 const Span<nodes::ClosureSignature::Item> input_items = closure_->signature().inputs;
962 const Span<nodes::ClosureSignature::Item> output_items = closure_->signature().outputs;
963
964 switch (in_out_) {
966 const int items_sum = input_items.size() + output_items.size();
967 if (STREQ(column_id.name, "Identifier")) {
968 return std::make_unique<ColumnValues>(
969 IFACE_("Identifier"),
971 [input_items, output_items](const int64_t index) {
972 if (index < input_items.size()) {
973 return input_items[index].key;
974 }
975 return output_items[index - input_items.size()].key;
976 }));
977 }
978 if (STREQ(column_id.name, "Type")) {
979 return std::make_unique<ColumnValues>(
980 IFACE_("Type"),
982 items_sum, [input_items, output_items](const int64_t index) {
983 if (index < input_items.size()) {
984 return input_items[index].type->label;
985 }
986 return output_items[index - input_items.size()].type->label;
987 }));
988 }
989 if (STREQ(column_id.name, "Interface")) {
990 return std::make_unique<ColumnValues>(
991 IFACE_("Interface"),
993 [inputs_num = input_items.size()](const int64_t index) {
994 if (index < inputs_num) {
995 return IFACE_("Input");
996 }
997 return IFACE_("Output");
998 }));
999 }
1000 break;
1001 }
1005 input_items :
1006 output_items;
1007 if (STREQ(column_id.name, "Identifier")) {
1008 return std::make_unique<ColumnValues>(
1009 IFACE_("Identifier"),
1011 [items](int64_t index) { return items[index].key; }));
1012 }
1013 if (STREQ(column_id.name, "Type")) {
1014 return std::make_unique<ColumnValues>(
1015 IFACE_("Type"), VArray<std::string>::from_func(items.size(), [items](int64_t index) {
1016 return items[index].type->label;
1017 }));
1018 }
1019 break;
1020 }
1021 }
1022 return {};
1023}
1024
1026{
1027 const int inputs_num = closure_->signature().inputs.size();
1028 const int outputs_num = closure_->signature().outputs.size();
1029 switch (in_out_) {
1031 return inputs_num + outputs_num;
1033 return inputs_num;
1035 return outputs_num;
1036 }
1037 return 0;
1038}
1039
1041 : value_gvarray_(GVArray::from_single(*value.type(), 1, value.get()))
1042{
1043}
1044
1046 FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn) const
1047{
1048 for (const char *name : {"Value"}) {
1049 SpreadsheetColumnID column_id{const_cast<char *>(name)};
1050 fn(column_id, false);
1051 }
1052}
1053
1054std::unique_ptr<ColumnValues> SingleValueDataSource::get_column_values(
1055 const SpreadsheetColumnID &column_id) const
1056{
1057 if (STREQ(column_id.name, "Value")) {
1058 return std::make_unique<ColumnValues>(IFACE_("Value"), value_gvarray_);
1059 }
1060 return {};
1061}
1062
1064{
1065 return 1;
1066}
1067
1069{
1070 switch (reference.type()) {
1072 const Object &object = reference.object();
1073 return ED_outliner_icon_from_id(object.id);
1074 }
1076 return ICON_OUTLINER_COLLECTION;
1077 }
1079 return ICON_GEOMETRY_SET;
1080 }
1082 break;
1083 }
1084 }
1085 return ICON_NONE;
1086}
1087
1093
1096{
1097 if (!bundle) {
1098 return {};
1099 }
1100 if (path.bundle_path_num == 0) {
1101 return bke::SocketValueVariant::from(bundle);
1102 }
1104 for (const int i : IndexRange(path.bundle_path_num)) {
1105 if (const std::optional<nodes::BundleKey> key = nodes::BundleKey::from_str(
1106 path.bundle_path[i].identifier))
1107 {
1108 keys.append(*key);
1109 }
1110 else {
1111 return {};
1112 }
1113 }
1114 return bundle->lookup_path<bke::SocketValueVariant>(keys).value_or(bke::SocketValueVariant{});
1115}
1116
1118 Object *object_eval)
1119{
1121 const Object *object_orig = DEG_get_original(object_eval);
1122 if (object_orig->type == OB_MESH) {
1123 const Mesh *mesh = id_cast<const Mesh *>(object_orig->data);
1124 if (object_orig->mode == OB_MODE_EDIT) {
1125 if (const BMesh *bm = BKE_editmesh_bmesh_get(mesh)) {
1126 Mesh *new_mesh = BKE_id_new_nomain<Mesh>(nullptr);
1127 /* This is a potentially heavy operation to do on every redraw. The best solution here
1128 * is to display the data directly from the bmesh without a conversion, which can be
1129 * implemented a bit later. */
1130 BM_mesh_bm_to_me_for_eval(const_cast<BMesh &>(*bm), *new_mesh, nullptr);
1132 }
1133 }
1134 else {
1137 }
1138 }
1139 else if (object_orig->type == OB_POINTCLOUD) {
1140 const PointCloud *pointcloud = id_cast<const PointCloud *>(object_orig->data);
1143 }
1144 else if (object_orig->type == OB_CURVES) {
1145 const Curves &curves_id = *id_cast<const Curves *>(object_orig->data);
1147 &const_cast<Curves &>(curves_id), bke::GeometryOwnershipType::ReadOnly));
1148 }
1149 else if (object_orig->type == OB_GREASE_PENCIL) {
1150 const GreasePencil &grease_pencil = *id_cast<const GreasePencil *>(object_orig->data);
1153 }
1154 return {};
1155 }
1156
1157 if (sspreadsheet->geometry_id.viewer_path.path.is_single()) {
1159 }
1160
1161 const nodes::eval_log::ViewerNodeLog *viewer_log =
1163 sspreadsheet->geometry_id.viewer_path);
1164 if (!viewer_log) {
1165 return {};
1166 }
1167
1168 const SpreadsheetTableIDGeometry &table_id = sspreadsheet->geometry_id;
1169 const int item_index = viewer_log->items.index_of_try_as(table_id.viewer_item_identifier);
1170 if (item_index == -1) {
1171 return {};
1172 }
1173
1174 bke::SocketValueVariant value = viewer_log->items[item_index].value;
1175
1176 /* Try to display the previous geometry instead of the value is a field (it will have been
1177 * evaluated on that geometry). */
1178 if (value.is_context_dependent_field()) {
1179 for (int i = item_index - 1; i >= 0; i--) {
1180 const bke::SocketValueVariant &prev_value = viewer_log->items[i].value;
1181 if (!prev_value.is_single()) {
1182 continue;
1183 }
1184 const GPointer prev_ptr = prev_value.get();
1185 if (!prev_ptr.is_type<bke::GeometrySet>()) {
1186 continue;
1187 }
1188 return prev_value;
1189 }
1190 return {};
1191 }
1192
1193 if (value.is_single()) {
1194 const GPointer ptr = value.get();
1195 if (!ptr.is_type<nodes::BundlePtr>()) {
1196 return value;
1197 }
1198 const nodes::BundlePtr &bundle = *ptr.get<nodes::BundlePtr>();
1199 return lookup_bundle_path(bundle, table_id.viewer_item_bundle_path);
1200 }
1201 if (value.is_list()) {
1202 return value;
1203 }
1204 if (value.is_volume_grid()) {
1205 return value;
1206 }
1207 return {};
1208}
1209
1210std::optional<bke::GeometrySet> root_geometry_set_get(const SpaceSpreadsheet *sspreadsheet,
1211 Object *object_eval)
1212{
1213 bke::SocketValueVariant display_data = root_display_data_get(sspreadsheet, object_eval);
1214 if (!display_data.is_single()) {
1215 return std::nullopt;
1216 }
1217 const GPointer ptr = display_data.get();
1218 if (!ptr.is_type<bke::GeometrySet>()) {
1219 return std::nullopt;
1220 }
1221 return std::move(*display_data.get_if<bke::GeometrySet>());
1222}
1223
1225 const Span<SpreadsheetInstanceID> instance_ids)
1226{
1227 bke::GeometrySet geometry = root_geometry;
1228 for (const SpreadsheetInstanceID &instance_id : instance_ids) {
1229 const bke::Instances *instances = geometry.get_instances();
1230 if (!instances) {
1231 /* Return the best available geometry. */
1232 return geometry;
1233 }
1234 const Span<bke::InstanceReference> references = instances->references();
1235 if (instance_id.reference_index < 0 || instance_id.reference_index >= references.size()) {
1236 /* Return the best available geometry. */
1237 return geometry;
1238 }
1239 const bke::InstanceReference &reference = references[instance_id.reference_index];
1240 bke::GeometrySet reference_geometry;
1241 reference.to_geometry_set(reference_geometry);
1242 geometry = reference_geometry;
1243 }
1244 return geometry;
1245}
1246
1247static std::unique_ptr<DataSource> data_source_from_socket_value(
1248 const bke::SocketValueVariant &value, const SpreadsheetClosureInputOutput closure_inout)
1249{
1250 if (value.is_context_dependent_field()) {
1251 return {};
1252 }
1253#ifdef WITH_OPENVDB
1254 if (value.is_volume_grid()) {
1255 return std::make_unique<VolumeGridDataSource>(*value.get().get<bke::GVolumeGrid>());
1256 }
1257#endif
1258 if (value.is_list()) {
1259 return std::make_unique<ListDataSource>(*value.get().get<nodes::GListPtr>());
1260 }
1261 if (value.is_single()) {
1262 const GPointer ptr = value.get();
1263 if (ptr.is_type<nodes::BundlePtr>()) {
1264 const nodes::BundlePtr bundle_ptr = *value.get().get<nodes::BundlePtr>();
1265 if (bundle_ptr) {
1266 return std::make_unique<BundleDataSource>(bundle_ptr);
1267 }
1268 return {};
1269 }
1270 if (ptr.is_type<nodes::ClosurePtr>()) {
1271 const nodes::ClosurePtr closure_ptr = *value.get().get<nodes::ClosurePtr>();
1272 if (closure_ptr) {
1273 return std::make_unique<ClosureSignatureDataSource>(closure_ptr, closure_inout);
1274 }
1275 return {};
1276 }
1277 const eSpreadsheetColumnValueType column_type = cpp_type_to_column_type(*ptr.type());
1278 if (column_type == SPREADSHEET_VALUE_TYPE_UNKNOWN) {
1279 return {};
1280 }
1281 return std::make_unique<SingleValueDataSource>(ptr);
1282 }
1283 return {};
1284}
1285
1286static std::unique_ptr<DataSource> data_source_from_geometry(
1288 const SpreadsheetTableIDGeometry &geometry_id,
1289 Object *object_eval,
1290 const bool show_internal_attributes)
1291{
1292 switch (SpreadsheetGeometryItemType(geometry_id.geometry_item_type)) {
1294 const bke::AttrDomain domain = (bke::AttrDomain)geometry_id.attribute_domain;
1295 const auto component_type = bke::GeometryComponent::Type(
1296 geometry_id.geometry_component_type);
1297 const int layer_index = geometry_id.layer_index;
1298 if (!geometry.has(component_type)) {
1299 return {};
1300 }
1301 if (component_type == bke::GeometryComponent::Type::Volume) {
1302 return std::make_unique<VolumeDataSource>(std::move(geometry));
1303 }
1304 Object *object_orig = geometry_id.instance_ids_num == 0 ? DEG_get_original(object_eval) :
1305 nullptr;
1306 return std::make_unique<GeometryDataSource>(object_orig,
1307 std::move(geometry),
1308 component_type,
1309 domain,
1310 show_internal_attributes,
1311 layer_index);
1312 }
1314 const nodes::BundlePtr &bundle_ptr = geometry.bundle_ptr();
1316 geometry_id.geometry_bundle_path);
1318 value,
1320 }
1321 }
1322 return {};
1323}
1324
1325std::unique_ptr<DataSource> data_source_from_geometry(const bContext *C, Object *object_eval)
1326{
1328 bke::SocketValueVariant root_data = root_display_data_get(sspreadsheet, object_eval);
1329
1330 if (root_data.is_single()) {
1331 const GPointer ptr = root_data.get();
1332 if (ptr.is_type<bke::GeometrySet>()) {
1333 const bke::GeometrySet &root_geometry_set = *ptr.get<bke::GeometrySet>();
1335 root_geometry_set,
1336 Span{sspreadsheet->geometry_id.instance_ids,
1337 sspreadsheet->geometry_id.instance_ids_num});
1338 return data_source_from_geometry(std::move(geometry_set),
1339 sspreadsheet->geometry_id,
1340 object_eval,
1341 sspreadsheet->flag &
1343 }
1344 }
1346 root_data,
1349}
1350
1351} // namespace ed::spreadsheet
1352} // namespace blender
Low-level operations for curves.
Low-level operations for grease pencil.
Volume data-block.
#define TIP_(msgid)
#define IFACE_(msgid)
#define C
Definition RandGen.cpp:29
volatile int lock
#define BLI_assert_unreachable()
#define UNUSED_VARS(...)
#define ELEM(...)
#define STREQ(a, b)
#define BM_elem_flag_test_bool(ele, hflag)
const CPPType * type() const
const void * get() const
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
constexpr int64_t size() const
constexpr IndexRange()=default
constexpr int64_t size() const
Definition BLI_span.hh:256
static VArray from_std_func(const int64_t size, std::function< T(int64_t index)> get_func)
static VArray from_single(T value, const int64_t size)
static VArray from_func(const int64_t size, GetFunc get_func)
static VArray from_span(Span< T > values)
void append(const T &value)
void extend(Span< T > array)
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
GVArray adapt_domain(const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const
int domain_size(const AttrDomain domain) const
void to_geometry_set(GeometrySet &r_geometry_set) const
Definition instances.cc:115
Span< InstanceReference > references() const
Definition instances.cc:290
static SocketValueVariant from(T &&value)
constexpr bool is_empty() const
constexpr const char * data() const
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
ClosureSignatureDataSource(nodes::ClosurePtr closure, SpreadsheetClosureInputOutput in_out)
IndexMask apply_selection_filter(LinearAllocator<> &memory) const
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
void to_bools(MutableSpan< bool > r_bools) const
static std::optional< BundleKey > from_str(StringRef key)
static std::string combine_path(Span< StringRef > path)
const BundleItemValue * lookup_path(Span< BundleKey > path) const
BundleItemMap::ItemIterator items() const
static const ViewerNodeLog * find_viewer_node_log_for_path(const ViewerPath &viewer_path)
Definition eval_log.cc:1065
CustomIDVectorSet< Item, ItemIdentifierGetter > items
#define instance_id
#define attribute(slot)
bool operator==(const Error &left, const Error &right)
bool attribute_name_is_anonymous(const StringRef name)
bool allow_procedural_attribute_access(StringRef attribute_name)
GeometrySet object_get_evaluated_geometry_set(const Object &object, bool apply_subdiv=true)
int size(const AssetLibraryReference *library_reference)
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, LinearAllocator<> &memory)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, LinearAllocator<> &memory)
bke::SocketValueVariant root_display_data_get(const SpaceSpreadsheet *sspreadsheet, Object *object_eval)
bke::GeometrySet get_geometry_set_for_instance_ids(const bke::GeometrySet &root_geometry, const Span< SpreadsheetInstanceID > instance_ids)
static bke::SocketValueVariant lookup_bundle_path(const nodes::BundlePtr &bundle, const SpreadsheetBundleTreeViewPath &path)
int get_instance_reference_icon(const bke::InstanceReference &reference)
std::unique_ptr< DataSource > data_source_from_geometry(const bContext *C, Object *object_eval)
const nodes::eval_log::ViewerNodeLog * viewer_node_log_lookup(const SpaceSpreadsheet &sspreadsheet)
static IndexMask calc_mesh_selection_mask(const Mesh &mesh_eval, const Mesh &mesh_orig, const bke::AttrDomain domain, LinearAllocator<> &memory)
eSpreadsheetColumnValueType cpp_type_to_column_type(const CPPType &type)
static std::unique_ptr< DataSource > data_source_from_socket_value(const bke::SocketValueVariant &value, const SpreadsheetClosureInputOutput closure_inout)
static void add_mesh_debug_column_names(const Mesh &mesh, const bke::AttrDomain domain, FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn)
static IndexMask calc_mesh_selection_mask_faces(const Mesh &mesh_eval, const Mesh &mesh_orig, LinearAllocator<> &memory)
std::optional< bke::GeometrySet > root_geometry_set_get(const SpaceSpreadsheet *sspreadsheet, Object *object_eval)
static std::unique_ptr< ColumnValues > build_mesh_debug_columns(const Mesh &mesh, const bke::AttrDomain domain, const StringRef name)
ImplicitSharingPtr< Closure > ClosurePtr
ImplicitSharingPtr< Bundle > BundlePtr
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
Definition BKE_text.h:91
__int64 int64_t
Definition BKE_text.h:90
int BKE_volume_num_grids(const Volume *volume)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
bool operator!=(const CPPType &a, const CPPType &b)
@ SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL
const bke::VolumeGridData * BKE_volume_grid_get(const Volume *volume, int grid_index)
@ SPREADSHEET_FLAG_SHOW_INTERNAL_ATTRIBUTES
const EnumPropertyItem rna_enum_volume_grid_data_type_items[]
Definition rna_volume.cc:27
void BM_mesh_bm_to_me_for_eval(BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *cd_mask_extra)
@ SPREADSHEET_GEOMETRY_ITEM_TYPE_DOMAIN
@ SPREADSHEET_GEOMETRY_ITEM_TYPE_BUNDLE
Global G
Definition blender.cc:57
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
@ OB_MODE_SCULPT_CURVES
BMesh const char void * data
int ED_outliner_icon_from_id(const ID &id)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
SpreadsheetClosureInputOutput
@ SPREADSHEET_CLOSURE_OUTPUT
@ SPREADSHEET_CLOSURE_NONE
@ SPREADSHEET_CLOSURE_INPUT
void * BKE_id_new_nomain(short type, const char *name)
Definition lib_id.cc:1617
T * DEG_get_original(T *id)
const BMesh * BKE_editmesh_bmesh_get(const Object *ob)
Definition editmesh.cc:65
SpaceSpreadsheet * CTX_wm_space_spreadsheet(const bContext *C)
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
VecBase< float, 3 > float3
@ SPREADSHEET_VALUE_TYPE_UNKNOWN
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:252
#define min(a, b)
Definition sort.cc:38
CustomData face_data
CustomData edge_data
CustomData vert_data
SpreadsheetTableIDGeometry geometry_id
SpreadsheetClosureInputOutput closure_input_output
SpreadsheetBundlePathElem * bundle_path
SpreadsheetGeometryItemType geometry_item_type
SpreadsheetBundleTreeViewPath viewer_item_bundle_path
SpreadsheetBundleTreeViewPath geometry_bundle_path
ListBaseT< ViewerPathElem > path
static GeometrySet from_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)