Compare commits
1 Commits
file-brows
...
info-edito
Author | SHA1 | Date | |
---|---|---|---|
042524c1f1 |
@@ -325,7 +325,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
|
|||||||
{ \
|
{ \
|
||||||
Object *_instance; \
|
Object *_instance; \
|
||||||
Base *_base; \
|
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;
|
_instance = _base->object;
|
||||||
|
|
||||||
#define FOREACH_OBJECT_END \
|
#define FOREACH_OBJECT_END \
|
||||||
|
@@ -34,14 +34,14 @@ set(INC
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
info_draw.c
|
info_draw.cc
|
||||||
info_ops.c
|
info_ops.cc
|
||||||
info_report.c
|
info_report.cc
|
||||||
info_stats.c
|
info_stats.cc
|
||||||
space_info.c
|
space_info.cc
|
||||||
textview.c
|
textview.cc
|
||||||
|
|
||||||
info_intern.h
|
info_intern.hh
|
||||||
textview.h
|
textview.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -21,8 +21,8 @@
|
|||||||
* \ingroup spinfo
|
* \ingroup spinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "UI_resources.h"
|
#include "UI_resources.h"
|
||||||
#include "UI_view2d.h"
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
#include "info_intern.h"
|
#include "info_intern.hh"
|
||||||
#include "textview.h"
|
#include "textview.h"
|
||||||
|
|
||||||
static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
|
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_fg[4],
|
||||||
uchar r_icon_bg[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. */
|
/* Same text color no matter what type of report. */
|
||||||
UI_GetThemeColor4ubv((report->flag & SELECT) ? TH_INFO_SELECTED_TEXT : TH_TEXT, fg);
|
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. */
|
/* This theme color is RGB only, so set alpha. */
|
||||||
r_icon_fg[3] = 255;
|
r_icon_fg[3] = 255;
|
||||||
UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg);
|
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! */
|
/* reports! */
|
||||||
static void report_textview_init__internal(TextViewContext *tvc)
|
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;
|
const char *str = report->message;
|
||||||
for (int i = tvc->iter_char_end - 1; i >= 0; i -= 1) {
|
for (int i = tvc->iter_char_end - 1; i >= 0; i -= 1) {
|
||||||
if (str[i] == '\n') {
|
if (str[i] == '\n') {
|
||||||
@@ -93,17 +94,17 @@ static void report_textview_init__internal(TextViewContext *tvc)
|
|||||||
|
|
||||||
static int report_textview_skip__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);
|
const int report_mask = info_report_mask(sinfo);
|
||||||
while (tvc->iter && (((const Report *)tvc->iter)->type & report_mask) == 0) {
|
while (tvc->iter && (((const Report *)tvc->iter)->type & report_mask) == 0) {
|
||||||
tvc->iter = (void *)((Link *)tvc->iter)->prev;
|
tvc->iter = (void *)((Link *)tvc->iter)->prev;
|
||||||
}
|
}
|
||||||
return (tvc->iter != NULL);
|
return (tvc->iter != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int report_textview_begin(TextViewContext *tvc)
|
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_start = 0;
|
||||||
tvc->sel_end = 0;
|
tvc->sel_end = 0;
|
||||||
@@ -116,7 +117,7 @@ static int report_textview_begin(TextViewContext *tvc)
|
|||||||
tvc->iter_tmp = 0;
|
tvc->iter_tmp = 0;
|
||||||
if (tvc->iter && report_textview_skip__internal(tvc)) {
|
if (tvc->iter && report_textview_skip__internal(tvc)) {
|
||||||
/* init the newline iterator */
|
/* init the newline iterator */
|
||||||
const Report *report = tvc->iter;
|
const Report *report = (const Report *)tvc->iter;
|
||||||
tvc->iter_char_end = report->len;
|
tvc->iter_char_end = report->len;
|
||||||
report_textview_init__internal(tvc);
|
report_textview_init__internal(tvc);
|
||||||
|
|
||||||
@@ -134,14 +135,14 @@ static void report_textview_end(TextViewContext *UNUSED(tvc))
|
|||||||
static int report_textview_step(TextViewContext *tvc)
|
static int report_textview_step(TextViewContext *tvc)
|
||||||
{
|
{
|
||||||
/* simple case, but no newline support */
|
/* simple case, but no newline support */
|
||||||
const Report *report = tvc->iter;
|
const Report *report = (const Report *)tvc->iter;
|
||||||
|
|
||||||
if (tvc->iter_char_begin <= 0) {
|
if (tvc->iter_char_begin <= 0) {
|
||||||
tvc->iter = (void *)((Link *)tvc->iter)->prev;
|
tvc->iter = (void *)((Link *)tvc->iter)->prev;
|
||||||
if (tvc->iter && report_textview_skip__internal(tvc)) {
|
if (tvc->iter && report_textview_skip__internal(tvc)) {
|
||||||
tvc->iter_tmp++;
|
tvc->iter_tmp++;
|
||||||
|
|
||||||
report = tvc->iter;
|
report = (const Report *)tvc->iter;
|
||||||
tvc->iter_char_end = report->len; /* reset start */
|
tvc->iter_char_end = report->len; /* reset start */
|
||||||
report_textview_init__internal(tvc);
|
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)
|
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_line = report->message + tvc->iter_char_begin;
|
||||||
*r_len = tvc->iter_char_end - 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.step = report_textview_step;
|
||||||
tvc.line_get = report_textview_line_get;
|
tvc.line_get = report_textview_line_get;
|
||||||
tvc.line_data = report_line_data;
|
tvc.line_data = report_line_data;
|
||||||
tvc.const_colors = NULL;
|
tvc.const_colors = nullptr;
|
||||||
|
|
||||||
tvc.arg1 = sinfo;
|
tvc.arg1 = sinfo;
|
||||||
tvc.arg2 = reports;
|
tvc.arg2 = reports;
|
||||||
@@ -225,21 +226,21 @@ void *info_text_pick(const SpaceInfo *sinfo,
|
|||||||
const ReportList *reports,
|
const ReportList *reports,
|
||||||
int mouse_y)
|
int mouse_y)
|
||||||
{
|
{
|
||||||
void *mval_pick_item = NULL;
|
void *mval_pick_item = nullptr;
|
||||||
const int mval[2] = {0, mouse_y};
|
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;
|
return (void *)mval_pick_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
int info_textview_height(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
|
int info_textview_height(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
|
||||||
{
|
{
|
||||||
const int mval[2] = {INT_MAX, INT_MAX};
|
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)
|
void info_textview_main(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
|
||||||
{
|
{
|
||||||
const int mval[2] = {INT_MAX, INT_MAX};
|
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);
|
||||||
}
|
}
|
@@ -21,8 +21,8 @@
|
|||||||
* \ingroup spinfo
|
* \ingroup spinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include "DNA_space_types.h"
|
#include "DNA_space_types.h"
|
||||||
#include "DNA_windowmanager_types.h"
|
#include "DNA_windowmanager_types.h"
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
#include "RNA_define.h"
|
#include "RNA_define.h"
|
||||||
|
|
||||||
#include "info_intern.h"
|
#include "info_intern.hh"
|
||||||
|
|
||||||
/********************* pack blend file libraries operator *********************/
|
/********************* pack blend file libraries operator *********************/
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
|
|||||||
Image *ima;
|
Image *ima;
|
||||||
|
|
||||||
/* First check for dirty images. */
|
/* 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)) {
|
if (BKE_image_is_dirty(ima)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ static const EnumPropertyItem unpack_all_method_items[] = {
|
|||||||
{PF_KEEP, "KEEP", 0, "Disable auto-pack, keep all packed files", ""},
|
{PF_KEEP, "KEEP", 0, "Disable auto-pack, keep all packed files", ""},
|
||||||
{PF_REMOVE, "REMOVE", 0, "Remove Pack", ""},
|
{PF_REMOVE, "REMOVE", 0, "Remove Pack", ""},
|
||||||
/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
|
/* {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)
|
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");
|
int method = RNA_enum_get(op->ptr, "method");
|
||||||
|
|
||||||
if (method != PF_KEEP) {
|
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;
|
G.fileflags &= ~G_FILE_AUTOPACK;
|
||||||
|
|
||||||
@@ -299,7 +300,7 @@ static const EnumPropertyItem unpack_item_method_items[] = {
|
|||||||
"Write file to original location (overwrite existing file)",
|
"Write file to original location (overwrite existing file)",
|
||||||
""},
|
""},
|
||||||
/* {PF_ASK, "ASK", 0, "Ask for each 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)
|
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);
|
RNA_string_get(op->ptr, "id_name", idname);
|
||||||
id = BKE_libblock_find_name(bmain, type, idname);
|
id = BKE_libblock_find_name(bmain, type, idname);
|
||||||
|
|
||||||
if (id == NULL) {
|
if (id == nullptr) {
|
||||||
BKE_report(op->reports, RPT_WARNING, "No packed file");
|
BKE_report(op->reports, RPT_WARNING, "No packed file");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method != PF_KEEP) {
|
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;
|
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);
|
layout = UI_popup_menu_layout(pup);
|
||||||
|
|
||||||
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
|
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);
|
UI_popup_menu_end(C, pup);
|
||||||
|
|
||||||
@@ -361,7 +364,7 @@ void FILE_OT_unpack_item(wmOperatorType *ot)
|
|||||||
RNA_def_enum(
|
RNA_def_enum(
|
||||||
ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack");
|
ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack");
|
||||||
RNA_def_string(
|
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,
|
RNA_def_int(ot->srna,
|
||||||
"id_type",
|
"id_type",
|
||||||
ID_IM,
|
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);
|
BKE_bpath_relative_convert(bmain, BKE_main_blendfile_path(bmain), op->reports);
|
||||||
|
|
||||||
/* redraw everything so any changed paths register */
|
/* redraw everything so any changed paths register */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, nullptr);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
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);
|
BKE_bpath_absolute_convert(bmain, BKE_main_blendfile_path(bmain), op->reports);
|
||||||
|
|
||||||
/* redraw everything so any changed paths register */
|
/* redraw everything so any changed paths register */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, nullptr);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
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)
|
static int find_missing_files_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
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");
|
const bool find_all = RNA_boolean_get(op->ptr, "find_all");
|
||||||
|
|
||||||
BKE_bpath_missing_files_find(bmain, searchpath, op->reports, 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;
|
int send_note = 0;
|
||||||
|
|
||||||
/* escape if not our timer */
|
/* escape if not our timer */
|
||||||
if ((reports->reporttimer == NULL) || (reports->reporttimer != event->customdata) ||
|
if ((reports->reporttimer == nullptr) || (reports->reporttimer != event->customdata) ||
|
||||||
((report = BKE_reports_last_displayable(reports)) == NULL)
|
((report = BKE_reports_last_displayable(reports)) == nullptr)
|
||||||
/* may have been deleted */
|
/* may have been deleted */
|
||||||
) {
|
) {
|
||||||
return OPERATOR_PASS_THROUGH;
|
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 */
|
/* clear the report display after timeout */
|
||||||
if ((float)reports->reporttimer->duration > timeout) {
|
if ((float)reports->reporttimer->duration > timeout) {
|
||||||
WM_event_remove_timer(wm, NULL, reports->reporttimer);
|
WM_event_remove_timer(wm, nullptr, reports->reporttimer);
|
||||||
reports->reporttimer = NULL;
|
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);
|
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) {
|
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);
|
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
|
@@ -18,9 +18,9 @@
|
|||||||
* \ingroup spinfo
|
* \ingroup spinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
@@ -39,13 +39,13 @@
|
|||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
#include "RNA_define.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)
|
static void reports_select_all(ReportList *reports, int report_mask, int action)
|
||||||
{
|
{
|
||||||
if (action == SEL_TOGGLE) {
|
if (action == SEL_TOGGLE) {
|
||||||
action = SEL_SELECT;
|
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)) {
|
if ((report->type & report_mask) && (report->flag & SELECT)) {
|
||||||
action = SEL_DESELECT;
|
action = SEL_DESELECT;
|
||||||
break;
|
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) {
|
if (report->type & report_mask) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SEL_SELECT:
|
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) &&
|
if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL | RPT_PROPERTY_ALL) &&
|
||||||
(report->flag & SELECT)) {
|
(report->flag & SELECT)) {
|
||||||
console_history_add_str(sc, report->message, 0);
|
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));
|
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");
|
int report_index = RNA_int_get(op->ptr, "report_index");
|
||||||
bool extend = RNA_boolean_get(op->ptr, "extend");
|
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);
|
SpaceInfo *sinfo = CTX_wm_space_info(C);
|
||||||
ReportList *reports = CTX_wm_reports(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);
|
SpaceInfo *sinfo = CTX_wm_space_info(C);
|
||||||
ARegion *region = CTX_wm_region(C);
|
ARegion *region = CTX_wm_region(C);
|
||||||
ReportList *reports = CTX_wm_reports(C);
|
ReportList *reports = CTX_wm_reports(C);
|
||||||
Report *report;
|
Report *report = (Report *)info_text_pick(sinfo, region, reports, event->mval[1]);
|
||||||
|
|
||||||
report = info_text_pick(sinfo, region, reports, event->mval[1]);
|
|
||||||
|
|
||||||
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
|
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);
|
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);
|
const int select = (sel_op != SEL_OP_SUB);
|
||||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||||
LISTBASE_FOREACH (Report *, report, &reports->list) {
|
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_min = (Report *)info_text_pick(sinfo, region, reports, rect.ymax);
|
||||||
report_max = info_text_pick(sinfo, region, reports, rect.ymin);
|
report_max = (Report *)info_text_pick(sinfo, region, reports, rect.ymin);
|
||||||
|
|
||||||
/* get the first report if none found */
|
/* get the first report if none found */
|
||||||
if (report_min == NULL) {
|
if (report_min == nullptr) {
|
||||||
// printf("find_min\n");
|
// printf("find_min\n");
|
||||||
LISTBASE_FOREACH (Report *, report, &reports->list) {
|
LISTBASE_FOREACH (Report *, report, &reports->list) {
|
||||||
if (report->type & report_mask) {
|
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");
|
// 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) {
|
if (report->type & report_mask) {
|
||||||
report_max = report;
|
report_max = report;
|
||||||
break;
|
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;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +328,7 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
Report *report, *report_next;
|
Report *report, *report_next;
|
||||||
|
|
||||||
for (report = reports->list.first; report;) {
|
for (report = (Report *)reports->list.first; report;) {
|
||||||
|
|
||||||
report_next = report->next;
|
report_next = report->next;
|
||||||
|
|
||||||
@@ -376,7 +374,7 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
DynStr *buf_dyn = BLI_dynstr_new();
|
DynStr *buf_dyn = BLI_dynstr_new();
|
||||||
char *buf_str;
|
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)) {
|
if ((report->type & report_mask) && (report->flag & SELECT)) {
|
||||||
BLI_dynstr_append(buf_dyn, report->message);
|
BLI_dynstr_append(buf_dyn, report->message);
|
||||||
BLI_dynstr_append(buf_dyn, "\n");
|
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);
|
buf_str = BLI_dynstr_get_cstring(buf_dyn);
|
||||||
BLI_dynstr_free(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);
|
MEM_freeN(buf_str);
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
@@ -18,8 +18,8 @@
|
|||||||
* \ingroup spinfo
|
* \ingroup spinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
#define MAX_INFO_NUM_LEN 16
|
#define MAX_INFO_NUM_LEN 16
|
||||||
|
|
||||||
typedef struct SceneStats {
|
struct SceneStats {
|
||||||
uint64_t totvert, totvertsel, totvertsculpt;
|
uint64_t totvert, totvertsel, totvertsculpt;
|
||||||
uint64_t totedge, totedgesel;
|
uint64_t totedge, totedgesel;
|
||||||
uint64_t totface, totfacesel, totfacesculpt;
|
uint64_t totface, totfacesel, totfacesculpt;
|
||||||
@@ -78,9 +78,9 @@ typedef struct SceneStats {
|
|||||||
uint64_t totlamp, totlampsel;
|
uint64_t totlamp, totlampsel;
|
||||||
uint64_t tottri;
|
uint64_t tottri;
|
||||||
uint64_t totgplayer, totgpframe, totgpstroke, totgppoint;
|
uint64_t totgplayer, totgpframe, totgpstroke, totgppoint;
|
||||||
} SceneStats;
|
};
|
||||||
|
|
||||||
typedef struct SceneStatsFmt {
|
struct SceneStatsFmt {
|
||||||
/* Totals */
|
/* Totals */
|
||||||
char totvert[MAX_INFO_NUM_LEN], totvertsel[MAX_INFO_NUM_LEN], totvertsculpt[MAX_INFO_NUM_LEN];
|
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];
|
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 tottri[MAX_INFO_NUM_LEN];
|
||||||
char totgplayer[MAX_INFO_NUM_LEN], totgpframe[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];
|
char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN];
|
||||||
} SceneStatsFmt;
|
};
|
||||||
|
|
||||||
static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats)
|
static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats)
|
||||||
{
|
{
|
||||||
if (me_eval == NULL) {
|
if (me_eval == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int totvert, totedge, totface, totloop;
|
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;
|
const SubdivCCG *subdiv_ccg = me_eval->runtime.subdiv_ccg;
|
||||||
BKE_subdiv_ccg_topology_counters(subdiv_ccg, &totvert, &totedge, &totface, &totloop);
|
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_CURVE:
|
||||||
case OB_FONT: {
|
case OB_FONT: {
|
||||||
Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,10 +232,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
|||||||
}
|
}
|
||||||
else if (obedit->type == OB_ARMATURE) {
|
else if (obedit->type == OB_ARMATURE) {
|
||||||
/* Armature Edit */
|
/* Armature Edit */
|
||||||
bArmature *arm = obedit->data;
|
bArmature *arm = (bArmature *)obedit->data;
|
||||||
EditBone *ebo;
|
EditBone *ebo;
|
||||||
|
|
||||||
for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
|
for (ebo = (EditBone *)arm->edbo->first; ebo; ebo = ebo->next) {
|
||||||
stats->totbone++;
|
stats->totbone++;
|
||||||
|
|
||||||
if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
|
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 */
|
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { /* OB_FONT has no cu->editnurb */
|
||||||
/* Curve Edit */
|
/* Curve Edit */
|
||||||
Curve *cu = obedit->data;
|
Curve *cu = (Curve *)obedit->data;
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
BPoint *bp;
|
BPoint *bp;
|
||||||
int a;
|
int a;
|
||||||
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
|
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) {
|
if (nu->type == CU_BEZIER) {
|
||||||
bezt = nu->bezt;
|
bezt = nu->bezt;
|
||||||
a = nu->pntsu;
|
a = nu->pntsu;
|
||||||
@@ -304,10 +304,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
|||||||
}
|
}
|
||||||
else if (obedit->type == OB_MBALL) {
|
else if (obedit->type == OB_MBALL) {
|
||||||
/* MetaBall Edit */
|
/* MetaBall Edit */
|
||||||
MetaBall *mball = obedit->data;
|
MetaBall *mball = (MetaBall *)obedit->data;
|
||||||
MetaElem *ml;
|
MetaElem *ml;
|
||||||
|
|
||||||
for (ml = mball->editelems->first; ml; ml = ml->next) {
|
for (ml = (MetaElem *)mball->editelems->first; ml; ml = ml->next) {
|
||||||
stats->totvert++;
|
stats->totvert++;
|
||||||
if (ml->flag & SELECT) {
|
if (ml->flag & SELECT) {
|
||||||
stats->totvertsel++;
|
stats->totvertsel++;
|
||||||
@@ -316,7 +316,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
|||||||
}
|
}
|
||||||
else if (obedit->type == OB_LATTICE) {
|
else if (obedit->type == OB_LATTICE) {
|
||||||
/* Lattice Edit */
|
/* Lattice Edit */
|
||||||
Lattice *lt = obedit->data;
|
Lattice *lt = (Lattice *)obedit->data;
|
||||||
Lattice *editlatt = lt->editlatt->latt;
|
Lattice *editlatt = lt->editlatt->latt;
|
||||||
BPoint *bp;
|
BPoint *bp;
|
||||||
int a;
|
int a;
|
||||||
@@ -337,10 +337,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
|||||||
static void stats_object_pose(Object *ob, SceneStats *stats)
|
static void stats_object_pose(Object *ob, SceneStats *stats)
|
||||||
{
|
{
|
||||||
if (ob->pose) {
|
if (ob->pose) {
|
||||||
bArmature *arm = ob->data;
|
bArmature *arm = (bArmature *)ob->data;
|
||||||
bPoseChannel *pchan;
|
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++;
|
stats->totbone++;
|
||||||
if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
|
if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
|
||||||
if (pchan->bone->layer & arm->layer) {
|
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)
|
static bool stats_is_object_dynamic_topology_sculpt(Object *ob)
|
||||||
{
|
{
|
||||||
if (ob == NULL) {
|
if (ob == nullptr) {
|
||||||
return false;
|
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);
|
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);
|
stats_object(ob_iter, &stats, objects_gset);
|
||||||
}
|
}
|
||||||
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
|
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)) {
|
if (ob && (ob->mode & OB_MODE_SCULPT)) {
|
||||||
@@ -430,7 +430,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!view_layer->stats) {
|
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;
|
*(view_layer->stats) = stats;
|
||||||
@@ -440,7 +440,7 @@ void ED_info_stats_clear(ViewLayer *view_layer)
|
|||||||
{
|
{
|
||||||
if (view_layer->stats) {
|
if (view_layer->stats) {
|
||||||
MEM_freeN(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. */
|
/* Create stats if they don't already exist. */
|
||||||
if (!view_layer->stats) {
|
if (!view_layer->stats) {
|
||||||
/* Do not not access dependency graph if interface is marked as locked. */
|
/* 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) {
|
if (wm->is_interface_locked) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ static void get_stats_string(
|
|||||||
{
|
{
|
||||||
Object *ob = OBACT(view_layer);
|
Object *ob = OBACT(view_layer);
|
||||||
Object *obedit = OBEDIT_FROM_OBACT(ob);
|
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;
|
LayerCollection *layer_collection = view_layer->active_collection;
|
||||||
|
|
||||||
if (object_mode == OB_MODE_OBJECT) {
|
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 char *ED_info_statistics_string(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
||||||
{
|
{
|
||||||
const eUserpref_StatusBar_Flag statistics_status_bar_flag = STATUSBAR_SHOW_STATS |
|
const eUserpref_StatusBar_Flag statistics_status_bar_flag = (eUserpref_StatusBar_Flag)(
|
||||||
STATUSBAR_SHOW_MEMORY |
|
STATUSBAR_SHOW_STATS | STATUSBAR_SHOW_MEMORY | STATUSBAR_SHOW_VERSION);
|
||||||
STATUSBAR_SHOW_VERSION;
|
|
||||||
|
|
||||||
return info_statusbar_string(bmain, scene, view_layer, statistics_status_bar_flag);
|
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 *ob = OBACT(view_layer);
|
||||||
Object *obedit = OBEDIT_FROM_OBACT(ob);
|
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();
|
const int font_id = BLF_default();
|
||||||
|
|
||||||
UI_FontThemeColor(font_id, TH_TEXT_HI);
|
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[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[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[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) {
|
else if (obedit->type == OB_ARMATURE) {
|
||||||
stats_row(col1, labels[JOINTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height);
|
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);
|
stats_row(col1, labels[BONES], col2, stats_fmt.totbonesel, stats_fmt.totbone, y, height);
|
||||||
}
|
}
|
||||||
else if ((ob) && (ob->type == OB_GPENCIL)) {
|
else if ((ob) && (ob->type == OB_GPENCIL)) {
|
||||||
stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, NULL, y, height);
|
stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, nullptr, y, height);
|
||||||
stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, NULL, y, height);
|
stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, nullptr, y, height);
|
||||||
stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, NULL, y, height);
|
stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, nullptr, y, height);
|
||||||
stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, NULL, y, height);
|
stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, nullptr, y, height);
|
||||||
}
|
}
|
||||||
else if (ob && (object_mode & OB_MODE_SCULPT)) {
|
else if (ob && (object_mode & OB_MODE_SCULPT)) {
|
||||||
if (stats_is_object_dynamic_topology_sculpt(ob)) {
|
if (stats_is_object_dynamic_topology_sculpt(ob)) {
|
||||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, NULL, y, height);
|
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, nullptr, 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 {
|
else {
|
||||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, stats_fmt.totvert, y, height);
|
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, stats_fmt.totvert, y, height);
|
||||||
@@ -781,10 +780,10 @@ void ED_info_draw_stats(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, NULL, y, height);
|
stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, nullptr, y, height);
|
||||||
stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, NULL, y, height);
|
stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, nullptr, y, height);
|
||||||
stats_row(col1, labels[FACES], col2, stats_fmt.totface, NULL, y, height);
|
stats_row(col1, labels[FACES], col2, stats_fmt.totface, nullptr, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLF_disable(font_id, BLF_SHADOW);
|
BLF_disable(font_id, BLF_SHADOW);
|
@@ -21,8 +21,8 @@
|
|||||||
* \ingroup spinfo
|
* \ingroup spinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
#include "UI_resources.h"
|
#include "UI_resources.h"
|
||||||
#include "UI_view2d.h"
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
#include "info_intern.h" /* own include */
|
#include "info_intern.hh" /* own include */
|
||||||
|
|
||||||
/* ******************** default callbacks for info space ***************** */
|
/* ******************** default callbacks for info space ***************** */
|
||||||
|
|
||||||
@@ -53,20 +53,20 @@ static SpaceLink *info_create(const ScrArea *UNUSED(area), const Scene *UNUSED(s
|
|||||||
ARegion *region;
|
ARegion *region;
|
||||||
SpaceInfo *sinfo;
|
SpaceInfo *sinfo;
|
||||||
|
|
||||||
sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo");
|
sinfo = (SpaceInfo *)MEM_callocN(sizeof(SpaceInfo), "initinfo");
|
||||||
sinfo->spacetype = SPACE_INFO;
|
sinfo->spacetype = SPACE_INFO;
|
||||||
|
|
||||||
sinfo->rpt_mask = INFO_RPT_OP;
|
sinfo->rpt_mask = INFO_RPT_OP;
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
region = MEM_callocN(sizeof(ARegion), "header for info");
|
region = (ARegion *)MEM_callocN(sizeof(ARegion), "header for info");
|
||||||
|
|
||||||
BLI_addtail(&sinfo->regionbase, region);
|
BLI_addtail(&sinfo->regionbase, region);
|
||||||
region->regiontype = RGN_TYPE_HEADER;
|
region->regiontype = RGN_TYPE_HEADER;
|
||||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||||
|
|
||||||
/* main region */
|
/* 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);
|
BLI_addtail(&sinfo->regionbase, region);
|
||||||
region->regiontype = RGN_TYPE_WINDOW;
|
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)
|
static SpaceLink *info_duplicate(SpaceLink *sl)
|
||||||
{
|
{
|
||||||
SpaceInfo *sinfon = MEM_dupallocN(sl);
|
SpaceInfo *sinfon = (SpaceInfo *)MEM_dupallocN(sl);
|
||||||
|
|
||||||
/* clear or remove stuff from old */
|
/* 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);
|
UI_view2d_view_restore(C);
|
||||||
|
|
||||||
/* scrollers */
|
/* 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_autopack_toggle);
|
||||||
WM_operatortype_append(FILE_OT_pack_all);
|
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 */
|
/* only called once, from space/spacetypes.c */
|
||||||
void ED_spacetype_info(void)
|
void ED_spacetype_info(void)
|
||||||
{
|
{
|
||||||
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info");
|
SpaceType *st = (SpaceType *)MEM_callocN(sizeof(SpaceType), "spacetype info");
|
||||||
ARegionType *art;
|
ARegionType *art;
|
||||||
|
|
||||||
st->spaceid = SPACE_INFO;
|
st->spaceid = SPACE_INFO;
|
||||||
@@ -282,7 +282,7 @@ void ED_spacetype_info(void)
|
|||||||
st->keymap = info_keymap;
|
st->keymap = info_keymap;
|
||||||
|
|
||||||
/* regions: main window */
|
/* 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->regionid = RGN_TYPE_WINDOW;
|
||||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
|
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);
|
BLI_addhead(&st->regiontypes, art);
|
||||||
|
|
||||||
/* regions: header */
|
/* 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->regionid = RGN_TYPE_HEADER;
|
||||||
art->prefsizey = HEADERY;
|
art->prefsizey = HEADERY;
|
||||||
|
|
@@ -42,7 +42,7 @@ static void textview_font_begin(const int font_id, const int lheight)
|
|||||||
BLF_size(font_id, 0.8f * lheight, 72);
|
BLF_size(font_id, 0.8f * lheight, 72);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct TextViewDrawState {
|
struct TextViewDrawState {
|
||||||
int font_id;
|
int font_id;
|
||||||
int cwidth;
|
int cwidth;
|
||||||
int lheight;
|
int lheight;
|
||||||
@@ -62,7 +62,7 @@ typedef struct TextViewDrawState {
|
|||||||
int *mval_pick_offset;
|
int *mval_pick_offset;
|
||||||
const int *mval; // [2]
|
const int *mval; // [2]
|
||||||
bool do_draw;
|
bool do_draw;
|
||||||
} TextViewDrawState;
|
};
|
||||||
|
|
||||||
BLI_INLINE void textview_step_sel(TextViewDrawState *tds, const int step)
|
BLI_INLINE void textview_step_sel(TextViewDrawState *tds, const int step)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ static int textview_wrap_offsets(
|
|||||||
|
|
||||||
*r_lines = 1;
|
*r_lines = 1;
|
||||||
|
|
||||||
*r_offsets = MEM_callocN(
|
*r_offsets = (int *)MEM_callocN(
|
||||||
sizeof(**r_offsets) *
|
sizeof(**r_offsets) *
|
||||||
(len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1),
|
(len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1),
|
||||||
__func__);
|
__func__);
|
||||||
@@ -225,16 +225,13 @@ static bool textview_draw_string(TextViewDrawState *tds,
|
|||||||
|
|
||||||
rgba_uchar_to_float(col, icon_bg);
|
rgba_uchar_to_float(col, icon_bg);
|
||||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||||
UI_draw_roundbox_4fv(
|
const rctf rect{
|
||||||
&(const rctf){
|
hpadding,
|
||||||
.xmin = hpadding,
|
bg_size + hpadding,
|
||||||
.xmax = bg_size + hpadding,
|
line_top - bg_size - vpadding,
|
||||||
.ymin = line_top - bg_size - vpadding,
|
line_top - vpadding,
|
||||||
.ymax = line_top - vpadding,
|
};
|
||||||
},
|
UI_draw_roundbox_4fv(&rect, true, 4 * UI_DPI_FAC, col);
|
||||||
true,
|
|
||||||
4 * UI_DPI_FAC,
|
|
||||||
col);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon) {
|
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,
|
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;
|
*r_mval_pick_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,11 +396,11 @@ int textview_draw(TextViewContext *tvc,
|
|||||||
&tds,
|
&tds,
|
||||||
ext_line,
|
ext_line,
|
||||||
ext_len,
|
ext_len,
|
||||||
(data_flag & TVC_LINE_FG) ? fg : NULL,
|
(data_flag & TVC_LINE_FG) ? fg : nullptr,
|
||||||
(data_flag & TVC_LINE_BG) ? bg : NULL,
|
(data_flag & TVC_LINE_BG) ? bg : nullptr,
|
||||||
(data_flag & TVC_LINE_ICON) ? icon : 0,
|
(data_flag & TVC_LINE_ICON) ? icon : 0,
|
||||||
(data_flag & TVC_LINE_ICON_FG) ? icon_fg : NULL,
|
(data_flag & TVC_LINE_ICON_FG) ? icon_fg : nullptr,
|
||||||
(data_flag & TVC_LINE_ICON_BG) ? icon_bg : NULL,
|
(data_flag & TVC_LINE_ICON_BG) ? icon_bg : nullptr,
|
||||||
bg_sel);
|
bg_sel);
|
||||||
|
|
||||||
if (do_draw) {
|
if (do_draw) {
|
@@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum eTextViewContext_LineFlag {
|
enum eTextViewContext_LineFlag {
|
||||||
TVC_LINE_FG = (1 << 0),
|
TVC_LINE_FG = (1 << 0),
|
||||||
TVC_LINE_BG = (1 << 1),
|
TVC_LINE_BG = (1 << 1),
|
||||||
@@ -78,3 +82,7 @@ int textview_draw(struct TextViewContext *tvc,
|
|||||||
const int mval_init[2],
|
const int mval_init[2],
|
||||||
void **r_mval_pick_item,
|
void **r_mval_pick_item,
|
||||||
int *r_mval_pick_offset);
|
int *r_mval_pick_offset);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -260,16 +260,10 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id);
|
|||||||
/* Anonymous variants (for convenience) */
|
/* Anonymous variants (for convenience) */
|
||||||
#define WM_msg_subscribe_rna_anon_type(mbus, type_, value) \
|
#define WM_msg_subscribe_rna_anon_type(mbus, type_, value) \
|
||||||
{ \
|
{ \
|
||||||
WM_msg_subscribe_rna_params(mbus, \
|
wmMsgParams_RNA msg_params = {0}; \
|
||||||
&(const wmMsgParams_RNA){ \
|
msg_params.ptr.type = &RNA_##type_; \
|
||||||
.ptr = \
|
msg_params.prop = NULL; \
|
||||||
(PointerRNA){ \
|
WM_msg_subscribe_rna_params(mbus, &msg_params, value, __func__); \
|
||||||
.type = &RNA_##type_, \
|
|
||||||
}, \
|
|
||||||
.prop = NULL, \
|
|
||||||
}, \
|
|
||||||
value, \
|
|
||||||
__func__); \
|
|
||||||
} \
|
} \
|
||||||
((void)0)
|
((void)0)
|
||||||
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value) \
|
#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; \
|
_WM_MESSAGE_EXTERN_BEGIN; \
|
||||||
extern PropertyRNA rna_##type_##_##prop_; \
|
extern PropertyRNA rna_##type_##_##prop_; \
|
||||||
_WM_MESSAGE_EXTERN_END; \
|
_WM_MESSAGE_EXTERN_END; \
|
||||||
WM_msg_subscribe_rna_params(mbus, \
|
wmMsgParams_RNA msg_params = {0}; \
|
||||||
&(const wmMsgParams_RNA){ \
|
msg_params.ptr.type = &RNA_##type_; \
|
||||||
.ptr = \
|
msg_params.prop = &rna_##type_##_##prop_; \
|
||||||
(PointerRNA){ \
|
WM_msg_subscribe_rna_params(mbus, &msg_params, value, __func__); \
|
||||||
.type = &RNA_##type_, \
|
|
||||||
}, \
|
|
||||||
.prop = &rna_##type_##_##prop_, \
|
|
||||||
}, \
|
|
||||||
value, \
|
|
||||||
__func__); \
|
|
||||||
} \
|
} \
|
||||||
((void)0)
|
((void)0)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user