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
This commit is contained in:
parent
91f061003c
commit
f79b4850fb
Notes:
blender-bot
2023-02-14 06:23:08 +01:00
Referenced by issue #81248, can't delete animation of duplicated environment (world)
|
@ -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);
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue