Key Configuration

Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.

There's actually 3 levels now:

* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
  or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
  to .py files as well to make creating distributable configurations
  easier.

Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.


Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
  keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
  added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
This commit is contained in:
Brecht Van Lommel 2009-10-08 18:40:03 +00:00
parent e0c5e48473
commit 3ebd58673f
108 changed files with 1763 additions and 638 deletions

@ -12,6 +12,10 @@ class USERPREF_HT_header(bpy.types.Header):
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.save_homefile", text="Save As Default")
if userpref.active_section == 'INPUT':
layout.operator_context = "INVOKE_DEFAULT"
layout.itemO("wm.keyconfig_save", "Save Key Configuration...")
class USERPREF_MT_view(bpy.types.Menu):
__space_type__ = 'USER_PREFERENCES'
@ -31,14 +35,14 @@ class USERPREF_PT_tabs(bpy.types.Panel):
layout.itemR(userpref, "active_section", expand=True)
class USERPREF_PT_view(bpy.types.Panel):
class USERPREF_PT_interface(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "View"
__label__ = "Interface"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'VIEW_CONTROLS')
return (userpref.active_section == 'INTERFACE')
def draw(self, context):
layout = self.layout
@ -87,37 +91,27 @@ class USERPREF_PT_view(bpy.types.Panel):
sub1.itemR(view, "perspective_orthographic_switch")
sub1.itemR(view, "smooth_view")
sub1.itemR(view, "rotation_angle")
sub1.itemS()
sub1.itemL(text="NDOF Device:")
sub1.itemR(view, "ndof_pan_speed", text="Pan Speed")
sub1.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Mouse Buttons:")
sub2 = sub1.column()
sub2.enabled = (view.select_mouse == 'RIGHT')
sub2.itemR(view, "emulate_3_button_mouse")
sub1.itemL(text="Select With:")
sub1.row().itemR(view, "select_mouse", expand=True)
sub1.itemL(text="Middle Mouse:")
sub1.row().itemR(view, "middle_mouse", expand=True)
sub1.itemR(view, "use_middle_mouse_paste")
sub1.itemL(text="Mouse Wheel:")
sub1.itemR(view, "wheel_invert_zoom", text="Invert Zoom")
sub1.itemR(view, "wheel_scroll_lines", text="Scroll Lines")
sub1.itemL(text="Mouse Motion:")
sub1.itemR(view, "continuous_mouse", text="Continuous Grab")
sub1.itemS()
sub1.itemL(text="Menus:")
sub1.itemR(view, "open_mouse_over")
sub1.itemL(text="Menu Open Delay:")
sub1.itemR(view, "open_toplevel_delay", text="Top Level")
sub1.itemR(view, "open_sublevel_delay", text="Sub Level")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Toolbox:")
sub1.itemR(view, "use_column_layout")
sub1.itemL(text="Open Toolbox Delay:")
sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
col = split.column()
sub = col.split(percentage=0.85)
@ -129,14 +123,6 @@ class USERPREF_PT_view(bpy.types.Panel):
sub2.itemR(view, "manipulator_size", text="Size")
sub2.itemR(view, "manipulator_handle_size", text="Handle Size")
sub2.itemR(view, "manipulator_hotspot", text="Hotspot")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Toolbox:")
sub1.itemR(view, "use_column_layout")
sub1.itemL(text="Open Toolbox Delay:")
sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
class USERPREF_PT_edit(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
@ -145,7 +131,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDIT_METHODS')
return (userpref.active_section == 'EDITING')
def draw(self, context):
layout = self.layout
@ -248,7 +234,7 @@ class USERPREF_PT_system(bpy.types.Panel):
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM_OPENGL')
return (userpref.active_section == 'SYSTEM')
def draw(self, context):
layout = self.layout
@ -276,7 +262,7 @@ class USERPREF_PT_system(bpy.types.Panel):
sub1.itemL(text="Sound:")
sub1.row().itemR(system, "audio_device", expand=True)
sub2 = sub1.column()
sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
sub2.active = system.audio_device != 'NONE'
sub2.itemR(system, "enable_all_codecs")
sub2.itemR(system, "game_sound")
sub2.itemR(system, "audio_channels", text="Channels")
@ -332,14 +318,14 @@ class USERPREF_PT_system(bpy.types.Panel):
sub1.itemR(system, "prefetch_frames")
sub1.itemR(system, "memory_cache_limit")
class USERPREF_PT_filepaths(bpy.types.Panel):
class USERPREF_PT_file(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "File Paths"
__label__ = "Files"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILE_PATHS')
return (userpref.active_section == 'FILES')
def draw(self, context):
layout = self.layout
@ -398,11 +384,314 @@ class USERPREF_PT_filepaths(bpy.types.Panel):
sub3.enabled = paths.auto_save_temporary_files
sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
class USERPREF_PT_input(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "Input"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
wm = context.manager
#input = userpref.input
input = userpref
view = userpref.view
split = layout.split(percentage=0.25)
# General settings
row = split.row()
col = row.column()
sub = col.column()
sub.itemL(text="Configuration:")
sub.item_pointerR(wm, "active_keyconfig", wm, "keyconfigs", text="")
col.itemS()
sub = col.column()
sub.itemL(text="Mouse:")
sub1 = sub.column()
sub1.enabled = (view.select_mouse == 'RIGHT')
sub1.itemR(view, "emulate_3_button_mouse")
sub.itemR(view, "continuous_mouse", text="Continuous Grab")
sub.itemL(text="Select With:")
sub.row().itemR(view, "select_mouse", expand=True)
#sub.itemL(text="Middle Mouse:")
#sub.row().itemR(view, "middle_mouse", expand=True)
#sub.itemR(view, "use_middle_mouse_paste")
#col.itemS()
#sub = col.column()
#sub.itemL(text="Mouse Wheel:")
#sub.itemR(view, "wheel_invert_zoom", text="Invert Zoom")
#sub.itemR(view, "wheel_scroll_lines", text="Scroll Lines")
col.itemS()
sub = col.column()
sub.itemL(text="NDOF Device:")
sub.itemR(view, "ndof_pan_speed", text="Pan Speed")
sub.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
row.itemS()
# Keymap Settings
col = split.column()
kc = wm.active_keyconfig
defkc = wm.default_keyconfig
km = wm.active_keymap
subsplit = col.split()
subsplit.item_pointerR(wm, "active_keymap", defkc, "keymaps", text="Map:")
if km.user_defined:
row = subsplit.row()
row.itemO("WM_OT_keymap_restore", text="Restore")
row.item_booleanO("WM_OT_keymap_restore", "all", True, text="Restore All")
else:
row = subsplit.row()
row.itemO("WM_OT_keymap_edit", text="Edit")
row.itemL()
col.itemS()
for kmi in km.items:
subcol = col.column()
subcol.set_context_pointer("keyitem", kmi)
row = subcol.row()
if kmi.expanded:
row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_DOWN")
else:
row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT")
itemrow = row.row()
itemrow.enabled = km.user_defined
itemrow.itemR(kmi, "active", text="", icon="ICON_DOT")
itemcol = itemrow.column()
itemcol.active = kmi.active
row = itemcol.row()
row.itemR(kmi, "idname", text="")
sub = row.row()
sub.scale_x = 0.6
sub.itemR(kmi, "map_type", text="")
sub = row.row(align=True)
if kmi.map_type == 'KEYBOARD':
sub.itemR(kmi, "type", text="", full_event=True)
elif kmi.map_type == 'MOUSE':
sub.itemR(kmi, "type", text="", full_event=True)
elif kmi.map_type == 'TWEAK':
sub.scale_x = 0.5
sub.itemR(kmi, "type", text="")
sub.itemR(kmi, "value", text="")
elif kmi.map_type == 'TIMER':
sub.itemR(kmi, "type", text="")
else:
sub.itemL()
if kmi.expanded:
if kmi.map_type not in ('TEXTINPUT', 'TIMER'):
sub = itemcol.row(align=True)
if kmi.map_type == 'KEYBOARD':
sub.itemR(kmi, "type", text="", event=True)
sub.itemR(kmi, "value", text="")
elif kmi.map_type == 'MOUSE':
sub.itemR(kmi, "type", text="")
sub.itemR(kmi, "value", text="")
else:
sub.itemL()
sub.itemL()
subrow = sub.row()
subrow.scale_x = 0.75
subrow.itemR(kmi, "shift")
subrow.itemR(kmi, "ctrl")
subrow.itemR(kmi, "alt")
subrow.itemR(kmi, "oskey")
sub.itemR(kmi, "key_modifier", text="", event=True)
flow = itemcol.column_flow(columns=2)
props = kmi.properties
if props != None:
for pname in dir(props):
if not props.is_property_hidden(pname):
flow.itemR(props, pname)
itemcol.itemS()
itemrow.itemO("wm.keyitem_remove", text="", icon="ICON_ZOOMOUT")
itemrow = col.row()
itemrow.itemL()
itemrow.itemO("wm.keyitem_add", text="", icon="ICON_ZOOMIN")
itemrow.enabled = km.user_defined
bpy.types.register(USERPREF_HT_header)
bpy.types.register(USERPREF_MT_view)
bpy.types.register(USERPREF_PT_tabs)
bpy.types.register(USERPREF_PT_view)
bpy.types.register(USERPREF_PT_interface)
bpy.types.register(USERPREF_PT_edit)
bpy.types.register(USERPREF_PT_system)
bpy.types.register(USERPREF_PT_filepaths)
bpy.types.register(USERPREF_PT_file)
bpy.types.register(USERPREF_PT_input)
class WM_OT_keyconfig_save(bpy.types.Operator):
"Save key configuration to a python script."
__idname__ = "wm.keyconfig_save"
__label__ = "Save Key Configuration..."
__props__ = [
bpy.props.StringProperty(attr="path", name="File Path", description="File path to write file to.")]
def _string_value(self, value):
result = ""
if isinstance(value, str):
if value != "":
result = "\'%s\'" % value
elif isinstance(value, bool):
if value:
result = "True"
else:
result = "False"
elif isinstance(value, float):
result = "%.10f" % value
elif isinstance(value, int):
result = "%d" % value
elif getattr(value, '__len__', False):
if len(value):
result = "["
for i in range(0, len(value)):
result += self._string_value(value[i])
if i != len(value)-1:
result += ", "
result += "]"
else:
print("Save key configuration: can't write ", value)
return result
def execute(self, context):
if not self.path:
raise Exception("File path not set.")
f = open(self.path, "w")
if not f:
raise Exception("Could not open file.")
wm = context.manager
kc = wm.active_keyconfig
f.write('# Configuration %s\n' % kc.name)
f.write("wm = bpy.data.windowmanagers[0]\n");
f.write("kc = wm.add_keyconfig(\'%s\')\n\n" % kc.name)
for km in kc.keymaps:
f.write("# Map %s\n" % km.name)
f.write("km = kc.add_keymap(\'%s\', space_type=\'%s\', region_type=\'%s\')\n\n" % (km.name, km.space_type, km.region_type))
for kmi in km.items:
f.write("kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value))
if kmi.shift:
f.write(", shift=True")
if kmi.ctrl:
f.write(", ctrl=True")
if kmi.alt:
f.write(", alt=True")
if kmi.oskey:
f.write(", oskey=True")
if kmi.key_modifier and kmi.key_modifier != 'NONE':
f.write(", key_modifier=\'%s\'" % kmi.key_modifier)
f.write(")\n")
props = kmi.properties
if props != None:
for pname in dir(props):
if props.is_property_set(pname) and not props.is_property_hidden(pname):
value = eval("props.%s" % pname)
value = self._string_value(value)
if value != "":
f.write("kmi.properties.%s = %s\n" % (pname, value))
f.write("\n")
f.close()
return ('FINISHED',)
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self.__operator__)
return ('RUNNING_MODAL',)
class WM_OT_keymap_edit(bpy.types.Operator):
"Edit key map."
__idname__ = "wm.keymap_edit"
__label__ = "Edit Key Map"
def execute(self, context):
wm = context.manager
km = wm.active_keymap
km.copy_to_user()
return ('FINISHED',)
class WM_OT_keymap_restore(bpy.types.Operator):
"Restore key map"
__idname__ = "wm.keymap_restore"
__label__ = "Restore Key Map"
__props__ = [bpy.props.BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default.")]
def execute(self, context):
wm = context.manager
if self.all:
for km in wm.default_keyconfig.keymaps:
km.restore_to_default()
else:
km = wm.active_keymap
km.restore_to_default()
return ('FINISHED',)
class WM_OT_keyitem_add(bpy.types.Operator):
"Add key map item."
__idname__ = "wm.keyitem_add"
__label__ = "Add Key Map Item"
def execute(self, context):
wm = context.manager
km = wm.active_keymap
kmi = km.add_item("", "A", "PRESS")
return ('FINISHED',)
class WM_OT_keyitem_remove(bpy.types.Operator):
"Remove key map item."
__idname__ = "wm.keyitem_remove"
__label__ = "Remove Key Map Item"
def execute(self, context):
wm = context.manager
kmi = context.keyitem
km = wm.active_keymap
km.remove_item(kmi)
return ('FINISHED',)
bpy.ops.add(WM_OT_keyconfig_save)
bpy.ops.add(WM_OT_keymap_edit)
bpy.ops.add(WM_OT_keymap_restore)
bpy.ops.add(WM_OT_keyitem_add)
bpy.ops.add(WM_OT_keyitem_remove)

@ -44,6 +44,7 @@ struct SpaceType;
struct wmNotifier;
struct wmWindow;
struct wmWindowManager;
struct wmKeyConfig;
struct uiLayout;
struct uiMenuItem;
@ -81,7 +82,7 @@ typedef struct SpaceType {
/* register operator types on startup */
void (*operatortypes)(void);
/* add default items to WM keymap */
void (*keymap)(struct wmWindowManager *);
void (*keymap)(struct wmKeyConfig *);
/* return context data */
int (*context)(const struct bContext *, const char*, struct bContextDataResult *);
@ -122,7 +123,7 @@ typedef struct ARegionType {
/* register operator types on startup */
void (*operatortypes)(void);
/* add own items to keymap */
void (*keymap)(struct wmWindowManager *);
void (*keymap)(struct wmKeyConfig *);
/* allows default cursor per region */
void (*cursor)(struct wmWindow *, struct ScrArea *, struct ARegion *ar);

@ -74,6 +74,7 @@
#include "BKE_displist.h"
#include "BKE_font.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_ipo.h"
#include "BKE_main.h"
@ -406,10 +407,26 @@ static int handle_subversion_warning(Main *main)
void BKE_userdef_free(void)
{
wmKeyMap *km;
wmKeyMapItem *kmi;
for(km=U.keymaps.first; km; km=km->next) {
for(kmi=km->items.first; kmi; kmi=kmi->next) {
if(kmi->properties) {
IDP_FreeProperty(kmi->properties);
MEM_freeN(kmi->properties);
}
if(kmi->ptr)
MEM_freeN(kmi->ptr);
}
BLI_freelistN(&km->items);
}
BLI_freelistN(&U.uistyles);
BLI_freelistN(&U.uifonts);
BLI_freelistN(&U.themes);
BLI_freelistN(&U.keymaps);
}

@ -4446,11 +4446,13 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
}
wm->operators.first= wm->operators.last= NULL;
wm->keymaps.first= wm->keymaps.last= NULL;
wm->paintcursors.first= wm->paintcursors.last= NULL;
wm->queue.first= wm->queue.last= NULL;
BKE_reports_init(&wm->reports, RPT_STORE);
wm->keyconfigs.first= wm->keyconfigs.last= NULL;
wm->defaultconf= NULL;
wm->jobs.first= wm->jobs.last= NULL;
wm->windrawable= NULL;
@ -5276,6 +5278,33 @@ static char *dataname(short id_code)
}
static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocname)
{
bhead = blo_nextbhead(fd, bhead);
while(bhead && bhead->code==DATA) {
void *data;
#if 0
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
short *sp= fd->filesdna->structs[bhead->SDNAnr];
char *allocname = fd->filesdna->types[ sp[0] ];
char *tmp= malloc(100);
strcpy(tmp, allocname);
data= read_struct(fd, bhead, tmp);
#endif
data= read_struct(fd, bhead, allocname);
if (data) {
oldnewmap_insert(fd->datamap, bhead->old, data, 0);
}
bhead = blo_nextbhead(fd, bhead);
}
return bhead;
}
static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID **id_r)
{
/* this routine reads a libblock and its direct data. Use link functions
@ -5317,32 +5346,11 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
return blo_nextbhead(fd, bhead);
}
bhead = blo_nextbhead(fd, bhead);
/* need a name for the mallocN, just for debugging and sane prints on leaks */
allocname= dataname(GS(id->name));
/* read all data */
while(bhead && bhead->code==DATA) {
void *data;
#if 0
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
short *sp= fd->filesdna->structs[bhead->SDNAnr];
char *allocname = fd->filesdna->types[ sp[0] ];
char *tmp= malloc(100);
strcpy(tmp, allocname);
data= read_struct(fd, bhead, tmp);
#endif
data= read_struct(fd, bhead, allocname);
if (data) {
oldnewmap_insert(fd->datamap, bhead->old, data, 0);
}
bhead = blo_nextbhead(fd, bhead);
}
/* read all data into fd->datamap */
bhead= read_data_into_oldnewmap(fd, bhead, allocname);
/* init pointers direct data */
switch( GS(id->name) ) {
@ -9975,23 +9983,39 @@ static void lib_link_all(FileData *fd, Main *main)
static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
{
Link *link;
UserDef *user;
wmKeyMap *keymap;
wmKeyMapItem *kmi;
bfd->user= read_struct(fd, bhead, "user def");
bfd->user->themes.first= bfd->user->themes.last= NULL;
// XXX
bfd->user->uifonts.first= bfd->user->uifonts.last= NULL;
bfd->user->uistyles.first= bfd->user->uistyles.last= NULL;
bfd->user= user= read_struct(fd, bhead, "user def");
bhead = blo_nextbhead(fd, bhead);
/* read all data into fd->datamap */
bhead= read_data_into_oldnewmap(fd, bhead, "user def");
/* read all attached data */
while(bhead && bhead->code==DATA) {
link= read_struct(fd, bhead, "user def data");
BLI_addtail(&bfd->user->themes, link);
bhead = blo_nextbhead(fd, bhead);
link_list(fd, &user->themes);
link_list(fd, &user->keymaps);
for(keymap=user->keymaps.first; keymap; keymap=keymap->next) {
keymap->modal_items= NULL;
keymap->poll= NULL;
link_list(fd, &keymap->items);
for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
kmi->properties= newdataadr(fd, kmi->properties);
if(kmi->properties)
IDP_DirectLinkProperty(kmi->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
kmi->ptr= NULL;
}
}
// XXX
user->uifonts.first= user->uifonts.last= NULL;
user->uistyles.first= user->uistyles.last= NULL;
/* free fd->datamap again */
oldnewmap_free_unused(fd->datamap);
oldnewmap_clear(fd->datamap);
return bhead;
}

@ -537,13 +537,23 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) /* for renderdeamon
static void write_userdef(WriteData *wd)
{
bTheme *btheme;
wmKeyMap *keymap;
wmKeyMapItem *kmi;
writestruct(wd, USER, "UserDef", 1, &U);
btheme= U.themes.first;
while(btheme) {
for(btheme= U.themes.first; btheme; btheme=btheme->next)
writestruct(wd, DATA, "bTheme", 1, btheme);
btheme= btheme->next;
for(keymap= U.keymaps.first; keymap; keymap=keymap->next) {
writestruct(wd, DATA, "wmKeyMap", 1, keymap);
for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
writestruct(wd, DATA, "wmKeyMapItem", 1, kmi);
if(kmi->properties)
IDP_WriteProperty(kmi->properties, wd);
}
}
}

@ -1687,9 +1687,9 @@ void ED_operatortypes_animchannels(void)
WM_operatortype_append(ANIM_OT_channels_visibility_toggle);
}
void ED_keymap_animchannels(wmWindowManager *wm)
void ED_keymap_animchannels(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(wm, "Animation_Channels", 0, 0);
wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation_Channels", 0, 0);
/* selection */
/* click-select */

@ -990,9 +990,9 @@ void ED_operatortypes_marker(void)
}
/* called in screen_ops.c:ED_keymap_screen() */
void ED_marker_keymap(wmWindowManager *wm)
void ED_marker_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Markers", 0, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Markers", 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_S, KM_ANY, 0, 0);

@ -416,9 +416,9 @@ void ED_operatortypes_anim(void)
WM_operatortype_append(ANIM_OT_keying_set_path_remove);
}
void ED_keymap_anim(wmWindowManager *wm)
void ED_keymap_anim(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Animation", 0, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Animation", 0, 0);
/* frame management */
/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */

@ -205,13 +205,13 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_test); // XXX temp test for context iterators... to be removed
}
void ED_keymap_armature(wmWindowManager *wm)
void ED_keymap_armature(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
/* Armature ------------------------ */
keymap= WM_keymap_find(wm, "Armature", 0, 0);
keymap= WM_keymap_find(keyconf, "Armature", 0, 0);
keymap->poll= ED_operator_editarmature;
/* only set in editmode armature, by space_view3d listener */
@ -297,7 +297,7 @@ void ED_keymap_armature(wmWindowManager *wm)
/* Pose ------------------------ */
/* only set in posemode, by space_view3d listener */
keymap= WM_keymap_find(wm, "Pose", 0, 0);
keymap= WM_keymap_find(keyconf, "Pose", 0, 0);
keymap->poll= ED_operator_posemode;
// XXX: set parent is object-based operator, but it should also be available here...

@ -161,11 +161,11 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(CURVE_OT_specials_menu);
}
void ED_keymap_curve(wmWindowManager *wm)
void ED_keymap_curve(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
keymap= WM_keymap_find(wm, "Font", 0, 0);
keymap= WM_keymap_find(keyconf, "Font", 0, 0);
keymap->poll= ED_operator_editfont;
/* only set in editmode font, by space_view3d listener */
@ -215,7 +215,7 @@ void ED_keymap_curve(wmWindowManager *wm)
WM_keymap_add_item(keymap, "FONT_OT_text_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
/* only set in editmode curve, by space_view3d listener */
keymap= WM_keymap_find(wm, "Curve", 0, 0);
keymap= WM_keymap_find(keyconf, "Curve", 0, 0);
keymap->poll= ED_operator_editsurfcurve;
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);

@ -45,10 +45,10 @@
/* ****************************************** */
/* Generic Editing Keymap */
void ED_keymap_gpencil(wmWindowManager *wm)
void ED_keymap_gpencil(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
wmKeymapItem *kmi;
wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
wmKeyMapItem *kmi;
/* Draw */
/* draw */

@ -34,7 +34,7 @@ struct ListBase;
struct AnimData;
struct bContext;
struct wmWindowManager;
struct wmKeyConfig;
struct ScrArea;
struct ARegion;
struct View2D;
@ -487,11 +487,11 @@ void ANIM_pose_to_action_sync(struct Object *ob, struct ScrArea *sa);
/* generic animation channels */
void ED_operatortypes_animchannels(void);
void ED_keymap_animchannels(struct wmWindowManager *wm);
void ED_keymap_animchannels(struct wmKeyConfig *keyconf);
/* generic time editing */
void ED_operatortypes_anim(void);
void ED_keymap_anim(struct wmWindowManager *wm);
void ED_keymap_anim(struct wmKeyConfig *keyconf);
/* ************************************************ */

@ -35,7 +35,7 @@ struct Bone;
struct bArmature;
struct bPoseChannel;
struct wmOperator;
struct wmWindowManager;
struct wmKeyConfig;
struct ListBase;
struct View3D;
struct ViewContext;
@ -92,7 +92,7 @@ typedef struct EditBone
/* armature_ops.c */
void ED_operatortypes_armature(void);
void ED_keymap_armature(struct wmWindowManager *wm);
void ED_keymap_armature(struct wmKeyConfig *keyconf);
/* editarmature.c */
void ED_armature_from_edit(struct Object *obedit);

@ -36,11 +36,11 @@ struct Scene;
struct Text;
struct View3D;
struct wmOperator;
struct wmWindowManager;
struct wmKeyConfig;
/* curve_ops.c */
void ED_operatortypes_curve(void);
void ED_keymap_curve (struct wmWindowManager *wm);
void ED_keymap_curve (struct wmKeyConfig *keyconf);
/* editcurve.c */
void undo_push_curve (struct bContext *C, char *name);

@ -41,7 +41,7 @@ struct bGPDframe;
struct PointerRNA;
struct Panel;
struct ImBuf;
struct wmWindowManager;
struct wmKeyConfig;
/* ------------- Grease-Pencil Helpers ---------------- */
@ -62,7 +62,7 @@ struct bGPdata *gpencil_data_get_active(struct bContext *C);
/* ----------- Grease Pencil Operators ----------------- */
void ED_keymap_gpencil(struct wmWindowManager *wm);
void ED_keymap_gpencil(struct wmKeyConfig *keyconf);
void ED_operatortypes_gpencil(void);
/* ------------ Grease-Pencil Drawing API ------------------ */

@ -28,7 +28,7 @@
#ifndef ED_MARKERS_H
#define ED_MARKERS_H
struct wmWindowManager;
struct wmKeyConfig;
struct bContext;
struct TimeMarker;
@ -56,7 +56,7 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
/* called in screen_ops.c:ED_operatortypes_screen() */
void ED_operatortypes_marker(void);
/* called in screen_ops.c:ED_keymap_screen() */
void ED_marker_keymap(struct wmWindowManager *wm);
void ED_marker_keymap(struct wmKeyConfig *keyconf);
#endif /* ED_MARKERS_H */

@ -28,10 +28,10 @@
struct bContext;
struct Object;
struct wmWindowManager;
struct wmKeyConfig;
void ED_operatortypes_metaball(void);
void ED_keymap_metaball(struct wmWindowManager *wm);
void ED_keymap_metaball(struct wmKeyConfig *keyconf);
struct MetaElem *add_metaball_primitive(struct bContext *C, int type, int newname);

@ -38,6 +38,7 @@ struct EditFace;
struct bContext;
struct wmOperator;
struct wmWindowManager;
struct wmKeyConfig;
struct ReportList;
struct EditSelection;
struct ViewContext;
@ -84,13 +85,13 @@ int join_mesh_exec(struct bContext *C, struct wmOperator *op);
/* mesh_ops.c */
void ED_operatortypes_mesh(void);
void ED_keymap_mesh(struct wmWindowManager *wm);
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
/* editmesh.c */
void ED_spacetypes_init(void);
void ED_keymap_mesh(struct wmWindowManager *wm);
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
void make_editMesh(struct Scene *scene, struct Object *ob);
void load_editMesh(struct Scene *scene, struct Object *ob);

@ -28,7 +28,7 @@
#ifndef ED_OBJECT_H
#define ED_OBJECT_H
struct wmWindowManager;
struct wmKeyConfig;
struct Scene;
struct Object;
struct bContext;
@ -44,7 +44,7 @@ struct ModifierData;
/* object_edit.c */
void ED_operatortypes_object(void);
void ED_keymap_object(struct wmWindowManager *wm);
void ED_keymap_object(struct wmKeyConfig *keyconf);
/* send your own notifier for select! */
void ED_base_object_select(struct Base *base, short mode);

@ -36,7 +36,7 @@ struct ParticleEditSettings;
struct ParticleSystem;
struct RadialControl;
struct rcti;
struct wmWindowManager;
struct wmKeyConfig;
struct PTCacheEdit;
struct Scene;

@ -30,9 +30,11 @@
#ifndef ED_PHYSICS_H
#define ED_PHYSICS_H
struct wmKeyConfig;
/* operators */
void ED_operatortypes_physics(void);
void ED_keymap_physics(struct wmWindowManager *wm);
void ED_keymap_physics(struct wmKeyConfig *keyconf);
#endif /* ED_PHYSICS_H */

@ -37,6 +37,7 @@ struct wmWindowManager;
struct wmWindow;
struct wmNotifier;
struct wmEvent;
struct wmKeyConfig;
struct bContext;
struct SpaceType;
struct Scene;
@ -63,7 +64,7 @@ void region_scissor_winrct(struct ARegion *ar, struct rcti *winrct);
/* spaces */
void ED_spacetypes_init(void);
void ED_spacetypes_keymap(struct wmWindowManager *wm);
void ED_spacetypes_keymap(struct wmKeyConfig *keyconf);
int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco);
int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco);
void ED_area_overdraw(struct bContext *C);
@ -107,7 +108,7 @@ void ED_screen_new_window(struct bContext *C, struct rcti *position, int type);
void ED_update_for_newframe(const struct bContext *C, int mute);
void ED_operatortypes_screen(void);
void ED_keymap_screen(struct wmWindowManager *wm);
void ED_keymap_screen(struct wmKeyConfig *keyconf);
/* operators; context poll callbacks */
int ED_operator_screenactive(struct bContext *C);

