33 std::shuffle(
data.begin(),
data.end(), std::default_random_engine(
seed));
41 data[permutation[i]] = i;
79 for (
const int old_i : new_by_old_map.
index_range()) {
80 const int new_i = new_by_old_map[old_i];
98 for (
int &
v : mesh->edges_for_write().cast<
int>()) {
99 v = new_by_old_map[
v];
101 for (
int &
v : mesh->corner_verts_for_write()) {
102 v = new_by_old_map[
v];
105 mesh->tag_topology_changed();
119 for (
int &
e : mesh->corner_edges_for_write()) {
120 e = new_by_old_map[
e];
123 mesh->tag_topology_changed();
131 for (
const int new_i : old_offsets.
index_range()) {
132 const int old_i = old_by_new_map[new_i];
133 new_offsets[new_i + 1] = new_offsets[new_i] + old_offsets[old_i].
size();
143 const int elements_num = new_offsets.
total_size();
144 const int groups_num = new_by_old_map.
size();
147 for (
const int old_i :
IndexRange(groups_num)) {
148 const int new_i = new_by_old_map[old_i];
149 const IndexRange old_range = old_offsets[old_i];
150 const IndexRange new_range = new_offsets[new_i];
176 mesh->face_offsets_for_write().copy_from(new_face_offsets);
178 mesh->tag_topology_changed();
192 pointcloud->tag_positions_changed();
193 pointcloud->tag_radii_changed();
213 curves->
point_data, old_points_by_curve, new_points_by_curve, new_by_old_map);
244 return G.randomize_geometry_element_order;
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free(CustomData *data, int totelem)
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_copy_data(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
static unsigned long seed
constexpr void copy_from(Span< T > values) const
Span< T > as_span() const
constexpr int64_t size() const
constexpr int64_t start() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
OffsetIndices< int > points_by_curve() const
void tag_topology_changed()
MutableSpan< int > offsets_for_write()
int instances_num() const
CustomData & custom_data_attributes()
IndexRange index_range() const
void debug_randomize_edge_order(Mesh *mesh)
static Array< int > invert_permutation(const Span< int > permutation)
static void reorder_customdata_groups(CustomData &data, const OffsetIndices< int > old_offsets, const OffsetIndices< int > new_offsets, const Span< int > new_by_old_map)
bool use_debug_randomization()
static int seed_from_curves(const bke::CurvesGeometry &curves)
void debug_randomize_mesh_order(Mesh *mesh)
void debug_randomize_curve_order(bke::CurvesGeometry *curves)
static Array< int > make_new_offset_indices(const OffsetIndices< int > old_offsets, const Span< int > old_by_new_map)
static int seed_from_pointcloud(const PointCloud &pointcloud)
void debug_randomize_vert_order(Mesh *mesh)
static Array< int > get_permutation(const int length, const int seed)
void debug_randomize_face_order(Mesh *mesh)
static void reorder_customdata(CustomData &data, const Span< int > new_by_old_map)
void debug_randomize_point_order(PointCloud *pointcloud)
static int seed_from_mesh(const Mesh &mesh)
static int seed_from_instances(const bke::Instances &instances)
void debug_randomize_instance_order(bke::Instances *instances)