2.5
authorNathan Letwory <nathan@letworyinteractive.com>
Sat, 3 Jan 2009 18:43:11 +0000 (18:43 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Sat, 3 Jan 2009 18:43:11 +0000 (18:43 +0000)
- Make sure shader, composit and texture ntrees have an id.name. This is to ensure
  that node trees in Material, Scene and Texture are properly identified through RNA

source/blender/blenloader/intern/readfile.c

index 82923be09cf9d1528cd21b9ebddde3340cf1c16e..843c769b92e4efbf1fc4984c594864a5606546c2 100644 (file)
@@ -8436,9 +8436,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
        if (main->versionfile < 250) {
                bScreen *screen;
+               Material *ma;
+               Scene *sce;
+               Tex *tx;
                
                for(screen= main->screen.first; screen; screen= screen->id.next)
                        do_versions_windowmanager_2_50(screen);
+               
+               /* shader, composit and texture node trees have id.name empty, put something in
+                * to have them show in RNA viewer and accessible otherwise.
+                */
+               for(ma= main->mat.first; ma; ma= ma->id.next) {
+                       if(ma->nodetree && strlen(ma->nodetree->id.name)==0)
+                               strcpy(ma->nodetree->id.name, "NTShader Nodetree");
+               }
+               /* and composit trees */
+               for(sce= main->scene.first; sce; sce= sce->id.next) {
+                       if(sce->nodetree && strlen(sce->nodetree->id.name)==0)
+                               strcpy(sce->nodetree->id.name, "NTComposit Nodetree");
+               }
+               /* and texture trees */
+               for(tx= main->tex.first; tx; tx= tx->id.next) {
+                       if(tx->nodetree && strlen(tx->nodetree->id.name)==0)
+                               strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
+               }
        }