diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-06-26 17:07:39 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-06-26 17:07:39 +0300 |
commit | fbaf6e6fb3d2eb2f0c737b7d4713a5ea171738e6 (patch) | |
tree | 35bfa54eef6240693a13d594bb49ed7c8d33b32e /source/blender/blenloader/intern/versioning_280.c | |
parent | bba0ad903cfa407368c78b0b8480b1a729474305 (diff) | |
parent | c07f2bc89196ea449a2875634eb85efa45733fb5 (diff) |
Merge remote-tracking branch 'origin/blender2.8' into temp-dynamic-overridestemp-dynamic-overrides
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 218 |
1 files changed, 73 insertions, 145 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 74ff53a45d9..06017668c02 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -144,6 +144,7 @@ static void do_version_area_change_space_to_space_action(ScrArea *area, const Sc saction->mode = SACTCONT_TIMELINE; saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED; + saction->ads.filterflag |= ADS_FILTER_SUMMARY; } /** @@ -355,13 +356,6 @@ static void do_version_scene_collection_to_collection(Main *bmain, Scene *scene) #endif -enum { - DO_VERSION_COLLECTION_VISIBLE = 0, - DO_VERSION_COLLECTION_HIDE = 1, - DO_VERSION_COLLECTION_HIDE_RENDER = 2, - DO_VERSION_COLLECTION_HIDE_ALL = 3, -}; - static void do_version_layers_to_collections(Main *bmain, Scene *scene) { /* Since we don't have access to FileData we check the (always valid) first @@ -376,99 +370,26 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) /* Create collections from layers. */ Collection *collection_master = BKE_collection_master(scene); - - struct DoVersionSceneCollections { - Collection *collections[20]; - int created; - const char *suffix; - int flag; - } collections[] = - { - { - .collections = {NULL}, - .created = 0, - .suffix = "", - .flag = 0, - }, - { - .collections = {NULL}, - .created = 0, - .suffix = " - Hide Viewport", - .flag = COLLECTION_RESTRICT_VIEW, - }, - { - .collections = {NULL}, - .created = 0, - .suffix = " - Hide Render", - .flag = COLLECTION_RESTRICT_RENDER, - }, - { - .collections = {NULL}, - .created = 0, - .suffix = " - Hide Render All", - .flag = COLLECTION_RESTRICT_VIEW | COLLECTION_RESTRICT_RENDER, - } - }; + Collection *collections[20] = {NULL}; for (int layer = 0; layer < 20; layer++) { for (Base *base = scene->base.first; base; base = base->next) { if (base->lay & (1 << layer)) { - int collection_index = -1; - if ((base->object->restrictflag & OB_RESTRICT_VIEW) && - (base->object->restrictflag & OB_RESTRICT_RENDER)) - { - collection_index = DO_VERSION_COLLECTION_HIDE_ALL; - } - else if (base->object->restrictflag & OB_RESTRICT_VIEW) { - collection_index = DO_VERSION_COLLECTION_HIDE; - } - else if (base->object->restrictflag & OB_RESTRICT_RENDER) { - collection_index = DO_VERSION_COLLECTION_HIDE_RENDER; - } - else { - collection_index = DO_VERSION_COLLECTION_VISIBLE; - } - /* Create collections when needed only. */ - if ((collections[collection_index].created & (1 << layer)) == 0) { + if (collections[layer] == NULL) { char name[MAX_NAME]; - if ((collections[DO_VERSION_COLLECTION_VISIBLE].created & (1 << layer)) == 0) { - BLI_snprintf(name, - sizeof(collection_master->id.name), - "Collection %d%s", - layer + 1, - collections[DO_VERSION_COLLECTION_VISIBLE].suffix); - - Collection *collection = BKE_collection_add(bmain, collection_master, name); - collection->id.lib = scene->id.lib; - collection->flag |= collections[DO_VERSION_COLLECTION_VISIBLE].flag; - collections[DO_VERSION_COLLECTION_VISIBLE].collections[layer] = collection; - collections[DO_VERSION_COLLECTION_VISIBLE].created |= (1 << layer); - - if (!(scene->lay & (1 << layer))) { - collection->flag |= COLLECTION_RESTRICT_VIEW | COLLECTION_RESTRICT_RENDER; - } - } + BLI_snprintf(name, + sizeof(collection_master->id.name), + "Collection %d", + layer + 1); - if (collection_index != DO_VERSION_COLLECTION_VISIBLE) { - Collection *collection_parent; - collection_parent = collections[DO_VERSION_COLLECTION_VISIBLE].collections[layer]; - BLI_snprintf(name, - sizeof(collection_master->id.name), - "Collection %d%s", - layer + 1, - collections[collection_index].suffix); - - Collection *collection = BKE_collection_add(bmain, collection_parent, name); - collection->id.lib = scene->id.lib; - collection->flag |= collections[collection_index].flag; - collections[collection_index].collections[layer] = collection; - collections[collection_index].created |= (1 << layer); - - if (!(scene->lay & (1 << layer))) { - collection->flag |= COLLECTION_RESTRICT_VIEW | COLLECTION_RESTRICT_RENDER; - } + Collection *collection = BKE_collection_add(bmain, collection_master, name); + collection->id.lib = scene->id.lib; + collections[layer] = collection; + + if (!(scene->lay & (1 << layer))) { + collection->flag |= COLLECTION_RESTRICT_VIEW | COLLECTION_RESTRICT_RENDER; } } @@ -476,7 +397,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) * but since no view layers exists yet at this point it's fast. */ BKE_collection_object_add( bmain, - collections[collection_index].collections[layer], base->object); + collections[layer], base->object); } if (base->flag & SELECT) { @@ -488,46 +409,6 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) } } - /* Re-order the nested hidden collections. */ - CollectionChild *child_parent = collection_master->children.first; - Collection *collection_parent = (child_parent) ? child_parent->collection : NULL; - - for (int layer = 0; layer < 20; layer++) { - if (collections[DO_VERSION_COLLECTION_VISIBLE].created & (1 << layer)) { - CollectionChild *hide_child = BLI_findptr( - &collection_parent->children, - collections[DO_VERSION_COLLECTION_HIDE].collections[layer], - offsetof(CollectionChild, collection)); - - if ((collections[DO_VERSION_COLLECTION_HIDE].created & (1 << layer)) && - (hide_child != collection_parent->children.first)) - { - BLI_listbase_swaplinks( - &collection_parent->children, - hide_child, - collection_parent->children.first); - } - - CollectionChild *hide_all_child = BLI_findptr( - &collection_parent->children, - collections[DO_VERSION_COLLECTION_HIDE_ALL].collections[layer], - offsetof(CollectionChild, collection)); - - if ((collections[DO_VERSION_COLLECTION_HIDE_ALL].created & (1 << layer)) && - (hide_all_child != collection_parent->children.last)) - { - BLI_listbase_swaplinks( - &collection_parent->children, - hide_all_child, - collection_parent->children.last); - } - - child_parent = child_parent->next; - collection_parent = (child_parent) ? child_parent->collection : NULL; - } - } - BLI_assert(collection_parent == NULL); - /* Handle legacy render layers. */ bool have_override = false; @@ -577,8 +458,8 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) /* Set exclusion and overrides. */ for (int layer = 0; layer < 20; layer++) { - if (collections[DO_VERSION_COLLECTION_VISIBLE].created & (1 << layer)) { - Collection *collection = collections[DO_VERSION_COLLECTION_VISIBLE].collections[layer]; + Collection *collection = collections[layer]; + if (collection) { LayerCollection *lc = BKE_layer_collection_first_from_scene_collection(view_layer, collection); if (srl->lay_exclude & (1 << layer)) { @@ -612,14 +493,6 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) false); } } - - LayerCollection *nlc = lc->layer_collections.first; - for (int j = 1; j < 4; j++) { - if (collections[j].created & (1 << layer)) { - nlc = nlc->next; - } - } - BLI_assert(nlc == NULL); } } @@ -629,7 +502,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) } for (Base *base = view_layer->object_bases.first; base; base = base->next) { - if ((base->flag & BASE_SELECTABLED) && (base->object->flag & SELECT)) { + if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } } @@ -658,7 +531,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) /* convert selected bases */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { - if ((base->flag & BASE_SELECTABLED) && (base->object->flag & SELECT)) { + if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } @@ -1602,5 +1475,60 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) { + for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_ACTION) { + SpaceAction *saction = (SpaceAction *)sl; + /* "Dopesheet" should be default here, unless it looks like the Action Editor was active instead */ + if ((saction->mode_prev == 0) && (saction->action == NULL)) { + saction->mode_prev = SACTCONT_DOPESHEET; + } + } + } + } + } + } + + for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + if (v3d->drawtype == OB_TEXTURE) { + v3d->drawtype = OB_SOLID; + v3d->shading.light = V3D_LIGHTING_STUDIO; + v3d->shading.color_type = V3D_SHADING_TEXTURE_COLOR; + } + } + } + } + } + + } + + { + if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) { + for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + float alpha = v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE ? 0.0f : 0.8f; + v3d->overlay.texture_paint_mode_opacity = alpha; + v3d->overlay.vertex_paint_mode_opacity = alpha; + v3d->overlay.weight_paint_mode_opacity = alpha; + } + } + } + } + } + + for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { + if (scene->toolsettings->manipulator_flag == 0) { + scene->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; + } + } } } |