merges changes to revision 23820

This commit is contained in:
Maxime Curioni
2009-10-14 06:08:48 +00:00
381 changed files with 14926 additions and 9687 deletions

View File

@@ -244,6 +244,9 @@ static PyObject *CreateGlobalDictionary( bContext *C )
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"BoolProperty", (PyCFunction)BPy_BoolProperty, 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, ""},
{NULL, NULL, 0, NULL}
};

View File

@@ -94,7 +94,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
char *report_str= BKE_reports_string(reports, 0); /* all reports */
if(report_str) {
PySys_WriteStdout(report_str);
PySys_WriteStdout("%s\n", report_str);
MEM_freeN(report_str);
}
}

View File

@@ -47,6 +47,7 @@
#define PYOP_ATTR_IDNAME_BL "__idname_bl__" /* our own name converted into blender syntax, users wont see this */
#define PYOP_ATTR_DESCRIPTION "__doc__" /* use pythons docstring */
#define PYOP_ATTR_REGISTER "__register__" /* True/False. if this python operator should be registered */
#define PYOP_ATTR_UNDO "__undo__" /* True/False. if this python operator should be undone */
static struct BPY_flag_def pyop_ret_flags[] = {
{"RUNNING_MODAL", OPERATOR_RUNNING_MODAL},
@@ -269,6 +270,9 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
/* api callbacks, detailed checks dont on adding */
if (PyObject_HasAttrString(py_class, "invoke"))
ot->invoke= PYTHON_OT_invoke;
//else
// ot->invoke= WM_operator_props_popup; /* could have an option for standard invokes */
if (PyObject_HasAttrString(py_class, "execute"))
ot->exec= PYTHON_OT_execute;
if (PyObject_HasAttrString(py_class, "poll"))
@@ -277,16 +281,27 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
ot->pyop_data= userdata;
/* flags */
ot->flag= 0;
item= PyObject_GetAttrString(py_class, PYOP_ATTR_REGISTER);
if (item) {
ot->flag= PyObject_IsTrue(item)!=0 ? OPTYPE_REGISTER:0;
ot->flag |= PyObject_IsTrue(item)!=0 ? OPTYPE_REGISTER:0;
Py_DECREF(item);
}
else {
ot->flag= OPTYPE_REGISTER; /* unspesified, leave on for now to help debug */
PyErr_Clear();
}
item= PyObject_GetAttrString(py_class, PYOP_ATTR_UNDO);
if (item) {
ot->flag |= PyObject_IsTrue(item)!=0 ? OPTYPE_UNDO:0;
Py_DECREF(item);
}
else {
PyErr_Clear();
}
props= PyObject_GetAttrString(py_class, PYOP_ATTR_PROP);
if (props) {

View File

@@ -762,7 +762,10 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
break;
}
}
/* Run rna property functions */
RNA_property_update(BPy_GetContext(), ptr, prop);
return 0;
}
@@ -1150,6 +1153,31 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA * self, PyObject *ar
return PyBool_FromLong( insert_keyframe((ID *)self->ptr.data, NULL, NULL, path, index, cfra, 0));
}
static PyObject *pyrna_struct_is_property_set(BPy_StructRNA * self, PyObject *args)
{
char *name;
if (!PyArg_ParseTuple(args, "s:is_property_set", &name))
return NULL;
return PyBool_FromLong(RNA_property_is_set(&self->ptr, name));
}
static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA * self, PyObject *args)
{
PropertyRNA *prop;
char *name;
int hidden;
if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name))
return NULL;
prop= RNA_struct_find_property(&self->ptr, name);
hidden= (prop)? (RNA_property_flag(prop) & PROP_HIDDEN): 1;
return PyBool_FromLong(hidden);
}
static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
{
@@ -1742,6 +1770,8 @@ static struct PyMethodDef pyrna_struct_methods[] = {
/* maybe this become and ID function */
{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, NULL},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, NULL},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}