fix for regression in bpy-api, python context passed to operators couldn't override...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 7 Feb 2013 04:04:12 +0000 (04:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 7 Feb 2013 04:04:12 +0000 (04:04 +0000)
source/blender/python/intern/bpy_interface.c
source/tests/batch_import.py

index 543ddeb..632018f 100644 (file)
@@ -765,6 +765,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 
                //result->ptr = ((BPy_StructRNA *)item)->ptr;
                CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
+               CTX_data_type_set(result, CTX_DATA_TYPE_POINTER);
                done = true;
        }
        else if (PySequence_Check(item)) {
@@ -795,12 +796,12 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 
                        }
                        Py_DECREF(seq_fast);
-
+                       CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                        done = true;
                }
        }
 
-       if (done == 0) {
+       if (done == false) {
                if (item) printf("PyContext '%s' not a valid type\n", member);
                else      printf("PyContext '%s' not found\n", member);
        }
index 77595bd..a2c5fb5 100644 (file)
@@ -134,8 +134,7 @@ def batch_import(operator="",
             print("\tSaving: %r" % fout_blend)
 
             fout_dir = os.path.dirname(fout_blend)
-            if not os.path.exists(fout_dir):
-                os.makedirs(fout_dir)
+            os.makedirs(fout_dir, exist_ok=True)
 
             bpy.ops.wm.save_as_mainfile(filepath=fout_blend)