@ -29,14 +29,14 @@
#define ED_SCULPT_H
struct bContext;
struct wmWindowManager;
struct wmKeyConfig;
/* sculpt.c */
void ED_operatortypes_sculpt(void);
/* paint_ops.c */
void ED_operatortypes_paint(void);
void ED_keymap_paint(struct wmWindowManager *wm);
void ED_keymap_paint(struct wmKeyConfig *keyconf);
/* paint_image.c */
void undo_imagepaint_step(int step);

@ -42,8 +42,9 @@ struct uiLayout;
struct EnumPropertyItem;
struct wmOperatorType;
struct wmKeyMap;
struct wmKeyConfig;
void transform_keymap_for_space(struct wmWindowManager *wm, struct wmKeyMap *keymap, int spaceid);
void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid);
void transform_operatortypes(void);
/* ******************** Macros & Prototypes *********************** */

@ -34,11 +34,11 @@ struct Object;
struct MTFace;
struct EditFace;
struct Image;
struct wmWindowManager;
struct wmKeyConfig;
/* uvedit_ops.c */
void ED_operatortypes_uvedit(void);
void ED_keymap_uvedit(struct wmWindowManager *wm);
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);

@ -147,6 +147,7 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_INACTIVE (1<<23)
#define UI_BUT_LAST_ACTIVE (1<<24)
#define UI_BUT_UNDO (1<<25)
#define UI_BUT_IMMEDIATE (1<<26)
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
@ -572,6 +573,8 @@ void UI_exit(void);
#define UI_ITEM_R_SLIDER 4
#define UI_ITEM_R_TOGGLE 8
#define UI_ITEM_R_ICON_ONLY 16
#define UI_ITEM_R_EVENT 32
#define UI_ITEM_R_FULL_EVENT 64
uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);

