diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-12 11:02:52 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-12 11:02:52 +0400 |
commit | f0b991c944e8a4af383619f620eb2115595abb04 (patch) | |
tree | ddbd57ec05ede020b629639fa40cae8c86dc6e77 /source/blender/blenkernel/intern/library.c | |
parent | d00ca6eb2c4f9598bfbf9419f36937a16f81fc62 (diff) |
Supplementary fix for #35640, internal node group trees (inside material, lamp, world, texture and scene) still keep their original library pointer when appending, making them uneditable. Clearing the
lib pointer now has been moved inside the id_clear_lib_data function, with an ugly switch statement to handle integrated node trees.
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index db4706e3c6c..c1715ada7bd 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1428,11 +1428,26 @@ bool new_id(ListBase *lb, ID *id, const char *tname) * don't have other library users. */ void id_clear_lib_data(Main *bmain, ID *id) { + bNodeTree *ntree = NULL; + BKE_id_lib_local_paths(bmain, id->lib, id); id->lib = NULL; id->flag = LIB_LOCAL; new_id(which_libbase(bmain, GS(id->name)), id, NULL); + + /* internal bNodeTree blocks inside ID types below + * also stores id->lib, make sure this stays in sync. + */ + switch (GS(id->name)) { + case ID_SCE: ntree = ((Scene *)id)->nodetree; break; + case ID_MA: ntree = ((Material *)id)->nodetree; break; + case ID_LA: ntree = ((Lamp *)id)->nodetree; break; + case ID_WO: ntree = ((World *)id)->nodetree; break; + case ID_TE: ntree = ((Tex *)id)->nodetree; break; + } + if (ntree) + ntree->id.lib = NULL; } /* next to indirect usage in read/writefile also in editobject.c scene.c */ |