Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_dial_2d.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BKE_context.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
#include "GPU_shader.h"
#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_gizmo_library.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "../gizmo_library_intern.h"
Go to the source code of this file.
Classes | |
struct | RectTransformInteraction |
Macros | |
#define | MUL_V2_V3_M4_FINAL(test_co, mouse_co) |
Typedefs | |
typedef struct RectTransformInteraction | RectTransformInteraction |
Functions | |
static void | gizmo_cage2d_draw_intern (wmGizmo *gz, const bool select, const bool highlight, const int select_id) |
static void | gizmo_cage2d_draw_select (const bContext *UNUSED(C), wmGizmo *gz, int select_id) |
static void | gizmo_cage2d_draw (const bContext *UNUSED(C), wmGizmo *gz) |
static int | gizmo_cage2d_get_cursor (wmGizmo *gz) |
static int | gizmo_cage2d_test_select (bContext *C, wmGizmo *gz, const int mval[2]) |
static void | gizmo_cage2d_setup (wmGizmo *gz) |
static int | gizmo_cage2d_invoke (bContext *C, wmGizmo *gz, const wmEvent *event) |
static void | gizmo_rect_pivot_from_scale_part (int part, float r_pt[2], bool r_constrain_axis[2]) |
static int | gizmo_cage2d_modal (bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak UNUSED(tweak_flag)) |
static void | gizmo_cage2d_property_update (wmGizmo *gz, wmGizmoProperty *gz_prop) |
static void | gizmo_cage2d_exit (bContext *C, wmGizmo *gz, const bool cancel) |
Box Draw Style | |
Useful for 3D views, see: ED_GIZMO_CAGE2D_STYLE_BOX | |
static void | cage2d_draw_box_corners (const rctf *r, const float margin[2], const float color[3], const float line_width) |
static void | cage2d_draw_box_interaction (const float color[4], const int highlighted, const float size[2], const float margin[2], const float line_width, const bool is_solid, const int draw_options) |
Circle Draw Style | |
Useful for 2D views, see: ED_GIZMO_CAGE2D_STYLE_CIRCLE | |
static void | imm_draw_point_aspect_2d (uint pos, float x, float y, float rad_x, float rad_y, bool solid) |
static void | cage2d_draw_circle_wire (const rctf *r, const float margin[2], const float color[3], const int transform_flag, const int draw_options, const float line_width) |
static void | cage2d_draw_circle_handles (const rctf *r, const float margin[2], const float color[3], const int transform_flag, bool solid) |
Cage Gizmo API | |
static void | GIZMO_GT_cage_2d (wmGizmoType *gzt) |
void | ED_gizmotypes_cage_2d (void) |
Cage Gizmo | |
Rectangular gizmo acting as a 'cage' around its content. Interacting scales or translates the gizmo. 2D Gizmo | |
#define | GIZMO_MARGIN_OFFSET_SCALE 1.5f |
static bool | gizmo_calc_rect_view_scale (const wmGizmo *gz, const float dims[2], float scale[2]) |
static bool | gizmo_calc_rect_view_margin (const wmGizmo *gz, const float dims[2], float margin[2]) |
#define GIZMO_MARGIN_OFFSET_SCALE 1.5f |
Definition at line 43 of file cage2d_gizmo.c.
#define MUL_V2_V3_M4_FINAL | ( | test_co, | |
mouse_co | |||
) |
typedef struct RectTransformInteraction RectTransformInteraction |
|
static |
Definition at line 97 of file cage2d_gizmo.c.
References color, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3fv(), immVertex3f(), immVertexFormat(), pos, and r.
Referenced by gizmo_cage2d_draw_intern().
|
static |
Definition at line 141 of file cage2d_gizmo.c.
References ARRAY_SET_ITEMS, attr_id, BLI_assert, col, color, ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, ED_GIZMO_CAGE2D_PART_ROTATE, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ED_GIZMO_CAGE2D_PART_TRANSLATE, ELEM, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_NONE, GPU_PRIM_TRI_FAN, GPU_SHADER_2D_FLAT_COLOR, GPU_SHADER_3D_POLYLINE_FLAT_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immAttr3f(), immAttr3fv(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immVertex2fv(), immVertexFormat(), pos, r, size(), verts, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by gizmo_cage2d_draw_intern().
|
static |
Definition at line 536 of file cage2d_gizmo.c.
References BLI_rctf_cent_x(), color, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, float(), GIZMO_MARGIN_OFFSET_SCALE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), imm_draw_circle_fill_aspect_2d(), imm_draw_circle_wire_aspect_2d(), imm_draw_point_aspect_2d(), immBindBuiltinProgram(), immUnbindProgram(), immUniformColor3fv(), immVertexFormat(), pos, r, and void.
Referenced by gizmo_cage2d_draw_intern().
|
static |
Definition at line 475 of file cage2d_gizmo.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), center, color, ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3fv(), immVertex3f(), immVertexFormat(), pos, and r.
Referenced by gizmo_cage2d_draw_intern().
Definition at line 1230 of file cage2d_gizmo.c.
References GIZMO_GT_cage_2d(), and WM_gizmotype_append().
Referenced by ED_spacetypes_init().
Definition at line 723 of file cage2d_gizmo.c.
References gizmo_cage2d_draw_intern(), wmGizmo::state, and WM_GIZMO_STATE_HIGHLIGHT.
Referenced by GIZMO_GT_cage_2d().
|
static |
Definition at line 573 of file cage2d_gizmo.c.
References ARRAY_SIZE, BLI_assert, cage2d_draw_box_corners(), cage2d_draw_box_interaction(), cage2d_draw_circle_handles(), cage2d_draw_circle_wire(), color, wmGizmo::color, ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, ED_GIZMO_CAGE2D_PART_ROTATE, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ED_GIZMO_CAGE2D_PART_TRANSLATE, ED_GIZMO_CAGE2D_STYLE_BOX, ED_GIZMO_CAGE2D_STYLE_CIRCLE, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, gizmo_calc_rect_view_margin(), gizmo_color_get(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), GPU_select_load_id(), GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), wmGizmo::highlight_part, immBindBuiltinProgram(), immRectf(), immUnbindProgram(), immUniformColor4fv(), immVertexFormat(), wmGizmo::line_width, pos, wmGizmo::ptr, r, RNA_enum_get(), RNA_float_get_array(), select(), size(), and WM_gizmo_calc_matrix_final().
Referenced by gizmo_cage2d_draw(), and gizmo_cage2d_draw_select().
|
static |
For when we want to draw 2d cage in 3d views.
Definition at line 718 of file cage2d_gizmo.c.
References gizmo_cage2d_draw_intern().
Referenced by GIZMO_GT_cage_2d().
Definition at line 1146 of file cage2d_gizmo.c.
References C, copy_m4_m4(), data, wmGizmo::interaction_data, wmGizmo::matrix_offset, MEM_SAFE_FREE, NULL, wmGizmoProperty::type, WM_gizmo_target_property_find(), and WM_gizmo_target_property_float_set_array().
Referenced by GIZMO_GT_cage_2d().
|
static |
Definition at line 729 of file cage2d_gizmo.c.
References ED_GIZMO_CAGE2D_PART_ROTATE, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ED_GIZMO_CAGE2D_PART_TRANSLATE, wmGizmoGroupType::flag, wmGizmo::highlight_part, wmGizmo::parent_gzgroup, wmGizmoGroup::type, WM_CURSOR_CROSS, WM_CURSOR_DEFAULT, WM_CURSOR_NSEW_SCROLL, and WM_GIZMOGROUPTYPE_3D.
Referenced by GIZMO_GT_cage_2d().
Definition at line 892 of file cage2d_gizmo.c.
References C, copy_m4_m4(), data, gizmo_window_project_2d(), wmGizmo::interaction_data, wmGizmo::matrix_offset, MEM_callocN, wmEvent::mval, OPERATOR_RUNNING_MODAL, UNPACK2, WM_gizmo_calc_matrix_final_no_offset(), and zero_v2().
Referenced by GIZMO_GT_cage_2d().
|
static |
Definition at line 961 of file cage2d_gizmo.c.
References angle(), BLI_assert, BLI_dial_angle(), BLI_dial_init(), C, copy_m4_m4(), copy_v3_v3(), CTX_wm_region(), CTX_wm_window(), data, ED_GIZMO_CAGE2D_PART_ROTATE, ED_GIZMO_CAGE2D_PART_TRANSLATE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, ED_region_tag_redraw_editor_overlays(), gizmo_rect_pivot_from_scale_part(), gizmo_window_project_2d(), wmGizmo::highlight_part, wmGizmo::interaction_data, invert_m4_m4(), len_v3(), wmGizmo::matrix_offset, wmGizmo::matrix_space, MOUSEMOVE, mul_m4_m4m4(), MUL_V2_V3_M4_FINAL, mul_v3_fl(), wmEvent::mval, NULL, OPERATOR_RUNNING_MODAL, wmGizmo::ptr, RNA_enum_get(), RNA_float_get_array(), rotate_m4(), KDL::sign(), signum_i(), transform_pivot_set_m4(), wmGizmoProperty::type, wmEvent::type, unit_m4(), UNPACK2, WM_event_add_mousemove(), WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get_array(), WM_gizmo_target_property_float_set_array(), zero_v2(), and zero_v3().
Referenced by GIZMO_GT_cage_2d().
|
static |
Definition at line 1131 of file cage2d_gizmo.c.
References BLI_assert, wmGizmoPropertyType::idname, wmGizmo::matrix_offset, STREQ, wmGizmoProperty::type, WM_gizmo_target_property_array_length(), and WM_gizmo_target_property_float_get_array().
Referenced by GIZMO_GT_cage_2d().
Definition at line 887 of file cage2d_gizmo.c.
References wmGizmo::flag, WM_GIZMO_DRAW_MODAL, and WM_GIZMO_DRAW_NO_SCALE.
Referenced by GIZMO_GT_cage_2d().
Definition at line 761 of file cage2d_gizmo.c.
References BLI_rctf_isect_pt_v(), C, ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, ED_GIZMO_CAGE2D_PART_ROTATE, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ED_GIZMO_CAGE2D_PART_TRANSLATE, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, gizmo_calc_rect_view_margin(), GIZMO_MARGIN_OFFSET_SCALE, gizmo_window_project_2d(), wmGizmo::ptr, r, RNA_enum_get(), RNA_float_get_array(), size(), UNPACK2, and rctf::xmin.
Referenced by GIZMO_GT_cage_2d().
|
static |
Definition at line 75 of file cage2d_gizmo.c.
References gizmo_calc_rect_view_scale(), wmGizmo::scale_final, and zero_v2().
Referenced by gizmo_cage2d_draw_intern(), and gizmo_cage2d_test_select().
|
static |
Definition at line 45 of file cage2d_gizmo.c.
References len_v3(), wmGizmo::matrix_offset, mul_v2_v2(), mul_v3_mat3_m4v3(), and WM_gizmo_calc_matrix_final_no_offset().
Referenced by gizmo_calc_rect_view_margin().
|
static |
Definition at line 1171 of file cage2d_gizmo.c.
References wmGizmoType::cursor_get, wmGizmoType::draw, wmGizmoType::draw_select, ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, ED_GIZMO_CAGE2D_STYLE_BOX, ED_GIZMO_CAGE2D_STYLE_CIRCLE, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, wmGizmoType::exit, gizmo_cage2d_draw(), gizmo_cage2d_draw_select(), gizmo_cage2d_exit(), gizmo_cage2d_get_cursor(), gizmo_cage2d_invoke(), gizmo_cage2d_modal(), gizmo_cage2d_property_update(), gizmo_cage2d_setup(), gizmo_cage2d_test_select(), wmGizmoType::idname, wmGizmoType::invoke, wmGizmoType::modal, NULL, PROP_FLOAT, wmGizmoType::property_update, RNA_def_enum(), RNA_def_enum_flag(), RNA_def_float_vector(), wmGizmoType::setup, wmGizmoType::srna, wmGizmoType::struct_size, wmGizmoType::test_select, and WM_gizmotype_target_property_def().
Referenced by ED_gizmotypes_cage_2d().
|
static |
Definition at line 910 of file cage2d_gizmo.c.
References ARRAY_SET_ITEMS, BLI_assert, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, x, and y.
Referenced by gizmo_cage2d_modal().
|
static |
Definition at line 441 of file cage2d_gizmo.c.
References GPU_PRIM_LINES, GPU_PRIM_TRIS, immBegin(), immEnd(), immVertex2f(), pos, x, and y.
Referenced by cage2d_draw_circle_handles().