|
Blender V4.3
|
#include <cmath>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_listbase.h"#include "BLI_rect.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "BLT_translation.hh"#include "BKE_context.hh"#include "BKE_image.hh"#include "BLF_api.hh"#include "IMB_imbuf_types.hh"#include "IMB_metadata.hh"#include "ED_screen.hh"#include "ED_space_api.hh"#include "ED_util.hh"#include "GPU_immediate.hh"#include "GPU_matrix.hh"#include "GPU_state.hh"#include "UI_interface.hh"#include "UI_resources.hh"#include "WM_api.hh"#include "WM_types.hh"Go to the source code of this file.
Classes | |
| struct | tSlider |
| struct | MetadataCustomDrawContext |
| struct | MetadataCustomCountContext |
Macros | |
| #define | MAX_METADATA_STR 1024 |
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 *, 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 * UI_SCALE_FAC) |
| #define | OVERSHOOT_RANGE_DELTA 0.2f |
| #define | SLIDER_UNIT_STRING_SIZE 64 |
| 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, const std::string &property_label) |
| static void | slider_draw (const bContext *, ARegion *region, void *arg) |
| static void | slider_update_factor (tSlider *slider, const wmEvent *event) |
| tSlider * | ED_slider_create (bContext *C) |
| void | ED_slider_init (tSlider *slider, const wmEvent *event) |
| bool | ED_slider_modal (tSlider *slider, const wmEvent *event) |
| void | ED_slider_status_string_get (const tSlider *slider, char *status_string, const size_t size_of_status_string) |
| void | ED_slider_destroy (bContext *C, tSlider *slider) |
| float | ED_slider_factor_get (const tSlider *slider) |
| void | ED_slider_factor_set (tSlider *slider, const float factor) |
| void | ED_slider_allow_overshoot_set (tSlider *slider, const bool lower, const bool upper) |
| bool | ED_slider_allow_increments_get (const tSlider *slider) |
| void | ED_slider_allow_increments_set (tSlider *slider, const bool value) |
| void | ED_slider_factor_bounds_set (tSlider *slider, float factor_bound_lower, float factor_bound_upper) |
| void | ED_slider_mode_set (tSlider *slider, SliderMode mode) |
| SliderMode | ED_slider_mode_get (const tSlider *slider) |
| void | ED_slider_unit_set (tSlider *slider, const char *unit) |
| void | ED_slider_property_label_set (tSlider *slider, const char *property_label) |
| #define MAX_METADATA_STR 1024 |
Definition at line 659 of file ed_draw.cc.
Referenced by metadata_box_height_get(), metadata_custom_draw_fields(), metadata_draw_imbuf(), and metadata_is_valid().
| #define OVERSHOOT_RANGE_DELTA 0.2f |
Definition at line 56 of file ed_draw.cc.
Referenced by draw_main_line(), and slider_draw().
| #define SLIDE_PIXEL_DISTANCE (300.0f * UI_SCALE_FAC) |
Definition at line 55 of file ed_draw.cc.
Referenced by draw_main_line(), draw_ticks(), slider_draw(), and slider_update_factor().
| #define SLIDER_UNIT_STRING_SIZE 64 |
Definition at line 57 of file ed_draw.cc.
|
static |
Definition at line 227 of file ed_draw.cc.
References BLF_width_and_height(), pad, UI_draw_roundbox_3ub_alpha(), rctf::xmax, and rctf::xmin.
Referenced by sequencer_calc_scopes(), sequencer_draw_display_buffer(), sequencer_draw_preview(), sequencer_preview_get_rect(), and slider_draw().
|
static |
Definition at line 183 of file ed_draw.cc.
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 112 of file ed_draw.cc.
References GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_polygon_smooth(), GPU_PRIM_TRIS, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniformColor3ubvAlpha(), immVertex2f(), and immVertexFormat().
Referenced by slider_draw().
|
static |
Definition at line 137 of file ed_draw.cc.
References ceil(), float, SLIDE_PIXEL_DISTANCE, UI_draw_roundbox_3ub_alpha(), and rctf::xmin.
Referenced by slider_draw().
Callback that draws a line between the mouse and a position given as the initial argument.
Definition at line 626 of file ed_draw.cc.
References CTX_wm_window(), wmWindow::eventstate, float, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_3D_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_SCALE_FAC, and wmEvent::xy.
Referenced by edbm_bevel_init(), and edbm_inset_init().
| void ED_region_image_metadata_draw | ( | int | x, |
| int | y, | ||
| ImBuf * | ibuf, | ||
| const rctf * | frame, | ||
| float | zoomx, | ||
| float | zoomy ) |
Definition at line 876 of file ed_draw.cc.
References BLF_CLIPPING, BLF_clipping(), BLF_disable(), BLF_enable(), blf_mono_font, BLF_size(), BLI_rctf_init(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immRectf(), immUnbindProgram(), immUniformThemeColorAlpha(), immVertexFormat(), ImBuf::metadata, metadata_box_height_get(), metadata_draw_imbuf(), uiFontStyle::points, pos, TH_METADATA_BG, TH_METADATA_TEXT, UI_FontThemeColor(), UI_SCALE_FAC, UI_style_get_dpi(), uiStyle::widget, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by draw_movieclip_buffer(), image_main_region_draw(), and sequencer_draw_preview().
| bool ED_slider_allow_increments_get | ( | const tSlider * | slider | ) |
Definition at line 586 of file ed_draw.cc.
References tSlider::allow_increments.
| void ED_slider_allow_increments_set | ( | tSlider * | slider, |
| const bool | value ) |
Definition at line 591 of file ed_draw.cc.
References tSlider::allow_increments.
Referenced by poselib_blend_init_data().
| void ED_slider_allow_overshoot_set | ( | tSlider * | slider, |
| bool | lower, | ||
| bool | upper ) |
One bool value for each side of the slider. Allows to enable overshoot only on one side.
Definition at line 580 of file ed_draw.cc.
References tSlider::allow_overshoot_lower, and tSlider::allow_overshoot_upper.
Referenced by blend_to_ease_invoke(), btw_smooth_invoke(), decimate_invoke(), ease_invoke(), ease_modal(), gaussian_smooth_invoke(), match_slope_invoke(), and poselib_blend_init_data().
Definition at line 427 of file ed_draw.cc.
References tSlider::allow_increments, tSlider::allow_overshoot_lower, tSlider::allow_overshoot_upper, tSlider::area, CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), tSlider::draw_handle, ED_area_status_text(), ED_region_draw_cb_activate(), tSlider::factor, tSlider::factor_bounds, LISTBASE_FOREACH, tSlider::raw_factor, REGION_DRAW_POST_PIXEL, tSlider::region_header, ScrArea::regionbase, RGN_TYPE_HEADER, tSlider::scene, slider_draw(), tSlider::slider_mode, SLIDER_MODE_PERCENT, and tSlider::unit_string.
Referenced by graph_slider_invoke(), pose_slide_init(), and poselib_blend_init_data().
Definition at line 553 of file ed_draw.cc.
References tSlider::area, tSlider::draw_handle, ED_area_status_text(), ED_region_draw_cb_exit(), ED_workspace_status_text(), tSlider::region_header, and ARegion::type.
Referenced by graph_slider_exit(), pose_slide_exit(), and poselib_blend_cleanup().
| void ED_slider_factor_bounds_set | ( | tSlider * | slider, |
| float | factor_bound_lower, | ||
| float | factor_bound_upper ) |
Set the soft limits for the slider, which are applied until the user enables overshooting.
Definition at line 596 of file ed_draw.cc.
References tSlider::factor_bounds.
Referenced by blend_offset_invoke(), blend_to_ease_invoke(), blend_to_neighbor_invoke(), breakdown_invoke(), btw_smooth_invoke(), ease_invoke(), ease_modal(), match_slope_invoke(), pose_slide_blend_rest_invoke(), poselib_blend_init_data(), push_pull_invoke(), scale_average_invoke(), scale_from_neighbor_invoke(), shear_invoke(), and time_offset_invoke().
Definition at line 566 of file ed_draw.cc.
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(), poselib_blend_handle_event(), and slider_factor_get_and_remember().
Definition at line 571 of file ed_draw.cc.
References clamp_f(), tSlider::factor, tSlider::factor_bounds, tSlider::overshoot, and tSlider::raw_factor.
Referenced by blend_offset_invoke(), blend_to_default_invoke(), blend_to_ease_invoke(), blend_to_neighbor_invoke(), breakdown_invoke(), btw_smooth_invoke(), ease_invoke(), ease_modal(), gaussian_smooth_invoke(), graph_slider_modal(), match_slope_invoke(), pose_slide_blend_rest_invoke(), pose_slide_init(), pose_slide_modal(), poselib_blend_init_data(), push_pull_invoke(), scale_average_invoke(), scale_from_neighbor_invoke(), shear_invoke(), and time_offset_invoke().
For modal operations so the percentage doesn't pop on the first mouse movement.
Definition at line 467 of file ed_draw.cc.
References copy_v2fl_v2i(), tSlider::last_cursor, and wmEvent::xy.
Referenced by graph_slider_invoke(), pose_slide_invoke_common(), and poselib_blend_init_data().
Calculate slider factor based on mouse position.
Definition at line 472 of file ed_draw.cc.
References tSlider::allow_increments, tSlider::allow_overshoot_lower, tSlider::allow_overshoot_upper, 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.
Referenced by graph_slider_modal(), pose_slide_modal(), and poselib_blend_handle_event().
| SliderMode ED_slider_mode_get | ( | const tSlider * | slider | ) |
Definition at line 609 of file ed_draw.cc.
References tSlider::slider_mode.
Referenced by graph_slider_modal().
| void ED_slider_mode_set | ( | tSlider * | slider, |
| SliderMode | mode ) |
Definition at line 604 of file ed_draw.cc.
References tSlider::slider_mode.
Referenced by btw_smooth_invoke(), ease_modal(), and time_offset_invoke().
| void ED_slider_property_label_set | ( | tSlider * | slider, |
| const char * | property_label ) |
Definition at line 619 of file ed_draw.cc.
References tSlider::property_label.
Referenced by ease_invoke(), and ease_modal().
| void ED_slider_status_string_get | ( | const tSlider * | slider, |
| char * | status_string, | ||
| size_t | size_of_status_string ) |
Return string based on the current state of the slider.
Definition at line 505 of file ed_draw.cc.
References tSlider::allow_increments, tSlider::allow_overshoot_lower, tSlider::allow_overshoot_upper, BLI_snprintf(), IFACE_, tSlider::increments, tSlider::overshoot, tSlider::precision, and STRNCPY.
Referenced by common_draw_status_header(), decimate_draw_status(), ease_draw_status_header(), pose_slide_draw_status(), poselib_blend_modal(), scale_from_neighbor_draw_status_header(), and shear_draw_status_header().
| void ED_slider_unit_set | ( | tSlider * | slider, |
| const char * | unit ) |
Definition at line 614 of file ed_draw.cc.
References STRNCPY, and tSlider::unit_string.
Referenced by btw_smooth_invoke(), ease_modal(), and time_offset_invoke().
Definition at line 823 of file ed_draw.cc.
References BLF_boundbox(), BLF_disable(), BLF_enable(), BLF_height_max(), BLF_WORD_WRAP, BLF_wordwrap(), count, MetadataCustomCountContext::count, IMB_metadata_foreach(), MAX_METADATA_STR, metadata_custom_count_fields(), metadata_is_valid(), str, wrap(), and ImBuf::x.
Referenced by ED_region_image_metadata_draw().
|
static |
Definition at line 814 of file ed_draw.cc.
References MetadataCustomCountContext::count, and metadata_is_custom_drawable().
Referenced by metadata_box_height_get().
|
static |
Definition at line 704 of file ed_draw.cc.
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 717 of file ed_draw.cc.
References BLF_descender(), BLF_disable(), BLF_draw(), BLF_enable(), BLF_height_max(), BLF_position(), BLF_width(), BLF_WORD_WRAP, BLF_wordwrap(), MetadataCustomDrawContext::current_y, ELEM, MetadataCustomDrawContext::fontid, 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 681 of file ed_draw.cc.
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 674 of file ed_draw.cc.
References IMB_metadata_get_field(), MAX_METADATA_STR, meta_data_list, and ImBuf::metadata.
Referenced by metadata_box_height_get(), and metadata_draw_imbuf().
Draw an on screen Slider for a Pose Slide Operator.
Definition at line 261 of file ed_draw.cc.
References BLF_color3ubv(), BLF_draw(), BLF_position(), BLF_rotation(), BLF_width_and_height(), draw_backdrop(), draw_main_line(), draw_overshoot_triangle(), draw_ticks(), tSlider::factor, tSlider::factor_bounds, tSlider::overshoot, OVERSHOOT_RANGE_DELTA, tSlider::property_label, tSlider::region_header, SLIDE_PIXEL_DISTANCE, tSlider::slider_mode, SLIDER_MODE_FLOAT, SLIDER_MODE_PERCENT, SNPRINTF, TH_HEADER, TH_HEADER_TEXT, TH_HEADER_TEXT_HI, UI_draw_roundbox_3ub_alpha(), UI_GetThemeColor4ubv(), UI_style_get(), uiFontStyle::uifont_id, tSlider::unit_string, uiStyle::widget, ARegion::winy, and rctf::xmin.
Referenced by ED_slider_create().
Definition at line 398 of file ed_draw.cc.
References tSlider::allow_overshoot_lower, tSlider::allow_overshoot_upper, clamp_f(), copy_v2fl_v2i(), tSlider::factor, tSlider::factor_bounds, tSlider::increments, tSlider::last_cursor, max_ff(), min_ff(), tSlider::overshoot, tSlider::precision, tSlider::raw_factor, SLIDE_PIXEL_DISTANCE, and wmEvent::xy.
Referenced by ED_slider_modal().
|
static |
Definition at line 661 of file ed_draw.cc.
Referenced by metadata_draw_imbuf(), and metadata_is_valid().