@ -128,7 +128,7 @@ struct View2D;
struct View2DGrid;
struct View2DScrollers;
struct wmWindowManager;
struct wmKeyConfig;
struct bScreen;
struct ScrArea;
struct ARegion;
@ -196,7 +196,7 @@ void UI_view2d_text_cache_draw(struct ARegion *ar);
/* operators */
void ui_view2d_operatortypes(void);
void UI_view2d_keymap(struct wmWindowManager *wm);
void UI_view2d_keymap(struct wmKeyConfig *keyconf);
#endif /* UI_VIEW2D_H */

@ -1958,7 +1958,10 @@ void ui_check_but(uiBut *but)
if (but->flag & UI_SELECT) {
short *sp= (short *)but->func_arg3;
strcpy(but->drawstr, but->str);
if(but->flag & UI_BUT_IMMEDIATE)
strcpy(but->drawstr, but->str);
else
strcpy(but->drawstr, "");
if(*sp) {
char *str= but->drawstr;
@ -1974,10 +1977,10 @@ void ui_check_but(uiBut *but)
}
else
strcat(but->drawstr, "Press a key ");
} else {
/* XXX todo, button currently only used temporarily */
strcpy(but->drawstr, WM_key_event_string((short) ui_get_but_val(but)));
}
else
strcpy(but->drawstr, but->str);
break;
case BUT_TOGDUAL:

@ -1858,6 +1858,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
but->drawstr[0]= 0;
*(short *)but->func_arg3= 0;
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
@ -1868,9 +1869,12 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
if(event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
if(ELEM(event->type, ESCKEY, LEFTMOUSE)) {
if(event->type == ESCKEY) {
/* data->cancel doesnt work, this button opens immediate */
ui_set_but_val(but, 0);
if(but->flag & UI_BUT_IMMEDIATE)
ui_set_but_val(but, 0);
else
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
@ -3325,6 +3329,7 @@ static uiBlock *menu_change_hotkey(bContext *C, ARegion *ar, void *arg_but)
strcat(buf, " |");
but= uiDefHotKeyevtButS(block, 0, buf, 0, 0, 200, 20, dummy, dummy+1, "");
uiButSetFlag(but, UI_BUT_IMMEDIATE);
uiButSetFunc(but, do_menu_change_hotkey, arg_but, dummy);
uiPopupBoundsBlock(block, 6.0f, 50, -10);
@ -3782,8 +3787,11 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
/* activate right away */
if(but->type==HOTKEYEVT)
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
if(but->flag & UI_BUT_IMMEDIATE) {
if(but->type==HOTKEYEVT)
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
/* .. more to be added here */
}
if(type == BUTTON_ACTIVATE_OPEN) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);

@ -476,8 +476,20 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
MEM_freeN(item);
}
/* callback for keymap item change button */
static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v)
{
uiBut *but= but_v;
short modifier= *((short*)key_v);
RNA_boolean_set(&but->rnapoin, "shift", (modifier & KM_SHIFT) != 0);
RNA_boolean_set(&but->rnapoin, "ctrl", (modifier & KM_CTRL) != 0);
RNA_boolean_set(&but->rnapoin, "alt", (modifier & KM_ALT) != 0);
RNA_boolean_set(&but->rnapoin, "oskey", (modifier & KM_OSKEY) != 0);
}
/* create label + button for RNA property */
static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int icon_only)
static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag)
{
uiLayout *sub;
uiBut *but=NULL;
@ -507,10 +519,26 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, i
/* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, "Browse for file or directory.");
}
else if(subtype == PROP_DIRECTION)
uiDefButR(block, BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
else if(subtype == PROP_DIRECTION) {
uiDefButR(block, BUT_NORMAL, 0, name, x, y, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
}
else if(flag & UI_ITEM_R_EVENT) {
uiDefButR(block, KEYEVT, 0, name, x, y, w, h, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
}
else if(flag & UI_ITEM_R_FULL_EVENT) {
if(RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
static short dummy = 0;
char buf[128];
WM_keymap_item_to_string(ptr->data, buf, sizeof(buf));
but= uiDefButR(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, RNA_property_identifier(prop), 0, 0, 0, -1, -1, NULL);
but->func_arg3= &dummy; // XXX abuse
uiButSetFunc(but, ui_keymap_but_cb, but, &dummy);
}
}
else
but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !icon_only)? NULL: "", icon, x, y, w, h);
but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY))? NULL: "", icon, x, y, w, h);
uiBlockSetCurLayout(block, layout);
return but;
@ -897,7 +925,7 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
/* property with separate label */
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, icon_only);
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
ui_but_add_search(but, ptr, prop, NULL, NULL);
}
/* single button */

@ -126,10 +126,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns)
{
uiLayout *split, *col;
int flag;
char *name;
RNA_STRUCT_BEGIN(ptr, prop) {
if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
flag= RNA_property_flag(prop);
if(flag & PROP_HIDDEN)
continue;
name= (char*)RNA_property_ui_name(prop);

@ -1407,9 +1407,9 @@ void ui_view2d_operatortypes(void)
WM_operatortype_append(VIEW2D_OT_reset);
}
void UI_view2d_keymap(wmWindowManager *wm)
void UI_view2d_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "View2D", 0, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "View2D", 0, 0);
/* pan/scroll */
WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
@ -1445,7 +1445,7 @@ void UI_view2d_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);
/* Alternative keymap for buttons listview */
keymap= WM_keymap_find(wm, "View2D Buttons List", 0, 0);
keymap= WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0);

@ -1240,36 +1240,34 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr,
EnumPropertyItem *item= NULL;
int totitem= 0;
if(C==NULL) {
/* needed for doc generation */
RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
RNA_enum_items_add(&item, &totitem, prop_simedge_types);
RNA_enum_items_add(&item, &totitem, prop_simface_types);
RNA_enum_item_end(&item, &totitem);
*free= 1;
if(C) {
obedit= CTX_data_edit_object(C);
return item;
if(obedit && obedit->type == OB_MESH) {
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
if(em->selectmode & SCE_SELECT_VERTEX)
RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
else if(em->selectmode & SCE_SELECT_EDGE)
RNA_enum_items_add(&item, &totitem, prop_simedge_types);
else if(em->selectmode & SCE_SELECT_FACE)
RNA_enum_items_add(&item, &totitem, prop_simface_types);
RNA_enum_item_end(&item, &totitem);
*free= 1;
return item;
}
}
obedit= CTX_data_edit_object(C);
if(obedit && obedit->type == OB_MESH) {
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
if(em->selectmode & SCE_SELECT_VERTEX)
RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
else if(em->selectmode & SCE_SELECT_EDGE)
RNA_enum_items_add(&item, &totitem, prop_simedge_types);
else if(em->selectmode & SCE_SELECT_FACE)
RNA_enum_items_add(&item, &totitem, prop_simface_types);
RNA_enum_item_end(&item, &totitem);
*free= 1;
return item;
}
/* needed for doc generation */
RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
RNA_enum_items_add(&item, &totitem, prop_simedge_types);
RNA_enum_items_add(&item, &totitem, prop_simface_types);
RNA_enum_item_end(&item, &totitem);
*free= 1;
return NULL;
return item;
}
void MESH_OT_select_similar(wmOperatorType *ot)
@ -1290,7 +1288,7 @@ void MESH_OT_select_similar(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
prop= RNA_def_enum(ot->srna, "type", prop_simvertex_types, 0, "Type", "");
prop= RNA_def_enum(ot->srna, "type", prop_simvertex_types, SIMVERT_NORMAL, "Type", "");
RNA_def_enum_funcs(prop, select_similar_type_itemf);
}

@ -348,12 +348,12 @@ void ED_operatortypes_mesh(void)
}
/* note mesh keymap also for other space? */
void ED_keymap_mesh(wmWindowManager *wm)
void ED_keymap_mesh(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
keymap= WM_keymap_find(wm, "EditMesh", 0, 0);
keymap= WM_keymap_find(keyconf, "EditMesh", 0, 0);
keymap->poll= ED_operator_editmesh;
WM_keymap_add_item(keymap, "MESH_OT_loopcut", RKEY, KM_PRESS, KM_CTRL, 0);

@ -51,11 +51,11 @@ void ED_operatortypes_metaball(void)
WM_operatortype_append(MBALL_OT_select_random_metaelems);
}
void ED_keymap_metaball(wmWindowManager *wm)
void ED_keymap_metaball(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
keymap= WM_keymap_find(wm, "Metaball", 0, 0);
keymap= WM_keymap_find(keyconf, "Metaball", 0, 0);
keymap->poll= ED_operator_editmball;
WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0);

