svn merge -r 12937:13095 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender-staging.git] / source / blender / src / transform_generics.c
index b24f9bea48d3fa14d2fb4725545fa8c4e8216d45..a79b1d4c4ea87ee7bee81da9c3089ed629962ff6 100644 (file)
@@ -74,6 +74,7 @@
 #include "BKE_action.h"
 #include "BKE_anim.h"
 #include "BKE_armature.h"
+#include "BKE_cloth.h"
 #include "BKE_curve.h"
 #include "BKE_depsgraph.h"
 #include "BKE_displist.h"
@@ -467,8 +468,16 @@ void recalcData(TransInfo *t)
                        /* bah, softbody exception... recalcdata doesnt reset */
                        for(base= FIRSTBASE; base; base= base->next) {
                                if(base->object->recalc & OB_RECALC_DATA)
+                               {                                       
+                                       ClothModifierData *clmd = NULL;
+                                       
                                        if(modifiers_isSoftbodyEnabled(base->object)) {
                                                base->object->softflag |= OB_SB_REDO;
+                                       }
+                                       else if((clmd = (ClothModifierData *)modifiers_isClothEnabled(ob))) {
+                                               cloth_free_modifier(clmd);
+                                       }
+                                       
                                }
                        }
                }
@@ -504,10 +513,17 @@ void recalcData(TransInfo *t)
                                }                               
                        }
                        
-                       /* softbody exception */
-                       if(modifiers_isSoftbodyEnabled(ob)) {
-                               if(ob->recalc & OB_RECALC_DATA)
-                                       ob->softflag |= OB_SB_REDO;
+                       /* softbody & cloth exception */
+                       if(ob->recalc & OB_RECALC_DATA)
+                       {
+                               ClothModifierData *clmd = NULL;
+                               
+                               if(modifiers_isSoftbodyEnabled(ob)) {
+                                               ob->softflag |= OB_SB_REDO;
+                               }
+                               else if((clmd = (ClothModifierData *)modifiers_isClothEnabled(ob))) {
+                                       cloth_free_modifier(clmd);
+                               }
                        }
                        
                        /* proxy exception */