Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/ui/bpy_ops.py20
-rw-r--r--source/blender/blenkernel/intern/screen.c2
-rw-r--r--source/blender/makesrna/intern/rna_rna.c95
-rw-r--r--source/blender/python/epy_doc_gen.py23
-rw-r--r--source/blender/python/intern/bpy_interface.c14
-rw-r--r--source/blender/python/intern/bpy_operator.c34
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c54
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
9 files changed, 196 insertions, 54 deletions
diff --git a/release/ui/bpy_ops.py b/release/ui/bpy_ops.py
index aaf9edc082e..aa9bfb460f0 100644
--- a/release/ui/bpy_ops.py
+++ b/release/ui/bpy_ops.py
@@ -3,6 +3,7 @@ from bpy.__ops__ import add as op_add
from bpy.__ops__ import remove as op_remove
from bpy.__ops__ import dir as op_dir
from bpy.__ops__ import call as op_call
+from bpy.__ops__ import get_rna as op_get_rna
class bpy_ops(object):
'''
@@ -89,13 +90,22 @@ class bpy_ops_submodule_op(object):
self.module = module
self.func = func
- def __call__(self, **kw):
+ def idname(self):
# submod.foo -> SUBMOD_OT_foo
- id_name = self.module.upper() + '_OT_' + self.func
-
- # Get the operator from
- return op_call(id_name, kw)
+ return self.module.upper() + '_OT_' + self.func
+
+ def __call__(self, **kw):
+ # Get the operator from blender
+ return op_call(self.idname(), kw)
+
+ def get_rna(self):
+ '''
+ currently only used for '__rna__'
+ '''
+ return op_get_rna(self.idname())
+
+
def __repr__(self):
return "<function bpy.ops.%s.%s at 0x%x'>" % (self.module, self.func, id(self))
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 524120bf014..c1f621274c0 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -112,7 +112,7 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
if(art->regionid==regionid)
return art;
- printf("Error, region type missing in %s\n", st->name);
+ printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
return st->regiontypes.first;
}
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index aeaedd6f81d..385c7f5b2b1 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -432,6 +432,19 @@ static int rna_Property_registered_optional_get(PointerRNA *ptr)
return prop->flag & PROP_REGISTER_OPTIONAL;
}
+static int rna_BoolProperty_default_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((BooleanPropertyRNA*)prop)->defaultvalue;
+}
+
+static int rna_IntProperty_default_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA*)prop)->defaultvalue;
+}
static int rna_IntProperty_hard_min_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -467,6 +480,12 @@ static int rna_IntProperty_step_get(PointerRNA *ptr)
return ((IntPropertyRNA*)prop)->step;
}
+static float rna_FloatProperty_default_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA*)prop)->defaultvalue;
+}
static float rna_FloatProperty_hard_min_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -509,6 +528,19 @@ static int rna_FloatProperty_precision_get(PointerRNA *ptr)
return ((FloatPropertyRNA*)prop)->precision;
}
+static void rna_StringProperty_default_get(PointerRNA *ptr, char *value)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, ((StringPropertyRNA*)prop)->defaultvalue);
+}
+static int rna_StringProperty_default_length(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return strlen(((StringPropertyRNA*)prop)->defaultvalue);
+}
+
static int rna_StringProperty_max_length_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -516,6 +548,28 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
return ((StringPropertyRNA*)prop)->maxlength;
}
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ EnumPropertyRNA *eprop;
+
+ rna_idproperty_check(&prop, ptr);
+ eprop= (EnumPropertyRNA*)prop;
+
+ if(eprop->itemf==NULL || eprop->itemf==rna_EnumProperty_default_itemf)
+ return eprop->item;
+
+ return eprop->itemf(C, ptr, free);
+}
+
+/* XXX - not sore this is needed? */
+static int rna_EnumProperty_default_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((EnumPropertyRNA*)prop)->defaultvalue;
+}
+
static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data)
{
EnumPropertyItem *item= (EnumPropertyItem*)data;
@@ -816,6 +870,31 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
{
PropertyRNA *prop;
+ prop= RNA_def_property(srna, "default", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Default", "Default value for this number");
+
+ switch(type) {
+ case PROP_BOOLEAN:
+ RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
+ break;
+ case PROP_INT:
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL);
+ break;
+ case PROP_FLOAT:
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL);
+ break;
+ }
+
+
+#if 0 // XXX - Variable length arrays
+ prop= RNA_def_property(srna, "default_array", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL);
+ else RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Default", "Default value for this number");
+#endif
+
prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
@@ -866,6 +945,11 @@ static void rna_def_string_property(StructRNA *srna)
{
PropertyRNA *prop;
+ prop= RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL);
+ RNA_def_property_ui_text(prop, "Default", "string default value.");
+
prop= RNA_def_property(srna, "max_length", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
@@ -876,6 +960,17 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
{
PropertyRNA *prop;
+ /* the itemf func is used instead, keep blender happy */
+ static EnumPropertyItem default_dummy_items[] = {
+ {PROP_NONE, "DUMMY", 0, "Dummy", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ prop= RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, default_dummy_items);
+ RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
+ RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
+
prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "EnumPropertyItem");
diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py
index 9f3efc916bf..57c67233bf2 100644
--- a/source/blender/python/epy_doc_gen.py
+++ b/source/blender/python/epy_doc_gen.py
@@ -503,20 +503,21 @@ def rna2epy(target_path):
def op2epy(target_path):
out = open(target_path, 'w')
- operators = dir(bpy.ops)
- operators.remove('add')
- operators.remove('remove')
- operators.sort()
+ op_mods = dir(bpy.ops)
+ op_mods.remove('add')
+ op_mods.remove('remove')
- for op in operators:
-
- if op.startswith('__'):
+ for op_mod_name in sorted(op_mods):
+ if op_mod_name.startswith('__'):
continue
+
+ op_mod = getattr(bpy.ops, op_mod_name)
- # rna = getattr(bpy.types, op).__rna__
- rna = bpy.ops.__rna__(op)
-
- write_func(rna, '', out, 'OPERATOR')
+ operators = dir(op_mod)
+ for op in sorted(operators):
+ # rna = getattr(bpy.types, op).__rna__
+ rna = getattr(op_mod, op).get_rna()
+ write_func(rna, '', out, 'OPERATOR')
out.write('\n')
out.close()
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index ef2406d446c..473b3d42095 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -260,10 +260,16 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc
py_result = PyEval_EvalCode( text->compiled, py_dict, py_dict );
} else {
- char pystring[512];
- /* TODO - look into a better way to run a file */
- sprintf(pystring, "exec(open(r'%s').read())", fn);
- py_result = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
+ FILE *fp= fopen(fn, "r");
+ if(fp) {
+ py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
+ fclose(fp);
+ }
+ else {
+ PyErr_Format(PyExc_SystemError, "Python file \"%s\" could not be opened: %s", fn, strerror(errno));
+ py_result= NULL;
+ }
+
}
if (!py_result) {
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 240ce2030ba..2ffa9db4027 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -38,6 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
+#include "BKE_utildefines.h"
/* 'self' stores the operator string */
@@ -77,14 +78,14 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
}
- ot= WM_operatortype_find(opname, 1);
+ ot= WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format( PyExc_SystemError, "bpy.__ops__.call: operator \"%s\"could not be found", opname);
return NULL;
}
- if(ot->poll && (ot->poll(C) == 0)) {
+ if(ot->poll && (ot->poll(C) == FALSE)) {
PyErr_SetString( PyExc_SystemError, "bpy.__ops__.call: operator poll() function failed, context is incorrect");
return NULL;
}
@@ -146,10 +147,38 @@ static PyObject *pyop_dir(PyObject *self)
return list;
}
+static PyObject *pyop_getrna(PyObject *self, PyObject *value)
+{
+ wmOperatorType *ot;
+ PointerRNA ptr;
+ char *opname= _PyUnicode_AsString(value);
+ BPy_StructRNA *pyrna= NULL;
+
+ if(opname==NULL) {
+ PyErr_SetString(PyExc_TypeError, "bpy.__ops__.get_rna() expects a string argument");
+ return NULL;
+ }
+ ot= WM_operatortype_find(opname, TRUE);
+ if(ot==NULL) {
+ PyErr_Format(PyExc_KeyError, "bpy.__ops__.get_rna(\"%s\") not found", opname);
+ return NULL;
+ }
+
+ /* type */
+ //RNA_pointer_create(NULL, &RNA_Struct, ot->srna, &ptr);
+
+ /* XXX - should call WM_operator_properties_free */
+ WM_operator_properties_create(&ptr, ot->idname);
+ pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+ pyrna->freeptr= TRUE;
+ return (PyObject *)pyrna;
+}
+
PyObject *BPY_operator_module( void )
{
static PyMethodDef pyop_call_meth = {"call", (PyCFunction) pyop_call, METH_VARARGS, NULL};
static PyMethodDef pyop_dir_meth = {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL};
+ static PyMethodDef pyop_getrna_meth = {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL};
static PyMethodDef pyop_add_meth = {"add", (PyCFunction) PYOP_wrap_add, METH_O, NULL};
static PyMethodDef pyop_remove_meth = {"remove", (PyCFunction) PYOP_wrap_remove, METH_O, NULL};
@@ -158,6 +187,7 @@ PyObject *BPY_operator_module( void )
PyModule_AddObject( submodule, "call", PyCFunction_New(&pyop_call_meth, NULL) );
PyModule_AddObject( submodule, "dir", PyCFunction_New(&pyop_dir_meth, NULL) );
+ PyModule_AddObject( submodule, "get_rna", PyCFunction_New(&pyop_getrna_meth, NULL) );
PyModule_AddObject( submodule, "add", PyCFunction_New(&pyop_add_meth, NULL) );
PyModule_AddObject( submodule, "remove", PyCFunction_New(&pyop_remove_meth, NULL) );
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 02d721739e7..080d2e8ce6a 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -265,8 +265,8 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
}
item= PyObject_GetAttrString(py_class, PYOP_ATTR_DESCRIPTION);
- ot->description= (item && PyUnicode_Check(item)) ? _PyUnicode_AsString(item):"";
- Py_DECREF(item);
+ ot->description= (item && PyUnicode_Check(item)) ? _PyUnicode_AsString(item):"undocumented python operator";
+ Py_XDECREF(item);
/* api callbacks, detailed checks dont on adding */
if (PyObject_HasAttrString(py_class, "invoke"))
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index e83bb68a387..c76cb252f2c 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -171,7 +171,7 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA * self )
char *name;
/* print name if available */
- name= RNA_struct_name_get_alloc(&self->ptr, NULL, 0);
+ name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
if(name) {
pyob= PyUnicode_FromFormat( "[BPy_StructRNA \"%.200s\" -> \"%.200s\"]", RNA_struct_identifier(self->ptr.type), name);
MEM_freeN(name);
@@ -190,7 +190,7 @@ static PyObject *pyrna_prop_repr( BPy_PropertyRNA * self )
/* if a pointer, try to print name of pointer target too */
if(RNA_property_type(self->prop) == PROP_POINTER) {
ptr= RNA_property_pointer_get(&self->ptr, self->prop);
- name= RNA_struct_name_get_alloc(&ptr, NULL, 0);
+ name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
if(name) {
pyob= PyUnicode_FromFormat( "[BPy_PropertyRNA \"%.200s\" -> \"%.200s\" -> \"%.200s\" ]", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
@@ -225,7 +225,7 @@ static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
EnumPropertyItem *item;
char *result;
- int free= 0;
+ int free= FALSE;
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
if(item) {
@@ -258,31 +258,31 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
switch(RNA_property_subtype(prop)) {
case PROP_VECTOR:
if(len>=2 && len <= 4) {
- PyObject *vec_cb= newVectorObject_cb(ret, len, mathutils_rna_array_cb_index, 0);
+ PyObject *vec_cb= newVectorObject_cb(ret, len, mathutils_rna_array_cb_index, FALSE);
Py_DECREF(ret); /* the vector owns now */
ret= vec_cb; /* return the vector instead */
}
break;
case PROP_MATRIX:
if(len==16) {
- PyObject *mat_cb= newMatrixObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, 0);
+ PyObject *mat_cb= newMatrixObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
ret= mat_cb; /* return the matrix instead */
}
else if (len==9) {
- PyObject *mat_cb= newMatrixObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, 0);
+ PyObject *mat_cb= newMatrixObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
ret= mat_cb; /* return the matrix instead */
}
break;
case PROP_ROTATION:
if(len==3) { /* euler */
- PyObject *eul_cb= newEulerObject_cb(ret, mathutils_rna_array_cb_index, 0);
+ PyObject *eul_cb= newEulerObject_cb(ret, mathutils_rna_array_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
ret= eul_cb; /* return the matrix instead */
}
else if (len==4) {
- PyObject *quat_cb= newQuaternionObject_cb(ret, mathutils_rna_array_cb_index, 0);
+ PyObject *quat_cb= newQuaternionObject_cb(ret, mathutils_rna_array_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
ret= quat_cb; /* return the matrix instead */
}
@@ -325,7 +325,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
ret = PyUnicode_FromString( identifier );
} else {
EnumPropertyItem *item;
- int free= 0;
+ int free= FALSE;
/* don't throw error here, can't trust blender 100% to give the
* right values, python code should not generate error for that */
@@ -673,7 +673,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
return -1;
} else {
BPy_StructRNA *param= (BPy_StructRNA*)value;
- int raise_error= 0;
+ int raise_error= FALSE;
if(data) {
int flag = RNA_property_flag(prop);
@@ -690,7 +690,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
*((void**)data)= param->ptr.data;
}
else {
- raise_error= 1;
+ raise_error= TRUE;
}
}
else {
@@ -1465,13 +1465,13 @@ static void foreach_attr_type( BPy_PropertyRNA *self, char *attr,
PropertyRNA *prop;
*raw_type= -1;
*attr_tot= 0;
- *attr_signed= 0;
+ *attr_signed= FALSE;
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
prop = RNA_struct_find_property(&itemptr, attr);
*raw_type= RNA_property_raw_type(prop);
*attr_tot = RNA_property_array_length(prop);
- *attr_signed= (RNA_property_subtype(prop)==PROP_UNSIGNED) ? 0:1;
+ *attr_signed= (RNA_property_subtype(prop)==PROP_UNSIGNED) ? FALSE:TRUE;
break;
}
RNA_PROP_END;
@@ -1489,7 +1489,7 @@ static int foreach_parse_args(
int target_tot;
#endif
- *size= *raw_type= *attr_tot= *attr_signed= 0;
+ *size= *raw_type= *attr_tot= *attr_signed= FALSE;
if(!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
PyErr_SetString( PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence" );
@@ -1569,7 +1569,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
if(set) { /* get the array from python */
- buffer_is_compat = 0;
+ buffer_is_compat = FALSE;
if(PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
@@ -1616,7 +1616,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
}
}
else {
- buffer_is_compat = 0;
+ buffer_is_compat = FALSE;
if(PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
@@ -1962,14 +1962,14 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
item= PyTuple_GET_ITEM(args, i);
i++;
- kw_arg= 0;
+ kw_arg= FALSE;
}
else if (kw != NULL) {
item= PyDict_GetItemString(kw, parm_id); /* borrow ref */
if(item)
kw_tot++; /* make sure invalid keywords are not given */
- kw_arg= 1;
+ kw_arg= TRUE;
}
if (item==NULL) {
@@ -1990,7 +1990,7 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
char error_prefix[512];
PyErr_Clear(); /* re-raise */
- if(kw_arg)
+ if(kw_arg==TRUE)
snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with keyword argument \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), parm_id);
else
snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id);
@@ -2013,12 +2013,12 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
DynStr *good_args= BLI_dynstr_new();
char *arg_name, *bad_args_str, *good_args_str;
- int found= 0, first=1;
+ int found= FALSE, first= TRUE;
while (PyDict_Next(kw, &pos, &key, &value)) {
arg_name= _PyUnicode_AsString(key);
- found= 0;
+ found= FALSE;
if(arg_name==NULL) { /* unlikely the argname is not a string but ignore if it is*/
PyErr_Clear();
@@ -2029,28 +2029,28 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
for(; iter.valid; RNA_parameter_list_next(&iter)) {
parm= iter.parm;
if (strcmp(arg_name, RNA_property_identifier(parm))==0) {
- found= 1;
+ found= TRUE;
break;
}
}
RNA_parameter_list_end(&iter);
- if(!found) {
+ if(found==FALSE) {
BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name);
- first= 0;
+ first= FALSE;
}
}
}
/* list good args */
- first= 1;
+ first= TRUE;
RNA_parameter_list_begin(&parms, &iter);
for(; iter.valid; RNA_parameter_list_next(&iter)) {
parm= iter.parm;
BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
- first= 0;
+ first= FALSE;
}
RNA_parameter_list_end(&iter);
@@ -2403,7 +2403,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
}
pyrna->ptr= *ptr;
- pyrna->freeptr= 0;
+ pyrna->freeptr= FALSE;
// PyObSpit("NewStructRNA: ", (PyObject *)pyrna);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6c90926d545..39114dcfe13 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -137,7 +137,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
ot->name= dummy_name;
}
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:""); // XXX All ops should have a description but for now allow them not to.
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)"); // XXX All ops should have a description but for now allow them not to.
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_addtail(&global_ops, ot);
}
@@ -149,7 +149,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
opfunc(ot, userdata);
- RNA_def_struct_ui_text(ot->srna, ot->name, "DOC_BROKEN"); /* TODO - add a discription to wmOperatorType? */
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)");
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_addtail(&global_ops, ot);
}