Merge from 2.5 r21160 through r21285
[blender.git] / source / blender / python / intern / bpy_rna.c
index e13f02c5529ffe9f245b331a153b9d91d924944b..c5c56aeb5b08c73ce0fbf8e4123f2c86bfb65841 100644 (file)
@@ -1621,8 +1621,12 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
                                newptr= *(PointerRNA*)data;
                        }
                        else {
-                               /* XXX this is missing the ID part! */
-                               RNA_pointer_create(NULL, type, *(void**)data, &newptr);
+                               if (RNA_struct_is_ID(type)) {
+                                       RNA_id_pointer_create(*(void**)data, &newptr);
+                               }
+                               else {
+                                       RNA_pointer_create(NULL, type, *(void**)data, &newptr);
+                               }
                        }
 
                        if (newptr.data) {