diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-04-06 16:40:12 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-04-06 16:40:12 +0300 |
commit | d5f1b9c2223333e03f2e4994171ad9df8c1c4f21 (patch) | |
tree | be6b81d2c439249af96b8b28b5013dcbb735b937 /source/blender/blenloader | |
parent | 74df307ca43df14b759fd9eb6a049a6c5d90dcda (diff) |
Multi-View and Stereo 3D
Official Documentation:
http://www.blender.org/manual/render/workflows/multiview.html
Implemented Features
====================
Builtin Stereo Camera
* Convergence Mode
* Interocular Distance
* Convergence Distance
* Pivot Mode
Viewport
* Cameras
* Plane
* Volume
Compositor
* View Switch Node
* Image Node Multi-View OpenEXR support
Sequencer
* Image/Movie Strips 'Use Multiview'
UV/Image Editor
* Option to see Multi-View images in Stereo-3D or its individual images
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images
I/O
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images
Scene Render Views
* Ability to have an arbitrary number of views in the scene
Missing Bits
============
First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report.
Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report.
Everything else is likely small todos, and may wait until we are sure none of the above is happening.
Apart from that there are those known issues:
* Compositor Image Node poorly working for Multi-View OpenEXR
(this was working prefectly before the 'Use Multi-View' functionality)
* Selecting camera from Multi-View when looking from camera is problematic
* Animation Playback (ctrl+F11) doesn't support stereo formats
* Wrong filepath when trying to play back animated scene
* Viewport Rendering doesn't support Multi-View
* Overscan Rendering
* Fullscreen display modes need to warn the user
* Object copy should be aware of views suffix
Acknowledgments
===============
* Francesco Siddi for the help with the original feature specs and design
* Brecht Van Lommel for the original review of the code and design early on
* Blender Foundation for the Development Fund to support the project wrap up
Final patch reviewers:
* Antony Riakiotakis (psy-fi)
* Campbell Barton (ideasman42)
* Julian Eisel (Severin)
* Sergey Sharybin (nazgul)
* Thomas Dinged (dingto)
Code contributors of the original branch in github:
* Alexey Akishin
* Gabriel Caraballo
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 41 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 88 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 31 |
3 files changed, 143 insertions, 17 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8c5959f20bf..4eb7413adc1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1533,9 +1533,15 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain) fd->packedmap = oldnewmap_new(); - for (ima = oldmain->image.first; ima; ima = ima->id.next) + for (ima = oldmain->image.first; ima; ima = ima->id.next) { + ImagePackedFile *imapf; if (ima->packedfile) insert_packedmap(fd, ima->packedfile); + + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) + if (imapf->packedfile) + insert_packedmap(fd, imapf->packedfile); + } for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next) if (vfont->packedfile) @@ -1568,8 +1574,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) entry->newp = NULL; } - for (ima = oldmain->image.first; ima; ima = ima->id.next) + for (ima = oldmain->image.first; ima; ima = ima->id.next) { + ImagePackedFile *imapf; ima->packedfile = newpackedadr(fd, ima->packedfile); + + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) + imapf->packedfile = newpackedadr(fd, imapf->packedfile); + } for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next) vfont->packedfile = newpackedadr(fd, vfont->packedfile); @@ -3391,6 +3402,8 @@ static void lib_link_image(FileData *fd, Main *main) static void direct_link_image(FileData *fd, Image *ima) { + ImagePackedFile *imapf; + /* for undo system, pointers could be restored */ if (fd->imamap) ima->cache = newimaadr(fd, ima->cache); @@ -3404,8 +3417,7 @@ static void direct_link_image(FileData *fd, Image *ima) ima->gputexture = NULL; ima->rr = NULL; } - - ima->anim = NULL; + ima->repbind = NULL; /* undo system, try to restore render buffers */ @@ -3419,9 +3431,18 @@ static void direct_link_image(FileData *fd, Image *ima) memset(ima->renders, 0, sizeof(ima->renders)); ima->last_render_slot = ima->render_slot; } - + + link_list(fd, &(ima->views)); + link_list(fd, &(ima->packedfiles)); + + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { + imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile); + } + + ima->anims.first = ima->anims.last = NULL; ima->packedfile = direct_link_packedfile(fd, ima->packedfile); ima->preview = direct_link_preview_image(fd, ima->preview); + ima->stereo3d_format = newdataadr(fd, ima->stereo3d_format); ima->ok = 1; } @@ -5378,7 +5399,7 @@ static void lib_link_scene(FileData *fd, Main *main) seq->scene_sound = BKE_sound_add_scene_sound_defaults(sce, seq); } } - seq->anim = NULL; + seq->anims.first = seq->anims.last = NULL; lib_link_sequence_modifiers(fd, sce, &seq->modifiers); } @@ -5610,6 +5631,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) if (seq->seq3 == NULL) seq->seq3 = seq->seq2; seq->effectdata = newdataadr(fd, seq->effectdata); + seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format); if (seq->type & SEQ_TYPE_EFFECT) seq->flag |= SEQ_EFFECT_NOT_LOADED; @@ -5722,6 +5744,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) link_list(fd, &(sce->markers)); link_list(fd, &(sce->transform_spaces)); link_list(fd, &(sce->r.layers)); + link_list(fd, &(sce->r.views)); for (srl = sce->r.layers.first; srl; srl = srl->next) { link_list(fd, &(srl->freestyleConfig.modules)); @@ -5785,8 +5808,8 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) BLI_listbase_clear(&win->modalhandlers); BLI_listbase_clear(&win->subwindows); BLI_listbase_clear(&win->gesture); + BLI_listbase_clear(&win->drawdata); - win->drawdata = NULL; win->drawmethod = -1; win->drawfail = 0; win->active = 0; @@ -5794,6 +5817,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) win->cursor = 0; win->lastcursor = 0; win->modalcursor = 0; + win->stereo3d_format = newdataadr(fd, win->stereo3d_format); } BLI_listbase_clear(&wm->timers); @@ -7765,7 +7789,6 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) user->walk_navigation.jump_height = 0.4f; /* m */ user->walk_navigation.teleport_time = 0.2f; /* s */ } - } static void do_versions(FileData *fd, Library *lib, Main *main) @@ -7888,7 +7911,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) link_list(fd, &user->user_keymaps); link_list(fd, &user->addons); link_list(fd, &user->autoexec_paths); - + for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) { keymap->modal_items= NULL; keymap->poll = NULL; diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 50cd39352a8..371ce495b07 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -27,6 +27,7 @@ #include "BLI_utildefines.h" #include "BLI_compiler_attrs.h" +#include "BLI_string.h" /* for MinGW32 definition of NULL, could use BLI_blenlib.h instead too */ #include <stddef.h> @@ -48,14 +49,18 @@ #include "DNA_particle_types.h" #include "DNA_linestyle_types.h" #include "DNA_actuator_types.h" +#include "DNA_camera_types.h" +#include "DNA_view3d_types.h" #include "DNA_genfile.h" #include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_node.h" +#include "BKE_scene.h" #include "BKE_sequencer.h" #include "BKE_screen.h" +#include "BKE_sequencer.h" #include "BLI_math.h" #include "BLI_listbase.h" @@ -460,10 +465,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) br->mtex.random_angle = 2.0 * M_PI; br->mask_mtex.random_angle = 2.0 * M_PI; } + } #undef BRUSH_RAKE #undef BRUSH_RANDOM_ROTATION - } /* Customizable Safe Areas */ if (!MAIN_VERSION_ATLEAST(main, 273, 2)) { @@ -724,4 +729,85 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) #undef SEQ_USE_PROXY_CUSTOM_DIR #undef SEQ_USE_PROXY_CUSTOM_FILE } + + if (!MAIN_VERSION_ATLEAST(main, 274, 3)) + { + SceneRenderView *srv; + wmWindowManager *wm; + bScreen *screen; + wmWindow *win; + Scene *scene; + Camera *cam; + Image *ima; + + for (scene = main->scene.first; scene; scene = scene->id.next) { + Sequence *seq; + + BKE_scene_add_render_view(scene, STEREO_LEFT_NAME); + srv = scene->r.views.first; + BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix)); + + BKE_scene_add_render_view(scene, STEREO_RIGHT_NAME); + srv = scene->r.views.last; + BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix)); + + SEQ_BEGIN (scene->ed, seq) + { + seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format"); + } + SEQ_END + } + + for (screen = main->screen.first; screen; screen = screen->id.next) { + ScrArea *sa; + for (sa = screen->areabase.first; sa; sa = sa->next) { + SpaceLink *sl; + + for (sl = sa->spacedata.first; sl; sl = sl->next) { + switch (sl->spacetype) { + case SPACE_VIEW3D: + { + View3D *v3d = (View3D *)sl; + v3d->stereo3d_camera = STEREO_3D_ID; + v3d->stereo3d_flag |= V3D_S3D_DISPPLANE; + v3d->stereo3d_convergence_alpha = 0.15f; + v3d->stereo3d_volume_alpha = 0.05f; + break; + } + case SPACE_IMAGE: + { + SpaceImage *sima = (SpaceImage *) sl; + sima->iuser.flag |= IMA_SHOW_STEREO; + sima->iuser.passtype = SCE_PASS_COMBINED; + break; + } + } + } + } + } + + for (cam = main->camera.first; cam; cam = cam->id.next) { + cam->stereo.interocular_distance = 0.065; + cam->stereo.convergence_distance = 30.f * 0.065; + } + + for (ima = main->image.first; ima; ima = ima->id.next) { + ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format"); + + if (ima->packedfile) { + ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed File"); + BLI_addtail(&ima->packedfiles, imapf); + + imapf->packedfile = ima->packedfile; + BLI_strncpy(imapf->filepath, ima->name, FILE_MAX); + ima->packedfile = NULL; + } + } + + for (wm = main->wm.first; wm; wm = wm->id.next) { + for (win = wm->windows.first; win; win = win->next) { + win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format"); + } + } + } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c616436d584..2580ba64622 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2124,7 +2124,8 @@ static void write_images(WriteData *wd, ListBase *idbase) { Image *ima; PackedFile * pf; - + ImageView *iv; + ImagePackedFile *imapf; ima= idbase->first; while (ima) { @@ -2133,13 +2134,20 @@ static void write_images(WriteData *wd, ListBase *idbase) writestruct(wd, ID_IM, "Image", 1, ima); if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd); - if (ima->packedfile) { - pf = ima->packedfile; - writestruct(wd, DATA, "PackedFile", 1, pf); - writedata(wd, DATA, pf->size, pf->data); + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { + writestruct(wd, DATA, "ImagePackedFile", 1, imapf); + if (imapf->packedfile) { + pf = imapf->packedfile; + writestruct(wd, DATA, "PackedFile", 1, pf); + writedata(wd, DATA, pf->size, pf->data); + } } write_previews(wd, ima->preview); + + for (iv = ima->views.first; iv; iv = iv->next) + writestruct(wd, DATA, "ImageView", 1, iv); + writestruct(wd, DATA, "Stereo3dFormat", 1, ima->stereo3d_format); } ima= ima->id.next; } @@ -2340,6 +2348,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) TimeMarker *marker; TransformOrientation *ts; SceneRenderLayer *srl; + SceneRenderView *srv; ToolSettings *tos; FreestyleModuleConfig *fmc; FreestyleLineSet *fls; @@ -2421,7 +2430,9 @@ static void write_scenes(WriteData *wd, ListBase *scebase) break; } } - + + writestruct(wd, DATA, "Stereo3dFormat", 1, seq->stereo3d_format); + strip= seq->strip; writestruct(wd, DATA, "Strip", 1, strip); if (seq->flag & SEQ_USE_CROP && strip->crop) { @@ -2486,6 +2497,10 @@ static void write_scenes(WriteData *wd, ListBase *scebase) writestruct(wd, DATA, "FreestyleLineSet", 1, fls); } } + + /* writing MultiView to the blend file */ + for (srv = sce->r.views.first; srv; srv = srv->next) + writestruct(wd, DATA, "SceneRenderView", 1, srv); if (sce->nodetree) { writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree); @@ -2548,8 +2563,10 @@ static void write_windowmanagers(WriteData *wd, ListBase *lb) for (wm= lb->first; wm; wm= wm->id.next) { writestruct(wd, ID_WM, "wmWindowManager", 1, wm); - for (win= wm->windows.first; win; win= win->next) + for (win= wm->windows.first; win; win= win->next) { writestruct(wd, DATA, "wmWindow", 1, win); + writestruct(wd, DATA, "Stereo3dFormat", 1, win->stereo3d_format); + } } } |