diff options
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add_gizmo.c | 76 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bisect.c | 150 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 106 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude_spin.c | 178 |
4 files changed, 255 insertions, 255 deletions
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index 6fa0eb33b89..460b70cecca 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -140,21 +140,21 @@ typedef struct GizmoPlacementGroup { * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void gizmo_placement_exec(GizmoPlacementGroup *man) +static void gizmo_placement_exec(GizmoPlacementGroup *ggd) { - wmOperator *op = man->data.op; - if (op == WM_operator_last_redo((bContext *)man->data.context)) { - ED_undo_operator_repeat((bContext *)man->data.context, op); + wmOperator *op = ggd->data.op; + if (op == WM_operator_last_redo((bContext *)ggd->data.context)) { + ED_undo_operator_repeat((bContext *)ggd->data.context, op); } } -static void gizmo_mesh_placement_update_from_op(GizmoPlacementGroup *man) +static void gizmo_mesh_placement_update_from_op(GizmoPlacementGroup *ggd) { - wmOperator *op = man->data.op; + wmOperator *op = ggd->data.op; UNUSED_VARS(op); /* For now don't read back from the operator. */ #if 0 - RNA_property_float_get_array(op->ptr, man->data.prop_matrix, &man->cage->matrix_offset[0][0]); + RNA_property_float_get_array(op->ptr, ggd->data.prop_matrix, &ggd->cage->matrix_offset[0][0]); #endif } @@ -163,15 +163,15 @@ static void gizmo_placement_prop_matrix_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoPlacementGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoPlacementGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 16); UNUSED_VARS_NDEBUG(gz_prop); - if (value_p != man->cage->matrix_offset) { - mul_m4_m4m4(value_p, man->cage->matrix_basis, man->cage->matrix_offset); - RNA_property_float_get_array(op->ptr, man->data.prop_matrix, value); + if (value_p != ggd->cage->matrix_offset) { + mul_m4_m4m4(value_p, ggd->cage->matrix_basis, ggd->cage->matrix_offset); + RNA_property_float_get_array(op->ptr, ggd->data.prop_matrix, value); } } @@ -179,22 +179,22 @@ static void gizmo_placement_prop_matrix_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value) { - GizmoPlacementGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoPlacementGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; BLI_assert(gz_prop->type->array_length == 16); UNUSED_VARS_NDEBUG(gz_prop); float mat[4][4]; - mul_m4_m4m4(mat, man->cage->matrix_basis, value); + mul_m4_m4m4(mat, ggd->cage->matrix_basis, value); if (is_negative_m4(mat)) { negate_mat3_m4(mat); } - RNA_property_float_set_array(op->ptr, man->data.prop_matrix, &mat[0][0]); + RNA_property_float_set_array(op->ptr, ggd->data.prop_matrix, &mat[0][0]); - gizmo_placement_exec(man); + gizmo_placement_exec(ggd); } static bool gizmo_mesh_placement_poll(const bContext *C, wmGizmoGroupType *gzgt) @@ -210,11 +210,11 @@ static bool gizmo_mesh_placement_poll(const bContext *C, wmGizmoGroupType *gzgt) static void gizmo_mesh_placement_modal_from_setup( const bContext *C, wmGizmoGroup *gzgroup) { - GizmoPlacementGroup *man = gzgroup->customdata; + GizmoPlacementGroup *ggd = gzgroup->customdata; /* Initial size. */ { - wmGizmo *gz = man->cage; + wmGizmo *gz = ggd->cage; zero_m4(gz->matrix_offset); /* TODO: support zero scaled matrix in 'GIZMO_GT_cage_3d'. */ @@ -228,7 +228,7 @@ static void gizmo_mesh_placement_modal_from_setup( { wmWindow *win = CTX_wm_window(C); ARegion *ar = CTX_wm_region(C); - wmGizmo *gz = man->cage; + wmGizmo *gz = ggd->cage; { float mat3[3][3]; @@ -246,7 +246,7 @@ static void gizmo_mesh_placement_modal_from_setup( if (1) { wmGizmoMap *gzmap = gzgroup->parent_gzmap; WM_gizmo_modal_set_from_setup( - gzmap, (bContext *)C, man->cage, ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, win->eventstate); + gzmap, (bContext *)C, ggd->cage, ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, win->eventstate); } } } @@ -259,32 +259,32 @@ static void gizmo_mesh_placement_setup(const bContext *C, wmGizmoGroup *gzgroup) return; } - struct GizmoPlacementGroup *man = MEM_callocN(sizeof(GizmoPlacementGroup), __func__); - gzgroup->customdata = man; + struct GizmoPlacementGroup *ggd = MEM_callocN(sizeof(GizmoPlacementGroup), __func__); + gzgroup->customdata = ggd; const wmGizmoType *gzt_cage = WM_gizmotype_find("GIZMO_GT_cage_3d", true); - man->cage = WM_gizmo_new_ptr(gzt_cage, gzgroup, NULL); + ggd->cage = WM_gizmo_new_ptr(gzt_cage, gzgroup, NULL); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->cage->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->cage->color); - RNA_enum_set(man->cage->ptr, "transform", + RNA_enum_set(ggd->cage->ptr, "transform", ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED); - WM_gizmo_set_flag(man->cage, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->cage, WM_GIZMO_DRAW_VALUE, true); - man->data.context = (bContext *)C; - man->data.op = op; - man->data.prop_matrix = RNA_struct_find_property(op->ptr, "matrix"); + ggd->data.context = (bContext *)C; + ggd->data.op = op; + ggd->data.prop_matrix = RNA_struct_find_property(op->ptr, "matrix"); - gizmo_mesh_placement_update_from_op(man); + gizmo_mesh_placement_update_from_op(ggd); /* Setup property callbacks */ { WM_gizmo_target_property_def_func( - man->cage, "matrix", + ggd->cage, "matrix", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_placement_prop_matrix_get, .value_set_fn = gizmo_placement_prop_matrix_set, @@ -299,11 +299,11 @@ static void gizmo_mesh_placement_setup(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo_mesh_placement_draw_prepare( const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { - GizmoPlacementGroup *man = gzgroup->customdata; - if (man->data.op->next) { - man->data.op = WM_operator_last_redo((bContext *)man->data.context); + GizmoPlacementGroup *ggd = gzgroup->customdata; + if (ggd->data.op->next) { + ggd->data.op = WM_operator_last_redo((bContext *)ggd->data.context); } - gizmo_mesh_placement_update_from_op(man); + gizmo_mesh_placement_update_from_op(ggd); } static void MESH_GGT_add_bounds(struct wmGizmoGroupType *gzgt) @@ -385,8 +385,8 @@ static int add_primitive_cube_gizmo_invoke(bContext *C, wmOperator *op, const wm wmGizmoGroupType *gzgt = WM_gizmogrouptype_find("MESH_GGT_add_bounds", false); wmGizmoGroup *gzgroup = WM_gizmomap_group_find_ptr(gzmap, gzgt); if (gzgroup != NULL) { - GizmoPlacementGroup *man = gzgroup->customdata; - man->data.op = op; + GizmoPlacementGroup *ggd = gzgroup->customdata; + ggd->data.op = op; gizmo_mesh_placement_modal_from_setup(C, gzgroup); } else { diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 386c56a1e62..e35e97c0054 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -458,47 +458,47 @@ typedef struct GizmoGroup { * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void gizmo_bisect_exec(GizmoGroup *man) +static void gizmo_bisect_exec(GizmoGroup *ggd) { - wmOperator *op = man->data.op; - if (op == WM_operator_last_redo((bContext *)man->data.context)) { - ED_undo_operator_repeat((bContext *)man->data.context, op); + wmOperator *op = ggd->data.op; + if (op == WM_operator_last_redo((bContext *)ggd->data.context)) { + ED_undo_operator_repeat((bContext *)ggd->data.context, op); } } -static void gizmo_mesh_bisect_update_from_op(GizmoGroup *man) +static void gizmo_mesh_bisect_update_from_op(GizmoGroup *ggd) { - wmOperator *op = man->data.op; + wmOperator *op = ggd->data.op; float plane_co[3], plane_no[3]; - RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_no, plane_no); - WM_gizmo_set_matrix_location(man->translate_z, plane_co); - WM_gizmo_set_matrix_location(man->rotate_c, plane_co); + WM_gizmo_set_matrix_location(ggd->translate_z, plane_co); + WM_gizmo_set_matrix_location(ggd->rotate_c, plane_co); /* translate_c location comes from the property. */ - WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(ggd->translate_z, plane_no); - WM_gizmo_set_scale(man->translate_c, 0.2); + WM_gizmo_set_scale(ggd->translate_c, 0.2); - RegionView3D *rv3d = ED_view3d_context_rv3d(man->data.context); + RegionView3D *rv3d = ED_view3d_context_rv3d(ggd->data.context); if (rv3d) { - normalize_v3_v3(man->data.rotate_axis, rv3d->viewinv[2]); - normalize_v3_v3(man->data.rotate_up, rv3d->viewinv[1]); + normalize_v3_v3(ggd->data.rotate_axis, rv3d->viewinv[2]); + normalize_v3_v3(ggd->data.rotate_up, rv3d->viewinv[1]); /* ensure its orthogonal */ - project_plane_normalized_v3_v3v3(man->data.rotate_up, man->data.rotate_up, man->data.rotate_axis); - normalize_v3(man->data.rotate_up); + project_plane_normalized_v3_v3v3(ggd->data.rotate_up, ggd->data.rotate_up, ggd->data.rotate_axis); + normalize_v3(ggd->data.rotate_up); - WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(ggd->translate_c, plane_no); float plane_no_cross[3]; - cross_v3_v3v3(plane_no_cross, plane_no, man->data.rotate_axis); + cross_v3_v3v3(plane_no_cross, plane_no, ggd->data.rotate_axis); - WM_gizmo_set_matrix_offset_rotation_from_yz_axis(man->rotate_c, plane_no_cross, man->data.rotate_axis); - RNA_enum_set(man->rotate_c->ptr, "draw_options", + WM_gizmo_set_matrix_offset_rotation_from_yz_axis(ggd->rotate_c, plane_no_cross, ggd->data.rotate_axis); + RNA_enum_set(ggd->rotate_c->ptr, "draw_options", ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR | ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y); } @@ -509,16 +509,16 @@ static void gizmo_bisect_prop_depth_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_co[3], plane_no[3]; - RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_no, plane_no); value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, gz->matrix_basis[3]); } @@ -527,16 +527,16 @@ static void gizmo_bisect_prop_depth_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; const float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_co[3], plane[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_no, plane); normalize_v3(plane); plane[3] = -value[0] - dot_v3v3(plane, gz->matrix_basis[3]); @@ -544,9 +544,9 @@ static void gizmo_bisect_prop_depth_set( /* Keep our location, may be offset simply to be inside the viewport. */ closest_to_plane_normalized_v3(plane_co, plane, plane_co); - RNA_property_float_set_array(op->ptr, man->data.prop_plane_co, plane_co); + RNA_property_float_set_array(op->ptr, ggd->data.prop_plane_co, plane_co); - gizmo_bisect_exec(man); + gizmo_bisect_exec(ggd); } /* translate callbacks */ @@ -554,28 +554,28 @@ static void gizmo_bisect_prop_translate_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; BLI_assert(gz_prop->type->array_length == 3); UNUSED_VARS_NDEBUG(gz_prop); - RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, value_p); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_co, value_p); } static void gizmo_bisect_prop_translate_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; BLI_assert(gz_prop->type->array_length == 3); UNUSED_VARS_NDEBUG(gz_prop); - RNA_property_float_set_array(op->ptr, man->data.prop_plane_co, value_p); + RNA_property_float_set_array(op->ptr, ggd->data.prop_plane_co, value_p); - gizmo_bisect_exec(man); + gizmo_bisect_exec(ggd); } /* angle callbacks */ @@ -583,22 +583,22 @@ static void gizmo_bisect_prop_angle_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_no[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_no, plane_no); normalize_v3(plane_no); float plane_no_proj[3]; - project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, man->data.rotate_axis); + project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, ggd->data.rotate_axis); if (!is_zero_v3(plane_no_proj)) { - const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, man->data.rotate_up, man->data.rotate_axis); + const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, ggd->data.rotate_up, ggd->data.rotate_axis); value[0] = angle; } else { @@ -610,32 +610,32 @@ static void gizmo_bisect_prop_angle_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; const float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_no[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_plane_no, plane_no); normalize_v3(plane_no); float plane_no_proj[3]; - project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, man->data.rotate_axis); + project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, ggd->data.rotate_axis); if (!is_zero_v3(plane_no_proj)) { - const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, man->data.rotate_up, man->data.rotate_axis); + const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, ggd->data.rotate_up, ggd->data.rotate_axis); const float angle_delta = angle - angle_compat_rad(value[0], angle); if (angle_delta != 0.0f) { float mat[3][3]; - axis_angle_normalized_to_mat3(mat, man->data.rotate_axis, angle_delta); + axis_angle_normalized_to_mat3(mat, ggd->data.rotate_axis, angle_delta); mul_m3_v3(mat, plane_no); /* re-normalize - seems acceptable */ - RNA_property_float_set_array(op->ptr, man->data.prop_plane_no, plane_no); + RNA_property_float_set_array(op->ptr, ggd->data.prop_plane_no, plane_no); - gizmo_bisect_exec(man); + gizmo_bisect_exec(ggd); } } } @@ -658,40 +658,40 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup) return; } - struct GizmoGroup *man = MEM_callocN(sizeof(GizmoGroup), __func__); - gzgroup->customdata = man; + struct GizmoGroup *ggd = MEM_callocN(sizeof(GizmoGroup), __func__); + gzgroup->customdata = ggd; const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true); const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true); const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true); - man->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); - man->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); - man->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); + ggd->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); + ggd->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); + ggd->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_z->color); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_c->color); - UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, man->rotate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->translate_z->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->translate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, ggd->rotate_c->color); - RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); - RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D); + RNA_enum_set(ggd->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); + RNA_enum_set(ggd->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D); - WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true); - WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->translate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->rotate_c, WM_GIZMO_DRAW_VALUE, true); { - man->data.context = (bContext *)C; - man->data.op = op; - man->data.prop_plane_co = RNA_struct_find_property(op->ptr, "plane_co"); - man->data.prop_plane_no = RNA_struct_find_property(op->ptr, "plane_no"); + ggd->data.context = (bContext *)C; + ggd->data.op = op; + ggd->data.prop_plane_co = RNA_struct_find_property(op->ptr, "plane_co"); + ggd->data.prop_plane_no = RNA_struct_find_property(op->ptr, "plane_no"); } - gizmo_mesh_bisect_update_from_op(man); + gizmo_mesh_bisect_update_from_op(ggd); /* Setup property callbacks */ { WM_gizmo_target_property_def_func( - man->translate_z, "offset", + ggd->translate_z, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_bisect_prop_depth_get, .value_set_fn = gizmo_bisect_prop_depth_set, @@ -700,7 +700,7 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup) }); WM_gizmo_target_property_def_func( - man->translate_c, "offset", + ggd->translate_c, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_bisect_prop_translate_get, .value_set_fn = gizmo_bisect_prop_translate_set, @@ -709,7 +709,7 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup) }); WM_gizmo_target_property_def_func( - man->rotate_c, "offset", + ggd->rotate_c, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_bisect_prop_angle_get, .value_set_fn = gizmo_bisect_prop_angle_set, @@ -722,11 +722,11 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo_mesh_bisect_draw_prepare( const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { - GizmoGroup *man = gzgroup->customdata; - if (man->data.op->next) { - man->data.op = WM_operator_last_redo((bContext *)man->data.context); + GizmoGroup *ggd = gzgroup->customdata; + if (ggd->data.op->next) { + ggd->data.op = WM_operator_last_redo((bContext *)ggd->data.context); } - gizmo_mesh_bisect_update_from_op(man); + gizmo_mesh_bisect_update_from_op(ggd); } static void MESH_GGT_bisect(struct wmGizmoGroupType *gzgt) diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index fa6a1f7b60c..d1050f1122f 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -395,24 +395,24 @@ typedef struct GizmoExtrudeGroup { } GizmoExtrudeGroup; static void gizmo_mesh_extrude_orientation_matrix_set( - struct GizmoExtrudeGroup *man, const float mat[3][3]) + struct GizmoExtrudeGroup *ggd, const float mat[3][3]) { for (int i = 0; i < 3; i++) { /* Set orientation without location. */ for (int j = 0; j < 3; j++) { - copy_v3_v3(man->adjust_xyz_no[i]->matrix_basis[j], mat[j]); + copy_v3_v3(ggd->adjust_xyz_no[i]->matrix_basis[j], mat[j]); } /* nop when (i == 2). */ - swap_v3_v3(man->adjust_xyz_no[i]->matrix_basis[i], man->adjust_xyz_no[i]->matrix_basis[2]); + swap_v3_v3(ggd->adjust_xyz_no[i]->matrix_basis[i], ggd->adjust_xyz_no[i]->matrix_basis[2]); /* Orient to normal gives generally less awkward results. */ - if (man->data.orientation_type != V3D_MANIP_NORMAL) { - if (dot_v3v3(man->adjust_xyz_no[i]->matrix_basis[2], man->data.normal_mat3[2]) < 0.0f) { - negate_v3(man->adjust_xyz_no[i]->matrix_basis[2]); + if (ggd->data.orientation_type != V3D_MANIP_NORMAL) { + if (dot_v3v3(ggd->adjust_xyz_no[i]->matrix_basis[2], ggd->data.normal_mat3[2]) < 0.0f) { + negate_v3(ggd->adjust_xyz_no[i]->matrix_basis[2]); } } mul_v3_v3fl( - man->invoke_xyz_no[i]->matrix_offset[3], - man->adjust_xyz_no[i]->matrix_basis[2], + ggd->invoke_xyz_no[i]->matrix_offset[3], + ggd->adjust_xyz_no[i]->matrix_basis[2], (extrude_arrow_xyz_axis_scale * extrude_button_offset_scale) / extrude_button_scale); } } @@ -433,52 +433,52 @@ static bool gizmo_mesh_extrude_poll(const bContext *C, wmGizmoGroupType *gzgt) static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { - struct GizmoExtrudeGroup *man = MEM_callocN(sizeof(GizmoExtrudeGroup), __func__); - gzgroup->customdata = man; + struct GizmoExtrudeGroup *ggd = MEM_callocN(sizeof(GizmoExtrudeGroup), __func__); + gzgroup->customdata = ggd; const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true); const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_button_2d", true); for (int i = 0; i < 4; i++) { - man->adjust_xyz_no[i] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); - man->invoke_xyz_no[i] = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); - man->invoke_xyz_no[i]->flag |= WM_GIZMO_DRAW_OFFSET_SCALE; + ggd->adjust_xyz_no[i] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); + ggd->invoke_xyz_no[i] = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); + ggd->invoke_xyz_no[i]->flag |= WM_GIZMO_DRAW_OFFSET_SCALE; } { - PropertyRNA *prop = RNA_struct_find_property(man->invoke_xyz_no[3]->ptr, "shape"); + PropertyRNA *prop = RNA_struct_find_property(ggd->invoke_xyz_no[3]->ptr, "shape"); for (int i = 0; i < 4; i++) { RNA_property_string_set_bytes( - man->invoke_xyz_no[i]->ptr, prop, + ggd->invoke_xyz_no[i]->ptr, prop, (const char *)shape_plus, ARRAY_SIZE(shape_plus)); } } - man->ot_extrude = WM_operatortype_find("MESH_OT_extrude_context_move", true); + ggd->ot_extrude = WM_operatortype_find("MESH_OT_extrude_context_move", true); for (int i = 0; i < 3; i++) { - UI_GetThemeColor3fv(TH_AXIS_X + i, man->invoke_xyz_no[i]->color); - UI_GetThemeColor3fv(TH_AXIS_X + i, man->adjust_xyz_no[i]->color); + UI_GetThemeColor3fv(TH_AXIS_X + i, ggd->invoke_xyz_no[i]->color); + UI_GetThemeColor3fv(TH_AXIS_X + i, ggd->adjust_xyz_no[i]->color); } - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->invoke_xyz_no[3]->color); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->adjust_xyz_no[3]->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->invoke_xyz_no[3]->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->adjust_xyz_no[3]->color); for (int i = 0; i < 4; i++) { - WM_gizmo_set_scale(man->invoke_xyz_no[i], extrude_button_scale); - WM_gizmo_set_scale(man->adjust_xyz_no[i], extrude_arrow_scale); + WM_gizmo_set_scale(ggd->invoke_xyz_no[i], extrude_button_scale); + WM_gizmo_set_scale(ggd->adjust_xyz_no[i], extrude_arrow_scale); } - WM_gizmo_set_scale(man->adjust_xyz_no[3], extrude_arrow_normal_axis_scale); + WM_gizmo_set_scale(ggd->adjust_xyz_no[3], extrude_arrow_normal_axis_scale); for (int i = 0; i < 4; i++) { } for (int i = 0; i < 4; i++) { - WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->adjust_xyz_no[i], WM_GIZMO_DRAW_VALUE, true); } /* XYZ & normal axis extrude. */ for (int i = 0; i < 4; i++) { - PointerRNA *ptr = WM_gizmo_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(ggd->invoke_xyz_no[i], 0, ggd->ot_extrude, NULL); { bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; @@ -490,7 +490,7 @@ static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *gz /* Adjust extrude. */ for (int i = 0; i < 4; i++) { - PointerRNA *ptr = WM_gizmo_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(ggd->adjust_xyz_no[i], 0, ggd->ot_extrude, NULL); { bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; @@ -498,18 +498,18 @@ static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *gz RNA_boolean_set(¯optr, "release_confirm", true); RNA_boolean_set_array(¯optr, "constraint_axis", constraint); } - wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->adjust_xyz_no[i], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(ggd->adjust_xyz_no[i], 0); mpop->is_redo = true; } } static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) { - GizmoExtrudeGroup *man = gzgroup->customdata; + GizmoExtrudeGroup *ggd = gzgroup->customdata; for (int i = 0; i < 4; i++) { - WM_gizmo_set_flag(man->invoke_xyz_no[i], WM_GIZMO_HIDDEN, true); - WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); + WM_gizmo_set_flag(ggd->invoke_xyz_no[i], WM_GIZMO_HIDDEN, true); + WM_gizmo_set_flag(ggd->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); } if (G.moving) { @@ -517,8 +517,8 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) } Scene *scene = CTX_data_scene(C); - man->data.orientation_type = scene->orientation_type; - bool use_normal = (man->data.orientation_type != V3D_MANIP_NORMAL); + ggd->data.orientation_type = scene->orientation_type; + bool use_normal = (ggd->data.orientation_type != V3D_MANIP_NORMAL); const int axis_len_used = use_normal ? 4 : 3; struct TransformBounds tbounds; @@ -532,13 +532,13 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) { unit_m3(tbounds_normal.axis); } - copy_m3_m3(man->data.normal_mat3, tbounds_normal.axis); + copy_m3_m3(ggd->data.normal_mat3, tbounds_normal.axis); } /* TODO(campbell): run second since this modifies the 3D view, it should not. */ if (!ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams){ - .orientation_type = man->data.orientation_type + 1, + .orientation_type = ggd->data.orientation_type + 1, }, &tbounds)) { return; @@ -546,41 +546,41 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) /* Main axis is normal. */ if (!use_normal) { - copy_m3_m3(man->data.normal_mat3, tbounds.axis); + copy_m3_m3(ggd->data.normal_mat3, tbounds.axis); } /* Offset the add icon. */ mul_v3_v3fl( - man->invoke_xyz_no[3]->matrix_offset[3], - man->data.normal_mat3[2], + ggd->invoke_xyz_no[3]->matrix_offset[3], + ggd->data.normal_mat3[2], (extrude_arrow_normal_axis_scale * extrude_button_offset_scale) / extrude_button_scale); /* Needed for normal orientation. */ - gizmo_mesh_extrude_orientation_matrix_set(man, tbounds.axis); + gizmo_mesh_extrude_orientation_matrix_set(ggd, tbounds.axis); if (use_normal) { - copy_m4_m3(man->adjust_xyz_no[3]->matrix_basis, man->data.normal_mat3); + copy_m4_m3(ggd->adjust_xyz_no[3]->matrix_basis, ggd->data.normal_mat3); } /* Location. */ for (int i = 0; i < axis_len_used; i++) { - WM_gizmo_set_matrix_location(man->invoke_xyz_no[i], tbounds.center); - WM_gizmo_set_matrix_location(man->adjust_xyz_no[i], tbounds.center); + WM_gizmo_set_matrix_location(ggd->invoke_xyz_no[i], tbounds.center); + WM_gizmo_set_matrix_location(ggd->adjust_xyz_no[i], tbounds.center); } /* Adjust current operator. */ /* Don't use 'WM_operator_last_redo' because selection actions will be ignored. */ wmOperator *op = CTX_wm_manager(C)->operators.last; - bool has_redo = (op && op->type == man->ot_extrude); + bool has_redo = (op && op->type == ggd->ot_extrude); /* Un-hide. */ for (int i = 0; i < axis_len_used; i++) { - WM_gizmo_set_flag(man->invoke_xyz_no[i], WM_GIZMO_HIDDEN, false); - WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, !has_redo); + WM_gizmo_set_flag(ggd->invoke_xyz_no[i], WM_GIZMO_HIDDEN, false); + WM_gizmo_set_flag(ggd->adjust_xyz_no[i], WM_GIZMO_HIDDEN, !has_redo); } /* Operator properties. */ if (use_normal) { - wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->invoke_xyz_no[3], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(ggd->invoke_xyz_no[3], 0); PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate"); RNA_enum_set(¯optr, "constraint_orientation", V3D_MANIP_NORMAL); } @@ -597,10 +597,10 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) /* We could also access this from 'ot->last_properties' */ for (int i = 0; i < 4; i++) { if ((i != 3) ? - (orientation_type == man->data.orientation_type && constraint_axis[i]) : + (orientation_type == ggd->data.orientation_type && constraint_axis[i]) : (orientation_type == V3D_MANIP_NORMAL && constraint_axis[2])) { - wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->adjust_xyz_no[i], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(ggd->adjust_xyz_no[i], 0); PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate"); @@ -611,16 +611,16 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) else { /* TODO(campbell): ideally we could adjust all, * this is complicated by how operator redo and the transform macro works. */ - WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); + WM_gizmo_set_flag(ggd->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); } } } for (int i = 0; i < 4; i++) { RNA_enum_set( - man->invoke_xyz_no[i]->ptr, + ggd->invoke_xyz_no[i]->ptr, "draw_options", - (man->adjust_xyz_no[i]->flag & WM_GIZMO_HIDDEN) ? + (ggd->adjust_xyz_no[i]->flag & WM_GIZMO_HIDDEN) ? ED_GIZMO_BUTTON_SHOW_HELPLINE : 0); } } @@ -636,15 +636,15 @@ static int gizmo_cmp_temp_f(const void *gz_a_ptr, const void *gz_b_ptr) static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { - GizmoExtrudeGroup *man = gzgroup->customdata; - switch (man->data.orientation_type) { + GizmoExtrudeGroup *ggd = gzgroup->customdata; + switch (ggd->data.orientation_type) { case V3D_MANIP_VIEW: { RegionView3D *rv3d = CTX_wm_region_view3d(C); float mat[3][3]; copy_m3_m4(mat, rv3d->viewinv); normalize_m3(mat); - gizmo_mesh_extrude_orientation_matrix_set(man, mat); + gizmo_mesh_extrude_orientation_matrix_set(ggd, mat); break; } } diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index d89d47a1964..974b30160b4 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -94,47 +94,47 @@ typedef struct GizmoSpinGroup { * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void gizmo_spin_exec(GizmoSpinGroup *man) +static void gizmo_spin_exec(GizmoSpinGroup *ggd) { - wmOperator *op = man->data.op; - if (op == WM_operator_last_redo((bContext *)man->data.context)) { - ED_undo_operator_repeat((bContext *)man->data.context, op); + wmOperator *op = ggd->data.op; + if (op == WM_operator_last_redo((bContext *)ggd->data.context)) { + ED_undo_operator_repeat((bContext *)ggd->data.context, op); } } -static void gizmo_mesh_spin_update_from_op(GizmoSpinGroup *man) +static void gizmo_mesh_spin_update_from_op(GizmoSpinGroup *ggd) { - wmOperator *op = man->data.op; + wmOperator *op = ggd->data.op; float plane_co[3], plane_no[3]; - RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no); - WM_gizmo_set_matrix_location(man->translate_z, plane_co); - WM_gizmo_set_matrix_location(man->rotate_c, plane_co); - WM_gizmo_set_matrix_location(man->angle_z, plane_co); + WM_gizmo_set_matrix_location(ggd->translate_z, plane_co); + WM_gizmo_set_matrix_location(ggd->rotate_c, plane_co); + WM_gizmo_set_matrix_location(ggd->angle_z, plane_co); /* translate_c location comes from the property. */ - WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); - WM_gizmo_set_matrix_rotation_from_z_axis(man->angle_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(ggd->translate_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(ggd->angle_z, plane_no); - WM_gizmo_set_scale(man->translate_c, 0.2); + WM_gizmo_set_scale(ggd->translate_c, 0.2); - RegionView3D *rv3d = ED_view3d_context_rv3d(man->data.context); + RegionView3D *rv3d = ED_view3d_context_rv3d(ggd->data.context); if (rv3d) { - normalize_v3_v3(man->data.rotate_axis, rv3d->viewinv[2]); - normalize_v3_v3(man->data.rotate_up, rv3d->viewinv[1]); + normalize_v3_v3(ggd->data.rotate_axis, rv3d->viewinv[2]); + normalize_v3_v3(ggd->data.rotate_up, rv3d->viewinv[1]); /* ensure its orthogonal */ - project_plane_normalized_v3_v3v3(man->data.rotate_up, man->data.rotate_up, man->data.rotate_axis); - normalize_v3(man->data.rotate_up); + project_plane_normalized_v3_v3v3(ggd->data.rotate_up, ggd->data.rotate_up, ggd->data.rotate_axis); + normalize_v3(ggd->data.rotate_up); - WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); - WM_gizmo_set_matrix_rotation_from_yz_axis(man->rotate_c, plane_no, man->data.rotate_axis); + WM_gizmo_set_matrix_rotation_from_z_axis(ggd->translate_c, plane_no); + WM_gizmo_set_matrix_rotation_from_yz_axis(ggd->rotate_c, plane_no, ggd->data.rotate_axis); /* show the axis instead of mouse cursor */ - RNA_enum_set(man->rotate_c->ptr, "draw_options", + RNA_enum_set(ggd->rotate_c->ptr, "draw_options", ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR | ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y); @@ -146,16 +146,16 @@ static void gizmo_spin_prop_depth_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_co[3], plane_no[3]; - RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no); value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, gz->matrix_basis[3]); } @@ -164,16 +164,16 @@ static void gizmo_spin_prop_depth_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; const float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_co[3], plane[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co); - RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane); normalize_v3(plane); plane[3] = -value[0] - dot_v3v3(plane, gz->matrix_basis[3]); @@ -181,9 +181,9 @@ static void gizmo_spin_prop_depth_set( /* Keep our location, may be offset simply to be inside the viewport. */ closest_to_plane_normalized_v3(plane_co, plane, plane_co); - RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, plane_co); + RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_co, plane_co); - gizmo_spin_exec(man); + gizmo_spin_exec(ggd); } /* translate callbacks */ @@ -191,29 +191,29 @@ static void gizmo_spin_prop_translate_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 3); UNUSED_VARS_NDEBUG(gz_prop); - RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, value); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, value); } static void gizmo_spin_prop_translate_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; BLI_assert(gz_prop->type->array_length == 3); UNUSED_VARS_NDEBUG(gz_prop); - RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, value); + RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_co, value); - gizmo_spin_exec(man); + gizmo_spin_exec(ggd); } /* angle callbacks */ @@ -221,22 +221,22 @@ static void gizmo_spin_prop_axis_angle_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_no[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no); normalize_v3(plane_no); float plane_no_proj[3]; - project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, man->data.rotate_axis); + project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, ggd->data.rotate_axis); if (!is_zero_v3(plane_no_proj)) { - const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, man->data.rotate_up, man->data.rotate_axis); + const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, ggd->data.rotate_up, ggd->data.rotate_axis); value[0] = angle; } else { @@ -248,32 +248,32 @@ static void gizmo_spin_prop_axis_angle_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; const float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); float plane_no[4]; - RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no); + RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no); normalize_v3(plane_no); float plane_no_proj[3]; - project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, man->data.rotate_axis); + project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, ggd->data.rotate_axis); if (!is_zero_v3(plane_no_proj)) { - const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, man->data.rotate_up, man->data.rotate_axis); + const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, ggd->data.rotate_up, ggd->data.rotate_axis); const float angle_delta = angle - angle_compat_rad(value[0], angle); if (angle_delta != 0.0f) { float mat[3][3]; - axis_angle_normalized_to_mat3(mat, man->data.rotate_axis, angle_delta); + axis_angle_normalized_to_mat3(mat, ggd->data.rotate_axis, angle_delta); mul_m3_v3(mat, plane_no); /* re-normalize - seems acceptable */ - RNA_property_float_set_array(op->ptr, man->data.prop_axis_no, plane_no); + RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_no, plane_no); - gizmo_spin_exec(man); + gizmo_spin_exec(ggd); } } } @@ -283,27 +283,27 @@ static void gizmo_spin_prop_angle_get( const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; float *value = value_p; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); - value[0] = RNA_property_float_get(op->ptr, man->data.prop_angle); + value[0] = RNA_property_float_get(op->ptr, ggd->data.prop_angle); } static void gizmo_spin_prop_angle_set( const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p) { - GizmoSpinGroup *man = gz->parent_gzgroup->customdata; - wmOperator *op = man->data.op; + GizmoSpinGroup *ggd = gz->parent_gzgroup->customdata; + wmOperator *op = ggd->data.op; BLI_assert(gz_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(gz_prop); const float *value = value_p; - RNA_property_float_set(op->ptr, man->data.prop_angle, value[0]); + RNA_property_float_set(op->ptr, ggd->data.prop_angle, value[0]); - gizmo_spin_exec(man); + gizmo_spin_exec(ggd); } static bool gizmo_mesh_spin_poll(const bContext *C, wmGizmoGroupType *gzgt) @@ -324,47 +324,47 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup) return; } - struct GizmoSpinGroup *man = MEM_callocN(sizeof(GizmoSpinGroup), __func__); - gzgroup->customdata = man; + struct GizmoSpinGroup *ggd = MEM_callocN(sizeof(GizmoSpinGroup), __func__); + gzgroup->customdata = ggd; const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true); const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true); const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true); - man->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); - man->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); - man->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); - man->angle_z = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); + ggd->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL); + ggd->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL); + ggd->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); + ggd->angle_z = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_z->color); - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_c->color); - UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, man->rotate_c->color); - UI_GetThemeColor3fv(TH_AXIS_Z, man->angle_z->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->translate_z->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, ggd->translate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, ggd->rotate_c->color); + UI_GetThemeColor3fv(TH_AXIS_Z, ggd->angle_z->color); - RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); - RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D); + RNA_enum_set(ggd->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); + RNA_enum_set(ggd->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D); - WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true); - WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true); - WM_gizmo_set_flag(man->angle_z, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->translate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->rotate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(ggd->angle_z, WM_GIZMO_DRAW_VALUE, true); - WM_gizmo_set_scale(man->angle_z, 0.5f); + WM_gizmo_set_scale(ggd->angle_z, 0.5f); { - man->data.context = (bContext *)C; - man->data.op = op; - man->data.prop_axis_co = RNA_struct_find_property(op->ptr, "center"); - man->data.prop_axis_no = RNA_struct_find_property(op->ptr, "axis"); - man->data.prop_angle = RNA_struct_find_property(op->ptr, "angle"); + ggd->data.context = (bContext *)C; + ggd->data.op = op; + ggd->data.prop_axis_co = RNA_struct_find_property(op->ptr, "center"); + ggd->data.prop_axis_no = RNA_struct_find_property(op->ptr, "axis"); + ggd->data.prop_angle = RNA_struct_find_property(op->ptr, "angle"); } - gizmo_mesh_spin_update_from_op(man); + gizmo_mesh_spin_update_from_op(ggd); /* Setup property callbacks */ { WM_gizmo_target_property_def_func( - man->translate_z, "offset", + ggd->translate_z, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_spin_prop_depth_get, .value_set_fn = gizmo_spin_prop_depth_set, @@ -373,7 +373,7 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup) }); WM_gizmo_target_property_def_func( - man->translate_c, "offset", + ggd->translate_c, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_spin_prop_translate_get, .value_set_fn = gizmo_spin_prop_translate_set, @@ -382,7 +382,7 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup) }); WM_gizmo_target_property_def_func( - man->rotate_c, "offset", + ggd->rotate_c, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_spin_prop_axis_angle_get, .value_set_fn = gizmo_spin_prop_axis_angle_set, @@ -391,7 +391,7 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup) }); WM_gizmo_target_property_def_func( - man->angle_z, "offset", + ggd->angle_z, "offset", &(const struct wmGizmoPropertyFnParams) { .value_get_fn = gizmo_spin_prop_angle_get, .value_set_fn = gizmo_spin_prop_angle_set, @@ -405,11 +405,11 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo_mesh_spin_draw_prepare( const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { - GizmoSpinGroup *man = gzgroup->customdata; - if (man->data.op->next) { - man->data.op = WM_operator_last_redo((bContext *)man->data.context); + GizmoSpinGroup *ggd = gzgroup->customdata; + if (ggd->data.op->next) { + ggd->data.op = WM_operator_last_redo((bContext *)ggd->data.context); } - gizmo_mesh_spin_update_from_op(man); + gizmo_mesh_spin_update_from_op(ggd); } static void MESH_GGT_spin(struct wmGizmoGroupType *gzgt) |