diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-18 10:12:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-18 10:16:15 +0300 |
commit | 7d055da327b9555f76035075ce4e228d31f04df4 (patch) | |
tree | 1baf55c36ba068acf764febed0a8ddf4bedca438 /source/blender/blenloader/intern | |
parent | 33ba170f5c2fc3b8b26b895b092a86ebd85d3e13 (diff) |
Move transform orientation to scene
This was stored in the workspace, selected from the view.
Move both to scene since custom orientations are closely related to your
scene data.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 3 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 29 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 7 |
3 files changed, 12 insertions, 27 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b40321f75d1..fdd65add6d1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2902,7 +2902,6 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main link_list(fd, BKE_workspace_layouts_get(workspace)); link_list(fd, &workspace->hook_layout_relations); link_list(fd, &workspace->scene_viewlayer_relations); - link_list(fd, BKE_workspace_transform_orientations_get(workspace)); link_list(fd, &workspace->owner_ids); for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first; @@ -6258,7 +6257,7 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain) } link_list(fd, &(sce->markers)); - link_list(fd, &(sce->transform_spaces)); /* only for old files */ + link_list(fd, &(sce->transform_spaces)); link_list(fd, &(sce->r.layers)); link_list(fd, &(sce->r.views)); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index d8314cb232c..0b2e44bff86 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -95,7 +95,6 @@ static void do_version_workspaces_create_from_screens(Main *bmain) Scene *scene = screen->scene; WorkSpace *workspace; ViewLayer *layer = BKE_view_layer_from_scene_get(scene); - ListBase *transform_orientations; if (screen_parent) { /* fullscreen with "Back to Previous" option, don't create @@ -116,9 +115,6 @@ static void do_version_workspaces_create_from_screens(Main *bmain) BLI_strncpy(workspace->view_render.engine_id, RE_engine_id_BLENDER_EEVEE, sizeof(workspace->view_render.engine_id)); #endif - - transform_orientations = BKE_workspace_transform_orientations_get(workspace); - BLI_duplicatelist(transform_orientations, &scene->transform_spaces); } } @@ -750,25 +746,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) } if (!MAIN_VERSION_ATLEAST(main, 280, 2)) { - if (!DNA_struct_elem_find(fd->filesdna, "View3D", "short", "custom_orientation_index")) { - for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) { - for (ScrArea *area = screen->areabase.first; area; area = area->next) { - for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *)sl; - if (v3d->twmode >= V3D_MANIP_CUSTOM) { - v3d->custom_orientation_index = v3d->twmode - V3D_MANIP_CUSTOM; - v3d->twmode = V3D_MANIP_CUSTOM; - } - else { - v3d->custom_orientation_index = -1; - } - } - } - } - } - } - if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "cascade_max_dist")) { for (Lamp *la = main->lamp.first; la; la = la->id.next) { la->cascade_max_dist = 1000.0f; @@ -947,6 +924,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) con = con_next; } } + + if (!DNA_struct_elem_find(fd->filesdna, "Scene", "int", "orientation_index_custom")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + scene->orientation_index_custom = -1; + } + } } if (!MAIN_VERSION_ATLEAST(main, 280, 6)) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c6523dc99e2..ab71676b3df 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2648,6 +2648,11 @@ static void write_scene(WriteData *wd, Scene *sce) writestruct(wd, DATA, TimeMarker, 1, marker); } + /* writing dynamic list of TransformOrientations to the blend file */ + for (TransformOrientation *ts = sce->transform_spaces.first; ts; ts = ts->next) { + writestruct(wd, DATA, TransformOrientation, 1, ts); + } + /* writing MultiView to the blend file */ for (SceneRenderView *srv = sce->r.views.first; srv; srv = srv->next) { writestruct(wd, DATA, SceneRenderView, 1, srv); @@ -3625,14 +3630,12 @@ static void write_cachefile(WriteData *wd, CacheFile *cache_file) static void write_workspace(WriteData *wd, WorkSpace *workspace) { ListBase *layouts = BKE_workspace_layouts_get(workspace); - ListBase *transform_orientations = BKE_workspace_transform_orientations_get(workspace); writestruct(wd, ID_WS, WorkSpace, 1, workspace); writelist(wd, DATA, WorkSpaceLayout, layouts); writelist(wd, DATA, WorkSpaceDataRelation, &workspace->hook_layout_relations); writelist(wd, DATA, WorkSpaceDataRelation, &workspace->scene_viewlayer_relations); writelist(wd, DATA, wmOwnerID, &workspace->owner_ids); - writelist(wd, DATA, TransformOrientation, transform_orientations); } /* Keep it last of write_foodata functions. */ |