@ -196,12 +196,12 @@ static int object_mode_poll(bContext *C)
return (!ob || ob->mode == OB_MODE_OBJECT);
}
void ED_keymap_object(wmWindowManager *wm)
void ED_keymap_object(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
keymap= WM_keymap_find(wm, "Object Non-modal", 0, 0);
keymap= WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
/* Note: this keymap works disregarding mode */
WM_keymap_add_item(keymap, "OBJECT_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0);
@ -217,7 +217,7 @@ void ED_keymap_object(wmWindowManager *wm)
WM_keymap_add_item(keymap, "OBJECT_OT_center_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
/* Note: this keymap gets disabled in non-objectmode, */
keymap= WM_keymap_find(wm, "Object Mode", 0, 0);
keymap= WM_keymap_find(keyconf, "Object Mode", 0, 0);
keymap->poll= object_mode_poll;
WM_keymap_add_item(keymap, "OBJECT_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
@ -264,7 +264,7 @@ void ED_keymap_object(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
/* Lattice */
keymap= WM_keymap_find(wm, "Lattice", 0, 0);
keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
keymap->poll= ED_operator_editlattice;
WM_keymap_add_item(keymap, "LATTICE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);

@ -83,11 +83,11 @@ static void operatortypes_particle(void)
WM_operatortype_append(PARTICLE_OT_dupliob_move_down);
}
static void keymap_particle(wmWindowManager *wm)
static void keymap_particle(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
keymap= WM_keymap_find(wm, "Particle", 0, 0);
keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
keymap->poll= PE_poll;
WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
@ -166,10 +166,10 @@ void ED_operatortypes_physics(void)
operatortypes_pointcache();
}
void ED_keymap_physics(wmWindowManager *wm)
void ED_keymap_physics(wmKeyConfig *keyconf)
{
keymap_particle(wm);
//keymap_pointcache(wm);
keymap_particle(keyconf);
//keymap_pointcache(keyconf);
}

@ -824,24 +824,24 @@ static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int fla
UI_add_region_handlers(handlers);
}
if(flag & ED_KEYMAP_VIEW2D) {
wmKeyMap *keymap= WM_keymap_find(wm, "View2D", 0, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_MARKERS) {
wmKeyMap *keymap= WM_keymap_find(wm, "Markers", 0, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
// XXX need boundbox check urgently!!!
}
if(flag & ED_KEYMAP_ANIMATION) {
wmKeyMap *keymap= WM_keymap_find(wm, "Animation", 0, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_FRAMES) {
wmKeyMap *keymap= WM_keymap_find(wm, "Frames", 0, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_GPENCIL) {
wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
}
@ -1371,7 +1371,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
keymap= WM_keymap_find(wm, "View2D Buttons List", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}

@ -2550,7 +2550,7 @@ static ScrArea *find_empty_image_area(bContext *C)
static void screen_set_image_output(bContext *C, int mx, int my)
{
Scene *scene= CTX_data_scene(C);
ScrArea *sa;
ScrArea *sa= NULL;
SpaceImage *sima;
if(scene->r.displaymode==R_OUTPUT_WINDOW) {
@ -2580,8 +2580,8 @@ static void screen_set_image_output(bContext *C, int mx, int my)
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
sa= CTX_wm_area(C);
}
else {
if(!sa) {
sa= find_area_showing_r_result(C);
if(sa==NULL)
sa= find_area_image_empty(C);
@ -3286,7 +3286,7 @@ void ED_operatortypes_screen(void)
}
static void keymap_modal_set(wmWindowManager *wm)
static void keymap_modal_set(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@ -3297,7 +3297,7 @@ static void keymap_modal_set(wmWindowManager *wm)
wmKeyMap *keymap;
/* Standard Modal keymap ------------------------------------------------ */
keymap= WM_modalkeymap_add(wm, "Standard Modal Map", modal_items);
keymap= WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items);
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, KM_MODAL_APPLY);
@ -3312,12 +3312,12 @@ static void keymap_modal_set(wmWindowManager *wm)
}
/* called in spacetypes.c */
void ED_keymap_screen(wmWindowManager *wm)
void ED_keymap_screen(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
/* Screen Editing ------------------------------------------------ */
keymap= WM_keymap_find(wm, "Screen Editing", 0, 0);
keymap= WM_keymap_find(keyconf, "Screen Editing", 0, 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1);
@ -3334,7 +3334,7 @@ void ED_keymap_screen(wmWindowManager *wm)
/* Screen General ------------------------------------------------ */
keymap= WM_keymap_find(wm, "Screen", 0, 0);
keymap= WM_keymap_find(keyconf, "Screen", 0, 0);
/* standard timers */
WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
@ -3389,7 +3389,7 @@ void ED_keymap_screen(wmWindowManager *wm)
/* Anim Playback ------------------------------------------------ */
keymap= WM_keymap_find(wm, "Frames", 0, 0);
keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
/* frame offsets */
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 10);
@ -3409,6 +3409,6 @@ void ED_keymap_screen(wmWindowManager *wm)
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", KKEY, KM_PRESS, 0, LKEY);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1);
keymap_modal_set(wm);
keymap_modal_set(keyconf);
}

@ -134,12 +134,12 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(PAINT_OT_vertex_color_set);
}
void ED_keymap_paint(wmWindowManager *wm)
void ED_keymap_paint(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
/* Sculpt mode */
keymap= WM_keymap_find(wm, "Sculpt", 0, 0);
keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
keymap->poll= sculpt_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@ -150,7 +150,7 @@ void ED_keymap_paint(wmWindowManager *wm)
WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
/* Vertex Paint mode */
keymap= WM_keymap_find(wm, "Vertex Paint", 0, 0);
keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
keymap->poll= vertex_paint_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@ -159,7 +159,7 @@ void ED_keymap_paint(wmWindowManager *wm)
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
/* Weight Paint mode */
keymap= WM_keymap_find(wm, "Weight Paint", 0, 0);
keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0);
keymap->poll= weight_paint_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@ -168,7 +168,7 @@ void ED_keymap_paint(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
/* Image/Texture Paint mode */
keymap= WM_keymap_find(wm, "Image Paint", 0, 0);
keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
keymap->poll= image_texture_paint_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);

@ -124,7 +124,7 @@ enum {
/* ***************************************** */
/* action_ops.c */
void action_operatortypes(void);
void action_keymap(struct wmWindowManager *wm);
void action_keymap(struct wmKeyConfig *keyconf);
#endif /* ED_ACTION_INTERN_H */

@ -91,9 +91,9 @@ void action_operatortypes(void)
/* ************************** registration - keymaps **********************************/
static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
/* action_select.c - selection tools */
/* click-select */
@ -156,7 +156,7 @@ static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "ACT_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
/* transform system */
transform_keymap_for_space(wm, keymap, SPACE_ACTION);
transform_keymap_for_space(keyconf, keymap, SPACE_ACTION);
/* test */
/* WM_keymap_add_item(keymap, "ACT_OT_test", QKEY, KM_PRESS, 0, 0); */
@ -164,7 +164,7 @@ static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
/* --------------- */
void action_keymap(wmWindowManager *wm)
void action_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
@ -175,7 +175,7 @@ void action_keymap(wmWindowManager *wm)
*/
/* keyframes */
keymap= WM_keymap_find(wm, "Action_Keys", SPACE_ACTION, 0);
action_keymap_keyframes(wm, keymap);
keymap= WM_keymap_find(keyconf, "Action_Keys", SPACE_ACTION, 0);
action_keymap_keyframes(keyconf, keymap);
}

@ -158,7 +158,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Action_Keys", SPACE_ACTION, 0);
keymap= WM_keymap_find(wm->defaultconf, "Action_Keys", SPACE_ACTION, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -221,7 +221,7 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Animation_Channels", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Animation_Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -110,35 +110,35 @@ void ED_spacetypes_init(void)
/* called in wm.c */
/* keymap definitions are registered only once per WM initialize, usually on file read,
using the keymap the actual areas/regions add the handlers */
void ED_spacetypes_keymap(wmWindowManager *wm)
void ED_spacetypes_keymap(wmKeyConfig *keyconf)
{
const ListBase *spacetypes;
SpaceType *stype;
ARegionType *atype;
ED_keymap_screen(wm);
ED_keymap_anim(wm);
ED_keymap_animchannels(wm);
ED_keymap_gpencil(wm);
ED_keymap_object(wm);
ED_keymap_mesh(wm);
ED_keymap_uvedit(wm);
ED_keymap_curve(wm);
ED_keymap_armature(wm);
ED_keymap_physics(wm);
ED_keymap_metaball(wm);
ED_keymap_paint(wm);
ED_marker_keymap(wm);
ED_keymap_screen(keyconf);
ED_keymap_anim(keyconf);
ED_keymap_animchannels(keyconf);
ED_keymap_gpencil(keyconf);
ED_keymap_object(keyconf);
ED_keymap_mesh(keyconf);
ED_keymap_uvedit(keyconf);
ED_keymap_curve(keyconf);
ED_keymap_armature(keyconf);
ED_keymap_physics(keyconf);
ED_keymap_metaball(keyconf);
ED_keymap_paint(keyconf);
ED_marker_keymap(keyconf);
UI_view2d_keymap(wm);
UI_view2d_keymap(keyconf);
spacetypes = BKE_spacetypes_list();
for(stype=spacetypes->first; stype; stype=stype->next) {
if(stype->keymap)
stype->keymap(wm);
stype->keymap(keyconf);
for(atype=stype->regiontypes.first; atype; atype=atype->next) {
if(atype->keymap)
atype->keymap(wm);
atype->keymap(keyconf);
}
}
}
@ -234,7 +234,7 @@ static void xxx_operatortypes(void)
/* register operator types for this space */
}
static void xxx_keymap(wmWindowManager *wm)
static void xxx_keymap(wmKeyConfig *keyconf)
{
/* add default items to keymap */
}

@ -142,7 +142,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "Buttons Generic", SPACE_BUTS, 0);
keymap= WM_keymap_find(wm->defaultconf, "Buttons Generic", SPACE_BUTS, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -189,9 +189,9 @@ void buttons_operatortypes(void)
WM_operatortype_append(BUTTONS_OT_file_browse);
}
void buttons_keymap(struct wmWindowManager *wm)
void buttons_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Buttons Generic", SPACE_BUTS, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Buttons Generic", SPACE_BUTS, 0);
WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
}

@ -152,7 +152,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Console", SPACE_CONSOLE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -232,9 +232,9 @@ void console_operatortypes(void)
WM_operatortype_append(CONSOLE_OT_report_copy);
}
void console_keymap(struct wmWindowManager *wm)
void console_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Console", SPACE_CONSOLE, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
#ifdef __APPLE__
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);

@ -172,16 +172,16 @@ static void file_panel_operator(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op= sfile->op;
int empty= 1;
int empty= 1, flag;
if(op->type->ui) {
op->type->ui((bContext*)C, op->ptr, pa->layout);
}
else {
RNA_STRUCT_BEGIN(op->ptr, prop) {
if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
continue;
if(strcmp(RNA_property_identifier(prop), "filemode") == 0)
flag= RNA_property_flag(prop);
if(flag & PROP_HIDDEN)
continue;
if(strcmp(RNA_property_identifier(prop), "path") == 0)
continue;
@ -189,10 +189,6 @@ static void file_panel_operator(const bContext *C, Panel *pa)
continue;
if(strcmp(RNA_property_identifier(prop), "filename") == 0)
continue;
if(strcmp(RNA_property_identifier(prop), "display") == 0)
continue;
if(strncmp(RNA_property_identifier(prop), "filter", 6) == 0)
continue;
uiItemFullR(pa->layout, NULL, 0, op->ptr, prop, -1, 0, 0);
empty= 0;

@ -406,7 +406,7 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
previous_folder = folderlist->last;
// check if already exists
if(previous_folder){
if(previous_folder && previous_folder->foldername){
if(! strcmp(previous_folder->foldername, dir)){
return;
}

@ -124,7 +124,10 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (op) {
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
params->type = RNA_int_get(op->ptr, "filemode");
if(RNA_struct_find_property(op->ptr, "filename"))
params->type = RNA_int_get(op->ptr, "filemode");
else
params->type = FILE_SPECIAL;
if (RNA_property_is_set(op->ptr, "path")) {
RNA_string_get(op->ptr, "path", name);
@ -140,15 +143,24 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
}
params->filter = 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_blender"))
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_image"))
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_movie"))
params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_text"))
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_python"))
params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_font"))
params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_sound"))
params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_text"))
params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
if(RNA_struct_find_property(op->ptr, "filter_folder"))
params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
if (params->filter != 0)
params->flag |= FILE_FILTER;

@ -253,10 +253,10 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymaps */
keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "FileMain", SPACE_FILE, 0);
keymap= WM_keymap_find(wm->defaultconf, "FileMain", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@ -364,11 +364,11 @@ void file_operatortypes(void)
}
/* NOTE: do not add .blend file reading on this level */
void file_keymap(struct wmWindowManager *wm)
void file_keymap(struct wmKeyConfig *keyconf)
{
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
/* keys for all areas */
wmKeyMap *keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "File", SPACE_FILE, 0);
WM_keymap_add_item(keymap, "FILE_OT_bookmark_toggle", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_add_bookmark", BKEY, KM_PRESS, KM_CTRL, 0);
@ -380,7 +380,7 @@ void file_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "FILE_OT_delete", DELKEY, KM_PRESS, 0, 0);
/* keys for main area */
keymap= WM_keymap_find(wm, "FileMain", SPACE_FILE, 0);
keymap= WM_keymap_find(keyconf, "FileMain", SPACE_FILE, 0);
WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_select_border", BKEY, KM_PRESS, 0, 0);
@ -401,7 +401,7 @@ void file_keymap(struct wmWindowManager *wm)
RNA_int_set(kmi->ptr, "increment",-100);
/* keys for button area (top) */
keymap= WM_keymap_find(wm, "FileButtons", SPACE_FILE, 0);
keymap= WM_keymap_find(keyconf, "FileButtons", SPACE_FILE, 0);
WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", 1);
@ -425,7 +425,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
/* own keymaps */
keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -461,10 +461,10 @@ static void file_ui_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "FileButtons", SPACE_FILE, 0);
keymap= WM_keymap_find(wm->defaultconf, "FileButtons", SPACE_FILE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -159,7 +159,7 @@ int graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
/* graph_ops.c */
void graphedit_keymap(struct wmWindowManager *wm);
void graphedit_keymap(struct wmKeyConfig *keyconf);
void graphedit_operatortypes(void);

@ -141,9 +141,9 @@ void graphedit_operatortypes(void)
/* ************************** registration - keymaps **********************************/
static void graphedit_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
/* view */
WM_keymap_add_item(keymap, "GRAPH_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
@ -225,17 +225,17 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
/* transform system */
transform_keymap_for_space(wm, keymap, SPACE_IPO);
transform_keymap_for_space(keyconf, keymap, SPACE_IPO);
}
/* --------------- */
void graphedit_keymap(wmWindowManager *wm)
void graphedit_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
/* keymap for all regions */
keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
keymap= WM_keymap_find(keyconf, "GraphEdit Generic", SPACE_IPO, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
/* channels */
@ -245,7 +245,7 @@ void graphedit_keymap(wmWindowManager *wm)
*/
/* keyframes */
keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
graphedit_keymap_keyframes(wm, keymap);
keymap= WM_keymap_find(keyconf, "GraphEdit Keys", SPACE_IPO, 0);
graphedit_keymap_keyframes(keyconf, keymap);
}

@ -208,9 +208,9 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Keys", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -286,9 +286,9 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Animation_Channels", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Animation_Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -356,7 +356,7 @@ static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -202,9 +202,9 @@ void image_operatortypes(void)
WM_operatortype_append(IMAGE_OT_properties);
}
void image_keymap(struct wmWindowManager *wm)
void image_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
@ -212,7 +212,7 @@ void image_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
keymap= WM_keymap_find(wm, "Image", SPACE_IMAGE, 0);
keymap= WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
@ -389,16 +389,16 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* image paint polls for mode */
keymap= WM_keymap_find(wm, "Image Paint", SPACE_IMAGE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image Paint", SPACE_IMAGE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "UVEdit", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "UVEdit", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* own keymaps */
keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Image", SPACE_IMAGE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -463,7 +463,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}

@ -134,7 +134,7 @@ void info_operatortypes(void)
WM_operatortype_append(FILE_OT_find_missing_files);
}
void info_keymap(struct wmWindowManager *wm)
void info_keymap(struct wmKeyConfig *keyconf)
{
}

@ -186,9 +186,9 @@ void logic_operatortypes(void)
}
void logic_keymap(struct wmWindowManager *wm)
void logic_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Logic Generic", SPACE_LOGIC, 0);
WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
}
@ -239,7 +239,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymaps */
keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
keymap= WM_keymap_find(wm->defaultconf, "Logic Generic", SPACE_LOGIC, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -280,7 +280,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
keymap= WM_keymap_find(wm->defaultconf, "Logic Generic", SPACE_LOGIC, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}

@ -130,7 +130,7 @@ short nlaedit_is_tweakmode_on(bAnimContext *ac);
/* --- */
void nla_operatortypes(void);
void nla_keymap(wmWindowManager *wm);
void nla_keymap(wmKeyConfig *keyconf);
#endif /* ED_NLA_INTERN_H */

@ -167,7 +167,7 @@ void nla_operatortypes(void)
/* ************************** registration - keymaps **********************************/
static void nla_keymap_channels (wmWindowManager *wm, wmKeyMap *keymap)
static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap)
{
/* NLA-specific (different to standard channels keymap) -------------------------- */
/* selection */
@ -210,9 +210,9 @@ static void nla_keymap_channels (wmWindowManager *wm, wmKeyMap *keymap)
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 1);
}
static void nla_keymap_main (wmWindowManager *wm, wmKeyMap *keymap)
static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
/* selection */
/* click select */
@ -277,17 +277,17 @@ static void nla_keymap_main (wmWindowManager *wm, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "NLA_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
/* transform system */
transform_keymap_for_space(wm, keymap, SPACE_NLA);
transform_keymap_for_space(keyconf, keymap, SPACE_NLA);
}
/* --------------- */
void nla_keymap(wmWindowManager *wm)
void nla_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
/* keymap for all regions */
keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
keymap= WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0);
/* channels */
@ -297,11 +297,11 @@ void nla_keymap(wmWindowManager *wm)
*
* However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
*/
keymap= WM_keymap_find(wm, "NLA Channels", SPACE_NLA, 0);
nla_keymap_channels(wm, keymap);
keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
nla_keymap_channels(keyconf, keymap);
/* data */
keymap= WM_keymap_find(wm, "NLA Data", SPACE_NLA, 0);
nla_keymap_main(wm, keymap);
keymap= WM_keymap_find(keyconf, "NLA Data", SPACE_NLA, 0);
nla_keymap_main(keyconf, keymap);
}

