Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-10-26 13:40:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-26 14:02:40 +0300
commitef96f36ee961e7f11556570da2b9cef0a08159f9 (patch)
tree2a6943daee3d11baa7f3a92a58eff72d48ea3609 /source/blender/blenloader
parent654ee398ff0e37f4d5f5c4df96b1d521e4796de4 (diff)
Move background images into the camera
This moves background images out of the 3D viewport, to be used only as camera reference images. For 3D viewport references, background images can be used, see: D2827 Some work is still needed (background option isn't working at the moment).
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c49
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c7
-rw-r--r--source/blender/blenloader/intern/writefile.c8
3 files changed, 17 insertions, 47 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ce7914b0f37..2e4ff1c96a6 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3505,6 +3505,11 @@ static void lib_link_camera(FileData *fd, Main *main)
ca->dof_ob = newlibadr(fd, ca->id.lib, ca->dof_ob);
+ for (CameraBGImage *bgpic = ca->bg_images.first; bgpic; bgpic = bgpic->next) {
+ bgpic->ima = newlibadr_us(fd, ca->id.lib, bgpic->ima);
+ bgpic->clip = newlibadr_us(fd, ca->id.lib, bgpic->clip);
+ }
+
ca->id.tag &= ~LIB_TAG_NEED_LINK;
}
}
@@ -3514,6 +3519,12 @@ static void direct_link_camera(FileData *fd, Camera *ca)
{
ca->adt = newdataadr(fd, ca->adt);
direct_link_animdata(fd, ca->adt);
+
+ link_list(fd, &ca->bg_images);
+
+ for (CameraBGImage *bgpic = ca->bg_images.first; bgpic; bgpic = bgpic->next) {
+ bgpic->iuser.ok = 1;
+ }
}
@@ -6560,22 +6571,10 @@ static void lib_link_screen(FileData *fd, Main *main)
case SPACE_VIEW3D:
{
View3D *v3d = (View3D*) sl;
- BGpic *bgpic = NULL;
v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
- /* should be do_versions but not easy adding into the listbase */
- if (v3d->bgpic) {
- v3d->bgpic = newlibadr(fd, sc->id.lib, v3d->bgpic);
- BLI_addtail(&v3d->bgpicbase, bgpic);
- v3d->bgpic = NULL;
- }
-
- for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
- bgpic->ima = newlibadr_us(fd, sc->id.lib, bgpic->ima);
- bgpic->clip = newlibadr_us(fd, sc->id.lib, bgpic->clip);
- }
if (v3d->localvd) {
v3d->localvd->camera = newlibadr(fd, sc->id.lib, v3d->localvd->camera);
}
@@ -6905,21 +6904,11 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- BGpic *bgpic;
ARegion *ar;
v3d->camera = restore_pointer_by_name(id_map, (ID *)v3d->camera, USER_REAL);
v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL);
-
- for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
- if ((bgpic->ima = restore_pointer_by_name(id_map, (ID *)bgpic->ima, USER_IGNORE))) {
- id_us_plus((ID *)bgpic->ima);
- }
- if ((bgpic->clip = restore_pointer_by_name(id_map, (ID *)bgpic->clip, USER_IGNORE))) {
- id_us_plus((ID *)bgpic->clip);
- }
- }
-
+
/* not very nice, but could help */
if ((v3d->layact & v3d->lay) == 0) v3d->layact = v3d->lay;
@@ -7342,22 +7331,8 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
- BGpic *bgpic;
-
v3d->flag |= V3D_INVALID_BACKBUF;
- link_list(fd, &v3d->bgpicbase);
-
- /* should be do_versions except this doesnt fit well there */
- if (v3d->bgpic) {
- bgpic = newdataadr(fd, v3d->bgpic);
- BLI_addtail(&v3d->bgpicbase, bgpic);
- v3d->bgpic = NULL;
- }
-
- for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next)
- bgpic->iuser.ok = 1;
-
if (v3d->gpd) {
v3d->gpd = newdataadr(fd, v3d->gpd);
direct_link_gpencil(fd, v3d->gpd);
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 55219cbaad7..44b8ec780e8 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -2456,13 +2456,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_IMAGE)
+ if (sl->spacetype == SPACE_IMAGE) {
((SpaceImage *)sl)->iuser.fie_ima = 2;
- else if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- BGpic *bgpic;
- for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next)
- bgpic->iuser.fie_ima = 2;
}
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index bfffcbdcae6..da41433f6bc 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1992,6 +1992,10 @@ static void write_camera(WriteData *wd, Camera *cam)
if (cam->adt) {
write_animdata(wd, cam->adt);
}
+
+ for (CameraBGImage *bgpic = cam->bg_images.first; bgpic; bgpic = bgpic->next) {
+ writestruct(wd, DATA, CameraBGImage, 1, bgpic);
+ }
}
}
@@ -2992,12 +2996,8 @@ static void write_screen(WriteData *wd, bScreen *sc)
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- BGpic *bgpic;
writestruct(wd, DATA, View3D, 1, v3d);
- for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
- writestruct(wd, DATA, BGpic, 1, bgpic);
- }
if (v3d->localvd) {
writestruct(wd, DATA, View3D, 1, v3d->localvd);
}