- 'id_data' attribute for py rna api, so you can get the Mesh from a face, Armature...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Oct 2009 11:31:24 +0000 (11:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Oct 2009 11:31:24 +0000 (11:31 +0000)
- fixed crash when adjusting added objects settngs from the toolbar.

release/scripts/modules/bpy_ops.py
source/blender/editors/object/object_add.c
source/blender/python/intern/bpy_rna.c

index 8b5d07b3986a700fdd9d558b1abd6f49d86c883f..3eeb7f554002306c14f6743a0564e2abea79507a 100644 (file)
@@ -364,6 +364,7 @@ class WM_OT_doc_edit(bpy.types.Operator):
        __label__ = "Edit Documentation"
        __props__ = [doc_id, doc_new]
        
+       
        def _send_xmlrpc(self, data_dict):              
                print("sending data:", data_dict)
                
index f2022cb490f9d9f82ccdbb200b3a7f1dce875682..c8c8d5628ed99b87d94a77a075f9ce4899260b0b 100644 (file)
@@ -123,10 +123,8 @@ void ED_object_base_init_from_view(bContext *C, Base *base)
                }
                
                if (U.flag & USER_ADD_VIEWALIGNED) {
-                       ARegion *ar= CTX_wm_region(C);
-                       if(ar) {
-                               RegionView3D *rv3d= ar->regiondata;
-                               
+                       RegionView3D *rv3d = CTX_wm_region_view3d(C);
+                       if(rv3d) {
                                rv3d->viewquat[0]= -rv3d->viewquat[0];
                                QuatToEul(rv3d->viewquat, ob->rot);
                                rv3d->viewquat[0]= -rv3d->viewquat[0];
index a60de529e8f317dca59b8551607eeb8b778cb607..b067d30e36efeaf3a4d2e06636dbc1875c56a4a5 100644 (file)
@@ -1178,7 +1178,6 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA * self, PyObject
        return PyBool_FromLong(hidden);
 }
 
-
 static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
 {
        PyObject *ret, *dict;
@@ -1263,6 +1262,13 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
                BLI_freelistN(&lb);
        }
        
+       /* Hard coded names */
+       {
+               pystring = PyUnicode_FromString("id_data");
+               PyList_Append(ret, pystring);
+               Py_DECREF(pystring);
+       }
+
        return ret;
 }
 
@@ -1319,6 +1325,16 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA * self, PyObject *pyname )
 
                BLI_freelistN(&newlb);
        }
+       else if (strcmp(name, "id_data")==0) { /* XXX - hard coded */
+               if(self->ptr.id.data) {
+                       PointerRNA id_ptr;
+                       RNA_id_pointer_create((ID *)self->ptr.id.data, &id_ptr);
+                       return pyrna_struct_CreatePyObject(&id_ptr);
+               }
+               else {
+                       Py_RETURN_NONE;
+               }
+       }
        else {
                PyErr_Format( PyExc_AttributeError, "StructRNA - Attribute \"%.200s\" not found", name);
                ret = NULL;