2009-06-18 19:48:55 +00:00
|
|
|
/**
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* ***** 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,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
#include "RNA_types.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"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.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"
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
static wmKeyMap *rna_keymap_add(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal)
|
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-11-16 20:50:02 +00:00
|
|
|
if (modal == 0) {
|
|
|
|
|
return WM_keymap_find(keyconf, idname, spaceid, regionid);
|
|
|
|
|
} else {
|
|
|
|
|
return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-08 18:02:50 +00:00
|
|
|
static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
|
|
|
|
|
{
|
|
|
|
|
return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname)
|
|
|
|
|
{
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(idname, 0);
|
|
|
|
|
|
|
|
|
|
if (!ot)
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return ot->modalkeymap;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
|
|
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
return WM_keymap_active(wm, km);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
|
|
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
int modifier= 0;
|
|
|
|
|
int propvalue = 0;
|
|
|
|
|
|
|
|
|
|
/* only modal maps */
|
|
|
|
|
if ((km->flag & KEYMAP_MODAL) == 0) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "Not a modal keymap.");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!km->modal_items) {
|
|
|
|
|
if(!WM_keymap_user_init(wm, km)) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "User defined keymap doesn't correspond to a system keymap.");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!km->modal_items) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "No property values defined.");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) {
|
|
|
|
|
BKE_report(reports, RPT_WARNING, "Property value not in enumeration.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(shift) modifier |= KM_SHIFT;
|
|
|
|
|
if(ctrl) modifier |= KM_CTRL;
|
|
|
|
|
if(alt) modifier |= KM_ALT;
|
|
|
|
|
if(oskey) modifier |= KM_OSKEY;
|
|
|
|
|
|
|
|
|
|
if(any) modifier = KM_ANY;
|
|
|
|
|
|
|
|
|
|
return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-17 03:32:33 +00:00
|
|
|
static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi)
|
|
|
|
|
{
|
|
|
|
|
WM_keymap_restore_item_to_default(C, km, kmi);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
|
2009-11-16 20:50:02 +00:00
|
|
|
{
|
|
|
|
|
// wmWindowManager *wm = CTX_wm_manager(C);
|
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
|
|
|
int modifier= 0;
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
/* only on non-modal maps */
|
|
|
|
|
if (km->flag & KEYMAP_MODAL) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "Not a non-modal keymap.");
|
|
|
|
|
return 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
|
|
|
if(shift) modifier |= KM_SHIFT;
|
|
|
|
|
if(ctrl) modifier |= KM_CTRL;
|
|
|
|
|
if(alt) modifier |= KM_ALT;
|
|
|
|
|
if(oskey) modifier |= KM_OSKEY;
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
if(any) modifier = KM_ANY;
|
|
|
|
|
|
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 WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
|
|
|
|
|
}
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2009-12-10 16:52:44 +00:00
|
|
|
static void rna_Operator_report(wmOperator *op, int type, char *msg)
|
|
|
|
|
{
|
|
|
|
|
BKE_report(op->reports, type, msg);
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
void RNA_api_wm(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
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
|
|
|
PropertyRNA *parm;
|
2009-06-18 19:48:55 +00:00
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "add_fileselect", "WM_event_add_fileselect");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
|
|
|
|
|
RNA_def_function_ui_description(func, "Show up the file selector.");
|
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
|
|
|
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "add_keyconfig", "WM_keyconfig_add");
|
|
|
|
|
parm= RNA_def_string(func, "name", "", 0, "Name", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
2009-10-27 02:54:25 +00:00
|
|
|
|
|
|
|
|
/* invoke functions, for use with python */
|
|
|
|
|
func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
|
|
|
|
|
RNA_def_function_ui_description(func, "Operator popup invoke.");
|
|
|
|
|
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_pointer(func, "event", "Event", "", "Event.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-12-07 00:16:57 +00:00
|
|
|
|
|
|
|
|
parm= RNA_def_enum(func, "result", operator_return_items, 0, "result", ""); // better name?
|
|
|
|
|
RNA_def_property_flag(parm, PROP_ENUM_FLAG);
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
2009-12-06 04:35:00 +00:00
|
|
|
|
|
|
|
|
/* invoke functions, for use with python */
|
|
|
|
|
func= RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
|
|
|
|
|
RNA_def_function_ui_description(func, "Operator popup invoke.");
|
|
|
|
|
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup.", 0, INT_MAX);
|
|
|
|
|
parm= RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup.", 0, INT_MAX);
|
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-10 16:52:44 +00:00
|
|
|
void RNA_api_operator(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "report", "rna_Operator_report");
|
|
|
|
|
parm= RNA_def_enum(func, "type", wm_report_items, 0, "Type", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_ENUM_FLAG);
|
|
|
|
|
parm= RNA_def_string(func, "message", "", 0, "Report Message", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
void RNA_api_keyconfig(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
func= RNA_def_function(srna, "add_keymap", "rna_keymap_add");
|
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
|
|
|
parm= RNA_def_string(func, "name", "", 0, "Name", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
|
|
|
|
|
RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
|
2009-11-16 20:50:02 +00:00
|
|
|
RNA_def_boolean(func, "modal", 0, "Modal", "");
|
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
|
|
|
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
2009-12-08 18:02:50 +00:00
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "find_keymap", "rna_keymap_find");
|
|
|
|
|
parm= RNA_def_string(func, "name", "", 0, "Name", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
|
|
|
|
|
RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
|
|
|
|
|
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "find_keymap_modal", "rna_keymap_find_modal");
|
|
|
|
|
parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_api_keymap(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "add_item", "rna_KeyMap_add_item");
|
2009-11-16 20:50:02 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
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
|
|
|
parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-11-16 20:50:02 +00:00
|
|
|
RNA_def_boolean(func, "any", 0, "Any", "");
|
|
|
|
|
RNA_def_boolean(func, "shift", 0, "Shift", "");
|
|
|
|
|
RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
|
|
|
|
|
RNA_def_boolean(func, "alt", 0, "Alt", "");
|
|
|
|
|
RNA_def_boolean(func, "oskey", 0, "OS Key", "");
|
|
|
|
|
RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", "");
|
|
|
|
|
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "add_modal_item", "rna_KeyMap_add_modal_item");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
|
|
|
|
|
parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
RNA_def_boolean(func, "any", 0, "Any", "");
|
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_boolean(func, "shift", 0, "Shift", "");
|
|
|
|
|
RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
|
|
|
|
|
RNA_def_boolean(func, "alt", 0, "Alt", "");
|
|
|
|
|
RNA_def_boolean(func, "oskey", 0, "OS Key", "");
|
|
|
|
|
RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", "");
|
|
|
|
|
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
2009-11-16 20:50:02 +00:00
|
|
|
func= RNA_def_function(srna, "active", "rna_keymap_active");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
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
|
|
|
func= RNA_def_function(srna, "remove_item", "WM_keymap_remove_item");
|
|
|
|
|
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user");
|
|
|
|
|
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
|
2009-12-17 03:32:33 +00:00
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-06-18 19:48:55 +00:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
void RNA_api_keymapitem(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "compare", "WM_keymap_item_compare");
|
|
|
|
|
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm= RNA_def_boolean(func, "result", 0, "Comparison result", "");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
}
|
2009-06-18 19:48:55 +00:00
|
|
|
#endif
|
|
|
|
|
|