Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 12 Jun 2018 10:38:54 +0000 (12:38 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 12 Jun 2018 10:38:54 +0000 (12:38 +0200)
Conflicts:
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c

12 files changed:
1  2 
intern/cycles/device/device_cuda.cpp
source/blender/blenkernel/BKE_animsys.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/armature/armature_relations.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/render/intern/source/pipeline.c

Simple merge
@@@ -70,13 -68,13 +70,13 @@@ bool BKE_animdata_set_action(struct Rep
  void BKE_animdata_free(struct ID *id, const bool do_id_user);
  
  /* Copy AnimData */
 -struct AnimData *BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, const bool do_action);
 +struct AnimData *BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, const bool do_action, const bool do_id_user);
  
  /* Copy AnimData */
 -bool BKE_animdata_copy_id(struct Main *bmain, struct ID *id_to, struct ID *id_from, const bool do_action);
 +bool BKE_animdata_copy_id(struct Main *bmain, struct ID *id_to, struct ID *id_from, const bool do_action, const bool do_id_user);
  
  /* Copy AnimData Actions */
- void BKE_animdata_copy_id_action(struct ID *id, const bool set_newid);
+ void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id, const bool set_newid);
  
  /* Merge copies of data from source AnimData block */
  typedef enum eAnimData_MergeCopy_Modes {
  
  #include "BKE_action.h"
  #include "BKE_fcurve.h"
- #include "BKE_nla.h"
  #include "BKE_global.h"
  #include "BKE_library.h"
+ #include "BKE_main.h"
+ #include "BKE_nla.h"
  
  #ifdef WITH_AUDASPACE
 -#  include AUD_SPECIAL_H
 +#  include <AUD_Special.h>
  #endif
  
  #include "RNA_access.h"
@@@ -2256,10 -2194,25 +2256,10 @@@ static Base *object_add_duplicate_inter
                        }
  
                        if (dupflag & USER_DUP_ACT) {
-                               BKE_animdata_copy_id_action((ID *)obn->data, true);
 -                              bActuator *act;
 -
+                               BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true);
                                if (key) {
-                                       BKE_animdata_copy_id_action((ID *)key, true);
+                                       BKE_animdata_copy_id_action(bmain, (ID *)key, true);
                                }
 -
 -                              /* Update the duplicated action in the action actuators */
 -                              /* XXX TODO this code is all wrong! actact->act is user-refcounted (see readfile.c),
 -                               * and what about other ID pointers of other BGE logic bricks,
 -                               * and since this is object-level, why is it only ran if obdata was duplicated??? -mont29 */
 -                              for (act = obn->actuators.first; act; act = act->next) {
 -                                      if (act->type == ACT_ACTION) {
 -                                              bActionActuator *actact = (bActionActuator *) act->data;
 -                                              if (ob->adt && actact->act == ob->adt->action) {
 -                                                      actact->act = obn->adt->action;
 -                                              }
 -                                      }
 -                              }
                        }
  
                        if (dupflag & USER_DUP_MAT) {
@@@ -1803,10 -1908,10 +1803,10 @@@ static void single_obdata_users(Main *b
                                        case OB_LATTICE:
                                                ob->data = lat = ID_NEW_SET(ob->data, BKE_lattice_copy(bmain, ob->data));
                                                if (lat->key)  /* We do not need to set lat->key->id.newid here... */
-                                                       BKE_animdata_copy_id_action((ID *)lat->key, false);
+                                                       BKE_animdata_copy_id_action(bmain, (ID *)lat->key, false);
                                                break;
                                        case OB_ARMATURE:
 -                                              DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +                                              DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
                                                ob->data = ID_NEW_SET(ob->data, BKE_armature_copy(bmain, ob->data));
                                                BKE_pose_rebuild(ob, ob->data);
                                                break;
        }
  }
  
- static void single_object_action_users(Scene *scene, ViewLayer *view_layer, const int flag)
 -static void single_object_action_users(Main *bmain, Scene *scene, const int flag)
++static void single_object_action_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
  {
 -      Object *ob;
 -      Base *base;
 -
 -      for (base = FIRSTBASE; base; base = base->next) {
 -              ob = base->object;
 -              if (!ID_IS_LINKED(ob) && (flag == 0 || (base->flag & SELECT)) ) {
 -                      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +      FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
 +      {
 +              if (!ID_IS_LINKED(ob)) {
 +                      DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
-                       BKE_animdata_copy_id_action(&ob->id, false);
+                       BKE_animdata_copy_id_action(bmain, &ob->id, false);
                }
        }
 +      FOREACH_OBJECT_FLAG_END;
  }
  
 -static void single_mat_users(Main *bmain, Scene *scene, const int flag, const bool do_textures)
 +static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
  {
 -      Object *ob;
 -      Base *base;
        Material *ma, *man;
 -      Tex *tex;
 -      int a, b;
 +      int a;
  
 -      for (base = FIRSTBASE; base; base = base->next) {
 -              ob = base->object;
 -              if (!ID_IS_LINKED(ob) && (flag == 0 || (base->flag & SELECT)) ) {
 +      FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
 +      {
 +              if (!ID_IS_LINKED(ob)) {
                        for (a = 1; a <= ob->totcol; a++) {
                                ma = give_current_material(ob, a);
                                if (ma) {
@@@ -1910,14 -2087,22 +1910,14 @@@ static void single_mat_users_expand(Mai
  }
  
  /* used for copying scenes */
 -void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bool copy_groups)
 +void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bool copy_collections)
  {
 -      single_object_users(bmain, scene, NULL, 0, copy_groups);
 +      single_object_users(bmain, scene, NULL, 0, copy_collections);
  
        if (full) {
 -              single_obdata_users(bmain, scene, 0);
 -              single_object_action_users(bmain, scene, 0);
 +              single_obdata_users(bmain, scene, NULL, 0);
-               single_object_action_users(scene, NULL, 0);
++              single_object_action_users(bmain, scene, NULL, 0);
                single_mat_users_expand(bmain);
 -              single_tex_users_expand(bmain);
        }
  
        /* Relink nodetrees' pointers that have been duplicated. */
@@@ -2453,11 -2430,15 +2453,11 @@@ static int make_single_user_exec(bConte
        }
  
        if (RNA_boolean_get(op->ptr, "material")) {
 -              single_mat_users(bmain, scene, flag, RNA_boolean_get(op->ptr, "texture"));
 +              single_mat_users(bmain, scene, view_layer, flag);
        }
  
 -#if 0 /* can't do this separate from materials */
 -      if (RNA_boolean_get(op->ptr, "texture"))
 -              single_mat_users(scene, flag, true);
 -#endif
        if (RNA_boolean_get(op->ptr, "animation")) {
-               single_object_action_users(scene, view_layer, flag);
 -              single_object_action_users(bmain, scene, flag);
++              single_object_action_users(bmain, scene, view_layer, flag);
        }
  
        BKE_main_id_clear_newpoins(bmain);