51#ifdef USE_SELECT_CENTER
58#define ORTHO_AXIS_OFFSET 2
80#ifdef USE_SELECT_CENTER
81 float select_center[3];
82 float select_center_ortho_axis[3][3];
83 bool use_select_center;
96#define INIT_SCALE_BASE 2.3f
97#define INIT_SCALE_BUTTON 0.15f
100 0x73, 0x73, 0x73, 0x36, 0x8c, 0x36, 0x8c, 0x73, 0xc9, 0x73, 0xc9, 0x8c, 0x8c,
101 0x8c, 0x8c, 0xc9, 0x73, 0xc9, 0x73, 0x8c, 0x36, 0x8c, 0x36, 0x73, 0x36, 0x73,
107 const float alpha = 0.6f;
108 const float alpha_hi = 1.0f;
117 for (
int i = 0; i < 3; i++) {
118 for (
int j = 0; j < 2; j++) {
136 ggd->
gizmos.icon_button[i][j] = gz;
144 ggd->
gizmos.xyz_view[i] = gz;
147 for (
int i = 0; i < 3; i++) {
149#ifndef USE_DIAL_HOVER
178 for (
int i = 0; i < 4; i++) {
192 const float axis_vec[3],
193 const float axis_tan[3])
197 if (axis_tan !=
nullptr) {
205#ifndef USE_DIAL_HOVER
211 if (axis_index < 3) {
212 for (
int j = 0; j < 2; j++) {
213 gz = ggd->
gizmos.icon_button[axis_index][j];
215 float axis_vec_flip[3];
231 float viewinv_m3[3][3];
238 switch (orient_slot->
type) {
263 for (
int i = 0; i < 4; i++) {
264 bool hide = (axis_flag & (1 << i)) == 0;
274 for (
int i = 0; i < 3; i++) {
275 for (
int j = 0; j < 2; j++) {
296 ggd->
invoke.ortho_axis_active = -1;
297 for (
int i = 0; i < 3; i++) {
299 ggd->
invoke.ortho_axis_active = i;
309 const float *gizmo_center =
nullptr;
322 for (
int j = 0; j < 2; j++) {
329 for (
int i = 0; i < 3; i++) {
331 const float *axis_ortho_vec = ggd->
data.orient_mat[axis_ortho];
332#ifdef USE_SELECT_CENTER
333 if (ggd->
data.use_select_center) {
337 ggd->
data.select_center_ortho_axis[i], delta, ggd->
data.orient_mat[i]);
339 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
344 gzgroup, i, ggd->
data.orient_mat[i], axis_ortho_vec);
351#ifdef USE_SELECT_CENTER
355 float select_center[3] = {0};
371 mul_m4_v3(obedit->object_to_world().ptr(), select_center);
373 ggd->
data.use_select_center =
true;
376 ggd->
data.use_select_center =
false;
383 const float *axis_ortho_vec = ggd->
data.orient_mat[axis_ortho];
387#ifdef USE_SELECT_CENTER
388 if (ggd->
data.use_select_center && !
is_zero_v3(ggd->
data.select_center_ortho_axis[i])) {
389 axis_ortho_vec = ggd->
data.select_center_ortho_axis[i];
394 for (
int j = 0; j < 2; j++) {
408 for (
int j = 0; j < 2; j++) {
429 msg_sub_value_gz_tag_refresh.
owner = region;
434 &scene->
id, RNA_View3DCursor, &scene->
cursor);
440 params.
prop = ggd->
data.gzgt_axis_prop,
446 gzgt->
name =
"Mesh Spin Init";
447 gzgt->
idname =
"MESH_GGT_spin";
467#undef INIT_SCALE_BASE
468#undef INIT_SCALE_BUTTON
481#define USE_ANGLE_Z_ORIENT
513#ifdef USE_ANGLE_Z_ORIENT
549 const float plane_no[3])
561 float plane_co[3], plane_no[3];
569 if (is_plane_co_eq && is_plane_no_eq) {
575 if (is_plane_no_eq ==
false) {
579 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];
616 float *value =
static_cast<float *
>(value_p);
635 const float *value =
static_cast<const float *
>(value_p);
640 float plane_co[3], plane[4];
662 float *value =
static_cast<float *
>(value_p);
694 float *value =
static_cast<float *
>(value_p);
707 float plane_no_proj[3];
726 const float *value =
static_cast<const float *
>(value_p);
739 float plane_no_proj[3];
745 if (angle_delta != 0.0f) {
764 float *value =
static_cast<float *
>(value_p);
780 const float *value =
static_cast<const float *
>(value_p);
814 if ((op ==
nullptr) || (op->
type != ot)) {
868 for (
int i = 0; i < 2; i++) {
878 for (
int i = 0; i < 2; i++) {
914 if (gzgroup_init && gzgroup_init->
customdata) {
918 if (ggd_init->
invoke.ortho_axis_active != -1) {
920 ggd_init->
gizmos.xyz_view[ggd_init->
invoke.ortho_axis_active]->matrix_basis[1]);
921 ggd_init->
invoke.ortho_axis_active = -1;
929#ifdef USE_ANGLE_Z_ORIENT
935 float plane_co[3], plane_no[3];
984 for (
int i = 0; i < 2; i++) {
1011 if (win && win->
active) {
1026 if (ggd->
data.op->next) {
1033 bool is_modal =
false;
1060 gzgt->
name =
"Mesh Spin Redo";
1061 gzgt->
idname =
"MESH_GGT_spin_redo";
Read Blender memory allocation and freeing.
#define UNUSED_VARS_NDEBUG(...)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
#define ORTHO_AXIS_OFFSET
#define INIT_SCALE_BUTTON
void get_color_3fv(int colorid, float col[3])
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
static const float dial_angle_partial_margin
void mul_m3_v3(const float M[3][3], float r[3])
bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, wmGizmoGroupType *gzgt, const char *gzgt_idname)
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
bool ED_undo_operator_repeat(bContext *C, wmOperator *op)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
static const uchar shape_plus[]
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
static void gizmo_spin_prop_axis_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void WM_gizmo_set_matrix_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
static void gizmo_spin_prop_depth_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
static void gizmo_spin_prop_axis_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
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])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
static void gizmo_spin_exec(GizmoGroupData_SpinRedo *ggd)
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
float angle_compat_rad(float angle, float angle_compat)
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void ED_gizmo_arrow3d_reset_offset(wmGizmo *gz)
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
static const float dial_angle_partial
const EnumPropertyItem rna_enum_axis_flag_xyz_items[]
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
wmWindow * CTX_wm_window(const bContext *C)
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
RegionView3D * ED_view3d_context_rv3d(bContext *C)
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_gizmo_set_line_width(wmGizmo *gz, const float line_width)
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3])
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
static void gizmo_spin_prop_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
MINLINE void zero_v4(float r[4])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE bool equals_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
static void gizmo_mesh_spin_redo_update_from_op(GizmoGroupData_SpinRedo *ggd)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
static void gizmo_spin_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static void gizmo_mesh_spin_redo_update_orient_axis(GizmoGroupData_SpinRedo *ggd, const float plane_no[3])
BMesh const char void * data
TransformOrientationSlot * BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
Object * CTX_data_edit_object(const bContext *C)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
static void gizmo_spin_prop_translate_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value)
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
static void gizmo_spin_prop_translate_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
@ ED_GIZMO_MOVE_STYLE_RING_2D
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_redo_modal_from_setup(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_init_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo_spin_prop_depth_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void MESH_GGT_spin(wmGizmoGroupType *gzgt)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void ortho_v3_v3(float out[3], const float v[3])
@ ED_GIZMO_ARROW_STYLE_NORMAL
static void gizmo_mesh_spin_redo_draw_prepare(const bContext *, wmGizmoGroup *gzgroup)
MINLINE float normalize_v3_v3(float r[3], const float a[3])
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_OFFSET_SCALE
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
MINLINE float normalize_v3(float n[3])
static void gizmo_mesh_spin_init_refresh_axis_orientation(wmGizmoGroup *gzgroup, int axis_index, const float axis_vec[3], const float axis_tan[3])
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void MESH_GGT_spin_redo(wmGizmoGroupType *gzgt)
@ WM_GIZMO_STATE_HIGHLIGHT
static void gizmo_mesh_spin_init_invoke_prepare(const bContext *, wmGizmoGroup *gzgroup, wmGizmo *gz, const wmEvent *)
void unit_m3(float m[3][3])
MINLINE void copy_v3_fl(float r[3], float f)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
static void gizmo_mesh_spin_init_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_init_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
wmOperator * WM_operator_last_redo(const bContext *C)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
const BMesh * BKE_editmesh_bmesh_get(const Object *ob)
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)
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])
Scene * CTX_data_scene(const bContext *C)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const bContext *C, wmGizmoGroupType *gzgt, const char *idname)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])
View3D * CTX_wm_view3d(const bContext *C)
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR
@ ED_GIZMO_DIAL_DRAW_FLAG_CLIP
@ ED_GIZMO_DIAL_DRAW_FLAG_FILL
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE
static bool gizmo_mesh_spin_redo_poll(const bContext *C, wmGizmoGroupType *gzgt)
bool equals_m3m3(const float mat1[3][3], const float mat2[3][3])
bke::ARegionRuntime * runtime
PropertyRNA * gzgt_axis_prop
wmGizmo * icon_button[3][2]
struct blender::GizmoGroupData_SpinInit::@223065025320243347260335125001234364106130012153 invoke
struct blender::GizmoGroupData_SpinInit::@171344066002274307231167035365100216233013064141 data
struct blender::GizmoGroupData_SpinInit::@366026042215072254256264270056164337100064161052 prev
struct blender::GizmoGroupData_SpinInit::@357257024074242355214230206351035061136300156222 gizmos
float orient_axis_relative[3]
PropertyRNA * prop_axis_no
PropertyRNA * prop_axis_co
struct blender::GizmoGroupData_SpinRedo::@220126131175035141015013162237150267310100244071 data
struct blender::GizmoGroupData_SpinRedo::@374111325273242021216213201313004354270006251326 prev
wmGizmo * translate_xy[2]
struct ARegion * active_region
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoMapType_Params gzmap_params
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoMap * parent_gzmap
ListBaseT< wmGizmo > gizmos
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnRangeGet range_get_fn
wmGizmoPropertyFnGet value_get_fn
const wmGizmoPropertyType * type
float matrix_offset[4][4]
wmGizmoGroup * parent_gzgroup
struct wmOperatorType * type
bke::WindowRuntime * runtime