Commit: 95d8653c084df8c96fc052cbbb33eb501b428b21
Author: Lukas Tönne
Date:   Mon Jan 8 11:09:03 2018 +0000
Branches: hair_guides
https://developer.blender.org/rB95d8653c084df8c96fc052cbbb33eb501b428b21

Disable rebinding during every update to prevent invalidating transform data.

===================================================================

M       source/blender/blenkernel/BKE_groom.h
M       source/blender/blenkernel/intern/groom.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_groom.h 
b/source/blender/blenkernel/BKE_groom.h
index 5ccc42de36a..5bd07625937 100644
--- a/source/blender/blenkernel/BKE_groom.h
+++ b/source/blender/blenkernel/BKE_groom.h
@@ -57,9 +57,9 @@ void BKE_groom_boundbox_calc(struct Groom *groom, float 
r_loc[3], float r_size[3
 /* === Scalp regions === */
 
 /* Try to bind bundles to their scalp regions */
-void BKE_groom_bind_scalp_regions(struct Groom *groom);
+void BKE_groom_bind_scalp_regions(struct Groom *groom, bool force_rebind);
 
-bool BKE_groom_bundle_bind(struct Groom *groom, struct GroomBundle *bundle);
+bool BKE_groom_bundle_bind(struct Groom *groom, struct GroomBundle *bundle, 
bool force_rebind);
 void BKE_groom_bundle_unbind(struct GroomBundle *bundle);
 
 
diff --git a/source/blender/blenkernel/intern/groom.c 
b/source/blender/blenkernel/intern/groom.c
index 7eaab2d2039..0ebead14261 100644
--- a/source/blender/blenkernel/intern/groom.c
+++ b/source/blender/blenkernel/intern/groom.c
@@ -246,20 +246,20 @@ void BKE_groom_boundbox_calc(Groom *groom, float 
r_loc[3], float r_size[3])
 
 /* === Scalp regions === */
 
-void BKE_groom_bind_scalp_regions(Groom *groom)
+void BKE_groom_bind_scalp_regions(Groom *groom, bool force_rebind)
 {
        if (groom->editgroom)
        {
                for (GroomBundle *bundle = groom->editgroom->bundles.first; 
bundle; bundle = bundle->next)
                {
-                       BKE_groom_bundle_bind(groom, bundle);
+                       BKE_groom_bundle_bind(groom, bundle, force_rebind);
                }
        }
        else
        {
                for (GroomBundle *bundle = groom->bundles.first; bundle; bundle 
= bundle->next)
                {
-                       BKE_groom_bundle_bind(groom, bundle);
+                       BKE_groom_bundle_bind(groom, bundle, force_rebind);
                }
        }
 }
@@ -458,8 +458,13 @@ finalize:
        return result;
 }
 
-bool BKE_groom_bundle_bind(Groom *groom, GroomBundle *bundle)
+bool BKE_groom_bundle_bind(Groom *groom, GroomBundle *bundle, bool 
force_rebind)
 {
+       if (bundle->scalp_region && !force_rebind)
+       {
+               return true;
+       }
+       
        BKE_groom_bundle_unbind(bundle);
        if (!groom->scalp_object)
        {
@@ -750,7 +755,7 @@ void BKE_groom_eval_geometry(const EvaluationContext 
*UNUSED(eval_ctx), Groom *g
                printf("%s on %s\n", __func__, groom->id.name);
        }
        
-       BKE_groom_bind_scalp_regions(groom);
+       BKE_groom_bind_scalp_regions(groom, false);
        
        if (groom->bb == NULL || (groom->bb->flag & BOUNDBOX_DIRTY)) {
                BKE_groom_boundbox_calc(groom, NULL, NULL);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to