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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-10-31 16:31:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-10-31 16:31:23 +0300
commitea265fc69702566a846be3005d9fd814a10d7d54 (patch)
tree011f35edde76ca7519c6e4bfc9acb01c0d39774e /source
parent85eb9d6a2f0a0d94f795fc5264670e85ad56992f (diff)
change blender python interface for classes not to ise __idname__ rather bl_idname since __somename__ is for pythons internal use.
replacements... "__idname__" -> "bl_idname" "__props__" -> "bl_props" "__label__" -> "bl_label" "__register__" -> "bl_register" "__undo__" -> "bl_undo" "__space_type__" -> "bl_space_type" "__default_closed__" -> "bl_default_closed" "__region_type__" -> "bl_region_type" "__context__" -> "bl_context" "__show_header__" -> "bl_show_header" "__URL__" -> "_url"
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_ui.c24
-rw-r--r--source/blender/python/epy_doc_gen.py4
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c16
-rw-r--r--source/blender/python/intern/bpy_rna.c22
-rw-r--r--source/blender/python/rna_dump.py4
5 files changed, 36 insertions, 34 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 8d6a18dd9c2..34b50e1b3ea 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -591,33 +591,34 @@ static void rna_def_panel(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "drawname");
/* registration */
- prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->label");
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
RNA_def_property_enum_items(prop, region_type_items);
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "context", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->context");
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "default_closed", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_default_closed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_show_header", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
RNA_def_property_flag(prop, PROP_REGISTER);
}
@@ -647,11 +648,11 @@ static void rna_def_header(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "UILayout");
/* registration */
- prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_flag(prop, PROP_REGISTER);
@@ -691,11 +692,12 @@ static void rna_def_menu(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "UILayout");
/* registration */
- prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
RNA_def_property_flag(prop, PROP_REGISTER);
- prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->label");
RNA_def_property_flag(prop, PROP_REGISTER);
diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py
index 4ff5c8102e2..851eaa3b6f3 100644
--- a/source/blender/python/epy_doc_gen.py
+++ b/source/blender/python/epy_doc_gen.py
@@ -440,7 +440,7 @@ def rna2epy(BASEPATH):
for rna_type_name in dir(bpy.types):
rna_type = getattr(bpy.types, rna_type_name)
- try: rna_struct = rna_type.__rna__
+ try: rna_struct = rna_type.bl_rna
except: rna_struct = None
if rna_struct:
@@ -672,7 +672,7 @@ def op2epy(BASEPATH):
op_mod = getattr(bpy.ops, op_mod_name)
operators = dir(op_mod)
for op in sorted(operators):
- # rna = getattr(bpy.types, op).__rna__
+ # rna = getattr(bpy.types, op).bl_rna
rna = getattr(op_mod, op).get_rna()
write_func(rna, '', out, 'OPERATOR')
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 769a8336d4a..959213b77aa 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -41,13 +41,13 @@
#include "../generic/bpy_internal_import.h" // our own imports
-#define PYOP_ATTR_PROP "__props__"
-#define PYOP_ATTR_UINAME "__label__"
-#define PYOP_ATTR_IDNAME "__idname__" /* the name given by python */
-#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 */
+#define PYOP_ATTR_PROP "bl_props"
+#define PYOP_ATTR_UINAME "bl_label"
+#define PYOP_ATTR_IDNAME "bl_idname" /* the name given by python */
+#define PYOP_ATTR_IDNAME_BL "_bl_idname" /* our own name converted into blender syntax, users wont see this */
+#define PYOP_ATTR_DESCRIPTION "__doc__" /* use pythons docstring */
+#define PYOP_ATTR_REGISTER "bl_register" /* True/False. if this python operator should be registered */
+#define PYOP_ATTR_UNDO "bl_undo" /* True/False. if this python operator should be undone */
static struct BPY_flag_def pyop_ret_flags[] = {
{"RUNNING_MODAL", OPERATOR_RUNNING_MODAL},
@@ -98,7 +98,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
bpy_context_set(C, &gilstate);
args = PyTuple_New(1);
- PyTuple_SET_ITEM(args, 0, PyObject_GetAttrString(py_class, "__rna__")); // need to use an rna instance as the first arg
+ PyTuple_SET_ITEM(args, 0, PyObject_GetAttrString(py_class, "bl_rna")); // need to use an rna instance as the first arg
py_class_instance = PyObject_Call(py_class, args, NULL);
Py_DECREF(args);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index d9c996474fd..abd53df30cd 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2407,7 +2407,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
item = pyrna_struct_CreatePyObject(&ptr);
//item = PyCObject_FromVoidPtr(srna, NULL);
- PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "__rna__", item);
+ PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "bl_rna", item);
Py_DECREF(item);
/* done with rna instance */
@@ -2740,26 +2740,26 @@ static StructRNA *pyrna_struct_as_srna(PyObject *self)
/* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */
if(PyType_Check(self)) {
- py_srna = (BPy_StructRNA *)PyDict_GetItemString(((PyTypeObject *)self)->tp_dict, "__rna__");
+ py_srna = (BPy_StructRNA *)PyDict_GetItemString(((PyTypeObject *)self)->tp_dict, "bl_rna");
Py_XINCREF(py_srna);
}
if(py_srna==NULL)
- py_srna = (BPy_StructRNA*)PyObject_GetAttrString(self, "__rna__");
+ py_srna = (BPy_StructRNA*)PyObject_GetAttrString(self, "bl_rna");
if(py_srna==NULL) {
- PyErr_SetString(PyExc_SystemError, "internal error, self had no __rna__ attribute, should never happen.");
+ PyErr_SetString(PyExc_SystemError, "internal error, self had no bl_rna attribute, should never happen.");
return NULL;
}
if(!BPy_StructRNA_Check(py_srna)) {
- PyErr_Format(PyExc_SystemError, "internal error, __rna__ was of type %.200s, instead of %.200s instance.", Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
+ PyErr_Format(PyExc_SystemError, "internal error, bl_rna was of type %.200s, instead of %.200s instance.", Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
Py_DECREF(py_srna);
return NULL;
}
if(py_srna->ptr.type != &RNA_Struct) {
- PyErr_SetString(PyExc_SystemError, "internal error, __rna__ was not a RNA_Struct type of rna struct.");
+ PyErr_SetString(PyExc_SystemError, "internal error, bl_rna was not a RNA_Struct type of rna struct.");
Py_DECREF(py_srna);
return NULL;
}
@@ -3107,7 +3107,7 @@ static int deferred_register_props(PyObject *py_class, StructRNA *srna)
PyObject *props, *dummy_args, *item;
int i;
- props= PyObject_GetAttrString(py_class, "__props__");
+ props= PyObject_GetAttrString(py_class, "bl_props");
if(!props) {
PyErr_Clear();
@@ -3138,7 +3138,7 @@ static int deferred_register_props(PyObject *py_class, StructRNA *srna)
}
else {
PyErr_Clear();
- PyErr_SetString(PyExc_AttributeError, "expected list of dicts for __props__.");
+ PyErr_SetString(PyExc_AttributeError, "expected list of dicts for bl_props.");
Py_DECREF(dummy_args);
return 0;
}
@@ -3179,7 +3179,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
PyObject *item, *fitem;
PyObject *py_arg_count;
int i, flag, arg_count, func_arg_count;
- char identifier[128];
+ char *identifier;
if (base_class) {
if (!PyObject_IsSubclass(py_class, base_class)) {
@@ -3250,11 +3250,11 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
if(!(flag & PROP_REGISTER))
continue;
- BLI_snprintf(identifier, sizeof(identifier), "__%s__", RNA_property_identifier(prop));
+ identifier= RNA_property_identifier(prop);
item = PyObject_GetAttrString(py_class, identifier);
if (item==NULL) {
- if(strcmp(identifier, "__idname__") == 0) {
+ if(strcmp(identifier, "bl_idname") == 0) {
item= PyObject_GetAttrString(py_class, "__name__");
if(item) {
diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py
index 66fb76c35aa..7dde4007f66 100644
--- a/source/blender/python/rna_dump.py
+++ b/source/blender/python/rna_dump.py
@@ -123,10 +123,10 @@ seek(bpy.data, 'bpy.data', 0)
'''
for d in dir(bpy.types):
t = getattr(bpy.types, d)
- try: r = t.__rna__
+ try: r = t.bl_rna
except: r = None
if r:
- seek(r, 'bpy.types.' + d + '.__rna__', 0)
+ seek(r, 'bpy.types.' + d + '.bl_rna', 0)
'''
#print dir(bpy)