|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "BLI_math.h"#include "DNA_object_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_view3d_types.h"#include "BKE_context.h"#include "BKE_layer.h"#include "RNA_access.h"#include "UI_resources.h"#include "UI_view2d.h"#include "WM_api.h"#include "WM_message.h"#include "WM_types.h"#include "ED_gizmo_library.h"#include "ED_gizmo_utils.h"#include "ED_image.h"#include "ED_screen.h"#include "ED_uvedit.h"#include "transform.h"Go to the source code of this file.
Classes | |
| struct | GizmoGroup2D |
| struct | GizmoGroup_Resize2D |
| struct | GizmoGroup_Rotate2D |
Functions | |
Shared Callback's | |
| static bool | gizmo2d_generic_poll (const bContext *C, wmGizmoGroupType *gzgt) |
| static void | gizmo2d_pivot_point_message_subscribe (struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus, bScreen *screen, ScrArea *area, ARegion *region) |
Scale Handles | |
| typedef struct GizmoGroup_Resize2D | GizmoGroup_Resize2D |
| static GizmoGroup_Resize2D * | gizmogroup2d_resize_init (wmGizmoGroup *gzgroup) |
| static void | gizmo2d_resize_refresh (const bContext *C, wmGizmoGroup *gzgroup) |
| static void | gizmo2d_resize_draw_prepare (const bContext *C, wmGizmoGroup *gzgroup) |
| static void | gizmo2d_resize_setup (const bContext *UNUSED(C), wmGizmoGroup *gzgroup) |
| static void | gizmo2d_resize_message_subscribe (const struct bContext *C, struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus) |
| void | ED_widgetgroup_gizmo2d_resize_callbacks_set (wmGizmoGroupType *gzgt) |
Rotate Handles | |
Defines public functions, not the gizmo itself:
| |
| typedef struct GizmoGroup_Rotate2D | GizmoGroup_Rotate2D |
| static GizmoGroup_Rotate2D * | gizmogroup2d_rotate_init (wmGizmoGroup *gzgroup) |
| static void | gizmo2d_rotate_refresh (const bContext *C, wmGizmoGroup *gzgroup) |
| static void | gizmo2d_rotate_draw_prepare (const bContext *C, wmGizmoGroup *gzgroup) |
| static void | gizmo2d_rotate_setup (const bContext *UNUSED(C), wmGizmoGroup *gzgroup) |
| static void | gizmo2d_rotate_message_subscribe (const struct bContext *C, struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus) |
| void | ED_widgetgroup_gizmo2d_rotate_callbacks_set (wmGizmoGroupType *gzgt) |
| typedef struct GizmoGroup2D GizmoGroup2D |
| typedef struct GizmoGroup_Resize2D GizmoGroup_Resize2D |
| typedef struct GizmoGroup_Rotate2D GizmoGroup_Rotate2D |
| anonymous enum |
| Enumerator | |
|---|---|
| MAN2D_AXIS_TRANS_X | |
| MAN2D_AXIS_TRANS_Y | |
| MAN2D_AXIS_LAST | |
Definition at line 132 of file transform_gizmo_2d.c.
| void ED_widgetgroup_gizmo2d_resize_callbacks_set | ( | wmGizmoGroupType * | gzgt | ) |
Definition at line 674 of file transform_gizmo_2d.c.
References wmGizmoGroupType::draw_prepare, gizmo2d_generic_poll(), gizmo2d_resize_draw_prepare(), gizmo2d_resize_message_subscribe(), gizmo2d_resize_refresh(), gizmo2d_resize_setup(), wmGizmoGroupType::message_subscribe, wmGizmoGroupType::poll, wmGizmoGroupType::refresh, wmGizmoGroupType::setup, wmGizmoGroupType::setup_keymap, and WM_gizmogroup_setup_keymap_generic_maybe_drag().
Referenced by IMAGE_GGT_gizmo2d_resize().
| void ED_widgetgroup_gizmo2d_rotate_callbacks_set | ( | wmGizmoGroupType * | gzgt | ) |
Definition at line 794 of file transform_gizmo_2d.c.
References wmGizmoGroupType::draw_prepare, gizmo2d_generic_poll(), gizmo2d_rotate_draw_prepare(), gizmo2d_rotate_message_subscribe(), gizmo2d_rotate_refresh(), gizmo2d_rotate_setup(), wmGizmoGroupType::message_subscribe, wmGizmoGroupType::poll, wmGizmoGroupType::refresh, wmGizmoGroupType::setup, wmGizmoGroupType::setup_keymap, and WM_gizmogroup_setup_keymap_generic_maybe_drag().
Referenced by IMAGE_GGT_gizmo2d_rotate().
| void ED_widgetgroup_gizmo2d_xform_callbacks_set | ( | wmGizmoGroupType * | gzgt | ) |
Definition at line 512 of file transform_gizmo_2d.c.
References wmGizmoGroupType::draw_prepare, gizmo2d_generic_poll(), gizmo2d_xform_draw_prepare(), gizmo2d_xform_refresh(), gizmo2d_xform_setup(), wmGizmoGroupType::poll, wmGizmoGroupType::refresh, wmGizmoGroupType::setup, wmGizmoGroupType::setup_keymap, and WM_gizmogroup_setup_keymap_generic_maybe_drag().
Referenced by ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set(), and IMAGE_GGT_gizmo2d().
| void ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set | ( | wmGizmoGroupType * | gzgt | ) |
Definition at line 521 of file transform_gizmo_2d.c.
References ED_widgetgroup_gizmo2d_xform_callbacks_set(), gizmo2d_xform_no_cage_message_subscribe(), gizmo2d_xform_setup_no_cage(), wmGizmoGroupType::message_subscribe, and wmGizmoGroupType::setup.
Referenced by IMAGE_GGT_gizmo2d_translate().
|
static |
Calculates origin in view space, use with gizmo2d_origin_to_region.
Definition at line 204 of file transform_gizmo_2d.c.
References blender::compositor::area(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs, C, CTX_data_scene(), CTX_data_view_layer(), CTX_wm_area(), ED_uvedit_minmax_multi(), MEM_freeN, mid_v2_v2v2(), NULL, scene, SPACE_IMAGE, and zero_v2().
Referenced by gizmo2d_xform_refresh().
Definition at line 237 of file transform_gizmo_2d.c.
References blender::compositor::area(), SpaceImage::around, C, CTX_data_scene(), CTX_data_view_layer(), CTX_wm_area(), ED_uvedit_center_from_pivot_ex(), scene, SPACE_IMAGE, and zero_v2().
Referenced by gizmo2d_modal(), gizmo2d_resize_refresh(), gizmo2d_rotate_refresh(), and gizmo2d_xform_refresh().
|
static |
Definition at line 58 of file transform_gizmo_2d.c.
References blender::compositor::area(), C, CTX_data_edit_object(), CTX_wm_area(), ED_gizmo_poll_or_unlink_delayed_from_tool(), ED_space_image_show_uvedit(), SPACE_IMAGE, and USER_GIZMO_DRAW.
Referenced by ED_widgetgroup_gizmo2d_resize_callbacks_set(), ED_widgetgroup_gizmo2d_rotate_callbacks_set(), and ED_widgetgroup_gizmo2d_xform_callbacks_set().
Definition at line 154 of file transform_gizmo_2d.c.
References alpha, BLI_assert, copy_v4_v4(), MAN2D_AXIS_TRANS_X, MAN2D_AXIS_TRANS_Y, TH_AXIS_X, TH_AXIS_Y, and UI_GetThemeColor4fv().
Referenced by gizmo2d_resize_setup(), and gizmo2d_xform_setup().
|
static |
Custom handler for gizmo widgets
Definition at line 262 of file transform_gizmo_2d.c.
References C, CTX_wm_region(), ED_region_tag_redraw_editor_overlays(), gizmo2d_calc_center(), gizmo2d_origin_to_region(), OPERATOR_RUNNING_MODAL, and WM_gizmo_set_matrix_location().
Referenced by gizmo2d_resize_setup(), gizmo2d_rotate_setup(), and gizmo2d_xform_setup().
| BLI_INLINE void gizmo2d_origin_to_region | ( | ARegion * | region, |
| float * | r_origin | ||
| ) |
Convert origin (or any other point) from view to region space.
Definition at line 254 of file transform_gizmo_2d.c.
References UI_view2d_view_to_region_fl(), and ARegion::v2d.
Referenced by gizmo2d_modal(), gizmo2d_resize_draw_prepare(), gizmo2d_rotate_draw_prepare(), and gizmo2d_xform_draw_prepare().
|
static |
Definition at line 82 of file transform_gizmo_2d.c.
References blender::compositor::area(), SpaceImage::around, ARRAY_SIZE, bScreen::id, NULL, wmMsgSubscribeValue::owner, wmGizmoGroup::parent_gzmap, ptr, RNA_pointer_create(), RNA_SpaceImageEditor, SPACE_IMAGE, V3D_AROUND_CURSOR, WM_gizmo_do_msg_notify_tag_refresh(), and WM_msg_subscribe_rna().
Referenced by gizmo2d_resize_message_subscribe(), gizmo2d_rotate_message_subscribe(), and gizmo2d_xform_no_cage_message_subscribe().
|
static |
Definition at line 577 of file transform_gizmo_2d.c.
References ARRAY_SIZE, C, CTX_data_scene(), CTX_wm_region(), wmGizmoGroup::customdata, wmGizmoGroupType::flag, gizmo2d_origin_to_region(), GizmoGroup_Resize2D::gizmo_xy, GizmoGroup_Resize2D::origin, SCE_WORKSPACE_TOOL_FALLBACK, scene, Scene::toolsettings, wmGizmoGroup::type, UNPACK2, wmGizmoGroup::use_fallback_keymap, WM_gizmo_set_matrix_location(), WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP, and ToolSettings::workspace_tool_type.
Referenced by ED_widgetgroup_gizmo2d_resize_callbacks_set().
|
static |
Definition at line 664 of file transform_gizmo_2d.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), and gizmo2d_pivot_point_message_subscribe().
Referenced by ED_widgetgroup_gizmo2d_resize_callbacks_set().
|
static |
Definition at line 558 of file transform_gizmo_2d.c.
References ARRAY_SIZE, C, copy_v2_v2(), wmGizmoGroup::customdata, wmGizmo::flag, gizmo2d_calc_center(), GizmoGroup_Resize2D::gizmo_xy, GizmoGroup_Resize2D::origin, and WM_GIZMO_HIDDEN.
Referenced by ED_widgetgroup_gizmo2d_resize_callbacks_set().
|
static |
Definition at line 601 of file transform_gizmo_2d.c.
References ARRAY_SIZE, copy_v4_v4(), wmGizmoGroup::customdata, ED_GIZMO_ARROW_STYLE_BOX, ED_GIZMO_BUTTON_SHOW_BACKDROP, gizmo2d_get_axis_color(), gizmo2d_modal(), GIZMO_AXIS_LINE_WIDTH, GizmoGroup_Resize2D::gizmo_xy, gizmogroup2d_resize_init(), NULL, wmGizmo::ptr, ptr, RNA_boolean_set(), RNA_boolean_set_array(), RNA_enum_set(), RNA_float_set(), RNA_property_enum_set(), RNA_struct_find_property(), TH_GIZMO_VIEW_ALIGN, UI_GetThemeColor4fv(), WM_gizmo_operator_set(), WM_gizmo_set_color(), WM_gizmo_set_color_highlight(), WM_gizmo_set_fn_custom_modal(), WM_gizmo_set_line_width(), WM_gizmo_set_matrix_rotation_from_z_axis(), WM_gizmo_set_scale(), and WM_operatortype_find().
Referenced by ED_widgetgroup_gizmo2d_resize_callbacks_set().
|
static |
Definition at line 726 of file transform_gizmo_2d.c.
References C, CTX_data_scene(), CTX_wm_region(), wmGizmoGroup::customdata, wmGizmoGroupType::flag, GizmoGroup_Rotate2D::gizmo, gizmo2d_origin_to_region(), GizmoGroup_Rotate2D::origin, SCE_WORKSPACE_TOOL_FALLBACK, scene, Scene::toolsettings, wmGizmoGroup::type, UNPACK2, wmGizmoGroup::use_fallback_keymap, WM_gizmo_set_matrix_location(), WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP, and ToolSettings::workspace_tool_type.
Referenced by ED_widgetgroup_gizmo2d_rotate_callbacks_set().
|
static |
Definition at line 784 of file transform_gizmo_2d.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), and gizmo2d_pivot_point_message_subscribe().
Referenced by ED_widgetgroup_gizmo2d_rotate_callbacks_set().
|
static |
Definition at line 711 of file transform_gizmo_2d.c.
References C, copy_v2_v2(), wmGizmoGroup::customdata, wmGizmo::flag, GizmoGroup_Rotate2D::gizmo, gizmo2d_calc_center(), GizmoGroup_Rotate2D::origin, and WM_GIZMO_HIDDEN.
Referenced by ED_widgetgroup_gizmo2d_rotate_callbacks_set().
|
static |
Definition at line 748 of file transform_gizmo_2d.c.
References wmGizmoGroup::customdata, ED_GIZMO_BUTTON_SHOW_BACKDROP, GizmoGroup_Rotate2D::gizmo, gizmo2d_modal(), gizmogroup2d_rotate_init(), NULL, wmGizmo::ptr, ptr, RNA_boolean_set(), RNA_enum_set(), RNA_float_set(), RNA_property_enum_set(), RNA_struct_find_property(), TH_GIZMO_VIEW_ALIGN, UI_GetThemeColor4fv(), WM_gizmo_operator_set(), WM_gizmo_set_color(), WM_gizmo_set_color_highlight(), WM_gizmo_set_fn_custom_modal(), WM_gizmo_set_line_width(), WM_gizmo_set_scale(), and WM_operatortype_find().
Referenced by ED_widgetgroup_gizmo2d_rotate_callbacks_set().
|
static |
Definition at line 482 of file transform_gizmo_2d.c.
References ARRAY_SIZE, C, GizmoGroup2D::cage, CTX_wm_region(), wmGizmoGroup::customdata, gizmo2d_origin_to_region(), wmGizmo::matrix_offset, wmGizmo::matrix_space, GizmoGroup2D::max, GizmoGroup2D::min, GizmoGroup2D::origin, GizmoGroup2D::translate_xy, UI_view2d_view_to_region_m4(), UNPACK2, ARegion::v2d, WM_gizmo_set_matrix_location(), and WM_gizmo_set_matrix_offset_location().
Referenced by ED_widgetgroup_gizmo2d_xform_callbacks_set().
|
static |
Definition at line 502 of file transform_gizmo_2d.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), and gizmo2d_pivot_point_message_subscribe().
Referenced by ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set().
|
static |
Definition at line 395 of file transform_gizmo_2d.c.
References ARRAY_SIZE, C, GizmoGroup2D::cage, copy_v2_v2(), CTX_data_scene(), wmGizmoGroup::customdata, 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, equals_v2v2(), wmGizmo::flag, wmGizmoGroupType::flag, gizmo2d_calc_bounds(), gizmo2d_calc_center(), GizmoGroup2D::max, max, mid_v2_v2v2(), min, GizmoGroup2D::min, GizmoGroup2D::no_cage, GizmoGroup2D::origin, wmGizmoOpElem::ptr, RNA_property_float_set_array(), RNA_struct_find_property(), SCE_WORKSPACE_TOOL_FALLBACK, scene, Scene::toolsettings, GizmoGroup2D::translate_xy, wmGizmoGroup::type, wmGizmoGroup::use_fallback_keymap, WM_GIZMO_HIDDEN, WM_gizmo_operator_get(), WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP, and ToolSettings::workspace_tool_type.
Referenced by ED_widgetgroup_gizmo2d_xform_callbacks_set().
|
static |
Definition at line 279 of file transform_gizmo_2d.c.
References ARRAY_SIZE, GizmoGroup2D::cage, copy_v4_v4(), wmGizmoGroup::customdata, ED_GIZMO_BUTTON_SHOW_BACKDROP, 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, wmGizmo::flag, gizmo2d_get_axis_color(), gizmo2d_modal(), GIZMO_AXIS_LINE_WIDTH, gizmogroup2d_init(), NULL, wmGizmo::ptr, ptr, RNA_boolean_set(), RNA_boolean_set_array(), RNA_enum_set(), RNA_float_set(), RNA_property_boolean_set(), RNA_property_boolean_set_array(), RNA_property_enum_set(), RNA_struct_find_property(), TH_GIZMO_VIEW_ALIGN, GizmoGroup2D::translate_xy, UI_GetThemeColor4fv(), WM_GIZMO_DRAW_OFFSET_SCALE, WM_gizmo_operator_set(), WM_gizmo_set_color(), WM_gizmo_set_color_highlight(), WM_gizmo_set_fn_custom_modal(), WM_gizmo_set_line_width(), WM_gizmo_set_matrix_offset_location(), WM_gizmo_set_matrix_rotation_from_z_axis(), WM_gizmo_set_scale(), and WM_operatortype_find().
Referenced by ED_widgetgroup_gizmo2d_xform_callbacks_set(), and gizmo2d_xform_setup_no_cage().
|
static |
Definition at line 388 of file transform_gizmo_2d.c.
References C, wmGizmoGroup::customdata, gizmo2d_xform_setup(), and GizmoGroup2D::no_cage.
Referenced by ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set().
|
static |
Definition at line 180 of file transform_gizmo_2d.c.
References GizmoGroup2D::cage, ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, MEM_callocN, NULL, wmGizmo::ptr, RNA_enum_set(), GizmoGroup2D::translate_xy, WM_gizmo_new_ptr(), and WM_gizmotype_find().
Referenced by gizmo2d_xform_setup().
|
static |
Definition at line 544 of file transform_gizmo_2d.c.
References GizmoGroup_Resize2D::gizmo_xy, MEM_callocN, NULL, WM_gizmo_new_ptr(), and WM_gizmotype_find().
Referenced by gizmo2d_resize_setup().
|
static |
Definition at line 700 of file transform_gizmo_2d.c.
References GizmoGroup_Rotate2D::gizmo, MEM_callocN, NULL, WM_gizmo_new_ptr(), and WM_gizmotype_find().
Referenced by gizmo2d_rotate_setup().