37#define CORNER_RESOLUTION 3
49 exter[0] =
roundf(exter[0]);
50 exter[1] =
roundf(exter[1]);
67 static blender::gpu::Batch *screen_edges_batch =
nullptr;
69 if (screen_edges_batch ==
nullptr) {
77 for (
int corner = 0; corner < 4; corner++) {
92 return screen_edges_batch;
95#undef CORNER_RESOLUTION
127 ScrArea *active_area =
nullptr;
151 active_area =
nullptr;
180 const float shader_scale = edge_thickness +
EDITORRADIUS;
181 const float corner_coverage[10] = {
182 0.144f, 0.25f, 0.334f, 0.40f, 0.455, 0.5, 0.538, 0.571, 0.6, 0.625f};
183 const float shader_width = corner_coverage[
U.border_width - 1];
187 int verts_per_corner = 0;
215 (area == active_area) ? outline2 : outline1,
229 rctf rect = {SHRT_MAX, SHRT_MIN, SHRT_MAX, SHRT_MIN};
232 if (edge->v1->editflag && edge->v2->editflag) {
249 const float width = std::min(2.0f * offset, 5.0f *
UI_SCALE_FAC);
257 float inner[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
260 outline[3] *= anim_factor;
264 &rect, inner,
nullptr, 1.0f, outline, width -
U.pixelsize, 2.5f *
UI_SCALE_FAC);
276 rect.
xmin = rect.
xmax - (4.0f *
U.pixelsize);
282 rect.
xmax = rect.
xmin + (4.0f *
U.pixelsize);
288 rect.
ymin = rect.
ymax - (4.0f *
U.pixelsize);
294 rect.
ymax = rect.
ymin + (4.0f *
U.pixelsize);
302 float inner[4] = {1.0f, 1.0f, 1.0f, 0.4f};
303 float outline[4] = {0.0f, 0.0f, 0.0f, 0.3f};
305 &rect, inner,
nullptr, 1.0f, outline, 1.0f *
U.pixelsize, 2.5f *
UI_SCALE_FAC);
309 const wmWindow *win,
int x,
int y,
const ScrArea *source,
const std::string &hint)
315 float col_fg[4], col_bg[4];
322 const float margin = scale * 4.0f;
324 const float icon_gap = scale * 3.0f;
325 const float line_gap = scale * 5.0f;
330 const float width = margin + std::max(line1_len, line2_len + icon_width + icon_gap) + margin;
331 const float height = margin + lheight + line_gap + lheight + margin;
347 top - height + margin + (1.0f * scale),
363 left + margin + icon_width + icon_gap,
364 top - height + margin - descent,
373 float darken[4] = {0.0f, 0.0f, 0.0f, 0.7f * anim_factor};
404 if (offset1 < 0 || offset2 > 0) {
446 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
447 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f * anim_factor};
458 format,
"pos", blender::gpu::VertAttrType::SFLOAT_32_32);
468 for (
int a = 0; a < 4; a++) {
479 for (
int a = 0; a < 4; a++) {
490 for (
int a = 0; a < 4; a++) {
501 for (
int a = 0; a < 4; a++) {
512 for (
int a = 0; a < 4; a++) {
535 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
536 float inner[4] = {1.0f, 1.0f, 1.0f, 0.1f * anim_factor};
539 border[3] *= anim_factor;
555 remainder.
xmax =
split - half_line_width;
562 remainder.
xmin =
split + half_line_width;
569 remainder.
ymax =
split - half_line_width;
576 remainder.
ymin =
split + half_line_width;
601 IFACE_(
"Move area here"));
606 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
607 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
615 if (factor < 0.0001 || factor > 0.9999) {
621 float x = (1 - factor) * rect.
xmin + factor * rect.
xmax;
622 float y = (1 - factor) * rect.
ymin + factor * rect.
ymax;
639 rect.
ymin =
y + half_line_width;
643 rect.
xmin =
x + half_line_width;
655 rect.
ymin =
y - half_line_width;
656 rect.
ymax =
y + half_line_width;
659 rect.
xmin =
x - half_line_width;
660 rect.
xmax =
x + half_line_width;
681 if (now >
data->end_time) {
688 const float factor =
pow((now -
data->start_time) / (
data->end_time -
data->start_time), 2);
689 const bool do_inner =
data->inner[3] > 0.0f;
690 const bool do_outline =
data->outline[3] > 0.0f;
692 float inner_color[4];
694 inner_color[0] =
data->inner[0];
695 inner_color[1] =
data->inner[1];
696 inner_color[2] =
data->inner[2];
697 inner_color[3] = (1.0f - factor) *
data->inner[3];
700 float outline_color[4];
702 outline_color[0] =
data->outline[0];
703 outline_color[1] =
data->outline[1];
704 outline_color[2] =
data->outline[2];
705 outline_color[3] = (1.0f - factor) *
data->outline[3];
710 do_inner ? inner_color :
nullptr,
713 do_outline ? outline_color :
nullptr,
717 data->screen->do_refresh =
true;
734 "screen_animate_area_highlight");
736 data->screen = screen;
745 data->end_time =
data->start_time + seconds;
ScrArea ScrArea * BKE_screen_find_area_xy(const bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
void BLF_size(int fontid, float size)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_color4fv(int fontid, const float rgba[4])
#define BLF_DRAW_STR_DUMMY_MAX
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_position(int fontid, float x, float y, float z)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_INLINE bool BLI_listbase_is_single(const ListBase *lb)
MINLINE float max_ff(float a, float b)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init_minmax(struct rcti *rect)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Platform independent time functions.
double BLI_time_now_seconds(void)
int ED_area_icon(const ScrArea *area)
blender::StringRefNull ED_area_name(const ScrArea *area)
static void split(const char *text, const char *seps, char ***str, int *count)
#define GPU_batch_uniform_1f(batch, name, x)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, GPUBuiltinShader shader_id)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
void GPU_batch_draw(blender::gpu::Batch *batch)
#define GPU_batch_uniform_4fv(batch, name, val)
#define GPU_batch_uniform_1i(batch, name, x)
void gpu_batch_presets_register(blender::gpu::Batch *preset_batch)
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_AREA_BORDERS
void GPU_scissor_test(bool enable)
void GPU_blend(GPUBlend blend)
void GPU_scissor(int x, int y, int width, int height)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_attr_set(blender::gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void UI_draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
#define UI_DEFAULT_TOOLTIP_POINTS
void UI_draw_roundbox_corner_set(int type)
#define UI_FSTYLE_TOOLTIP
#define UI_NO_ICON_OVERLAY_TEXT
void UI_icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false)
#define ICON_DEFAULT_WIDTH
@ TH_EDITOR_OUTLINE_ACTIVE
void UI_GetThemeColor4fv(int colorid, float col[4])
BMesh const char void * data
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
struct @021025263243242147216143265077100330027142264337::@225245033123204053237120173316075113304004012000 batch
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
VecBase< int32_t, 2 > int2
void screen_draw_region_scale_highlight(ARegion *region)
static void drawscredge_area(const ScrArea &area, float edge_thickness)
Screen edges drawing.
static void rounded_corners(rctf rect, float color[4], int corners)
static void area_animate_highlight_cb(const wmWindow *, void *userdata)
void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float factor)
void screen_draw_move_highlight(const wmWindow *win, bScreen *screen, eScreenAxis dir_axis, float anim_factor)
void ED_screen_draw_edges(wmWindow *win)
#define CORNER_RESOLUTION
void screen_draw_dock_preview(const wmWindow *win, ScrArea *source, ScrArea *target, AreaDockTarget dock_target, float factor, int x, int y, float anim_factor)
static void do_vert_pair(blender::gpu::VertBuf *vbo, uint pos, uint *vidx, int corner, int i)
void screen_animate_area_highlight(wmWindow *win, bScreen *screen, const rcti *rect, float inner[4], float outline[4], float seconds)
static void screen_draw_area_closed(int xmin, int xmax, int ymin, int ymax, float anim_factor)
static void screen_draw_area_drag_tip(const wmWindow *win, int x, int y, const ScrArea *source, const std::string &hint)
void screen_draw_join_highlight(const wmWindow *win, ScrArea *sa1, ScrArea *sa2, eScreenDir dir, float anim_factor)
static blender::gpu::Batch * batch_screen_edges_get(int *corner_len)
void area_getoffsets(ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
#define SCREEN_DIR_IS_VERTICAL(dir)
uiWidgetColors wcol_tooltip
struct ARegion * active_region
struct wmEvent * eventstate
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const wmWindow *win, void *customdata), void *customdata)
void WM_draw_cb_exit(wmWindow *win, void *handle)
int WM_window_native_pixel_x(const wmWindow *win)
void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
bScreen * WM_window_get_active_screen(const wmWindow *win)