Cleanup: expand on code-comments

Rename layout_old to layout_ref as the layout is a reference
(the old layout has been freed).
Also use boolean for save_copy argument.
This commit is contained in:
Campbell Barton
2023-05-03 16:31:06 +10:00
parent b690b8c16f
commit f9fbbd8f80
3 changed files with 23 additions and 7 deletions

View File

@@ -267,7 +267,7 @@ static void image_save_post(ReportList *reports,
ImBuf *ibuf,
int ok,
const ImageSaveOptions *opts,
int save_copy,
const bool save_copy,
const char *filepath,
bool *r_colorspace_changed)
{
@@ -350,7 +350,8 @@ static void imbuf_save_post(ImBuf *ibuf, ImBuf *colormanaged_ibuf)
/**
* \return success.
* \note `ima->filepath` and `ibuf->filepath` should end up the same.
* \note `ima->filepath` and `ibuf->filepath` will reference the same path
* (although `ima->filepath` may be blend-file relative).
* \note for multi-view the first `ibuf` is important to get the settings.
*/
static bool image_save_single(ReportList *reports,

View File

@@ -3232,7 +3232,11 @@ void SEQ_effect_text_font_load(TextVars *data, const bool do_id_user)
if (vfont->packedfile != NULL) {
PackedFile *pf = vfont->packedfile;
/* Create a name that's unique between library data-blocks to avoid loading
* a font per strip which will load fonts many times. */
* a font per strip which will load fonts many times.
*
* WARNING: this isn't fool proof!
* The #VFont may be renamed which will cause this to load multiple times,
* in practice this isn't so likely though. */
char name[MAX_ID_FULL_NAME];
BKE_id_full_name_get(name, &vfont->id, 0);

View File

@@ -269,6 +269,15 @@ static void wm_window_substitute_old(wmWindowManager *oldwm,
win->posy = oldwin->posy;
}
/**
* Support loading older files without multiple windows (pre 2.5),
* in this case the #bScreen from the users file should be used but the current
* windows (from `current_wm_list` are kept).
*
* As the original file did not have multiple windows, duplicate the layout into each window.
* An alternative solution could also be to close all windows except the first however this is
* enough of a corner case that it's the current behavior is acceptable.
*/
static void wm_window_match_keep_current_wm(const bContext *C,
ListBase *current_wm_list,
const bool load_ui,
@@ -286,7 +295,7 @@ static void wm_window_match_keep_current_wm(const bContext *C,
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
WorkSpace *workspace;
WorkSpaceLayout *layout_old = BKE_workspace_layout_find_global(bmain, screen, &workspace);
WorkSpaceLayout *layout_ref = BKE_workspace_layout_find_global(bmain, screen, &workspace);
BKE_workspace_active_set(win->workspace_hook, workspace);
win->scene = CTX_data_scene(C);
@@ -295,11 +304,13 @@ static void wm_window_match_keep_current_wm(const bContext *C,
WM_window_set_active_screen(win, workspace, screen);
}
else {
#if 0 /* NOTE(@ideasman42): The screen referenced from the window has been freed, see: 107525. */
WorkSpaceLayout *layout_old = WM_window_get_active_layout(win);
#if 0
/* NOTE(@ideasman42): The screen referenced from the window has been freed,
* see: #107525. */
WorkSpaceLayout *layout_ref = WM_window_get_active_layout(win);
#endif
WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(
bmain, workspace, layout_old, win);
bmain, workspace, layout_ref, win);
WM_window_set_active_layout(win, workspace, layout_new);
}