diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 42b905dc0d8..44b419e8ae9 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -433,7 +433,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) { PointerRNA newptr; newptr= RNA_property_pointer_get(ptr, prop); - if (newptr.data) { + if (newptr.type) { ret = pyrna_struct_CreatePyObject(&newptr); } else { ret = Py_None; @@ -1153,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) { @@ -1272,7 +1297,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA * self, PyObject *pyname ) CTX_data_get(self->ptr.data, name, &newptr, &newlb); - if (newptr.data) { + if (newptr.type) { ret = pyrna_struct_CreatePyObject(&newptr); } else if (newlb.first) { @@ -1745,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} |