Key Configuration
Keymaps are now saveable and configurable from the user preferences, note that editing one item in a keymap means the whole keymap is now defined by the user and will not be updated by Blender, an option for syncing might be added later. The outliner interface is still there, but I will probably remove it. There's actually 3 levels now: * Default builtin key configuration. * Key configuration loaded from .py file, for configs like Blender 2.4x or other 3D applications. * Keymaps edited by the user and saved in .B.blend. These can be saved to .py files as well to make creating distributable configurations easier. Also, user preferences sections were reorganized a bit, now there is: Interface, Editing, Input, Files and System. Implementation notes: * wmKeyConfig was added which represents a key configuration containing keymaps. * wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap. * Modal maps are not wrapped yet. * User preferences DNA file reading did not support newdataadr() yet, added this now for reading keymaps. * Key configuration related settings are now RNA wrapped. * is_property_set and is_property_hidden python methods were added.
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user