43 #ifdef USE_SELECT_CENTER
50 #define ORTHO_AXIS_OFFSET 2
72 #ifdef USE_SELECT_CENTER
73 float select_center[3];
74 float select_center_ortho_axis[3][3];
75 bool use_select_center;
87 #define USE_DIAL_HOVER
89 #define INIT_SCALE_BASE 2.3f
90 #define INIT_SCALE_BUTTON 0.15f
93 0x73, 0x73, 0x73, 0x36, 0x8c, 0x36, 0x8c, 0x73, 0xc9, 0x73, 0xc9, 0x8c, 0x8c,
94 0x8c, 0x8c, 0xc9, 0x73, 0xc9, 0x73, 0x8c, 0x36, 0x8c, 0x36, 0x73, 0x36, 0x73,
100 const float alpha = 0.6f;
101 const float alpha_hi = 1.0f;
110 for (
int i = 0; i < 3; i++) {
111 for (
int j = 0; j < 2; j++) {
140 for (
int i = 0; i < 3; i++) {
142 #ifndef USE_DIAL_HOVER
170 #ifdef USE_DIAL_HOVER
171 for (
int i = 0; i < 4; i++) {
185 const float axis_vec[3],
186 const float axis_tan[3])
190 if (axis_tan !=
NULL) {
198 #ifndef USE_DIAL_HOVER
204 if (axis_index < 3) {
205 for (
int j = 0; j < 2; j++) {
208 float axis_vec_flip[3];
224 float viewinv_m3[3][3];
231 switch (orient_slot->
type) {
250 #ifdef USE_DIAL_HOVER
256 for (
int i = 0; i < 4; i++) {
257 bool hide = (axis_flag & (1 << i)) == 0;
267 for (
int i = 0; i < 3; i++) {
268 for (
int j = 0; j < 2; j++) {
290 for (
int i = 0; i < 3; i++) {
302 const float *gizmo_center =
NULL;
315 for (
int j = 0; j < 2; j++) {
322 for (
int i = 0; i < 3; i++) {
325 #ifdef USE_SELECT_CENTER
326 if (ggd->
data.use_select_center) {
332 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
344 #ifdef USE_SELECT_CENTER
348 float select_center[3] = {0};
367 ggd->
data.use_select_center =
true;
370 ggd->
data.use_select_center =
false;
381 #ifdef USE_SELECT_CENTER
382 if (ggd->
data.use_select_center && !
is_zero_v3(ggd->
data.select_center_ortho_axis[i])) {
383 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
388 for (
int j = 0; j < 2; j++) {
402 for (
int j = 0; j < 2; j++) {
441 &msg_sub_value_gz_tag_refresh,
447 gzgt->
name =
"Mesh Spin Init";
448 gzgt->
idname =
"MESH_GGT_spin";
468 #undef INIT_SCALE_BASE
469 #undef INIT_SCALE_BUTTON
482 #define USE_ANGLE_Z_ORIENT
514 #ifdef USE_ANGLE_Z_ORIENT
550 const float plane_no[3])
562 float plane_co[3], plane_no[3];
570 if (is_plane_co_eq && is_plane_no_eq) {
576 if (is_plane_no_eq ==
false) {
580 for (
int i = 0; i < 2; i++) {
588 for (
int i = 0; i < 2; i++) {
592 #ifdef USE_ANGLE_Z_ORIENT
595 float orient_axis[3];
615 float *value = value_p;
633 const float *value = value_p;
638 float plane_co[3], plane[4];
659 float *value = value_p;
689 float *value = value_p;
702 float plane_no_proj[3];
720 const float *value = value_p;
733 float plane_no_proj[3];
739 if (angle_delta != 0.0f) {
757 float *value = value_p;
772 const float *value = value_p;
860 for (
int i = 0; i < 2; i++) {
870 for (
int i = 0; i < 2; i++) {
915 #ifdef USE_ANGLE_Z_ORIENT
921 float plane_co[3], plane_no[3];
955 .value_get_fn = gizmo_spin_prop_translate_get,
956 .value_set_fn = gizmo_spin_prop_translate_set,
957 .range_get_fn = NULL,
964 .value_get_fn = gizmo_spin_prop_axis_angle_get,
965 .value_set_fn = gizmo_spin_prop_axis_angle_set,
966 .range_get_fn = NULL,
970 for (
int i = 0; i < 2; i++) {
974 .value_get_fn = gizmo_spin_prop_axis_angle_get,
975 .value_set_fn = gizmo_spin_prop_axis_angle_set,
976 .range_get_fn = NULL,
982 .value_get_fn = gizmo_spin_prop_depth_get,
983 .value_set_fn = gizmo_spin_prop_depth_set,
984 .range_get_fn = NULL,
992 .value_get_fn = gizmo_spin_prop_angle_get,
993 .value_set_fn = gizmo_spin_prop_angle_set,
994 .range_get_fn = NULL,
1000 if (win && win->
active) {
1022 bool is_modal =
false;
1049 gzgt->
name =
"Mesh Spin Redo";
1050 gzgt->
idname =
"MESH_GGT_spin_redo";
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
struct TransformOrientationSlot * BKE_scene_orientation_slot_get(struct 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 equals_m3m3(const float mat1[3][3], const float mat2[3][3])
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m3_m3(float R[3][3], const float A[3][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 float normalize_v3(float r[3])
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])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
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 equals_v3v3(const float a[3], const float b[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])
#define UNUSED_VARS_NDEBUG(...)
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
@ ED_GIZMO_MOVE_STYLE_RING_2D
@ 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_ARROW_STYLE_NORMAL
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const struct bContext *C, struct wmGizmoGroupType *gzgt)
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const struct bContext *C, struct wmGizmoGroupType *gzgt, const char *idname)
bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const struct bContext *C, struct wmGizmoGroupType *gzgt, const char *gzgt_idname)
int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op)
void ED_view3d_win_to_3d_int(const struct View3D *v3d, const struct 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 struct ARegion *region, const float plane[4], const int mval[2], bool do_clip, float r_out[3])
struct RegionView3D * ED_view3d_context_rv3d(struct bContext *C)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
struct PointerRNA PointerRNA
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
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
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_spin_prop_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_mesh_spin_redo_draw_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static void gizmo_spin_prop_depth_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
struct GizmoGroupData_SpinRedo GizmoGroupData_SpinRedo
struct GizmoGroupData_SpinInit GizmoGroupData_SpinInit
static void gizmo_mesh_spin_init_invoke_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup, wmGizmo *gz, const wmEvent *UNUSED(event))
static void gizmo_spin_prop_axis_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_spin_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void MESH_GGT_spin(struct wmGizmoGroupType *gzgt)
static const uchar shape_plus[]
static void gizmo_mesh_spin_init_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, struct wmMsgBus *mbus)
#define ORTHO_AXIS_OFFSET
void MESH_GGT_spin_redo(struct wmGizmoGroupType *gzgt)
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_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static const float dial_angle_partial
static void gizmo_spin_prop_translate_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value)
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)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
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)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_axis_flag_xyz_items[]
struct wmGizmoMap * gizmo_map
struct GizmoGroupData_SpinInit::@455 invoke
struct GizmoGroupData_SpinInit::@452 gizmos
struct GizmoGroupData_SpinInit::@453 prev
PropertyRNA * gzgt_axis_prop
struct GizmoGroupData_SpinInit::@454 data
wmGizmo * icon_button[3][2]
PropertyRNA * prop_axis_no
struct GizmoGroupData_SpinRedo::@456 prev
PropertyRNA * prop_axis_co
struct wmGizmo * translate_xy[2]
float orient_axis_relative[3]
struct GizmoGroupData_SpinRedo::@457 data
struct wmGizmo * translate_c
struct wmGizmo * rotate_view
struct wmGizmo * rotate_xy[2]
struct ARegion * active_region
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInvokePrepare invoke_prepare
eWM_GizmoFlagGroupTypeFlag flag
struct wmGizmoMapType_Params gzmap_params
wmGizmoGroupFnDrawPrepare draw_prepare
struct wmGizmoGroupType * type
struct wmGizmoMap * parent_gzmap
const struct wmGizmoPropertyType * type
struct wmGizmoGroup * parent_gzgroup
float matrix_offset[4][4]
struct wmOperatorType * type
struct wmEvent * eventstate
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
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_modal_set_from_setup(struct wmGizmoMap *gzmap, struct bContext *C, struct wmGizmo *gz, int part_index, const wmEvent *event)
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])
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
wmGizmoGroup * WM_gizmomap_group_find(struct wmGizmoMap *gzmap, const char *idname)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), 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(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
void WM_msg_subscribe_rna(struct 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)