Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-11-03 21:45:51 +0300
committerHans Goudey <h.goudey@me.com>2021-11-03 21:45:51 +0300
commitccead2ed9c6121c42a516712da38a2faec877e2f (patch)
treeca3699abb9ba3760bbfa6831ab798b58ef34a14f /source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
parent4e5537d841e426c9d7fd731b7b6d5033c7e5fb65 (diff)
Spreadsheet: Display geometry volume component grids
This shows a geometry's volume grids in the spreadsheet. Three columns are displayed: - Name: The text name of each grid - Data type: Float, Vector, etc. - Class: Fog volume, Level Set, or unkown In the future, values of the voxels themselves could be displayed, but that is a much more complex problem, with important performance implications, etc. Differential Revision: https://developer.blender.org/D13049
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc')
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
index 4cf6d14cbda..b9a508d7764 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
@@ -20,6 +20,7 @@
#include "DNA_windowmanager_types.h"
#include "BKE_context.h"
+#include "BKE_volume.h"
#include "BLF_api.h"
@@ -48,7 +49,7 @@ static int is_component_row_selected(struct uiBut *but, const void *arg)
const bool is_domain_selected = (AttributeDomain)sspreadsheet->attribute_domain == domain;
bool is_selected = is_component_selected && is_domain_selected;
- if (component == GEO_COMPONENT_TYPE_INSTANCES) {
+ if (ELEM(component, GEO_COMPONENT_TYPE_VOLUME, GEO_COMPONENT_TYPE_INSTANCES)) {
is_selected = is_component_selected;
}
@@ -141,6 +142,14 @@ static int element_count_from_instances(const GeometrySet &geometry_set)
return 0;
}
+static int element_count_from_volume(const GeometrySet &geometry_set)
+{
+ if (const Volume *volume = geometry_set.get_volume_for_read()) {
+ return BKE_volume_num_grids(volume);
+ }
+ return 0;
+}
+
static int element_count_from_component_domain(const GeometrySet &geometry_set,
GeometryComponentType component,
AttributeDomain domain)
@@ -191,6 +200,10 @@ void DatasetRegionDrawer::draw_dataset_row(const int indentation,
BLI_str_format_attribute_domain_size(
element_count, element_count_from_instances(draw_context.current_geometry_set));
}
+ if (component == GEO_COMPONENT_TYPE_VOLUME) {
+ BLI_str_format_attribute_domain_size(
+ element_count, element_count_from_volume(draw_context.current_geometry_set));
+ }
else {
BLI_str_format_attribute_domain_size(
element_count,
@@ -237,7 +250,7 @@ void DatasetRegionDrawer::draw_dataset_row(const int indentation,
void DatasetRegionDrawer::draw_component_row(const DatasetComponentLayoutInfo &component_info)
{
- if (component_info.type == GEO_COMPONENT_TYPE_INSTANCES) {
+ if (ELEM(component_info.type, GEO_COMPONENT_TYPE_VOLUME, GEO_COMPONENT_TYPE_INSTANCES)) {
draw_dataset_row(
0, component_info.type, std::nullopt, component_info.icon, component_info.label, true);
}