39#define CORNER_RESOLUTION 3
51 exter[0] =
roundf(exter[0]);
52 exter[1] =
roundf(exter[1]);
69 static gpu::Batch *screen_edges_batch =
nullptr;
71 if (screen_edges_batch ==
nullptr) {
75 gpu::VertBuf *vbo = GPU_vertbuf_create_with_format(format);
79 for (
int corner = 0; corner < 4; corner++) {
94 return screen_edges_batch;
97#undef CORNER_RESOLUTION
129 ScrArea *active_area =
nullptr;
153 active_area =
nullptr;
182 const float shader_scale = edge_thickness +
EDITORRADIUS;
183 const float corner_coverage[10] = {
184 0.144f, 0.25f, 0.334f, 0.40f, 0.455, 0.5, 0.538, 0.571, 0.6, 0.625f};
185 const float shader_width = corner_coverage[
U.border_width - 1];
189 int verts_per_corner = 0;
217 (&area == active_area) ? outline2 : outline1,
251 const float width = std::min(2.0f * offset, 5.0f *
UI_SCALE_FAC);
259 float inner[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
262 outline[3] *= anim_factor;
266 &rect, inner,
nullptr, 1.0f, outline, width -
U.pixelsize, 2.5f *
UI_SCALE_FAC);
278 rect.
xmin = rect.
xmax - (4.0f *
U.pixelsize);
284 rect.
xmax = rect.
xmin + (4.0f *
U.pixelsize);
290 rect.
ymin = rect.
ymax - (4.0f *
U.pixelsize);
296 rect.
ymax = rect.
ymin + (4.0f *
U.pixelsize);
304 float inner[4] = {1.0f, 1.0f, 1.0f, 0.4f};
305 float outline[4] = {0.0f, 0.0f, 0.0f, 0.3f};
307 &rect, inner,
nullptr, 1.0f, outline, 1.0f *
U.pixelsize, 2.5f *
UI_SCALE_FAC);
311 const wmWindow *win,
int x,
int y,
const ScrArea *source,
const std::string &hint)
317 float col_fg[4], col_bg[4];
324 const float margin =
scale * 4.0f;
326 const float icon_gap =
scale * 3.0f;
327 const float line_gap =
scale * 5.0f;
332 const float width = margin + std::max(line1_len, line2_len + icon_width + icon_gap) + margin;
333 const float height = margin + line_height + line_gap + line_height + margin;
338 const int top = std::max(
y -
int(7.0f *
UI_SCALE_FAC),
int(height));
342 rect.
xmax = left + width;
344 rect.
ymin = top - height;
349 top - height + margin + (1.0f *
scale),
362 fstyle->
uifont_id, left + margin, top - margin - line_height + (2.0f *
scale), 0.0f);
366 left + margin + icon_width + icon_gap,
367 top - height + margin - descent,
376 float darken[4] = {0.0f, 0.0f, 0.0f, 0.7f * anim_factor};
407 if (offset1 < 0 || offset2 > 0) {
449 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
450 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f * anim_factor};
473 for (
int a = 0; a < 4; a++) {
484 for (
int a = 0; a < 4; a++) {
495 for (
int a = 0; a < 4; a++) {
506 for (
int a = 0; a < 4; a++) {
517 for (
int a = 0; a < 4; a++) {
540 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f * anim_factor};
541 float inner[4] = {1.0f, 1.0f, 1.0f, 0.1f * anim_factor};
544 border[3] *= anim_factor;
560 remainder.
xmax =
split - half_line_width;
567 remainder.
xmin =
split + half_line_width;
574 remainder.
ymax =
split - half_line_width;
581 remainder.
ymin =
split + half_line_width;
606 IFACE_(
"Move area here"));
611 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
612 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
620 if (factor < 0.0001 || factor > 0.9999) {
626 float x = (1 - factor) * rect.
xmin + factor * rect.
xmax;
627 float y = (1 - factor) * rect.
ymin + factor * rect.
ymax;
644 rect.
ymin =
y + half_line_width;
648 rect.
xmin =
x + half_line_width;
660 rect.
ymin =
y - half_line_width;
661 rect.
ymax =
y + half_line_width;
664 rect.
xmin =
x - half_line_width;
665 rect.
xmax =
x + half_line_width;
686 if (now >
data->end_time) {
693 const float factor =
pow((now -
data->start_time) / (
data->end_time -
data->start_time), 2);
694 const bool do_inner =
data->inner[3] > 0.0f;
695 const bool do_outline =
data->outline[3] > 0.0f;
697 float inner_color[4];
699 inner_color[0] =
data->inner[0];
700 inner_color[1] =
data->inner[1];
701 inner_color[2] =
data->inner[2];
702 inner_color[3] = (1.0f - factor) *
data->inner[3];
705 float outline_color[4];
707 outline_color[0] =
data->outline[0];
708 outline_color[1] =
data->outline[1];
709 outline_color[2] =
data->outline[2];
710 outline_color[3] = (1.0f - factor) *
data->outline[3];
715 do_inner ? inner_color :
nullptr,
718 do_outline ? outline_color :
nullptr,
722 data->screen->do_refresh =
true;
739 "screen_animate_area_highlight");
741 data->screen = screen;
750 data->end_time =
data->start_time + seconds;
#define BLF_DRAW_STR_DUMMY_MAX
Platform independent time functions.
#define GPU_batch_uniform_1f(batch, name, x)
#define GPU_batch_uniform_4fv(batch, name, val)
#define GPU_batch_uniform_1i(batch, name, x)
#define UI_DEFAULT_TOOLTIP_POINTS
#define UI_FSTYLE_TOOLTIP
#define UI_NO_ICON_OVERLAY_TEXT
#define ICON_DEFAULT_WIDTH
float3x3 scale(float3x3 mat, float2 scale)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
void get_color_4fv(int colorid, float col[4])
const bTheme * theme_get()
void 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, float scale=1.0f)
void draw_roundbox_corner_set(int type)
void 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)
void draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void GPU_scissor_test(bool enable)
int ED_area_icon(const ScrArea *area)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
uint padding(uint offset, uint alignment)
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
void BLF_position(int fontid, float x, float y, float z)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float factor)
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
GPUVertFormat * immVertexFormat()
static void screen_draw_area_closed(int xmin, int xmax, int ymin, int ymax, float anim_factor)
void immBegin(GPUPrimType, uint vertex_len)
StringRefNull ED_area_name(const ScrArea *area)
void BLI_rcti_init_minmax(struct rcti *rect)
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
static void screen_draw_area_drag_tip(const wmWindow *win, int x, int y, const ScrArea *source, const std::string &hint)
@ TH_EDITOR_OUTLINE_ACTIVE
int WM_window_native_pixel_x(const wmWindow *win)
void immUniformColor4fv(const float rgba[4])
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void WM_draw_cb_exit(wmWindow *win, void *handle)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void BLF_size(int fontid, float size)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
static void area_animate_highlight_cb(const wmWindow *, void *userdata)
VecBase< int32_t, 2 > int2
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void immVertex2f(uint attr_id, float x, float y)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
BMesh const char void * data
void GPU_vertbuf_attr_set(gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
@ GPU_SHADER_2D_AREA_BORDERS
@ GPU_SHADER_3D_UNIFORM_COLOR
void screen_draw_dock_preview(const wmWindow *win, ScrArea *source, ScrArea *target, AreaDockTarget dock_target, float factor, int x, int y, float anim_factor)
void GPU_batch_draw(gpu::Batch *batch)
void gpu_batch_presets_register(gpu::Batch *preset_batch)
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
void area_getoffsets(ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
ScrArea ScrArea * BKE_screen_find_area_xy(const bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
static gpu::Batch * batch_screen_edges_get(int *corner_len)
static void rounded_corners(rctf rect, float color[4], int corners)
void GPU_scissor(int x, int y, int width, int height)
void screen_animate_area_highlight(wmWindow *win, bScreen *screen, const rcti *rect, float inner[4], float outline[4], float seconds)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
MINLINE float max_ff(float a, float b)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void screen_draw_join_highlight(const wmWindow *win, ScrArea *sa1, ScrArea *sa2, eScreenDir dir, float anim_factor)
void ED_screen_draw_edges(wmWindow *win)
double BLI_time_now_seconds()
MINLINE void copy_v4_v4(float r[4], const float a[4])
void GPU_blend(GPUBlend blend)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const wmWindow *win, void *customdata), void *customdata)
static void drawscredge_area(const ScrArea &area, float edge_thickness)
Screen edges drawing.
void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void screen_draw_move_highlight(const wmWindow *win, bScreen *screen, eScreenAxis dir_axis, float anim_factor)
static void do_vert_pair(gpu::VertBuf *vbo, uint pos, uint *vidx, int corner, int i)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
void BLF_color4fv(int fontid, const float rgba[4])
void screen_draw_region_scale_highlight(ARegion *region)
#define CORNER_RESOLUTION
#define SCREEN_DIR_IS_VERTICAL(dir)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
uiWidgetColors wcol_tooltip
eRegion_Alignment alignment
ListBaseT< ScrArea > areabase
struct ARegion * active_region
ListBaseT< struct ScrEdge > edgebase
ListBaseT< struct ScrArea > areabase
ListBaseT< WindowDrawCB > drawcalls
bke::WindowRuntime * runtime