Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 2 Oct 2016 16:53:01 +0000 (18:53 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 2 Oct 2016 16:53:01 +0000 (18:53 +0200)
1  2 
source/blender/blenkernel/intern/library_query.c
source/blender/blenloader/intern/readfile.c
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/editors/transform/transform_snap_object.c
source/blender/gpu/intern/gpu_material.c

index 772ba2d9c807d0f3ba3a6019896308db40629b70,718950624e274992df13d81cd7d4caed7e514fac..66aa8e3f498a9020f28f03427c4ad289cd79a1b3
@@@ -51,7 -51,6 +51,7 @@@
  #include "DNA_mask_types.h"
  #include "DNA_node_types.h"
  #include "DNA_object_force.h"
 +#include "DNA_object_types.h"
  #include "DNA_rigidbody_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_sensor_types.h"
@@@ -64,6 -63,7 +64,6 @@@
  #include "DNA_world_types.h"
  
  #include "BLI_utildefines.h"
 -#include "BLI_listbase.h"
  #include "BLI_ghash.h"
  #include "BLI_linklist_stack.h"
  
@@@ -74,6 -74,7 +74,6 @@@
  #include "BKE_library_query.h"
  #include "BKE_main.h"
  #include "BKE_modifier.h"
 -#include "BKE_particle.h"
  #include "BKE_rigidbody.h"
  #include "BKE_sca.h"
  #include "BKE_sequencer.h"
@@@ -166,6 -167,15 +166,6 @@@ static void library_foreach_constraintO
        FOREACH_FINALIZE_VOID;
  }
  
 -static void library_foreach_particlesystemsObjectLooper(
 -        ParticleSystem *UNUSED(psys), ID **id_pointer, void *user_data, int cd_flag)
 -{
 -      LibraryForeachIDData *data = (LibraryForeachIDData *) user_data;
 -      FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cd_flag);
 -
 -      FOREACH_FINALIZE_VOID;
 -}
 -
  static void library_foreach_sensorsObjectLooper(
          bSensor *UNUSED(sensor), ID **id_pointer, void *user_data, int cd_flag)
  {
@@@ -368,9 -378,17 +368,13 @@@ void BKE_library_foreach_ID_link(ID *id
                                        CALLBACK_INVOKE(base->object, IDWALK_USER);
                                }
  
+                               for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
+                                       CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
+                               }
                                if (toolsett) {
                                        CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP);
  
 -                                      CALLBACK_INVOKE(toolsett->particle.scene, IDWALK_NOP);
 -                                      CALLBACK_INVOKE(toolsett->particle.object, IDWALK_NOP);
 -                                      CALLBACK_INVOKE(toolsett->particle.shape_object, IDWALK_NOP);
 -
                                        library_foreach_paint(&data, &toolsett->imapaint.paint);
                                        CALLBACK_INVOKE(toolsett->imapaint.stencil, IDWALK_USER);
                                        CALLBACK_INVOKE(toolsett->imapaint.clone, IDWALK_USER);
                        case ID_OB:
                        {
                                Object *object = (Object *) id;
 -                              ParticleSystem *psys;
  
                                /* Object is special, proxies make things hard... */
                                const int data_cd_flag = data.cd_flag;
                                modifiers_foreachIDLink(object, library_foreach_modifiersForeachIDLink, &data);
                                BKE_constraints_id_loop(&object->constraints, library_foreach_constraintObjectLooper, &data);
  
 -                              for (psys = object->particlesystem.first; psys; psys = psys->next) {
 -                                      BKE_particlesystem_id_loop(psys, library_foreach_particlesystemsObjectLooper, &data);
 -                              }
 -
                                if (object->soft) {
                                        CALLBACK_INVOKE(object->soft->collision_group, IDWALK_NOP);
  
                                break;
                        }
  
 -                      case ID_PA:
 -                      {
 -                              ParticleSettings *psett = (ParticleSettings *) id;
 -                              CALLBACK_INVOKE(psett->dup_group, IDWALK_NOP);
 -                              CALLBACK_INVOKE(psett->dup_ob, IDWALK_NOP);
 -                              CALLBACK_INVOKE(psett->bb_ob, IDWALK_NOP);
 -                              CALLBACK_INVOKE(psett->collision_group, IDWALK_NOP);
 -
 -                              for (i = 0; i < MAX_MTEX; i++) {
 -                                      if (psett->mtex[i]) {
 -                                              library_foreach_mtex(&data, psett->mtex[i]);
 -                                      }
 -                              }
 -
 -                              if (psett->effector_weights) {
 -                                      CALLBACK_INVOKE(psett->effector_weights->group, IDWALK_NOP);
 -                              }
 -
 -                              if (psett->pd) {
 -                                      CALLBACK_INVOKE(psett->pd->tex, IDWALK_USER);
 -                                      CALLBACK_INVOKE(psett->pd->f_source, IDWALK_NOP);
 -                              }
 -                              if (psett->pd2) {
 -                                      CALLBACK_INVOKE(psett->pd2->tex, IDWALK_USER);
 -                                      CALLBACK_INVOKE(psett->pd2->f_source, IDWALK_NOP);
 -                              }
 -
 -                              if (psett->boids) {
 -                                      BoidState *state;
 -                                      BoidRule *rule;
 -
 -                                      for (state = psett->boids->states.first; state; state = state->next) {
 -                                              for (rule = state->rules.first; rule; rule = rule->next) {
 -                                                      if (rule->type == eBoidRuleType_Avoid) {
 -                                                              BoidRuleGoalAvoid *gabr = (BoidRuleGoalAvoid *)rule;
 -                                                              CALLBACK_INVOKE(gabr->ob, IDWALK_NOP);
 -                                                      }
 -                                                      else if (rule->type == eBoidRuleType_FollowLeader) {
 -                                                              BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader *)rule;
 -                                                              CALLBACK_INVOKE(flbr->ob, IDWALK_NOP);
 -                                                      }
 -                                              }
 -                                      }
 -                              }
 -                              break;
 -                      }
 -
                        case ID_MC:
                        {
                                MovieClip *clip = (MovieClip *) id;
                                }
                                break;
                        }
