Revision: 23835
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23835
Author:   blendix
Date:     2009-10-14 16:44:05 +0200 (Wed, 14 Oct 2009)

Log Message:
-----------
Bugfixes for python RNA/
* Adding properties to python defined subclasses could add
  them to the base type instead.
* FloatProperty did not work correct with negative min/max.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c        2009-10-14 
14:28:05 UTC (rev 23834)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c        2009-10-14 
14:44:05 UTC (rev 23835)
@@ -2315,6 +2315,19 @@
        NULL
 };
 
+static struct PyMethodDef pyrna_struct_subtype_methods[] = {
+       {"BoolProperty", (PyCFunction)BPy_BoolProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"IntProperty", (PyCFunction)BPy_IntProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"FloatProperty", (PyCFunction)BPy_FloatProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"StringProperty", (PyCFunction)BPy_StringProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"EnumProperty", (PyCFunction)BPy_EnumProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"PointerProperty", (PyCFunction)BPy_PointerProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+       {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
+
+//     {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""},
+       {NULL, NULL, 0, NULL}
+};
+
 static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
 {
        PointerRNA ptr;
@@ -2340,6 +2353,17 @@
        PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "__rna__", 
item);
        Py_DECREF(item);
        /* done with rna instance */
+
+       /* attach functions into the class
+        * so you can do... bpy.types.Scene.SomeFunction()
+        */
+       {
+               PyMethodDef *ml;
+
+               for(ml= pyrna_struct_subtype_methods; ml->ml_name; ml++){
+                       PyObject_SetAttrString(newclass, ml->ml_name, 
PyCFunction_New(ml, newclass));
+               }
+       }
 }
 
 /*
@@ -2362,20 +2386,6 @@
 }
 */
 
-static struct PyMethodDef pyrna_struct_subtype_methods[] = {
-       {"BoolProperty", (PyCFunction)BPy_BoolProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"IntProperty", (PyCFunction)BPy_IntProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"FloatProperty", (PyCFunction)BPy_FloatProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"StringProperty", (PyCFunction)BPy_StringProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"EnumProperty", (PyCFunction)BPy_EnumProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"PointerProperty", (PyCFunction)BPy_PointerProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-       {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, 
METH_VARARGS|METH_KEYWORDS, ""},
-
-//     {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""},
-       {NULL, NULL, 0, NULL}
-};
-
-
 PyObject* pyrna_srna_Subtype(StructRNA *srna)
 {
        PyObject *newclass = NULL;
@@ -2425,18 +2435,6 @@
                        pyrna_subtype_set_rna(newclass, srna);
 
                        Py_DECREF(newclass); /* let srna own */
-
-
-                       /* attach functions into the class
-                        * so you can do... bpy.types.Scene.SomeFunction()
-                        */
-                       {
-                               PyMethodDef *ml;
-                               for(ml= pyrna_struct_subtype_methods; 
ml->ml_name; ml++){
-                                       PyObject_SetAttrString(newclass, 
ml->ml_name, PyCFunction_New(ml, newclass));
-                               }
-                       }
-
                }
                else {
                        /* this should not happen */
@@ -2818,7 +2816,7 @@
 {
        static char *kwlist[] = {"attr", "name", "description", "min", "max", 
"soft_min", "soft_max", "default", NULL};
        char *id, *name="", *description="";
-       float min=FLT_MIN, max=FLT_MAX, soft_min=FLT_MIN, soft_max=FLT_MAX, 
def=0.0f;
+       float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, 
def=0.0f;
        PropertyRNA *prop;
        StructRNA *srna;
 


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to