51 for (
const auto item : columns_.items()) {
53 column_id.
name = (
char *)item.key.c_str();
61 const GSpan *values = columns_.lookup_ptr(column_id.
name);
62 if (values ==
nullptr) {
81 fn({(
char *)
"Name"},
false);
88 if (meta_data.
domain != domain_) {
104 fn({(
char *)
"Rotation"},
false);
105 fn({(
char *)
"Scale"},
false);
109 fn({(
char *)
"Vertex 1"},
false);
110 fn({(
char *)
"Vertex 2"},
false);
113 fn({(
char *)
"Corner Start"},
false);
114 fn({(
char *)
"Corner Size"},
false);
117 fn({(
char *)
"Vertex"},
false);
118 fn({(
char *)
"Edge"},
false);
135 std::lock_guard
lock{mutex_};
137 std::unique_ptr<ColumnValues> extra_column_values = extra_columns_.
get_column_values(column_id);
138 if (extra_column_values) {
139 return extra_column_values;
147 return std::make_unique<ColumnValues>(
150 [reference_handles, references](
int64_t index) {
151 return references[reference_handles[index]];
156 return std::make_unique<ColumnValues>(
158 return transforms[index].to_euler();
162 return std::make_unique<ColumnValues>(
164 return transforms[index].scale();
173 return std::make_unique<ColumnValues>(
175 return mesh->medge[index].v1;
179 return std::make_unique<ColumnValues>(
181 return mesh->medge[index].v2;
186 if (
STREQ(column_id.
name,
"Corner Start")) {
187 return std::make_unique<ColumnValues>(
189 return mesh->mpoly[index].loopstart;
192 if (
STREQ(column_id.
name,
"Corner Size")) {
193 return std::make_unique<ColumnValues>(
195 return mesh->mpoly[index].totloop;
201 return std::make_unique<ColumnValues>(
203 return mesh->mloop[index].v;
207 return std::make_unique<ColumnValues>(
209 return mesh->mloop[index].e;
225 return std::make_unique<ColumnValues>(column_id.
name, std::move(varray));
240 switch (component_->
type()) {
266 std::lock_guard
lock{mutex_};
272 switch (component_->
type()) {
284 if (orig_indices !=
nullptr) {
288 [
bm, orig_indices](
int vertex_index) ->
bool {
289 const int i_orig = orig_indices[vertex_index];
302 full_range, selection, 1024,
indices);
307 VArray<bool> selection = attributes_eval.adapt_domain<
bool>(
309 [
bm](
int vertex_index) ->
bool {
310 const BMVert *vert = BM_vert_at_index(bm, vertex_index);
311 return BM_elem_flag_test(vert, BM_ELEM_SELECT);
316 full_range, selection, 2048,
indices);
341 void VolumeDataSource::foreach_default_column_ids(
344 if (component_->is_empty()) {
348 for (
const char *name : {
"Grid Name",
"Data Type",
"Class"}) {
350 fn(column_id,
false);
354 std::unique_ptr<ColumnValues> VolumeDataSource::get_column_values(
357 const Volume *volume = component_->get_for_read();
358 if (volume ==
nullptr) {
363 const int size = this->tot_rows();
364 if (
STREQ(column_id.
name,
"Grid Name")) {
365 return std::make_unique<ColumnValues>(
371 if (
STREQ(column_id.
name,
"Data Type")) {
372 return std::make_unique<ColumnValues>(
376 const char *name =
nullptr;
382 return std::make_unique<ColumnValues>(
385 openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid);
386 openvdb::GridClass grid_class = grid->getGridClass();
387 if (grid_class == openvdb::GridClass::GRID_FOG_VOLUME) {
388 return IFACE_(
"Fog Volume");
390 if (grid_class == openvdb::GridClass::GRID_LEVEL_SET) {
391 return IFACE_(
"Level Set");
403 int VolumeDataSource::tot_rows()
const
405 const Volume *volume = component_->get_for_read();
406 if (volume ==
nullptr) {
452 if (
mesh ==
nullptr) {
469 if (node_log !=
nullptr) {
473 const GeometrySet *full_geometry = geo_value_log->full_geometry();
474 if (full_geometry !=
nullptr) {
475 geometry_set = *full_geometry;
499 if (node_log ==
nullptr) {
504 if (value_log ==
nullptr) {
509 const GField &field = field_value_log->field();
511 r_fields.
add(
"Viewer", std::move(field));
516 GPointer value = generic_value_log->value();
540 return this->component == other_geo->component;
562 std::make_unique<GeometryComponentCacheKey>(
component));
566 for (
const auto item : fields_to_show.
items()) {
568 const GField &field = item.value;
571 GArray<> &evaluated_array = cache.
arrays.lookup_or_add_cb({domain, field}, [&]() {
576 field_evaluator.add_with_destination(field, evaluated_array);
577 field_evaluator.evaluate();
578 return evaluated_array;
581 r_extra_columns.
add(name, evaluated_array.
as_span());
592 if (!geometry_set.
has(component_type)) {
601 return std::make_unique<VolumeDataSource>(std::move(geometry_set));
603 return std::make_unique<GeometryDataSource>(
604 object_eval, std::move(geometry_set), component_type, domain, std::move(extra_columns));
struct SpaceSpreadsheet * CTX_wm_space_spreadsheet(const bContext *C)
Low-level operations for curves.
void * CustomData_get_layer(const struct CustomData *data, int type)
@ GEO_COMPONENT_TYPE_MESH
@ GEO_COMPONENT_TYPE_INSTANCES
@ GEO_COMPONENT_TYPE_CURVE
@ GEO_COMPONENT_TYPE_VOLUME
void * BKE_id_new_nomain(short type, const char *name)
void BKE_mesh_wrapper_ensure_mdata(struct Mesh *me)
struct Mesh * BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object *ob_eval)
const VolumeGrid * BKE_volume_grid_get_for_read(const struct Volume *volume, int grid_index)
VolumeGridType BKE_volume_grid_type(const struct VolumeGrid *grid)
const char * BKE_volume_grid_name(const struct VolumeGrid *grid)
int BKE_volume_num_grids(const struct Volume *volume)
#define BLI_assert_unreachable()
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static uint8 component(Color32 c, uint i)
struct Object * DEG_get_original_object(struct Object *object)
ID and Library types, which are fundamental for sdna.
@ SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE
@ SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL
_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 type
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
#define BM_elem_flag_test(ele, hflag)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *cd_mask_extra)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void replace(Curves *curve, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
virtual std::optional< blender::bke::AttributeAccessor > attributes() const
GeometryComponentType type() const
blender::Span< int > instance_reference_handles() const
blender::Span< InstanceReference > references() const
blender::MutableSpan< blender::float4x4 > instance_transforms()
void replace(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const CPPType * type() const
static GVArray ForSpan(GSpan span)
bool add(const Key &key, const Value &value)
ItemIterator items() const
constexpr const char * data() const
static VArray ForFunc(const int64_t size, GetFunc get_func)
GVArray adapt_domain(const GVArray &varray, const eAttrDomain from_domain, const eAttrDomain to_domain) const
int domain_size(const eAttrDomain domain) const
GAttributeReader lookup(const AttributeIDRef &attribute_id) const
bool for_all(const AttributeForeachCallback fn) const
bool is_anonymous() const
void add(std::string name, GSpan data)
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const
bool is_equal_to(const Key &other) const override
uint64_t hash() const override
GeometryComponentCacheKey(const GeometryComponent &component)
const GeometryComponent * component
Map< std::pair< eAttrDomain, GField >, GArray<> > arrays
IndexMask apply_selection_filter(Vector< int64_t > &indices) const
bool has_selection_filter() const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
int tot_rows() const override
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
Value & lookup_or_add(std::unique_ptr< Key > key, FunctionRef< std::unique_ptr< Value >()> create_value)
const CPPType & cpp_type() const
static const NodeLog * find_node_by_spreadsheet_editor_context(const SpaceSpreadsheet &sspreadsheet)
Span< SocketLog > input_logs() const
ccl_gpu_kernel_postfix int ccl_global int * indices
static int domain_num(const CurvesGeometry &curves, const eAttrDomain domain)
bool allow_procedural_attribute_access(StringRef attribute_name)
AttributeAccessor mesh_attributes(const Mesh &mesh)
static IndexMask retrieve_selected_points(const CurvesGeometry &curves, const eAttrDomain domain, Vector< int64_t > &r_indices)
static IndexMask retrieve_selected_curves(const CurvesGeometry &curves, const eAttrDomain domain, Vector< int64_t > &r_indices)
GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *sspreadsheet, Object *object_eval)
std::unique_ptr< DataSource > data_source_from_geometry(const bContext *C, Object *object_eval)
static void find_fields_to_evaluate(const SpaceSpreadsheet *sspreadsheet, Map< std::string, GField > &r_fields)
static void add_fields_as_extra_columns(SpaceSpreadsheet *sspreadsheet, const GeometryComponent &component, ExtraColumns &r_extra_columns)
GField make_constant_field(const CPPType &type, const void *value)
IndexMask find_indices_from_virtual_array(IndexMask indices_to_check, const VArray< bool > &virtual_array, int64_t parallel_grain_size, Vector< int64_t > &r_indices)
uint64_t get_default_hash(const T &v)
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
const EnumPropertyItem rna_enum_volume_grid_data_type_items[]
unsigned __int64 uint64_t
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
bool has(const GeometryComponentType component_type) const
const GeometryComponent * get_component_for_read(GeometryComponentType component_type) const
const Mesh * get_mesh_for_read() const
struct BMEditMesh * edit_mesh
struct GeometrySet * geometry_set_eval
blender::ed::spreadsheet::SpreadsheetCache cache
uint8_t object_eval_state
uint8_t geometry_component_type
SpaceSpreadsheet_Runtime * runtime