Change in behavior to shrinkwrap modifier's offset value with negative enabled.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 8 Feb 2011 02:09:59 +0000 (02:09 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 8 Feb 2011 02:09:59 +0000 (02:09 +0000)
- negative ray casts would invert the offset direction.
  this meant if positive and negative were enabled at once and the mesh was slightly inside & outside the object it wrapped,
  the offset would be applied in opposite directions.
  This way the offset is always along the vertex normal.

- allow negative offset from RNA, could be useful and no benefit to disable.

source/blender/blenkernel/intern/shrinkwrap.c
source/blender/makesrna/intern/rna_modifier.c

index 75a955a..48d9a4e 100644 (file)
@@ -378,9 +378,6 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
                                        normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
 
                                normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
-
-                               if(hit.index != -1)
-                                       madd_v3_v3v3fl(hit.co, hit.co, tmp_no, -calc->keepDist);
                        }
 
                        //Project over negative direction of axis
@@ -393,14 +390,12 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
                                        normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
 
                                normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
-
-                               if(hit.index != -1)
-                                       madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist);
                        }
 
 
                        if(hit.index != -1)
                        {
+                               madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist);
                                interp_v3_v3v3(co, co, hit.co, weight);
                        }
                }
index 33a6856..15da48a 100644 (file)
@@ -1900,11 +1900,11 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
        RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_set");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
-       
+
        prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "keepDist");
-       RNA_def_property_range(prop, 0, FLT_MAX);
-       RNA_def_property_ui_range(prop, 0, 100, 1, 2);
+       RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+       RNA_def_property_ui_range(prop, -100, 100, 1, 2);
        RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");