Blender Git Loki
Git Commits -> Revision 1a81d26
Revision 1a81d26 by Jacques Lucke (master) May 19, 2021, 08:23 (GMT) |
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 |
Commit Details:
Full Hash: 1a81d268a19f2f1402f408ad1dadf92c7a399607
Parent Commit: d373b43
Lines Changed: +164, -30
14 Modified Paths:
/source/blender/blenkernel/BKE_material.h (+5, -0) (Diff)
/source/blender/blenkernel/intern/material.c (+68, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_cryptomatte.c (+3, -5) (Diff)
/source/blender/draw/engines/eevee/eevee_materials.c (+1, -1) (Diff)
/source/blender/draw/engines/eevee/eevee_volumes.c (+1, -1) (Diff)
/source/blender/draw/engines/gpencil/gpencil_cache_utils.c (+2, -1) (Diff)
/source/blender/draw/engines/gpencil/gpencil_draw_data.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_gpencil.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_paint.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_particle.c (+1, -1) (Diff)
/source/blender/draw/engines/workbench/workbench_materials.c (+1, -1) (Diff)
/source/blender/draw/engines/workbench/workbench_volume.c (+1, -1) (Diff)
/source/blender/draw/intern/draw_cache_extract.h (+4, -0) (Diff)
/source/blender/makesrna/intern/rna_object.c (+74, -16) (Diff)
/source/blender/blenkernel/intern/material.c (+68, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_cryptomatte.c (+3, -5) (Diff)
/source/blender/draw/engines/eevee/eevee_materials.c (+1, -1) (Diff)
/source/blender/draw/engines/eevee/eevee_volumes.c (+1, -1) (Diff)
/source/blender/draw/engines/gpencil/gpencil_cache_utils.c (+2, -1) (Diff)
/source/blender/draw/engines/gpencil/gpencil_draw_data.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_gpencil.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_paint.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/overlay_particle.c (+1, -1) (Diff)
/source/blender/draw/engines/workbench/workbench_materials.c (+1, -1) (Diff)
/source/blender/draw/engines/workbench/workbench_volume.c (+1, -1) (Diff)
/source/blender/draw/intern/draw_cache_extract.h (+4, -0) (Diff)
/source/blender/makesrna/intern/rna_object.c (+74, -16) (Diff)