Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 13 Jun 2018 13:36:24 +0000 (15:36 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 13 Jun 2018 13:36:24 +0000 (15:36 +0200)
Conflicts:
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/pointcache.c
source/blender/editors/include/ED_particle.h
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_edit_undo.c
source/blender/editors/physics/particle_object.c
source/blender/editors/physics/physics_intern.h
source/blender/editors/physics/physics_pointcache.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blenderplayer/bad_level_call_stubs/stubs.c

1  2 
source/blender/blenkernel/BKE_pointcache.h
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_edit_undo.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/makesrna/intern/rna_sculpt_paint.c

@@@ -277,8 -274,8 +277,9 @@@ void BKE_ptcache_id_from_smoke(PTCacheI
  void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, struct Object *ob, struct DynamicPaintSurface *surface);
  void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, struct Object *ob, struct RigidBodyWorld *rbw);
  
- void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis);
 +PTCacheID BKE_ptcache_id_find(struct Object *ob, struct Scene *scene, struct PointCache *cache);
 -        struct Main *bmain, struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis);
+ void BKE_ptcache_ids_from_object(
++        struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis);
  
  /***************** Global funcs ****************************/
  void BKE_ptcache_remove(void);
  #include "BKE_DerivedMesh.h"
  #include "BKE_global.h"
  #include "BKE_object.h"
 +#include "BKE_library.h"
+ #include "BKE_main.h"
  #include "BKE_mesh.h"
 +#include "BKE_mesh_runtime.h"
  #include "BKE_modifier.h"
  #include "BKE_particle.h"
  #include "BKE_report.h"
@@@ -114,10 -105,10 +115,10 @@@ int PE_hair_poll(bContext *C
        Object *ob= CTX_data_active_object(C);
        PTCacheEdit *edit;
  
 -      if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
 +      if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) {
                return 0;
 -
 -      edit= PE_get_current(bmain, scene, ob);
 +      }
-       edit= PE_get_current(scene, ob);
++      edit = PE_get_current(scene, ob);
  
        return (edit && edit->psys);
  }
