Merge branch 'master' into blender2.8
authorSybren A. Stüvel <sybren@stuvel.eu>
Wed, 5 Jul 2017 20:25:05 +0000 (22:25 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Wed, 5 Jul 2017 20:25:05 +0000 (22:25 +0200)
1  2 
source/blender/blenkernel/intern/particle.c
source/blender/blenloader/intern/versioning_270.c
source/blender/makesrna/intern/rna_particle.c

index f34a680b52da559626fd31f43488d584dc194ec6,416d63cfefb7aeaf448c711a9fc1a73df57e5caf..a8253b9dc3cf0ad36662f6370509255116b3d0d2
@@@ -78,6 -78,7 +78,6 @@@
  #include "BKE_library.h"
  #include "BKE_library_query.h"
  #include "BKE_library_remap.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_modifier.h"
  #include "BKE_mesh.h"
  #include "BKE_cdderivedmesh.h"
@@@ -85,9 -86,6 +85,9 @@@
  #include "BKE_scene.h"
  #include "BKE_deform.h"
  
 +#include "DEG_depsgraph.h"
 +#include "DEG_depsgraph_build.h"
 +
  #include "RE_render_ext.h"
  
  unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
@@@ -608,8 -606,6 +608,8 @@@ void psys_free(Object *ob, ParticleSyst
                        MEM_freeN(psys->pdd);
                }
  
 +              BKE_particle_batch_cache_free(psys);
 +
                MEM_freeN(psys);
        }
  }
@@@ -3162,8 -3158,8 +3162,8 @@@ ModifierData *object_add_particle_syste
        psys->flag = PSYS_CURRENT;
        psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
  
 -      DAG_relations_tag_update(G.main);
 -      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +      DEG_relations_tag_update(G.main);
 +      DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
  
        return md;
  }
@@@ -3208,8 -3204,8 +3208,8 @@@ void object_remove_particle_system(Scen
        else
                ob->mode &= ~OB_MODE_PARTICLE_EDIT;
  
 -      DAG_relations_tag_update(G.main);
 -      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +      DEG_relations_tag_update(G.main);
 +      DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
  }
  
  static void default_particle_settings(ParticleSettings *part)
  
        part->omat = 1;
        part->use_modifier_stack = false;
 +      part->draw_size = 0.1f;
  }
  
  
