Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_280.c
| Show First 20 Lines • Show All 556 Lines • ▼ Show 20 Lines | for (WorkSpace *workspace = main->workspaces.first; workspace; workspace = workspace->id.next) { | ||||
| * workspace directly, but should be stored there per-scene. */ | * workspace directly, but should be stored there per-scene. */ | ||||
| for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { | for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { | ||||
| if (BLI_findindex(&scene->view_layers, workspace->view_layer) != -1) { | if (BLI_findindex(&scene->view_layers, workspace->view_layer) != -1) { | ||||
| BKE_workspace_view_layer_set(workspace, workspace->view_layer, scene); | BKE_workspace_view_layer_set(workspace, workspace->view_layer, scene); | ||||
| workspace->view_layer = NULL; | workspace->view_layer = NULL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| BLI_assert(workspace->view_layer == NULL); | /* fails when reading workspaces.blend before actually appending */ | ||||
| // BLI_assert(workspace->view_layer == NULL); | |||||
| } | } | ||||
| } | } | ||||
| { | { | ||||
| /* Since we don't have access to FileData we check the (always valid) master collection of the group. */ | /* Since we don't have access to FileData we check the (always valid) master collection of the group. */ | ||||
| for (Group *group = main->group.first; group; group = group->id.next) { | for (Group *group = main->group.first; group; group = group->id.next) { | ||||
| if (group->collection == NULL) { | if (group->collection == NULL) { | ||||
| BKE_group_init(group); | BKE_group_init(group); | ||||
| Show All 21 Lines | for (Group *group = main->group.first; group; group = group->id.next) { | ||||
| } | } | ||||
| GroupObject *go; | GroupObject *go; | ||||
| while ((go = BLI_pophead(&group->gobject))) { | while ((go = BLI_pophead(&group->gobject))) { | ||||
| MEM_freeN(go); | MEM_freeN(go); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| { | |||||
| for (wmWindowManager *wm = main->wm.first; wm; wm = wm->id.next) { | |||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | |||||
| WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); | |||||
| if (workspace->preferred_mode == OB_MODE_OBJECT) { /* Should never be the case! */ | |||||
| const Base *base = BKE_workspace_active_base_get(workspace, win->scene); | |||||
| if (!base) { | |||||
| /* skip */ | |||||
| } | |||||
| else if (base->object->mode == OB_MODE_OBJECT) { | |||||
| workspace->preferred_mode = (base->object->restore_mode == OB_MODE_OBJECT) ? | |||||
| OB_MODE_EDIT : base->object->restore_mode; | |||||
| } | |||||
| else { | |||||
| workspace->preferred_mode = base->object->mode; | |||||
| workspace->flags |= WORKSPACE_USE_PREFERED_MODE; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| for (WorkSpace *workspace = main->workspaces.first; workspace; workspace = workspace->id.next) { | |||||
| if (workspace->preferred_mode == OB_MODE_OBJECT) { /* Should never be the case! */ | |||||
| workspace->preferred_mode = OB_MODE_EDIT; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| static void do_version_layer_collections_idproperties(ListBase *lb) | static void do_version_layer_collections_idproperties(ListBase *lb) | ||||
| { | { | ||||
| IDPropertyTemplate val = {0}; | IDPropertyTemplate val = {0}; | ||||
| for (LayerCollection *lc = lb->first; lc; lc = lc->next) { | for (LayerCollection *lc = lb->first; lc; lc = lc->next) { | ||||
| lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP); | lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP); | ||||
| BKE_layer_collection_engine_settings_create(lc->properties); | BKE_layer_collection_engine_settings_create(lc->properties); | ||||
| ▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines | |||||