Page MenuHome

Shrinkwrap modifier with proyect not working in curves
Closed, ResolvedPublicBUG


System Information
Operating system: Windows-10-10.0.17134 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.64

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: rBf6cb5f54494e
Worked: (optional)

Short description of error
Hello, I´m trying to retopo cylinders using curves but when I use the option "project" the modifier just don't work, the other options works correctly

Exact steps for others to reproduce the error
Create a cylinder and scale it in Z axis until it looks like a pencil or similar, then create a curve (bezier or path) with the same direction of the cylinder and add some depth in the geometry panel of the curve until it fits the shape of the cylinder (a little bit inside), then add a shrinkwrap modifier to the curve and select the cylinder as target, then change the mode to proyect and the shrinkwrap will stop working.

Event Timeline

Thanks for the report.
Sorry for the delay in replying.
Can you provide a simple .blend file showing the problem?
This makes the investigation simpler.

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Jan 7 2020, 12:40 PM

Can confirm.

Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".Jan 7 2020, 12:45 PM

This appears to be working in 2.79.

This seems to doing the trick:

3diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
4index a2699e767e9..7fe3842e3e4 100644
5--- a/source/blender/blenkernel/intern/shrinkwrap.c
6+++ b/source/blender/blenkernel/intern/shrinkwrap.c
7@@ -659,6 +659,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
8 /* Prepare data to retrieve the direction in which we should project each vertex */
9 if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
10 if (calc->vert == NULL) {
11+ /* this will happen for curves. */
12 return;
13 }
14 }
15diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
16index b8d0b19b7bf..48bdb5361aa 100644
17--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
18+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
19@@ -108,8 +108,11 @@ static void deformVerts(ModifierData *md,
20 struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
21 Mesh *mesh_src = NULL;
23- if (ctx->object->type == OB_MESH) {
24+ /* rB4cde92303f3db9286b38d65d835db3e358b595f4 made this MESH only */
25+ /* Seems to work fine for curves though. */
26+ if (ELEM(ctx->object->type, OB_MESH, OB_CURVE)) {
27 /* mesh_src is only needed for vgroups. */
28+ /* Nope, also needed for MOD_SHRINKWRAP_PROJECT 'calc.vert' in shrinkwrapModifier_deform() */
29 mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
30 }

CC @Bastien Montagne (mont29)
CC @Germano Cavalcante (mano-wii)

The patch looks ok, (if the regression was caused only by rB4cde92303f3d).
Getting mesh_src through MOD_deform_mesh_eval_get instead of ctx->object->data should already solve that other problem.

It would only improve the comments, (both new and existing).