Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-04-24 17:06:01 +0300
committerJacques Lucke <jacques@blender.org>2021-04-24 17:06:01 +0300
commit042524c1f19717ac8c5787479fcdf60a6d156b23 (patch)
treef4c9450d778eb3185c68d09f7a8355bdf441798d
parent8adeac7c27936d61d12229ac7d30ea84b7653940 (diff)
Info Editor: move to c++info-editor-cpp
I'm currently doing some experiments in the info editor and for that it is easier if the info editor is in c++ already.
-rw-r--r--source/blender/blenkernel/BKE_layer.h2
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt14
-rw-r--r--source/blender/editors/space_info/info_draw.cc (renamed from source/blender/editors/space_info/info_draw.c)39
-rw-r--r--source/blender/editors/space_info/info_intern.hh (renamed from source/blender/editors/space_info/info_intern.h)0
-rw-r--r--source/blender/editors/space_info/info_ops.cc (renamed from source/blender/editors/space_info/info_ops.c)43
-rw-r--r--source/blender/editors/space_info/info_report.cc (renamed from source/blender/editors/space_info/info_report.c)40
-rw-r--r--source/blender/editors/space_info/info_stats.cc (renamed from source/blender/editors/space_info/info_stats.c)79
-rw-r--r--source/blender/editors/space_info/space_info.cc (renamed from source/blender/editors/space_info/space_info.c)24
-rw-r--r--source/blender/editors/space_info/textview.cc (renamed from source/blender/editors/space_info/textview.c)33
-rw-r--r--source/blender/editors/space_info/textview.h8
-rw-r--r--source/blender/windowmanager/message_bus/wm_message_bus.h28
11 files changed, 152 insertions, 158 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index 240d6cb18ec..a89ece567a2 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 = (view_layer)->object_bases.first; _base; _base = _base->next) { \
+ for (_base = (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 b6df07eec4e..15194082376 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.c
- info_ops.c
- info_report.c
- info_stats.c
- space_info.c
- textview.c
+ info_draw.cc
+ info_ops.cc
+ info_report.cc
+ info_stats.cc
+ space_info.cc
+ textview.cc
- info_intern.h
+ info_intern.hh
textview.h
)
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.cc
index be3b60d581b..852447372d6 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.cc
@@ -21,8 +21,8 @@
* \ingroup spinfo
*/
-#include <limits.h>
-#include <string.h>
+#include <climits>
+#include <cstring>
#include "BLI_utildefines.h"
@@ -35,7 +35,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "info_intern.h"
+#include "info_intern.hh"
#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 = tvc->iter;
+ const Report *report = (const 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,16 +71,17 @@ 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 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 | TVC_LINE_ICON |
+ TVC_LINE_ICON_FG | TVC_LINE_ICON_BG);
}
- return TVC_LINE_FG | TVC_LINE_BG;
+ return (enum eTextViewContext_LineFlag)(TVC_LINE_FG | TVC_LINE_BG);
}
/* reports! */
static void report_textview_init__internal(TextViewContext *tvc)
{
- const Report *report = tvc->iter;
+ const Report *report = (const Report *)tvc->iter;
const char *str = report->message;
for (int i = tvc->iter_char_end - 1; i >= 0; i -= 1) {
if (str[i] == '\n') {
@@ -93,17 +94,17 @@ static void report_textview_init__internal(TextViewContext *tvc)
static int report_textview_skip__internal(TextViewContext *tvc)
{
- const SpaceInfo *sinfo = tvc->arg1;
+ const SpaceInfo *sinfo = (const SpaceInfo *)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 != NULL);
+ return (tvc->iter != nullptr);
}
static int report_textview_begin(TextViewContext *tvc)
{
- const ReportList *reports = tvc->arg2;
+ const ReportList *reports = (const ReportList *)tvc->arg2;
tvc->sel_start = 0;
tvc->sel_end = 0;
@@ -116,7 +117,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 = tvc->iter;
+ const Report *report = (const Report *)tvc->iter;
tvc->iter_char_end = report->len;
report_textview_init__internal(tvc);
@@ -134,14 +135,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 = tvc->iter;
+ const Report *report = (const 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 = tvc->iter;
+ report = (const Report *)tvc->iter;
tvc->iter_char_end = report->len; /* reset start */
report_textview_init__internal(tvc);
@@ -159,7 +160,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 = tvc->iter;
+ const Report *report = (const Report *)tvc->iter;
*r_line = report->message + tvc->iter_char_begin;
*r_len = tvc->iter_char_end - tvc->iter_char_begin;
}
@@ -200,7 +201,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 = NULL;
+ tvc.const_colors = nullptr;
tvc.arg1 = sinfo;
tvc.arg2 = reports;
@@ -225,21 +226,21 @@ void *info_text_pick(const SpaceInfo *sinfo,
const ReportList *reports,
int mouse_y)
{
- void *mval_pick_item = NULL;
+ void *mval_pick_item = nullptr;
const int mval[2] = {0, mouse_y};
- info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, NULL);
+ info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, nullptr);
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, NULL, NULL);
+ return info_textview_main__internal(sinfo, region, reports, false, mval, nullptr, nullptr);
}
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, NULL, NULL);
+ info_textview_main__internal(sinfo, region, reports, true, mval, nullptr, nullptr);
}
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.hh
index a19ebe5ef04..a19ebe5ef04 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.hh
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.cc
index 0583628be43..e7a4e18c789 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.cc
@@ -21,8 +21,8 @@
* \ingroup spinfo
*/
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#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.h"
+#include "info_intern.hh"
/********************* 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 = bmain->images.first; ima; ima = ima->id.next) {
+ for (ima = (Image *)bmain->images.first; ima; ima = (Image *)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, NULL, 0, NULL, NULL},
+ {0, nullptr, 0, nullptr, nullptr},
};
static int unpack_all_exec(bContext *C, wmOperator *op)
@@ -219,7 +219,8 @@ 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, method); /* XXX PF_ASK can't work here */
+ BKE_packedfile_unpack_all(
+ bmain, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */
}
G.fileflags &= ~G_FILE_AUTOPACK;
@@ -299,7 +300,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, NULL, 0, NULL, NULL},
+ {0, nullptr, 0, nullptr, nullptr},
};
static int unpack_item_exec(bContext *C, wmOperator *op)
@@ -313,13 +314,14 @@ 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 == NULL) {
+ if (id == nullptr) {
BKE_report(op->reports, RPT_WARNING, "No packed file");
return OPERATOR_CANCELLED;
}
if (method != PF_KEEP) {
- BKE_packedfile_id_unpack(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
+ BKE_packedfile_id_unpack(
+ bmain, id, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */
}
G.fileflags &= ~G_FILE_AUTOPACK;
@@ -336,7 +338,8 @@ 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", op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
+ uiItemsFullEnumO(
+ layout, op->type->idname, "method", (IDProperty *)op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
UI_popup_menu_end(C, pup);
@@ -361,7 +364,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", NULL, BKE_ST_MAXNAME, "ID Name", "Name of ID block to unpack");
+ ot->srna, "id_name", nullptr, BKE_ST_MAXNAME, "ID Name", "Name of ID block to unpack");
RNA_def_int(ot->srna,
"id_type",
ID_IM,
@@ -387,7 +390,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, NULL);
+ WM_main_add_notifier(NC_WINDOW, nullptr);
return OPERATOR_FINISHED;
}
@@ -420,7 +423,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, NULL);
+ WM_main_add_notifier(NC_WINDOW, nullptr);
return OPERATOR_FINISHED;
}
@@ -470,7 +473,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", NULL, 0);
+ const char *searchpath = RNA_string_get_alloc(op->ptr, "directory", nullptr, 0);
const bool find_all = RNA_boolean_get(op->ptr, "find_all");
BKE_bpath_missing_files_find(bmain, searchpath, op->reports, find_all);
@@ -542,8 +545,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 == NULL) || (reports->reporttimer != event->customdata) ||
- ((report = BKE_reports_last_displayable(reports)) == NULL)
+ if ((reports->reporttimer == nullptr) || (reports->reporttimer != event->customdata) ||
+ ((report = BKE_reports_last_displayable(reports)) == nullptr)
/* may have been deleted */
) {
return OPERATOR_PASS_THROUGH;
@@ -555,10 +558,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, NULL, reports->reporttimer);
- reports->reporttimer = NULL;
+ WM_event_remove_timer(wm, nullptr, reports->reporttimer);
+ reports->reporttimer = nullptr;
- WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, nullptr);
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
@@ -598,7 +601,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, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, nullptr);
}
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.cc
index 7dd8382c8ef..7911b609619 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.cc
@@ -18,9 +18,9 @@
* \ingroup spinfo
*/
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
+#include <climits>
+#include <cstdlib>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -39,13 +39,13 @@
#include "RNA_access.h"
#include "RNA_define.h"
-#include "info_intern.h"
+#include "info_intern.hh"
static void reports_select_all(ReportList *reports, int report_mask, int action)
{
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- for (Report *report = reports->list.last; report; report = report->prev) {
+ for (Report *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 = reports->list.last; report; report = report->prev) {
+ for (Report *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, NULL);
+ WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, nullptr);
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 = BLI_findlink(&CTX_wm_reports(C)->list, report_index);
+ Report *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,9 +174,7 @@ 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));
@@ -247,7 +245,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
WM_operator_properties_border_to_rcti(op, &rect);
- const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const eSelectOp sel_op = (eSelectOp)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) {
@@ -258,11 +256,11 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- report_min = info_text_pick(sinfo, region, reports, rect.ymax);
- report_max = info_text_pick(sinfo, region, reports, rect.ymin);
+ report_min = (Report *)info_text_pick(sinfo, region, reports, rect.ymax);
+ report_max = (Report *)info_text_pick(sinfo, region, reports, rect.ymin);
/* get the first report if none found */
- if (report_min == NULL) {
+ if (report_min == nullptr) {
// printf("find_min\n");
LISTBASE_FOREACH (Report *, report, &reports->list) {
if (report->type & report_mask) {
@@ -272,9 +270,9 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- if (report_max == NULL) {
+ if (report_max == nullptr) {
// printf("find_max\n");
- for (Report *report = reports->list.last; report; report = report->prev) {
+ for (Report *report = (Report *)reports->list.last; report; report = report->prev) {
if (report->type & report_mask) {
report_max = report;
break;
@@ -282,7 +280,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- if (report_min == NULL || report_max == NULL) {
+ if (report_min == nullptr || report_max == nullptr) {
return OPERATOR_CANCELLED;
}
@@ -330,7 +328,7 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
Report *report, *report_next;
- for (report = reports->list.first; report;) {
+ for (report = (Report *)reports->list.first; report;) {
report_next = report->next;
@@ -376,7 +374,7 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
DynStr *buf_dyn = BLI_dynstr_new();
char *buf_str;
- for (report = reports->list.first; report; report = report->next) {
+ for (report = (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");
@@ -386,7 +384,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, 0);
+ WM_clipboard_text_set(buf_str, false);
MEM_freeN(buf_str);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.cc
index ffac5c982d6..71a2594a8be 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.cc
@@ -18,8 +18,8 @@
* \ingroup spinfo
*/
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -69,7 +69,7 @@
#define MAX_INFO_NUM_LEN 16
-typedef struct SceneStats {
+struct SceneStats {
uint64_t totvert, totvertsel, totvertsculpt;
uint64_t totedge, totedgesel;
uint64_t totface, totfacesel, totfacesculpt;
@@ -78,9 +78,9 @@ typedef struct SceneStats {
uint64_t totlamp, totlampsel;
uint64_t tottri;
uint64_t totgplayer, totgpframe, totgpstroke, totgppoint;
-} SceneStats;
+};
-typedef struct SceneStatsFmt {
+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 @@ typedef 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 == NULL) {
+ if (me_eval == nullptr) {
return false;
}
int totvert, totedge, totface, totloop;
- if (me_eval->runtime.subdiv_ccg != NULL) {
+ if (me_eval->runtime.subdiv_ccg != nullptr) {
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 != NULL) && !BLI_gset_add(objects_gset, me_eval)) {
+ if ((me_eval != nullptr) && !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 = obedit->data;
+ bArmature *arm = (bArmature *)obedit->data;
EditBone *ebo;
- for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
+ for (ebo = (EditBone *)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 = obedit->data;
+ Curve *cu = (Curve *)obedit->data;
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
int a;
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
- for (nu = nurbs->first; nu; nu = nu->next) {
+ for (nu = (Nurb *)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 = obedit->data;
+ MetaBall *mball = (MetaBall *)obedit->data;
MetaElem *ml;
- for (ml = mball->editelems->first; ml; ml = ml->next) {
+ for (ml = (MetaElem *)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 = obedit->data;
+ Lattice *lt = (Lattice *)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 = ob->data;
+ bArmature *arm = (bArmature *)ob->data;
bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ for (pchan = (bPoseChannel *)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 == NULL) {
+ if (ob == nullptr) {
return false;
}
- const eObjectMode object_mode = ob->mode;
+ const eObjectMode object_mode = (eObjectMode)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, NULL);
+ BLI_gset_free(objects_gset, nullptr);
}
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 = MEM_callocN(sizeof(SceneStats), "SceneStats");
+ view_layer->stats = (SceneStats *)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 = NULL;
+ view_layer->stats = nullptr;
}
}
@@ -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 = bmain->wm.first;
+ wmWindowManager *wm = (wmWindowManager *)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 ? ob->mode : OB_MODE_OBJECT;
+ eObjectMode object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT;
LayerCollection *layer_collection = view_layer->active_collection;
if (object_mode == OB_MODE_OBJECT) {
@@ -660,9 +660,8 @@ 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 = STATUSBAR_SHOW_STATS |
- STATUSBAR_SHOW_MEMORY |
- STATUSBAR_SHOW_VERSION;
+ const eUserpref_StatusBar_Flag statistics_status_bar_flag = (eUserpref_StatusBar_Flag)(
+ STATUSBAR_SHOW_STATS | STATUSBAR_SHOW_MEMORY | STATUSBAR_SHOW_VERSION);
return info_statusbar_string(bmain, scene, view_layer, statistics_status_bar_flag);
}
@@ -692,7 +691,7 @@ void ED_info_draw_stats(
Object *ob = OBACT(view_layer);
Object *obedit = OBEDIT_FROM_OBACT(ob);
- eObjectMode object_mode = ob ? ob->mode : OB_MODE_OBJECT;
+ eObjectMode object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT;
const int font_id = BLF_default();
UI_FontThemeColor(font_id, TH_TEXT_HI);
@@ -751,7 +750,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, NULL, y, height);
+ stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height);
}
else if (obedit->type == OB_ARMATURE) {
stats_row(col1, labels[JOINTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height);
@@ -765,15 +764,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, 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);
+ 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);
}
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, NULL, y, height);
- stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, NULL, y, height);
+ stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, nullptr, y, height);
+ stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height);
}
else {
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, stats_fmt.totvert, y, height);
@@ -781,10 +780,10 @@ void ED_info_draw_stats(
}
}
else {
- 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);
+ 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);
}
BLF_disable(font_id, BLF_SHADOW);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.cc
index dfc0abee704..43716a70f90 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.cc
@@ -21,8 +21,8 @@
* \ingroup spinfo
*/
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -44,7 +44,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "info_intern.h" /* own include */
+#include "info_intern.hh" /* 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 = MEM_callocN(sizeof(SpaceInfo), "initinfo");
+ sinfo = (SpaceInfo *)MEM_callocN(sizeof(SpaceInfo), "initinfo");
sinfo->spacetype = SPACE_INFO;
sinfo->rpt_mask = INFO_RPT_OP;
/* header */
- region = MEM_callocN(sizeof(ARegion), "header for info");
+ region = (ARegion *)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 = MEM_callocN(sizeof(ARegion), "main region for info");
+ region = (ARegion *)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 = MEM_dupallocN(sl);
+ SpaceInfo *sinfon = (SpaceInfo *)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, NULL);
+ UI_view2d_scrollers_draw(v2d, nullptr);
}
-static void info_operatortypes(void)
+static void info_operatortypes()
{
WM_operatortype_append(FILE_OT_autopack_toggle);
WM_operatortype_append(FILE_OT_pack_all);
@@ -268,7 +268,7 @@ static void info_header_region_message_subscribe(const wmRegionMessageSubscribeP
/* only called once, from space/spacetypes.c */
void ED_spacetype_info(void)
{
- SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info");
+ SpaceType *st = (SpaceType *)MEM_callocN(sizeof(SpaceType), "spacetype info");
ARegionType *art;
st->spaceid = SPACE_INFO;
@@ -282,7 +282,7 @@ void ED_spacetype_info(void)
st->keymap = info_keymap;
/* regions: main window */
- art = MEM_callocN(sizeof(ARegionType), "spacetype info region");
+ art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype info region");
art->regionid = RGN_TYPE_WINDOW;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
@@ -293,7 +293,7 @@ void ED_spacetype_info(void)
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art = MEM_callocN(sizeof(ARegionType), "spacetype info region");
+ art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype info region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.cc
index aef59e89325..4dfeb742238 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.cc
@@ -42,7 +42,7 @@ static void textview_font_begin(const int font_id, const int lheight)
BLF_size(font_id, 0.8f * lheight, 72);
}
-typedef struct TextViewDrawState {
+struct TextViewDrawState {
int font_id;
int cwidth;
int lheight;
@@ -62,7 +62,7 @@ typedef 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 = MEM_callocN(
+ *r_offsets = (int *)MEM_callocN(
sizeof(**r_offsets) *
(len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1),
__func__);
@@ -225,16 +225,13 @@ static bool textview_draw_string(TextViewDrawState *tds,
rgba_uchar_to_float(col, icon_bg);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- 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);
+ 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);
}
if (icon) {
@@ -342,7 +339,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 != NULL) {
+ if (r_mval_pick_offset != nullptr) {
*r_mval_pick_offset = 0;
}
@@ -399,11 +396,11 @@ int textview_draw(TextViewContext *tvc,
&tds,
ext_line,
ext_len,
- (data_flag & TVC_LINE_FG) ? fg : NULL,
- (data_flag & TVC_LINE_BG) ? bg : NULL,
+ (data_flag & TVC_LINE_FG) ? fg : nullptr,
+ (data_flag & TVC_LINE_BG) ? bg : nullptr,
(data_flag & TVC_LINE_ICON) ? icon : 0,
- (data_flag & TVC_LINE_ICON_FG) ? icon_fg : NULL,
- (data_flag & TVC_LINE_ICON_BG) ? icon_bg : NULL,
+ (data_flag & TVC_LINE_ICON_FG) ? icon_fg : nullptr,
+ (data_flag & TVC_LINE_ICON_BG) ? icon_bg : nullptr,
bg_sel);
if (do_draw) {
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
index 7520dbce191..e547f0c2cba 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -20,6 +20,10 @@
#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum eTextViewContext_LineFlag {
TVC_LINE_FG = (1 << 0),
TVC_LINE_BG = (1 << 1),
@@ -78,3 +82,7 @@ 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 7ae356cf806..8c8caaf104b 100644
--- a/source/blender/windowmanager/message_bus/wm_message_bus.h
+++ b/source/blender/windowmanager/message_bus/wm_message_bus.h
@@ -260,16 +260,10 @@ 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) \
{ \
- WM_msg_subscribe_rna_params(mbus, \
- &(const wmMsgParams_RNA){ \
- .ptr = \
- (PointerRNA){ \
- .type = &RNA_##type_, \
- }, \
- .prop = NULL, \
- }, \
- value, \
- __func__); \
+ 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__); \
} \
((void)0)
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value) \
@@ -277,16 +271,10 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id);
_WM_MESSAGE_EXTERN_BEGIN; \
extern PropertyRNA rna_##type_##_##prop_; \
_WM_MESSAGE_EXTERN_END; \
- WM_msg_subscribe_rna_params(mbus, \
- &(const wmMsgParams_RNA){ \
- .ptr = \
- (PointerRNA){ \
- .type = &RNA_##type_, \
- }, \
- .prop = &rna_##type_##_##prop_, \
- }, \
- value, \
- __func__); \
+ 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__); \
} \
((void)0)