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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 574c4e98819..9e8e9030925 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -25,6 +25,8 @@
#include "BLT_translation.h"
+#include "BKE_attribute.h"
+#include "BKE_geometry_set.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_movieclip.h"
@@ -2991,6 +2993,48 @@ static void rna_SpaceSpreadsheet_pinned_id_set(PointerRNA *ptr,
sspreadsheet->pinned_id = value.data;
}
+static void rna_SpaceSpreadsheet_geometry_component_type_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)ptr->data;
+ if (sspreadsheet->geometry_component_type == GEO_COMPONENT_TYPE_POINT_CLOUD) {
+ sspreadsheet->attribute_domain = ATTR_DOMAIN_POINT;
+ }
+}
+
+const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)ptr->data;
+ EnumPropertyItem *item_array = NULL;
+ int items_len = 0;
+ for (const EnumPropertyItem *item = rna_enum_attribute_domain_items; item->identifier != NULL;
+ item++) {
+ if (sspreadsheet->geometry_component_type == GEO_COMPONENT_TYPE_MESH) {
+ if (!ELEM(item->value,
+ ATTR_DOMAIN_CORNER,
+ ATTR_DOMAIN_EDGE,
+ ATTR_DOMAIN_POINT,
+ ATTR_DOMAIN_POLYGON)) {
+ continue;
+ }
+ }
+ if (sspreadsheet->geometry_component_type == GEO_COMPONENT_TYPE_POINT_CLOUD) {
+ if (item->value != ATTR_DOMAIN_POINT) {
+ continue;
+ }
+ }
+ RNA_enum_item_add(&item_array, &items_len, item);
+ }
+ RNA_enum_item_end(&item_array, &items_len);
+
+ *r_free = true;
+ return item_array;
+}
+
#else
static const EnumPropertyItem dt_uv_items[] = {
@@ -7196,6 +7240,20 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna)
PropertyRNA *prop;
StructRNA *srna;
+ static const EnumPropertyItem geometry_component_type_items[] = {
+ {GEO_COMPONENT_TYPE_MESH,
+ "MESH",
+ ICON_MESH_DATA,
+ "Mesh",
+ "Mesh component containing point, corner, edge and polygon data"},
+ {GEO_COMPONENT_TYPE_POINT_CLOUD,
+ "POINTCLOUD",
+ ICON_POINTCLOUD_DATA,
+ "Point Cloud",
+ "Point cloud component containing only point data"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "SpaceSpreadsheet", "Space");
RNA_def_struct_ui_text(srna, "Space Spreadsheet", "Spreadsheet space data");
@@ -7210,6 +7268,20 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Show Only Selected", "Only include rows that correspond to selected elements");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL);
+
+ prop = RNA_def_property(srna, "geometry_component_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, geometry_component_type_items);
+ RNA_def_property_ui_text(
+ prop, "Geometry Component", "Part of the geometry to display data from");
+ RNA_def_property_update(prop,
+ NC_SPACE | ND_SPACE_SPREADSHEET,
+ "rna_SpaceSpreadsheet_geometry_component_type_update");
+
+ prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceSpreadsheet_attribute_domain_itemf");
+ RNA_def_property_ui_text(prop, "Attribute Domain", "Attribute domain to display");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL);
}
void RNA_def_space(BlenderRNA *brna)