Page MenuHome

Fix T62916: Applying boolean modifier does not set material of new surfaces properly.
AbandonedPublic

Authored by Sebastian Parborg (zeddb) on Mar 25 2019, 4:04 PM.

Details

Summary

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 Timeline

Bastien Montagne (mont29) requested changes to this revision.Mar 25 2019, 4:18 PM

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()?

source/blender/blenkernel/intern/material.c
859–861 ↗(On Diff #14400)

Pretty certain those two changes are fully wrong…

This revision now requires changes to proceed.Mar 25 2019, 4:18 PM

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.

Right, it's much easier to just make sure that we have the objects in the same state.

Sergey Sharybin (sergey) requested changes to this revision.Mar 25 2019, 4:38 PM

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.

This revision now requires changes to proceed.Mar 25 2019, 4:38 PM

I talked to @Sergey Sharybin (sergey) on IRC. It seems like the need to make the active modifier object current.

That's not exactly what i've meant. The BKE_mesh_create_derived_for_modifier is to be called with evaluated object.
Probably easier if i just hijack the fix.