51uint64_t SpreadsheetInstanceID::hash()
const
76 fn({(
char *)
"Original Index"},
false);
81 fn({(
char *)
"Original Index"},
false);
86 fn({(
char *)
"Original Index"},
false);
88 fn({(
char *)
"Corner Start"},
false);
89 fn({(
char *)
"Corner Size"},
false);
105 if (name ==
"Original Index") {
106 const int *
data =
static_cast<const int *
>(
109 return std::make_unique<ColumnValues>(name,
116 if (name ==
"Original Index") {
117 const int *
data =
static_cast<const int *
>(
120 return std::make_unique<ColumnValues>(name,
127 if (name ==
"Original Index") {
128 const int *
data =
static_cast<const int *
>(
131 return std::make_unique<ColumnValues>(name,
135 if (name ==
"Corner Start") {
136 return std::make_unique<ColumnValues>(
139 if (name ==
"Corner Size") {
141 return std::make_unique<ColumnValues>(
143 return faces[index].size();
157bool GeometryDataSource::display_attribute(
const StringRef name,
163 if (!show_internal_attributes_) {
179 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
180 if (!attributes.has_value()) {
183 if (attributes->domain_size(domain_) == 0) {
188 fn({(
char *)
"Name"},
false);
192 fn({(
char *)
"Name"},
false);
196 if (iter.
domain != domain_) {
199 if (!display_attribute(iter.
name, iter.
domain)) {
204 const bool is_front = iter.
name ==
".viewer";
205 fn(column_id, is_front);
209 fn({(
char *)
"Position"},
false);
210 fn({(
char *)
"Rotation"},
false);
211 fn({(
char *)
"Scale"},
false);
224 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
225 if (!attributes.has_value()) {
228 const int domain_num = attributes->domain_size(domain_);
229 if (domain_num == 0) {
232 if (!display_attribute(column_id.
name, domain_)) {
236 std::lock_guard
lock{mutex_};
243 Span<int> reference_handles = instances->reference_handles();
245 return std::make_unique<ColumnValues>(
248 domain_num, [reference_handles, references](
int64_t index) {
249 return references[reference_handles[index]];
254 return std::make_unique<ColumnValues>(
256 return transforms[index].location();
260 return std::make_unique<ColumnValues>(
262 return float3(math::to_euler(math::normalize(transforms[index])));
266 return std::make_unique<ColumnValues>(
268 return math::to_scale<true>(transforms[index]);
279 return std::make_unique<ColumnValues>(
281 StringRefNull name = layers[index]->name();
282 if (name.is_empty()) {
283 name = IFACE_(
"(Layer)");
285 return std::string(name);
294 *
mesh, domain_, column_id.name))
301 bke::GAttributeReader attribute = attributes->lookup(column_id.name);
305 GVArray varray = std::move(attribute.varray);
306 if (attribute.domain != domain_) {
310 StringRefNull column_display_name = column_id.name;
311 if (column_display_name ==
".viewer") {
312 column_display_name =
"Viewer";
315 return std::make_unique<ColumnValues>(column_display_name, std::move(varray));
320 std::optional<const bke::AttributeAccessor> attributes = this->get_component_attributes();
321 if (!attributes.has_value()) {
324 return attributes->domain_size(domain_);
332 switch (component_->type()) {
334 if (object_orig_->type !=
OB_MESH) {
366 const Mesh &mesh_orig,
380 if (
const int *orig_indices =
static_cast<const int *
>(
384 const int orig = orig_indices[
i];
396 const Mesh &mesh_orig,
413 if (
const int *orig_indices =
static_cast<const int *
>(
417 const int orig = orig_indices[
i];
435 if (
const int *orig_indices =
static_cast<const int *
>(
439 const int orig = orig_indices[
i];
455 mesh_eval, mesh_orig, face_memory);
459 if (face_mask.
size() == range.
size()) {
478 std::lock_guard
lock{mutex_};
484 switch (component_->type()) {
488 const Mesh *mesh_eval = geometry_set_.get_mesh();
489 const Mesh *mesh_orig =
static_cast<const Mesh *
>(object_orig_->data);
495 const Curves &curves_id = *component.
get();
518std::optional<const bke::AttributeAccessor> GeometryDataSource::get_component_attributes()
const
521 return component_->attributes();
523 const GreasePencil *grease_pencil = geometry_set_.get_grease_pencil();
524 if (!grease_pencil) {
528 return grease_pencil->attributes();
530 if (layer_index_ >= 0 && layer_index_ < grease_pencil->layers().
size()) {
531 if (
const bke::greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
532 grease_pencil->layer(layer_index_)))
534 return drawing->strokes().attributes();
543 if (component_->is_empty()) {
547 for (
const char *name : {
"Grid Name",
"Data Type",
"Class"}) {
549 fn(column_id,
false);
556 const Volume *volume = component_->get();
557 if (volume ==
nullptr) {
563 if (
STREQ(column_id.
name,
"Grid Name")) {
564 return std::make_unique<ColumnValues>(
567 return volume_grid->name();
570 if (
STREQ(column_id.
name,
"Data Type")) {
571 return std::make_unique<ColumnValues>(
575 const char *name =
nullptr;
581 return std::make_unique<ColumnValues>(
584 openvdb::GridClass grid_class = volume_grid->grid_class();
585 if (grid_class == openvdb::GridClass::GRID_FOG_VOLUME) {
586 return IFACE_(
"Fog Volume");
588 if (grid_class == openvdb::GridClass::GRID_LEVEL_SET) {
589 return IFACE_(
"Level Set");
603 const Volume *volume = component_->get();
604 if (volume ==
nullptr) {
612 switch (reference.
type()) {
618 return ICON_OUTLINER_COLLECTION;
621 return ICON_GEOMETRY_SET;
677 geometry_set = viewer_log->geometry;
695 if (instance_id.reference_index < 0 || instance_id.reference_index >= references.
size()) {
721 if (!geometry_set.
has(component_type)) {
726 return std::make_unique<VolumeDataSource>(std::move(geometry_set));
731 return std::make_unique<GeometryDataSource>(object_orig,
732 std::move(geometry_set),
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)
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 ListBase *lb)
T * DEG_get_original(T *id)
@ SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL
@ SPREADSHEET_FLAG_SHOW_INTERNAL_ATTRIBUTES
int ED_outliner_icon_from_id(const ID &id)
#define BM_elem_flag_test_bool(ele, hflag)
BMesh const char void * data
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
BLI_INLINE BMFace * BM_face_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)
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
constexpr int64_t size() const
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
int domain_size(const AttrDomain domain) 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
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
void to_bools(MutableSpan< bool > r_bools) const
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)
GeometrySet object_get_evaluated_geometry_set(const Object &object, bool apply_subdiv=true)
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)
static IndexMask calc_mesh_selection_mask_faces(const Mesh &mesh_eval, const Mesh &mesh_orig, IndexMaskMemory &memory)
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 IndexMask calc_mesh_selection_mask(const Mesh &mesh_eval, const Mesh &mesh_orig, const bke::AttrDomain domain, IndexMaskMemory &memory)
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)
uint64_t get_default_hash(const T &v, const Args &...args)
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
const EnumPropertyItem rna_enum_volume_grid_data_type_items[]
bool operator!=(const SpreadsheetInstanceID &a, const SpreadsheetInstanceID &b)
bool operator==(const SpreadsheetInstanceID &a, const SpreadsheetInstanceID &b)
MeshRuntimeHandle * runtime
SpreadsheetTableIDGeometry geometry_id
uint8_t object_eval_state
SpreadsheetInstanceID * instance_ids
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)