Refactor: Logging: Move G.quiet to CLOG, replace some printfs

* Replace G.quiet by CLG_quiet_set/get
* CLOG_INFO_NOCHECK prints are now suppressed when quiet, these were
  typically inside a if (!G.quiet) conditional already.
* Change some prints for blend files, color management and rendering to
  use CLOG, that were previously using if (!G.quiet) printf().

Pull Request: https://projects.blender.org/blender/blender/pulls/143138
This commit is contained in:
Brecht Van Lommel
2025-07-28 13:36:13 +02:00
committed by Brecht Van Lommel
parent b1d5c35f3a
commit fa007002b1
15 changed files with 121 additions and 139 deletions

View File

@@ -135,6 +135,13 @@ void CLG_logref_init(CLG_LogRef *clg_ref);
int CLG_color_support_get(CLG_LogRef *clg_ref);
/* When true, quiet any NOCHECK logs that would otherwise be printed regardless of log filters
* and levels. This is used so command line tools can control output without unnecessary noise.
*
* Note this does not silence log filters and levels that have been explicitly enabled. */
void CLG_quiet_set(bool quiet);
bool CLG_quiet_get();
/** Declare outside function, declare as extern in header. */
#define CLG_LOGREF_DECLARE_GLOBAL(var, id) \
static CLG_LogRef _static_##var = {id}; \
@@ -159,7 +166,9 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_AT_LEVEL_NOCHECK(clg_ref, verbose_level, ...) \
{ \
const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
CLG_logf(_lg_ty, verbose_level, __FILE__ ":" STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
if (!CLG_quiet_get() || _lg_ty->level >= verbose_level) { \
CLG_logf(_lg_ty, verbose_level, __FILE__ ":" STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
} \
} \
((void)0)
@@ -175,10 +184,13 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_STR_AT_LEVEL_NOCHECK(clg_ref, verbose_level, str) \
{ \
const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
CLG_log_str(_lg_ty, verbose_level, __FILE__ ":" STRINGIFY(__LINE__), __func__, str); \
if (!CLG_quiet_get() || _lg_ty->level >= verbose_level) { \
CLG_log_str(_lg_ty, verbose_level, __FILE__ ":" STRINGIFY(__LINE__), __func__, str); \
} \
} \
((void)0)
/* Log with format string. */
#define CLOG_FATAL(clg_ref, ...) CLOG_AT_LEVEL(clg_ref, CLG_LEVEL_FATAL, __VA_ARGS__)
#define CLOG_ERROR(clg_ref, ...) CLOG_AT_LEVEL(clg_ref, CLG_LEVEL_ERROR, __VA_ARGS__)
#define CLOG_WARN(clg_ref, ...) CLOG_AT_LEVEL(clg_ref, CLG_LEVEL_WARN, __VA_ARGS__)
@@ -186,6 +198,7 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_DEBUG(clg_ref, ...) CLOG_AT_LEVEL(clg_ref, CLG_LEVEL_DEBUG, __VA_ARGS__)
#define CLOG_TRACE(clg_ref, ...) CLOG_AT_LEVEL(clg_ref, CLG_LEVEL_TRACE, __VA_ARGS__)
/* Log single string. */
#define CLOG_STR_FATAL(clg_ref, str) CLOG_STR_AT_LEVEL(clg_ref, CLG_LEVEL_FATAL, str)
#define CLOG_STR_ERROR(clg_ref, str) CLOG_STR_AT_LEVEL(clg_ref, CLG_LEVEL_ERROR, str)
#define CLOG_STR_WARN(clg_ref, str) CLOG_STR_AT_LEVEL(clg_ref, CLG_LEVEL_WARN, str)
@@ -193,6 +206,8 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_STR_DEBUG(clg_ref, str) CLOG_STR_AT_LEVEL(clg_ref, CLG_LEVEL_DEBUG, str)
#define CLOG_STR_TRACE(clg_ref, str) CLOG_STR_AT_LEVEL(clg_ref, CLG_LEVEL_TRACE, str)
/* Log regardless of filters and levels, for a few important messages like blend save and load.
* Only #CLG_quiet_set will silence these. */
#define CLOG_INFO_NOCHECK(clg_ref, format, ...) \
CLOG_AT_LEVEL_NOCHECK(clg_ref, CLG_LEVEL_INFO, format, __VA_ARGS__)
#define CLOG_STR_INFO_NOCHECK(clg_ref, str) CLOG_STR_AT_LEVEL_NOCHECK(clg_ref, CLG_LEVEL_INFO, str)

View File

@@ -856,6 +856,8 @@ static void CLG_ctx_free(CLogContext *ctx)
/* We could support multiple at once, for now this seems not needed. */
static struct CLogContext *g_ctx = nullptr;
/* Separate to preserve this after freeing context. */
static bool g_quiet = false;
void CLG_init()
{
@@ -924,6 +926,16 @@ void CLG_level_set(CLG_Level level)
CLG_ctx_level_set(g_ctx, level);
}
void CLG_quiet_set(bool quiet)
{
g_quiet = quiet;
}
bool CLG_quiet_get()
{
return g_quiet;
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -70,14 +70,6 @@ struct Global {
*/
bool background;
/**
* When true, suppress any non-error print messages such as files saves, loaded, quitting etc.
* This is used so command line tools can control output without unnecessary noise.
*
* \note This should only be used to suppress printing (not reports or other kinds of logging).
*/
bool quiet;
/**
* Skip reading the startup file and user preferences.
* Also disable saving the preferences on exit (see #G_FLAG_USERPREF_NO_SAVE_ON_EXIT),

View File

@@ -1355,9 +1355,7 @@ BlendFileData *BKE_blendfile_read(const char *filepath,
{
/* Don't print startup file loading. */
if (params->is_startup == false) {
if (!G.quiet) {
CLOG_INFO_NOCHECK(&LOG_BLEND, "Read blend: \"%s\"", filepath);
}
CLOG_INFO_NOCHECK(&LOG_BLEND, "Read blend: \"%s\"", filepath);
}
BlendFileData *bfd = BLO_read_from_file(filepath, eBLOReadSkip(params->skip_flags), reports);
@@ -1636,9 +1634,7 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
if (cfgdir) {
bool ok_write;
BLI_path_join(filepath, sizeof(filepath), cfgdir->c_str(), BLENDER_USERPREF_FILE);
if (!G.quiet) {
printf("Writing userprefs: \"%s\" ", filepath);
}
CLOG_INFO_NOCHECK(&LOG_BLEND, "Writing user preferences: \"%s\" ", filepath);
if (use_template_userpref) {
ok_write = BKE_blendfile_userdef_write_app_template(filepath, reports);
}
@@ -1647,15 +1643,10 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
}
if (ok_write) {
if (!G.quiet) {
printf("ok\n");
}
BKE_report(reports, RPT_INFO, "Preferences saved");
}
else {
if (!G.quiet) {
printf("fail\n");
}
CLOG_WARN(&LOG_BLEND, "Failed to write user preferences");
ok = false;
BKE_report(reports, RPT_ERROR, "Saving preferences failed");
}
@@ -1670,18 +1661,11 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
/* Also save app-template preferences. */
BLI_path_join(filepath, sizeof(filepath), cfgdir->c_str(), BLENDER_USERPREF_FILE);
if (!G.quiet) {
printf("Writing userprefs app-template: \"%s\" ", filepath);
}
CLOG_INFO_NOCHECK(&LOG_BLEND, "Writing user preferences app-template: \"%s\" ", filepath);
if (BKE_blendfile_userdef_write(filepath, reports) != 0) {
if (!G.quiet) {
printf("ok\n");
}
}
else {
if (!G.quiet) {
printf("fail\n");
}
CLOG_WARN(&LOG_BLEND, "Failed to write user preferences");
ok = false;
}
}

View File

@@ -1042,9 +1042,7 @@ static void image_render_print_save_message(ReportList *reports,
{
if (ok) {
/* no need to report, just some helpful console info */
if (!G.quiet) {
CLOG_INFO(&LOG_RENDER, "Saved: '%s'", filepath);
}
CLOG_INFO_NOCHECK(&LOG_RENDER, "Saved: '%s'", filepath);
}
else {
/* report on error since users will want to know what failed */

View File

@@ -77,6 +77,7 @@ set(LIB
PRIVATE bf::gpu
bf_imbuf_openimageio
PRIVATE bf::intern::atomic
PRIVATE bf::intern::clog
PRIVATE bf::intern::guardedalloc
bf_intern_memutil
PRIVATE bf::imbuf::opencolorio

View File

@@ -54,8 +54,12 @@
#include "SEQ_iterator.hh"
#include "CLG_log.h"
#include "OCIO_api.hh"
static CLG_LogRef LOG = {"image.color_management"};
using blender::float3;
using blender::float3x3;
using blender::StringRefNull;
@@ -492,8 +496,8 @@ static bool colormanage_role_color_space_name_get(ocio::Config &config,
}
if (ociocs == nullptr) {
if (!optional && !G.quiet) {
printf("Color management: Error, could not find role \"%s\"\n", role);
if (!optional) {
CLOG_ERROR(&LOG, "Could not find role \"%s\"", role);
}
colorspace_name[0] = '\0';
return false;
@@ -527,16 +531,12 @@ static bool colormanage_load_config(ocio::Config &config)
config, global_role_aces_interchange, OCIO_ROLE_ACES_INTERCHANGE, nullptr, true);
if (g_config->get_num_displays() == 0) {
if (!G.quiet) {
printf("Color management: Error, could not find any displays\n");
}
CLOG_ERROR(&LOG, "Could not find any displays");
ok = false;
}
/* NOTE: The look "None" is expected to be hard-coded to exist in the OpenColorIO integration. */
if (g_config->get_num_looks() == 0) {
if (!G.quiet) {
printf("Color management: Error, could not find any looks\n");
}
CLOG_ERROR(&LOG, "Could not find any looks");
ok = false;
}
@@ -544,10 +544,7 @@ static bool colormanage_load_config(ocio::Config &config)
const ocio::Display *display = g_config->get_display_by_index(display_index);
const int num_views = display->get_num_views();
if (num_views <= 0) {
if (!G.quiet) {
printf("Color management: Error, could not find any views for display %s\n",
display->name().c_str());
}
CLOG_ERROR(&LOG, "Could not find any views for display %s", display->name().c_str());
ok = false;
break;
}
@@ -588,15 +585,11 @@ void colormanagement_init()
if (ocio_env && ocio_env[0] != '\0') {
g_config = ocio::Config::create_from_environment();
if (g_config != nullptr) {
if (!G.quiet) {
printf("Color management: Using %s as a configuration file\n", ocio_env);
}
CLOG_INFO_NOCHECK(&LOG, "Using %s as a configuration file", ocio_env);
const bool ok = colormanage_load_config(*g_config);
if (!ok) {
if (!G.quiet) {
printf("Color management: Failed to load config from environment\n");
}
CLOG_ERROR(&LOG, "Failed to load config from environment");
colormanage_free_config();
}
}
@@ -616,9 +609,7 @@ void colormanagement_init()
const bool ok = colormanage_load_config(*g_config);
if (!ok) {
if (!G.quiet) {
printf("Color management: Failed to load bundled config\n");
}
CLOG_ERROR(&LOG, "Failed to load bundled config");
colormanage_free_config();
}
}
@@ -627,9 +618,7 @@ void colormanagement_init()
/* Then use fallback. */
if (g_config == nullptr) {
if (!G.quiet) {
printf("Color management: Using fallback mode for management\n");
}
CLOG_STR_INFO_NOCHECK(&LOG, "Using fallback mode for management");
g_config = ocio::Config::create_fallback();
colormanage_load_config(*g_config);
}
@@ -878,14 +867,11 @@ static void colormanage_check_display_settings(ColorManagedDisplaySettings *disp
const ocio::Display *display = g_config->get_display_by_name(display_settings->display_device);
if (!display) {
if (!G.quiet) {
printf(
"Color management: display \"%s\" used by %s not found, setting to default "
"(\"%s\").\n",
display_settings->display_device,
what,
default_display->name().c_str());
}
CLOG_WARN(&LOG,
"Display \"%s\" used by %s not found, setting to default (\"%s\").",
display_settings->display_device,
what,
default_display->name().c_str());
STRNCPY_UTF8(display_settings->display_device, default_display->name().c_str());
}
@@ -913,12 +899,11 @@ static void colormanage_check_view_settings(ColorManagedDisplaySettings *display
if (!view) {
const ocio::View *default_view = display->get_default_view();
if (default_view) {
if (!G.quiet) {
printf("Color management: %s view \"%s\" not found, setting default \"%s\".\n",
what,
view_settings->view_transform,
default_view->name().c_str());
}
CLOG_WARN(&LOG,
"%s view \"%s\" not found, setting default \"%s\".",
what,
view_settings->view_transform,
default_view->name().c_str());
STRNCPY_UTF8(view_settings->view_transform, default_view->name().c_str());
}
}
@@ -930,26 +915,23 @@ static void colormanage_check_view_settings(ColorManagedDisplaySettings *display
else {
const ocio::Look *look = g_config->get_look_by_name(view_settings->look);
if (look == nullptr) {
if (!G.quiet) {
printf("Color management: %s look \"%s\" not found, setting default \"%s\".\n",
what,
view_settings->look,
default_look_name);
}
CLOG_WARN(&LOG,
"%s look \"%s\" not found, setting default \"%s\".",
what,
view_settings->look,
default_look_name);
STRNCPY_UTF8(view_settings->look, default_look_name);
}
else if (!colormanage_compatible_look(look, view_settings->view_transform)) {
if (!G.quiet) {
printf(
"Color management: %s look \"%s\" is not compatible with view \"%s\", setting "
"default "
"\"%s\".\n",
what,
view_settings->look,
view_settings->view_transform,
default_look_name);
}
CLOG_INFO(&LOG,
"%s look \"%s\" is not compatible with view \"%s\", setting "
"default "
"\"%s\".",
what,
view_settings->look,
view_settings->view_transform,
default_look_name);
STRNCPY_UTF8(view_settings->look, default_look_name);
}
@@ -972,11 +954,10 @@ static void colormanage_check_colorspace_settings(
const ColorSpace *colorspace = g_config->get_color_space(colorspace_settings->name);
if (!colorspace) {
if (!G.quiet) {
printf("Color management: %s colorspace \"%s\" not found, will use default instead.\n",
what,
colorspace_settings->name);
}
CLOG_WARN(&LOG,
"%s colorspace \"%s\" not found, will use default instead.\n",
what,
colorspace_settings->name);
STRNCPY_UTF8(colorspace_settings->name, "");
}
@@ -1073,9 +1054,7 @@ const char *IMB_colormanagement_role_colorspace_name_get(int role)
case COLOR_ROLE_ACES_INTERCHANGE:
return global_role_aces_interchange;
default:
if (!G.quiet) {
printf("Unknown role was passed to %s\n", __func__);
}
CLOG_WARN(&LOG, "Unknown role was passed to %s", __func__);
BLI_assert(0);
break;
}

View File

@@ -39,9 +39,10 @@
#include "MEM_guardedalloc.h"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_report.hh"
#include "CLG_log.h"
/* so operators called can spawn threads which acquire the GIL */
#define BPY_RELEASE_GIL
@@ -257,7 +258,7 @@ static PyObject *pyop_call(PyObject * /*self*/, PyObject *args)
if (!BLI_listbase_is_empty(&reports->list)) {
/* Restore the print level as this is owned by the operator now. */
eReportType level = eReportType(reports->printlevel);
BKE_report_print_level_set(reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(reports, nullptr);
BKE_report_print_level_set(reports, level);
}

View File

@@ -10172,7 +10172,7 @@ static PyObject *pyrna_register_class(PyObject * /*self*/, PyObject *py_class)
if (!BLI_listbase_is_empty(&reports.list)) {
const bool has_error = (BPy_reports_to_error(&reports, PyExc_RuntimeError, false) == -1);
if (!has_error) {
BKE_report_print_level_set(&reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(&reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(&reports, error_prefix);
}
if (has_error) {

View File

@@ -50,6 +50,8 @@
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"
#include "CLG_log.h"
/* for keyframes and drivers */
static int pyrna_struct_anim_args_parse_ex(PointerRNA *ptr,
const char *error_prefix,
@@ -436,7 +438,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_free(&reports);
return nullptr;
}
BKE_report_print_level_set(&reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(&reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(&reports, nullptr);
BKE_reports_free(&reports);

View File

@@ -206,7 +206,8 @@ static void stats_background(void * /*arg*/, RenderStats *rs)
static blender::Mutex mutex;
std::scoped_lock lock(mutex);
if (!G.quiet) {
const bool show_info = CLOG_CHECK(&LOG, CLG_LEVEL_INFO);
if (show_info) {
CLOG_STR_INFO(&LOG, rs->infostr);
/* Flush stdout to be sure python callbacks are printing stuff after blender. */
fflush(stdout);
@@ -216,7 +217,7 @@ static void stats_background(void * /*arg*/, RenderStats *rs)
* Not sure it's actually even used anyway, we could as well pass nullptr? */
BKE_callback_exec_string(G_MAIN, BKE_CB_EVT_RENDER_STATS, rs->infostr);
if (!G.quiet) {
if (show_info) {
fflush(stdout);
}
}
@@ -2234,9 +2235,7 @@ bool RE_WriteRenderViewsMovie(ReportList *reports,
/* imbuf knows which rects are not part of ibuf */
IMB_freeImBuf(ibuf);
}
if (!G.quiet) {
printf("Append frame %d\n", scene->r.cfra);
}
CLOG_INFO(&LOG, "Video append frame %d", scene->r.cfra);
}
else { /* R_IMF_VIEWS_STEREO_3D */
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
@@ -2354,7 +2353,8 @@ static bool do_write_image_or_movie(
message = fmt::format("{} (Saving: {})", message, filepath);
}
if (!G.quiet) {
const bool show_info = CLOG_CHECK(&LOG, CLG_LEVEL_INFO);
if (show_info) {
CLOG_STR_INFO(&LOG, message.c_str());
/* Flush stdout to be sure python callbacks are printing stuff after blender. */
fflush(stdout);
@@ -2364,7 +2364,7 @@ static bool do_write_image_or_movie(
* Not sure it's actually even used anyway, we could as well pass nullptr? */
render_callback_exec_string(re, G_MAIN, BKE_CB_EVT_RENDER_STATS, message.c_str());
if (!G.quiet) {
if (show_info) {
fflush(stdout);
}
@@ -2551,9 +2551,7 @@ void RE_RenderAnim(Render *re,
if (rd.mode & R_NO_OVERWRITE) {
if (!is_multiview_name) {
if (BLI_exists(filepath)) {
if (!G.quiet) {
printf("skipping existing frame \"%s\"\n", filepath);
}
CLOG_INFO(&LOG, "Skipping existing frame \"%s\"", filepath);
totskipped++;
continue;
}
@@ -2570,10 +2568,10 @@ void RE_RenderAnim(Render *re,
BKE_scene_multiview_filepath_get(srv, filepath, filepath_view);
if (BLI_exists(filepath_view)) {
is_skip = true;
if (!G.quiet) {
printf(
"skipping existing frame \"%s\" for view \"%s\"\n", filepath_view, srv->name);
}
CLOG_INFO(&LOG,
"Skipping existing frame \"%s\" for view \"%s\"",
filepath_view,
srv->name);
}
}

View File

@@ -1179,7 +1179,7 @@ static void wm_operator_reports(bContext *C,
if (caller_owns_reports == false) {
/* Print out reports to console.
* When quiet, only show warnings, suppressing info and other non-essential warnings. */
const eReportType level = G.quiet ? RPT_WARNING : RPT_DEBUG;
const eReportType level = CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG;
BKE_reports_log(op->reports, level, WM_LOG_OPERATORS);
}
@@ -4433,7 +4433,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
ScrArea *root_area = nullptr;
ARegion *root_region = nullptr;
if (!G.quiet) {
if (!CLG_quiet_get()) {
/* Perform some sanity checks.
*
* - Using the file-path sub-types is important because it's possible paths don't use
@@ -4454,7 +4454,10 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
if (!((RNA_property_type(prop) == PROP_STRING) &&
(RNA_property_subtype(prop) == PROP_FILEPATH)))
{
printf("%s: \"%s\" expected a string with a 'FILE_PATH' subtype.\n", prefix, prop_id);
CLOG_WARN(WM_LOG_OPERATORS,
"%s: \"%s\" expected a string with a 'FILE_PATH' subtype.",
prefix,
prop_id);
}
}
prop_id = "directory";
@@ -4463,7 +4466,10 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
if (!((RNA_property_type(prop) == PROP_STRING) &&
(RNA_property_subtype(prop) == PROP_DIRPATH)))
{
printf("%s: \"%s\" expected a string with a 'DIR_PATH' subtype.\n", prefix, prop_id);
CLOG_WARN(WM_LOG_OPERATORS,
"%s: \"%s\" expected a string with a 'DIR_PATH' subtype.",
prefix,
prop_id);
}
}
@@ -4473,7 +4479,10 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
if (!((RNA_property_type(prop) == PROP_STRING) &&
(RNA_property_subtype(prop) == PROP_FILENAME)))
{
printf("%s: \"%s\" expected a string with a 'FILE_NAME' subtype.\n", prefix, prop_id);
CLOG_WARN(WM_LOG_OPERATORS,
"%s: \"%s\" expected a string with a 'FILE_NAME' subtype.",
prefix,
prop_id);
}
}

View File

@@ -2527,9 +2527,7 @@ static wmOperatorStatus wm_homefile_write_exec(bContext *C, wmOperator *op)
BLI_path_join(filepath, sizeof(filepath), cfgdir->c_str(), BLENDER_STARTUP_FILE);
if (!G.quiet) {
printf("Writing homefile: \"%s\" ", filepath);
}
CLOG_INFO_NOCHECK(&LOG, "Writing startup file: \"%s\" ", filepath);
ED_editors_flush_edits(bmain);
@@ -2550,15 +2548,10 @@ static wmOperatorStatus wm_homefile_write_exec(bContext *C, wmOperator *op)
BKE_callback_exec_string(bmain, success ? BKE_CB_EVT_SAVE_POST : BKE_CB_EVT_SAVE_POST_FAIL, "");
if (success) {
if (!G.quiet) {
printf("ok\n");
}
BKE_report(op->reports, RPT_INFO, "Startup file saved");
return OPERATOR_FINISHED;
}
if (!G.quiet) {
printf("fail\n");
}
CLOG_WARN(&LOG, "Failed to write startup file");
return OPERATOR_CANCELLED;
}

View File

@@ -471,9 +471,7 @@ void WM_exit_ex(bContext *C, const bool do_python_exit, const bool do_user_exit_
BlendFileWriteParams blend_file_write_params{};
if (BLO_write_file(bmain, filepath, fileflags, &blend_file_write_params, nullptr)) {
if (!G.quiet) {
CLOG_INFO_NOCHECK(&LOG_BLEND, "Saved session recovery to \"%s\"", filepath);
}
CLOG_INFO_NOCHECK(&LOG_BLEND, "Saved session recovery to \"%s\"", filepath);
}
}
@@ -687,7 +685,7 @@ void WM_exit(bContext *C, const int exit_code)
const bool do_user_exit_actions = G.background ? false : (exit_code == EXIT_SUCCESS);
WM_exit_ex(C, true, do_user_exit_actions);
if (!G.quiet) {
if (!CLG_quiet_get()) {
printf("\nBlender quit\n");
}

View File

@@ -1029,7 +1029,7 @@ static const char arg_handle_quiet_set_doc[] =
"Suppress status printing (warnings & errors are still printed).";
static int arg_handle_quiet_set(int /*argc*/, const char ** /*argv*/, void * /*data*/)
{
G.quiet = true;
CLG_quiet_set(true);
return 0;
}
@@ -1064,7 +1064,7 @@ static const char arg_handle_background_mode_set_doc[] =
"\tand can be re-enabled by passing in '-setaudio Default' afterwards.";
static int arg_handle_background_mode_set(int /*argc*/, const char ** /*argv*/, void * /*data*/)
{
if (!G.quiet) {
if (!CLG_quiet_get()) {
print_version_short();
}
background_mode_set();
@@ -1087,7 +1087,7 @@ static int arg_handle_command_set(int argc, const char **argv, void *data)
BLI_assert_unreachable();
}
/* Application "info" messages get in the way of command line output, suppress them. */
G.quiet = true;
CLG_quiet_set(true);
background_mode_set();
@@ -1843,7 +1843,7 @@ static const char arg_handle_register_extension_doc[] =
"Register blend-file extension for current user, then exit (Windows & Linux only).";
static int arg_handle_register_extension(int argc, const char **argv, void *data)
{
G.quiet = true;
CLG_quiet_set(true);
background_mode_set();
# if !(defined(WIN32) && defined(__APPLE__))
@@ -1861,7 +1861,7 @@ static const char arg_handle_register_extension_all_doc[] =
"Register blend-file extension for all users, then exit (Windows & Linux only).";
static int arg_handle_register_extension_all(int argc, const char **argv, void *data)
{
G.quiet = true;
CLG_quiet_set(true);
background_mode_set();
# if !(defined(WIN32) && defined(__APPLE__))
@@ -1879,7 +1879,7 @@ static const char arg_handle_unregister_extension_doc[] =
"Unregister blend-file extension for current user, then exit (Windows & Linux only).";
static int arg_handle_unregister_extension(int argc, const char **argv, void *data)
{
G.quiet = true;
CLG_quiet_set(true);
background_mode_set();
# if !(defined(WIN32) && defined(__APPLE__))
@@ -1897,7 +1897,7 @@ static const char arg_handle_unregister_extension_all_doc[] =
"Unregister blend-file extension for all users, then exit (Windows & Linux only).";
static int arg_handle_unregister_extension_all(int argc, const char **argv, void *data)
{
G.quiet = true;
CLG_quiet_set(true);
background_mode_set();
# if !(defined(WIN32) && defined(__APPLE__))