+                       case ID_AC:
+                       {
+                               bAction *act = (bAction *) id;
+                               for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+                                       CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
+                               }
+                               break;
+                       }
  
                        /* Nothing needed for those... */
                        case ID_IM:
                        case ID_TXT:
                        case ID_SO:
                        case ID_AR:
-                       case ID_AC:
                        case ID_GD:
                        case ID_WM:
                        case ID_PAL:
@@@ -850,7 -928,7 +862,7 @@@ bool BKE_library_idtype_can_use_idtype(
                        /* Could be the following, but simpler to just always say 'yes' here. */
  #if 0
                        return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA,  /* obdata */
 -                                                ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_PA, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC
 +                                                ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC
                                                  /* + constraints, modifiers and game logic ID types... */);
  #else
                        return true;
  #endif
                case ID_BR:
                        return ELEM(id_type_used, ID_BR, ID_IM, ID_PC, ID_TE);
 -              case ID_PA:
 -                      return ELEM(id_type_used, ID_OB, ID_GR, ID_TE);
                case ID_MC:
                        return ELEM(id_type_used, ID_GD, ID_IM);
                case ID_MSK:
index a476b18eaace3314fc3c6a9049b797cdc8ac095e,d86a89a0e489d9091ffeb5659030773a17a93065..4e1eb41c7cf325d410639304116af2e278cfbe17
@@@ -81,9 -81,9 +81,9 @@@
  #include "DNA_nla_types.h"
  #include "DNA_node_types.h"
  #include "DNA_object_fluidsim.h" // NT
 +#include "DNA_object_force.h"
  #include "DNA_object_types.h"
  #include "DNA_packedFile_types.h"
 -#include "DNA_particle_types.h"
  #include "DNA_property_types.h"
  #include "DNA_rigidbody_types.h"
  #include "DNA_text_types.h"
  #include "BKE_node.h" // for tree type defines
  #include "BKE_object.h"
  #include "BKE_paint.h"
 -#include "BKE_particle.h"
 -#include "BKE_pointcache.h"
  #include "BKE_report.h"
  #include "BKE_sca.h" // for init_actuator
  #include "BKE_scene.h"
@@@ -2509,6 -2511,12 +2509,12 @@@ static void lib_link_action(FileData *f
  // >>> XXX deprecated - old animation system
                        
                        lib_link_fcurves(fd, &act->id, &act->curves);
+                       for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+                               if (marker->camera) {
+                                       marker->camera = newlibadr(fd, act->id.lib, marker->camera);
+                               }
+                       }
                }
        }
  }
