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/windowmanager/gizmo/intern/wm_gizmo_group_type.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/windowmanager/gizmo/intern/wm_gizmo_group_type.c')
-rw-r--r-- | source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c | 156 |
1 files changed, 77 insertions, 79 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c index 60377353182..7c8db18c0ca 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c @@ -38,7 +38,6 @@ #include "wm_gizmo_wmapi.h" #include "wm_gizmo_intern.h" - /** \name GizmoGroup Type Append * * \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends. @@ -48,98 +47,96 @@ static GHash *global_gizmogrouptype_hash = NULL; wmGizmoGroupType *WM_gizmogrouptype_find(const char *idname, bool quiet) { - if (idname[0]) { - wmGizmoGroupType *gzgt; - - gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); - if (gzgt) { - return gzgt; - } - - if (!quiet) { - printf("search for unknown gizmo group '%s'\n", idname); - } - } - else { - if (!quiet) { - printf("search for empty gizmo group\n"); - } - } - - return NULL; + if (idname[0]) { + wmGizmoGroupType *gzgt; + + gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); + if (gzgt) { + return gzgt; + } + + if (!quiet) { + printf("search for unknown gizmo group '%s'\n", idname); + } + } + else { + if (!quiet) { + printf("search for empty gizmo group\n"); + } + } + + return NULL; } /* caller must free */ void WM_gizmogrouptype_iter(GHashIterator *ghi) { - BLI_ghashIterator_init(ghi, global_gizmogrouptype_hash); + BLI_ghashIterator_init(ghi, global_gizmogrouptype_hash); } static wmGizmoGroupType *wm_gizmogrouptype_append__begin(void) { - wmGizmoGroupType *gzgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype"); - gzgt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoGroupProperties); + wmGizmoGroupType *gzgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype"); + gzgt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoGroupProperties); #if 0 - /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); - ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; + /* Set the default i18n context now, so that opfunc can redefine it if needed! */ + RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); + ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; #endif - return gzgt; + return gzgt; } static void wm_gizmogrouptype_append__end(wmGizmoGroupType *gzgt) { - BLI_assert(gzgt->name != NULL); - BLI_assert(gzgt->idname != NULL); + BLI_assert(gzgt->name != NULL); + BLI_assert(gzgt->idname != NULL); - RNA_def_struct_identifier(&BLENDER_RNA, gzgt->srna, gzgt->idname); + RNA_def_struct_identifier(&BLENDER_RNA, gzgt->srna, gzgt->idname); - gzgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT; + gzgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT; - /* if not set, use default */ - if (gzgt->setup_keymap == NULL) { - if (gzgt->flag & WM_GIZMOGROUPTYPE_SELECT) { - gzgt->setup_keymap = WM_gizmogroup_keymap_common_select; - } - else { - gzgt->setup_keymap = WM_gizmogroup_keymap_common; - } - } + /* if not set, use default */ + if (gzgt->setup_keymap == NULL) { + if (gzgt->flag & WM_GIZMOGROUPTYPE_SELECT) { + gzgt->setup_keymap = WM_gizmogroup_keymap_common_select; + } + else { + gzgt->setup_keymap = WM_gizmogroup_keymap_common; + } + } - BLI_ghash_insert(global_gizmogrouptype_hash, (void *)gzgt->idname, gzgt); + BLI_ghash_insert(global_gizmogrouptype_hash, (void *)gzgt->idname, gzgt); } -wmGizmoGroupType *WM_gizmogrouptype_append( - void (*wtfunc)(struct wmGizmoGroupType *)) +wmGizmoGroupType *WM_gizmogrouptype_append(void (*wtfunc)(struct wmGizmoGroupType *)) { - wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin(); - wtfunc(gzgt); - wm_gizmogrouptype_append__end(gzgt); - return gzgt; + wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin(); + wtfunc(gzgt); + wm_gizmogrouptype_append__end(gzgt); + return gzgt; } -wmGizmoGroupType *WM_gizmogrouptype_append_ptr( - void (*wtfunc)(struct wmGizmoGroupType *, void *), void *userdata) +wmGizmoGroupType *WM_gizmogrouptype_append_ptr(void (*wtfunc)(struct wmGizmoGroupType *, void *), + void *userdata) { - wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin(); - wtfunc(gzgt, userdata); - wm_gizmogrouptype_append__end(gzgt); - return gzgt; + wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin(); + wtfunc(gzgt, userdata); + wm_gizmogrouptype_append__end(gzgt); + return gzgt; } /** * Append and insert into a gizmo typemap. * This is most common for C gizmos which are enabled by default. */ -wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link( - wmGizmoMapType *gzmap_type, - void (*wtfunc)(struct wmGizmoGroupType *)) +wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, + void (*wtfunc)(struct wmGizmoGroupType *)) { - wmGizmoGroupType *gzgt = WM_gizmogrouptype_append(wtfunc); + wmGizmoGroupType *gzgt = WM_gizmogrouptype_append(wtfunc); - gzgt->gzmap_params.spaceid = gzmap_type->spaceid; - gzgt->gzmap_params.regionid = gzmap_type->regionid; + gzgt->gzmap_params.spaceid = gzmap_type->spaceid; + gzgt->gzmap_params.regionid = gzmap_type->regionid; - return WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt); + return WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt); } /** @@ -147,53 +144,54 @@ wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link( */ static void gizmogrouptype_free(wmGizmoGroupType *gzgt) { - if (gzgt->ext.srna) { /* python gizmo group, allocs own string */ - MEM_freeN((void *)gzgt->idname); - } + if (gzgt->ext.srna) { /* python gizmo group, allocs own string */ + MEM_freeN((void *)gzgt->idname); + } - MEM_freeN(gzgt); + MEM_freeN(gzgt); } void WM_gizmogrouptype_free_ptr(wmGizmoGroupType *gzgt) { - BLI_assert(gzgt == WM_gizmogrouptype_find(gzgt->idname, false)); + BLI_assert(gzgt == WM_gizmogrouptype_find(gzgt->idname, false)); - BLI_ghash_remove(global_gizmogrouptype_hash, gzgt->idname, NULL, NULL); + BLI_ghash_remove(global_gizmogrouptype_hash, gzgt->idname, NULL, NULL); - gizmogrouptype_free(gzgt); + gizmogrouptype_free(gzgt); - /* XXX, TODO, update the world! */ + /* XXX, TODO, update the world! */ } bool WM_gizmogrouptype_free(const char *idname) { - wmGizmoGroupType *gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); + wmGizmoGroupType *gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); - if (gzgt == NULL) { - return false; - } + if (gzgt == NULL) { + return false; + } - WM_gizmogrouptype_free_ptr(gzgt); + WM_gizmogrouptype_free_ptr(gzgt); - return true; + return true; } static void wm_gizmogrouptype_ghash_free_cb(wmGizmoGroupType *gzgt) { - gizmogrouptype_free(gzgt); + gizmogrouptype_free(gzgt); } void wm_gizmogrouptype_free(void) { - BLI_ghash_free(global_gizmogrouptype_hash, NULL, (GHashValFreeFP)wm_gizmogrouptype_ghash_free_cb); - global_gizmogrouptype_hash = NULL; + BLI_ghash_free( + global_gizmogrouptype_hash, NULL, (GHashValFreeFP)wm_gizmogrouptype_ghash_free_cb); + global_gizmogrouptype_hash = NULL; } /* called on initialize WM_init() */ void wm_gizmogrouptype_init(void) { - /* reserve size is set based on blender default setup */ - global_gizmogrouptype_hash = BLI_ghash_str_new_ex("wm_gizmogrouptype_init gh", 128); + /* reserve size is set based on blender default setup */ + global_gizmogrouptype_hash = BLI_ghash_str_new_ex("wm_gizmogrouptype_init gh", 128); } /** \} */ |