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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-12 12:28:49 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-18 20:38:20 +0300
commit1c815e0826518adc69bc3888e18f52991e8774f7 (patch)
treee82f0ee122f9fa56be40e015069836b3d33dd73d /source/blender/blenloader/intern/versioning_defaults.c
parent84f21c170dda9e503de440c20bc2753002987901 (diff)
Workspaces: move 2D Animation, VFX and Video workspaces into own templates.
These can now be acessed from the File > New, Ctrl+N, or the splash screen. Since these are application templates, users can save a separate startup.blend for each. User preferences are shared between these templates though. This also fixes some issues in the default startup.blend (triangulated cube..). Differential Revision: https://developer.blender.org/D3690
Diffstat (limited to 'source/blender/blenloader/intern/versioning_defaults.c')
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c117
1 files changed, 31 insertions, 86 deletions
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index abbc8f4c4a4..d783d1d54f4 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -74,54 +74,9 @@ void BLO_update_defaults_userpref_blend(void)
/**
* Update defaults in startup.blend, without having to save and embed the file.
* This function can be emptied each time the startup.blend is updated. */
-void BLO_update_defaults_startup_blend(Main *bmain)
+void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
{
- for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
- const char *name = workspace->id.name + 2;
-
- if (STREQ(name, "Modeling")) {
- workspace->order = 0;
- }
- else if (STREQ(name, "Sculpting")) {
- workspace->object_mode = OB_MODE_SCULPT;
- workspace->order = 1;
- }
- else if (STREQ(name, "UV Editing")) {
- workspace->object_mode = OB_MODE_EDIT;
- workspace->order = 2;
- }
- else if (STREQ(name, "Texture Paint")) {
- workspace->object_mode = OB_MODE_TEXTURE_PAINT;
- workspace->order = 3;
- }
- else if (STREQ(name, "Shading")) {
- workspace->order = 4;
- }
- else if (STREQ(name, "3D Animation")) {
- workspace->object_mode = OB_MODE_POSE;
- workspace->order = 5;
- }
- else if (STREQ(name, "Rendering")) {
- workspace->order = 6;
- }
- else if (STREQ(name, "Compositing")) {
- workspace->order = 7;
- }
- else if (STREQ(name, "2D Animation")) {
- workspace->object_mode = OB_MODE_GPENCIL_PAINT;
- workspace->order = 8;
- }
- else if (STREQ(name, "Video Editing")) {
- workspace->order = 9;
- }
- else if (STREQ(name, "Motion Tracking")) {
- workspace->order = 10;
- }
- else if (STREQ(name, "Scripting")) {
- workspace->order = 11;
- }
- }
-
+ /* For all startup.blend files. */
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
@@ -134,53 +89,43 @@ void BLO_update_defaults_startup_blend(Main *bmain)
ar->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
-
- if (area->spacetype == SPACE_FILE) {
- SpaceFile *sfile = area->spacedata.first;
-
- if (sfile->params) {
- if (STREQ(screen->id.name, "SRDefault.003")) {
- /* Shading. */
- sfile->params->filter = FILE_TYPE_FOLDER |
- FILE_TYPE_IMAGE;
- }
- else {
- /* Video Editing. */
- sfile->params->filter = FILE_TYPE_FOLDER |
- FILE_TYPE_IMAGE |
- FILE_TYPE_MOVIE |
- FILE_TYPE_SOUND;
- }
- }
- }
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
- BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
+ /* For 2D animation template. */
+ if (app_template && STREQ(app_template, "2D Animation")) {
+ for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
+ const char *name = workspace->id.name + 2;
- scene->r.cfra = 1.0f;
-
- /* Don't enable compositing nodes. */
- if (scene->nodetree) {
- ntreeFreeTree(scene->nodetree);
- MEM_freeN(scene->nodetree);
- scene->nodetree = NULL;
- scene->use_nodes = false;
+ if (STREQ(name, "Drawing")) {
+ workspace->object_mode = OB_MODE_GPENCIL_PAINT;
+ }
}
+ }
- /* Select only cube by default. */
- for (ViewLayer *layer = scene->view_layers.first; layer; layer = layer->next) {
- for (Base *base = layer->object_bases.first; base; base = base->next) {
- if (STREQ(base->object->id.name + 2, "Cube")) {
- base->flag |= BASE_SELECTED;
- }
- else {
- base->flag &= ~BASE_SELECTED;
- }
+ /* For all builtin templates shipped with Blender. */
+ bool builtin_template = !app_template ||
+ STREQ(app_template, "2D_Animation") ||
+ STREQ(app_template, "VFX") ||
+ STREQ(app_template, "Video_Editing");
+
+ if (builtin_template) {
+ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
+
+ scene->r.cfra = 1.0f;
+ scene->r.displaymode = R_OUTPUT_WINDOW;
+
+ /* Don't enable compositing nodes. */
+ if (scene->nodetree) {
+ ntreeFreeTree(scene->nodetree);
+ MEM_freeN(scene->nodetree);
+ scene->nodetree = NULL;
+ scene->use_nodes = false;
}
- BKE_layer_collection_sync(scene, layer);
+ /* Rename render layers. */
+ BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer");
}
}
}