56 if (obj_eval->runtime->last_update_transform > last_update) {
82 rcti rect_clamp = *rect;
89 if (select_ctx->
is_dirty(depsgraph, rv3d)) {
125 *r_buf_len = buf_len;
146 rcti rect_px = *rect;
152 if (buf ==
nullptr) {
160 const uint *buf_iter = buf;
163 if (
index < bitmap_len) {
171 *r_bitmap_len = bitmap_len;
187 rect.
xmin = center[0] - radius;
188 rect.
xmax = center[0] + radius + 1;
189 rect.
ymin = center[1] - radius;
190 rect.
ymax = center[1] + radius + 1;
194 if (buf ==
nullptr) {
202 const uint *buf_iter = buf;
203 const int radius_sq = radius * radius;
204 for (
int yc = -radius; yc <= radius; yc++) {
205 for (
int xc = -radius; xc <= radius; xc++, buf_iter++) {
206 if (xc * xc + yc * yc < radius_sq) {
209 if (
index < bitmap_len) {
218 *r_bitmap_len = bitmap_len;
233 int i = (
y *
data->width) +
x;
237 }
while (++
x != x_end);
249 rcti rect_px = *rect;
255 if (buf ==
nullptr) {
262 poly_mask_data.
px = buf_mask;
277 const uint *buf_iter = buf;
288 MEM_delete(buf_mask);
291 *r_bitmap_len = bitmap_len;
314 rect.
xmin = center[0];
315 rect.
xmax = center[0] + 1;
316 rect.
ymin = center[1];
317 rect.
ymax = center[1] + 1;
340 uint hit_id = *
static_cast<uint *
>(
const_cast<void *
>(value));
341 if (hit_id && hit_id >=
data->id_min && hit_id < data->id_max) {
343 data->val_ptr = value;
344 data->r_index = (hit_id -
data->id_min) + 1;
374 if (buf ==
nullptr) {
378 const int shape[2] = {height, width};
379 const int center_yx[2] = {(height - 1) / 2, (width - 1) / 2};
384 size_t offset = (size_t(
data.val_ptr) - size_t(buf)) /
sizeof(*buf);
385 int hit_x = offset % width;
386 int hit_y = offset / width;
387 *dist =
uint(
abs(hit_y - center_yx[0]) +
abs(hit_x - center_yx[1]));
407 for (
const auto &item : select_ctx->
elem_ranges.items()) {
416 r_base_index = select_ctx->
objects.first_index_of_try(ob);
417 return r_base_index != -1;
422 r_base_index = select_ctx->
objects.first_index_of_try(ob);
423 return r_base_index != -1;
428 r_base_index = select_ctx->
objects.first_index_of_try(ob);
429 return r_base_index != -1;
474 Object *obj = bases[i]->object;
Generic array manipulation API.
#define BLI_array_iter_spiral_square(arr, arr_shape, center, test_fn, user_data)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
Read Blender memory allocation and freeing.
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool contains(int64_t value) const
constexpr int64_t start() const
bool is_equal(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, const T epsilon=T(0))
void DRW_gpu_context_enable()
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
void GPU_framebuffer_read_color(gpu::FrameBuffer *fb, int x, int y, int width, int height, int channels, int slot, eGPUDataFormat data_format, void *r_data)
uint DRW_select_buffer_find_nearest_to_point(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const int center[2], uint id_min, uint id_max, uint *dist)
void GPU_framebuffer_restore()
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
uint64_t DEG_get_update_count(const Depsgraph *depsgraph)
static bool select_buffer_test_fn(const void *__restrict value, void *__restrict userdata)
uint * DRW_select_buffer_bitmap_from_rect(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect, uint *r_bitmap_len)
uint DRW_select_buffer_context_offset_for_object_elem(Depsgraph *depsgraph, Object *object, char elem_type)
bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b)
bool DRW_select_buffer_elem_get(uint sel_id, uint &r_elem, uint &r_base_index, char &r_elem_type)
gpu::FrameBuffer * DRW_engine_select_framebuffer_get()
MatBase< float, 4, 4 > float4x4
void GPU_select_buffer_stride_realign(const rcti *src, const rcti *dst, uint *r_buf)
uint DRW_select_buffer_sample_point(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const int center[2])
static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
void DRW_gpu_context_disable()
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void DRW_select_buffer_context_create(Depsgraph *depsgraph, Span< Base * > bases, short select_mode)
uint * DRW_select_buffer_bitmap_from_circle(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const int center[2], int radius, uint *r_bitmap_len)
BMesh const char void * data
void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, int ymin, int xmax, int ymax, Span< int2 > verts, void(*callback)(int x, int x_end, int y, void *), void *user_data)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d)
int GPU_texture_width(const gpu::Texture *texture)
uint * DRW_select_buffer_read(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect, uint *r_buf_len)
bool BLI_rcti_is_empty(const struct rcti *rect)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
int GPU_texture_height(const gpu::Texture *texture)
gpu::Texture * DRW_engine_select_texture_get()
SELECTID_Context * DRW_select_engine_context_get()
void BLI_rcti_init_pt_radius(struct rcti *rect, const int xy[2], int size)
uint * DRW_select_buffer_bitmap_from_poly(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Span< int2 > poly, const rcti *rect, uint *r_bitmap_len)
Map< Object *, ElemIndexRanges > elem_ranges
uint64_t depsgraph_last_update
bool is_dirty(Depsgraph *depsgraph, RegionView3D *rv3d)
Vector< Object * > objects