The problem was that we compared material pointers previously. On apply, the material pointers got out of sync between objects (CoW).
As all material names have to be unique either way, the function now looks at the names instead of the pointers.
Differential D4587
Fix T62916: Applying boolean modifier does not set material of new surfaces properly. Authored by Sebastian Parborg (zeddb) on Mar 25 2019, 4:04 PM.
Details The problem was that we compared material pointers previously. On apply, the material pointers got out of sync between objects (CoW). As all material names have to be unique either way, the function now looks at the names instead of the pointers.
Diff Detail Event TimelineComment Actions You cannot use material name alone, linked materials from different libraries can have same names… you need to use a pair (mat->id.name, mat->id.lib->id.name) e.g. to ensure you do have unique keys (or maybe concatenate those two ID names in a single string somehow). But wouldn’t it be possible to just ensure you get orig mat pointers instead? Using DEG_get_original_id()?
Comment Actions Comparing names is not strictly correct, datablocks from different libraries can have the same name. I would expect this function to get two CoW objects with pointers to CoW materials that can be compared? I don't think you'd even have to get original pointers. Comment Actions Right, it's much easier to just make sure that we have the objects in the same state. Comment Actions it is only allowed to go from evaluated to original one from an active dependency graph. Doing it otherwise violates the whole idea of clear separation of original and evaluated data. Comment Actions I talked to @Sergey Sharybin (sergey) on IRC. It seems like the need to make the active modifier object current. Comment Actions That's not exactly what i've meant. The BKE_mesh_create_derived_for_modifier is to be called with evaluated object. | ||||||