Page MenuHome

Various problems with CD layers and tesselation, related to modifiers stack
Closed, ResolvedPublic

Description

Relates to: T30234 T30266 T29451

Hi Andrew, posting here as Campbell advised me you were the guy for this area, and I couldn’t catch you on IRC.

To see the problem, simply open the default scene and switch to Weight Paint mode. Instead of a blue cube, you get a black one.

You can find similar problems in various modifiers setup involving custom data layers (e.g. dynapaint’s demos, weightvg’s demos, an UVProject after a subsurf, etc.).

First part of the problem is that, at the end of the mod stack func (mesh_calc_modifiers), the finaldm is only re-tesselated if it has no tessfaces already.

So I coded a function to only update CD layers, without re-tesselating, to catch that kind of situations. And there I faced another one: quite often, finaldm has tessfaces, but no CD_POLYINDEX layer, which I think is a bug. This happens e.g. because subsurf (i.e. CCGDM) does not generate that layer currently when it does its own tesselation, and also because that layer was not protected during copying of dm in stack evaluation…

The attached patch addresses all the problems I could find out, but I finally wonder if we shouldn’t just unconditionally retesselate at the end of the mod stack? Or else, review all modifiers that actually affect topology, so that they really invalidate tesselated data (or just do it as soon as we have a constructive one in stack)?

Details

Type
Bug

Event Timeline

As a side note, it should also fix [#29451].

Moved from BMesh Branch 2.6x Bug Trackers to Blender 2.6 Bug Tracker

Updated patch against 44275 of trunk, and moving that bug into main tracker!

Discussed with Bastien

requested that we have a flag in DM so that tessface data can be tagged as out of date so its not recalculated always (would slow down subsurf a lot I would think).

Updated patch to r44744, adding a dirty enum flag to DM (this way, wae can easily add other dirty flags later, if needed).

Side note: I’m not sure it’s related, but we still have problems with particules and subsurf modifier (i.e. dynapaint demo works well and gets nice weight preview, but not particles, as long as subsurf is there)… :/

@Bastien
Yes, hard to say if that is related or not. Particles or hair don't work at all if there is a subsurf modifier and dynamic paint in the stack earlier, weights seem to have nothing to do with it. Also it seems to be very random - just changing the subsurf level randomly works. After short investigation I have no idea why that is happening. :s

Updated patch against r44907, and removed customdata changes.

Patch committed as r44978, closing.