Blender
V3.3
|
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BLF_api.h"
#include "IMB_imbuf_types.h"
#include "IMB_metadata.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_util.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
Go to the source code of this file.
Classes | |
struct | tSlider |
struct | MetadataCustomDrawContext |
struct | MetadataCustomCountContext |
Macros | |
#define | MAX_METADATA_STR 1024 |
Typedefs | |
typedef struct MetadataCustomDrawContext | MetadataCustomDrawContext |
typedef struct MetadataCustomCountContext | MetadataCustomCountContext |
Functions | |
void | ED_region_draw_mouse_line_cb (const bContext *C, ARegion *region, void *arg_info) |
BLI_INLINE bool | metadata_is_valid (ImBuf *ibuf, char *r_str, short index, int offset) |
BLI_INLINE bool | metadata_is_custom_drawable (const char *field) |
static void | metadata_custom_draw_fields (const char *field, const char *value, void *ctx_v) |
static void | metadata_draw_imbuf (ImBuf *ibuf, const rctf *rect, int fontid, const bool is_top) |
static void | metadata_custom_count_fields (const char *field, const char *UNUSED(value), void *ctx_v) |
static float | metadata_box_height_get (ImBuf *ibuf, int fontid, const bool is_top) |
void | ED_region_image_metadata_draw (int x, int y, ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy) |
Variables | |
static const char * | meta_data_list [] |
Generic Slider | |
The generic slider is supposed to be called during modal operations. It calculates a factor value based on mouse position and draws a visual representation. In order to use it, you need to store a reference to a tSlider in your operator which you get by calling ED_slider_create. Then you need to update it during modal operations by calling ED_slider_modal", which will update tSlider.factor for you to use. To remove drawing and free the memory, call ED_slider_destroy. | |
#define | SLIDE_PIXEL_DISTANCE (300.0f * U.dpi_fac) |
#define | OVERSHOOT_RANGE_DELTA 0.2f |
typedef struct tSlider | tSlider |
static void | draw_overshoot_triangle (const uint8_t color[4], const bool facing_right, const float x, const float y) |
static void | draw_ticks (const float start_factor, const float end_factor, const float line_start[2], const float base_tick_height, const float line_width, const uint8_t color_overshoot[4], const uint8_t color_line[4]) |
static void | draw_main_line (const rctf *main_line_rect, const float factor, const bool overshoot, const uint8_t color_overshoot[4], const uint8_t color_line[4]) |
static void | draw_backdrop (const int fontid, const rctf *main_line_rect, const uint8_t color_bg[4], const short region_y_size, const float base_tick_height) |
static void | slider_draw (const struct bContext *UNUSED(C), ARegion *region, void *arg) |
static void | slider_update_factor (tSlider *slider, const wmEvent *event) |
tSlider * | ED_slider_create (struct bContext *C) |
void | ED_slider_init (struct tSlider *slider, const wmEvent *event) |
bool | ED_slider_modal (tSlider *slider, const wmEvent *event) |
void | ED_slider_status_string_get (const struct tSlider *slider, char *status_string, const size_t size_of_status_string) |
void | ED_slider_destroy (struct bContext *C, tSlider *slider) |
float | ED_slider_factor_get (struct tSlider *slider) |
void | ED_slider_factor_set (struct tSlider *slider, const float factor) |
bool | ED_slider_allow_overshoot_get (struct tSlider *slider) |
void | ED_slider_allow_overshoot_set (struct tSlider *slider, const bool value) |
typedef struct MetadataCustomCountContext MetadataCustomCountContext |
typedef struct MetadataCustomDrawContext MetadataCustomDrawContext |
|
static |
Definition at line 208 of file ed_draw.c.
References BLF_width_and_height(), pad, UI_draw_roundbox_3ub_alpha(), rctf::xmax, and rctf::xmin.
Referenced by sequencer_draw_display_buffer(), sequencer_draw_preview(), sequencer_get_scope(), sequencer_preview_get_rect(), and slider_draw().
|
static |
Definition at line 163 of file ed_draw.c.
References clamp_f(), OVERSHOOT_RANGE_DELTA, SLIDE_PIXEL_DISTANCE, UI_draw_roundbox_3ub_alpha(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by slider_draw().
|
static |
Definition at line 91 of file ed_draw.c.
References color, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_polygon_smooth(), GPU_PRIM_TRIS, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniformColor3ubvAlpha(), immVertex2f(), immVertexFormat(), x, and y.
Referenced by slider_draw().
|
static |
Definition at line 116 of file ed_draw.c.
References ceil(), float(), SLIDE_PIXEL_DISTANCE, UI_draw_roundbox_3ub_alpha(), x, and rctf::xmin.
Referenced by slider_draw().
Definition at line 505 of file ed_draw.c.
References C, CTX_wm_window(), wmWindow::eventstate, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniformThemeColor3(), immVertex2fv(), immVertexFormat(), TH_VIEW_OVERLAY, UI_DPI_FAC, ARegion::winrct, rcti::xmin, wmEvent::xy, and rcti::ymin.
void ED_region_image_metadata_draw | ( | int | x, |
int | y, | ||
struct ImBuf * | ibuf, | ||
const rctf * | frame, | ||
float | zoomx, | ||
float | zoomy | ||
) |
Definition at line 755 of file ed_draw.c.
References BLF_clipping(), BLF_CLIPPING, BLF_disable(), BLF_enable(), blf_mono_font, BLF_size(), BLI_rctf_init(), GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immRectf(), immUnbindProgram(), immUniformThemeColor(), immVertexFormat(), ImBuf::metadata, metadata_box_height_get(), metadata_draw_imbuf(), uiFontStyle::points, pos, TH_METADATA_BG, TH_METADATA_TEXT, UI_FontThemeColor(), UI_style_get_dpi(), uiStyle::widgetlabel, x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by draw_movieclip_buffer(), image_main_region_draw(), and sequencer_draw_preview().
Definition at line 493 of file ed_draw.c.
References tSlider::allow_overshoot.
Definition at line 498 of file ed_draw.c.
References tSlider::allow_overshoot.
Referenced by decimate_invoke().
Definition at line 358 of file ed_draw.c.
References tSlider::allow_overshoot, tSlider::area, C, CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), tSlider::draw_handle, ED_region_draw_cb_activate(), tSlider::factor, LISTBASE_FOREACH, MEM_callocN, tSlider::raw_factor, REGION_DRAW_POST_PIXEL, tSlider::region_header, ScrArea::regionbase, RGN_TYPE_HEADER, tSlider::scene, and slider_draw().
Referenced by graph_slider_invoke(), and pose_slide_init().
Definition at line 467 of file ed_draw.c.
References tSlider::area, C, tSlider::draw_handle, ED_area_status_text(), ED_region_draw_cb_exit(), ED_workspace_status_text(), MEM_freeN, NULL, tSlider::region_header, and ARegion::type.
Referenced by graph_slider_exit(), and pose_slide_exit().
Definition at line 480 of file ed_draw.c.
References tSlider::factor.
Referenced by blend_to_default_modal_update(), pose_slide_apply_quat(), pose_slide_apply_val(), pose_slide_modal(), pose_slide_rest_pose_apply_other_rot(), pose_slide_rest_pose_apply_vec3(), and slider_factor_get_and_remember().
Definition at line 485 of file ed_draw.c.
References clamp_f(), tSlider::factor, and tSlider::overshoot.
Referenced by graph_slider_modal(), pose_slide_init(), and pose_slide_modal().
Definition at line 386 of file ed_draw.c.
References copy_v2fl_v2i(), tSlider::last_cursor, and wmEvent::xy.
Definition at line 391 of file ed_draw.c.
References tSlider::allow_overshoot, ED_region_tag_redraw(), EVT_EKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, tSlider::increments, KM_PRESS, MOUSEMOVE, tSlider::overshoot, tSlider::precision, tSlider::region_header, slider_update_factor(), and wmEvent::type.
void ED_slider_status_string_get | ( | const struct tSlider * | slider, |
char * | status_string, | ||
size_t | size_of_status_string | ||
) |
Return string based on the current state of the slider.
Definition at line 424 of file ed_draw.c.
References tSlider::allow_overshoot, BLI_snprintf(), tSlider::increments, tSlider::overshoot, tSlider::precision, STRNCPY, and TIP_.
Referenced by blend_to_default_draw_status_header(), blend_to_neighbor_draw_status_header(), breakdown_draw_status_header(), decimate_draw_status(), and pose_slide_draw_status().
Definition at line 702 of file ed_draw.c.
References BLF_boundbox_ex(), BLF_disable(), BLF_enable(), BLF_height_max(), BLF_WORD_WRAP, BLF_wordwrap(), count, MetadataCustomCountContext::count, height, IMB_metadata_foreach(), MAX_METADATA_STR, metadata_custom_count_fields(), metadata_is_valid(), str, blender::bke::image::partial_update::wrap(), and ImBuf::x.
Referenced by ED_region_image_metadata_draw().
|
static |
Definition at line 693 of file ed_draw.c.
References MetadataCustomCountContext::count, and metadata_is_custom_drawable().
Referenced by metadata_box_height_get().
|
static |
Definition at line 583 of file ed_draw.c.
References BLF_draw(), BLF_position(), MetadataCustomDrawContext::current_y, MetadataCustomDrawContext::fontid, MAX_METADATA_STR, metadata_is_custom_drawable(), SNPRINTF, MetadataCustomDrawContext::vertical_offset, MetadataCustomDrawContext::xmin, and MetadataCustomDrawContext::ymin.
Referenced by metadata_draw_imbuf().
|
static |
Definition at line 596 of file ed_draw.c.
References BLF_descender(), BLF_disable(), BLF_draw(), BLF_draw_ex(), BLF_enable(), BLF_height_max(), BLF_position(), BLF_width(), BLF_WORD_WRAP, BLF_wordwrap(), MetadataCustomDrawContext::current_y, ELEM, MetadataCustomDrawContext::fontid, height, IMB_metadata_foreach(), len, ResultBLF::lines, MAX_METADATA_STR, meta_data_list, metadata_custom_draw_fields(), metadata_is_valid(), SNPRINTF_RLEN, UI_UNIT_X, MetadataCustomDrawContext::vertical_offset, ImBuf::x, rctf::xmax, MetadataCustomDrawContext::xmin, rctf::xmin, rctf::ymax, MetadataCustomDrawContext::ymin, and rctf::ymin.
Referenced by ED_region_image_metadata_draw().
BLI_INLINE bool metadata_is_custom_drawable | ( | const char * | field | ) |
Definition at line 560 of file ed_draw.c.
References BKE_stamp_is_known_field(), and STREQ.
Referenced by metadata_custom_count_fields(), and metadata_custom_draw_fields().
BLI_INLINE bool metadata_is_valid | ( | ImBuf * | ibuf, |
char * | r_str, | ||
short | index, | ||
int | offset | ||
) |
Definition at line 553 of file ed_draw.c.
References IMB_metadata_get_field(), MAX_METADATA_STR, meta_data_list, ImBuf::metadata, and offset.
Referenced by metadata_box_height_get(), and metadata_draw_imbuf().
Draw an on screen Slider for a Pose Slide Operator.
Definition at line 234 of file ed_draw.c.
References BLF_color3ubv(), BLF_draw(), BLF_position(), BLF_rotation(), BLF_width_and_height(), BLI_snprintf(), draw_backdrop(), draw_main_line(), draw_overshoot_triangle(), draw_ticks(), tSlider::factor, tSlider::overshoot, OVERSHOOT_RANGE_DELTA, tSlider::region_header, SLIDE_PIXEL_DISTANCE, TH_HEADER, TH_HEADER_TEXT, TH_HEADER_TEXT_HI, UI_draw_roundbox_3ub_alpha(), UI_GetThemeColor4ubv(), UI_style_get(), uiFontStyle::uifont_id, uiStyle::widget, ARegion::winx, ARegion::winy, rctf::xmax, and rctf::xmin.
Referenced by ED_slider_create().
Definition at line 341 of file ed_draw.c.
References clamp_f(), copy_v2fl_v2i(), tSlider::factor, tSlider::increments, tSlider::last_cursor, tSlider::overshoot, tSlider::precision, tSlider::raw_factor, SLIDE_PIXEL_DISTANCE, and wmEvent::xy.
Referenced by ED_slider_modal().
|
static |
Definition at line 540 of file ed_draw.c.
Referenced by metadata_draw_imbuf(), and metadata_is_valid().