Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 30 Nov 2017 14:11:06 +0000 (15:11 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 30 Nov 2017 14:11:06 +0000 (15:11 +0100)
1  2 
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_snap_object.c
source/blender/makesdna/DNA_object_types.h

index d2c48c4aea00a03df600a04d4a423a1f87186815,34cc143f3a9816c66b1aa76b4e51af96338e39db..5e8c2e2c09acd7e6bf4db049b86b47a561a7b906
@@@ -1890,10 -1905,9 +1890,9 @@@ static void createTransParticleVerts(bC
  {
        TransData *td = NULL;
        TransDataExtension *tx;
-       Base *base = CTX_data_active_base(C);
        Object *ob = CTX_data_active_object(C);
        ParticleEditSettings *pset = PE_settings(t->scene);
 -      PTCacheEdit *edit = PE_get_current(t->scene, ob);
 +      PTCacheEdit *edit = PE_get_current(t->scene, t->view_layer, ob);
        ParticleSystem *psys = NULL;
        ParticleSystemModifierData *psmd = NULL;
        PTCacheEditPoint *point;
@@@ -5611,11 -5607,10 +5608,10 @@@ static void set_trans_object_base_flags
  
        /* and we store them temporal in base (only used for transform code) */
        /* this because after doing updates, the object->recalc is cleared */
 -      for (base = scene->base.first; base; base = base->next) {
 +      for (base = view_layer->object_bases.first; base; base = base->next) {
-               if (base->object->recalc & OB_RECALC_OB)
-                       base->flag_legacy |= BA_HAS_RECALC_OB;
-               if (base->object->recalc & OB_RECALC_DATA)
-                       base->flag_legacy |= BA_HAS_RECALC_DATA;
+               if (base->object->recalc & (OB_RECALC_OB | OB_RECALC_DATA)) {
+                       base->flag |= BA_SNAP_FIX_DEPS_FIASCO;
+               }
        }
  }
  
@@@ -5695,11 -5685,10 +5691,10 @@@ static int count_proportional_objects(T
  
        /* and we store them temporal in base (only used for transform code) */
        /* this because after doing updates, the object->recalc is cleared */
 -      for (base = scene->base.first; base; base = base->next) {
 +      for (base = view_layer->object_bases.first; base; base = base->next) {
-               if (base->object->recalc & OB_RECALC_OB)
-                       base->flag_legacy |= BA_HAS_RECALC_OB;
-               if (base->object->recalc & OB_RECALC_DATA)
-                       base->flag_legacy |= BA_HAS_RECALC_DATA;
+               if (base->object->recalc & (OB_RECALC_OB | OB_RECALC_DATA)) {
+                       base->flag |= BA_SNAP_FIX_DEPS_FIASCO;
+               }
        }
  
        return total;
  
  static void clear_trans_object_base_flags(TransInfo *t)
  {
 -      Scene *sce = t->scene;
 +      ViewLayer *view_layer = t->view_layer;
        Base *base;
  
 -      for (base = sce->base.first; base; base = base->next) {
 -              if (base->flag & BA_WAS_SEL)
 -                      base->flag |= SELECT;
 +      for (base = view_layer->object_bases.first; base; base = base->next) {
 +              if (base->flag_legacy & BA_WAS_SEL) {
 +                      base->flag |= BASE_SELECTED;
 +              }
  
-               base->flag_legacy &= ~(BA_WAS_SEL | BA_HAS_RECALC_OB | BA_HAS_RECALC_DATA | BA_TEMP_TAG | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT);
 -              base->flag &= ~(BA_WAS_SEL | BA_SNAP_FIX_DEPS_FIASCO | BA_TEMP_TAG | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT);
++              base->flag_legacy &= ~(BA_WAS_SEL | BA_SNAP_FIX_DEPS_FIASCO | BA_TEMP_TAG | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT);
        }
  }
  
index d92417ec68ac7db6a97f291efb7fc2a47d3810ba,63bdf3ac0108fca6d56fe5ef5b74d9609941dbfb..ce8de2ef4d3645d4cce426e0a1719ca9f271d408
@@@ -160,19 -155,11 +160,10 @@@ static void iter_snap_objects
          IterSnapObjsCallback sob_callback,
          void *data)
  {
 -      Base *base_act = sctx->scene->basact;
 -      for (Base *base = sctx->scene->base.first; base != NULL; base = base->next) {
 -              if ((BASE_VISIBLE_BGMODE(sctx->v3d_data.v3d, sctx->scene, base)) &&
 -                  (base->flag & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
 -                  !((snap_select == SNAP_NOT_SELECTED && (base->flag & (SELECT | BA_WAS_SEL))) ||
 +      Base *base_act = sctx->eval_ctx.view_layer->basact;
-       /* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
-        * which makes the loop skip it, even the derived mesh will never change
-        *
-        * To solve that problem, we do it first as an exception.
-        * */
-       if (base_act && base_act->object && base_act->object->mode & OB_MODE_PARTICLE_EDIT) {
-               sob_callback(sctx, false, base_act->object, base_act->object->obmat, data);
-       }
 +      for (Base *base = sctx->eval_ctx.view_layer->object_bases.first; base != NULL; base = base->next) {
-               if ((BASE_VISIBLE(base)) && (base->flag_legacy & (BA_HAS_RECALC_OB | BA_HAS_RECALC_DATA)) == 0 &&
++              if ((BASE_VISIBLE(base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
 +                  !((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
                      (snap_select == SNAP_NOT_ACTIVE && base == base_act)))
                {
                        bool use_obedit;