@ -214,9 +214,9 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
// TODO: cannot use generic copy, need special NLA version
keymap= WM_keymap_find(wm, "NLA Channels", SPACE_NLA, 0);
keymap= WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -259,9 +259,9 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "NLA Data", SPACE_NLA, 0);
keymap= WM_keymap_find(wm->defaultconf, "NLA Data", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -358,7 +358,7 @@ static void nla_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -53,7 +53,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
/* node_ops.c */
void node_operatortypes(void);
void node_keymap(wmWindowManager *wm);
void node_keymap(wmKeyConfig *keyconf);
/* node_select.c */
void NODE_OT_select(struct wmOperatorType *ot);

@ -67,10 +67,10 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_group_edit);
}
void node_keymap(struct wmWindowManager *wm)
void node_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Node", SPACE_NODE, 0);
wmKeymapItem *kmi;
wmKeyMap *keymap= WM_keymap_find(keyconf, "Node", SPACE_NODE, 0);
wmKeyMapItem *kmi;
/* mouse select in nodes used to be both keys, it's UI elements... */
RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
@ -101,5 +101,5 @@ void node_keymap(struct wmWindowManager *wm)
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "name", "NODE_MT_add");
transform_keymap_for_space(wm, keymap, SPACE_NODE);
transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
}

@ -252,7 +252,7 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Node", SPACE_NODE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Node", SPACE_NODE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -1113,16 +1113,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(type == TSE_KEYMAP) {
wmKeyMap *km= (wmKeyMap *)idv;
wmKeymapItem *kmi;
wmKeyMapItem *kmi;
char opname[OP_MAX_TYPENAME];
te->directdata= idv;
te->name= km->nameid;
te->name= km->idname;
if(!(tselem->flag & TSE_CLOSED)) {
a= 0;
for (kmi= km->keymap.first; kmi; kmi= kmi->next, a++) {
for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
const char *key= WM_key_event_string(kmi->type);
if(key[0]) {
@ -1408,7 +1408,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
wmWindowManager *wm= mainvar->wm.first;
wmKeyMap *km;
for(km= wm->keymaps.first; km; km= km->next) {
for(km= wm->defaultconf->keymaps.first; km; km= km->next) {
ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
}
}
@ -2229,14 +2229,14 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme
static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
{
wmKeymapItem *kmi= te->directdata;
wmKeyMapItem *kmi= te->directdata;
if(set==0) {
if(kmi->inactive) return 0;
if(kmi->flag & KMI_INACTIVE) return 0;
return 1;
}
else {
kmi->inactive= !kmi->inactive;
kmi->flag ^= KMI_INACTIVE;
}
return 0;
}
@ -4957,7 +4957,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
{
wmOperatorType *ot= arg2;
wmKeymapItem *kmi= arg_kmi;
wmKeyMapItem *kmi= arg_kmi;
if(ot)
BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
@ -4987,7 +4987,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static char search[OP_MAX_TYPENAME];
wmEvent event;
wmWindow *win= CTX_wm_window(C);
wmKeymapItem *kmi= arg_kmi;
wmKeyMapItem *kmi= arg_kmi;
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
uiBlock *block;
uiBut *but;
@ -5026,8 +5026,8 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
static short keymap_menu_type(short type)
{
if(ISKEYBOARD(type)) return OL_KM_KEYBOARD;
if(WM_key_event_is_tweak(type)) return OL_KM_TWEAK;
if(type >= LEFTMOUSE && type <= WHEELOUTMOUSE) return OL_KM_MOUSE;
if(ISTWEAK(type)) return OL_KM_TWEAK;
if(ISMOUSE(type)) return OL_KM_MOUSE;
// return OL_KM_SPECIALS;
return 0;
}
@ -5083,8 +5083,6 @@ static char *keymap_tweak_menu(void)
str += sprintf(str, formatstr, "Left Mouse", EVT_TWEAK_L);
str += sprintf(str, formatstr, "Middle Mouse", EVT_TWEAK_M);
str += sprintf(str, formatstr, "Right Mouse", EVT_TWEAK_R);
str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE);
str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE);
str += sprintf(str, formatstr, "Action Mouse", EVT_TWEAK_A);
str += sprintf(str, formatstr, "Select Mouse", EVT_TWEAK_S);
@ -5115,7 +5113,7 @@ static char *keymap_tweak_dir_menu(void)
static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v)
{
wmKeymapItem *kmi= kmi_v;
wmKeyMapItem *kmi= kmi_v;
short maptype= keymap_menu_type(kmi->type);
if(maptype!=kmi->maptype) {
@ -5158,7 +5156,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
int butw3= 43; /* modifiers */
if(tselem->type == TSE_KEYMAP_ITEM) {
wmKeymapItem *kmi= te->directdata;
wmKeyMapItem *kmi= te->directdata;
/* modal map? */
if(kmi->propvalue);

@ -110,7 +110,7 @@ typedef struct TreeElement {
/* outliner_ops.c */
void outliner_operatortypes(void);
void outliner_keymap(struct wmWindowManager *wm);
void outliner_keymap(struct wmKeyConfig *keyconf);
/* outliner_header.c */
void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);

@ -74,9 +74,9 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_drivers_delete);
}
void outliner_keymap(wmWindowManager *wm)
void outliner_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);

@ -77,7 +77,7 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -36,7 +36,7 @@ void script_header_buttons(const bContext *C, ARegion *ar);
/* script_ops.c */
void script_operatortypes(void);
void script_keymap(struct wmWindowManager *wm);
void script_keymap(struct wmKeyConfig *keyconf);
/* script_edit.c */
void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);

@ -63,9 +63,9 @@ void script_operatortypes(void)
WM_operatortype_append(SCRIPT_OT_python_run_ui_scripts);
}
void script_keymap(wmWindowManager *wm)
void script_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Script", SPACE_SCRIPT, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "path", "test.py");

@ -138,7 +138,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Script", SPACE_SCRIPT, 0);
keymap= WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -75,7 +75,8 @@ extern EnumPropertyItem prop_side_types[];
/* operators */
struct wmOperatorType;
struct wmWindowManager;
struct wmKeyConfig;
void SEQUENCER_OT_cut(struct wmOperatorType *ot);
void SEQUENCER_OT_mute(struct wmOperatorType *ot);
void SEQUENCER_OT_unmute(struct wmOperatorType *ot);
@ -137,7 +138,7 @@ enum {
/* sequencer_ops.c */
void sequencer_operatortypes(void);
void sequencer_keymap(struct wmWindowManager *wm);
void sequencer_keymap(struct wmKeyConfig *keyconf);
/* sequencer_scope.c */
struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf);

@ -103,10 +103,10 @@ void sequencer_operatortypes(void)
}
void sequencer_keymap(wmWindowManager *wm)
void sequencer_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "Sequencer", SPACE_SEQ, 0);
wmKeymapItem *kmi;
wmKeyMap *keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
wmKeyMapItem *kmi;
WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
@ -183,6 +183,6 @@ void sequencer_keymap(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "ANIM_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0);
transform_keymap_for_space(wm, keymap, SPACE_SEQ);
transform_keymap_for_space(keyconf, keymap, SPACE_SEQ);
}

@ -190,7 +190,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Sequencer", SPACE_SEQ, 0);
keymap= WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -147,7 +147,7 @@ static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Sound", SPACE_SOUND, 0);
keymap= WM_keymap_find(wm->defaultconf, "Sound", SPACE_SOUND, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@ -179,7 +179,7 @@ void sound_operatortypes(void)
}
void sound_keymap(struct wmWindowManager *wm)
void sound_keymap(struct wmKeyConfig *keyconf)
{
}

@ -206,11 +206,11 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_resolve_conflict);
}
static void text_keymap(struct wmWindowManager *wm)
static void text_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
keymap= WM_keymap_find(wm, "Text", SPACE_TEXT, 0);
keymap= WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
#ifdef __APPLE__
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
@ -336,7 +336,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "Text", SPACE_TEXT, 0);
keymap= WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -207,7 +207,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_find(wm, "TimeLine", SPACE_TIME, 0);
keymap= WM_keymap_find(wm->defaultconf, "TimeLine", SPACE_TIME, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}

@ -35,7 +35,7 @@ struct wmWindowManager;
/* time_ops.c */
void time_operatortypes(void);
void time_keymap(struct wmWindowManager *wm);
void time_keymap(struct wmKeyConfig *keyconf);
/* time_header.c */
void time_header_buttons(const bContext *C, ARegion *ar);

@ -140,9 +140,9 @@ void time_operatortypes(void)
WM_operatortype_append(TIME_OT_end_frame_set);
}
void time_keymap(wmWindowManager *wm)
void time_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(wm, "TimeLine", SPACE_TIME, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "TimeLine", SPACE_TIME, 0);
WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);

@ -115,7 +115,7 @@ void userpref_operatortypes(void)
{
}
void userpref_keymap(struct wmWindowManager *wm)
void userpref_keymap(struct wmKeyConfig *keyconf)
{
}
@ -167,7 +167,7 @@ void ED_spacetype_userpref(void)
art->init= userpref_main_area_init;
art->draw= userpref_main_area_draw;
art->listener= userpref_main_area_listener;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->keymapflag= ED_KEYMAP_UI;
BLI_addhead(&st->regiontypes, art);

