[Bf-blender-cvs] [ceed34aac18] master: Merge branch 'blender2.7'

Bastien Montagne noreply at git.blender.org
Wed May 22 23:38:00 CEST 2019


Commit: ceed34aac18e578109a79d3fe945493a29e8c27e
Author: Bastien Montagne
Date:   Wed May 22 23:34:07 2019 +0200
Branches: master
https://developer.blender.org/rBceed34aac18e578109a79d3fe945493a29e8c27e

Merge branch 'blender2.7'

Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/screen/screen_edit.c

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_library.h
index 54b9fdac5b4,0b781f95811..818fbce4f9a
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@@ -218,17 -180,12 +218,19 @@@ void BKE_main_id_flag_all(struct Main *
  
  void BKE_main_id_clear_newpoins(struct Main *bmain);
  
+ void BLE_main_id_refcount_recompute(struct Main *bmain, const bool do_linked_only);
+ 
  void BKE_main_lib_objects_recalc_all(struct Main *bmain);
  
 -/* (MAX_ID_NAME - 2) + 3 */
 -void BKE_id_ui_prefix(char name[66 + 1], const struct ID *id);
 +/* Only for repairing files via versioning, avoid for general use. */
 +void BKE_main_id_repair_duplicate_names_listbase(struct ListBase *lb);
 +
 +#define MAX_ID_FULL_NAME (64 + 64 + 3 + 1)         /* 64 is MAX_ID_NAME - 2 */
 +#define MAX_ID_FULL_NAME_UI (MAX_ID_FULL_NAME + 3) /* Adds 'keycode' two letters at begining. */
 +void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id);
 +void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const struct ID *id);
 +
 +char *BKE_id_to_unique_string_key(const struct ID *id);
  
  void BKE_library_free(struct Library *lib);
  
