diff options
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_info/CMakeLists.txt | 14 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_draw.c (renamed from source/blender/editors/space_info/info_draw.cc) | 39 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_intern.h (renamed from source/blender/editors/space_info/info_intern.hh) | 0 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c (renamed from source/blender/editors/space_info/info_ops.cc) | 43 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_report.c (renamed from source/blender/editors/space_info/info_report.cc) | 40 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c (renamed from source/blender/editors/space_info/info_stats.cc) | 79 | ||||
-rw-r--r-- | source/blender/editors/space_info/space_info.c (renamed from source/blender/editors/space_info/space_info.cc) | 24 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.c (renamed from source/blender/editors/space_info/textview.cc) | 33 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.h | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/message_bus/wm_message_bus.h | 28 |
11 files changed, 158 insertions, 152 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index a89ece567a2..240d6cb18ec 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -325,7 +325,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter); { \ Object *_instance; \ Base *_base; \ - for (_base = (Base *)(view_layer)->object_bases.first; _base; _base = _base->next) { \ + for (_base = (view_layer)->object_bases.first; _base; _base = _base->next) { \ _instance = _base->object; #define FOREACH_OBJECT_END \ diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index 15194082376..b6df07eec4e 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -34,14 +34,14 @@ set(INC ) set(SRC - info_draw.cc - info_ops.cc - info_report.cc - info_stats.cc - space_info.cc - textview.cc + info_draw.c + info_ops.c + info_report.c + info_stats.c + space_info.c + textview.c - info_intern.hh + info_intern.h textview.h ) diff --git a/source/blender/editors/space_info/info_draw.cc b/source/blender/editors/space_info/info_draw.c index 852447372d6..be3b60d581b 100644 --- a/source/blender/editors/space_info/info_draw.cc +++ b/source/blender/editors/space_info/info_draw.c @@ -21,8 +21,8 @@ * \ingroup spinfo */ -#include <climits> -#include <cstring> +#include <limits.h> +#include <string.h> #include "BLI_utildefines.h" @@ -35,7 +35,7 @@ #include "UI_resources.h" #include "UI_view2d.h" -#include "info_intern.hh" +#include "info_intern.h" #include "textview.h" static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc, @@ -45,7 +45,7 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc, uchar r_icon_fg[4], uchar r_icon_bg[4]) { - const Report *report = (const Report *)tvc->iter; + const Report *report = tvc->iter; /* Same text color no matter what type of report. */ UI_GetThemeColor4ubv((report->flag & SELECT) ? TH_INFO_SELECTED_TEXT : TH_TEXT, fg); @@ -71,17 +71,16 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc, /* This theme color is RGB only, so set alpha. */ r_icon_fg[3] = 255; UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg); - return (enum eTextViewContext_LineFlag)(TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | - TVC_LINE_ICON_FG | TVC_LINE_ICON_BG); + return TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | TVC_LINE_ICON_FG | TVC_LINE_ICON_BG; } - return (enum eTextViewContext_LineFlag)(TVC_LINE_FG | TVC_LINE_BG); + return TVC_LINE_FG | TVC_LINE_BG; } /* reports! */ static void report_textview_init__internal(TextViewContext *tvc) { - const Report *report = (const Report *)tvc->iter; + const Report *report = tvc->iter; const char *str = report->message; for (int i = tvc->iter_char_end - 1; i >= 0; i -= 1) { if (str[i] == '\n') { @@ -94,17 +93,17 @@ static void report_textview_init__internal(TextViewContext *tvc) static int report_textview_skip__internal(TextViewContext *tvc) { - const SpaceInfo *sinfo = (const SpaceInfo *)tvc->arg1; + const SpaceInfo *sinfo = tvc->arg1; const int report_mask = info_report_mask(sinfo); while (tvc->iter && (((const Report *)tvc->iter)->type & report_mask) == 0) { tvc->iter = (void *)((Link *)tvc->iter)->prev; } - return (tvc->iter != nullptr); + return (tvc->iter != NULL); } static int report_textview_begin(TextViewContext *tvc) { - const ReportList *reports = (const ReportList *)tvc->arg2; + const ReportList *reports = tvc->arg2; tvc->sel_start = 0; tvc->sel_end = 0; @@ -117,7 +116,7 @@ static int report_textview_begin(TextViewContext *tvc) tvc->iter_tmp = 0; if (tvc->iter && report_textview_skip__internal(tvc)) { /* init the newline iterator */ - const Report *report = (const Report *)tvc->iter; + const Report *report = tvc->iter; tvc->iter_char_end = report->len; report_textview_init__internal(tvc); @@ -135,14 +134,14 @@ static void report_textview_end(TextViewContext *UNUSED(tvc)) static int report_textview_step(TextViewContext *tvc) { /* simple case, but no newline support */ - const Report *report = (const Report *)tvc->iter; + const Report *report = tvc->iter; if (tvc->iter_char_begin <= 0) { tvc->iter = (void *)((Link *)tvc->iter)->prev; if (tvc->iter && report_textview_skip__internal(tvc)) { tvc->iter_tmp++; - report = (const Report *)tvc->iter; + report = tvc->iter; tvc->iter_char_end = report->len; /* reset start */ report_textview_init__internal(tvc); @@ -160,7 +159,7 @@ static int report_textview_step(TextViewContext *tvc) static void report_textview_line_get(TextViewContext *tvc, const char **r_line, int *r_len) { - const Report *report = (const Report *)tvc->iter; + const Report *report = tvc->iter; *r_line = report->message + tvc->iter_char_begin; *r_len = tvc->iter_char_end - tvc->iter_char_begin; } @@ -201,7 +200,7 @@ static int info_textview_main__internal(const SpaceInfo *sinfo, tvc.step = report_textview_step; tvc.line_get = report_textview_line_get; tvc.line_data = report_line_data; - tvc.const_colors = nullptr; + tvc.const_colors = NULL; tvc.arg1 = sinfo; tvc.arg2 = reports; @@ -226,21 +225,21 @@ void *info_text_pick(const SpaceInfo *sinfo, const ReportList *reports, int mouse_y) { - void *mval_pick_item = nullptr; + void *mval_pick_item = NULL; const int mval[2] = {0, mouse_y}; - info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, nullptr); + info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, NULL); return (void *)mval_pick_item; } int info_textview_height(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports) { const int mval[2] = {INT_MAX, INT_MAX}; - return info_textview_main__internal(sinfo, region, reports, false, mval, nullptr, nullptr); + return info_textview_main__internal(sinfo, region, reports, false, mval, NULL, NULL); } void info_textview_main(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports) { const int mval[2] = {INT_MAX, INT_MAX}; - info_textview_main__internal(sinfo, region, reports, true, mval, nullptr, nullptr); + info_textview_main__internal(sinfo, region, reports, true, mval, NULL, NULL); } diff --git a/source/blender/editors/space_info/info_intern.hh b/source/blender/editors/space_info/info_intern.h index a19ebe5ef04..a19ebe5ef04 100644 --- a/source/blender/editors/space_info/info_intern.hh +++ b/source/blender/editors/space_info/info_intern.h diff --git a/source/blender/editors/space_info/info_ops.cc b/source/blender/editors/space_info/info_ops.c index e7a4e18c789..0583628be43 100644 --- a/source/blender/editors/space_info/info_ops.cc +++ b/source/blender/editors/space_info/info_ops.c @@ -21,8 +21,8 @@ * \ingroup spinfo */ -#include <cstdio> -#include <cstring> +#include <stdio.h> +#include <string.h> #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" @@ -54,7 +54,7 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "info_intern.hh" +#include "info_intern.h" /********************* pack blend file libraries operator *********************/ @@ -159,7 +159,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev Image *ima; /* First check for dirty images. */ - for (ima = (Image *)bmain->images.first; ima; ima = (Image *)ima->id.next) { + for (ima = bmain->images.first; ima; ima = ima->id.next) { if (BKE_image_is_dirty(ima)) { break; } @@ -210,7 +210,7 @@ static const EnumPropertyItem unpack_all_method_items[] = { {PF_KEEP, "KEEP", 0, "Disable auto-pack, keep all packed files", ""}, {PF_REMOVE, "REMOVE", 0, "Remove Pack", ""}, /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */ - {0, nullptr, 0, nullptr, nullptr}, + {0, NULL, 0, NULL, NULL}, }; static int unpack_all_exec(bContext *C, wmOperator *op) @@ -219,8 +219,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) int method = RNA_enum_get(op->ptr, "method"); if (method != PF_KEEP) { - BKE_packedfile_unpack_all( - bmain, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */ + BKE_packedfile_unpack_all(bmain, op->reports, method); /* XXX PF_ASK can't work here */ } G.fileflags &= ~G_FILE_AUTOPACK; @@ -300,7 +299,7 @@ static const EnumPropertyItem unpack_item_method_items[] = { "Write file to original location (overwrite existing file)", ""}, /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */ - {0, nullptr, 0, nullptr, nullptr}, + {0, NULL, 0, NULL, NULL}, }; static int unpack_item_exec(bContext *C, wmOperator *op) @@ -314,14 +313,13 @@ static int unpack_item_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "id_name", idname); id = BKE_libblock_find_name(bmain, type, idname); - if (id == nullptr) { + if (id == NULL) { BKE_report(op->reports, RPT_WARNING, "No packed file"); return OPERATOR_CANCELLED; } if (method != PF_KEEP) { - BKE_packedfile_id_unpack( - bmain, id, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */ + BKE_packedfile_id_unpack(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */ } G.fileflags &= ~G_FILE_AUTOPACK; @@ -338,8 +336,7 @@ static int unpack_item_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemsFullEnumO( - layout, op->type->idname, "method", (IDProperty *)op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); + uiItemsFullEnumO(layout, op->type->idname, "method", op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); UI_popup_menu_end(C, pup); @@ -364,7 +361,7 @@ void FILE_OT_unpack_item(wmOperatorType *ot) RNA_def_enum( ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack"); RNA_def_string( - ot->srna, "id_name", nullptr, BKE_ST_MAXNAME, "ID Name", "Name of ID block to unpack"); + ot->srna, "id_name", NULL, BKE_ST_MAXNAME, "ID Name", "Name of ID block to unpack"); RNA_def_int(ot->srna, "id_type", ID_IM, @@ -390,7 +387,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) BKE_bpath_relative_convert(bmain, BKE_main_blendfile_path(bmain), op->reports); /* redraw everything so any changed paths register */ - WM_main_add_notifier(NC_WINDOW, nullptr); + WM_main_add_notifier(NC_WINDOW, NULL); return OPERATOR_FINISHED; } @@ -423,7 +420,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) BKE_bpath_absolute_convert(bmain, BKE_main_blendfile_path(bmain), op->reports); /* redraw everything so any changed paths register */ - WM_main_add_notifier(NC_WINDOW, nullptr); + WM_main_add_notifier(NC_WINDOW, NULL); return OPERATOR_FINISHED; } @@ -473,7 +470,7 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) static int find_missing_files_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - const char *searchpath = RNA_string_get_alloc(op->ptr, "directory", nullptr, 0); + const char *searchpath = RNA_string_get_alloc(op->ptr, "directory", NULL, 0); const bool find_all = RNA_boolean_get(op->ptr, "find_all"); BKE_bpath_missing_files_find(bmain, searchpath, op->reports, find_all); @@ -545,8 +542,8 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co int send_note = 0; /* escape if not our timer */ - if ((reports->reporttimer == nullptr) || (reports->reporttimer != event->customdata) || - ((report = BKE_reports_last_displayable(reports)) == nullptr) + if ((reports->reporttimer == NULL) || (reports->reporttimer != event->customdata) || + ((report = BKE_reports_last_displayable(reports)) == NULL) /* may have been deleted */ ) { return OPERATOR_PASS_THROUGH; @@ -558,10 +555,10 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co /* clear the report display after timeout */ if ((float)reports->reporttimer->duration > timeout) { - WM_event_remove_timer(wm, nullptr, reports->reporttimer); - reports->reporttimer = nullptr; + WM_event_remove_timer(wm, NULL, reports->reporttimer); + reports->reporttimer = NULL; - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, nullptr); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); } @@ -601,7 +598,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co } if (send_note) { - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, nullptr); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); } return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); diff --git a/source/blender/editors/space_info/info_report.cc b/source/blender/editors/space_info/info_report.c index 7911b609619..7dd8382c8ef 100644 --- a/source/blender/editors/space_info/info_report.cc +++ b/source/blender/editors/space_info/info_report.c @@ -18,9 +18,9 @@ * \ingroup spinfo */ -#include <climits> -#include <cstdlib> -#include <cstring> +#include <limits.h> +#include <stdlib.h> +#include <string.h> #include "MEM_guardedalloc.h" @@ -39,13 +39,13 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "info_intern.hh" +#include "info_intern.h" static void reports_select_all(ReportList *reports, int report_mask, int action) { if (action == SEL_TOGGLE) { action = SEL_SELECT; - for (Report *report = (Report *)reports->list.last; report; report = report->prev) { + for (Report *report = reports->list.last; report; report = report->prev) { if ((report->type & report_mask) && (report->flag & SELECT)) { action = SEL_DESELECT; break; @@ -53,7 +53,7 @@ static void reports_select_all(ReportList *reports, int report_mask, int action) } } - for (Report *report = (Report *)reports->list.last; report; report = report->prev) { + for (Report *report = reports->list.last; report; report = report->prev) { if (report->type & report_mask) { switch (action) { case SEL_SELECT: @@ -115,7 +115,7 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL | RPT_PROPERTY_ALL) && (report->flag & SELECT)) { console_history_add_str(sc, report->message, 0); - WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, nullptr); + WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); ED_area_tag_redraw(CTX_wm_area(C)); } @@ -150,7 +150,7 @@ static int select_report_pick_exec(bContext *C, wmOperator *op) int report_index = RNA_int_get(op->ptr, "report_index"); bool extend = RNA_boolean_get(op->ptr, "extend"); - Report *report = (Report *)BLI_findlink(&CTX_wm_reports(C)->list, report_index); + Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index); SpaceInfo *sinfo = CTX_wm_space_info(C); ReportList *reports = CTX_wm_reports(C); @@ -174,7 +174,9 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, const wmEvent SpaceInfo *sinfo = CTX_wm_space_info(C); ARegion *region = CTX_wm_region(C); ReportList *reports = CTX_wm_reports(C); - Report *report = (Report *)info_text_pick(sinfo, region, reports, event->mval[1]); + Report *report; + + report = info_text_pick(sinfo, region, reports, event->mval[1]); RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report)); @@ -245,7 +247,7 @@ static int box_select_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rcti(op, &rect); - const eSelectOp sel_op = (eSelectOp)RNA_enum_get(op->ptr, "mode"); + const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); const int select = (sel_op != SEL_OP_SUB); if (SEL_OP_USE_PRE_DESELECT(sel_op)) { LISTBASE_FOREACH (Report *, report, &reports->list) { @@ -256,11 +258,11 @@ static int box_select_exec(bContext *C, wmOperator *op) } } - report_min = (Report *)info_text_pick(sinfo, region, reports, rect.ymax); - report_max = (Report *)info_text_pick(sinfo, region, reports, rect.ymin); + report_min = info_text_pick(sinfo, region, reports, rect.ymax); + report_max = info_text_pick(sinfo, region, reports, rect.ymin); /* get the first report if none found */ - if (report_min == nullptr) { + if (report_min == NULL) { // printf("find_min\n"); LISTBASE_FOREACH (Report *, report, &reports->list) { if (report->type & report_mask) { @@ -270,9 +272,9 @@ static int box_select_exec(bContext *C, wmOperator *op) } } - if (report_max == nullptr) { + if (report_max == NULL) { // printf("find_max\n"); - for (Report *report = (Report *)reports->list.last; report; report = report->prev) { + for (Report *report = reports->list.last; report; report = report->prev) { if (report->type & report_mask) { report_max = report; break; @@ -280,7 +282,7 @@ static int box_select_exec(bContext *C, wmOperator *op) } } - if (report_min == nullptr || report_max == nullptr) { + if (report_min == NULL || report_max == NULL) { return OPERATOR_CANCELLED; } @@ -328,7 +330,7 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) Report *report, *report_next; - for (report = (Report *)reports->list.first; report;) { + for (report = reports->list.first; report;) { report_next = report->next; @@ -374,7 +376,7 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) DynStr *buf_dyn = BLI_dynstr_new(); char *buf_str; - for (report = (Report *)reports->list.first; report; report = report->next) { + for (report = reports->list.first; report; report = report->next) { if ((report->type & report_mask) && (report->flag & SELECT)) { BLI_dynstr_append(buf_dyn, report->message); BLI_dynstr_append(buf_dyn, "\n"); @@ -384,7 +386,7 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) buf_str = BLI_dynstr_get_cstring(buf_dyn); BLI_dynstr_free(buf_dyn); - WM_clipboard_text_set(buf_str, false); + WM_clipboard_text_set(buf_str, 0); MEM_freeN(buf_str); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.c index de92feaed10..0bdfceb36b6 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.c @@ -18,8 +18,8 @@ * \ingroup spinfo */ -#include <cstdio> -#include <cstring> +#include <stdio.h> +#include <string.h> #include "MEM_guardedalloc.h" @@ -69,7 +69,7 @@ #define MAX_INFO_NUM_LEN 16 -struct SceneStats { +typedef struct SceneStats { uint64_t totvert, totvertsel, totvertsculpt; uint64_t totedge, totedgesel; uint64_t totface, totfacesel, totfacesculpt; @@ -78,9 +78,9 @@ struct SceneStats { uint64_t totlamp, totlampsel; uint64_t tottri; uint64_t totgplayer, totgpframe, totgpstroke, totgppoint; -}; +} SceneStats; -struct SceneStatsFmt { +typedef struct SceneStatsFmt { /* Totals */ char totvert[MAX_INFO_NUM_LEN], totvertsel[MAX_INFO_NUM_LEN], totvertsculpt[MAX_INFO_NUM_LEN]; char totface[MAX_INFO_NUM_LEN], totfacesel[MAX_INFO_NUM_LEN]; @@ -91,16 +91,16 @@ struct SceneStatsFmt { char tottri[MAX_INFO_NUM_LEN]; char totgplayer[MAX_INFO_NUM_LEN], totgpframe[MAX_INFO_NUM_LEN]; char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN]; -}; +} SceneStatsFmt; static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats) { - if (me_eval == nullptr) { + if (me_eval == NULL) { return false; } int totvert, totedge, totface, totloop; - if (me_eval->runtime.subdiv_ccg != nullptr) { + if (me_eval->runtime.subdiv_ccg != NULL) { const SubdivCCG *subdiv_ccg = me_eval->runtime.subdiv_ccg; BKE_subdiv_ccg_topology_counters(subdiv_ccg, &totvert, &totedge, &totface, &totloop); } @@ -156,7 +156,7 @@ static void stats_object(Object *ob, SceneStats *stats, GSet *objects_gset) case OB_CURVE: case OB_FONT: { Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); - if ((me_eval != nullptr) && !BLI_gset_add(objects_gset, me_eval)) { + if ((me_eval != NULL) && !BLI_gset_add(objects_gset, me_eval)) { break; } @@ -232,10 +232,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } else if (obedit->type == OB_ARMATURE) { /* Armature Edit */ - bArmature *arm = (bArmature *)obedit->data; + bArmature *arm = obedit->data; EditBone *ebo; - for (ebo = (EditBone *)arm->edbo->first; ebo; ebo = ebo->next) { + for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { stats->totbone++; if ((ebo->flag & BONE_CONNECTED) && ebo->parent) { @@ -264,14 +264,14 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { /* OB_FONT has no cu->editnurb */ /* Curve Edit */ - Curve *cu = (Curve *)obedit->data; + Curve *cu = obedit->data; Nurb *nu; BezTriple *bezt; BPoint *bp; int a; ListBase *nurbs = BKE_curve_editNurbs_get(cu); - for (nu = (Nurb *)nurbs->first; nu; nu = nu->next) { + for (nu = nurbs->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { bezt = nu->bezt; a = nu->pntsu; @@ -304,10 +304,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } else if (obedit->type == OB_MBALL) { /* MetaBall Edit */ - MetaBall *mball = (MetaBall *)obedit->data; + MetaBall *mball = obedit->data; MetaElem *ml; - for (ml = (MetaElem *)mball->editelems->first; ml; ml = ml->next) { + for (ml = mball->editelems->first; ml; ml = ml->next) { stats->totvert++; if (ml->flag & SELECT) { stats->totvertsel++; @@ -316,7 +316,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } else if (obedit->type == OB_LATTICE) { /* Lattice Edit */ - Lattice *lt = (Lattice *)obedit->data; + Lattice *lt = obedit->data; Lattice *editlatt = lt->editlatt->latt; BPoint *bp; int a; @@ -337,10 +337,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) static void stats_object_pose(Object *ob, SceneStats *stats) { if (ob->pose) { - bArmature *arm = (bArmature *)ob->data; + bArmature *arm = ob->data; bPoseChannel *pchan; - for (pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) { + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { stats->totbone++; if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) { if (pchan->bone->layer & arm->layer) { @@ -353,10 +353,10 @@ static void stats_object_pose(Object *ob, SceneStats *stats) static bool stats_is_object_dynamic_topology_sculpt(Object *ob) { - if (ob == nullptr) { + if (ob == NULL) { return false; } - const eObjectMode object_mode = (eObjectMode)ob->mode; + const eObjectMode object_mode = ob->mode; return ((object_mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm); } @@ -420,7 +420,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer) stats_object(ob_iter, &stats, objects_gset); } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END; - BLI_gset_free(objects_gset, nullptr); + BLI_gset_free(objects_gset, NULL); } if (ob && (ob->mode & OB_MODE_SCULPT)) { @@ -430,7 +430,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer) } if (!view_layer->stats) { - view_layer->stats = (SceneStats *)MEM_callocN(sizeof(SceneStats), "SceneStats"); + view_layer->stats = MEM_callocN(sizeof(SceneStats), "SceneStats"); } *(view_layer->stats) = stats; @@ -440,7 +440,7 @@ void ED_info_stats_clear(ViewLayer *view_layer) { if (view_layer->stats) { MEM_freeN(view_layer->stats); - view_layer->stats = nullptr; + view_layer->stats = NULL; } } @@ -452,7 +452,7 @@ static bool format_stats(Main *bmain, /* Create stats if they don't already exist. */ if (!view_layer->stats) { /* Do not not access dependency graph if interface is marked as locked. */ - wmWindowManager *wm = (wmWindowManager *)bmain->wm.first; + wmWindowManager *wm = bmain->wm.first; if (wm->is_interface_locked) { return false; } @@ -501,7 +501,7 @@ static void get_stats_string( { Object *ob = OBACT(view_layer); Object *obedit = OBEDIT_FROM_OBACT(ob); - eObjectMode object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT; + eObjectMode object_mode = ob ? ob->mode : OB_MODE_OBJECT; LayerCollection *layer_collection = view_layer->active_collection; if (object_mode == OB_MODE_OBJECT) { @@ -660,8 +660,9 @@ const char *ED_info_statusbar_string(Main *bmain, Scene *scene, ViewLayer *view_ const char *ED_info_statistics_string(Main *bmain, Scene *scene, ViewLayer *view_layer) { - const eUserpref_StatusBar_Flag statistics_status_bar_flag = (eUserpref_StatusBar_Flag)( - STATUSBAR_SHOW_STATS | STATUSBAR_SHOW_MEMORY | STATUSBAR_SHOW_VERSION); + const eUserpref_StatusBar_Flag statistics_status_bar_flag = STATUSBAR_SHOW_STATS | + STATUSBAR_SHOW_MEMORY | + STATUSBAR_SHOW_VERSION; return info_statusbar_string(bmain, scene, view_layer, statistics_status_bar_flag); } @@ -691,7 +692,7 @@ void ED_info_draw_stats( Object *ob = OBACT(view_layer); Object *obedit = OBEDIT_FROM_OBACT(ob); - eObjectMode object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT; + eObjectMode object_mode = ob ? ob->mode : OB_MODE_OBJECT; const int font_id = BLF_default(); UI_FontThemeColor(font_id, TH_TEXT_HI); @@ -751,7 +752,7 @@ void ED_info_draw_stats( stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height); stats_row(col1, labels[EDGES], col2, stats_fmt.totedgesel, stats_fmt.totedge, y, height); stats_row(col1, labels[FACES], col2, stats_fmt.totfacesel, stats_fmt.totface, y, height); - stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height); + stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, NULL, y, height); } else if (obedit->type == OB_ARMATURE) { stats_row(col1, labels[JOINTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height); @@ -765,15 +766,15 @@ void ED_info_draw_stats( stats_row(col1, labels[BONES], col2, stats_fmt.totbonesel, stats_fmt.totbone, y, height); } else if ((ob) && (ob->type == OB_GPENCIL)) { - stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, nullptr, y, height); - stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, nullptr, y, height); - stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, nullptr, y, height); - stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, nullptr, y, height); + stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, NULL, y, height); + stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, NULL, y, height); + stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, NULL, y, height); + stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, NULL, y, height); } else if (ob && (object_mode & OB_MODE_SCULPT)) { if (stats_is_object_dynamic_topology_sculpt(ob)) { - stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, nullptr, y, height); - stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height); + stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, NULL, y, height); + stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, NULL, y, height); } else { stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, stats_fmt.totvert, y, height); @@ -781,10 +782,10 @@ void ED_info_draw_stats( } } else { - stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, nullptr, y, height); - stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, nullptr, y, height); - stats_row(col1, labels[FACES], col2, stats_fmt.totface, nullptr, y, height); - stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height); + stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, NULL, y, height); + stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, NULL, y, height); + stats_row(col1, labels[FACES], col2, stats_fmt.totface, NULL, y, height); + stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, NULL, y, height); } BLF_disable(font_id, BLF_SHADOW); diff --git a/source/blender/editors/space_info/space_info.cc b/source/blender/editors/space_info/space_info.c index f24d1949a91..204ad25b984 100644 --- a/source/blender/editors/space_info/space_info.cc +++ b/source/blender/editors/space_info/space_info.c @@ -21,8 +21,8 @@ * \ingroup spinfo */ -#include <cstdio> -#include <cstring> +#include <stdio.h> +#include <string.h> #include "MEM_guardedalloc.h" @@ -44,7 +44,7 @@ #include "UI_resources.h" #include "UI_view2d.h" -#include "info_intern.hh" /* own include */ +#include "info_intern.h" /* own include */ /* ******************** default callbacks for info space ***************** */ @@ -53,20 +53,20 @@ static SpaceLink *info_create(const ScrArea *UNUSED(area), const Scene *UNUSED(s ARegion *region; SpaceInfo *sinfo; - sinfo = (SpaceInfo *)MEM_callocN(sizeof(SpaceInfo), "initinfo"); + sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo"); sinfo->spacetype = SPACE_INFO; sinfo->rpt_mask = INFO_RPT_OP; /* header */ - region = (ARegion *)MEM_callocN(sizeof(ARegion), "header for info"); + region = MEM_callocN(sizeof(ARegion), "header for info"); BLI_addtail(&sinfo->regionbase, region); region->regiontype = RGN_TYPE_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ - region = (ARegion *)MEM_callocN(sizeof(ARegion), "main region for info"); + region = MEM_callocN(sizeof(ARegion), "main region for info"); BLI_addtail(&sinfo->regionbase, region); region->regiontype = RGN_TYPE_WINDOW; @@ -98,7 +98,7 @@ static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) static SpaceLink *info_duplicate(SpaceLink *sl) { - SpaceInfo *sinfon = (SpaceInfo *)MEM_dupallocN(sl); + SpaceInfo *sinfon = MEM_dupallocN(sl); /* clear or remove stuff from old */ @@ -154,10 +154,10 @@ static void info_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - UI_view2d_scrollers_draw(v2d, nullptr); + UI_view2d_scrollers_draw(v2d, NULL); } -static void info_operatortypes() +static void info_operatortypes(void) { WM_operatortype_append(FILE_OT_autopack_toggle); WM_operatortype_append(FILE_OT_pack_all); @@ -267,7 +267,7 @@ static void info_header_region_message_subscribe(const wmRegionMessageSubscribeP /* only called once, from space/spacetypes.c */ void ED_spacetype_info(void) { - SpaceType *st = (SpaceType *)MEM_callocN(sizeof(SpaceType), "spacetype info"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info"); ARegionType *art; st->spaceid = SPACE_INFO; @@ -281,7 +281,7 @@ void ED_spacetype_info(void) st->keymap = info_keymap; /* regions: main window */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype info region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype info region"); art->regionid = RGN_TYPE_WINDOW; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES; @@ -292,7 +292,7 @@ void ED_spacetype_info(void) BLI_addhead(&st->regiontypes, art); /* regions: header */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype info region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype info region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; diff --git a/source/blender/editors/space_info/textview.cc b/source/blender/editors/space_info/textview.c index 4dfeb742238..aef59e89325 100644 --- a/source/blender/editors/space_info/textview.cc +++ b/source/blender/editors/space_info/textview.c @@ -42,7 +42,7 @@ static void textview_font_begin(const int font_id, const int lheight) BLF_size(font_id, 0.8f * lheight, 72); } -struct TextViewDrawState { +typedef struct TextViewDrawState { int font_id; int cwidth; int lheight; @@ -62,7 +62,7 @@ struct TextViewDrawState { int *mval_pick_offset; const int *mval; // [2] bool do_draw; -}; +} TextViewDrawState; BLI_INLINE void textview_step_sel(TextViewDrawState *tds, const int step) { @@ -111,7 +111,7 @@ static int textview_wrap_offsets( *r_lines = 1; - *r_offsets = (int *)MEM_callocN( + *r_offsets = MEM_callocN( sizeof(**r_offsets) * (len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1), __func__); @@ -225,13 +225,16 @@ static bool textview_draw_string(TextViewDrawState *tds, rgba_uchar_to_float(col, icon_bg); UI_draw_roundbox_corner_set(UI_CNR_ALL); - const rctf rect{ - hpadding, - bg_size + hpadding, - line_top - bg_size - vpadding, - line_top - vpadding, - }; - UI_draw_roundbox_4fv(&rect, true, 4 * UI_DPI_FAC, col); + UI_draw_roundbox_4fv( + &(const rctf){ + .xmin = hpadding, + .xmax = bg_size + hpadding, + .ymin = line_top - bg_size - vpadding, + .ymax = line_top - vpadding, + }, + true, + 4 * UI_DPI_FAC, + col); } if (icon) { @@ -339,7 +342,7 @@ int textview_draw(TextViewContext *tvc, CLAMPIS(mval_init[1], tvc->draw_rect.ymin, tvc->draw_rect.ymax) + tvc->scroll_ymin, }; - if (r_mval_pick_offset != nullptr) { + if (r_mval_pick_offset != NULL) { *r_mval_pick_offset = 0; } @@ -396,11 +399,11 @@ int textview_draw(TextViewContext *tvc, &tds, ext_line, ext_len, - (data_flag & TVC_LINE_FG) ? fg : nullptr, - (data_flag & TVC_LINE_BG) ? bg : nullptr, + (data_flag & TVC_LINE_FG) ? fg : NULL, + (data_flag & TVC_LINE_BG) ? bg : NULL, (data_flag & TVC_LINE_ICON) ? icon : 0, - (data_flag & TVC_LINE_ICON_FG) ? icon_fg : nullptr, - (data_flag & TVC_LINE_ICON_BG) ? icon_bg : nullptr, + (data_flag & TVC_LINE_ICON_FG) ? icon_fg : NULL, + (data_flag & TVC_LINE_ICON_BG) ? icon_bg : NULL, bg_sel); if (do_draw) { diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index e547f0c2cba..7520dbce191 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -20,10 +20,6 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - enum eTextViewContext_LineFlag { TVC_LINE_FG = (1 << 0), TVC_LINE_BG = (1 << 1), @@ -82,7 +78,3 @@ int textview_draw(struct TextViewContext *tvc, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.h b/source/blender/windowmanager/message_bus/wm_message_bus.h index 8c8caaf104b..7ae356cf806 100644 --- a/source/blender/windowmanager/message_bus/wm_message_bus.h +++ b/source/blender/windowmanager/message_bus/wm_message_bus.h @@ -260,10 +260,16 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id); /* Anonymous variants (for convenience) */ #define WM_msg_subscribe_rna_anon_type(mbus, type_, value) \ { \ - wmMsgParams_RNA msg_params = {0}; \ - msg_params.ptr.type = &RNA_##type_; \ - msg_params.prop = NULL; \ - WM_msg_subscribe_rna_params(mbus, &msg_params, value, __func__); \ + WM_msg_subscribe_rna_params(mbus, \ + &(const wmMsgParams_RNA){ \ + .ptr = \ + (PointerRNA){ \ + .type = &RNA_##type_, \ + }, \ + .prop = NULL, \ + }, \ + value, \ + __func__); \ } \ ((void)0) #define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value) \ @@ -271,10 +277,16 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id); _WM_MESSAGE_EXTERN_BEGIN; \ extern PropertyRNA rna_##type_##_##prop_; \ _WM_MESSAGE_EXTERN_END; \ - wmMsgParams_RNA msg_params = {0}; \ - msg_params.ptr.type = &RNA_##type_; \ - msg_params.prop = &rna_##type_##_##prop_; \ - WM_msg_subscribe_rna_params(mbus, &msg_params, value, __func__); \ + WM_msg_subscribe_rna_params(mbus, \ + &(const wmMsgParams_RNA){ \ + .ptr = \ + (PointerRNA){ \ + .type = &RNA_##type_, \ + }, \ + .prop = &rna_##type_##_##prop_, \ + }, \ + value, \ + __func__); \ } \ ((void)0) |