Merged changes in the trunk up to revision 28685.

This commit is contained in:
2010-05-09 12:42:19 +00:00
212 changed files with 4139 additions and 8374 deletions

View File

@@ -346,7 +346,6 @@ static char py_blf_load_doc[] =
static PyObject *py_blf_load(PyObject *self, PyObject *args)
{
int fontid = 0;
char* filename;
if (!PyArg_ParseTuple(args, "s:blf.load", &filename))

View File

@@ -132,10 +132,9 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiO!s:BoolProperty", (char **)kwlist, &id, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "BoolProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "BoolProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolProperty(options={...}):"))
@@ -200,10 +199,9 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "BoolVectorProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolVectorProperty(options={...}):"))
@@ -275,10 +273,9 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "IntProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "IntProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntProperty(options={...}):"))
@@ -344,10 +341,9 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "IntVectorProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntVectorProperty(options={...}):"))
@@ -426,10 +422,9 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "FloatProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "FloatProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatProperty(options={...}):"))
@@ -500,10 +495,9 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatVectorProperty(options={...}):"))
@@ -576,10 +570,9 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sssiO!s:StringProperty", (char **)kwlist, &id, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "StringProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "StringProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "StringProperty(options={...}):"))
@@ -688,10 +681,9 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|sssO!:EnumProperty", (char **)kwlist, &id, &items, &name, &description, &def, &PySet_Type, &pyopts))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "EnumProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "EnumProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "EnumProperty(options={...}):"))
@@ -772,10 +764,9 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:PointerProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "PointerProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "PointerProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "PointerProperty(options={...}):"))
@@ -833,10 +824,9 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:CollectionProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts))
return NULL;
if(bpy_struct_id_used(srna, id)) {
// PyErr_Format(PyExc_TypeError, "CollectionProperty(): '%s' already defined.", id);
// return NULL;
Py_RETURN_NONE;
if(RNA_def_property_free_identifier(srna, id) == -1) {
PyErr_Format(PyExc_TypeError, "CollectionProperty(): '%s' is defined as a non-dynamic type.", id);
return NULL;
}
if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "CollectionProperty(options={...}):"))
@@ -860,6 +850,42 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
static char BPy_RemoveProperty_doc[] =
".. function:: RemoveProperty(attr)\n"
"\n"
" Removes a dynamically defined property.\n"
"\n"
" :arg attr: Property name.\n"
" :type attr: string";
PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
srna= srna_from_self(self, "RemoveProperty(...):");
if(srna==NULL && PyErr_Occurred()) {
return NULL; /* self's type was compatible but error getting the srna */
}
else if(srna==NULL) {
PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type.");
return NULL;
}
else {
static const char *kwlist[] = {"attr", NULL};
char *id=NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s:RemoveProperty", (char **)kwlist, &id))
return NULL;
if(RNA_def_property_free_identifier(srna, id) != 1) {
PyErr_Format(PyExc_TypeError, "RemoveProperty(): '%s' not a defined dynamic property.", id);
return NULL;
}
Py_RETURN_NONE;
}
}
static struct PyMethodDef props_methods[] = {
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
@@ -871,6 +897,9 @@ static struct PyMethodDef props_methods[] = {
{"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS, BPy_EnumProperty_doc},
{"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS, BPy_PointerProperty_doc},
{"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS, BPy_CollectionProperty_doc},
/* only useful as a bpy_struct method */
/* {"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS, BPy_RemoveProperty_doc}, */
{NULL, NULL, 0, NULL}
};

View File

@@ -41,6 +41,8 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw);
PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw);
#define PYRNA_STACK_ARRAY 32
#endif

View File

@@ -1864,7 +1864,7 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *er
}
static char pyrna_struct_keyframe_insert_doc[] =
".. method:: keyframe_insert(path, index=-1, frame=bpy.context.scene.frame_current)\n"
".. method:: keyframe_insert(path, index=-1, frame=bpy.context.scene.frame_current, group=\"\")\n"
"\n"
" Insert a keyframe on the property given, adding fcurves and animation data when necessary.\n"
"\n"
@@ -1898,7 +1898,7 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *arg
}
static char pyrna_struct_keyframe_delete_doc[] =
".. method:: keyframe_delete(path, index=-1, frame=bpy.context.scene.frame_current)\n"
".. method:: keyframe_delete(path, index=-1, frame=bpy.context.scene.frame_current, group=\"\")\n"
"\n"
" Remove a keyframe from this properties fcurve.\n"
"\n"
@@ -3794,6 +3794,8 @@ static struct PyMethodDef pyrna_struct_subtype_methods[] = {
{"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS, ""},
// {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}