61 for (
const auto item : columns_.items()) {
63 column_id.
name = (
char *)item.key.c_str();
71 const GSpan *values = columns_.lookup_ptr(column_id.
name);
72 if (values ==
nullptr) {
86 fn({(
char *)
"Original Index"},
false);
91 fn({(
char *)
"Original Index"},
false);
93 fn({(
char *)
"Vertices"},
false);
97 fn({(
char *)
"Original Index"},
false);
99 fn({(
char *)
"Corner Start"},
false);
100 fn({(
char *)
"Corner Size"},
false);
103 fn({(
char *)
"Vertex"},
false);
104 fn({(
char *)
"Edge"},
false);
118 if (name ==
"Original Index") {
119 const int *
data =
static_cast<const int *
>(
122 return std::make_unique<ColumnValues>(name,
129 if (name ==
"Original Index") {
130 const int *
data =
static_cast<const int *
>(
133 return std::make_unique<ColumnValues>(name,
137 if (name ==
"Vertices") {
143 if (name ==
"Original Index") {
144 const int *
data =
static_cast<const int *
>(
147 return std::make_unique<ColumnValues>(name,
151 if (name ==
"Corner Start") {
152 return std::make_unique<ColumnValues>(
155 if (name ==
"Corner Size") {
157 return std::make_unique<ColumnValues>(
159 return faces[index].size();
165 if (name ==
"Vertex") {
168 if (name ==
"Edge") {
182 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
183 if (!attributes.has_value()) {
186 if (attributes->domain_size(domain_) == 0) {
191 fn({(
char *)
"Name"},
false);
195 fn({(
char *)
"Name"},
false);
198 extra_columns_.foreach_default_column_ids(
fn);
201 if (iter.
domain != domain_) {
217 const bool is_front = iter.
name ==
".viewer";
218 fn(column_id, is_front);
222 fn({(
char *)
"Position"},
false);
223 fn({(
char *)
"Rotation"},
false);
224 fn({(
char *)
"Scale"},
false);
237 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
238 if (!attributes.has_value()) {
241 const int domain_num = attributes->domain_size(domain_);
242 if (domain_num == 0) {
246 std::lock_guard
lock{mutex_};
248 std::unique_ptr<ColumnValues> extra_column_values = extra_columns_.get_column_values(column_id);
249 if (extra_column_values) {
250 return extra_column_values;
258 Span<int> reference_handles = instances->reference_handles();
260 return std::make_unique<ColumnValues>(
263 domain_num, [reference_handles, references](
int64_t index) {
264 return references[reference_handles[index]];
269 return std::make_unique<ColumnValues>(
271 return transforms[index].location();
275 return std::make_unique<ColumnValues>(
277 return float3(math::to_euler(math::normalize(transforms[index])));
281 return std::make_unique<ColumnValues>(
283 return math::to_scale<true>(transforms[index]);
294 return std::make_unique<ColumnValues>(
296 StringRefNull name = layers[index]->name();
297 if (name.is_empty()) {
298 name = IFACE_(
"(Layer)");
300 return std::string(name);
309 *
mesh, domain_, column_id.name))
316 bke::GAttributeReader
attribute = attributes->lookup(column_id.name);
320 GVArray varray = std::move(
attribute.varray);
325 StringRefNull column_display_name = column_id.name;
326 if (column_display_name ==
".viewer") {
327 column_display_name =
"Viewer";
330 return std::make_unique<ColumnValues>(column_display_name, std::move(varray));
335 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
336 if (!attributes.has_value()) {
339 return attributes->domain_size(domain_);
347 switch (component_->type()) {
349 if (object_orig_->type !=
OB_MESH) {
382 std::lock_guard
lock{mutex_};
388 switch (component_->type()) {
392 const Mesh *mesh_eval = geometry_set_.get_mesh();
394 Mesh *mesh_orig = (
Mesh *)object_orig_->data;
400 if (orig_indices !=
nullptr) {
404 [
bm, orig_indices](
int vertex_index) ->
bool {
405 const int i_orig = orig_indices[vertex_index];
409 if (i_orig >=
bm->totvert) {
420 if (mesh_eval->verts_num ==
bm->totvert) {
424 [
bm](
int vertex_index) ->
bool {
425 const BMVert *vert = BM_vert_at_index(bm, vertex_index);
426 return BM_elem_flag_test(vert, BM_ELEM_SELECT);
438 const Curves &curves_id = *component.
get();
461std::optional<const bke::AttributeAccessor> GeometryDataSource::get_component_attributes()
const
464 return component_->attributes();
466 const GreasePencil *grease_pencil = geometry_set_.get_grease_pencil();
467 if (!grease_pencil) {
471 return grease_pencil->attributes();
473 if (layer_index_ >= 0 && layer_index_ < grease_pencil->layers().
size()) {
474 if (
const bke::greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
475 grease_pencil->layer(layer_index_)))
477 return drawing->strokes().attributes();
486 if (component_->is_empty()) {
490 for (
const char *name : {
"Grid Name",
"Data Type",
"Class"}) {
492 fn(column_id,
false);
499 const Volume *volume = component_->get();
500 if (volume ==
nullptr) {
506 if (
STREQ(column_id.
name,
"Grid Name")) {
507 return std::make_unique<ColumnValues>(
510 return volume_grid->name();
513 if (
STREQ(column_id.
name,
"Data Type")) {
514 return std::make_unique<ColumnValues>(
518 const char *name =
nullptr;
524 return std::make_unique<ColumnValues>(
527 openvdb::GridClass grid_class = volume_grid->grid_class();
528 if (grid_class == openvdb::GridClass::GRID_FOG_VOLUME) {
529 return IFACE_(
"Fog Volume");
531 if (grid_class == openvdb::GridClass::GRID_LEVEL_SET) {
532 return IFACE_(
"Level Set");
546 const Volume *volume = component_->get();
547 if (volume ==
nullptr) {
555 switch (reference.
type()) {
561 return ICON_OUTLINER_COLLECTION;
564 return ICON_GEOMETRY_SET;
614 geometry_set = *geometry_eval;
629 geometry_set = viewer_log->geometry;
647 if (instance_id.reference_index < 0 || instance_id.reference_index >= references.
size()) {
671 if (!geometry_set.
has(component_type)) {
676 return std::make_unique<VolumeDataSource>(std::move(geometry_set));
681 return std::make_unique<GeometryDataSource>(
682 object_orig, std::move(geometry_set), component_type, domain, active_layer_index);
SpaceSpreadsheet * CTX_wm_space_spreadsheet(const bContext *C)
Low-level operations for curves.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
Low-level operations for grease pencil.
void * BKE_id_new_nomain(short type, const char *name)
void BKE_mesh_wrapper_ensure_mdata(Mesh *mesh)
Mesh * BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval)
int BKE_volume_num_grids(const Volume *volume)
const blender::bke::VolumeGridData * BKE_volume_grid_get(const Volume *volume, int grid_index)
#define BLI_assert_unreachable()
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
Object * DEG_get_original_object(Object *object)
ID and Library types, which are fundamental for SDNA.
@ SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL
int ED_outliner_icon_from_id(const ID &id)
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 Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture 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 &mesh, const CustomData_MeshMasks *cd_mask_extra)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static GVArray ForSpan(GSpan span)
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
constexpr int64_t size() const
constexpr const char * data() const
static VArray ForSpan(Span< T > values)
static VArray ForFunc(const int64_t size, GetFunc get_func)
GVArray adapt_domain(const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
const Curves * get() const
const GreasePencil * get() const
void to_geometry_set(GeometrySet &r_geometry_set) const
const Instances * get() const
Span< InstanceReference > references() const
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
IndexMask apply_selection_filter(IndexMaskMemory &memory) 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
void foreach_default_column_ids(FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn) const override
int tot_rows() const override
std::unique_ptr< ColumnValues > get_column_values(const SpreadsheetColumnID &column_id) const override
static const ViewerNodeLog * find_viewer_node_log_for_path(const ViewerPath &viewer_path)
bool attribute_name_is_anonymous(const StringRef name)
bool allow_procedural_attribute_access(StringRef attribute_name)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
bke::GeometrySet get_geometry_set_for_instance_ids(const bke::GeometrySet &root_geometry, const Span< SpreadsheetInstanceID > instance_ids)
bke::GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *sspreadsheet, Object *object_eval)
int get_instance_reference_icon(const bke::InstanceReference &reference)
std::unique_ptr< DataSource > data_source_from_geometry(const bContext *C, Object *object_eval)
static void add_mesh_debug_column_names(const Mesh &mesh, const bke::AttrDomain domain, FunctionRef< void(const SpreadsheetColumnID &, bool is_extra)> fn)
static std::unique_ptr< ColumnValues > build_mesh_debug_columns(const Mesh &mesh, const bke::AttrDomain domain, const StringRef name)
GPU_SHADER_INTERFACE_INFO(overlay_edit_curve_handle_iface, "vert").flat(Type pos vertex_in(1, Type::UINT, "data") .vertex_out(overlay_edit_curve_handle_iface) .geometry_layout(PrimitiveIn Frequency::GEOMETRY storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) .push_constant(Type Frequency::GEOMETRY selection[]
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
const EnumPropertyItem rna_enum_volume_grid_data_type_items[]
MeshRuntimeHandle * runtime
ObjectRuntimeHandle * runtime
SpreadsheetInstanceID * instance_ids
uint8_t object_eval_state
uint8_t geometry_component_type
bool has(const GeometryComponent::Type component_type) const
void replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)