diff --cc source/blender/blenkernel/intern/blendfile.c
index 570c1b9bd4c,2439e126c41..c301588af0c
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@@ -126,253 -105,233 +126,263 @@@ static void setup_app_userdef(BlendFile
   * \param bfd: Blend file data, freed by this function on exit.
   * \param filepath: File path or identifier.
   */
 -static void setup_app_data(
 -        bContext *C, BlendFileData *bfd,
 -        const char *filepath,
 -        const bool is_startup,
 -        ReportList *reports)
 +static void setup_app_data(bContext *C,
 +                           BlendFileData *bfd,
 +                           const char *filepath,
 +                           const bool is_startup,
 +                           ReportList *reports)
  {
 -	Main *bmain = G_MAIN;
 -	Scene *curscene = NULL;
 -	const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
 -	enum {
 -		LOAD_UI = 1,
 -		LOAD_UI_OFF,
 -		LOAD_UNDO,
 -	} mode;
 -
 -	/* may happen with library files - UNDO file should never have NULL cursccene... */
 -	if (ELEM(NULL, bfd->curscreen, bfd->curscene)) {
 -		BKE_report(reports, RPT_WARNING, "Library file, loading empty scene");
 -		mode = LOAD_UI_OFF;
 -	}
 -	else if (BLI_listbase_is_empty(&bfd->main->screen)) {
 -		mode = LOAD_UNDO;
 -	}
 -	else if ((G.fileflags & G_FILE_NO_UI) && (is_startup == false)) {
 -		mode = LOAD_UI_OFF;
 -	}
 -	else {
 -		mode = LOAD_UI;
 -	}
 -
 -	/* Free all render results, without this stale data gets displayed after loading files */
 -	if (mode != LOAD_UNDO) {
 -		RE_FreeAllRenderResults();
 -	}
 -
 -	/* Only make filepaths compatible when loading for real (not undo) */
 -	if (mode != LOAD_UNDO) {
 -		clean_paths(bfd->main);
 -	}
 -
 -	/* XXX here the complex windowmanager matching */
 -
 -	/* no load screens? */
 -	if (mode != LOAD_UI) {
 -		/* Logic for 'track_undo_scene' is to keep using the scene which the active screen has,
 -		 * as long as the scene associated with the undo operation is visible in one of the open windows.
 -		 *
 -		 * - 'curscreen->scene' - scene the user is currently looking at.
 -		 * - 'bfd->curscene' - scene undo-step was created in.
 -		 *
 -		 * This means users can have 2+ windows open and undo in both without screens switching.
 -		 * But if they close one of the screens,
 -		 * undo will ensure that the scene being operated on will be activated
 -		 * (otherwise we'd be undoing on an off-screen scene which isn't acceptable).
 -		 * see: T43424
 -		 */
 -		bScreen *curscreen = NULL;
 -		bool track_undo_scene;
 -
 -		/* comes from readfile.c */
 -		SWAP(ListBase, bmain->wm, bfd->main->wm);
 -		SWAP(ListBase, bmain->screen, bfd->main->screen);
 -
 -		/* we re-use current screen */
 -		curscreen = CTX_wm_screen(C);
 -		/* but use new Scene pointer */
 -		curscene = bfd->curscene;
 -
 -		track_undo_scene = (mode == LOAD_UNDO && curscreen && curscene && bfd->main->wm.first);
 -
 -		if (curscene == NULL) {
 -			curscene = bfd->main->scene.first;
 -		}
 -		/* empty file, we add a scene to make Blender work */
 -		if (curscene == NULL) {
 -			curscene = BKE_scene_add(bfd->main, "Empty");
 -		}
 -
 -		if (track_undo_scene) {
 -			/* keep the old (free'd) scene, let 'blo_lib_link_screen_restore'
 -			 * replace it with 'curscene' if its needed */
 -		}
 -		else {
 -			/* and we enforce curscene to be in current screen */
 -			if (curscreen) {
 -				/* can run in bgmode */
 -				curscreen->scene = curscene;
 -			}
 -		}
 -
 -		/* BKE_blender_globals_clear will free G_MAIN, here we can still restore pointers */
 -		blo_lib_link_screen_restore(bfd->main, curscreen, curscene);
 -		/* curscreen might not be set when loading without ui (see T44217) so only re-assign if available */
 -		if (curscreen) {
 -			curscene = curscreen->scene;
 -		}
 -
 -		if (track_undo_scene) {
 -			wmWindowManager *wm = bfd->main->wm.first;
 -			if (wm_scene_is_visible(wm, bfd->curscene) == false) {
 -				curscene = bfd->curscene;
 -				curscreen->scene = curscene;
 -				BKE_screen_view3d_scene_sync(curscreen);
 -			}
 -		}
 -	}
 -
 -	/* free G_MAIN Main database */
 -//	CTX_wm_manager_set(C, NULL);
 -	BKE_blender_globals_clear();
 -
 -	/* clear old property update cache, in case some old references are left dangling */
 -	RNA_property_update_cache_free();
 -
 -	bmain = G_MAIN = bfd->main;
 -
 -	CTX_data_main_set(C, bmain);
 -
 -	if (bfd->user) {
 -		/* only here free userdef themes... */
 -		BKE_blender_userdef_data_set_and_free(bfd->user);
 -		bfd->user = NULL;
 -
 -		/* Security issue: any blend file could include a USER block.
 -		 *
 -		 * Currently we load prefs from BLENDER_STARTUP_FILE and later on load BLENDER_USERPREF_FILE,
 -		 * to load the preferences defined in the users home dir.
 -		 *
 -		 * This means we will never accidentally (or maliciously)
 -		 * enable scripts auto-execution by loading a '.blend' file.
 -		 */
 -		U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
 -	}
 -
 -	/* case G_FILE_NO_UI or no screens in file */
 -	if (mode != LOAD_UI) {
 -		/* leave entire context further unaltered? */
 -		CTX_data_scene_set(C, curscene);
 -	}
 -	else {
 -		CTX_wm_manager_set(C, bmain->wm.first);
 -		CTX_wm_screen_set(C, bfd->curscreen);
 -		CTX_data_scene_set(C, bfd->curscene);
 -		CTX_wm_area_set(C, NULL);
 -		CTX_wm_region_set(C, NULL);
 -		CTX_wm_menu_set(C, NULL);
 -		curscene = bfd->curscene;
 -	}
 -
 -	/* Keep state from preferences. */
 -	const int fileflags_skip = G_FILE_FLAGS_RUNTIME;
 -	G.fileflags = (G.fileflags & fileflags_skip) | (bfd->fileflags & ~fileflags_skip);
 -
 -	/* this can happen when active scene was lib-linked, and doesn't exist anymore */
 -	if (CTX_data_scene(C) == NULL) {
 -		/* in case we don't even have a local scene, add one */
 -		if (!bmain->scene.first)
 -			BKE_scene_add(bmain, "Empty");
 -
 -		CTX_data_scene_set(C, bmain->scene.first);
 -		CTX_wm_screen(C)->scene = CTX_data_scene(C);
 -		curscene = CTX_data_scene(C);
 -	}
 -
 -	BLI_assert(curscene == CTX_data_scene(C));
 -
 -
 -	/* special cases, override loaded flags: */
 -	if (G.f != bfd->globalf) {
 -		const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
 -		bfd->globalf = (bfd->globalf & ~flags_keep) | (G.f & flags_keep);
 -	}
 -
 -
 -	G.f = bfd->globalf;
 +  Main *bmain = G_MAIN;
 +  Scene *curscene = NULL;
 +  const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
 +  enum {
 +    LOAD_UI = 1,
 +    LOAD_UI_OFF,
 +    LOAD_UNDO,
 +  } mode;
 +
 +  /* may happen with library files - UNDO file should never have NULL cursccene... */
 +  if (ELEM(NULL, bfd->curscreen, bfd->curscene)) {
 +    BKE_report(reports, RPT_WARNING, "Library file, loading empty scene");
 +    mode = LOAD_UI_OFF;
 +  }
 +  else if (BLI_listbase_is_empty(&bfd->main->screens)) {
 +    mode = LOAD_UNDO;
 +  }
 +  else if ((G.fileflags & G_FILE_NO_UI) && (is_startup == false)) {
 +    mode = LOAD_UI_OFF;
 +  }
 +  else {
 +    mode = LOAD_UI;
 +  }
 +
 +  /* Free all render results, without this stale data gets displayed after loading files */
 +  if (mode != LOAD_UNDO) {
 +    RE_FreeAllRenderResults();
 +  }
 +
 +  /* Only make filepaths compatible when loading for real (not undo) */
 +  if (mode != LOAD_UNDO) {
 +    clean_paths(bfd->main);
 +  }
 +
 +  /* XXX here the complex windowmanager matching */
 +
 +  /* no load screens? */
 +  if (mode != LOAD_UI) {
 +    /* Logic for 'track_undo_scene' is to keep using the scene which the active screen has,
 +     * as long as the scene associated with the undo operation is visible
 +     * in one of the open windows.
 +     *
 +     * - 'curscreen->scene' - scene the user is currently looking at.
 +     * - 'bfd->curscene' - scene undo-step was created in.
 +     *
 +     * This means users can have 2+ windows open and undo in both without screens switching.
 +     * But if they close one of the screens,
 +     * undo will ensure that the scene being operated on will be activated
 +     * (otherwise we'd be undoing on an off-screen scene which isn't acceptable).
 +     * see: T43424
 +     */
 +    wmWindow *win;
 +    bScreen *curscreen = NULL;
 +    ViewLayer *cur_view_layer;
 +    bool track_undo_scene;
 +
 +    /* comes from readfile.c */
 +    SWAP(ListBase, bmain->wm, bfd->main->wm);
 +    SWAP(ListBase, bmain->workspaces, bfd->main->workspaces);
 +    SWAP(ListBase, bmain->screens, bfd->main->screens);
 +
 +    /* we re-use current window and screen */
 +    win = CTX_wm_window(C);
 +    curscreen = CTX_wm_screen(C);
 +    /* but use Scene pointer from new file */
 +    curscene = bfd->curscene;
 +    cur_view_layer = bfd->cur_view_layer;
 +
 +    track_undo_scene = (mode == LOAD_UNDO && curscreen && curscene && bfd->main->wm.first);
 +
 +    if (curscene == NULL) {
 +      curscene = bfd->main->scenes.first;
 +    }
 +    /* empty file, we add a scene to make Blender work */
 +    if (curscene == NULL) {
 +      curscene = BKE_scene_add(bfd->main, "Empty");
 +    }
 +    if (cur_view_layer == NULL) {
 +      /* fallback to scene layer */
 +      c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list