Page MenuHome

Fix T79714: Projecting texture from camera fails
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Aug 14 2020, 3:19 PM.

Details

Summary

Fix T79714: Wrong result when projecting texture from camera on object with modifier..

The evaluated mesh is now only recomputed when the required data layers are missing. Previously the evaluated mesh was re-evaluated incorrectly, which caused the stippled result and the failing assert.

Since now only the evaluated mesh is used, and never a temporary mesh, there is also no more need to keep track of whether the mesh needs freeing or not.

Diff Detail

Repository
rB Blender
Branch
temp-T79714-uv-project-texture (branched from master)
Build Status
Buildable 9524
Build 9524: arc lint + arc unit

Event Timeline

Sybren A. Stüvel (sybren) requested review of this revision.Aug 14 2020, 3:20 PM
Sybren A. Stüvel (sybren) edited the summary of this revision. (Show Details)
Sybren A. Stüvel (sybren) edited the summary of this revision. (Show Details)
Sergey Sharybin (sergey) requested changes to this revision.Aug 17 2020, 9:24 AM

I suggest we follow Git's style for wording in the commit message [1], namely:

Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour.

Otherwise it sounds somewhat ambiguous. For example, "This does require reevaluating the geometry after the painting is done". Does it mean that the change causes re-evaluation? Or the eval_reset() requires to add re-evaluation somewhere?

[1] https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/SubmittingPatches?id=HEAD

source/blender/editors/sculpt_paint/paint_image_proj.c
4033–4034

Does this work correctly if the mesh already had all the custom data layers in it?

Maybe state explicitly in the comment to BKE_object_eval_reset() what happens in this case.

And maybe look into avoiding mesh re-evaluation here if it has all the data already. Could be done by making it so mesh_get_eval_final() does re-set prior to re-evaluation (as re-evaluation without reset is meaningless anyway).

4043

create always creates mesh, so you are the one who is responsible for freeing it.

4640–4641

How often project_paint_end is called?
Tagging geometry for update in painting modes is something you should be doing with absolute care.

This revision now requires changes to proceed.Aug 17 2020, 9:24 AM

New approach after things were clarified in rBfc5eab357009

From reading looks good. Don't see anything obviously wrong.
No need for geometry tag either?

This revision is now accepted and ready to land.Aug 18 2020, 3:48 PM

No need for geometry tag either?

Nope, it all just keeps working like this. Because now the BKE_object_eval_reset(ob_eval); (which we had in an earlier version of this patch) is no longer necessary, no info is thrown away, so no need to recompute either.