30 if (!sync_selection) {
42 for (const int face : range) {
43 r_offset_data[face] = BM_face_at_index(&const_cast<BMesh &>(bm), face)->len;
60 if (selection.
size() ==
bm.totface) {
65 for (const int i : range) {
66 data[i] = uint3(BM_elem_index_get(looptris[i][0]),
67 BM_elem_index_get(looptris[i][1]),
68 BM_elem_index_get(looptris[i][2]));
77 Array<int> selected_face_offset_data(selection.size() + 1);
79 faces, selection, selected_face_offset_data);
87 selection.foreach_index(
GrainSize(4096), [&](
const int face,
const int mask) {
101 const bool sync_selection)
110 faces.index_range(),
GrainSize(4096), memory, [&](
const int face) {
123 selection =
faces.index_range();
136 corner_tris.
cast<uint32_t>().data(),
145 faces, selection, selected_face_offset_data);
158 corner_tris[tris[
i]][0], corner_tris[tris[
i]][1], corner_tris[tris[
i]][2]);
177 const int tris_num = selection.
size() * 2;
184 const uint corner_start = subdiv_quad_index * 4;
185 data[
mask * 2 + 0] =
uint3(corner_start, corner_start + 1, corner_start + 2);
186 data[
mask * 2 + 1] =
uint3(corner_start, corner_start + 2, corner_start + 3);
195 const bool sync_selection)
206 [&](
const int subdiv_quad_index) {
207 const uint corner_start = subdiv_quad_index * 4;
208 const int coarse_face = subdiv_loop_face_index[corner_start];
218 const bool sync_selection)
228 [&](
const int subdiv_quad_index) {
229 const uint corner_start = subdiv_quad_index * 4;
230 const int coarse_face = subdiv_loop_face_index[corner_start];
261 const bool sync_selection)
294 const bool sync_selection)
308 for (
const int face_index :
faces.index_range()) {
317 for (
const int corner : face) {
318 const int edge = corner_edges[corner];
332 if (!sync_selection) {
342 for (
const int corner : face) {
343 const int edge = corner_edges[corner];
366 bool sync_selection =
false;
369 sync_selection =
true;
375 sync_selection =
false;
387 const bool sync_selection)
401 const int coarse_face = subdiv_loop_face_index[subdiv_quad * 4];
406 const IndexRange subdiv_face(subdiv_quad * 4, 4);
407 for (
const int subdiv_corner : subdiv_face) {
408 const int coarse_edge = subdiv_loop_edge_index[subdiv_corner];
409 if (coarse_edge == -1) {
422 const bool sync_selection)
436 const int coarse_face = subdiv_loop_face_index[subdiv_quad * 4];
449 if (!sync_selection) {
455 const IndexRange subdiv_face(subdiv_quad * 4, 4);
456 for (
const int subdiv_corner : subdiv_face) {
457 const int coarse_edge = subdiv_loop_edge_index[subdiv_corner];
458 if (coarse_edge == -1) {
481 bool sync_selection =
false;
484 sync_selection =
true;
490 sync_selection =
false;
507 const bool sync_selection,
526 const bool sync_selection,
534 for (
const int face_index :
faces.index_range()) {
542 for (
const int corner :
faces[face_index]) {
543 const int vert = corner_verts[corner];
569 const bool sync_selection,
578 const int coarse_face = subdiv_loop_face_index[subdiv_quad * 4];
583 for (
const int subdiv_corner :
IndexRange(subdiv_quad * 4, 4)) {
584 const int coarse_vert = subdiv_loop_vert_index[subdiv_corner];
585 if (coarse_vert == -1) {
595 const bool sync_selection,
603 const int coarse_face = subdiv_loop_face_index[subdiv_quad * 4];
611 for (
const int subdiv_corner :
IndexRange(subdiv_quad * 4, 4)) {
612 const int coarse_vert = subdiv_loop_vert_index[subdiv_corner];
613 if (coarse_vert == -1) {
645 const bool sync_selection)
661 const bool sync_selection)
681 return std::any_of(face_verts.
begin(), face_verts.
end(), [&](
const int vert) {
682 return facedot_tags[vert];
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
blender::MutableSpan< uint32_t > GPU_indexbuf_get_data(GPUIndexBufBuilder *)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
blender::gpu::IndexBuf * GPU_indexbuf_build_ex(GPUIndexBufBuilder *builder, uint index_min, uint index_max, bool uses_restart_indices)
blender::gpu::IndexBuf * GPU_indexbuf_calloc()
void GPU_indexbuf_add_point_vert(GPUIndexBufBuilder *, uint v)
blender::gpu::IndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *)
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, blender::gpu::IndexBuf *)
blender::gpu::IndexBuf * GPU_indexbuf_build_from_memory(GPUPrimType prim_type, const uint32_t *data, int32_t data_len, int32_t index_min, int32_t index_max, bool uses_restart_indices)
#define BM_FACE_FIRST_LOOP(p)
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_test_bool(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
BMesh const char void * data
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
static IndexMask from_bools_inverse(const VArray< bool > &bools, IndexMaskMemory &memory)
constexpr bool is_empty() const
void reinitialize(const int64_t new_size)
constexpr IndexRange index_range() const
Span< NewT > constexpr cast() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size() const
constexpr const T * end() const
constexpr IndexRange index_range() const
constexpr const T * begin() const
constexpr bool is_empty() const
void to_indices(MutableSpan< T > r_indices) const
void foreach_index(Fn &&fn) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
BLI_INLINE BMFace * bm_original_face_get(const MeshRenderData &mr, int idx)
gpu::IndexBufPtr extract_edituv_lines_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, UvExtractionMode mode)
gpu::IndexBufPtr extract_edituv_face_dots(const MeshRenderData &mr)
static gpu::IndexBufPtr extract_edituv_face_dots_bm(const MeshRenderData &mr, const bool sync_selection)
static gpu::IndexBufPtr extract_edituv_lines_subdiv_mesh(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection)
static OffsetIndices< int > build_bmesh_face_offsets(const BMesh &bm, Array< int > &r_offset_data)
gpu::IndexBufPtr extract_edituv_tris(const MeshRenderData &mr, bool edit_uvs)
static gpu::IndexBufPtr build_tris_from_subdiv_quad_selection(const DRWSubdivCache &subdiv_cache, const IndexMask &selection)
gpu::IndexBufPtr extract_edituv_points(const MeshRenderData &mr)
gpu::IndexBufPtr extract_edituv_tris_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache)
static gpu::IndexBufPtr extract_edituv_tris_subdiv_mesh(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection)
uint2 edge_from_corners(const IndexRange face, const int corner)
static gpu::IndexBufPtr extract_edituv_tris_subdiv_bm(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection)
static void extract_edituv_points_subdiv_bm(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection, GPUIndexBufBuilder &builder)
gpu::IndexBufPtr extract_edituv_points_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache)
static gpu::IndexBufPtr extract_edituv_tris_mesh(const MeshRenderData &mr, const bool sync_selection)
static void extract_edituv_points_subdiv_mesh(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection, GPUIndexBufBuilder &builder)
static gpu::IndexBufPtr extract_edituv_face_dots_mesh(const MeshRenderData &mr, const bool sync_selection)
static void extract_edituv_points_mesh(const MeshRenderData &mr, const bool sync_selection, GPUIndexBufBuilder &builder)
gpu::IndexBufPtr extract_edituv_lines(const MeshRenderData &mr, UvExtractionMode mode)
static gpu::IndexBufPtr extract_edituv_lines_bm(const MeshRenderData &mr, const bool sync_selection)
static void extract_edituv_points_bm(const MeshRenderData &mr, const bool sync_selection, GPUIndexBufBuilder &builder)
static gpu::IndexBufPtr extract_edituv_tris_bm(const MeshRenderData &mr, const bool sync_selection)
static gpu::IndexBufPtr extract_edituv_lines_subdiv_bm(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const bool sync_selection)
bool skip_bm_face(const BMFace &face, const bool sync_selection)
static gpu::IndexBufPtr extract_edituv_lines_mesh(const MeshRenderData &mr, const bool sync_selection)
std::unique_ptr< IndexBuf, IndexBufDeleter > IndexBufPtr
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
OffsetIndices< int > gather_selected_offsets(OffsetIndices< int > src_offsets, const IndexMask &selection, int start_offset, MutableSpan< int > dst_offsets)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< uint32_t, 2 > uint2
VecBase< uint32_t, 3 > uint3
blender::Array< std::array< BMLoop *, 3 > > looptris
bool uses_restart_indices
MeshRuntimeHandle * runtime
gpu::VertBuf * verts_orig_index
gpu::VertBuf * edges_orig_index
int * subdiv_loop_face_index
const int * orig_index_vert
const ToolSettings * toolsettings
MeshExtractType extract_type
const int * orig_index_face
VArraySpan< bool > select_poly
const int * orig_index_edge
VArraySpan< bool > hide_poly
OffsetIndices< int > faces