@@@ -3970,6 -3978,83 +3976,6 @@@ static void direct_link_material(FileDa
  }
  
  /* ************ READ PARTICLE SETTINGS ***************** */
 -/* update this also to writefile.c */
 -static const char *ptcache_data_struct[] = {
 -      "", // BPHYS_DATA_INDEX
 -      "", // BPHYS_DATA_LOCATION
 -      "", // BPHYS_DATA_VELOCITY
 -      "", // BPHYS_DATA_ROTATION
 -      "", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
 -      "", // BPHYS_DATA_SIZE:
 -      "", // BPHYS_DATA_TIMES:
 -      "BoidData" // case BPHYS_DATA_BOIDS:
 -};
 -
 -static void direct_link_pointcache_cb(FileData *fd, void *data)
 -{
 -      PTCacheMem *pm = data;
 -      PTCacheExtra *extra;
 -      int i;
 -      for (i = 0; i < BPHYS_TOT_DATA; i++) {
 -              pm->data[i] = newdataadr(fd, pm->data[i]);
 -
 -              /* the cache saves non-struct data without DNA */
 -              if (pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
 -                      int tot = (BKE_ptcache_data_size(i) * pm->totpoint) / sizeof(int);  /* data_size returns bytes */
 -                      int *poin = pm->data[i];
 -
 -                      BLI_endian_switch_int32_array(poin, tot);
 -              }
 -      }
 -
 -      link_list(fd, &pm->extradata);
 -
 -      for (extra=pm->extradata.first; extra; extra=extra->next)
 -              extra->data = newdataadr(fd, extra->data);
 -}
 -
 -static void direct_link_pointcache(FileData *fd, PointCache *cache)
 -{
 -      if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
 -              link_list_ex(fd, &cache->mem_cache, direct_link_pointcache_cb);
 -      }
 -      else
 -              BLI_listbase_clear(&cache->mem_cache);
 -      
 -      cache->flag &= ~PTCACHE_SIMULATION_VALID;
 -      cache->simframe = 0;
 -      cache->edit = NULL;
 -      cache->free_edit = NULL;
 -      cache->cached_frames = NULL;
 -}
 -
 -static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk)
 -{
 -      if (ptcaches->first) {
 -              PointCache *cache= NULL;
 -              link_list(fd, ptcaches);
 -              for (cache=ptcaches->first; cache; cache=cache->next) {
 -                      direct_link_pointcache(fd, cache);
 -                      if (force_disk) {
 -                              cache->flag |= PTCACHE_DISK_CACHE;
 -                              cache->step = 1;
 -                      }
 -              }
 -              
 -              *ocache = newdataadr(fd, *ocache);
 -      }
 -      else if (*ocache) {
 -              /* old "single" caches need to be linked too */
 -              *ocache = newdataadr(fd, *ocache);
 -              direct_link_pointcache(fd, *ocache);
 -              if (force_disk) {
 -                      (*ocache)->flag |= PTCACHE_DISK_CACHE;
 -                      (*ocache)->step = 1;
 -              }
 -              
 -              ptcaches->first = ptcaches->last = *ocache;
 -      }
 -}
  
  static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
  {
                pd->f_source = newlibadr(fd, id->lib, pd->f_source);
  }
  
 -static void lib_link_particlesettings(FileData *fd, Main *main)
 -{
 -      ParticleSettings *part;
 -      ParticleDupliWeight *dw;
 -      MTex *mtex;
 -      int a;
 -      
 -      for (part = main->particle.first; part; part = part->id.next) {
 -              if (part->id.tag & LIB_TAG_NEED_LINK) {
 -                      lib_link_animdata(fd, &part->id, part->adt);
 -                      part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
 -                      
 -                      part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
 -                      part->dup_group = newlibadr(fd, part->id.lib, part->dup_group);
 -                      part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
 -                      part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
 -                      part->collision_group = newlibadr(fd, part->id.lib, part->collision_group);
 -                      
 -                      lib_link_partdeflect(fd, &part->id, part->pd);
 -                      lib_link_partdeflect(fd, &part->id, part->pd2);
 -                      
 -                      if (part->effector_weights) {
 -                              part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
 -                      }
 -                      else {
 -                              part->effector_weights = BKE_add_effector_weights(part->eff_group);
 -                      }
 -
 -                      if (part->dupliweights.first && part->dup_group) {
 -                              int index_ok = 0;
 -                              /* check for old files without indices (all indexes 0) */
 -                              if (BLI_listbase_is_single(&part->dupliweights)) {
 -                                      /* special case for only one object in the group */
 -                                      index_ok = 1;
 -                              }
 -                              else {
 -                                      for (dw = part->dupliweights.first; dw; dw = dw->next) {
 -                                              if (dw->index > 0) {
 -                                                      index_ok = 1;
 -                                                      break;
 -                                              }
 -                                      }
 -                              }
 -
 -                              if (index_ok) {
 -                                      /* if we have indexes, let's use them */
 -                                      for (dw = part->dupliweights.first; dw; dw = dw->next) {
 -                                              /* Do not try to restore pointer here, we have to search for group objects in another
 -                                               * separated step.
 -                                               * Reason is, the used group may be linked from another library, which has not yet
 -                                               * been 'lib_linked'.
 -                                               * Since dw->ob is not considered as an object user (it does not make objet directly linked),
 -                                               * we may have no valid way to retrieve it yet.
 -                                               * See T49273. */
 -                                              dw->ob = NULL;
 -                                      }
 -                              }
 -                              else {
 -                                      /* otherwise try to get objects from own library (won't work on library linked groups) */
 -                                      for (dw = part->dupliweights.first; dw; dw = dw->next) {
 -                                              dw->ob = newlibadr(fd, part->id.lib, dw->ob);
 -                                      }
 -                              }
 -                      }
 -                      else {
 -                              BLI_listbase_clear(&part->dupliweights);
 -                      }
 -                      
 -                      if (part->boids) {
 -                              BoidState *state = part->boids->states.first;
 -                              BoidRule *rule;
 -                              for (; state; state=state->next) {
 -                                      rule = state->rules.first;
 -                                      for (; rule; rule=rule->next) {
 -                                              switch (rule->type) {
 -                                                      case eBoidRuleType_Goal:
 -                                                      case eBoidRuleType_Avoid:
 -                                                      {
 -                                                              BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid*)rule;
 -                                                              brga->ob = newlibadr(fd, part->id.lib, brga->ob);
 -                                                              break;
 -                                                      }
 -                                                      case eBoidRuleType_FollowLeader:
 -                                                      {
 -                                                              BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader*)rule;
 -                                                              brfl->ob = newlibadr(fd, part->id.lib, brfl->ob);
 -                                                              break;
 -                                                      }
 -                                              }
 -                                      }
 -                              }
 -                      }
 -
 -                      for (a = 0; a < MAX_MTEX; a++) {
 -                              mtex= part->mtex[a];
 -                              if (mtex) {
 -                                      mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex);
 -                                      mtex->object = newlibadr(fd, part->id.lib, mtex->object);
 -                              }
 -                      }
 -                      
 -                      part->id.tag &= ~LIB_TAG_NEED_LINK;
 -              }
 -      }
 -}
 -
  static void direct_link_partdeflect(PartDeflect *pd)
  {
        if (pd) pd->rng = NULL;
  }
  
 -static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
 -{
 -      int a;
 -      
 -      part->adt = newdataadr(fd, part->adt);
 -      part->pd = newdataadr(fd, part->pd);
 -      part->pd2 = newdataadr(fd, part->pd2);
 -
 -      direct_link_animdata(fd, part->adt);
 -      direct_link_partdeflect(part->pd);
 -      direct_link_partdeflect(part->pd2);
 -
 -      part->clumpcurve = newdataadr(fd, part->clumpcurve);
 -      if (part->clumpcurve)
 -              direct_link_curvemapping(fd, part->clumpcurve);
 -      part->roughcurve = newdataadr(fd, part->roughcurve);
 -      if (part->roughcurve)
 -              direct_link_curvemapping(fd, part->roughcurve);
 -
 -      part->effector_weights = newdataadr(fd, part->effector_weights);
 -      if (!part->effector_weights)
 -              part->effector_weights = BKE_add_effector_weights(part->eff_group);
 -
 -      link_list(fd, &part->dupliweights);
 -
 -      part->boids = newdataadr(fd, part->boids);
 -      part->fluid = newdataadr(fd, part->fluid);
 -
 -      if (part->boids) {
 -              BoidState *state;
 -              link_list(fd, &part->boids->states);
 -              
 -              for (state=part->boids->states.first; state; state=state->next) {
 -                      link_list(fd, &state->rules);
 -                      link_list(fd, &state->conditions);
 -                      link_list(fd, &state->actions);
 -              }
 -      }
 -      for (a = 0; a < MAX_MTEX; a++) {
 -              part->mtex[a] = newdataadr(fd, part->mtex[a]);
 -      }
 -}
 -
 -static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase *particles)
 -{
 -      ParticleSystem *psys, *psysnext;
 -
 -      for (psys=particles->first; psys; psys=psysnext) {
 -              psysnext = psys->next;
 -              
 -              psys->part = newlibadr_us(fd, id->lib, psys->part);
 -              if (psys->part) {
 -                      ParticleTarget *pt = psys->targets.first;
 -                      
 -                      for (; pt; pt=pt->next)
 -                              pt->ob=newlibadr(fd, id->lib, pt->ob);
 -                      
 -                      psys->parent = newlibadr(fd, id->lib, psys->parent);
 -                      psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
 -                      
 -                      if (psys->clmd) {
 -                              /* XXX - from reading existing code this seems correct but intended usage of
 -                               * pointcache /w cloth should be added in 'ParticleSystem' - campbell */
 -                              psys->clmd->point_cache = psys->pointcache;
 -                              psys->clmd->ptcaches.first = psys->clmd->ptcaches.last= NULL;
 -                              psys->clmd->coll_parms->group = newlibadr(fd, id->lib, psys->clmd->coll_parms->group);
 -                              psys->clmd->modifier.error = NULL;
 -                      }
 -              }
 -              else {
 -                      /* particle modifier must be removed before particle system */
 -                      ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
 -                      BLI_remlink(&ob->modifiers, psmd);
 -                      modifier_free((ModifierData *)psmd);
 -                      
 -                      BLI_remlink(particles, psys);
 -                      MEM_freeN(psys);
 -              }
 -      }
 -}
 -static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 -{
 -      ParticleSystem *psys;
 -      ParticleData *pa;
 -      int a;
 -      
 -      for (psys=particles->first; psys; psys=psys->next) {
 -              psys->particles=newdataadr(fd, psys->particles);
 -              
 -              if (psys->particles && psys->particles->hair) {
 -                      for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
 -                              pa->hair=newdataadr(fd, pa->hair);
 -              }
 -              
 -              if (psys->particles && psys->particles->keys) {
 -                      for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) {
 -                              pa->keys= NULL;
 -                              pa->totkey= 0;
 -                      }
 -                      
 -                      psys->flag &= ~PSYS_KEYED;
 -              }
 -              
 -              if (psys->particles && psys->particles->boid) {
 -                      pa = psys->particles;
 -                      pa->boid = newdataadr(fd, pa->boid);
 -                      for (a=1, pa++; a<psys->totpart; a++, pa++)
 -                              pa->boid = (pa-1)->boid + 1;
 -              }
 -              else if (psys->particles) {
 -                      for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
 -                              pa->boid = NULL;
 -              }
 -              
 -              psys->fluid_springs = newdataadr(fd, psys->fluid_springs);
 -              
 -              psys->child = newdataadr(fd, psys->child);
 -              psys->effectors = NULL;
 -              
 -              link_list(fd, &psys->targets);
 -              
 -              psys->edit = NULL;
 -              psys->free_edit = NULL;
 -              psys->pathcache = NULL;
 -              psys->childcache = NULL;
 -              BLI_listbase_clear(&psys->pathcachebufs);
 -              BLI_listbase_clear(&psys->childcachebufs);
 -              psys->pdd = NULL;
 -              psys->renderdata = NULL;
 -              
 -              if (psys->clmd) {
 -                      psys->clmd = newdataadr(fd, psys->clmd);
 -                      psys->clmd->clothObject = NULL;
 -                      psys->clmd->hairdata = NULL;
 -                      
 -                      psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms);
 -                      psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
 -                      
 -                      if (psys->clmd->sim_parms) {
 -                              psys->clmd->sim_parms->effector_weights = NULL;
 -                              if (psys->clmd->sim_parms->presets > 10)
 -                                      psys->clmd->sim_parms->presets = 0;
 -                      }
 -                      
 -                      psys->hair_in_dm = psys->hair_out_dm = NULL;
 -                      psys->clmd->solver_result = NULL;
 -              }
 -
 -              direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache, 0);
 -              if (psys->clmd) {
 -                      psys->clmd->point_cache = psys->pointcache;
 -              }
 -
 -              psys->tree = NULL;
 -              psys->bvhtree = NULL;
 -      }
 -      return;
 -}
 -
  /* ************ READ MESH ***************** */
  
  static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