@@@ -3415,6 -3410,9 +3415,9 @@@ static int get_particle_uv(DerivedMesh 
                if (from_vert) {
                        mf = dm->getTessFaceDataArray(dm, CD_MFACE);
  
+                       /* This finds the first face to contain the emitting vertex,
+                        * this is not ideal, but is mostly fine as UV seams generally
+                        * map to equal-colored parts of a texture */
                        for (int j = 0; j < dm->getNumTessFaces(dm); j++, mf++) {
                                if (ELEM(i, mf->v1, mf->v2, mf->v3, mf->v4)) {
                                        i = j;
@@@ -4338,22 -4336,3 +4341,22 @@@ void psys_apply_hair_lattice(Scene *sce
                psys->flag |= PSYS_EDITED;
        }
  }
 +
 +
 +
 +/* Draw Engine */
 +void (*BKE_particle_batch_cache_dirty_cb)(ParticleSystem *psys, int mode) = NULL;
 +void (*BKE_particle_batch_cache_free_cb)(ParticleSystem *psys) = NULL;
 +
 +void BKE_particle_batch_cache_dirty(ParticleSystem *psys, int mode)
 +{
 +      if (psys->batch_cache) {
 +              BKE_particle_batch_cache_dirty_cb(psys, mode);
 +      }
 +}
 +void BKE_particle_batch_cache_free(ParticleSystem *psys)
 +{
 +      if (psys->batch_cache) {
 +              BKE_particle_batch_cache_free_cb(psys);
 +      }
 +}
index db32b48c717029b98a2e2650e3c1f0715e3e2945,94d335870caa392ede8bfa6f57db2f7c946ce45e..cb7c46d24f3ec8157a2802f2c2e5f4e1822628e0
@@@ -1236,12 -1236,19 +1236,19 @@@ void blo_do_versions_270(FileData *fd, 
  
                        SEQ_BEGIN (scene->ed, seq)
                        {
-                               if (seq->type == SEQ_TYPE_TEXT) {
-                                       TextVars *data = seq->effectdata;
-                                       if (data->color[3] == 0.0f) {
-                                               copy_v4_fl(data->color, 1.0f);
-                                               data->shadow_color[3] = 1.0f;
-                                       }
+                               if (seq->type != SEQ_TYPE_TEXT) {
+                                       continue;
+                               }
+                               if (seq->effectdata == NULL) {
+                                       struct SeqEffectHandle effect_handle = BKE_sequence_get_effect(seq);
+                                       effect_handle.init(seq);
+                               }
+                               TextVars *data = seq->effectdata;
+                               if (data->color[3] == 0.0f) {
+                                       copy_v4_fl(data->color, 1.0f);
+                                       data->shadow_color[3] = 1.0f;
                                }
                        }
                        SEQ_END
                for (Mesh *me = main->mesh.first; me; me = me->id.next) {
                        CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
                }
 +
 +              if (!DNA_struct_elem_find(fd->filesdna, "View3DDebug", "char", "background")) {
 +                      bScreen *screen;
 +
 +                      for (screen = main->screen.first; screen; screen = screen->id.next) {
 +                              ScrArea *sa;
 +                              for (sa = screen->areabase.first; sa; sa = sa->next) {
 +                                      SpaceLink *sl;
 +
 +                                      for (sl = sa->spacedata.first; sl; sl = sl->next) {
 +                                              switch (sl->spacetype) {
 +                                                      case SPACE_VIEW3D:
 +                                                      {
 +                                                              View3D *v3d = (View3D *)sl;
 +                                                              v3d->debug.background = V3D_DEBUG_BACKGROUND_NONE;
 +                                                      }
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
        }
  }
  
index b40519386cc9e1745784ba89132aca446671ea52,00104b8667da98fcb722128e2bd3ce7409f9508b..0f2eb9412e7eedced5e9c28b3c70f62fb625ad69
@@@ -135,6 -135,7 +135,6 @@@ static EnumPropertyItem part_hair_ren_a
  #include "BKE_cloth.h"
  #include "BKE_colortools.h"
  #include "BKE_deform.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_DerivedMesh.h"
  #include "BKE_cdderivedmesh.h"
  #include "BKE_effect.h"
  #include "BKE_pointcache.h"
  #include "BKE_texture.h"
  
 +#include "DEG_depsgraph.h"
 +#include "DEG_depsgraph_build.h"
 +
  /* use for object space hair get/set */
  static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
                                                       ParticleData **pa_pt)
@@@ -494,6 -492,9 +494,9 @@@ static int rna_ParticleSystem_tessfacei
  
                                *r_fuv = &particle->fuv;
  
+                               /* This finds the first face to contain the emitting vertex,
+                                * this is not ideal, but is mostly fine as UV seams generally
+                                * map to equal-colored parts of a texture */
                                for (int i = 0; i < totface; i++, mface++) {
                                        if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
                                                return i;
  
                                        *r_fuv = &parent->fuv;
  
+                                       /* This finds the first face to contain the emitting vertex,
+                                        * this is not ideal, but is mostly fine as UV seams generally
+                                        * map to equal-colored parts of a texture */
                                        for (int i = 0; i < totface; i++, mface++) {
                                                if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
                                                        return i;
@@@ -639,10 -643,10 +645,10 @@@ static void particle_recalc(Main *UNUSE
                
                psys->recalc = flag;
  
 -              DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
 +              DEG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
        }
        else
 -              DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | flag);
 +              DEG_id_tag_update(ptr->id.data, OB_RECALC_DATA | flag);
  
        WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
  }
@@@ -653,7 -657,7 +659,7 @@@ static void rna_Particle_redo(Main *bma
  
  static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
  {
 -      DAG_relations_tag_update(bmain);
 +      DEG_relations_tag_update(bmain);
        rna_Particle_redo(bmain, scene, ptr);
  }
  
@@@ -664,7 -668,7 +670,7 @@@ static void rna_Particle_reset(Main *bm
  
  static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
  {
 -      DAG_relations_tag_update(bmain);
 +      DEG_relations_tag_update(bmain);
        rna_Particle_reset(bmain, scene, ptr);
  }
  
@@@ -687,7 -691,7 +693,7 @@@ static void rna_Particle_cloth_update(M
  {
        Object *ob = (Object *)ptr->id.data;
  
 -      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +      DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
        WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
  }
  
@@@ -732,8 -736,8 +738,8 @@@ static void rna_Particle_target_reset(M
                
                psys->recalc = PSYS_RECALC_RESET;
  
 -              DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 -              DAG_relations_tag_update(bmain);
 +              DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +              DEG_relations_tag_update(bmain);
        }
  
        WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
@@@ -748,7 -752,7 +754,7 @@@ static void rna_Particle_target_redo(Ma
                
                psys->recalc = PSYS_RECALC_REDO;
  
 -              DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +              DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
                WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
        }
  }
@@@ -768,7 -772,7 +774,7 @@@ static void rna_Particle_hair_dynamics(
        else
                WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
  
 -      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +      DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
  }
  static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
  {
@@@ -2368,10 -2372,10 +2374,10 @@@ static void rna_def_particle_settings(B
        RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
        RNA_def_property_update(prop, 0, "rna_Particle_redo");
  
 -      prop = RNA_def_property(srna, "draw_size", PROP_INT, PROP_PIXEL);
 +      prop = RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_NONE);
        RNA_def_property_range(prop, 0, 1000);
        RNA_def_property_ui_range(prop, 0, 100, 1, -1);
 -      RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
 +      RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU (0.1 = default)");
        RNA_def_property_update(prop, 0, "rna_Particle_redo");
  
        prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);