[Bf-blender-cvs] [f79b4850fb3] master: Fix T81248: World nodetree action is linked after duplication

Philipp Oeser noreply at git.blender.org
Thu Oct 1 15:52:58 CEST 2020


Commit: f79b4850fb3c29bf2a153428b1b4d4b5f67121f9
Author: Philipp Oeser
Date:   Tue Sep 29 10:52:10 2020 +0200
Branches: master
https://developer.blender.org/rBf79b4850fb3c29bf2a153428b1b4d4b5f67121f9

Fix T81248: World nodetree action is linked after duplication

This was already changed for Material nodetrees on duplication in
rBa75ac18638f4.
Since it is not obvious from the UI how change World actions - and to be
consistent with Material actions, it is best to copy the action as the
default behavior.
So use generic BKE_id_copy functions with LIB_ID_COPY_ACTIONS flag [which
also enables us to get rid of `BKE_world_copy`]

Note: taking the User Preference `USER_DUP_ACT` into account here (for
both material and world actions) could be a followup step.

Maniphest Tasks: T81248

Differential Revision: https://developer.blender.org/D9046

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

M	source/blender/blenkernel/BKE_world.h
M	source/blender/blenkernel/intern/world.c
M	source/blender/editors/render/render_shading.c

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

diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index 82830facccc..73eb340e887 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -31,7 +31,6 @@ struct Main;
 struct World;
 
 struct World *BKE_world_add(struct Main *bmain, const char *name);
-struct World *BKE_world_copy(struct Main *bmain, const struct World *wrld);
 struct World *BKE_world_localize(struct World *wrld);
 void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world);
 
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 99f35d06c1d..d5142e2d1a4 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -210,13 +210,6 @@ World *BKE_world_add(Main *bmain, const char *name)
   return wrld;
 }
 
-World *BKE_world_copy(Main *bmain, const World *wrld)
-{
-  World *wrld_copy;
-  BKE_id_copy(bmain, &wrld->id, (ID **)&wrld_copy);
-  return wrld_copy;
-}
-
 World *BKE_world_localize(World *wrld)
 {
   /* TODO(bastien): Replace with something like:
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 5999a622368..5ebf2a3915d 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -873,7 +873,9 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
 
   /* add or copy world */
   if (wo) {
-    wo = BKE_world_copy(bmain, wo);
+    World *new_wo = NULL;
+    BKE_id_copy_ex(bmain, &wo->id, (ID **)&new_wo, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
+    wo = new_wo;
   }
   else {
     wo = BKE_world_add(bmain, DATA_("World"));



More information about the Bf-blender-cvs mailing list