diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/editors/space_view3d/view3d_gizmo_forcefield.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_forcefield.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_forcefield.c | 121 |
1 files changed, 59 insertions, 62 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c index 34cf38b3466..7d3e22b4d70 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c @@ -18,7 +18,6 @@ * \ingroup spview3d */ - #include "BLI_utildefines.h" #include "BKE_context.h" @@ -39,7 +38,7 @@ #include "WM_api.h" #include "WM_types.h" -#include "view3d_intern.h" /* own include */ +#include "view3d_intern.h" /* own include */ /* -------------------------------------------------------------------- */ /** \name Force Field Gizmos @@ -47,80 +46,78 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt)) { - View3D *v3d = CTX_wm_view3d(C); - - if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) { - return false; - } - if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD) == 0) { - return false; - } - - ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); - if (base && BASE_SELECTABLE(v3d, base)) { - Object *ob = base->object; - if (ob->pd && ob->pd->forcefield) { - return true; - } - } - return false; + View3D *v3d = CTX_wm_view3d(C); + + if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) { + return false; + } + if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD) == 0) { + return false; + } + + ViewLayer *view_layer = CTX_data_view_layer(C); + Base *base = BASACT(view_layer); + if (base && BASE_SELECTABLE(v3d, base)) { + Object *ob = base->object; + if (ob->pd && ob->pd->forcefield) { + return true; + } + } + return false; } static void WIDGETGROUP_forcefield_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { - /* only wind effector for now */ - wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); - gzgroup->customdata = wwrapper; - - wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_arrow_3d", gzgroup, NULL); - wmGizmo *gz = wwrapper->gizmo; - RNA_enum_set(gz->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED); - ED_gizmo_arrow3d_set_ui_range(gz, -200.0f, 200.0f); - ED_gizmo_arrow3d_set_range_fac(gz, 6.0f); - - UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color); - UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi); + /* only wind effector for now */ + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); + gzgroup->customdata = wwrapper; + + wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_arrow_3d", gzgroup, NULL); + wmGizmo *gz = wwrapper->gizmo; + RNA_enum_set(gz->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED); + ED_gizmo_arrow3d_set_ui_range(gz, -200.0f, 200.0f); + ED_gizmo_arrow3d_set_range_fac(gz, 6.0f); + + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi); } static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmGizmoGroup *gzgroup) { - wmGizmoWrapper *wwrapper = gzgroup->customdata; - wmGizmo *gz = wwrapper->gizmo; - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); - PartDeflect *pd = ob->pd; - - if (pd->forcefield == PFIELD_WIND) { - const float size = (ob->type == OB_EMPTY) ? ob->empty_drawsize : 1.0f; - const float ofs[3] = {0.0f, -size, 0.0f}; - PointerRNA field_ptr; - - RNA_pointer_create(&ob->id, &RNA_FieldSettings, pd, &field_ptr); - WM_gizmo_set_matrix_location(gz, ob->obmat[3]); - WM_gizmo_set_matrix_rotation_from_z_axis(gz, ob->obmat[2]); - WM_gizmo_set_matrix_offset_location(gz, ofs); - WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false); - WM_gizmo_target_property_def_rna(gz, "offset", &field_ptr, "strength", -1); - } - else { - WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true); - } + wmGizmoWrapper *wwrapper = gzgroup->customdata; + wmGizmo *gz = wwrapper->gizmo; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); + PartDeflect *pd = ob->pd; + + if (pd->forcefield == PFIELD_WIND) { + const float size = (ob->type == OB_EMPTY) ? ob->empty_drawsize : 1.0f; + const float ofs[3] = {0.0f, -size, 0.0f}; + PointerRNA field_ptr; + + RNA_pointer_create(&ob->id, &RNA_FieldSettings, pd, &field_ptr); + WM_gizmo_set_matrix_location(gz, ob->obmat[3]); + WM_gizmo_set_matrix_rotation_from_z_axis(gz, ob->obmat[2]); + WM_gizmo_set_matrix_offset_location(gz, ofs); + WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false); + WM_gizmo_target_property_def_rna(gz, "offset", &field_ptr, "strength", -1); + } + else { + WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true); + } } void VIEW3D_GGT_force_field(wmGizmoGroupType *gzgt) { - gzgt->name = "Force Field Widgets"; - gzgt->idname = "VIEW3D_GGT_force_field"; + gzgt->name = "Force Field Widgets"; + gzgt->idname = "VIEW3D_GGT_force_field"; - gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | - WM_GIZMOGROUPTYPE_3D | - WM_GIZMOGROUPTYPE_SCALE | - WM_GIZMOGROUPTYPE_DEPTH_3D); + gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_SCALE | + WM_GIZMOGROUPTYPE_DEPTH_3D); - gzgt->poll = WIDGETGROUP_forcefield_poll; - gzgt->setup = WIDGETGROUP_forcefield_setup; - gzgt->refresh = WIDGETGROUP_forcefield_refresh; + gzgt->poll = WIDGETGROUP_forcefield_poll; + gzgt->setup = WIDGETGROUP_forcefield_setup; + gzgt->refresh = WIDGETGROUP_forcefield_refresh; } /** \} */ |