Merge with trunk: svn merge -r 12151:12179 https://svn.blender.org/svnroot/bf-blender...
[blender.git] / source / blender / src / transform_generics.c
index cb5b2d057c5f9dfaceb18e9b997a69d3046083f3..ea8555eb7c44233fb5f3688ac753f69687ec3461 100644 (file)
@@ -72,6 +72,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"
@@ -419,8 +420,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(modifiers_isClothEnabled(ob)) {
+                                               cloth_free_modifier(modifiers_isClothEnabled(ob));
+                                       }
+                                       
                                }
                        }
                }
@@ -453,10 +462,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(modifiers_isClothEnabled(ob)) {
+                                       cloth_free_modifier(modifiers_isClothEnabled(ob));
+                               }
                        }
                        
                        /* proxy exception */