@ -280,62 +280,62 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
/* object ops. */
keymap= WM_keymap_find(wm, "Object Non-modal", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* pose is not modal, operator poll checks for this */
keymap= WM_keymap_find(wm, "Pose", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Object Mode", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Image Paint", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Vertex Paint", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Weight Paint", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Sculpt", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "EditMesh", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "EditMesh", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Curve", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Armature", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Pose", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Metaball", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Lattice", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* armature sketching needs to take over mouse */
keymap= WM_keymap_find(wm, "Armature_Sketch", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Armature_Sketch", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "Particle", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* editfont keymap swallows all... */
keymap= WM_keymap_find(wm, "Font", 0, 0);
keymap= WM_keymap_find(wm->defaultconf, "Font", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* own keymap, last so modes can override it */
keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_find(wm, "View3D", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(wm->defaultconf, "View3D", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -491,7 +491,7 @@ static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
static void view3d_header_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
@ -531,7 +531,7 @@ static void view3d_buttons_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@ -602,7 +602,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}

@ -371,7 +371,7 @@ enum {
/* called in transform_ops.c, on each regeneration of keymaps */
void viewrotate_modal_keymap(wmWindowManager *wm)
void viewrotate_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Cancel", ""},
@ -381,12 +381,12 @@ void viewrotate_modal_keymap(wmWindowManager *wm)
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Rotate Modal");
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
/* this function is called for each spacetype, only needs to add map once */
if(keymap) return;
keymap= WM_modalkeymap_add(wm, "View3D Rotate Modal", modal_items);
keymap= WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
@ -630,19 +630,19 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
/* called in transform_ops.c, on each regeneration of keymaps */
void viewmove_modal_keymap(wmWindowManager *wm)
void viewmove_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Move Modal");
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Move Modal");
/* this function is called for each spacetype, only needs to add map once */
if(keymap) return;
keymap= WM_modalkeymap_add(wm, "View3D Move Modal", modal_items);
keymap= WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
@ -749,19 +749,19 @@ void VIEW3D_OT_move(wmOperatorType *ot)
/* ************************ viewzoom ******************************** */
/* called in transform_ops.c, on each regeneration of keymaps */
void viewzoom_modal_keymap(wmWindowManager *wm)
void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Zoom Modal");
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
/* this function is called for each spacetype, only needs to add map once */
if(keymap) return;
keymap= WM_modalkeymap_add(wm, "View3D Zoom Modal", modal_items);
keymap= WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);

@ -62,7 +62,7 @@ void VIEW3D_OT_layers(struct wmOperatorType *ot);
/* view3d_ops.c */
void view3d_operatortypes(void);
void view3d_keymap(struct wmWindowManager *wm);
void view3d_keymap(struct wmKeyConfig *keyconf);
/* view3d_edit.c */
void VIEW3D_OT_zoom(struct wmOperatorType *ot);
@ -137,10 +137,10 @@ void smooth_view(struct bContext *C, Object *, Object *, float *ofs, float *quat
void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
void fly_modal_keymap(struct wmWindowManager *wm);
void viewrotate_modal_keymap(struct wmWindowManager *wm);
void viewmove_modal_keymap(struct wmWindowManager *wm);
void viewzoom_modal_keymap(struct wmWindowManager *wm);
void fly_modal_keymap(struct wmKeyConfig *keyconf);
void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
/* view3d_buttons.c */
void VIEW3D_OT_properties(struct wmOperatorType *ot);

@ -103,18 +103,18 @@ void view3d_operatortypes(void)
transform_operatortypes();
}
void view3d_keymap(wmWindowManager *wm)
void view3d_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeymapItem *km;
wmKeyMapItem *km;
keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(keyconf, "View3D Generic", SPACE_VIEW3D, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_toolbar", TKEY, KM_PRESS, 0, 0);
/* only for region 3D window */
keymap= WM_keymap_find(wm, "View3D", SPACE_VIEW3D, 0);
keymap= WM_keymap_find(keyconf, "View3D", SPACE_VIEW3D, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, 0, 0); /* manipulator always on left mouse, not on action mouse*/
@ -221,11 +221,11 @@ void view3d_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "VIEW3D_OT_snap_menu", SKEY, KM_PRESS, KM_SHIFT, 0);
transform_keymap_for_space(wm, keymap, SPACE_VIEW3D);
transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
fly_modal_keymap(wm);
viewrotate_modal_keymap(wm);
viewmove_modal_keymap(wm);
viewzoom_modal_keymap(wm);
fly_modal_keymap(keyconf);
viewrotate_modal_keymap(keyconf);
viewmove_modal_keymap(keyconf);
viewzoom_modal_keymap(keyconf);
}

@ -1633,7 +1633,7 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
#define FLY_MODAL_PRECISION_DISABLE 16
/* called in transform_ops.c, on each regeneration of keymaps */
void fly_modal_keymap(wmWindowManager *wm)
void fly_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@ -1659,12 +1659,12 @@ void fly_modal_keymap(wmWindowManager *wm)
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Fly Modal");
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal");
/* this function is called for each spacetype, only needs to add map once */
if(keymap) return;
keymap= WM_modalkeymap_add(wm, "View3D Fly Modal", modal_items);
keymap= WM_modalkeymap_add(keyconf, "View3D Fly Modal", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CANCEL);

@ -515,7 +515,7 @@ static char *transform_to_undostr(TransInfo *t)
#define TFM_MODAL_SNAP_GEARS_OFF 7
/* called in transform_ops.c, on each regeneration of keymaps */
void transform_modal_keymap(wmWindowManager *wm)
void transform_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@ -527,12 +527,12 @@ void transform_modal_keymap(wmWindowManager *wm)
{TFM_MODAL_SNAP_GEARS_OFF, "SNAP_GEARS_OFF", 0, "Snap Off", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(wm, "Transform Modal Map");
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
/* this function is called for each spacetype, only needs to add map once */
if(keymap) return;
keymap= WM_modalkeymap_add(wm, "Transform Modal Map", modal_items);
keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);

@ -508,7 +508,7 @@ int Align(TransInfo *t, short mval[2]);
void drawPropCircle(const struct bContext *C, TransInfo *t);
void transform_modal_keymap(struct wmWindowManager *wm);
void transform_modal_keymap(struct wmKeyConfig *keyconf);
/*********************** transform_conversions.c ********** */

@ -734,12 +734,12 @@ void transform_operatortypes(void)
WM_operatortype_append(TFM_OT_delete_orientation);
}
void transform_keymap_for_space(struct wmWindowManager *wm, struct wmKeyMap *keymap, int spaceid)
void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid)
{
wmKeymapItem *km;
wmKeyMapItem *km;
/* transform.c, only adds modal map once, checks if it's there */
transform_modal_keymap(wm);
transform_modal_keymap(keyconf);
switch(spaceid)
{

@ -3084,11 +3084,11 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_tile_set);
}
void ED_keymap_uvedit(wmWindowManager *wm)
void ED_keymap_uvedit(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
keymap= WM_keymap_find(wm, "UVEdit", 0, 0);
keymap= WM_keymap_find(keyconf, "UVEdit", 0, 0);
keymap->poll= ED_operator_uvedit;
/* pick selection */
@ -3129,6 +3129,6 @@ void ED_keymap_uvedit(wmWindowManager *wm)
WM_keymap_add_item(keymap, "UV_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_tile_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
transform_keymap_for_space(wm, keymap, SPACE_IMAGE);
transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE);
}

@ -308,6 +308,8 @@ typedef struct UserDef {
struct ListBase themes;
struct ListBase uifonts;
struct ListBase uistyles;
struct ListBase keymaps;
char keyconfigstr[64];
short undosteps;
short undomemory;
@ -345,6 +347,14 @@ extern UserDef U; /* from blenkernel blender.c */
/* ***************** USERDEF ****************** */
/* userpref/section */
#define USER_SECTION_INTERFACE 0
#define USER_SECTION_EDIT 1
#define USER_SECTION_FILE 2
#define USER_SECTION_SYSTEM 3
#define USER_SECTION_THEME 4
#define USER_SECTION_INPUT 5
/* flag */
#define USER_AUTOSAVE (1 << 0)
#define USER_AUTOGRABGRID (1 << 1)

@ -42,6 +42,7 @@ struct wmGesture;
struct wmOperatorType;
struct wmOperator;
struct wmKeyMap;
struct wmKeyConfig;
/* forwards */
struct bContext;
@ -120,9 +121,9 @@ typedef struct wmWindowManager {
ListBase paintcursors; /* extra overlay cursors to draw, like circles */
/* used keymaps, optionally/partially saved */
ListBase keymaps;
ListBase keyconfigs; /* known key configurations */
struct wmKeyConfig *defaultconf; /* default configuration, not saved */
int defaultactmap, pad2; /* active keymap from default for editing */
} wmWindowManager;
/* wmWindowManager.initialized */
@ -234,44 +235,70 @@ typedef struct wmOperatorType {
/* partial copy of the event, for matching by eventhandler */
typedef struct wmKeymapItem {
struct wmKeymapItem *next, *prev;
typedef struct wmKeyMapItem {
struct wmKeyMapItem *next, *prev;
/* operator */
char idname[64]; /* used to retrieve operator type pointer */
struct PointerRNA *ptr; /* rna pointer to access properties */
IDProperty *properties; /* operator properties */
/* modal */
short propvalue; /* if used, the item is from modal map */
/* event */
short type; /* event code itself */
short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */
short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
short keymodifier; /* rawkey modifier */
short propvalue; /* if used, the item is from modal map */
short inactive; /* if set, deactivated item */
short maptype; /* keymap editor */
short pad2, pad3;
} wmKeymapItem;
/* flag: inactive, expanded */
short flag;
/* runtime */
short maptype, pad[2]; /* keymap editor */
struct PointerRNA *ptr; /* rna pointer to access properties */
} wmKeyMapItem;
/* wmKeyMapItem.flag */
#define KMI_INACTIVE 1
#define KMI_EXPANDED 2
/* stored in WM, the actively used keymaps */
typedef struct wmKeyMap {
struct wmKeyMap *next, *prev;
ListBase keymap;
ListBase items;
char nameid[64]; /* global editor keymaps, or for more per space/region */
char idname[64]; /* global editor keymaps, or for more per space/region */
short spaceid; /* same IDs as in DNA_space_types.h */
short regionid; /* see above */
short is_modal; /* modal map, not using operatornames */
short flag; /* general flags */
short pad;
void *items; /* struct EnumPropertyItem for now */
/* verify if the keymap is enabled in the current context */
int (*poll)(struct bContext *);
/* runtime */
int (*poll)(struct bContext *); /* verify if enabled in the current context */
void *modal_items; /* for modal, EnumPropertyItem for now */
} wmKeyMap;
/* wmKeyMap.flag */
#define KEYMAP_MODAL 1 /* modal map, not using operatornames */
#define KEYMAP_USER 2 /* user created keymap */
typedef struct wmKeyConfig {
struct wmKeyConfig *next, *prev;
char idname[64]; /* unique name */
char basename[64]; /* idname of configuration this is derives from, "" if none */
ListBase keymaps;
int actkeymap, flag;
} wmKeyConfig;
/* wmKeyConfig.flag */
#define KEYCONF_TWOBUTTONMOUSE (1 << 1)
#define KEYCONF_LMOUSESELECT (1 << 2)
#define KEYCONF_NONUMPAD (1 << 3)
/* this one is the operator itself, stored in files for macros etc */
/* operator + operatortype should be able to redo entirely, but for different contextes */

@ -56,6 +56,7 @@ extern StructRNA RNA_Area;
extern StructRNA RNA_AreaLamp;
extern StructRNA RNA_Armature;
extern StructRNA RNA_ArmatureModifier;
extern StructRNA RNA_ArmatureSensor;
extern StructRNA RNA_ArrayModifier;
extern StructRNA RNA_BackgroundImage;
extern StructRNA RNA_BevelModifier;
@ -76,6 +77,7 @@ extern StructRNA RNA_BoneGroup;
extern StructRNA RNA_BooleanModifier;
extern StructRNA RNA_BooleanProperty;
extern StructRNA RNA_Brush;
extern StructRNA RNA_BrushTextureSlot;
extern StructRNA RNA_BuildModifier;
extern StructRNA RNA_Camera;
extern StructRNA RNA_CastModifier;
@ -99,7 +101,8 @@ extern StructRNA RNA_CompositorNodeBilateralblur;
extern StructRNA RNA_CompositorNodeBlur;
extern StructRNA RNA_CompositorNodeBrightContrast;
extern StructRNA RNA_CompositorNodeChannelMatte;
extern StructRNA RNA_CompositorNodeChroma;
extern StructRNA RNA_CompositorNodeChromaMatte;
extern StructRNA RNA_CompositorNodeColorMatte;
extern StructRNA RNA_CompositorNodeColorSpill;
extern StructRNA RNA_CompositorNodeCombHSVA;
extern StructRNA RNA_CompositorNodeCombRGBA;
@ -114,6 +117,7 @@ extern StructRNA RNA_CompositorNodeDefocus;
extern StructRNA RNA_CompositorNodeDiffMatte;
extern StructRNA RNA_CompositorNodeDilateErode;
extern StructRNA RNA_CompositorNodeDisplace;
extern StructRNA RNA_CompositorNodeDistanceMatte;
extern StructRNA RNA_CompositorNodeFilter;
extern StructRNA RNA_CompositorNodeFlip;
extern StructRNA RNA_CompositorNodeGamma;
@ -123,6 +127,7 @@ extern StructRNA RNA_CompositorNodeIDMask;
extern StructRNA RNA_CompositorNodeImage;
extern StructRNA RNA_CompositorNodeInvert;
extern StructRNA RNA_CompositorNodeLensdist;
extern StructRNA RNA_CompositorNodeLevels;
extern StructRNA RNA_CompositorNodeLumaMatte;
extern StructRNA RNA_CompositorNodeMapUV;
extern StructRNA RNA_CompositorNodeMapValue;
@ -174,9 +179,11 @@ extern StructRNA RNA_DistortedNoiseTexture;
extern StructRNA RNA_DomainFluidSettings;
extern StructRNA RNA_Driver;
extern StructRNA RNA_DriverTarget;
extern StructRNA RNA_DupliObject;
extern StructRNA RNA_EdgeSplitModifier;
extern StructRNA RNA_EditBone;
extern StructRNA RNA_EffectSequence;
extern StructRNA RNA_EffectorWeights;
extern StructRNA RNA_EnumProperty;
extern StructRNA RNA_EnumPropertyItem;
extern StructRNA RNA_EnvironmentMap;
@ -204,6 +211,10 @@ extern StructRNA RNA_FluidSettings;
extern StructRNA RNA_FluidSimulationModifier;
extern StructRNA RNA_FollowPathConstraint;
extern StructRNA RNA_Function;
extern StructRNA RNA_GPencilFrame;
extern StructRNA RNA_GPencilLayer;
extern StructRNA RNA_GPencilStroke;
extern StructRNA RNA_GPencilStrokePoint;
extern StructRNA RNA_GameBooleanProperty;
extern StructRNA RNA_GameFloatProperty;
extern StructRNA RNA_GameIntProperty;
@ -214,10 +225,6 @@ extern StructRNA RNA_GameStringProperty;
extern StructRNA RNA_GameTimerProperty;
extern StructRNA RNA_GlowSequence;
extern StructRNA RNA_GreasePencil;
extern StructRNA RNA_GPencilLayer;
extern StructRNA RNA_GPencilFrame;
extern StructRNA RNA_GPencilStroke;
extern StructRNA RNA_GPencilStrokePoint;
extern StructRNA RNA_Group;
extern StructRNA RNA_Header;
extern StructRNA RNA_HemiLamp;
@ -225,6 +232,7 @@ extern StructRNA RNA_HookModifier;
extern StructRNA RNA_ID;
extern StructRNA RNA_IDProperty;
extern StructRNA RNA_IDPropertyGroup;
extern StructRNA RNA_IKParam;
extern StructRNA RNA_Image;
extern StructRNA RNA_ImagePaint;
extern StructRNA RNA_ImageSequence;
@ -232,8 +240,12 @@ extern StructRNA RNA_ImageTexture;
extern StructRNA RNA_ImageUser;
extern StructRNA RNA_InflowFluidSettings;
extern StructRNA RNA_IntProperty;
extern StructRNA RNA_Itasc;
extern StructRNA RNA_JoystickSensor;
extern StructRNA RNA_Key;
extern StructRNA RNA_KeyConfig;
extern StructRNA RNA_KeyMap;
extern StructRNA RNA_KeyMapItem;
extern StructRNA RNA_KeyboardSensor;
extern StructRNA RNA_KeyingSet;
extern StructRNA RNA_KeyingSetPath;
@ -263,6 +275,7 @@ extern StructRNA RNA_MaterialSlot;
extern StructRNA RNA_MaterialStrand;
extern StructRNA RNA_MaterialSubsurfaceScattering;
extern StructRNA RNA_MaterialTextureSlot;
extern StructRNA RNA_MaterialVolume;
extern StructRNA RNA_Menu;
extern StructRNA RNA_Mesh;
extern StructRNA RNA_MeshColor;
@ -313,6 +326,7 @@ extern StructRNA RNA_Paint;
extern StructRNA RNA_Panel;
extern StructRNA RNA_Particle;
extern StructRNA RNA_ParticleBrush;
extern StructRNA RNA_ParticleDupliWeight;
extern StructRNA RNA_ParticleEdit;
extern StructRNA RNA_ParticleFluidSettings;
extern StructRNA RNA_ParticleHairKey;
@ -327,13 +341,12 @@ extern StructRNA RNA_PluginTexture;
extern StructRNA RNA_PointCache;
extern StructRNA RNA_PointDensity;
extern StructRNA RNA_PointDensityTexture;
extern StructRNA RNA_PointerProperty;
extern StructRNA RNA_PointLamp;
extern StructRNA RNA_PointerProperty;
extern StructRNA RNA_Pose;
extern StructRNA RNA_PoseChannel;
extern StructRNA RNA_Property;
extern StructRNA RNA_PropertySensor;
extern StructRNA RNA_ArmatureSensor;
extern StructRNA RNA_PythonConstraint;
extern StructRNA RNA_PythonController;
extern StructRNA RNA_RadarSensor;
@ -344,7 +357,6 @@ extern StructRNA RNA_RenderEngine;
extern StructRNA RNA_RenderLayer;
extern StructRNA RNA_RenderPass;
extern StructRNA RNA_RenderResult;
extern StructRNA RNA_RenderValue;
extern StructRNA RNA_RigidBodyJointConstraint;
extern StructRNA RNA_Scene;
extern StructRNA RNA_SceneGameData;
@ -492,12 +504,12 @@ extern StructRNA RNA_TransformSequence;
extern StructRNA RNA_UILayout;
extern StructRNA RNA_UIListItem;
extern StructRNA RNA_UVProjectModifier;
extern StructRNA RNA_UVProjector;
extern StructRNA RNA_UnitSettings;
extern StructRNA RNA_UnknownType;
extern StructRNA RNA_UserPreferences;
extern StructRNA RNA_UserPreferencesEdit;
extern StructRNA RNA_UserPreferencesFilePaths;
extern StructRNA RNA_UserPreferencesLanguage;
extern StructRNA RNA_UserPreferencesSystem;
extern StructRNA RNA_UserPreferencesView;
extern StructRNA RNA_UserSolidLight;

@ -142,6 +142,9 @@ typedef enum PropertyFlag {
/* icon */
PROP_ICONS_CONSECUTIVE = 4096,
/* hidden in the user interface */
PROP_HIDDEN = 524288,
/* function paramater flags */
PROP_REQUIRED = 4,
PROP_RETURN = 8,

@ -2785,7 +2785,10 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name)
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
if(prop) {
return (rna_idproperty_find(ptr, name) != NULL);
if(prop->flag & PROP_IDPROPERTY)
return (rna_idproperty_find(ptr, name) != NULL);
else
return 1;
}
else {
// printf("RNA_property_is_set: %s.%s not found.\n", ptr->type->identifier, name);

@ -667,6 +667,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
}
prop= RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_ui_text(prop, "RNA", "RNA type definition.");
if(DefRNA.preprocess) {

@ -203,7 +203,9 @@ void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
void RNA_api_action(StructRNA *srna);
void RNA_api_image(struct StructRNA *srna);
void RNA_api_keyconfig(struct StructRNA *srna);
void RNA_api_keyingset(struct StructRNA *srna);
void RNA_api_keymap(struct StructRNA *srna);
void RNA_api_main(struct StructRNA *srna);
void RNA_api_material(StructRNA *srna);
void RNA_api_mesh(struct StructRNA *srna);
@ -213,7 +215,6 @@ void RNA_api_text(struct StructRNA *srna);
void RNA_api_ui_layout(struct StructRNA *srna);
void RNA_api_wm(struct StructRNA *srna);
/* ID Properties */
extern StringPropertyRNA rna_IDProperty_string;

@ -37,7 +37,7 @@
#ifdef RNA_RUNTIME
static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only)
static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only, int event, int full_event)
{
int flag= 0;
@ -45,6 +45,8 @@ static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr,
flag |= (expand)? UI_ITEM_R_EXPAND: 0;
flag |= (toggle)? UI_ITEM_R_TOGGLE: 0;
flag |= (icon_only)? UI_ITEM_R_ICON_ONLY: 0;
flag |= (event)? UI_ITEM_R_EVENT: 0;
flag |= (full_event)? UI_ITEM_R_FULL_EVENT: 0;
uiItemR(layout, name, icon, ptr, propname, flag);
}
@ -147,6 +149,8 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values.");
RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values.");
RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text.");
RNA_def_boolean(func, "event", 0, "", "Use button to input key events.");
RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers.");
func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR");
api_ui_item_rna_common(func);

@ -1977,68 +1977,68 @@ static void rna_def_userdef_system(BlenderRNA *brna)
StructRNA *srna;
static EnumPropertyItem gl_texture_clamp_items[] = {
{0, "GL_CLAMP_OFF", 0, "Off", ""},
{8192, "GL_CLAMP_8192", 0, "8192", ""},
{4096, "GL_CLAMP_4096", 0, "4096", ""},
{2048, "GL_CLAMP_2048", 0, "2048", ""},
{1024, "GL_CLAMP_1024", 0, "1024", ""},
{512, "GL_CLAMP_512", 0, "512", ""},
{256, "GL_CLAMP_256", 0, "256", ""},
{128, "GL_CLAMP_128", 0, "128", ""},
{0, "CLAMP_OFF", 0, "Off", ""},
{8192, "CLAMP_8192", 0, "8192", ""},
{4096, "CLAMP_4096", 0, "4096", ""},
{2048, "CLAMP_2048", 0, "2048", ""},
{1024, "CLAMP_1024", 0, "1024", ""},
{512, "CLAMP_512", 0, "512", ""},
{256, "CLAMP_256", 0, "256", ""},
{128, "CLAMP_128", 0, "128", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem audio_mixing_samples_items[] = {
{256, "AUDIO_SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
{512, "AUDIO_SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
{1024, "AUDIO_SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
{2048, "AUDIO_SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
{4096, "AUDIO_SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
{8192, "AUDIO_SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
{16384, "AUDIO_SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
{32768, "AUDIO_SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
{256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
{512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
{1024, "SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
{2048, "SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
{4096, "SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
{8192, "SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
{16384, "SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
{32768, "SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem audio_device_items[] = {
{0, "AUDIO_DEVICE_NULL", 0, "No Audio", "Null device - there will be no audio output."},
{0, "NONE", 0, "None", "Null device - there will be no audio output."},
#ifdef WITH_SDL
{1, "AUDIO_DEVICE_SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage."},
{1, "SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage."},
#endif
#ifdef WITH_OPENAL
{2, "AUDIO_DEVICE_OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage."},
{2, "OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage."},
#endif
#ifdef WITH_JACK
{3, "AUDIO_DEVICE_JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users."},
{3, "JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users."},
#endif
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem audio_rate_items[] = {
// {8000, "AUDIO_RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second."},
// {11025, "AUDIO_RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second."},
// {16000, "AUDIO_RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second."},
// {22050, "AUDIO_RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second."},
// {32000, "AUDIO_RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second."},
{44100, "AUDIO_RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second."},
{48000, "AUDIO_RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second."},
// {88200, "AUDIO_RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second."},
{96000, "AUDIO_RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second."},
{192000, "AUDIO_RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second."},
// {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second."},
// {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second."},
// {16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second."},
// {22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second."},
// {32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second."},
{44100, "RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second."},
{48000, "RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second."},
// {88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second."},
{96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second."},
{192000, "RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second."},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem audio_format_items[] = {
{0x01, "AUDIO_FORMAT_U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer."},
{0x12, "AUDIO_FORMAT_S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer."},
{0x13, "AUDIO_FORMAT_S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer."},
{0x14, "AUDIO_FORMAT_S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer."},
{0x24, "AUDIO_FORMAT_FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float."},
{0x28, "AUDIO_FORMAT_DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float."},
{0x01, "U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer."},
{0x12, "S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer."},
{0x13, "S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer."},
{0x14, "S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer."},
{0x24, "FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float."},
{0x28, "DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float."},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem audio_channel_items[] = {
{1, "AUDIO_CHANNELS_MONO", 0, "Mono", "Set audio channels to mono."},
{2, "AUDIO_CHANNELS_STEREO", 0, "Stereo", "Set audio channels to stereo."},
{4, "AUDIO_CHANNELS_SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels."},
{6, "AUDIO_CHANNELS_SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound."},
{8, "AUDIO_CHANNELS_SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound."},
{1, "MONO", 0, "Mono", "Set audio channels to mono."},
{2, "STEREO", 0, "Stereo", "Set audio channels to stereo."},
{4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels."},
{6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound."},
{8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound."},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem draw_method_items[] = {
@ -2340,11 +2340,12 @@ void RNA_def_userdef(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem user_pref_sections[] = {
{0, "VIEW_CONTROLS", 0, "View", ""},
{1, "EDIT_METHODS", 0, "Editing", ""},
{2, "FILE_PATHS", 0, "File", ""},
{3, "SYSTEM_OPENGL", 0, "System", ""},
// {4, "THEMES", 0, "Themes", ""}, // Leave this out until we figure out a way to manage themes in the prefs.
{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
{USER_SECTION_EDIT, "EDITING", 0, "Editing", ""},
{USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
// {USER_SECTION_THEME, "THEMES", 0, "Themes", ""}, // Leave this out until we figure out a way to manage themes in the prefs.
{USER_SECTION_FILE, "FILES", 0, "File", ""},
{USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
{0, NULL, 0, NULL, NULL}};
rna_def_userdef_dothemes(brna);
@ -2358,6 +2359,7 @@ void RNA_def_userdef(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "userpref");
RNA_def_property_enum_items(prop, user_pref_sections);
RNA_def_property_ui_text(prop, "Active Section", "Active section of the user preferences shown in the user interface.");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "themes", NULL);

@ -24,14 +24,37 @@
#include <stdlib.h>
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_types.h"
#include "rna_internal.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "WM_types.h" /* wmEvent */
#include "WM_types.h"
EnumPropertyItem event_keymouse_value_items[] = {
{KM_ANY, "ANY", 0, "Any", ""},
{KM_PRESS, "PRESS", 0, "Press", ""},
{KM_RELEASE, "RELEASE", 0, "Release", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_tweak_value_items[]= {
{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", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_value_items[] = {
{KM_ANY, "ANY", 0, "Any", ""},
@ -40,9 +63,43 @@ EnumPropertyItem event_value_items[] = {
{KM_RELEASE, "RELEASE", 0, "Release", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_tweak_type_items[]= {
{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", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_mouse_type_items[]= {
{LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
{BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
{ACTIONMOUSE, "ACTIONMOUSE", 0, "Action", ""},
{SELECTMOUSE, "SELECTMOUSE", 0, "Select", ""},
{0, "", 0, NULL, NULL},
{MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
{0, "", 0, NULL, NULL},
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_timer_type_items[]= {
{TIMER, "TIMER", 0, "Timer", ""},
{TIMER0, "TIMER0", 0, "Timer 0", ""},
{TIMER1, "TIMER1", 0, "Timer 1", ""},
{TIMER2, "TIMER2", 0, "Timer 2", ""},
{TIMERJOBS, "JOBS_TIMER", 0, "Jobs Timer", ""},
{0, NULL, 0, NULL, NULL}};
/* not returned: CAPSLOCKKEY, UNKNOWNKEY, GRLESSKEY */
EnumPropertyItem event_type_items[] = {
{0, "NONE", 0, "", ""},
{LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", ""},
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", ""},
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", ""},
@ -50,20 +107,20 @@ EnumPropertyItem event_type_items[] = {
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", ""},
{ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", ""},
{SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""},
{0, "", 0, NULL, NULL},
{MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""},
{0, "", 0, NULL, NULL},
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
{0, "", 0, NULL, NULL},
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", ""},
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", ""},
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", ""},
{EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Tweak Action", ""},
{EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Tweak Select", ""},
{0, "", 0, NULL, NULL},
{AKEY, "A", 0, "A", ""},
{BKEY, "B", 0, "B", ""},
{CKEY, "C", 0, "C", ""},
@ -90,7 +147,7 @@ EnumPropertyItem event_type_items[] = {
{XKEY, "X", 0, "X", ""},
{YKEY, "Y", 0, "Y", ""},
{ZKEY, "Z", 0, "Z", ""},
{0, "", 0, NULL, NULL},
{ZEROKEY, "ZERO", 0, "0", ""},
{ONEKEY, "ONE", 0, "1", ""},
{TWOKEY, "TWO", 0, "2", ""},
@ -101,16 +158,16 @@ EnumPropertyItem event_type_items[] = {
{SEVENKEY, "SEVEN", 0, "7", ""},
{EIGHTKEY, "EIGHT", 0, "8", ""},
{NINEKEY, "NINE", 0, "9", ""},
{0, "", 0, NULL, NULL},
{LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", ""},
{LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", ""},
{LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", ""},
{RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", ""},
{RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", ""},
{RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", ""},
{0, "", 0, NULL, NULL},
{COMMANDKEY, "COMMAND", 0, "Command", ""},
{0, "", 0, NULL, NULL},
{ESCKEY, "ESC", 0, "Esc", ""},
{TABKEY, "TAB", 0, "Tab", ""},
{RETKEY, "RET", 0, "Return", ""},
@ -167,8 +224,20 @@ EnumPropertyItem event_type_items[] = {
{PAGEUPKEY, "PAGE_UP", 0, "Page Up", ""},
{PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""},
{ENDKEY, "END", 0, "End", ""},
{0, "", 0, NULL, NULL},
{TIMER, "TIMER", 0, "Timer", ""},
{TIMER0, "TIMER0", 0, "Timer 0", ""},
{TIMER1, "TIMER1", 0, "Timer 1", ""},
{TIMER2, "TIMER2", 0, "Timer 2", ""},
{TIMERJOBS, "JOBS_TIMER", 0, "Jobs Timer", ""},
{0, NULL, 0, NULL, NULL}};
#define KMI_TYPE_KEYBOARD 0
#define KMI_TYPE_MOUSE 1
#define KMI_TYPE_TWEAK 2
#define KMI_TYPE_TEXTINPUT 3
#define KMI_TYPE_TIMER 4
#ifdef RNA_RUNTIME
#include "WM_api.h"
@ -263,6 +332,156 @@ static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
}
}
static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
{
wmKeyMapItem *kmi= ptr->data;
if(kmi->ptr)
return *(kmi->ptr);
//return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties);
return PointerRNA_NULL;
}
static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
{
wmKeyMapItem *kmi= ptr->data;
if(ISTIMER(kmi->type)) return KMI_TYPE_TIMER;
if(ISKEYBOARD(kmi->type)) return KMI_TYPE_KEYBOARD;
if(ISTWEAK(kmi->type)) return KMI_TYPE_TWEAK;
if(ISMOUSE(kmi->type)) return KMI_TYPE_MOUSE;
if(kmi->type == KM_TEXTINPUT) return KMI_TYPE_TEXTINPUT;
return KMI_TYPE_KEYBOARD;
}
static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
{
wmKeyMapItem *kmi= ptr->data;
int map_type= rna_wmKeyMapItem_map_type_get(ptr);
if(value != map_type) {
switch(value) {
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;
}
}
}
static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
int map_type= rna_wmKeyMapItem_map_type_get(ptr);
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;
else return event_type_items;
}
static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr, int *free)
{
int map_type= rna_wmKeyMapItem_map_type_get(ptr);
if(map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD) return event_keymouse_value_items;
if(map_type == KMI_TYPE_TWEAK) return event_tweak_value_items;
else return event_value_items;
}
static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
{
wmWindowManager *wm= ptr->data;
wmKeyConfig *kc;
for(kc=wm->keyconfigs.first; kc; kc=kc->next)
if(strcmp(kc->idname, U.keyconfigstr) == 0)
break;
if(!kc)
kc= wm->defaultconf;
return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
}
static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
{
wmKeyConfig *kc= value.data;
if(kc)
BLI_strncpy(U.keyconfigstr, kc->idname, sizeof(U.keyconfigstr));
}
static PointerRNA rna_WindowManager_active_keymap_get(PointerRNA *ptr)
{
wmWindowManager *wm= ptr->data;
wmKeyMap *km= NULL;
if(wm->defaultconf) {
km= BLI_findlink(&wm->defaultconf->keymaps, wm->defaultactmap);
if(!km)
km= wm->defaultconf->keymaps.first;
}
return rna_pointer_inherit_refine(ptr, &RNA_KeyMap, WM_keymap_active(wm, km));
}
static void rna_WindowManager_active_keymap_set(PointerRNA *ptr, PointerRNA value)
{
wmWindowManager *wm= ptr->data;
wmKeyMap *km= value.data;
int index;
if(wm->defaultconf && km) {
km= WM_keymap_find(wm->defaultconf, km->idname, km->spaceid, km->regionid);
index= BLI_findindex(&wm->defaultconf->keymaps, km);
if(index != -1) wm->defaultactmap= index;
else wm->defaultactmap= 0;
}
}
static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
{
wmKeyMapItem *kmi= ptr->data;
WM_operator_py_idname(value, kmi->idname);
}
static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
{
wmKeyMapItem *kmi= ptr->data;
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)
{
wmKeyMapItem *kmi= ptr->data;
char idname[OP_MAX_TYPENAME];
WM_operator_bl_idname(idname, value);
BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
}
#else
static void rna_def_operator(BlenderRNA *brna)
@ -434,9 +653,154 @@ static void rna_def_windowmanager(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Window");
RNA_def_property_ui_text(prop, "Windows", "Open windows.");
prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyConfig");
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations.");
prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "KeyConfig");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0);
RNA_def_property_ui_text(prop, "Active Key Configuration", "");
prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
RNA_def_property_struct_type(prop, "KeyConfig");
RNA_def_property_ui_text(prop, "Default Key Configuration", "");
prop= RNA_def_property(srna, "active_keymap", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "KeyMap");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keymap_get", "rna_WindowManager_active_keymap_set", 0);
RNA_def_property_ui_text(prop, "Active Key Map", "");
RNA_api_wm(srna);
}
static void rna_def_keyconfig(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop, *parm;
static EnumPropertyItem map_type_items[] = {
{KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
{KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
{KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
{KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
{KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
{0, NULL, 0, NULL, NULL}};
/* KeyConfig */
srna= RNA_def_struct(brna, "KeyConfig", NULL);
RNA_def_struct_sdna(srna, "wmKeyConfig");
RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps.");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
RNA_def_property_ui_text(prop, "Name", "Name of the key configuration.");
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyMap");
RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration.");
RNA_api_keyconfig(srna);
/* KeyMap */
srna= RNA_def_struct(brna, "KeyMap", NULL);
RNA_def_struct_sdna(srna, "wmKeyMap");
RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps.");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
RNA_def_property_ui_text(prop, "Name", "Name of the key map.");
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spaceid");
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with.");
prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "regionid");
RNA_def_property_enum_items(prop, region_type_items);
RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with.");
prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyMapItem");
RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event.");
prop= RNA_def_property(srna, "user_defined", PROP_BOOLEAN, PROP_NEVER_NULL);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER);
RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user.");
RNA_api_keymap(srna);
/* KeyMapItem */
srna= RNA_def_struct(brna, "KeyMapItem", NULL);
RNA_def_struct_sdna(srna, "wmKeyMapItem");
RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map.");
prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event.");
RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set");
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "OperatorProperties");
RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called.");
prop= RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
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);
RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping.");
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
RNA_def_property_ui_text(prop, "Type", "Type of event.");
prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "val");
RNA_def_property_enum_items(prop, event_value_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
RNA_def_property_ui_text(prop, "Value", "");
prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
RNA_def_property_ui_text(prop, "Shift", "Shift key pressed.");
prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed.");
prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
RNA_def_property_ui_text(prop, "Alt", "Alt key pressed.");
prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed.");
prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier.");
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
RNA_def_property_ui_text(prop, "Expanded", "Expanded in the user interface.");
prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item.");
}
void RNA_def_wm(BlenderRNA *brna)
{
rna_def_operator(brna);
@ -445,6 +809,7 @@ void RNA_def_wm(BlenderRNA *brna)
rna_def_event(brna);
rna_def_window(brna);
rna_def_windowmanager(brna);
rna_def_keyconfig(brna);
}
#endif

@ -31,25 +31,93 @@
#include "RNA_define.h"
#include "RNA_types.h"
#include "RNA_enum_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#ifdef RNA_RUNTIME
#include "BKE_context.h"
#include "WM_api.h"
#include "WM_types.h"
static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, char *idname, int type, int value, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
int modifier= 0;
if(shift) modifier |= KM_SHIFT;
if(ctrl) modifier |= KM_CTRL;
if(alt) modifier |= KM_ALT;
if(oskey) modifier |= KM_OSKEY;
return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
}
#else
void RNA_api_wm(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *prop;
PropertyRNA *parm;
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.");
prop= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
RNA_def_property_flag(prop, PROP_REQUIRED);
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);
}
void RNA_api_keyconfig(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *parm;
func= RNA_def_function(srna, "add_keymap", "WM_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", "Added key map.");
RNA_def_function_return(func, parm);
}
void RNA_api_keymap(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *parm;
func= RNA_def_function(srna, "add_item", "rna_KeyMap_add_item");
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);
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, "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");
}
#endif

@ -433,7 +433,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
{
PointerRNA newptr;
newptr= RNA_property_pointer_get(ptr, prop);
if (newptr.data) {
if (newptr.type) {
ret = pyrna_struct_CreatePyObject(&newptr);
} else {
ret = Py_None;
@ -1153,6 +1153,31 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA * self, PyObject *ar
return PyBool_FromLong( insert_keyframe((ID *)self->ptr.data, NULL, NULL, path, index, cfra, 0));
}
static PyObject *pyrna_struct_is_property_set(BPy_StructRNA * self, PyObject *args)
{
char *name;
if (!PyArg_ParseTuple(args, "s:is_property_set", &name))
return NULL;
return PyBool_FromLong(RNA_property_is_set(&self->ptr, name));
}
static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA * self, PyObject *args)
{
PropertyRNA *prop;
char *name;
int hidden;
if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name))
return NULL;
prop= RNA_struct_find_property(&self->ptr, name);
hidden= (prop)? (RNA_property_flag(prop) & PROP_HIDDEN): 1;
return PyBool_FromLong(hidden);
}
static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
{
@ -1272,7 +1297,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA * self, PyObject *pyname )
CTX_data_get(self->ptr.data, name, &newptr, &newlb);
if (newptr.data) {
if (newptr.type) {
ret = pyrna_struct_CreatePyObject(&newptr);
}
else if (newlb.first) {
@ -1745,6 +1770,8 @@ static struct PyMethodDef pyrna_struct_methods[] = {
/* maybe this become and ID function */
{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, NULL},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, NULL},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}

@ -82,22 +82,30 @@ void WM_timecursor (struct wmWindow *win, int nr);
void *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), void (*draw)(struct bContext *C, int, int, void *customdata), void *customdata);
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
/* keymap */
/* keyconfig and keymap */
wmKeyConfig *WM_keyconfig_add (struct wmWindowManager *wm, char *idname);
void WM_keyconfig_free (struct wmKeyConfig *keyconf);
void WM_keyconfig_userdef(struct wmWindowManager *wm);
void WM_keymap_init (struct bContext *C);
wmKeymapItem *WM_keymap_verify_item(wmKeyMap *keymap, char *idname, short type,
short val, int modifier, short keymodifier);
wmKeymapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, short type,
short val, int modifier, short keymodifier);
void WM_keymap_tweak (wmKeyMap *keymap, short type, short val, int modifier, short keymodifier);
wmKeyMap *WM_keymap_find (struct wmWindowManager *wm, const char *nameid,
short spaceid, short regionid);
void WM_keymap_free (struct wmKeyMap *keymap);
wmKeyMap *WM_modalkeymap_add(struct wmWindowManager *wm, const char *nameid, struct EnumPropertyItem *items);
wmKeyMap *WM_modalkeymap_get(struct wmWindowManager *wm, const char *nameid);
void WM_modalkeymap_add_item(wmKeyMap *km, short type, short val, int modifier, short keymodifier, short value);
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname);
wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, char *idname, int type,
int val, int modifier, int keymodifier);
wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type,
int val, int modifier, int keymodifier);
void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
int WM_key_event_is_tweak(short type);
wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, char *idname, int spaceid, int regionid);
wmKeyMap *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
wmKeyMap *WM_keymap_copy_to_user(struct wmKeyMap *keymap);
void WM_keymap_restore_to_default(struct wmKeyMap *keymap);
wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, char *idname, struct EnumPropertyItem *items);
wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, char *idname);
void WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
void WM_modalkeymap_assign(struct wmKeyMap *km, char *opname);
const char *WM_key_event_string(short type);
char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, char *str, int len);

Some files were not shown because too many files have changed in this diff Show More