Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-01-17 19:29:50 +11:00
commit dfea9f43db
3 changed files with 35 additions and 40 deletions

View File

@ -233,6 +233,15 @@
/* Use GHash for restoring pointers by name */
#define USE_GHASH_RESTORE_POINTER
/* Define this to have verbose debug prints. */
#define USE_DEBUG_PRINT
#ifdef USE_DEBUG_PRINT
# define DEBUG_PRINTF(...) printf(__VA_ARGS__)
#else
# define DEBUG_PRINTF(...)
#endif
/***/
typedef struct OldNew {
@ -8433,22 +8442,16 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
if (fd->memfile && ELEM(bhead->code, ID_LI, ID_ID)) {
const char *idname = bhead_id_name(fd, bhead);
#ifdef PRINT_DEBUG
printf("Checking %s...\n", idname);
#endif
DEBUG_PRINTF("Checking %s...\n", idname);
if (bhead->code == ID_LI) {
Main *libmain = fd->old_mainlist->first;
/* Skip oldmain itself... */
for (libmain = libmain->next; libmain; libmain = libmain->next) {
#ifdef PRINT_DEBUG
printf("... against %s: ", libmain->curlib ? libmain->curlib->id.name : "<NULL>");
#endif
DEBUG_PRINTF("... against %s: ", libmain->curlib ? libmain->curlib->id.name : "<NULL>");
if (libmain->curlib && STREQ(idname, libmain->curlib->id.name)) {
Main *oldmain = fd->old_mainlist->first;
#ifdef PRINT_DEBUG
printf("FOUND!\n");
#endif
DEBUG_PRINTF("FOUND!\n");
/* In case of a library, we need to re-add its main to fd->mainlist, because if we have later
* a missing ID_ID, we need to get the correct lib it is linked to!
* Order is crucial, we cannot bulk-add it in BLO_read_from_memfile() like it used to be... */
@ -8462,19 +8465,13 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
}
return blo_nextbhead(fd, bhead);
}
#ifdef PRINT_DEBUG
printf("nothing...\n");
#endif
DEBUG_PRINTF("nothing...\n");
}
}
else {
#ifdef PRINT_DEBUG
printf("... in %s (%s): ", main->curlib ? main->curlib->id.name : "<NULL>", main->curlib ? main->curlib->name : "<NULL>");
#endif
DEBUG_PRINTF("... in %s (%s): ", main->curlib ? main->curlib->id.name : "<NULL>", main->curlib ? main->curlib->name : "<NULL>");
if ((id = BKE_libblock_find_name_ex(main, GS(idname), idname + 2))) {
#ifdef PRINT_DEBUG
printf("FOUND!\n");
#endif
DEBUG_PRINTF("FOUND!\n");
/* Even though we found our linked ID, there is no guarantee its address is still the same... */
if (id != bhead->old) {
oldnewmap_insert(fd->libmap, bhead->old, id, GS(id->name));
@ -8486,9 +8483,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
}
return blo_nextbhead(fd, bhead);
}
#ifdef PRINT_DEBUG
printf("nothing...\n");
#endif
DEBUG_PRINTF("nothing...\n");
}
}

View File

@ -1794,14 +1794,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_SimpleDeform) {
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
switch (smd->mode) {
case MOD_SIMPLEDEFORM_MODE_BEND:
smd->deform_axis = 0;
break;
default:
smd->deform_axis = 2;
break;
}
smd->deform_axis = 2;
}
}
}

View File

@ -95,6 +95,18 @@ static void image_scopes_tag_refresh(ScrArea *sa)
sima->scopes.ok = 0;
}
static void image_user_refresh_scene(const bContext *C, SpaceImage *sima)
{
if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
/* for render result, try to use the currently rendering scene */
Scene *render_scene = ED_render_job_get_current_scene(C);
if (render_scene) {
sima->iuser.scene = render_scene;
return;
}
}
sima->iuser.scene = CTX_data_scene(C);
}
/* ******************** manage regions ********************* */
@ -734,17 +746,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* put scene context variable in iuser */
if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
/* for render result, try to use the currently rendering scene */
Scene *render_scene = ED_render_job_get_current_scene(C);
if (render_scene)
sima->iuser.scene = render_scene;
else
sima->iuser.scene = scene;
}
else
sima->iuser.scene = scene;
image_user_refresh_scene(C, sima);
/* we set view2d from own zoom and offset each time */
image_main_region_set_view2d(sima, ar);
@ -1014,6 +1016,11 @@ static void image_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void image_header_region_draw(const bContext *C, ARegion *ar)
{
ScrArea *sa = CTX_wm_area(C);
SpaceImage *sima = sa->spacedata.first;
image_user_refresh_scene(C, sima);
ED_region_header(C, ar);
}