Cleanup: use ntreeFromID
authorCampbell Barton <ideasman42@gmail.com>
Wed, 6 May 2015 14:18:11 +0000 (00:18 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 6 May 2015 14:18:11 +0000 (00:18 +1000)
source/blender/blenkernel/intern/library.c

index 42856e820629188b5b05c4aaa1aacc676100f0dc..ce118fe9fde8bc1508cecb15ba7d053171f1dfce 100644 (file)
@@ -1415,16 +1415,11 @@ void id_clear_lib_data(Main *bmain, ID *id)
        /* 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;
-               case ID_LS:             ntree = ((FreestyleLineStyle *)id)->nodetree; break;
-       }
-       if (ntree)
+       ntree = ntreeFromID(id);
+
+       if (ntree) {
                ntree->id.lib = NULL;
+       }
 }
 
 /* next to indirect usage in read/writefile also in editobject.c scene.c */