@@@ -362,15 -331,14 +363,16 @@@ static int pe_x_mirror(Object *ob
  
  typedef struct PEData {
        ViewContext vc;
 -      bglMats mats;
  
 +      const bContext *context;
+       Main *bmain;
        Scene *scene;
 +      ViewLayer *view_layer;
        Object *ob;
 -      DerivedMesh *dm;
 +      Mesh *mesh;
        PTCacheEdit *edit;
        BVHTreeFromMesh shape_bvh;
 +      Depsgraph *depsgraph;
  
        const int *mval;
        rcti *rect;
@@@ -400,11 -368,10 +402,12 @@@ static void PE_set_data(bContext *C, PE
  {
        memset(data, 0, sizeof(*data));
  
 -      data->scene= CTX_data_scene(C);
 -      data->ob= CTX_data_active_object(C);
 -      data->edit= PE_get_current(data->bmain, data->scene, data->ob);
+       data->bmain = CTX_data_main(C);
 +      data->scene = CTX_data_scene(C);
 +      data->view_layer = CTX_data_view_layer(C);
 +      data->ob = CTX_data_active_object(C);
 +      data->depsgraph = CTX_data_depsgraph(C);
 +      data->edit = PE_get_current(data->scene, data->ob);
  }
  
  static void PE_set_view3d_data(bContext *C, PEData *data)
@@@ -1657,9 -1624,7 +1658,7 @@@ static int select_random_exec(bContext 
  
        PE_set_data(C, &data);
        data.select_action = SEL_SELECT;
-       scene = CTX_data_scene(C);
-       ob = CTX_data_active_object(C);
-       edit = PE_get_current(scene, ob);
 -      edit = PE_get_current(data.bmain, data.scene, data.ob);
++      edit = PE_get_current(data.scene, data.ob);
  
        rng = BLI_rng_new_srandom(seed);
  
@@@ -3798,8 -3751,8 +3797,9 @@@ static int brush_edit_init(bContext *C
  
  static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
  {
+       Main *bmain = CTX_data_main(C);
        BrushEdit *bedit= op->customdata;
 +      Depsgraph *depsgraph = CTX_data_depsgraph(C);
        Scene *scene= bedit->scene;
        Object *ob= bedit->ob;
        PTCacheEdit *edit= bedit->edit;
@@@ -4678,8 -4603,7 +4678,7 @@@ static int unify_length_exec(bContext *
        }
        scale_points_to_length(edit, average_length);
  
 -      PE_update_object(bmain, scene, ob, 1);
 +      PE_update_object(depsgraph, scene, ob, 1);
        if (edit->psys) {
                WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
        }
  #include "BLI_string.h"
  #include "BLI_utildefines.h"
  
 -#include "BKE_depsgraph.h"
 -#include "BKE_main.h"
+ #include "BKE_context.h"
  #include "BKE_particle.h"
  #include "BKE_pointcache.h"
- #include "BKE_context.h"
  #include "BKE_undo_system.h"
  
 +#include "DEG_depsgraph.h"
 +
  #include "ED_object.h"
  #include "ED_particle.h"
  #include "ED_physics.h"
@@@ -2119,52 -2025,49 +2119,51 @@@ static void createTransParticleVerts(bC
  
  void flushTransParticles(TransInfo *t)
  {
 -      Main *bmain = CTX_data_main(t->context);
 -      Scene *scene = t->scene;
 -      Object *ob = OBACT;
 -      PTCacheEdit *edit = PE_get_current(bmain, scene, ob);
 -      ParticleSystem *psys = edit->psys;
 -      ParticleSystemModifierData *psmd = NULL;
 -      PTCacheEditPoint *point;
 -      PTCacheEditKey *key;
 -      TransData *td;
 -      float mat[4][4], imat[4][4], co[3];
 -      int i, k;
 -      const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
 -
 -      if (psys)
 -              psmd = psys_get_modifier(ob, psys);
 -
 -      /* we do transform in world space, so flush world space position
 -       * back to particle local space (only for hair particles) */
 -      td = t->data;
 -      for (i = 0, point = edit->points; i < edit->totpoint; i++, point++, td++) {
 -              if (!(point->flag & PEP_TRANSFORM)) continue;
 -
 -              if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 -                      psys_mat_hair_to_global(ob, psmd->dm_final, psys->part->from, psys->particles + i, mat);
 -                      invert_m4_m4(imat, mat);
 -
 -                      for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
 -                              copy_v3_v3(co, key->world_co);
 -                              mul_m4_v3(imat, co);
 -
 -
 -                              /* optimization for proportional edit */
 -                              if (!is_prop_edit || !compare_v3v3(key->co, co, 0.0001f)) {
 -                                      copy_v3_v3(key->co, co);
 -                                      point->flag |= PEP_EDIT_RECALC;
 +      FOREACH_TRANS_DATA_CONTAINER (t, tc) {
 +              Scene *scene = t->scene;
 +              ViewLayer *view_layer = t->view_layer;
 +              Object *ob = OBACT(view_layer);
 +              PTCacheEdit *edit = PE_get_current(scene, ob);
 +              ParticleSystem *psys = edit->psys;
 +              ParticleSystemModifierData *psmd = NULL;
 +              PTCacheEditPoint *point;
 +              PTCacheEditKey *key;
 +              TransData *td;
 +              float mat[4][4], imat[4][4], co[3];
 +              int i, k;
 +              const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
 +
 +              if (psys)
 +                      psmd = psys_get_modifier(ob, psys);
 +
 +              /* we do transform in world space, so flush world space position
 +               * back to particle local space (only for hair particles) */
 +              td = tc->data;
 +              for (i = 0, point = edit->points; i < edit->totpoint; i++, point++, td++) {
 +                      if (!(point->flag & PEP_TRANSFORM)) continue;
 +
 +                      if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 +                              psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles + i, mat);
 +                              invert_m4_m4(imat, mat);
 +
 +                              for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
 +                                      copy_v3_v3(co, key->world_co);
 +                                      mul_m4_v3(imat, co);
 +
 +
 +                                      /* optimization for proportional edit */
 +                                      if (!is_prop_edit || !compare_v3v3(key->co, co, 0.0001f)) {
 +                                              copy_v3_v3(key->co, co);
 +                                              point->flag |= PEP_EDIT_RECALC;
 +                                      }
                                }
                        }
 +                      else
 +                              point->flag |= PEP_EDIT_RECALC;
                }
 -              else
 -                      point->flag |= PEP_EDIT_RECALC;
 -      }
  
 -      PE_update_object(bmain, scene, OBACT, 1);
 +              PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1);
 +      }
  }
  
  /* ********************* mesh ****************** */
@@@ -103,13 -104,14 +104,13 @@@ const EnumPropertyItem rna_enum_symmetr
  #include "MEM_guardedalloc.h"
  
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_DerivedMesh.h"
- #include "BKE_pointcache.h"
 -#include "BKE_global.h"
  #include "BKE_particle.h"
 -#include "BKE_pointcache.h"
  #include "BKE_pbvh.h"
++#include "BKE_pointcache.h"
 +#include "BKE_object.h"
  
 -#include "GPU_buffers.h"
 +#include "DEG_depsgraph.h"
  
  #include "ED_particle.h"