[Bf-blender-cvs] [9e9d003a823] master: Render: change view layer name convention to ViewLayer_001 to avoid OpenEXR issues

Brecht Van Lommel noreply at git.blender.org
Tue Oct 19 14:36:25 CEST 2021


Commit: 9e9d003a823f6f9f83c04b6f2493604735d80fe9
Author: Brecht Van Lommel
Date:   Tue Oct 19 14:22:22 2021 +0200
Branches: master
https://developer.blender.org/rB9e9d003a823f6f9f83c04b6f2493604735d80fe9

Render: change view layer name convention to ViewLayer_001 to avoid OpenEXR issues

Some compositing applications do not support spaces and dots in layer names, and change
these to other symbols on import. This causes various compatibility issues, including
with Cryptomatte metadata. While technically those could be considered bugs in the
Cryptomatte implementation of other software, where they are not properly accounting for
that layer renaming, it's not ideal.

The OpenEXR channel naming convention is "layer.pass.channel". We get away with dots in
the layer name since we parse this from right to left, but it's a weak assumption.

Now we don't forbid using spaces or dots, and existing files are unchanged. But at
least by default names will be compatible, and hopefully other software catches up in
time to support more flexible layer names.

Ref T68924

===================================================================

M	source/blender/blenkernel/intern/layer.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_defaults.c

===================================================================

diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 502a4b8c22a..e51442b705d 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -170,7 +170,7 @@ ViewLayer *BKE_view_layer_context_active_PLACEHOLDER(const Scene *scene)
 static ViewLayer *view_layer_add(const char *name)
 {
   if (!name) {
-    name = DATA_("View Layer");
+    name = DATA_("ViewLayer");
   }
 
   ViewLayer *view_layer = MEM_callocN(sizeof(ViewLayer), "View Layer");
@@ -248,7 +248,7 @@ ViewLayer *BKE_view_layer_add(Scene *scene,
   BLI_uniquename(&scene->view_layers,
                  view_layer_new,
                  DATA_("ViewLayer"),
-                 '.',
+                 '_',
                  offsetof(ViewLayer, name),
                  sizeof(view_layer_new->name));
 
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 397bd430fd9..2cb0213a192 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -239,7 +239,7 @@ static void scene_init_data(ID *id)
   /* Master Collection */
   scene->master_collection = BKE_collection_master_add();
 
-  BKE_view_layer_add(scene, "View Layer", NULL, VIEWLAYER_ADD_NEW);
+  BKE_view_layer_add(scene, "ViewLayer", NULL, VIEWLAYER_ADD_NEW);
 }
 
 static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag)
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 2dcb2c35b22..c50b410e2b9 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -294,7 +294,7 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene)
   }
 
   /* Rename render layers. */
-  BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer");
+  BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "ViewLayer");
 
   /* Disable Z pass by default. */
   LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {



More information about the Bf-blender-cvs mailing list