fix [#29462] libraries.load can't have link=False when relative=True
authorCampbell Barton <ideasman42@gmail.com>
Wed, 30 Nov 2011 06:15:35 +0000 (06:15 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 30 Nov 2011 06:15:35 +0000 (06:15 +0000)
was doing an unnecessary (and incorrect) library lookup.

source/blender/python/intern/bpy_library.c

index d7c7a1e846f8e4e9b864a85b0e1db4da5b0ce91c..a6426a02e18418e6cedaae45b3cb497c44f03cde 100644 (file)
@@ -265,8 +265,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
 
        /* create a dummy */
        self_from= PyObject_New(BPy_Library, &bpy_lib_Type);
-       BLI_strncpy(self_from->relpath, self->relpath, sizeof(BPy_Library));
-       BLI_strncpy(self_from->abspath, self->abspath, sizeof(BPy_Library));
+       BLI_strncpy(self_from->relpath, self->relpath, sizeof(self_from->relpath));
+       BLI_strncpy(self_from->abspath, self->abspath, sizeof(self_from->abspath));
 
        self_from->blo_handle= NULL;
        self_from->flag= 0;
@@ -396,6 +396,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
                return NULL;
        }
        else {
+               Library *lib= mainl->curlib; /* newly added lib, assign before append end */
                BLO_library_append_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
                BLO_blendhandle_close(self->blo_handle);
                self->blo_handle= NULL;
@@ -406,9 +407,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
 
                        /* append, rather than linking */
                        if ((self->flag & FILE_LINK)==0) {
-                               Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name));
-                               if (lib)  BKE_library_make_local(bmain, lib, 1);
-                               else      BLI_assert(!"cant find name of just added library!");
+                               BKE_library_make_local(bmain, lib, 1);
                        }
                }