diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-17 08:30:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-17 08:30:39 +0300 |
commit | 8ebc6be43ddf5a4c28b848c62d09f9435dd1bffe (patch) | |
tree | 4cad9c9d4fa25483c4f04bf7873e0b68ed29fefc /source/blender/editors | |
parent | aa1af7f8e40e9f67f40bb4bf96756b83d2b0189a (diff) |
Cleanup: de-duplicate tool gizmo
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c index 81e5a8a76b9..f761a44fe16 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c @@ -70,19 +70,17 @@ static bool WIDGETGROUP_tool_generic_poll(const bContext *C, wmGizmoGroupType *g static wmGizmo *tool_generic_create_gizmo(const bContext *C, wmGizmoGroup *gzgroup) { - wmGizmo *gz; - - if (gzgroup->type->idname == handle_normal_id) { - gz = WM_gizmo_new("GIZMO_GT_button_2d", gzgroup, NULL); + wmGizmo *gz = WM_gizmo_new("GIZMO_GT_button_2d", gzgroup, NULL); + gz->flag |= WM_GIZMO_OPERATOR_TOOL_INIT; - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color); - UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi); - unit_m4(gz->matrix_offset); + unit_m4(gz->matrix_offset); - PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon"); - RNA_property_enum_set(gz->ptr, prop, ICON_NONE); + RNA_enum_set(gz->ptr, "icon", ICON_NONE); + if (gzgroup->type->idname == handle_normal_id) { gz->scale_basis = 0.12f; gz->matrix_offset[3][2] -= 12.0; RNA_enum_set(gz->ptr, @@ -91,17 +89,8 @@ static wmGizmo *tool_generic_create_gizmo(const bContext *C, wmGizmoGroup *gzgro ED_GIZMO_BUTTON_SHOW_OUTLINE)); } else { - gz = WM_gizmo_new("GIZMO_GT_button_2d", gzgroup, NULL); - - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color); - UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi); - - unit_m4(gz->matrix_offset); gz->scale_basis = 0.16f * 3; - PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon"); - RNA_property_enum_set(gz->ptr, prop, ICON_NONE); - RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP); /* Make the center low alpha. */ @@ -109,8 +98,6 @@ static wmGizmo *tool_generic_create_gizmo(const bContext *C, wmGizmoGroup *gzgro RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.125f); } - gz->flag |= WM_GIZMO_OPERATOR_TOOL_INIT; - bToolRef *tref = WM_toolsystem_ref_from_context((bContext *)C); wmWindowManager *wm = CTX_wm_manager(C); struct wmKeyConfig *kc = wm->defaultconf; |