2011-02-23 10:52:22 +00:00
|
|
|
/*
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation (2008).
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_wm.c
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-15 14:32:29 +00:00
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
#include "RNA_access.h"
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#include "RNA_define.h"
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
#include "RNA_enum_types.h"
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
static EnumPropertyItem event_keymouse_value_items[] = {
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{KM_PRESS, "PRESS", 0, "Press", ""},
|
|
|
|
|
{KM_RELEASE, "RELEASE", 0, "Release", ""},
|
2009-11-24 04:30:24 +00:00
|
|
|
{KM_CLICK, "CLICK", 0, "Click", ""},
|
2009-12-10 17:41:03 +00:00
|
|
|
{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_tweak_value_items[] = {
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{EVT_GESTURE_N, "NORTH", 0, "North", ""},
|
|
|
|
|
{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
|
|
|
|
|
{EVT_GESTURE_E, "EAST", 0, "East", ""},
|
|
|
|
|
{EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
|
|
|
|
|
{EVT_GESTURE_S, "SOUTH", 0, "South", ""},
|
|
|
|
|
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
|
|
|
|
|
{EVT_GESTURE_W, "WEST", 0, "West", ""},
|
|
|
|
|
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_tweak_type_items[] = {
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
|
|
|
|
|
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
|
|
|
|
|
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
|
|
|
|
|
{EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Action", ""},
|
|
|
|
|
{EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Select", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_mouse_type_items[] = {
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
|
|
|
|
|
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
|
|
|
|
|
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
|
|
|
|
|
{BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
|
|
|
|
|
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
|
2014-01-12 00:38:44 +11:00
|
|
|
{BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6", ""},
|
|
|
|
|
{BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{ACTIONMOUSE, "ACTIONMOUSE", 0, "Action", ""},
|
|
|
|
|
{SELECTMOUSE, "SELECTMOUSE", 0, "Select", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
2015-12-13 21:03:13 +13:00
|
|
|
{TABLET_STYLUS, "PEN", 0, "Pen", ""},
|
|
|
|
|
{TABLET_ERASER, "ERASER", 0, "Eraser", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
|
2010-01-11 11:14:36 +00:00
|
|
|
{MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
|
|
|
|
|
{MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
|
|
|
|
|
{MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
|
|
|
|
|
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
|
|
|
|
|
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
|
|
|
|
|
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_timer_type_items[] = {
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{TIMER, "TIMER", 0, "Timer", ""},
|
|
|
|
|
{TIMER0, "TIMER0", 0, "Timer 0", ""},
|
|
|
|
|
{TIMER1, "TIMER1", 0, "Timer 1", ""},
|
|
|
|
|
{TIMER2, "TIMER2", 0, "Timer 2", ""},
|
2012-05-29 15:04:11 +00:00
|
|
|
{TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", ""},
|
|
|
|
|
{TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
|
|
|
|
|
{TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
|
2013-05-29 16:03:09 +00:00
|
|
|
{TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_textinput_type_items[] = {
|
2013-05-02 19:43:52 +00:00
|
|
|
{KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
static EnumPropertyItem event_ndof_type_items[] = {
|
2012-10-31 11:31:25 +00:00
|
|
|
{NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* buttons on all 3dconnexion devices */
|
|
|
|
|
{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
|
|
|
|
|
{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
|
|
|
|
|
/* view buttons */
|
|
|
|
|
{NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""},
|
|
|
|
|
{NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""},
|
|
|
|
|
{NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""},
|
|
|
|
|
{NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""},
|
|
|
|
|
{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
|
|
|
|
|
{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
|
|
|
|
|
/* more views */
|
2012-02-29 02:44:08 +00:00
|
|
|
{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
|
|
|
|
|
{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* 90 degree rotations */
|
|
|
|
|
{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
|
|
|
|
|
{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""},
|
|
|
|
|
{NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""},
|
|
|
|
|
{NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""},
|
|
|
|
|
/* device control */
|
|
|
|
|
{NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""},
|
|
|
|
|
{NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""},
|
|
|
|
|
{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
|
|
|
|
|
{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
|
|
|
|
|
{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
|
2012-02-29 02:44:08 +00:00
|
|
|
/* keyboard emulation */
|
|
|
|
|
{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
|
|
|
|
|
{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
|
|
|
|
|
{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
|
|
|
|
|
{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* general-purpose buttons */
|
|
|
|
|
{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
|
|
|
|
|
{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
|
|
|
|
|
{NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""},
|
|
|
|
|
{NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""},
|
|
|
|
|
{NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""},
|
|
|
|
|
{NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""},
|
|
|
|
|
{NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""},
|
|
|
|
|
{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
|
|
|
|
|
{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
|
|
|
|
|
{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
|
2012-02-29 02:44:08 +00:00
|
|
|
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
|
|
|
|
|
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
|
|
|
|
|
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2013-09-11 21:27:14 +00:00
|
|
|
#endif
|
2011-07-21 21:40:00 +00:00
|
|
|
|
2010-12-01 13:18:24 +00:00
|
|
|
/* not returned: CAPSLOCKKEY, UNKNOWNKEY */
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_event_type_items[] = {
|
2015-07-03 15:07:46 +02:00
|
|
|
/* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "NONE", 0, "", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"},
|
|
|
|
|
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", "MMB"},
|
|
|
|
|
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", "RMB"},
|
|
|
|
|
{BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", "MB4"},
|
|
|
|
|
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", "MB5"},
|
|
|
|
|
{BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6 Mouse", "MB6"},
|
|
|
|
|
{BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7 Mouse", "MB7"},
|
|
|
|
|
{ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", "MBA"},
|
|
|
|
|
{SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", "MBS"},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-12-13 21:03:13 +13:00
|
|
|
{TABLET_STYLUS, "PEN", 0, "Pen", ""},
|
|
|
|
|
{TABLET_ERASER, "ERASER", 0, "Eraser", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"},
|
|
|
|
|
{INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"},
|
|
|
|
|
{MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"},
|
|
|
|
|
{MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", "MsZoom"},
|
|
|
|
|
{MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", "MsRot"},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", "WhUp"},
|
|
|
|
|
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", "WhDown"},
|
|
|
|
|
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
|
|
|
|
|
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
|
|
|
|
|
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
|
|
|
|
|
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
|
|
|
|
|
{EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Tweak Action", "TwkA"},
|
|
|
|
|
{EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Tweak Select", "TwkS"},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2009-06-21 14:30:59 +00:00
|
|
|
{AKEY, "A", 0, "A", ""},
|
|
|
|
|
{BKEY, "B", 0, "B", ""},
|
|
|
|
|
{CKEY, "C", 0, "C", ""},
|
|
|
|
|
{DKEY, "D", 0, "D", ""},
|
|
|
|
|
{EKEY, "E", 0, "E", ""},
|
|
|
|
|
{FKEY, "F", 0, "F", ""},
|
|
|
|
|
{GKEY, "G", 0, "G", ""},
|
|
|
|
|
{HKEY, "H", 0, "H", ""},
|
|
|
|
|
{IKEY, "I", 0, "I", ""},
|
|
|
|
|
{JKEY, "J", 0, "J", ""},
|
|
|
|
|
{KKEY, "K", 0, "K", ""},
|
|
|
|
|
{LKEY, "L", 0, "L", ""},
|
|
|
|
|
{MKEY, "M", 0, "M", ""},
|
|
|
|
|
{NKEY, "N", 0, "N", ""},
|
|
|
|
|
{OKEY, "O", 0, "O", ""},
|
|
|
|
|
{PKEY, "P", 0, "P", ""},
|
|
|
|
|
{QKEY, "Q", 0, "Q", ""},
|
|
|
|
|
{RKEY, "R", 0, "R", ""},
|
|
|
|
|
{SKEY, "S", 0, "S", ""},
|
|
|
|
|
{TKEY, "T", 0, "T", ""},
|
|
|
|
|
{UKEY, "U", 0, "U", ""},
|
|
|
|
|
{VKEY, "V", 0, "V", ""},
|
|
|
|
|
{WKEY, "W", 0, "W", ""},
|
|
|
|
|
{XKEY, "X", 0, "X", ""},
|
|
|
|
|
{YKEY, "Y", 0, "Y", ""},
|
|
|
|
|
{ZKEY, "Z", 0, "Z", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
{ZEROKEY, "ZERO", 0, "0", ""},
|
|
|
|
|
{ONEKEY, "ONE", 0, "1", ""},
|
|
|
|
|
{TWOKEY, "TWO", 0, "2", ""},
|
|
|
|
|
{THREEKEY, "THREE", 0, "3", ""},
|
|
|
|
|
{FOURKEY, "FOUR", 0, "4", ""},
|
|
|
|
|
{FIVEKEY, "FIVE", 0, "5", ""},
|
|
|
|
|
{SIXKEY, "SIX", 0, "6", ""},
|
|
|
|
|
{SEVENKEY, "SEVEN", 0, "7", ""},
|
|
|
|
|
{EIGHTKEY, "EIGHT", 0, "8", ""},
|
|
|
|
|
{NINEKEY, "NINE", 0, "9", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"},
|
|
|
|
|
{LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"},
|
|
|
|
|
{LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"},
|
|
|
|
|
{RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"},
|
|
|
|
|
{RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"},
|
|
|
|
|
{RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{GRLESSKEY, "GRLESS", 0, "Grless", ""},
|
2009-06-21 14:30:59 +00:00
|
|
|
{ESCKEY, "ESC", 0, "Esc", ""},
|
|
|
|
|
{TABKEY, "TAB", 0, "Tab", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{RETKEY, "RET", 0, "Return", "Enter"},
|
|
|
|
|
{SPACEKEY, "SPACE", 0, "Spacebar", "Space"},
|
2009-06-21 14:30:59 +00:00
|
|
|
{LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"},
|
|
|
|
|
{DELKEY, "DEL", 0, "Delete", "Del"},
|
2009-07-08 15:34:41 +00:00
|
|
|
{SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
|
|
|
|
|
{PERIODKEY, "PERIOD", 0, ".", ""},
|
|
|
|
|
{COMMAKEY, "COMMA", 0, ",", ""},
|
|
|
|
|
{QUOTEKEY, "QUOTE", 0, "\"", ""},
|
|
|
|
|
{ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
|
|
|
|
|
{MINUSKEY, "MINUS", 0, "-", ""},
|
|
|
|
|
{SLASHKEY, "SLASH", 0, "/", ""},
|
|
|
|
|
{BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
|
|
|
|
|
{EQUALKEY, "EQUAL", 0, "=", ""},
|
2009-11-02 10:20:06 +00:00
|
|
|
{LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""},
|
|
|
|
|
{RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"},
|
|
|
|
|
{DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"},
|
|
|
|
|
{RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"},
|
|
|
|
|
{UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"},
|
|
|
|
|
{PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"},
|
|
|
|
|
{PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"},
|
|
|
|
|
{PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"},
|
|
|
|
|
{PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"},
|
|
|
|
|
{PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"},
|
|
|
|
|
{PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"},
|
|
|
|
|
{PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"},
|
|
|
|
|
{PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"},
|
|
|
|
|
{PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"},
|
|
|
|
|
{PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."},
|
|
|
|
|
{PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"},
|
|
|
|
|
{PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"},
|
|
|
|
|
{PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"},
|
|
|
|
|
{PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"},
|
|
|
|
|
{PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"},
|
|
|
|
|
{PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"},
|
2009-06-21 14:30:59 +00:00
|
|
|
{F1KEY, "F1", 0, "F1", ""},
|
|
|
|
|
{F2KEY, "F2", 0, "F2", ""},
|
|
|
|
|
{F3KEY, "F3", 0, "F3", ""},
|
|
|
|
|
{F4KEY, "F4", 0, "F4", ""},
|
|
|
|
|
{F5KEY, "F5", 0, "F5", ""},
|
|
|
|
|
{F6KEY, "F6", 0, "F6", ""},
|
|
|
|
|
{F7KEY, "F7", 0, "F7", ""},
|
|
|
|
|
{F8KEY, "F8", 0, "F8", ""},
|
|
|
|
|
{F9KEY, "F9", 0, "F9", ""},
|
|
|
|
|
{F10KEY, "F10", 0, "F10", ""},
|
|
|
|
|
{F11KEY, "F11", 0, "F11", ""},
|
|
|
|
|
{F12KEY, "F12", 0, "F12", ""},
|
2010-04-20 00:08:27 +00:00
|
|
|
{F13KEY, "F13", 0, "F13", ""},
|
|
|
|
|
{F14KEY, "F14", 0, "F14", ""},
|
|
|
|
|
{F15KEY, "F15", 0, "F15", ""},
|
|
|
|
|
{F16KEY, "F16", 0, "F16", ""},
|
|
|
|
|
{F17KEY, "F17", 0, "F17", ""},
|
|
|
|
|
{F18KEY, "F18", 0, "F18", ""},
|
|
|
|
|
{F19KEY, "F19", 0, "F19", ""},
|
2009-06-21 14:30:59 +00:00
|
|
|
{PAUSEKEY, "PAUSE", 0, "Pause", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{INSERTKEY, "INSERT", 0, "Insert", "Ins"},
|
2009-06-21 14:30:59 +00:00
|
|
|
{HOMEKEY, "HOME", 0, "Home", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"},
|
|
|
|
|
{PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"},
|
2009-06-21 14:30:59 +00:00
|
|
|
{ENDKEY, "END", 0, "End", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"},
|
|
|
|
|
{MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"},
|
|
|
|
|
{MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"},
|
|
|
|
|
{MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"},
|
2011-02-18 22:42:03 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"},
|
2013-05-02 19:43:52 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2009-12-08 13:02:03 +00:00
|
|
|
{WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
|
2015-07-03 15:07:46 +02:00
|
|
|
{TIMER, "TIMER", 0, "Timer", "Tmr"},
|
|
|
|
|
{TIMER0, "TIMER0", 0, "Timer 0", "Tmr0"},
|
|
|
|
|
{TIMER1, "TIMER1", 0, "Timer 1", "Tmr1"},
|
|
|
|
|
{TIMER2, "TIMER2", 0, "Timer 2", "Tmr2"},
|
|
|
|
|
{TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", "TmrJob"},
|
|
|
|
|
{TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", "TmrSave"},
|
|
|
|
|
{TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"},
|
|
|
|
|
{TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"},
|
2011-07-21 21:40:00 +00:00
|
|
|
{0, "", 0, NULL, NULL},
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* buttons on all 3dconnexion devices */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"},
|
|
|
|
|
{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "NDOF Fit", "NdofFit"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* view buttons */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "NDOF Top", "Ndof↑"},
|
|
|
|
|
{NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "NDOF Bottom", "Ndof↓"},
|
|
|
|
|
{NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "NDOF Left", "Ndof←"},
|
|
|
|
|
{NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "NDOF Right", "Ndof→"},
|
|
|
|
|
{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", "NdofFront"},
|
|
|
|
|
{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", "NdofBack"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* more views */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", "NdofIso1"},
|
|
|
|
|
{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", "NdofIso2"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* 90 degree rotations */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", "NdofRCW"},
|
|
|
|
|
{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", "NdofRCCW"},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "NDOF Spin CW", "NdofSCW"},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "NDOF Spin CCW", "NdofSCCW"},
|
|
|
|
|
{NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "NDOF Tilt CW", "NdofTCW"},
|
|
|
|
|
{NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "NDOF Tilt CCW", "NdofTCCW"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* device control */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "NDOF Rotate", "NdofRot"},
|
|
|
|
|
{NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "NDOF Pan/Zoom", "NdofPanZoom"},
|
|
|
|
|
{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", "NdofDom"},
|
|
|
|
|
{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", "Ndof+"},
|
|
|
|
|
{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", "Ndof-"},
|
2012-02-29 02:44:08 +00:00
|
|
|
/* keyboard emulation */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc", "NdofEsc"},
|
|
|
|
|
{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt", "NdofAlt"},
|
|
|
|
|
{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"},
|
|
|
|
|
{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"},
|
2011-07-21 21:40:00 +00:00
|
|
|
/* general-purpose buttons */
|
2015-07-03 15:07:46 +02:00
|
|
|
{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"},
|
|
|
|
|
{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"},
|
|
|
|
|
{NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "NDOF Button 3", "NdofB3"},
|
|
|
|
|
{NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "NDOF Button 4", "NdofB4"},
|
|
|
|
|
{NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "NDOF Button 5", "NdofB5"},
|
|
|
|
|
{NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "NDOF Button 6", "NdofB6"},
|
|
|
|
|
{NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "NDOF Button 7", "NdofB7"},
|
|
|
|
|
{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", "NdofB8"},
|
|
|
|
|
{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", "NdofB9"},
|
|
|
|
|
{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", "NdofB10"},
|
|
|
|
|
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", "NdofBA"},
|
|
|
|
|
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"},
|
|
|
|
|
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_event_value_items[] = {
|
2013-09-11 21:27:14 +00:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{KM_NOTHING, "NOTHING", 0, "Nothing", ""},
|
|
|
|
|
{KM_PRESS, "PRESS", 0, "Press", ""},
|
|
|
|
|
{KM_RELEASE, "RELEASE", 0, "Release", ""},
|
|
|
|
|
{KM_CLICK, "CLICK", 0, "Click", ""},
|
|
|
|
|
{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
|
|
|
|
|
{EVT_GESTURE_N, "NORTH", 0, "North", ""},
|
|
|
|
|
{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
|
|
|
|
|
{EVT_GESTURE_E, "EAST", 0, "East", ""},
|
|
|
|
|
{EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
|
|
|
|
|
{EVT_GESTURE_S, "SOUTH", 0, "South", ""},
|
|
|
|
|
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
|
|
|
|
|
{EVT_GESTURE_W, "WEST", 0, "West", ""},
|
|
|
|
|
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_keymap_propvalue_items[] = {
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, "NONE", 0, "", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-11-14 22:43:42 +00:00
|
|
|
|
2011-11-14 16:05:44 +00:00
|
|
|
#if 0
|
|
|
|
|
static EnumPropertyItem keymap_modifiers_items[] = {
|
|
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
|
{1, "FIRST", 0, "First", ""},
|
|
|
|
|
{2, "SECOND", 0, "Second", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2011-11-14 16:05:44 +00:00
|
|
|
#endif
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
|
|
|
|
|
#ifndef RNA_RUNTIME
|
|
|
|
|
static EnumPropertyItem operator_flag_items[] = {
|
2011-11-14 16:05:44 +00:00
|
|
|
{OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"},
|
|
|
|
|
{OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
|
|
|
|
|
{OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
|
|
|
|
|
{OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
|
2015-04-27 18:44:27 +10:00
|
|
|
{OPTYPE_GRAB_CURSOR, "GRAB_CURSOR", 0, "Grab Pointer",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
|
|
|
|
|
"is enabled"},
|
2011-11-14 16:05:44 +00:00
|
|
|
{OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
|
|
|
|
|
{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2013-09-11 21:27:14 +00:00
|
|
|
#endif
|
2010-03-01 00:03:51 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_operator_return_items[] = {
|
2011-11-14 16:05:44 +00:00
|
|
|
{OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"},
|
|
|
|
|
{OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"},
|
|
|
|
|
{OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"},
|
2012-05-12 11:01:29 +00:00
|
|
|
/* used as a flag */
|
2012-03-18 09:27:36 +00:00
|
|
|
{OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
|
2014-10-28 17:51:06 +01:00
|
|
|
{OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-12-07 00:16:57 +00:00
|
|
|
|
2009-12-10 16:52:44 +00:00
|
|
|
/* flag/enum */
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_wm_report_items[] = {
|
2011-11-14 16:05:44 +00:00
|
|
|
{RPT_DEBUG, "DEBUG", 0, "Debug", ""},
|
|
|
|
|
{RPT_INFO, "INFO", 0, "Info", ""},
|
|
|
|
|
{RPT_OPERATOR, "OPERATOR", 0, "Operator", ""},
|
2012-12-18 15:22:06 +00:00
|
|
|
{RPT_PROPERTY, "PROPERTY", 0, "Property", ""},
|
2011-11-14 16:05:44 +00:00
|
|
|
{RPT_WARNING, "WARNING", 0, "Warning", ""},
|
|
|
|
|
{RPT_ERROR, "ERROR", 0, "Error", ""},
|
2012-01-12 06:11:08 +00:00
|
|
|
{RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
|
2011-11-14 16:05:44 +00:00
|
|
|
{RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
|
|
|
|
|
{RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-12-10 16:52:44 +00:00
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2010-12-07 08:27:20 +00:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
|
2013-06-01 04:06:38 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
|
2009-05-20 09:52:02 +00:00
|
|
|
#include "BKE_idprop.h"
|
|
|
|
|
|
2009-12-02 04:12:16 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2008-12-16 20:03:28 +00:00
|
|
|
static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmWindowManager *wm = ptr->id.data;
|
2012-05-12 11:01:29 +00:00
|
|
|
IDProperty *properties = (IDProperty *)ptr->data;
|
2008-12-16 20:03:28 +00:00
|
|
|
wmOperator *op;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (wm)
|
|
|
|
|
for (op = wm->operators.first; op; op = op->next)
|
|
|
|
|
if (op->properties == properties)
|
2008-12-16 20:03:28 +00:00
|
|
|
return op;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmOperator *op = rna_OperatorProperties_find_operator(ptr);
|
2008-12-16 20:03:28 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (op)
|
2008-12-16 20:03:28 +00:00
|
|
|
return op->type->srna;
|
|
|
|
|
else
|
2009-06-02 23:53:40 +00:00
|
|
|
return ptr->type;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create)
|
2009-05-20 09:52:02 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
if (create && !ptr->data) {
|
2009-05-20 09:52:02 +00:00
|
|
|
IDPropertyTemplate val = {0};
|
2012-03-05 23:30:41 +00:00
|
|
|
ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
|
2009-05-20 09:52:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ptr->data;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-16 20:03:28 +00:00
|
|
|
static void rna_Operator_name_get(PointerRNA *ptr, char *value)
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
strcpy(value, op->type->name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Operator_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
return strlen(op->type->name);
|
2008-12-16 20:03:28 +00:00
|
|
|
}
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
static int rna_Operator_has_reports_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
return (op->reports && op->reports->list.first);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-27 18:45:48 +10:00
|
|
|
static PointerRNA rna_Operator_options_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-02 19:57:57 +00:00
|
|
|
static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
|
2008-12-31 13:16:37 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
2009-11-19 16:15:22 +00:00
|
|
|
return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
|
2008-12-31 13:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-05 00:19:33 +00:00
|
|
|
static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
|
2009-12-05 19:27:26 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data;
|
2014-04-01 11:34:00 +11:00
|
|
|
wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
|
2009-12-05 19:27:26 +00:00
|
|
|
return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
|
|
|
|
|
}
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2009-06-23 00:41:55 +00:00
|
|
|
static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
|
2009-06-21 14:30:59 +00:00
|
|
|
{
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
value[0] = event->ascii;
|
|
|
|
|
value[1] = '\0';
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Event_ascii_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2012-05-12 11:01:29 +00:00
|
|
|
return (event->ascii) ? 1 : 0;
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-23 07:03:57 +00:00
|
|
|
static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2012-03-18 07:38:51 +00:00
|
|
|
/* utf8 buf isn't \0 terminated */
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
size_t len = 0;
|
2011-10-23 07:03:57 +00:00
|
|
|
|
|
|
|
|
if (event->utf8_buf[0]) {
|
|
|
|
|
BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
|
|
|
|
|
if (len > 0) {
|
|
|
|
|
memcpy(value, event->utf8_buf, len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
value[len] = '\0';
|
2011-10-23 07:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Event_unicode_length(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2011-10-23 07:03:57 +00:00
|
|
|
if (event->utf8_buf[0]) {
|
2012-03-18 09:27:36 +00:00
|
|
|
/* invalid value is checked on assignment so we don't need to account for this */
|
|
|
|
|
return BLI_str_utf8_size(event->utf8_buf);
|
2011-10-23 07:03:57 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-14 16:59:35 +03:00
|
|
|
static float rna_Event_pressure_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2014-07-14 17:49:00 +03:00
|
|
|
return WM_event_tablet_data(event, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Event_is_tablet_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2015-02-20 19:54:28 +11:00
|
|
|
const wmEvent *event = ptr->data;
|
2014-07-14 17:49:00 +03:00
|
|
|
return WM_event_is_tablet(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Event_tilt_get(PointerRNA *ptr, float *values)
|
|
|
|
|
{
|
|
|
|
|
wmEvent *event = ptr->data;
|
|
|
|
|
WM_event_tablet_data(event, NULL, values);
|
2014-07-14 16:59:35 +03:00
|
|
|
}
|
|
|
|
|
|
2013-06-01 04:06:38 +00:00
|
|
|
static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
struct uiPopupMenu *pup = ptr->data;
|
2014-11-09 21:20:40 +01:00
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2013-06-01 04:06:38 +00:00
|
|
|
|
|
|
|
|
PointerRNA rptr;
|
|
|
|
|
RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
|
|
|
|
|
|
|
|
|
|
return rptr;
|
|
|
|
|
}
|
|
|
|
|
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
struct uiPieMenu *pie = ptr->data;
|
2014-11-09 21:20:40 +01:00
|
|
|
uiLayout *layout = UI_pie_menu_layout(pie);
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
|
|
|
|
|
PointerRNA rptr;
|
|
|
|
|
RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
|
|
|
|
|
|
|
|
|
|
return rptr;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmWindow *win = (wmWindow *)ptr->data;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2015-08-26 13:59:46 +10:00
|
|
|
/* disallow ID-browsing away from temp screens */
|
|
|
|
|
if (win->screen->temp) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (value.data == NULL)
|
2009-06-30 19:10:14 +00:00
|
|
|
return;
|
|
|
|
|
|
2012-11-12 07:33:01 +00:00
|
|
|
/* exception: can't set screens inside of area/region handlers */
|
2012-03-05 23:30:41 +00:00
|
|
|
win->newscreen = value.data;
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2014-08-13 08:37:41 +10:00
|
|
|
static int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2013-06-03 04:06:54 +00:00
|
|
|
{
|
|
|
|
|
bScreen *screen = (bScreen *)value.id.data;
|
|
|
|
|
|
|
|
|
|
return !screen->temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-09-06 17:18:50 +00:00
|
|
|
static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
|
2009-06-30 19:10:14 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmWindow *win = (wmWindow *)ptr->data;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2012-11-12 07:33:01 +00:00
|
|
|
/* exception: can't set screens inside of area/region handlers,
|
|
|
|
|
* and must use context so notifier gets to the right window */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (win->newscreen) {
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_SCREENBROWSE, win->newscreen);
|
2012-03-05 23:30:41 +00:00
|
|
|
win->newscreen = NULL;
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (kmi->ptr)
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
return *(kmi->ptr);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
return PointerRNA_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2013-10-15 13:55:06 +00:00
|
|
|
return WM_keymap_map_type_get(kmi);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (value != map_type) {
|
|
|
|
|
switch (value) {
|
2012-05-12 11:01:29 +00:00
|
|
|
case KMI_TYPE_KEYBOARD:
|
|
|
|
|
kmi->type = AKEY;
|
|
|
|
|
kmi->val = KM_PRESS;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TWEAK:
|
|
|
|
|
kmi->type = EVT_TWEAK_L;
|
|
|
|
|
kmi->val = KM_ANY;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_MOUSE:
|
|
|
|
|
kmi->type = LEFTMOUSE;
|
|
|
|
|
kmi->val = KM_PRESS;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TEXTINPUT:
|
|
|
|
|
kmi->type = KM_TEXTINPUT;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TIMER:
|
|
|
|
|
kmi->type = TIMER;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_NDOF:
|
2012-10-31 11:31:25 +00:00
|
|
|
kmi->type = NDOF_MOTION;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
/* assumes value to be an enum from rna_enum_event_type_items */
|
2012-10-20 14:13:14 +00:00
|
|
|
/* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
|
|
|
|
|
static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
|
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
|
2012-10-20 14:16:56 +00:00
|
|
|
/* XXX, this should really be managed in an _itemf function,
|
|
|
|
|
* giving a list of valid enums, then silently changing them when they are set is not
|
|
|
|
|
* a good precedent, don't do this unless you have a good reason! */
|
|
|
|
|
if (value == ESCKEY) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (value >= AKEY) {
|
2012-10-20 14:13:14 +00:00
|
|
|
kmi->keymodifier = value;
|
2012-10-20 14:16:56 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-20 14:13:14 +00:00
|
|
|
kmi->keymodifier = 0;
|
2012-10-20 14:16:56 +00:00
|
|
|
}
|
2012-10-20 14:13:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
|
2014-01-04 18:08:43 +11:00
|
|
|
bool *UNUSED(r_free))
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (map_type == KMI_TYPE_MOUSE) return event_mouse_type_items;
|
|
|
|
|
if (map_type == KMI_TYPE_TWEAK) return event_tweak_type_items;
|
|
|
|
|
if (map_type == KMI_TYPE_TIMER) return event_timer_type_items;
|
|
|
|
|
if (map_type == KMI_TYPE_NDOF) return event_ndof_type_items;
|
2013-05-02 19:43:52 +00:00
|
|
|
if (map_type == KMI_TYPE_TEXTINPUT) return event_textinput_type_items;
|
2015-11-23 13:49:52 +11:00
|
|
|
else return rna_enum_event_type_items;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
|
2014-01-04 18:08:43 +11:00
|
|
|
bool *UNUSED(r_free))
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF)
|
|
|
|
|
return event_keymouse_value_items;
|
|
|
|
|
if (map_type == KMI_TYPE_TWEAK)
|
|
|
|
|
return event_tweak_value_items;
|
|
|
|
|
else
|
2015-11-23 13:49:52 +11:00
|
|
|
return rna_enum_event_value_items;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop),
|
2014-01-04 18:08:43 +11:00
|
|
|
bool *UNUSED(r_free))
|
2009-11-14 22:43:42 +00:00
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
wmKeyConfig *kc;
|
2009-11-15 19:25:34 +00:00
|
|
|
wmKeyMap *km;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
|
|
|
|
|
for (km = kc->keymaps.first; km; km = km->next) {
|
2009-11-14 22:43:42 +00:00
|
|
|
/* only check if it's a modal keymap */
|
|
|
|
|
if (km->modal_items) {
|
2009-12-24 09:36:15 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2012-03-05 23:30:41 +00:00
|
|
|
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
2009-12-24 09:36:15 +00:00
|
|
|
if (kmi == ptr->data) {
|
2009-11-14 22:43:42 +00:00
|
|
|
return km->modal_items;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
return rna_enum_keymap_propvalue_items; /* ERROR */
|
2009-11-14 22:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-20 19:54:28 +11:00
|
|
|
static int rna_KeyMapItem_any_get(PointerRNA *ptr)
|
2009-11-15 19:25:34 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
2009-11-15 19:25:34 +00:00
|
|
|
|
|
|
|
|
if (kmi->shift == KM_ANY &&
|
2012-04-28 06:31:57 +00:00
|
|
|
kmi->ctrl == KM_ANY &&
|
|
|
|
|
kmi->alt == KM_ANY &&
|
|
|
|
|
kmi->oskey == KM_ANY)
|
|
|
|
|
{
|
2009-11-15 19:25:34 +00:00
|
|
|
return 1;
|
2012-04-28 06:31:57 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-11-15 19:25:34 +00:00
|
|
|
return 0;
|
2012-04-28 06:31:57 +00:00
|
|
|
}
|
2009-11-15 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-20 19:54:28 +11:00
|
|
|
static void rna_KeyMapItem_any_set(PointerRNA *ptr, int value)
|
2009-11-15 19:25:34 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (value) {
|
|
|
|
|
kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
|
2009-11-15 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
|
2009-11-15 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-10 11:03:47 -03:00
|
|
|
static int rna_KeyMapItem_shift_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->shift != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_KeyMapItem_ctrl_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->ctrl != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_KeyMapItem_alt_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->alt != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_KeyMapItem_oskey_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->oskey != 0;
|
|
|
|
|
}
|
2009-11-15 19:25:34 +00:00
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmWindowManager *wm = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyConfig *kc;
|
|
|
|
|
|
2013-07-19 10:40:06 +00:00
|
|
|
kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!kc)
|
|
|
|
|
kc = wm->defaultconf;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
|
|
|
|
|
}
|
|
|
|
|
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmWindowManager *wm = ptr->data;
|
|
|
|
|
wmKeyConfig *kc = value.data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (kc)
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
WM_keyconfig_set_active(wm, kc->idname);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
WM_operator_py_idname(value, kmi->idname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
char pyname[OP_MAX_TYPENAME];
|
|
|
|
|
|
|
|
|
|
WM_operator_py_idname(pyname, kmi->idname);
|
|
|
|
|
return strlen(pyname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
char idname[OP_MAX_TYPENAME];
|
|
|
|
|
|
|
|
|
|
WM_operator_bl_idname(idname, value);
|
2009-12-02 04:12:16 +00:00
|
|
|
|
2015-01-26 16:03:11 +01:00
|
|
|
if (!STREQ(idname, kmi->idname)) {
|
2009-12-14 14:27:38 +00:00
|
|
|
BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
|
|
|
|
|
|
2010-11-10 11:19:52 +00:00
|
|
|
WM_keymap_properties_reset(kmi, NULL);
|
2009-12-14 14:27:38 +00:00
|
|
|
}
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-16 10:13:26 +00:00
|
|
|
static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
2012-09-22 20:07:30 +00:00
|
|
|
strcpy(value, ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
|
2009-12-16 10:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
2012-09-22 20:07:30 +00:00
|
|
|
return strlen(ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
|
2009-12-16 10:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-06 02:42:59 +00:00
|
|
|
static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
2010-12-06 02:42:59 +00:00
|
|
|
return kmi->id < 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value)
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
|
|
|
|
char *pbuf;
|
2014-01-08 17:39:12 +11:00
|
|
|
int pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
pbuf = WM_clipboard_text_get(false, &pbuf_len);
|
2012-03-05 23:30:41 +00:00
|
|
|
if (pbuf) {
|
2014-01-08 17:39:12 +11:00
|
|
|
memcpy(value, pbuf, pbuf_len + 1);
|
2010-09-08 21:47:16 +00:00
|
|
|
MEM_freeN(pbuf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
value[0] = '\0';
|
2010-09-08 21:47:16 +00:00
|
|
|
}
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr))
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
2010-09-08 21:47:16 +00:00
|
|
|
char *pbuf;
|
2014-01-08 17:39:12 +11:00
|
|
|
int pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
pbuf = WM_clipboard_text_get(false, &pbuf_len);
|
2012-03-05 23:30:41 +00:00
|
|
|
if (pbuf) {
|
2010-09-08 21:47:16 +00:00
|
|
|
MEM_freeN(pbuf);
|
|
|
|
|
}
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
return pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
2014-04-01 11:34:00 +11:00
|
|
|
WM_clipboard_text_set((void *) value, false);
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2011-05-18 10:56:26 +00:00
|
|
|
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2010-11-17 09:45:45 +00:00
|
|
|
const char *idname;
|
2012-03-05 23:30:41 +00:00
|
|
|
wmOperatorType *ot = RNA_struct_blender_type_get(type);
|
2011-05-18 10:56:26 +00:00
|
|
|
wmWindowManager *wm;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!ot)
|
2009-12-24 16:10:26 +00:00
|
|
|
return;
|
|
|
|
|
|
2010-04-05 14:21:57 +00:00
|
|
|
/* update while blender is running */
|
2012-03-05 23:30:41 +00:00
|
|
|
wm = bmain->wm.first;
|
2013-01-22 06:16:49 +00:00
|
|
|
if (wm) {
|
2011-05-18 10:56:26 +00:00
|
|
|
WM_operator_stack_clear(wm);
|
2013-01-22 06:16:49 +00:00
|
|
|
|
|
|
|
|
WM_operator_handlers_clear(wm, ot);
|
|
|
|
|
}
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
2010-04-05 14:21:57 +00:00
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_struct_free_extension(type, &ot->ext);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
idname = ot->idname;
|
2014-01-23 18:01:52 +11:00
|
|
|
WM_operatortype_remove_ptr(ot);
|
2010-11-17 09:45:45 +00:00
|
|
|
MEM_freeN((void *)idname);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2010-01-30 01:10:16 +00:00
|
|
|
/* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */
|
|
|
|
|
RNA_struct_free(&BLENDER_RNA, type);
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int operator_poll(bContext *C, wmOperatorType *ot)
|
|
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_poll_func;
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
PointerRNA ptr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int visible;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &ptr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
2010-12-07 04:12:15 +00:00
|
|
|
ot->ext.call(C, &ptr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "visible", &ret);
|
2012-05-12 11:01:29 +00:00
|
|
|
visible = *(int *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return visible;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-17 09:27:31 +00:00
|
|
|
static int operator_execute(bContext *C, wmOperator *op)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_execute_func;
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
|
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
2010-12-07 04:12:15 +00:00
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
2012-05-12 11:01:29 +00:00
|
|
|
result = *(int *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-17 09:27:31 +00:00
|
|
|
/* same as execute() but no return value */
|
2013-06-18 15:30:51 +00:00
|
|
|
static bool operator_check(bContext *C, wmOperator *op)
|
2010-09-17 09:27:31 +00:00
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_check_func;
|
|
|
|
|
|
2010-09-17 09:27:31 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
2013-06-18 15:30:51 +00:00
|
|
|
bool result;
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
|
2010-09-17 09:27:31 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
2010-12-07 04:12:15 +00:00
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
2013-06-18 15:30:51 +00:00
|
|
|
result = (*(int *)ret) != 0;
|
2010-09-17 09:27:31 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int operator_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_invoke_func;
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
|
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "event", &event);
|
2010-12-07 04:12:15 +00:00
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
2012-05-12 11:01:29 +00:00
|
|
|
result = *(int *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-21 11:56:00 +00:00
|
|
|
/* same as invoke */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int operator_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2010-02-21 11:56:00 +00:00
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_modal_func;
|
|
|
|
|
|
2010-02-21 11:56:00 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
|
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
|
2010-02-21 11:56:00 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "event", &event);
|
2010-12-07 04:12:15 +00:00
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2010-02-21 11:56:00 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
2012-05-12 11:01:29 +00:00
|
|
|
result = *(int *)ret;
|
2010-02-21 11:56:00 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-24 21:17:14 +00:00
|
|
|
static void operator_draw(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_draw_func;
|
|
|
|
|
|
2009-12-24 21:17:14 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
|
2009-12-24 21:17:14 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
2010-12-07 04:12:15 +00:00
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 21:17:14 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
}
|
2009-12-24 19:50:43 +00:00
|
|
|
|
2011-03-17 07:02:02 +00:00
|
|
|
/* same as exec(), but call cancel */
|
2013-10-30 23:08:53 +00:00
|
|
|
static void operator_cancel(bContext *C, wmOperator *op)
|
2011-03-17 07:02:02 +00:00
|
|
|
{
|
2011-10-19 22:40:03 +00:00
|
|
|
extern FunctionRNA rna_Operator_cancel_func;
|
|
|
|
|
|
2011-03-17 07:02:02 +00:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
|
2011-11-05 08:40:07 +00:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
2012-03-05 23:30:41 +00:00
|
|
|
func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
|
2011-03-17 07:02:02 +00:00
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
|
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-24 19:50:43 +00:00
|
|
|
void operator_wrapper(wmOperatorType *ot, void *userdata);
|
2009-12-30 22:14:32 +00:00
|
|
|
void macro_wrapper(wmOperatorType *ot, void *userdata);
|
2009-12-24 19:50:43 +00:00
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
static char _operator_idname[OP_MAX_TYPENAME];
|
2009-12-24 19:50:43 +00:00
|
|
|
static char _operator_name[OP_MAX_TYPENAME];
|
2011-11-15 15:24:57 +00:00
|
|
|
static char _operator_descr[RNA_DYN_DESCR_MAX];
|
2013-03-15 14:32:29 +00:00
|
|
|
static char _operator_ctxt[RNA_DYN_DESCR_MAX];
|
2012-03-18 09:27:36 +00:00
|
|
|
static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
|
|
|
|
|
StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2011-03-03 17:58:06 +00:00
|
|
|
wmOperatorType dummyot = {NULL};
|
2012-03-05 23:30:41 +00:00
|
|
|
wmOperator dummyop = {NULL};
|
2009-12-24 16:10:26 +00:00
|
|
|
PointerRNA dummyotr;
|
2011-03-17 07:02:02 +00:00
|
|
|
int have_function[7];
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
/* setup dummy operator & operator type to store static properties in */
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyop.type = &dummyot;
|
|
|
|
|
dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */
|
|
|
|
|
dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */
|
|
|
|
|
dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */
|
2013-03-15 14:32:29 +00:00
|
|
|
dummyot.translation_context = _operator_ctxt; /* only assigne the pointer, string is NULL'd */
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
|
|
|
|
|
|
2012-03-09 00:41:09 +00:00
|
|
|
/* clear in case they are left unset */
|
2013-03-15 15:12:46 +00:00
|
|
|
_operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0';
|
|
|
|
|
/* We have to set default op context! */
|
2015-08-16 17:32:01 +10:00
|
|
|
strcpy(_operator_ctxt, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2010-10-21 11:20:44 +00:00
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
/* validate the python class */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (validate(&dummyotr, data, have_function) != 0)
|
2009-12-24 16:10:26 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
{ /* convert foo.bar to FOO_OT_bar
|
2009-12-24 16:10:26 +00:00
|
|
|
* allocate the description and the idname in 1 go */
|
|
|
|
|
|
2011-01-24 05:15:14 +00:00
|
|
|
/* inconveniently long name sanity check */
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
char *ch = _operator_idname;
|
2011-01-24 05:15:14 +00:00
|
|
|
int i;
|
2012-03-05 23:30:41 +00:00
|
|
|
int dot = 0;
|
|
|
|
|
for (i = 0; *ch; i++) {
|
|
|
|
|
if ((*ch >= 'a' && *ch <= 'z') || (*ch >= '0' && *ch <= '9') || *ch == '_') {
|
2011-01-24 05:15:14 +00:00
|
|
|
/* pass */
|
|
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
else if (*ch == '.') {
|
2011-01-24 05:15:14 +00:00
|
|
|
dot++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-03-18 09:27:36 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR,
|
2012-10-13 15:44:50 +00:00
|
|
|
"Registering operator class: '%s', invalid bl_idname '%s', at position %d",
|
2012-03-18 09:27:36 +00:00
|
|
|
identifier, _operator_idname, i);
|
2011-01-24 05:15:14 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2011-01-24 05:15:14 +00:00
|
|
|
ch++;
|
|
|
|
|
}
|
2011-01-24 03:38:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (i > ((int)sizeof(dummyop.idname)) - 3) {
|
2012-10-13 15:44:50 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Registering operator class: '%s', invalid bl_idname '%s', "
|
2011-09-19 13:23:58 +00:00
|
|
|
"is too long, maximum length is %d", identifier, _operator_idname,
|
2012-03-18 09:27:36 +00:00
|
|
|
(int)sizeof(dummyop.idname) - 3);
|
2011-01-24 05:15:14 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (dot != 1) {
|
2012-03-18 09:27:36 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR,
|
2012-10-13 15:44:50 +00:00
|
|
|
"Registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
|
2012-03-18 09:27:36 +00:00
|
|
|
identifier, _operator_idname);
|
2011-01-24 05:15:14 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* end sanity check */
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int idlen = strlen(_operator_idname) + 4;
|
|
|
|
|
int namelen = strlen(_operator_name) + 1;
|
|
|
|
|
int desclen = strlen(_operator_descr) + 1;
|
2013-03-15 14:32:29 +00:00
|
|
|
int ctxtlen = strlen(_operator_ctxt) + 1;
|
2011-03-28 02:34:55 +00:00
|
|
|
char *ch;
|
2012-03-18 09:27:36 +00:00
|
|
|
/* 2 terminators and 3 to convert a.b -> A_OT_b */
|
2013-03-15 14:32:29 +00:00
|
|
|
ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen + ctxtlen), "_operator_idname");
|
2011-01-24 05:15:14 +00:00
|
|
|
WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyot.idname = ch;
|
2011-01-24 05:15:14 +00:00
|
|
|
ch += idlen;
|
|
|
|
|
strcpy(ch, _operator_name);
|
|
|
|
|
dummyot.name = ch;
|
|
|
|
|
ch += namelen;
|
|
|
|
|
strcpy(ch, _operator_descr);
|
|
|
|
|
dummyot.description = ch;
|
2013-03-15 14:32:29 +00:00
|
|
|
ch += desclen;
|
|
|
|
|
strcpy(ch, _operator_ctxt);
|
|
|
|
|
dummyot.translation_context = ch;
|
2011-01-24 05:15:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
2011-01-24 03:38:34 +00:00
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
/* check if we have registered this operator type before, and remove it */
|
|
|
|
|
{
|
2014-04-01 11:34:00 +11:00
|
|
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ot && ot->ext.srna)
|
2011-05-18 10:56:26 +00:00
|
|
|
rna_Operator_unregister(bmain, ot->ext.srna);
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-02 04:43:35 +00:00
|
|
|
/* XXX, this doubles up with the operator name [#29666]
|
|
|
|
|
* for now just remove from dir(bpy.types) */
|
|
|
|
|
|
2011-07-27 07:42:53 +00:00
|
|
|
/* create a new operator type */
|
2013-01-09 05:32:15 +00:00
|
|
|
dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
|
2010-09-09 17:41:36 +00:00
|
|
|
RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
|
2013-03-15 14:32:29 +00:00
|
|
|
RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyot.ext.data = data;
|
|
|
|
|
dummyot.ext.call = call;
|
|
|
|
|
dummyot.ext.free = free;
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
dummyot.pyop_poll = (have_function[0]) ? operator_poll : NULL;
|
|
|
|
|
dummyot.exec = (have_function[1]) ? operator_execute : NULL;
|
|
|
|
|
dummyot.check = (have_function[2]) ? operator_check : NULL;
|
|
|
|
|
dummyot.invoke = (have_function[3]) ? operator_invoke : NULL;
|
|
|
|
|
dummyot.modal = (have_function[4]) ? operator_modal : NULL;
|
|
|
|
|
dummyot.ui = (have_function[5]) ? operator_draw : NULL;
|
|
|
|
|
dummyot.cancel = (have_function[6]) ? operator_cancel : NULL;
|
2009-12-24 16:10:26 +00:00
|
|
|
WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot);
|
|
|
|
|
|
|
|
|
|
/* update while blender is running */
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
return dummyot.ext.srna;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void **rna_Operator_instance(PointerRNA *ptr)
|
2011-05-18 11:21:10 +00:00
|
|
|
{
|
|
|
|
|
wmOperator *op = ptr->data;
|
|
|
|
|
return &op->py_instance;
|
|
|
|
|
}
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
|
|
|
|
|
StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
|
2009-12-30 22:14:32 +00:00
|
|
|
{
|
2011-03-03 17:58:06 +00:00
|
|
|
wmOperatorType dummyot = {NULL};
|
2012-03-05 23:30:41 +00:00
|
|
|
wmOperator dummyop = {NULL};
|
2009-12-30 22:14:32 +00:00
|
|
|
PointerRNA dummyotr;
|
|
|
|
|
int have_function[4];
|
|
|
|
|
|
|
|
|
|
/* setup dummy operator & operator type to store static properties in */
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyop.type = &dummyot;
|
|
|
|
|
dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */
|
|
|
|
|
dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */
|
|
|
|
|
dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */
|
2013-03-15 14:32:29 +00:00
|
|
|
dummyot.translation_context = _operator_ctxt; /* only assigne the pointer, string is NULL'd */
|
2009-12-30 22:14:32 +00:00
|
|
|
RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
|
|
|
|
|
|
2013-03-15 15:12:46 +00:00
|
|
|
/* clear in case they are left unset */
|
|
|
|
|
_operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0';
|
|
|
|
|
/* We have to set default op context! */
|
2015-08-16 17:32:01 +10:00
|
|
|
strcpy(_operator_ctxt, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2013-03-15 15:12:46 +00:00
|
|
|
|
2009-12-30 22:14:32 +00:00
|
|
|
/* validate the python class */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (validate(&dummyotr, data, have_function) != 0)
|
2009-12-30 22:14:32 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
{ /* convert foo.bar to FOO_OT_bar
|
2009-12-30 22:14:32 +00:00
|
|
|
* allocate the description and the idname in 1 go */
|
|
|
|
|
int idlen = strlen(_operator_idname) + 4;
|
|
|
|
|
int namelen = strlen(_operator_name) + 1;
|
|
|
|
|
int desclen = strlen(_operator_descr) + 1;
|
2013-03-15 14:32:29 +00:00
|
|
|
int ctxtlen = strlen(_operator_ctxt) + 1;
|
2011-03-28 02:34:55 +00:00
|
|
|
char *ch;
|
2012-03-18 09:27:36 +00:00
|
|
|
/* 2 terminators and 3 to convert a.b -> A_OT_b */
|
2013-03-15 14:32:29 +00:00
|
|
|
ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen + ctxtlen), "_operator_idname");
|
2009-12-30 22:14:32 +00:00
|
|
|
WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyot.idname = ch;
|
2009-12-30 22:14:32 +00:00
|
|
|
ch += idlen;
|
|
|
|
|
strcpy(ch, _operator_name);
|
|
|
|
|
dummyot.name = ch;
|
|
|
|
|
ch += namelen;
|
|
|
|
|
strcpy(ch, _operator_descr);
|
|
|
|
|
dummyot.description = ch;
|
2013-03-15 14:32:29 +00:00
|
|
|
ch += desclen;
|
|
|
|
|
strcpy(ch, _operator_ctxt);
|
|
|
|
|
dummyot.translation_context = ch;
|
2009-12-30 22:14:32 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (strlen(identifier) >= sizeof(dummyop.idname)) {
|
2012-10-21 14:02:30 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Registering operator class: '%s' is too long, maximum length is %d",
|
2011-09-19 13:23:58 +00:00
|
|
|
identifier, (int)sizeof(dummyop.idname));
|
2009-12-30 22:14:32 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check if we have registered this operator type before, and remove it */
|
|
|
|
|
{
|
2014-04-01 11:34:00 +11:00
|
|
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ot && ot->ext.srna)
|
2011-05-18 10:56:26 +00:00
|
|
|
rna_Operator_unregister(bmain, ot->ext.srna);
|
2009-12-30 22:14:32 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-02 04:43:35 +00:00
|
|
|
/* XXX, this doubles up with the operator name [#29666]
|
|
|
|
|
* for now just remove from dir(bpy.types) */
|
|
|
|
|
|
|
|
|
|
/* create a new operator type */
|
2013-01-09 05:32:15 +00:00
|
|
|
dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
|
2013-03-15 14:32:29 +00:00
|
|
|
RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
|
2012-03-05 23:30:41 +00:00
|
|
|
dummyot.ext.data = data;
|
|
|
|
|
dummyot.ext.call = call;
|
|
|
|
|
dummyot.ext.free = free;
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
dummyot.pyop_poll = (have_function[0]) ? operator_poll : NULL;
|
|
|
|
|
dummyot.ui = (have_function[3]) ? operator_draw : NULL;
|
2009-12-30 22:14:32 +00:00
|
|
|
|
|
|
|
|
WM_operatortype_append_macro_ptr(macro_wrapper, (void *)&dummyot);
|
|
|
|
|
|
|
|
|
|
/* update while blender is running */
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
2009-12-30 22:14:32 +00:00
|
|
|
|
|
|
|
|
return dummyot.ext.srna;
|
|
|
|
|
}
|
2010-10-31 04:11:39 +00:00
|
|
|
#endif /* WITH_PYTHON */
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
static StructRNA *rna_Operator_refine(PointerRNA *opr)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)opr->data;
|
|
|
|
|
return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Operator;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
static StructRNA *rna_MacroOperator_refine(PointerRNA *opr)
|
2009-12-30 22:14:32 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *op = (wmOperator *)opr->data;
|
|
|
|
|
return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Macro;
|
2009-12-30 22:14:32 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-07 08:27:20 +00:00
|
|
|
/* just to work around 'const char *' warning and to ensure this is a python op */
|
|
|
|
|
static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
2012-03-05 23:30:41 +00:00
|
|
|
char *str = (char *)data->type->idname;
|
2012-10-26 14:45:56 +00:00
|
|
|
if (!str[0])
|
|
|
|
|
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
|
|
|
|
|
else
|
|
|
|
|
assert(!"setting the bl_idname on a non-builtin operator");
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
2012-03-05 23:30:41 +00:00
|
|
|
char *str = (char *)data->type->name;
|
2012-10-26 14:45:56 +00:00
|
|
|
if (!str[0])
|
|
|
|
|
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
|
|
|
|
|
else
|
|
|
|
|
assert(!"setting the bl_label on a non-builtin operator");
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-15 14:32:29 +00:00
|
|
|
static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
|
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->translation_context;
|
|
|
|
|
if (!str[0])
|
|
|
|
|
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
|
|
|
|
|
else
|
|
|
|
|
assert(!"setting the bl_translation_context on a non-builtin operator");
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-07 08:27:20 +00:00
|
|
|
static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
2012-03-05 23:30:41 +00:00
|
|
|
char *str = (char *)data->type->description;
|
2012-10-26 14:45:56 +00:00
|
|
|
if (!str[0])
|
|
|
|
|
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
|
|
|
|
|
else
|
|
|
|
|
assert(!"setting the bl_description on a non-builtin operator");
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-26 21:30:08 +00:00
|
|
|
static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
WM_keyconfig_update_tag(NULL, kmi);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-02 16:27:41 +00:00
|
|
|
#else /* RNA_RUNTIME */
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2015-04-27 18:45:48 +10:00
|
|
|
/**
|
|
|
|
|
* expose ``Operator.options`` as its own type so we can control each flags use (some are read-only).
|
|
|
|
|
*/
|
|
|
|
|
static void rna_def_operator_options_runtime(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "OperatorOptions", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_GRAB_CURSOR);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_INVOKE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Invoke", "True when invoked (even if only the execute callbacks available)");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-04-27 18:53:45 +10:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Focus Region", "Enable to use the region under the cursor for modal execution");
|
2015-04-27 18:45:48 +10:00
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_operator(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2008-12-16 20:03:28 +00:00
|
|
|
PropertyRNA *prop;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Operator", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being executed, or registered after execution");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_Operator_refine");
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2011-05-18 11:21:10 +00:00
|
|
|
RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
|
2010-01-23 20:43:55 +00:00
|
|
|
#endif
|
2015-08-16 17:32:01 +10:00
|
|
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2008-12-16 20:03:28 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2009-03-23 13:24:48 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-12-16 20:03:28 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
2009-09-16 18:04:01 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
2008-12-16 20:03:28 +00:00
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
2010-08-03 05:14:59 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Has Reports",
|
|
|
|
|
"Operator has a set of reports (warnings and errors) from last execution");
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
|
2009-12-24 21:17:14 +00:00
|
|
|
RNA_def_property_struct_type(prop, "UILayout");
|
|
|
|
|
|
2015-04-27 18:45:48 +10:00
|
|
|
prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorOptions");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Options", "Runtime options");
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
/* Registration */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->idname");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* else it uses the pointer size!. -3 because '.' -> '_OT_' */
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME - 3);
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2014-02-09 05:51:22 +11:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
2010-07-28 12:11:40 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
|
2009-12-24 19:50:43 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->name");
|
2011-11-15 15:24:57 +00:00
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
|
2013-03-15 14:32:29 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
|
2015-08-16 17:32:01 +10:00
|
|
|
RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2013-03-15 14:32:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
2013-01-05 13:52:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
|
2010-01-05 20:19:54 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->description");
|
2011-11-15 15:24:57 +00:00
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2010-10-21 11:20:44 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
2012-04-09 04:39:47 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
2010-01-05 20:19:54 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
2010-03-01 00:03:51 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, operator_flag_items);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
|
2010-03-01 00:03:51 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2015-05-13 05:25:26 +10:00
|
|
|
prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "macro", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Macro");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Macros", "");
|
|
|
|
|
|
2009-12-10 16:52:44 +00:00
|
|
|
RNA_api_operator(srna);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "OperatorProperties", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
|
2009-01-01 15:52:51 +00:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
|
2010-08-19 10:16:30 +00:00
|
|
|
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-05 19:27:26 +00:00
|
|
|
static void rna_def_macro_operator(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Macro", NULL);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Macro Operator",
|
|
|
|
|
"Storage of a macro operator being executed, or registered after execution");
|
2009-12-05 19:27:26 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
2009-12-30 22:14:32 +00:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister",
|
|
|
|
|
"rna_Operator_instance");
|
2010-01-23 20:43:55 +00:00
|
|
|
#endif
|
2015-08-16 17:32:01 +10:00
|
|
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2011-04-21 13:11:51 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2009-12-05 19:27:26 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
2009-12-05 19:27:26 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
2010-08-03 05:14:59 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
|
2009-12-30 22:14:32 +00:00
|
|
|
|
|
|
|
|
/* Registration */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
2009-12-30 22:14:32 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->idname");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2014-02-09 05:51:22 +11:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
2010-07-28 12:11:40 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
|
2009-12-30 22:14:32 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->name");
|
2011-11-15 15:24:57 +00:00
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2010-01-05 20:32:20 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
|
2013-03-15 14:32:29 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
|
2015-08-16 17:32:01 +10:00
|
|
|
RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
2013-03-15 14:32:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
2013-01-05 13:52:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
|
2010-01-05 20:32:20 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->description");
|
2011-11-15 15:24:57 +00:00
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
2010-12-07 08:27:20 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
2010-10-21 11:20:44 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
2012-04-09 04:39:47 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
2010-03-01 00:03:51 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, operator_flag_items);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
|
2010-03-01 00:03:51 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
2009-12-30 22:14:32 +00:00
|
|
|
|
|
|
|
|
RNA_api_macro(srna);
|
2009-12-05 19:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_operator_type_macro(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "OperatorMacro", NULL);
|
2011-10-05 00:19:33 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
|
2009-12-05 19:27:26 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
|
|
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
/* prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
/* RNA_def_property_string_sdna(prop, NULL, "idname"); */
|
|
|
|
|
/* RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
|
|
|
|
|
/* RNA_def_struct_name_property(srna, prop); */
|
2009-12-05 19:27:26 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
2009-12-05 19:27:26 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
2011-10-05 00:19:33 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
|
2009-12-05 19:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
static void rna_def_operator_utils(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
|
|
|
|
RNA_def_property_array(prop, 2);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location", "Mouse location");
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2009-06-05 16:11:35 +00:00
|
|
|
static void rna_def_operator_filelist_element(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
|
2009-06-05 16:11:35 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Operator File List Element", "");
|
2011-04-13 02:47:52 +00:00
|
|
|
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
|
2009-06-05 16:11:35 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
2012-02-27 18:14:56 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
|
2009-06-05 16:11:35 +00:00
|
|
|
}
|
2009-06-21 14:30:59 +00:00
|
|
|
|
|
|
|
|
static void rna_def_event(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Event", NULL);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmEvent");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
2009-12-19 14:58:24 +00:00
|
|
|
|
2009-06-21 14:30:59 +00:00
|
|
|
/* strings */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
|
2011-10-23 07:03:57 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
|
|
|
|
|
|
2009-06-21 14:30:59 +00:00
|
|
|
/* enums */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "val");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_value_items);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
2015-09-27 09:49:41 +02:00
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* mouse */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "x");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative horizontal location of the mouse");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "y");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative vertical location of the mouse");
|
2010-02-28 09:36:02 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
|
2010-02-28 09:36:02 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "mval[0]");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative horizontal location of the mouse");
|
2010-02-28 09:36:02 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
|
2010-02-28 09:36:02 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "mval[1]");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative vertical location of the mouse");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "prevx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "prevy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 11:02:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2014-07-14 16:59:35 +03:00
|
|
|
prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
|
2009-06-05 16:11:35 +00:00
|
|
|
|
2014-07-14 17:49:00 +03:00
|
|
|
prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
|
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
|
|
|
|
|
|
2009-06-21 14:30:59 +00:00
|
|
|
/* modifiers */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
|
2009-06-21 14:30:59 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
|
2009-12-19 14:58:24 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
2009-06-05 16:11:35 +00:00
|
|
|
|
2011-03-28 04:55:24 +00:00
|
|
|
static void rna_def_timer(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Timer", NULL);
|
2011-03-28 04:55:24 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmTimer");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
2011-03-28 04:55:24 +00:00
|
|
|
|
|
|
|
|
/* could wrap more, for now this is enough */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
|
2011-03-28 04:55:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "timestep");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Time Step", "");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
|
2011-03-28 04:55:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "delta");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
|
2011-03-28 04:55:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "duration");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
2011-03-28 04:55:24 +00:00
|
|
|
}
|
|
|
|
|
|
2013-06-01 04:06:38 +00:00
|
|
|
static void rna_def_popupmenu(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "UIPopupMenu", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "PopupMenu", "");
|
|
|
|
|
RNA_def_struct_sdna(srna, "uiPopupMenu");
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
|
|
|
|
|
|
|
|
|
/* could wrap more, for now this is enough */
|
|
|
|
|
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "UILayout");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_PopupMenu_layout_get",
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
|
|
|
|
}
|
|
|
|
|
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
static void rna_def_piemenu(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "UIPieMenu", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "PieMenu", "");
|
|
|
|
|
RNA_def_struct_sdna(srna, "uiPieMenu");
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
|
|
|
|
|
|
|
|
|
/* could wrap more, for now this is enough */
|
|
|
|
|
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "UILayout");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_PieMenu_layout_get",
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
static void rna_def_window_stereo3d(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "Stereo3dFormat");
|
|
|
|
|
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
|
2015-04-06 20:43:34 +02:00
|
|
|
RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_display_items);
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Display Mode", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Anaglyph Type", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Interlace Type", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
static void rna_def_window(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Window", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Window", "Open window");
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmWindow");
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
rna_def_window_stereo3d(brna);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
|
2009-09-16 18:04:01 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Screen");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window");
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2013-06-03 04:06:54 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_screen_set", NULL, "rna_Window_screen_assign_poll");
|
2011-09-06 17:18:50 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Window_screen_update");
|
2012-12-11 14:39:30 +00:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "posx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 10:59:54 +00:00
|
|
|
RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window");
|
2012-12-11 14:39:30 +00:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "posy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2013-06-29 10:59:54 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window");
|
2012-12-11 14:39:30 +00:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "sizex");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Width", "Window width");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "sizey");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Height", "Window height");
|
2013-09-06 22:54:22 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Stereo3dDisplay");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3d display");
|
|
|
|
|
|
2013-09-06 22:54:22 +00:00
|
|
|
RNA_api_window(srna);
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-23 22:16:45 +00:00
|
|
|
/* curve.splines */
|
|
|
|
|
static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "KeyConfigurations");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmWindowManager");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get",
|
|
|
|
|
"rna_WindowManager_active_keyconfig_set", NULL, NULL);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
|
2010-08-23 22:16:45 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Addon Key Configuration",
|
|
|
|
|
"Key configuration that can be extended by addons, and is added to the active "
|
|
|
|
|
"configuration when handling events");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "userconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "User Key Configuration",
|
|
|
|
|
"Final key configuration that combines keymaps from the active and addon configurations, "
|
|
|
|
|
"and can be edited by the user");
|
2010-08-30 13:50:59 +00:00
|
|
|
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_api_keyconfigs(srna);
|
2010-08-23 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_windowmanager(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "WindowManager", "ID");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Window Manager",
|
2015-10-24 02:44:43 +11:00
|
|
|
"Window manager data-block defining open windows and other user interface data");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmWindowManager");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Operator");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Operators", "Operator registry");
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Window");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Windows", "Open windows");
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
|
2010-08-23 22:16:45 +00:00
|
|
|
rna_def_wm_keyconfigs(brna, prop);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
|
2010-08-25 03:44:13 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Text Clipboard", "");
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
RNA_api_wm(srna);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2010-04-03 22:09:44 +00:00
|
|
|
/* keyconfig.items */
|
|
|
|
|
static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "KeyMapItems");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyMapItems", NULL);
|
2010-04-03 22:09:44 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMap");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
|
|
|
|
|
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_api_keymapitems(srna);
|
2010-08-30 13:50:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "KeyMaps");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyMaps", NULL);
|
2010-08-30 13:50:59 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmKeyConfig");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
|
|
|
|
|
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_api_keymaps(srna);
|
2010-04-03 22:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
static void rna_def_keyconfig(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2009-10-17 19:32:28 +00:00
|
|
|
PropertyRNA *prop;
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
|
|
|
|
static EnumPropertyItem map_type_items[] = {
|
|
|
|
|
{KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
|
|
|
|
|
{KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
|
|
|
|
|
{KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
|
2011-07-21 21:40:00 +00:00
|
|
|
{KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
{KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
|
|
|
|
|
{KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
|
|
|
|
/* KeyConfig */
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyConfig", NULL);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmKeyConfig");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2010-08-30 13:50:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "KeyMap");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
|
2010-08-30 13:50:59 +00:00
|
|
|
rna_def_wm_keymaps(brna, prop);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
|
2010-01-28 19:54:06 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "User Defined", "Indicates that a keyconfig was defined by the user");
|
2010-01-28 19:54:06 +00:00
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_api_keyconfig(srna);
|
|
|
|
|
|
|
|
|
|
/* KeyMap */
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyMap", NULL);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMap");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
2009-12-10 17:41:03 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of the key map");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "spaceid");
|
2009-12-10 17:41:03 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_space_type_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "regionid");
|
2009-12-10 17:41:03 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_region_type_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
|
2011-03-25 02:12:44 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "KeyMapItem");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event");
|
2010-04-03 22:09:44 +00:00
|
|
|
rna_def_keymap_items(brna, prop);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-04-10 08:33:30 +00:00
|
|
|
prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
|
2009-11-15 19:25:34 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
|
2009-12-10 17:41:03 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Modal Keymap",
|
|
|
|
|
"Indicates that a keymap is used for translate modal events for an operator");
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
|
2009-12-10 17:41:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
|
2009-12-10 17:41:03 +00:00
|
|
|
|
|
|
|
|
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_api_keymap(srna);
|
|
|
|
|
|
|
|
|
|
/* KeyMapItem */
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KeyMapItem", NULL);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMapItem");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length",
|
|
|
|
|
"rna_wmKeyMapItem_idname_set");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
2011-09-02 07:51:19 +00:00
|
|
|
|
2012-05-20 21:23:26 +00:00
|
|
|
/* this is in fact the operator name, but if the operator can't be found we
|
2011-09-02 07:51:19 +00:00
|
|
|
* fallback on the operator ID */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2012-09-22 20:07:30 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
2010-08-03 05:14:59 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "maptype");
|
|
|
|
|
RNA_def_property_enum_items(prop, map_type_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
2015-09-27 09:49:41 +02:00
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Type", "Type of event");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "val");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_value_items);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Value", "");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
|
2009-12-17 03:32:33 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "id");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2011-10-20 07:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "ID", "ID of the item");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
2009-12-17 03:32:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
|
2015-02-20 19:54:28 +11:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_get", "rna_KeyMapItem_any_set");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
|
2015-04-10 11:03:47 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "shift"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
|
2015-04-10 11:03:47 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
|
2015-04-10 11:03:47 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "alt"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
|
2015-04-10 11:03:47 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
2015-09-27 09:49:41 +02:00
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
2012-10-20 14:13:14 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Expanded", "Show key map event and property details in the user interface");
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
|
2012-04-17 16:21:13 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
|
2009-11-14 22:43:42 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "propvalue");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_keymap_propvalue_items);
|
2009-11-14 22:43:42 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap");
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
2009-11-14 22:43:42 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
|
2009-12-16 10:13:26 +00:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
|
2011-08-15 10:03:17 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
Keymap conflict detection operator.
Takes into account the hierarchical structures of keymaps as well as wildcards (KM_ANY) in event definitions, user remaps (emulate numpad, action/select mouse buttons, ...) and event values that overlap (click, press and release)
For now, doesn't do anything other than print conflicts in the console.
As a result, I cleaned up a lot of keymaps that had double definitions, moved some keymap items in more appropriate places, fixed wrong definitions and removed kmi that were added for testing a long long time ago.
Out of all the remaining conflicts, after removing obvious non-issues, here's what remains: http://www.pasteall.org/9898
2009-12-17 22:14:43 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
|
2010-12-06 02:42:59 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "User Defined",
|
|
|
|
|
"Is this keymap item user defined (doesn't just replace a builtin item)");
|
2010-12-06 02:42:59 +00:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
|
|
|
|
|
|
Keymap conflict detection operator.
Takes into account the hierarchical structures of keymaps as well as wildcards (KM_ANY) in event definitions, user remaps (emulate numpad, action/select mouse buttons, ...) and event values that overlap (click, press and release)
For now, doesn't do anything other than print conflicts in the console.
As a result, I cleaned up a lot of keymaps that had double definitions, moved some keymap items in more appropriate places, fixed wrong definitions and removed kmi that were added for testing a long long time ago.
Out of all the remaining conflicts, after removing obvious non-issues, here's what remains: http://www.pasteall.org/9898
2009-12-17 22:14:43 +00:00
|
|
|
RNA_api_keymapitem(srna);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void RNA_def_wm(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
rna_def_operator(brna);
|
2015-04-27 18:45:48 +10:00
|
|
|
rna_def_operator_options_runtime(brna);
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
rna_def_operator_utils(brna);
|
2009-06-05 16:11:35 +00:00
|
|
|
rna_def_operator_filelist_element(brna);
|
2009-12-05 19:27:26 +00:00
|
|
|
rna_def_macro_operator(brna);
|
|
|
|
|
rna_def_operator_type_macro(brna);
|
2009-06-21 14:30:59 +00:00
|
|
|
rna_def_event(brna);
|
2011-03-28 04:55:24 +00:00
|
|
|
rna_def_timer(brna);
|
2013-06-01 04:06:38 +00:00
|
|
|
rna_def_popupmenu(brna);
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
rna_def_piemenu(brna);
|
2009-06-30 19:10:14 +00:00
|
|
|
rna_def_window(brna);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_def_windowmanager(brna);
|
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.
2009-10-08 18:40:03 +00:00
|
|
|
rna_def_keyconfig(brna);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-02 16:27:41 +00:00
|
|
|
#endif /* RNA_RUNTIME */
|