@@@ -4594,6 -4944,7 +4600,6 @@@ static void lib_link_object(FileData *f
                                ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
                        }
                        
 -                      lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem);
                        lib_link_modifiers(fd, ob);
  
                        if (ob->rigidbody_constraint) {
@@@ -4694,6 -5045,8 +4700,6 @@@ static void direct_link_modifiers(FileD
                        clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
                        clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
                        
 -                      direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0);
 -                      
                        if (clmd->sim_parms) {
                                if (clmd->sim_parms->presets > 10)
                                        clmd->sim_parms->presets = 0;
                                smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights);
                                if (!smd->domain->effector_weights)
                                        smd->domain->effector_weights = BKE_add_effector_weights(NULL);
 -                              
 -                              direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1);
 -                              
 -                              /* Smoke uses only one cache from now on, so store pointer convert */
 -                              if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
 -                                      if (smd->domain->point_cache[1]) {
 -                                              PointCache *cache = newdataadr(fd, smd->domain->point_cache[1]);
 -                                              if (cache->flag & PTCACHE_FAKE_SMOKE) {
 -                                                      /* Smoke was already saved in "new format" and this cache is a fake one. */
 -                                              }
 -                                              else {
 -                                                      printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n");
 -                                              }
 -                                              BKE_ptcache_free(cache);
 -                                      }
 -                                      BLI_listbase_clear(&smd->domain->ptcaches[1]);
 -                                      smd->domain->point_cache[1] = NULL;
 -                              }
                        }
                        else if (smd->type == MOD_SMOKE_TYPE_FLOW) {
                                smd->domain = NULL;
                                smd->flow->dm = NULL;
                                smd->flow->verts_old = NULL;
                                smd->flow->numverts = 0;
 -                              smd->flow->psys = newdataadr(fd, smd->flow->psys);
                        }
                        else if (smd->type == MOD_SMOKE_TYPE_COLL) {
                                smd->flow = NULL;
                                        for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) {
                                                surface->canvas = pmd->canvas;
                                                surface->data = NULL;
 -                                              direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1);
                                                
                                                if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
                                                        surface->effector_weights = BKE_add_effector_weights(NULL);
                        if (pmd->brush) {
                                pmd->brush = newdataadr(fd, pmd->brush);
                                pmd->brush->pmd = pmd;
 -                              pmd->brush->psys = newdataadr(fd, pmd->brush->psys);
                                pmd->brush->paint_ramp = newdataadr(fd, pmd->brush->paint_ramp);
                                pmd->brush->vel_ramp = newdataadr(fd, pmd->brush->vel_ramp);
                                pmd->brush->dm = NULL;
                                direct_link_curvemapping(fd, hmd->curfalloff);
                        }
                }
 -              else if (md->type == eModifierType_ParticleSystem) {
 -                      ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
 -                      
 -                      psmd->dm_final = NULL;
 -                      psmd->dm_deformed = NULL;
 -                      psmd->psys= newdataadr(fd, psmd->psys);
 -                      psmd->flag &= ~eParticleSystemFlag_psys_updated;
 -                      psmd->flag |= eParticleSystemFlag_file_loaded;
 -              }
                else if (md->type == eModifierType_Explode) {
                        ExplodeModifierData *psmd = (ExplodeModifierData *)md;
                        
@@@ -4942,7 -5325,7 +4948,7 @@@ static void direct_link_object(FileDat
         * See [#34776, #42780] for more information.
         */
        if (fd->memfile || (ob->id.tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT))) {
 -              ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT);
 +              ob->mode &= ~OB_MODE_EDIT;
                if (!fd->memfile) {
                        ob->mode &= ~OB_MODE_POSE;
                }
                sb->effector_weights = newdataadr(fd, sb->effector_weights);
                if (!sb->effector_weights)
                        sb->effector_weights = BKE_add_effector_weights(NULL);
 -              
 -              direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
        }
        ob->bsoft = newdataadr(fd, ob->bsoft);
        ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
        ob->rigidbody_constraint = newdataadr(fd, ob->rigidbody_constraint);
        if (ob->rigidbody_constraint)
                ob->rigidbody_constraint->physics_constraint = NULL;
 -
 -      link_list(fd, &ob->particlesystem);
 -      direct_link_particlesystems(fd, &ob->particlesystem);
        
        link_list(fd, &ob->prop);
        for (prop = ob->prop.first; prop; prop = prop->next) {
@@@ -5226,7 -5614,6 +5232,6 @@@ static void lib_link_scene(FileData *fd
        Base *base, *next;
        Sequence *seq;
        SceneRenderLayer *srl;
-       TimeMarker *marker;
        FreestyleModuleConfig *fmc;
        FreestyleLineSet *fls;
  
                        
                        sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template);
                        
 -                      sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
 -                      
                        for (base = sce->base.first; base; base = next) {
                                next = base->next;
                                
                        }
                        SEQ_END
  
- #ifdef DURIAN_CAMERA_SWITCH
-                       for (marker = sce->markers.first; marker; marker = marker->next) {
+                       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
                                if (marker->camera) {
                                        marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
                                }
                        }
- #else
-                       (void)marker;
- #endif
                        
                        BKE_sequencer_update_muting(sce->ed);
                        BKE_sequencer_update_sound_bounds_all(sce);
@@@ -5517,6 -5902,9 +5518,6 @@@ static void direct_link_scene(FileData 
                direct_link_paint(fd, &sce->toolsettings->imapaint.paint);
  
                sce->toolsettings->imapaint.paintcursor = NULL;
 -              sce->toolsettings->particle.paintcursor = NULL;
 -              sce->toolsettings->particle.scene = NULL;
 -              sce->toolsettings->particle.object = NULL;
                sce->toolsettings->gp_sculpt.paintcursor = NULL;
  
                /* in rare cases this is needed, see [#33806] */
                rbw->effector_weights = newdataadr(fd, rbw->effector_weights);
                if (!rbw->effector_weights)
                        rbw->effector_weights = BKE_add_effector_weights(NULL);
 -
 -              /* link cache */
 -              direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
 -              /* make sure simulation starts from the beginning after loading file */
 -              if (rbw->pointcache) {
 -                      rbw->ltime = (float)rbw->pointcache->startframe;
 -              }
        }
  
        sce->preview = direct_link_preview_image(fd, sce->preview);
@@@ -7556,6 -7951,7 +7557,6 @@@ static const char *dataname(short id_co
                case ID_SO: return "Data from SO";
                case ID_NT: return "Data from NT";
                case ID_BR: return "Data from BR";
 -              case ID_PA: return "Data from PA";
                case ID_PAL: return "Data from PAL";
                case ID_PC: return "Data from PCRV";
                case ID_GD: return "Data from GD";
@@@ -7794,6 -8190,9 +7795,6 @@@ static BHead *read_libblock(FileData *f
                case ID_BR:
                        direct_link_brush(fd, (Brush*)id);
                        break;
 -              case ID_PA:
 -                      direct_link_particlesettings(fd, (ParticleSettings*)id);
 -                      break;
                case ID_GD:
                        direct_link_gpencil(fd, (bGPdata *)id);
                        break;
@@@ -8003,6 -8402,7 +8004,6 @@@ static void lib_link_all(FileData *fd, 
        lib_link_brush(fd, main);
        lib_link_palette(fd, main);
        lib_link_paint_curve(fd, main);
 -      lib_link_particlesettings(fd, main);
        lib_link_movieclip(fd, main);
        lib_link_mask(fd, main);
        lib_link_linestyle(fd, main);
@@@ -8461,6 -8861,12 +8462,12 @@@ static void expand_action(FileData *fd
        
        /* F-Curves in Action */
        expand_fcurves(fd, mainvar, &act->curves);
+       for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+               if (marker->camera) {
+                       expand_doit(fd, mainvar, marker->camera);
+               }
+       }
  }
  
  static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
@@@ -8511,6 -8917,58 +8518,6 @@@ static void expand_animdata(FileData *f
                expand_animdata_nlastrips(fd, mainvar, &nlt->strips);
  }     
  
 -static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part)
 -{
 -      int a;
 -      
 -      expand_doit(fd, mainvar, part->dup_ob);
 -      expand_doit(fd, mainvar, part->dup_group);
 -      expand_doit(fd, mainvar, part->eff_group);
 -      expand_doit(fd, mainvar, part->bb_ob);
 -      expand_doit(fd, mainvar, part->collision_group);
 -      
 -      if (part->adt)
 -              expand_animdata(fd, mainvar, part->adt);
 -      
 -      for (a = 0; a < MAX_MTEX; a++) {
 -              if (part->mtex[a]) {
 -                      expand_doit(fd, mainvar, part->mtex[a]->tex);
 -                      expand_doit(fd, mainvar, part->mtex[a]->object);
 -              }
 -      }
 -
 -      if (part->effector_weights) {
 -              expand_doit(fd, mainvar, part->effector_weights->group);
 -      }
 -
 -      if (part->pd) {
 -              expand_doit(fd, mainvar, part->pd->tex);
 -              expand_doit(fd, mainvar, part->pd->f_source);
 -      }
 -      if (part->pd2) {
 -              expand_doit(fd, mainvar, part->pd2->tex);
 -              expand_doit(fd, mainvar, part->pd2->f_source);
 -      }
 -
 -      if (part->boids) {
 -              BoidState *state;
 -              BoidRule *rule;
 -
 -              for (state = part->boids->states.first; state; state = state->next) {
 -                      for (rule = state->rules.first; rule; rule = rule->next) {
 -                              if (rule->type == eBoidRuleType_Avoid) {
 -                                      BoidRuleGoalAvoid *gabr = (BoidRuleGoalAvoid *)rule;
 -                                      expand_doit(fd, mainvar, gabr->ob);
 -                              }
 -                              else if (rule->type == eBoidRuleType_FollowLeader) {
 -                                      BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader *)rule;
 -                                      expand_doit(fd, mainvar, flbr->ob);
 -                              }
 -                      }
 -              }
 -      }
 -}
 -
  static void expand_group(FileData *fd, Main *mainvar, Group *group)
  {
        GroupObject *go;
@@@ -8813,6 -9271,7 +8820,6 @@@ static void expand_object_expandModifie
  
  static void expand_object(FileData *fd, Main *mainvar, Object *ob)
  {
 -      ParticleSystem *psys;
        bSensor *sens;
        bController *cont;
        bActuator *act;
                expand_doit(fd, mainvar, ob->proxy);
        if (ob->proxy_group)
                expand_doit(fd, mainvar, ob->proxy_group);
 -      
 -      for (psys = ob->particlesystem.first; psys; psys = psys->next)
 -              expand_doit(fd, mainvar, psys->part);
  
        for (sens = ob->sensors.first; sens; sens = sens->next) {
                if (sens->type == SENS_MESSAGE) {
@@@ -9035,17 -9497,11 +9042,11 @@@ static void expand_scene(FileData *fd, 
                expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
        }
  
- #ifdef DURIAN_CAMERA_SWITCH
-       {
-               TimeMarker *marker;
-               
-               for (marker = sce->markers.first; marker; marker = marker->next) {
-                       if (marker->camera) {
-                               expand_doit(fd, mainvar, marker->camera);
-                       }
+       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
+               if (marker->camera) {
+                       expand_doit(fd, mainvar, marker->camera);
                }
        }
- #endif
  
        expand_doit(fd, mainvar, sce->clip);
  }
@@@ -9245,6 -9701,9 +9246,6 @@@ void BLO_expand_main(void *fdhandle, Ma
                                        case ID_IP:
                                                expand_ipo(fd, mainvar, (Ipo *)id); // XXX deprecated - old animation system
                                                break;
 -                                      case ID_PA:
 -                                              expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
 -                                              break;
                                        case ID_MC:
                                                expand_movieclip(fd, mainvar, (MovieClip *)id);
                                                break;
index 7874dc052f02db50f1552dbcda07eecb7f15ef7d,5240aa24b547adb737418b364e5df3f8660366b8..ac6e6f8f09536c7c3e7c6bc41c17ac18e76288d4
@@@ -247,7 -247,7 +247,7 @@@ struct DepsgraphRelationBuilde
        void build_gpencil(ID *owner, bGPdata *gpd);
  
        void add_collision_relations(const OperationKey &key, Scene *scene, Object *ob, Group *group, int layer, bool dupli, const char *name);
 -      void add_forcefield_relations(const OperationKey &key, Scene *scene, Object *ob, ParticleSystem *psys, EffectorWeights *eff, bool add_absorption, const char *name);
 +      void add_forcefield_relations(const OperationKey &key, Scene *scene, Object *ob, EffectorWeights *eff, bool add_absorption, const char *name);
  
        template <typename KeyType>
        OperationDepsNode *find_operation_node(const KeyType &key);
@@@ -370,10 -370,12 +370,12 @@@ void DepsgraphRelationBuilder::add_node
        }
        else {
                if (!op_from) {
-                       /* XXX TODO handle as error or report if needed */
+                       fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_from (%s)\n",
+                               type, description, key_from.identifier().c_str());
                }
                if (!op_to) {
-                       /* XXX TODO handle as error or report if needed */
+                       fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_to (%s)\n",
+                               type, description, key_from.identifier().c_str());
                }
        }
  }
index 1b0f5862a44a5a19423f07da827467207de60642,02900d7022c6a358fd12c54f60cc5fdc28b472e0..c8ccb3772c586a0bbe6f7d2995e9291fa523192d
@@@ -294,7 -294,7 +294,7 @@@ static void copy_vert_no(const BVHTreeF
                case SNAP_MESH:
                {
                        BVHTreeFromMesh *data = meshdata->userdata;
-                       const MVert *vert = data->vert;
+                       const MVert *vert = data->vert + index;
                        normal_short_to_float_v3(r_no, vert->no);
                        break;
                }
@@@ -1302,6 -1302,7 +1302,7 @@@ static bool snapDerivedMesh
                                }
                        }
                }
+               /* SCE_SNAP_MODE_VERTEX or SCE_SNAP_MODE_EDGE */
                else {
                        const ARegion *ar = sctx->v3d_data.ar;
  
@@@ -1866,7 -1867,23 +1867,7 @@@ static bool snapObjectsRay
  
        unsigned int ob_index = 0;
        Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL;
 -
 -      /* 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.
 -       * */
        Base *base_act = sctx->scene->basact;
 -      if (base_act && base_act->object && base_act->object->mode & OB_MODE_PARTICLE_EDIT) {
 -              Object *ob = base_act->object;
 -
 -              retval |= snapObject(
 -                      sctx, ob, ob->obmat, ob_index++,
 -                      false, snap_to, mval,
 -                      ray_origin, ray_start, ray_normal, depth_range,
 -                      ray_depth, dist_px,
 -                      r_loc, r_no, r_index, r_ob, r_obmat, r_hit_list);
 -      }
  
        bool ignore_object_selected = false, ignore_object_active = false;
        switch (snap_select) {
index 440cfc0c814ab4ea25dd17961603b0e3a1b8e14d,b857aea29adac1cdb3c3672196084d185112ec02..3e8f0baf7b03fbc020fdf5adb0e5d860044cfcab
@@@ -117,6 -117,11 +117,6 @@@ struct GPUMaterial 
        int obcolloc, obautobumpscaleloc;
        int cameratexcofacloc;
  
 -      int partscalarpropsloc;
 -      int partcoloc;
 -      int partvel;
 -      int partangvel;
 -
        ListBase lamps;
        bool bound;
  
@@@ -255,6 -260,14 +255,6 @@@ static int GPU_material_construct_end(G
                        material->obautobumpscaleloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_AUTO_BUMPSCALE));
                if (material->builtins & GPU_CAMERA_TEXCO_FACTORS)
                        material->cameratexcofacloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_CAMERA_TEXCO_FACTORS));
 -              if (material->builtins & GPU_PARTICLE_SCALAR_PROPS)
 -                      material->partscalarpropsloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_SCALAR_PROPS));
 -              if (material->builtins & GPU_PARTICLE_LOCATION)
 -                      material->partcoloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_LOCATION));
 -              if (material->builtins & GPU_PARTICLE_VELOCITY)
 -                      material->partvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_VELOCITY));
 -              if (material->builtins & GPU_PARTICLE_ANG_VELOCITY)
 -                      material->partangvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
                return 1;
        }
        else {
@@@ -387,7 -400,7 +387,7 @@@ void GPU_material_bind
  
  void GPU_material_bind_uniforms(
          GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
 -        float autobumpscale, GPUParticleInfo *pi)
 +        float autobumpscale)
  {
        if (material->pass) {
                GPUShader *shader = GPU_pass_shader(material->pass);
                if (material->builtins & GPU_AUTO_BUMPSCALE) {
                        GPU_shader_uniform_vector(shader, material->obautobumpscaleloc, 1, 1, &autobumpscale);
                }
 -              if (material->builtins & GPU_PARTICLE_SCALAR_PROPS) {
 -                      GPU_shader_uniform_vector(shader, material->partscalarpropsloc, 4, 1, pi->scalprops);
 -              }
 -              if (material->builtins & GPU_PARTICLE_LOCATION) {
 -                      GPU_shader_uniform_vector(shader, material->partcoloc, 3, 1, pi->location);
 -              }
 -              if (material->builtins & GPU_PARTICLE_VELOCITY) {
 -                      GPU_shader_uniform_vector(shader, material->partvel, 3, 1, pi->velocity);
 -              }
 -              if (material->builtins & GPU_PARTICLE_ANG_VELOCITY) {
 -                      GPU_shader_uniform_vector(shader, material->partangvel, 3, 1, pi->angular_velocity);
 -              }
  
        }
  }
@@@ -779,7 -804,7 +779,7 @@@ static void shade_light_textures(GPUMat
        for (int i = 0; i < MAX_MTEX; ++i) {
                MTex *mtex = lamp->la->mtex[i];
  
-               if (mtex && mtex->tex->type & TEX_IMAGE && mtex->tex->ima) {
+               if (mtex && mtex->tex && (mtex->tex->type & TEX_IMAGE) && mtex->tex->ima) {
                        mat->dynproperty |= DYN_LAMP_PERSMAT;
  
                        float one = 1.0f;
@@@ -2384,7 -2409,7 +2384,7 @@@ GPULamp *GPU_lamp_from_blender(Scene *s
                                return lamp;
                        }
                
 -                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->depthtex, 0, NULL)) {
 +                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->depthtex, 0)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
                                return lamp;
                        }
  
 -                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, 0, NULL)) {
 +                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, 0)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
                                return lamp;
                        }
                
 -                      if (!GPU_framebuffer_texture_attach(lamp->blurfb, lamp->blurtex, 0, NULL)) {
 +                      if (!GPU_framebuffer_texture_attach(lamp->blurfb, lamp->blurtex, 0)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
                                return lamp;
                        }
  
 -                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, 0, NULL)) {
 +                      if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, 0)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }