33 Vector<GeometryInstanceGroup> &r_sets);
37 Vector<GeometryInstanceGroup> &r_sets);
44 if (
mesh !=
nullptr) {
60 if (
object.runtime.geometry_set_eval !=
nullptr) {
62 geometry_set = *
object.runtime.geometry_set_eval;
67 if (
object.runtime.geometry_set_eval !=
nullptr) {
68 return *
object.runtime.geometry_set_eval;
104 const Collection *collection_instance =
object.instance_collection;
105 if (collection_instance !=
nullptr) {
117 const Object &
object = *collection_object->ob;
122 BLI_assert(collection_child->collection !=
nullptr);
123 const Collection &collection = *collection_child->collection;
198 const Collection *collection_instance =
object.instance_collection;
199 if (collection_instance !=
nullptr) {
215 const Object &
object = *collection_object->ob;
221 BLI_assert(collection_child->collection !=
nullptr);
222 const Collection &collection = *collection_child->collection;
246 if (limit > 0 &&
count++ > limit) {
252 if (instances_component ==
nullptr) {
301 if (!set.
has(component_type)) {
307 if (ignored_attributes.
contains(name)) {
311 attribute_kind->domain = meta_data.domain;
312 attribute_kind->data_type = meta_data.data_type;
315 attribute_kind->domain = meta_data.domain;
316 attribute_kind->data_type = bke::attribute_data_type_highest_complexity(
317 {attribute_kind->data_type, meta_data.data_type});
328 const bool convert_points_to_vertices)
340 const int tot_transforms = set_group.transforms.size();
354 totverts += pointcloud.
totpoint * tot_transforms;
359 if ((totverts + totloops + totedges + totpolys) == 0) {
389 MVert &new_vert = new_mesh->
mvert[vert_offset + i];
398 MEdge &new_edge = new_mesh->
medge[edge_offset + i];
400 new_edge.
v1 += vert_offset;
401 new_edge.
v2 += vert_offset;
405 MLoop &new_loop = new_mesh->
mloop[loop_offset + i];
407 new_loop.
v += vert_offset;
408 new_loop.
e += edge_offset;
412 MPoly &new_poly = new_mesh->
mpoly[poly_offset + i];
427 MVert &new_vert = new_mesh->
mvert[vert_offset + i];
428 const float3 old_position = pointcloud.
co[i];
452 result.attribute_try_create(entry.key, domain_output, data_type_output);
454 if (!write_attribute || &write_attribute->cpp_type() != cpp_type ||
455 write_attribute->domain() != domain_output) {
464 if (set.
has(component_type)) {
466 const int domain_size =
component.attribute_domain_size(domain_output);
467 if (domain_size == 0) {
471 name, domain_output, data_type_output);
473 if (source_attribute) {
474 fn::GSpan src_span = source_attribute->get_span();
475 const void *src_buffer = src_span.
data();
476 for (
const int UNUSED(i) : set_group.transforms.index_range()) {
477 void *dst_buffer = dst_span[offset];
479 offset += domain_size;
483 offset += domain_size * set_group.transforms.size();
489 write_attribute->apply_span();
494 bool convert_points_to_vertices,
498 convert_points_to_vertices);
499 if (new_mesh ==
nullptr) {
504 dst_component.
replace(new_mesh);
508 if (convert_points_to_vertices) {
517 {
"position",
"material_index",
"normal",
"shade_smooth",
"crease"},
520 set_groups, component_types, attributes,
static_cast<GeometryComponent &
>(dst_component));
540 dst_component.
replace(pointcloud);
574 return new_geometry_set;
591 return new_geometry_set;
@ GEO_COMPONENT_TYPE_MESH
@ GEO_COMPONENT_TYPE_POINT_CLOUD
@ INSTANCE_DATA_TYPE_OBJECT
@ INSTANCE_DATA_TYPE_COLLECTION
struct Mesh * BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
void BKE_mesh_copy_settings(struct Mesh *me_dst, const struct Mesh *me_src)
void BKE_mesh_wrapper_ensure_mdata(struct Mesh *me)
struct Mesh * BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object *ob_eval, const bool get_cage_mesh)
General operations for point-clouds.
struct PointCloud * BKE_pointcloud_new_nomain(const int totpoint)
#define LISTBASE_FOREACH(type, var, list)
void unit_m4(float m[4][4])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
static uint8 component(Color32 c, uint i)
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
_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
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
blender::Span< blender::float4x4 > transforms() const
blender::Span< InstancedData > instanced_data() const
void replace(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void copy_vertex_group_names_from_object(const struct Object &object)
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
ItemIterator items() const
auto add_or_modify(const Key &key, const CreateValueF &create_value, const ModifyValueF &modify_value) -> decltype(create_value(nullptr))
bool contains(const Key &key) const
constexpr IndexRange index_range() const
void append(const T &value)
void copy_to_initialized_n(const void *src, void *dst, int64_t n) const
const void * data() const
DEGForeachIDComponentCallback callback
static void join_instance_groups_mesh(Span< GeometryInstanceGroup > set_groups, bool convert_points_to_vertices, GeometrySet &result)
static bool object_instance_attribute_foreach(const Object &object, const AttributeForeachCallback callback, const int limit, int &count)
static void join_instance_groups_pointcloud(Span< GeometryInstanceGroup > set_groups, GeometrySet &result)
static void add_final_mesh_as_geometry_component(const Object &object, GeometrySet &geometry_set)
void geometry_set_gather_instances(const GeometrySet &geometry_set, Vector< GeometryInstanceGroup > &r_instance_groups)
static void geometry_set_collect_recursive_object(const Object &object, const float4x4 &transform, Vector< GeometryInstanceGroup > &r_sets)
static Mesh * join_mesh_topology_and_builtin_attributes(Span< GeometryInstanceGroup > set_groups, const bool convert_points_to_vertices)
GeometrySet geometry_set_realize_mesh_for_modifier(const GeometrySet &geometry_set)
static void geometry_set_collect_recursive(const GeometrySet &geometry_set, const float4x4 &transform, Vector< GeometryInstanceGroup > &r_sets)
std::unique_ptr< WriteAttribute > WriteAttributePtr
GeometrySet geometry_set_realize_instances(const GeometrySet &geometry_set)
void geometry_set_gather_instances_attribute_info(Span< GeometryInstanceGroup > set_groups, Span< GeometryComponentType > component_types, const Set< std::string > &ignored_attributes, Map< std::string, AttributeKind > &r_attributes)
static bool collection_instance_attribute_foreach(const Collection &collection, const AttributeForeachCallback callback, const int limit, int &count)
static void join_instance_groups_volume(Span< GeometryInstanceGroup > set_groups, GeometrySet &result)
static void geometry_set_collect_recursive_collection_instance(const Collection &collection, const float4x4 &transform, Vector< GeometryInstanceGroup > &r_sets)
static GeometrySet object_get_geometry_set_for_read(const Object &object)
const CPPType * custom_data_type_to_cpp_type(const CustomDataType type)
void geometry_set_instances_attribute_foreach(const GeometrySet &geometry_set, const AttributeForeachCallback callback, const int limit)
static void geometry_set_collect_recursive_collection(const Collection &collection, const float4x4 &transform, Vector< GeometryInstanceGroup > &r_sets)
std::unique_ptr< ReadAttribute > ReadAttributePtr
static void join_attributes(Span< GeometryInstanceGroup > set_groups, Span< GeometryComponentType > component_types, const Map< std::string, AttributeKind > &attribute_info, GeometryComponent &result)
static bool instances_attribute_foreach_recursive(const GeometrySet &geometry_set, const AttributeForeachCallback callback, const int limit, int &count)
void remove(const GeometryComponentType component_type)
const PointCloud * get_pointcloud_for_read() const
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
blender::Vector< const GeometryComponent * > get_components_for_read() const
bool has(const GeometryComponentType component_type) const
const GeometryComponent * get_component_for_read(GeometryComponentType component_type) const
const Mesh * get_mesh_for_read() const
bool has_instances() const
bool has_pointcloud() const