Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 15 Nov 2018 15:28:37 +0000 (16:28 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 15 Nov 2018 15:28:37 +0000 (16:28 +0100)
1  2 
source/blender/blenkernel/intern/lamp.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/world.c

index 2c57a2bdb0a88300c9d0aca93d69a122701dbe26,84a8e11bdc81056454a31b4a21062381b75a8811..1ca794b8a4ab18c2fcf000b8066b5f916e95e1ac
@@@ -139,14 -157,27 +139,17 @@@ Lamp *BKE_lamp_copy(Main *bmain, const 
  
  Lamp *BKE_lamp_localize(Lamp *la)
  {
-       /* TODO replace with something like
-        * Lamp *la_copy;
-        * BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
-        * return la_copy;
+       /* TODO(bastien): Replace with something like:
         *
-        * ... Once f*** nodes are fully converted to that too :( */
+        *   Lamp *la_copy;
+        *   BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy,
+        *                  LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+        *                  false);
+        *   return la_copy;
+        *
+        * NOTE: Only possible once nested node trees are fully converted to that too. */
  
 -      Lamp *lan;
 -      int a;
 -
 -      lan = BKE_libblock_copy_nolib(&la->id, false);
 -
 -      for (a = 0; a < MAX_MTEX; a++) {
 -              if (lan->mtex[a]) {
 -                      lan->mtex[a] = MEM_mallocN(sizeof(MTex), __func__);
 -                      memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
 -              }
 -      }
 +      Lamp *lan = BKE_libblock_copy_nolib(&la->id, false);
  
        lan->curfalloff = curvemapping_copy(la->curfalloff);
  
index 4d764e70ef1f116ba49d8b6f50f75f2ab076d436,3414d08b8e7bb7b1598de1f7c43db2b8e08e07f9..fc0423dc5e547d9cad567f56dd4c594788006b3d
@@@ -225,22 -273,31 +225,25 @@@ Material *BKE_material_copy(Main *bmain
  /* XXX (see above) material copy without adding to main dbase */
  Material *BKE_material_localize(Material *ma)
  {
-       /* TODO replace with something like
-        * Material *ma_copy;
-        * BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
-        * return ma_copy;
+       /* TODO(bastien): Replace with something like:
         *
-        * ... Once f*** nodes are fully converted to that too :( */
+        *   Material *ma_copy;
+        *   BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy,
+        *                  LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+        *                  false);
+        *   return ma_copy;
+        *
+        * NOTE: Only possible once nested node trees are fully converted to that too. */
  
        Material *man;
 -      int a;
 -
 -      man = BKE_libblock_copy_nolib(&ma->id, false);
  
 -      /* no increment for texture ID users, in previewrender.c it prevents decrement */
 -      for (a = 0; a < MAX_MTEX; a++) {
 -              if (ma->mtex[a]) {
 -                      man->mtex[a] = MEM_mallocN(sizeof(MTex), "copymaterial");
 -                      memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
 -              }
 -      }
 -
 -      if (ma->ramp_col) man->ramp_col = MEM_dupallocN(ma->ramp_col);
 -      if (ma->ramp_spec) man->ramp_spec = MEM_dupallocN(ma->ramp_spec);
 +      BKE_id_copy_ex(
 +              NULL, &ma->id, (ID **)&man,
 +              (LIB_ID_CREATE_NO_MAIN |
 +               LIB_ID_CREATE_NO_USER_REFCOUNT |
 +               LIB_ID_COPY_NO_PREVIEW |
 +               LIB_ID_COPY_NO_ANIMDATA),
 +              false);
  
        man->texpaintslot = NULL;
        man->preview = NULL;
index 14a9133f8fbe696b6fd8fc822be16ba96c8640d3,a44d717bbdd5cab2218eebe2761346a8560662a1..cb8103588a7c46f3b8dfdf36e9ce70d31565f4a3
@@@ -142,14 -159,18 +142,17 @@@ World *BKE_world_copy(Main *bmain, cons
  
  World *BKE_world_localize(World *wrld)
  {
-       /* TODO replace with something like
-        * World *wrld_copy;
-        * BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
-        * return wrld_copy;
+       /* TODO(bastien): Replace with something like:
         *
-        * ... Once f*** nodes are fully converted to that too :( */
+        *   World *wrld_copy;
+        *   BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy,
+        *                  LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+        *                  false);
+        *   return wrld_copy;
+        *
+        * NOTE: Only possible once nested node trees are fully converted to that too. */
  
        World *wrldn;
 -      int a;
  
        wrldn = BKE_libblock_copy_nolib(&wrld->id, false);