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:
authorJacques Lucke <jacques@blender.org>2021-05-19 11:23:09 +0300
committerJacques Lucke <jacques@blender.org>2021-05-19 11:23:09 +0300
commit1a81d268a19f2f1402f408ad1dadf92c7a399607 (patch)
treed3f1b657efc1676b6b1f4b1cc34b4623529c379c /source/blender/draw/engines/overlay/overlay_gpencil.c
parentd373b43f07f5403826035b5dee71b09f433b0540 (diff)
Materials: support changing materials during evaluation
This commit allows that the evaluated geometry of an object has different materials from the original geometry. This is needed for geometry nodes. The main thing that changes for render engines and exporters is that the number of material slots on an object and its geometry might not match anymore. For original data, the slot counts are still equal, but not for evaluated data. Accessing material slots though rna stays the same. The behavior adapts automatically depending on whether the object is evaluated. When accessing materials of an object through `BKE_object_material_*` one has to use a new api for evaluated objects: `BKE_object_material_get_eval` and `BKE_object_material_count_eval`. In the future, the different behavior might be hidden behind a more general C api, but that would require quite a few more changes. The ground truth for the number of materials is the number of materials on the geometry now. This is important in the current design, because Eevee needs to know the number of materials just based on the mesh in `mesh_render_mat_len_get` and similar places. In a few places I had to add a special case for mesh edit mode to get it to work properly. This is unfortunate, but I don't see a way around that for now. Differential Revision: https://developer.blender.org/D11236
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_gpencil.c')
-rw-r--r--source/blender/draw/engines/overlay/overlay_gpencil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index 891142fe0a2..aa26aa47faa 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -382,7 +382,7 @@ static void overlay_gpencil_draw_stroke_color_name(bGPDlayer *UNUSED(gpl),
void *thunk)
{
Object *ob = (Object *)thunk;
- Material *ma = BKE_object_material_get(ob, gps->mat_nr + 1);
+ Material *ma = BKE_object_material_get_eval(ob, gps->mat_nr + 1);
if (ma == NULL) {
return;
}