Commit: c98b2e74df2e531726f5ceabe76342282f695f23
Author: Bastien Montagne
Date:   Tue Jun 12 12:38:54 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc98b2e74df2e531726f5ceabe76342282f695f23

Merge branch 'master' into blender2.8

Conflicts:
        source/blender/editors/object/object_add.c
        source/blender/editors/object/object_relations.c

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_animsys.h
index 326c25e8899,b25f57b4be2..7ae9527b2f7
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@@ -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 {
diff --cc source/blender/blenkernel/intern/nla.c
index b91887e6815,1db4e878c9a..56705c834d5
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@@ -54,12 -54,13 +54,13 @@@
  
  #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"
diff --cc source/blender/editors/object/object_add.c
index 9ce7f556448,039ea518b23..e079cfd1d90
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -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) {
diff --cc source/blender/editors/object/object_relations.c
index 4f441826bfd,727b7d69723..84e3e63fede
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@@ -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;
@@@ -1845,26 -1943,31 +1845,26 @@@
        }
  }
  
- 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);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to