2011-02-23 10:52:22 +00:00
|
|
|
/*
|
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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-06-18 19:48:55 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_wm_api.c
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
2010-11-20 16:39:15 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-17 09:45:45 +00:00
|
|
|
static void rna_Operator_report(wmOperator *op, int type, const char *msg)
|
2009-12-10 16:52:44 +00:00
|
|
|
{
|
|
|
|
|
BKE_report(op->reports, type, msg);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-15 22:40:33 +00:00
|
|
|
/* since event isnt needed... */
|
2010-01-16 01:15:47 +00:00
|
|
|
static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
|
2010-01-15 22:40:33 +00:00
|
|
|
{
|
|
|
|
|
WM_enum_search_invoke(C, op, NULL);
|
2010-01-16 01:15:47 +00:00
|
|
|
|
2010-01-15 22:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-08 11:42:11 +00:00
|
|
|
static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator)
|
2010-02-21 11:56:00 +00:00
|
|
|
{
|
|
|
|
|
return WM_event_add_modal_handler(C, operator) != NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#else
|
|
|
|
|
|
2010-03-20 18:03:59 +00:00
|
|
|
#define WM_GEN_INVOKE_EVENT (1<<0)
|
|
|
|
|
#define WM_GEN_INVOKE_SIZE (1<<1)
|
|
|
|
|
#define WM_GEN_INVOKE_RETURN (1<<2)
|
|
|
|
|
|
|
|
|
|
static void rna_generic_op_invoke(FunctionRNA *func, int flag)
|
2010-01-15 22:40:33 +00:00
|
|
|
{
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
|
|
|
|
|
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
|
2010-03-20 18:03:59 +00:00
|
|
|
if(flag & WM_GEN_INVOKE_EVENT) {
|
2010-01-15 22:40:33 +00:00
|
|
|
parm= RNA_def_pointer(func, "event", "Event", "", "Event.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
if(flag & WM_GEN_INVOKE_SIZE) {
|
2011-01-10 03:58:07 +00:00
|
|
|
RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup.", 0, INT_MAX);
|
|
|
|
|
RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup.", 0, INT_MAX);
|
2010-03-22 09:30:00 +00:00
|
|
|
}
|
2010-03-20 18:03:59 +00:00
|
|
|
|
|
|
|
|
if(flag & WM_GEN_INVOKE_RETURN) {
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
|
2010-01-15 22:40:33 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
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
|
|
|
|
2010-12-08 11:42:11 +00:00
|
|
|
func= RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
|
2009-06-18 19:48:55 +00:00
|
|
|
RNA_def_function_ui_description(func, "Show up the file selector.");
|
2010-03-20 18:03:59 +00:00
|
|
|
rna_generic_op_invoke(func, 0);
|
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
|
|
|
|
2010-12-08 11:42:11 +00:00
|
|
|
func= RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
|
2010-02-21 11:56:00 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
|
|
|
|
|
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", ""));
|
|
|
|
|
|
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_ui_description(func, "Operator popup invoke.");
|
2010-03-20 18:03:59 +00:00
|
|
|
rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN);
|
|
|
|
|
|
|
|
|
|
/* invoked dialog opens popup with OK button, does not auto-exec operator. */
|
|
|
|
|
func= RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
|
|
|
|
|
RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke.");
|
|
|
|
|
rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN);
|
2009-12-07 00:16:57 +00:00
|
|
|
|
2010-01-15 22:40:33 +00:00
|
|
|
/* invoke enum */
|
|
|
|
|
func= RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
|
2010-03-20 18:03:59 +00:00
|
|
|
rna_generic_op_invoke(func, 0);
|
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_ui_description(func, "Operator popup invoke.");
|
2010-03-20 18:03:59 +00:00
|
|
|
rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN);
|
2010-11-22 13:43:51 +00:00
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm");
|
|
|
|
|
RNA_def_function_ui_description(func, "Operator confirmation.");
|
|
|
|
|
rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN);
|
|
|
|
|
|
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;
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
/* utility, not for registering */
|
2009-12-10 16:52:44 +00:00
|
|
|
func= RNA_def_function(srna, "report", "rna_Operator_report");
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-12-10 16:52:44 +00:00
|
|
|
parm= RNA_def_string(func, "message", "", 0, "Report Message", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
|
|
/* poll */
|
|
|
|
|
func= RNA_def_function(srna, "poll", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Test if the operator can be called or not.");
|
2010-08-05 16:05:30 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
|
|
|
|
/* exec */
|
|
|
|
|
func= RNA_def_function(srna, "execute", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Execute the operator.");
|
2009-12-24 21:17:14 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
2010-09-17 09:27:31 +00:00
|
|
|
/* check */
|
|
|
|
|
func= RNA_def_function(srna, "check", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Check the operator settings.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
|
|
|
|
parm= RNA_def_boolean(func, "result", 0, "result", ""); // better name?
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
2009-12-24 16:10:26 +00:00
|
|
|
/* invoke */
|
|
|
|
|
func= RNA_def_function(srna, "invoke", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Invoke the operator.");
|
2009-12-24 21:17:14 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
|
|
|
|
parm= RNA_def_pointer(func, "event", "Event", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
|
2009-12-24 16:10:26 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-12-24 21:17:14 +00:00
|
|
|
|
2010-02-21 11:56:00 +00:00
|
|
|
func= RNA_def_function(srna, "modal", NULL); /* same as invoke */
|
|
|
|
|
RNA_def_function_ui_description(func, "Modal operator function.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
|
|
|
|
parm= RNA_def_pointer(func, "event", "Event", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
|
2010-02-21 11:56:00 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
2009-12-24 21:17:14 +00:00
|
|
|
/* draw */
|
|
|
|
|
func= RNA_def_function(srna, "draw", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw function for the operator.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-10 16:52:44 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-30 22:14:32 +00:00
|
|
|
void RNA_api_macro(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
/* utility, not for registering */
|
|
|
|
|
func= RNA_def_function(srna, "report", "rna_Operator_report");
|
2011-01-13 14:29:57 +00:00
|
|
|
parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-12-30 22:14:32 +00:00
|
|
|
parm= RNA_def_string(func, "message", "", 0, "Report Message", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
|
|
/* poll */
|
|
|
|
|
func= RNA_def_function(srna, "poll", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Test if the operator can be called or not.");
|
2010-08-05 16:05:30 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
|
2009-12-30 22:14:32 +00:00
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-30 22:14:32 +00:00
|
|
|
|
|
|
|
|
/* draw */
|
|
|
|
|
func= RNA_def_function(srna, "draw", NULL);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw function for the operator.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
2011-02-16 10:19:14 +00:00
|
|
|
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2009-12-30 22:14:32 +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
|
|
|
void RNA_api_keyconfig(StructRNA *srna)
|
|
|
|
|
{
|
2010-08-30 13:50:59 +00:00
|
|
|
// FunctionRNA *func;
|
|
|
|
|
// PropertyRNA *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;
|
|
|
|
|
|
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, "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);
|
|
|
|
|
|
2011-01-10 03:58:07 +00:00
|
|
|
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", "");
|
2010-02-03 10:00:43 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
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
|
|
|
|
|
|