48#ifdef USE_SELECT_CENTER
55#define ORTHO_AXIS_OFFSET 2
77#ifdef USE_SELECT_CENTER
78 float select_center[3];
79 float select_center_ortho_axis[3][3];
80 bool use_select_center;
93#define INIT_SCALE_BASE 2.3f
94#define INIT_SCALE_BUTTON 0.15f
97 0x73, 0x73, 0x73, 0x36, 0x8c, 0x36, 0x8c, 0x73, 0xc9, 0x73, 0xc9, 0x8c, 0x8c,
98 0x8c, 0x8c, 0xc9, 0x73, 0xc9, 0x73, 0x8c, 0x36, 0x8c, 0x36, 0x73, 0x36, 0x73,
104 const float alpha = 0.6f;
105 const float alpha_hi = 1.0f;
115 for (
int i = 0; i < 3; i++) {
116 for (
int j = 0; j < 2; j++) {
145 for (
int i = 0; i < 3; i++) {
147#ifndef USE_DIAL_HOVER
176 for (
int i = 0; i < 4; i++) {
190 const float axis_vec[3],
191 const float axis_tan[3])
195 if (axis_tan !=
nullptr) {
203#ifndef USE_DIAL_HOVER
209 if (axis_index < 3) {
210 for (
int j = 0; j < 2; j++) {
213 float axis_vec_flip[3];
229 float viewinv_m3[3][3];
236 switch (orient_slot->
type) {
261 for (
int i = 0; i < 4; i++) {
262 bool hide = (axis_flag & (1 << i)) == 0;
272 for (
int i = 0; i < 3; i++) {
273 for (
int j = 0; j < 2; j++) {
295 for (
int i = 0; i < 3; i++) {
307 const float *gizmo_center =
nullptr;
320 for (
int j = 0; j < 2; j++) {
327 for (
int i = 0; i < 3; i++) {
330#ifdef USE_SELECT_CENTER
331 if (ggd->
data.use_select_center) {
337 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
349#ifdef USE_SELECT_CENTER
353 float select_center[3] = {0};
370 mul_m4_v3(obedit->object_to_world().ptr(), select_center);
372 ggd->
data.use_select_center =
true;
375 ggd->
data.use_select_center =
false;
386#ifdef USE_SELECT_CENTER
387 if (ggd->
data.use_select_center && !
is_zero_v3(ggd->
data.select_center_ortho_axis[i])) {
388 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
393 for (
int j = 0; j < 2; j++) {
407 for (
int j = 0; j < 2; j++) {
428 msg_sub_value_gz_tag_refresh.
owner = region;
429 msg_sub_value_gz_tag_refresh.user_data = gzgroup->
parent_gzmap;
444 gzgt->
name =
"Mesh Spin Init";
445 gzgt->
idname =
"MESH_GGT_spin";
465#undef INIT_SCALE_BASE
466#undef INIT_SCALE_BUTTON
479#define USE_ANGLE_Z_ORIENT
511#ifdef USE_ANGLE_Z_ORIENT
547 const float plane_no[3])
559 float plane_co[3], plane_no[3];
567 if (is_plane_co_eq && is_plane_no_eq) {
573 if (is_plane_no_eq ==
false) {
577 for (
int i = 0; i < 2; i++) {
585 for (
int i = 0; i < 2; i++) {
589#ifdef USE_ANGLE_Z_ORIENT
592 float orient_axis[3];
613 float *value =
static_cast<float *
>(value_p);
632 const float *value =
static_cast<const float *
>(value_p);
637 float plane_co[3], plane[4];
659 float *value =
static_cast<float *
>(value_p);
691 float *value =
static_cast<float *
>(value_p);
704 float plane_no_proj[3];
723 const float *value =
static_cast<const float *
>(value_p);
736 float plane_no_proj[3];
742 if (angle_delta != 0.0f) {
761 float *value =
static_cast<float *
>(value_p);
777 const float *value =
static_cast<const float *
>(value_p);
811 if ((op ==
nullptr) || (op->
type !=
ot)) {
866 for (
int i = 0; i < 2; i++) {
876 for (
int i = 0; i < 2; i++) {
922#ifdef USE_ANGLE_Z_ORIENT
928 float plane_co[3], plane_no[3];
937 const int mval[2] = {
event->xy[0] - region->winrct.xmin,
event->xy[1] - region->winrct.ymin};
963 params.range_get_fn =
nullptr;
964 params.user_data =
nullptr;
972 params.range_get_fn =
nullptr;
973 params.user_data =
nullptr;
977 for (
int i = 0; i < 2; i++) {
982 params.user_data =
nullptr,
989 params.range_get_fn =
nullptr;
990 params.user_data =
nullptr;
998 params.range_get_fn =
nullptr;
999 params.user_data =
nullptr;
1004 if (win && win->
active) {
1006 if (screen->active_region) {
1008 if (screen->active_region == region) {
1026 bool is_modal =
false;
1053 gzgt->
name =
"Mesh Spin Redo";
1054 gzgt->
idname =
"MESH_GGT_spin_redo";
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
TransformOrientationSlot * BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
#define LISTBASE_FOREACH(type, var, list)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3])
void mul_m3_v3(const float M[3][3], float r[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void unit_m3(float m[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
bool equals_m3m3(const float mat1[3][3], const float mat2[3][3])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
float angle_compat_rad(float angle, float angle_compat)
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE bool equals_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
void ortho_v3_v3(float out[3], const float v[3])
MINLINE void zero_v4(float r[4])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
#define UNUSED_VARS_NDEBUG(...)
@ ED_GIZMO_ARROW_STYLE_NORMAL
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR
@ ED_GIZMO_DIAL_DRAW_FLAG_FILL
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE
@ ED_GIZMO_DIAL_DRAW_FLAG_CLIP
@ ED_GIZMO_MOVE_STYLE_RING_2D
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const bContext *C, wmGizmoGroupType *gzgt, const char *idname)
bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, wmGizmoGroupType *gzgt, const char *gzgt_idname)
int ED_undo_operator_repeat(bContext *C, wmOperator *op)
RegionView3D * ED_view3d_context_rv3d(bContext *C)
void ED_view3d_win_to_3d_int(const View3D *v3d, const ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
bool ED_view3d_win_to_3d_on_plane_int(const ARegion *region, const float plane[4], const int mval[2], bool do_clip, float r_out[3])
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
void UI_GetThemeColor3fv(int colorid, float col[3])
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
@ WM_GIZMO_STATE_HIGHLIGHT
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
static void gizmo_spin_prop_depth_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
static bool gizmo_mesh_spin_redo_poll(const bContext *C, wmGizmoGroupType *gzgt)
static void gizmo_mesh_spin_redo_update_orient_axis(GizmoGroupData_SpinRedo *ggd, const float plane_no[3])
static void gizmo_spin_prop_axis_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static void gizmo_spin_exec(GizmoGroupData_SpinRedo *ggd)
static void gizmo_mesh_spin_init_invoke_prepare(const bContext *, wmGizmoGroup *gzgroup, wmGizmo *gz, const wmEvent *)
static void gizmo_spin_prop_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_spin_prop_depth_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
void MESH_GGT_spin_redo(wmGizmoGroupType *gzgt)
static void gizmo_spin_prop_axis_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_mesh_spin_init_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo_spin_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static const uchar shape_plus[]
#define ORTHO_AXIS_OFFSET
static void gizmo_mesh_spin_init_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
#define INIT_SCALE_BUTTON
static void gizmo_spin_prop_translate_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static void gizmo_mesh_spin_init_refresh_axis_orientation(wmGizmoGroup *gzgroup, int axis_index, const float axis_vec[3], const float axis_tan[3])
static void gizmo_mesh_spin_redo_update_from_op(GizmoGroupData_SpinRedo *ggd)
static const float dial_angle_partial_margin
static void gizmo_mesh_spin_init_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
static void gizmo_mesh_spin_redo_draw_prepare(const bContext *, wmGizmoGroup *gzgroup)
static const float dial_angle_partial
static void gizmo_spin_prop_translate_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value)
void MESH_GGT_spin(wmGizmoGroupType *gzgt)
static void gizmo_mesh_spin_redo_modal_from_setup(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void *(* MEM_callocN)(size_t len, const char *str)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_axis_flag_xyz_items[]
struct GizmoGroupData_SpinInit::@415 data
struct GizmoGroupData_SpinInit::@414 prev
struct GizmoGroupData_SpinInit::@413 gizmos
PropertyRNA * gzgt_axis_prop
wmGizmo * icon_button[3][2]
struct GizmoGroupData_SpinInit::@416 invoke
PropertyRNA * prop_axis_no
PropertyRNA * prop_axis_co
struct GizmoGroupData_SpinRedo::@418 data
struct GizmoGroupData_SpinRedo::@417 prev
float orient_axis_relative[3]
wmGizmo * translate_xy[2]
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoMapType_Params gzmap_params
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupFnDrawPrepare draw_prepare
wmGizmoMap * parent_gzmap
const wmGizmoPropertyType * type
wmGizmoGroup * parent_gzgroup
float matrix_offset[4][4]
struct wmOperatorType * type
struct wmEvent * eventstate
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
void WM_gizmo_set_matrix_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
const wmGizmoType * WM_gizmotype_find(const char *idname, bool quiet)
void WM_msg_subscribe_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
wmOperator * WM_operator_last_redo(const bContext *C)
bScreen * WM_window_get_active_screen(const wmWindow *win)