diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-17 06:20:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-17 06:20:23 +0400 |
commit | bbe69705a52386ca5b6552d7187b0492b4b2b378 (patch) | |
tree | 48fb3e4b70c78b2a31f1c6a0a02e33b09b0113f5 /source/blender/editors | |
parent | 0e0d88605f0ce7422f278c399b913d394bc7f3ca (diff) | |
parent | 67b2985cceaf789e1b77d4f70864bf67ee9375c3 (diff) |
svn merge ^/trunk/blender -r43420:43436
Diffstat (limited to 'source/blender/editors')
32 files changed, 510 insertions, 344 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a21c394a81e..a7c37d371e5 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2424,20 +2424,21 @@ void ED_operatortypes_animchannels(void) void ED_keymap_animchannels(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation Channels", 0, 0); - + wmKeyMapItem *kmi; + /* selection */ /* click-select */ // XXX for now, only leftmouse.... WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "children_only", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "children_only", TRUE); /* rename */ WM_keymap_add_item(keymap, "ANIM_OT_channels_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); /* deselect all */ WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", AKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", TRUE); /* borderselect */ WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0); @@ -2459,9 +2460,11 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "all", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 0); - + kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "all", FALSE); + kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "all", FALSE); + /* rearranging */ RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "direction", REARRANGE_ANIMCHAN_UP); RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "direction", REARRANGE_ANIMCHAN_DOWN); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index e17aea3f8f3..216bb8d0e08 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1490,7 +1490,8 @@ void ED_marker_keymap(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_S, KM_ANY, 0, 0); WM_keymap_verify_item(keymap, "MARKER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_verify_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); #ifdef DURIAN_CAMERA_SWITCH kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 54314980e03..84206c4275e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1200,7 +1200,7 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED( else { /* just call the exec() on the active keyingset */ RNA_enum_set(op->ptr, "type", 0); - RNA_boolean_set(op->ptr, "confirm_success", 1); + RNA_boolean_set(op->ptr, "confirm_success", TRUE); return op->type->exec(C, op); } diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 29cdf6a61f7..7379a278d01 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -182,7 +182,7 @@ void ED_operatormacros_armature(void) if(ot) { ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); - RNA_boolean_set(otmacro->ptr, "forked", 0); + RNA_boolean_set(otmacro->ptr, "forked", FALSE); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); } @@ -193,7 +193,7 @@ void ED_operatormacros_armature(void) if(ot) { ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); - RNA_boolean_set(otmacro->ptr, "forked", 1); + RNA_boolean_set(otmacro->ptr, "forked", TRUE); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); } diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 60fca7ae4bd..b213f797d47 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -145,14 +145,14 @@ void ED_operatormacros_curve(void) WM_operatortype_macro_define(ot, "CURVE_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Extrude curve and move result"; WM_operatortype_macro_define(ot, "CURVE_OT_extrude"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); } void ED_keymap_curve(wmKeyConfig *keyconf) @@ -210,7 +210,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "FONT_OT_line_break", RETKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "FONT_OT_text_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last! - RNA_boolean_set(WM_keymap_add_item(keymap, "FONT_OT_text_insert", BACKSPACEKEY, KM_PRESS, KM_ALT, 0)->ptr, "accent", 1); // accented characters + kmi = WM_keymap_add_item(keymap, "FONT_OT_text_insert", BACKSPACEKEY, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "accent", TRUE); /* accented characters */ /* only set in editmode curve, by space_view3d listener */ keymap= WM_keymap_find(keyconf, "Curve", 0, 0); @@ -231,8 +232,11 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); + + kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "deselect", FALSE); + kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "deselect", TRUE); WM_keymap_add_item(keymap, "CURVE_OT_separate", PKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_extrude_move", EKEY, KM_PRESS, 0, 0); @@ -248,8 +252,10 @@ void ED_keymap_curve(wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN); WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a01efa25d19..c8c57c12088 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -320,7 +320,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) int len= RNA_property_array_length(ptr, prop); if(!shift) { - RNA_property_boolean_set_index(ptr, prop, index, 1); + RNA_property_boolean_set_index(ptr, prop, index, TRUE); for(i=0; i<len; i++) if(i != index) @@ -2783,7 +2783,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add"); RNA_string_set(&op_ptr, "operator", op->type->idname); - RNA_boolean_set(&op_ptr, "remove_active", 1); + RNA_boolean_set(&op_ptr, "remove_active", TRUE); op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 9cf93980c2c..730254bba79 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1957,10 +1957,10 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) tot= RNA_property_array_length(&but->rnapoin, but->rnaprop); /* Normally clicking only selects one layer */ - RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, 1); + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, TRUE); for(i = 0; i < tot; ++i) { if(i != cur) - RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, 0); + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, FALSE); } } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 2959d525cfb..234b2733bd3 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1689,7 +1689,8 @@ void UI_view2d_operatortypes(void) void UI_view2d_keymap(wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "View2D", 0, 0); - + wmKeyMapItem *kmi; + /* scrollers */ WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", MIDDLEMOUSE, KM_PRESS, 0, 0); @@ -1750,8 +1751,10 @@ void UI_view2d_keymap(wmKeyConfig *keyconf) 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); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "page", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "page", 1); + kmi = WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "page", TRUE); + kmi = WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "page", TRUE); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MOUSEZOOM, 0, 0, 0); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index ffceaf1c698..1e14fcdd580 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -201,35 +201,35 @@ void ED_operatormacros_mesh(void) WM_operatortype_macro_define(ot, "MESH_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Rip polygons and move the result"; WM_operatortype_macro_define(ot, "MESH_OT_rip"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Extrude region and move result"; otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_region"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Extrude faces and move result"; otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Extrude edges and move result"; otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Extrude vertices and move result"; @@ -237,7 +237,7 @@ void ED_operatormacros_mesh(void) RNA_enum_set(otmacro->ptr, "type", 4); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); - RNA_boolean_set(otmacro->ptr, "mirror", 0); + RNA_boolean_set(otmacro->ptr, "mirror", FALSE); } /* note mesh keymap also for other space? */ diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index 4c69bb3e559..c7635bcf2cc 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -37,6 +37,8 @@ #include "ED_mball.h" #include "ED_screen.h" +#include "BLI_utildefines.h" + #include "mball_intern.h" void ED_operatortypes_metaball(void) @@ -62,8 +64,10 @@ void ED_keymap_metaball(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MBALL_OT_reveal_metaelems", HKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 536b2f70c31..70a1aa73fc9 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -486,7 +486,7 @@ static int object_camera_add_exec(bContext *C, wmOperator *op) float loc[3], rot[3]; /* force view align for cameras */ - RNA_boolean_set(op->ptr, "view_align", 1); + RNA_boolean_set(op->ptr, "view_align", TRUE); object_add_generic_invoke_options(C, op); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index eba4dd1878a..542b75e1f19 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -236,7 +236,7 @@ void ED_operatormacros_object(void) if(ot) { ot->description = "Duplicate selected objects and move them"; otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); - RNA_boolean_set(otmacro->ptr, "linked", 1); + RNA_boolean_set(otmacro->ptr, "linked", TRUE); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); } diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index ebd3dc6617d..473ed50b5e2 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -96,20 +96,27 @@ static void keymap_particle(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Particle", 0, 0); keymap->poll= PE_poll; - WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); + + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "deselect", FALSE); + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "deselect", TRUE); WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0); RNA_boolean_set(kmi->ptr, "release_confirm", TRUE); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 6bb3b2ca7f8..13383445c93 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -272,8 +272,8 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) /* ensure we have a 3d view */ if(!ED_view3d_context_activate(C)) { - RNA_boolean_set(op->ptr, "view_context", 0); - is_view_context= 0; + RNA_boolean_set(op->ptr, "view_context", FALSE); + is_view_context = 0; } /* only one render job at a time */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a3874c9f28a..e18851893bd 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3490,7 +3490,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) { ListBase *lb; wmKeyMap *keymap; - //wmKeyMapItem *kmi; + wmKeyMapItem *kmi; /* Screen Editing ------------------------------------------------ */ keymap= WM_keymap_find(keyconf, "Screen Editing", 0, 0); @@ -3557,7 +3557,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* render */ WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, KM_CTRL, 0)->ptr, "animation", 1); + kmi = WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "animation", TRUE); WM_keymap_add_item(keymap, "RENDER_OT_view_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "RENDER_OT_view_show", F11KEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "RENDER_OT_play_rendered_anim", F11KEY, KM_PRESS, KM_CTRL, 0); @@ -3581,20 +3582,21 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", FALSE); WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", FALSE); WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0)->ptr, "next", 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "next", FALSE); /* play (forward and backwards) */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", TRUE); WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 2a0ebb8316d..d4578e17b3d 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -583,8 +583,10 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINT_OT_vert_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "deselect", 1); + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "deselect", FALSE); + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "deselect", TRUE); WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0); /* Image/Texture Paint mode */ @@ -609,8 +611,10 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINT_OT_face_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); WM_keymap_add_item(keymap, "PAINT_OT_face_select_reveal", HKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 45c7043c44c..06dd96603ef 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -999,5 +999,5 @@ void ED_operatormacros_clip(void) ot->description = "Add new marker and slide it with mouse until mouse button release"; WM_operatortype_macro_define(ot, "CLIP_OT_add_marker"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); - RNA_boolean_set(otmacro->ptr, "release_confirm", 1); + RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index b2527fbe4e0..3d584378135 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -463,10 +463,14 @@ static void clip_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CLIP_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0); /* selection */ - WM_keymap_add_item(keymap, "CLIP_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "CLIP_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); - WM_keymap_add_item(keymap, "CLIP_OT_select_all", AKEY, KM_PRESS, 0, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "CLIP_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); WM_keymap_add_item(keymap, "CLIP_OT_select_border", BKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CLIP_OT_select_circle", CKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "CLIP_MT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0); @@ -530,8 +534,10 @@ static void clip_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CLIP_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0); /* selection */ - WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); /* delete */ WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 1a2541cbc90..3df8e98be3a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -293,7 +293,8 @@ static void console_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR); RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR); - RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", 1); + kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "reverse", TRUE); WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0); /* diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index aa245585d11..aba58098563 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -383,7 +383,8 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "GRAPH_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); /* F-Modifiers */ - RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "only_active", 0); + kmi = WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "only_active", FALSE); /* animation module */ /* channels list diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index f173a3d3835..55831de876c 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -169,17 +169,23 @@ void nla_operatortypes(void) static void nla_keymap_channels(wmKeyMap *keymap) { + wmKeyMapItem *kmi; + /* NLA-specific (different to standard channels keymap) -------------------------- */ /* selection */ /* click-select */ // XXX for now, only leftmouse.... - WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); /* channel operations */ /* add tracks */ - WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "above_selected", 1); + kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "above_selected", FALSE); + kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "above_selected", TRUE); /* delete tracks */ WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", XKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index b71776f4266..508021540b5 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -114,8 +114,10 @@ void ED_operatormacros_node(void) /* modified operator call for duplicating with input links */ ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Duplicate selected nodes keeping input links and move them"; + mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); - RNA_boolean_set(mot->ptr, "keep_inputs", 1); + RNA_boolean_set(mot->ptr, "keep_inputs", TRUE); + WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO); @@ -144,11 +146,12 @@ void node_keymap(struct wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "extend", FALSE); kmi = WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "extend", FALSE); - kmi= WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); - kmi= WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(WM_keymap_add_item(keymap, "NODE_OT_select_border", EVT_TWEAK_S, KM_ANY, 0, 0)->ptr, "tweak", 1); + kmi = WM_keymap_add_item(keymap, "NODE_OT_select_border", EVT_TWEAK_S, KM_ANY, 0, 0); + RNA_boolean_set(kmi->ptr, "tweak", TRUE); /* each of these falls through if not handled... */ WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0); @@ -163,10 +166,12 @@ void node_keymap(struct wmKeyConfig *keyconf) kmi= WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, KM_ALT, 0); RNA_float_set(kmi->ptr, "factor", 1.2f); WM_keymap_add_item(keymap, "NODE_OT_backimage_sample", ACTIONMOUSE, KM_PRESS, KM_ALT, 0); - - WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, KM_CTRL, 0)->ptr, "replace", 1); - + + kmi = WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "replace", FALSE); + kmi = WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "replace", TRUE); + WM_keymap_add_menu(keymap, "NODE_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "NODE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); /* modified operator call for duplicating with input links */ @@ -180,7 +185,10 @@ void node_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "NODE_OT_show_cyclic_dependencies", CKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0); + + kmi = WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "tweak", FALSE); + WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index 0d3f2e85414..a424520c76f 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -38,6 +38,7 @@ #include "RNA_access.h" +#include "BLI_utildefines.h" #include "outliner_intern.h" @@ -80,14 +81,19 @@ void outliner_operatortypes(void) void outliner_keymap(wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0); + wmKeyMapItem *kmi; WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0); + + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, 0, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, 0, 0)->ptr, "extend", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0)->ptr, "extend", 1); - - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0)->ptr, "all", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", 1); + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "all", FALSE); + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "all", TRUE); WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_operation", RIGHTMOUSE, KM_PRESS, 0, 0); @@ -98,10 +104,12 @@ void outliner_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEDOWNKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "up", 1); + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "up", TRUE); WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */ - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */ + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "open", FALSE); /* close */ WM_keymap_verify_item(keymap, "OUTLINER_OT_selected_toggle", AKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "OUTLINER_OT_expanded_toggle", AKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 56c2e0ee4d1..c46a1eebc2e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3034,10 +3034,10 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN /* set default display depending on seq type */ if(seq->type == SEQ_IMAGE) { - RNA_boolean_set(op->ptr, "filter_movie", 0); + RNA_boolean_set(op->ptr, "filter_movie", FALSE); } else { - RNA_boolean_set(op->ptr, "filter_image", 0); + RNA_boolean_set(op->ptr, "filter_image", FALSE); } WM_event_add_fileselect(C, op); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 986aab8fa61..ec9f8bb36d9 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -136,9 +136,11 @@ void sequencer_keymap(wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", SEL_INVERT); - - RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_CUT_SOFT); - RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_CUT_HARD); + + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0); + RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "unselected", FALSE); @@ -212,8 +214,10 @@ void sequencer_keymap(wmKeyConfig *keyconf) /* 2.4x method, now use Alt for handles and select the side based on which handle was selected */ /* - RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "linked_left", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "linked_right", 1); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "linked_left", TRUE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "linked_right", TRUE); kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0); RNA_boolean_set(kmi->ptr, "linked_left", TRUE); @@ -263,8 +267,10 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); WM_keymap_add_item(keymap, "SEQUENCER_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 441a5eab976..314afeac0e6 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -298,8 +298,10 @@ static void text_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0); - if(U.uiflag & USER_MMB_PASTE) // XXX not dynamic - RNA_boolean_set(WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0)->ptr, "selection", 1); + if(U.uiflag & USER_MMB_PASTE) { // XXX not dynamic + kmi = WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "selection", TRUE); + } WM_keymap_add_item(keymap, "TEXT_OT_jump", JKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_find", GKEY, KM_PRESS, KM_CTRL, 0); @@ -307,8 +309,10 @@ static void text_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_replace", HKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "TEXT_OT_to_3d_object", MKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "TEXT_OT_to_3d_object", MKEY, KM_PRESS, KM_CTRL, 0)->ptr, "split_lines", 1); + kmi = WM_keymap_add_item(keymap, "TEXT_OT_to_3d_object", MKEY, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "split_lines", FALSE); + kmi = WM_keymap_add_item(keymap, "TEXT_OT_to_3d_object", MKEY, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "split_lines", TRUE); WM_keymap_add_item(keymap, "TEXT_OT_select_all", AKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); @@ -364,7 +368,8 @@ static void text_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "TEXT_OT_scroll", MOUSEPAN, 0, 0, 0); WM_keymap_add_item(keymap, "TEXT_OT_selection_set", EVT_TWEAK_L, KM_ANY, 0, 0); WM_keymap_add_item(keymap, "TEXT_OT_cursor_set", LEFTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "TEXT_OT_selection_set", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select", 1); + kmi = WM_keymap_add_item(keymap, "TEXT_OT_selection_set", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "select", TRUE); RNA_int_set(WM_keymap_add_item(keymap, "TEXT_OT_scroll", WHEELUPMOUSE, KM_PRESS, 0, 0)->ptr, "lines", -1); RNA_int_set(WM_keymap_add_item(keymap, "TEXT_OT_scroll", WHEELDOWNMOUSE, KM_PRESS, 0, 0)->ptr, "lines", 1); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 25b9c2f2864..8a78f236fea 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -72,7 +72,7 @@ static void text_font_end(SpaceText *UNUSED(st)) { } -static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str) +static int text_font_draw(SpaceText *UNUSED(st), int x, int y, const char *str) { BLF_position(mono, x, y, 0); BLF_draw(mono, str, BLF_DRAW_STR_DUMMY_MAX); @@ -92,19 +92,28 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c) return st->cwidth; } -int text_font_width(SpaceText *UNUSED(st), const char *str) +static int text_font_draw_character_utf8(SpaceText *st, int x, int y, const char *c) { - return BLF_width(mono, str); + char str[BLI_UTF8_MAX+1]; + size_t len = BLI_str_utf8_size(c); + memcpy(str, c, len); + str[len]= '\0'; + + BLF_position(mono, x, y, 0); + BLF_draw(mono, str, len); + + return st->cwidth; } /****************** flatten string **********************/ -static void flatten_string_append(FlattenString *fs, char c, int accum) +static void flatten_string_append(FlattenString *fs, const char *c, int accum, int len) { - if(fs->pos>=fs->len && fs->pos>=sizeof(fs->fixedbuf)-1) { + int i; + + if(fs->pos+len > fs->len) { char *nbuf; int *naccum; - if(fs->len) fs->len*= 2; - else fs->len= sizeof(fs->fixedbuf) * 2; + fs->len*= 2; nbuf= MEM_callocN(sizeof(*fs->buf)*fs->len, "fs->buf"); naccum= MEM_callocN(sizeof(*fs->accum)*fs->len, "fs->accum"); @@ -121,35 +130,45 @@ static void flatten_string_append(FlattenString *fs, char c, int accum) fs->accum= naccum; } - fs->buf[fs->pos]= c; - fs->accum[fs->pos]= accum; - - fs->pos++; + for (i = 0; i < len; i++) + { + fs->buf[fs->pos+i]= c[i]; + fs->accum[fs->pos+i]= accum; + } + + fs->pos+= len; } int flatten_string(SpaceText *st, FlattenString *fs, const char *in) { - int r = 0, i = 0; + int r, i, total = 0; memset(fs, 0, sizeof(FlattenString)); fs->buf= fs->fixedbuf; fs->accum= fs->fixedaccum; - - for(r=0, i=0; *in; r++, in++) { - if(*in=='\t') { - if(fs->pos && *(in-1)=='\t') - i= st->tabnumber; - else if(st->tabnumber > 0) - i= st->tabnumber - (fs->pos%st->tabnumber); + fs->len = sizeof(fs->fixedbuf); + for(r = 0, i = 0; *in; r++) { + if(*in=='\t') { + i= st->tabnumber - (total%st->tabnumber); + total+= i; + while(i--) - flatten_string_append(fs, ' ', r); + flatten_string_append(fs, " ", r, 1); + + in++; + } + else { + size_t len= BLI_str_utf8_size(in); + flatten_string_append(fs, in, r, len); + in += len; + total++; } - else - flatten_string_append(fs, *in, r); } + + flatten_string_append(fs, "\0", r, 1); - return fs->pos; + return total; } void flatten_string_free(FlattenString *fs) @@ -304,9 +323,8 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) } else orig = 0xFF; - flatten_string(st, &fs, line->line); + len = flatten_string(st, &fs, line->line); str = fs.buf; - len = strlen(str); if(!text_check_format_len(line, len)) { flatten_string_free(&fs); return; @@ -318,7 +336,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) if(*str == '\\') { *fmt = prev; fmt++; str++; if(*str == '\0') break; - *fmt = prev; fmt++; str++; + *fmt = prev; fmt++; str += BLI_str_utf8_size(str); continue; } /* Handle continuations */ @@ -339,14 +357,16 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) } *fmt = 'l'; + str += BLI_str_utf8_size(str) - 1; } /* Not in a string... */ else { /* Deal with comments first */ - if(prev == '#' || *str == '#') + if(prev == '#' || *str == '#') { *fmt = '#'; - /* Strings */ - else if(*str == '"' || *str == '\'') { + str += BLI_str_utf8_size(str) - 1; + } else if(*str == '"' || *str == '\'') { + /* Strings */ find = *str; cont = (*str== '"') ? TXT_DBLQUOTSTR : TXT_SNGQUOTSTR; if(*(str+1) == find && *(str+2) == find) { @@ -371,14 +391,18 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) } *fmt = 'n'; } - else + else { + str += BLI_str_utf8_size(str) - 1; *fmt = 'q'; + } /* Punctuation */ else if(text_check_delim(*str)) *fmt = '!'; /* Identifiers and other text (no previous ws. or delims. so text continues) */ - else if(prev == 'q') + else if(prev == 'q') { + str += BLI_str_utf8_size(str) - 1; *fmt = 'q'; + } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { /* Special vars(v) or built-in keywords(b) */ @@ -395,8 +419,10 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) } *fmt = prev; } - else + else { + str += BLI_str_utf8_size(str) - 1; *fmt = 'q'; + } } } prev = *fmt; @@ -408,14 +434,11 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) *fmt = '\0'; fmt++; *fmt = cont; - /* Debugging */ - //print_format(st, line); - /* If continuation has changed and we're allowed, process the next line */ if(cont!=orig && do_next && line->next) { txt_format_line(st, line->next, do_next); } - + flatten_string_free(&fs); } @@ -539,13 +562,14 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * } max= wrap_width(st, ar); + cursin = txt_utf8_offset_to_index(linein->line, cursin); while(linep) { start= 0; end= max; chop= 1; *offc= 0; - for(i=0, j=0; linep->line[j]!='\0'; j++) { + for(i=0, j=0; linep->line[j]; j+=BLI_str_utf8_size(linep->line+j)) { int chars; /* Mimic replacement of tabs */ @@ -591,6 +615,7 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * } } +/* cursin - mem, offc - view */ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc) { int i, j, start, end, chars, max, chop; @@ -607,8 +632,9 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi end= max; chop= 1; *offc= 0; + cursin = txt_utf8_offset_to_index(linein->line, cursin); - for(i=0, j=0; linein->line[j]!='\0'; j++) { + for(i=0, j=0; linein->line[j]; j += BLI_str_utf8_size(linein->line + j)) { /* Mimic replacement of tabs */ ch= linein->line[j]; @@ -653,7 +679,7 @@ int text_get_char_pos(SpaceText *st, const char *line, int cur) { int a=0, i; - for(i=0; i<cur && line[i]; i++) { + for(i=0; i<cur && line[i]; i += BLI_str_utf8_size(line + i)) { if(line[i]=='\t') a += st->tabnumber-a%st->tabnumber; else @@ -662,54 +688,65 @@ int text_get_char_pos(SpaceText *st, const char *line, int cur) return a; } -static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format, int skip) +static const char *txt_utf8_get_nth(const char *str, int n) +{ + int pos= 0; + while (str[pos] && n--) { + pos+= BLI_str_utf8_size(str + pos); + } + return str + pos; +} + +static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w, const char *format, int skip) { FlattenString fs; - int basex, i, a, len, start, end, max, lines; + int basex, i, a, start, end, max, lines; /* view */ + int mi, ma, mstart, mend; /* mem */ - len= flatten_string(st, &fs, str); + flatten_string(st, &fs, str); str= fs.buf; max= w/st->cwidth; if(max<8) max= 8; basex= x; - lines= 1; - start= 0; - end= max; - for(i=0; i<len; i++) { + + start= 0; mstart= 0; + end= max; mend= txt_utf8_get_nth(str, max) - str; + + for(i=0, mi=0; str[mi]; i++, mi+=BLI_str_utf8_size(str+mi)) { if(i-start >= max) { /* skip hidden part of line */ if(skip) { skip--; - start= end; - end += max; + start= end; mstart= mend; + end += max; mend= txt_utf8_get_nth(str+mend, max) - str; continue; } /* Draw the visible portion of text on the overshot line */ - for(a=start; a<end; a++) { + for(a=start, ma=mstart; a<end; a++, ma+=BLI_str_utf8_size(str+ma)) { if(st->showsyntax && format) format_draw_color(format[a]); - x += text_font_draw_character(st, x, y, str[a]); + x += text_font_draw_character_utf8(st, x, y, str + ma); } y -= st->lheight; x= basex; lines++; - start= end; - end += max; + start= end; mstart= mend; + end += max; mend= txt_utf8_get_nth(str+mend, max) - str; if(y<=0) break; } - else if(str[i]==' ' || str[i]=='-') { - end = i+1; + else if(str[mi]==' ' || str[mi]=='-') { + end = i+1; mend = mi+1; } } /* Draw the remaining text */ - for(a=start; a<len && y > 0; a++) { + for(a=start, ma=mstart; str[ma] && y > 0; a++, ma+=BLI_str_utf8_size(str+ma)) { if(st->showsyntax && format) format_draw_color(format[a]); - x += text_font_draw_character(st, x, y, str[a]); + x += text_font_draw_character_utf8(st, x, y, str+ma); } flatten_string_free(&fs); @@ -717,45 +754,36 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char return lines; } -static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format) +static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, const char *format) { FlattenString fs; - int r=0, w= 0, amount; - int *acc; - char *in; + int *acc, r=0; + const char *in; - w= flatten_string(st, &fs, str); + int w= flatten_string(st, &fs, str); if(w < cshift) { flatten_string_free(&fs); return 0; /* String is shorter than shift */ } - in= fs.buf+cshift; + in= txt_utf8_get_nth(fs.buf, cshift); acc= fs.accum+cshift; w= w-cshift; if(draw) { + int amount = maxwidth ? MIN2(w, maxwidth) : w; + if(st->showsyntax && format) { - int a; + int a, str_shift= 0; format = format+cshift; - - amount = strlen(in); - if(maxwidth) - amount= MIN2(amount, maxwidth); - + for(a = 0; a < amount; a++) { format_draw_color(format[a]); - x += text_font_draw_character(st, x, y, in[a]); + x += text_font_draw_character_utf8(st, x, y, in + str_shift); + str_shift += BLI_str_utf8_size(in + str_shift); } } - else { - amount = strlen(in); - if(maxwidth) - amount= MIN2(amount, maxwidth); - - in[amount]= 0; - text_font_draw(st, x, y, in); - } + else text_font_draw(st, x, y, in); } else { while(w-- && *acc++ < maxwidth) @@ -976,8 +1004,8 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str) max= wrap_width(st, ar); lines= 1; start= 0; - end= max; - for(i= 0, j= 0; str[j] != '\0'; j++) { + end= max; + for(i= 0, j= 0; str[j]; j+=BLI_str_utf8_size(str+j)) { /* Mimic replacement of tabs */ ch= str[j]; if(ch=='\t') { @@ -1421,7 +1449,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) BLI_strncpy(str, item->name, SUGG_LIST_WIDTH); - w = text_font_width(st, str); + w = BLF_width(mono, str); if(item == sel) { UI_ThemeColor(TH_SHADE2); @@ -1496,8 +1524,6 @@ static void draw_cursor(SpaceText *st, ARegion *ar) glRecti(x-4, y, ar->winx, y-st->lheight), y-=st->lheight; glRecti(x-4, y, x+toc*st->cwidth, y-st->lheight); y-=st->lheight; - - (void)y; } } else { @@ -1569,8 +1595,9 @@ static void draw_brackets(SpaceText *st, ARegion *ar) { TextLine *startl, *endl, *linep; Text *text = st->text; - int b, c, startc, endc, find, stack; - int viewc, viewl, offl, offc, x, y; + int b, fc, find, stack, viewc, viewl, offl, offc, x, y; + int startc, endc, c; + char ch; // showsyntax must be on or else the format string will be null @@ -1584,21 +1611,23 @@ static void draw_brackets(SpaceText *st, ARegion *ar) linep= startl; c= startc; + fc= txt_utf8_offset_to_index(linep->line, startc); endl= NULL; endc= -1; find= -b; stack= 0; /* Dont highlight backets if syntax HL is off or bracket in string or comment. */ - if(!linep->format || linep->format[c] == 'l' || linep->format[c] == '#') + if(!linep->format || linep->format[fc] == 'l' || linep->format[fc] == '#') return; if(b>0) { /* opening bracket, search forward for close */ - c++; + fc++; + c+= BLI_str_utf8_size(linep->line+c); while(linep) { while(c<linep->len) { - if(linep->format && linep->format[c] != 'l' && linep->format[c] != '#') { + if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') { b= text_check_bracket(linep->line[c]); if(b==find) { if(stack==0) { @@ -1612,19 +1641,22 @@ static void draw_brackets(SpaceText *st, ARegion *ar) stack++; } } - c++; + fc++; + c+= BLI_str_utf8_size(linep->line+c); } if(endl) break; linep= linep->next; c= 0; + fc= 0; } } else { /* closing bracket, search backward for open */ - c--; + fc--; + if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c); while(linep) { - while(c>=0) { - if(linep->format && linep->format[c] != 'l' && linep->format[c] != '#') { + while(fc>=0) { + if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') { b= text_check_bracket(linep->line[c]); if(b==find) { if(stack==0) { @@ -1638,11 +1670,17 @@ static void draw_brackets(SpaceText *st, ARegion *ar) stack++; } } - c--; + fc--; + if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c); } if(endl) break; linep= linep->prev; - if(linep) c= linep->len-1; + if(linep) { + if (linep->format) fc= strlen(linep->format)-1; + else fc= -1; + if (linep->len) c= BLI_str_prev_char_utf8(linep->line+linep->len)-linep->line; + else fc= -1; + } } } diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 62cd4fedf0e..043fb97547b 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -47,9 +47,6 @@ struct wmWindowManager; /* text_draw.c */ void draw_text_main(struct SpaceText *st, struct ARegion *ar); -int text_font_width_character(struct SpaceText *st); -int text_font_width(struct SpaceText *st, const char *str); - void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 19f0c9bba61..eab06474546 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1420,7 +1420,7 @@ static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int end= max; chop= loop= 1; - for(i=0, j=0; loop; j++) { + for(i=0, j=0; loop; j+=BLI_str_utf8_size(linein->line+j)) { int chars; /* Mimic replacement of tabs */ ch= linein->line[j]; @@ -1595,7 +1595,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) chop= loop= 1; *charp= 0; - for(i=0, j=0; loop; j++) { + for(i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) { int chars; /* Mimic replacement of tabs */ ch= (*linep)->line[j]; @@ -1610,7 +1610,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) *charp= endj; if(j>=oldc) { - if(ch=='\0') *charp= start; + if(ch=='\0') *charp= txt_utf8_index_to_offset((*linep)->line, start); loop= 0; break; } @@ -1623,7 +1623,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) } else if(ch==' ' || ch=='-' || ch=='\0') { if(j>=oldc) { - *charp= start; + *charp= txt_utf8_index_to_offset((*linep)->line, start); loop= 0; break; } @@ -1663,7 +1663,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel) chop= loop= 1; *charp= 0; - for(i=0, j=0; loop; j++) { + for(i=0, j=0; loop; j+=BLI_str_utf8_size((*linep)->line+j)) { int chars; /* Mimic replacement of tabs */ ch= (*linep)->line[j]; @@ -1675,7 +1675,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel) while(chars--) { if(i-start>=max) { - if(chop) endj= j-1; + if(chop) endj= BLI_str_prev_char_utf8((*linep)->line+j)-(*linep)->line; if(endj>=oldc) { if(ch=='\0') *charp= (*linep)->len; @@ -2364,148 +2364,183 @@ typedef struct SetSelection { short old[2]; } SetSelection; -static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) +static int flatten_len(SpaceText *st, const char *str) { - FlattenString fs; - Text *text= st->text; - TextLine **linep; - int *charp; - int w; - - text_update_character_width(st); + int i, total = 0; - if(sel) { linep= &text->sell; charp= &text->selc; } - else { linep= &text->curl; charp= &text->curc; } + for(i = 0; str[i]; i += BLI_str_utf8_size(str+i)) { + if(str[i]=='\t') { + total += st->tabnumber - total%st->tabnumber; + } + else total++; + } - y= (ar->winy - 2 - y)/st->lheight; - - if(st->showlinenrs) - x-= TXT_OFFSET+TEXTXLOC; - else - x-= TXT_OFFSET; + return total; +} - if(x<0) x= 0; - x = (x/st->cwidth) + st->left; +static int flatten_index_to_offset(SpaceText *st, const char *str, int index) +{ + int i, j; + for (i= 0, j= 0; i < index; j += BLI_str_utf8_size(str+j)) + if(str[j]=='\t') + i += st->tabnumber - i%st->tabnumber; + else + i++; - if(st->wordwrap) { - int i, j, endj, curs, max, chop, start, end, loop, found; - char ch; - - /* Point to first visible line */ - *linep= text->lines.first; - i= st->top; - while(i>0 && *linep) { - int lines= text_get_visible_lines(st, ar, (*linep)->line); + return j; +} - if (i-lines<0) { - y+= i; - break; - } else { - *linep= (*linep)->next; - i-= lines; - } +static TextLine *get_first_visible_line(SpaceText *st, ARegion *ar, int *y) +{ + TextLine *linep = st->text->lines.first; + int i; + for (i = st->top; i > 0 && linep; ) { + int lines = text_get_visible_lines(st, ar, linep->line); + + if (i-lines < 0) { + *y += i; + break; + } else { + linep = linep->next; + i -= lines; } + } + return linep; +} - max= wrap_width(st, ar); - - loop= 1; - found= 0; - while(loop && *linep) { - start= 0; - end= max; - chop= 1; - curs= 0; - endj= 0; - for(i=0, j=0; loop; j++) { - int chars; - - /* Mimic replacement of tabs */ - ch= (*linep)->line[j]; - if(ch=='\t') { - chars= st->tabnumber-i%st->tabnumber; - ch= ' '; - } - else - chars= 1; - - while(chars--) { - /* Gone too far, go back to last wrap point */ - if(y<0) { - *charp= endj; - loop= 0; - break; +static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, int y, int sel) +{ + Text *text = st->text; + int max = wrap_width(st, ar); /* view */ + int charp; /* mem */ + int loop = 1, found = 0; /* flags */ + char ch; + + /* Point to first visible line */ + TextLine *linep = get_first_visible_line(st, ar, &y); + + while(loop && linep) { + int i = 0, start = 0, end = max; /* view */ + int j = 0, curs = 0, endj = 0; /* mem */ + int chop = 1; /* flags */ + + for (; loop; j += BLI_str_utf8_size(linep->line+j)) { + int chars; + + /* Mimic replacement of tabs */ + ch = linep->line[j]; + if(ch == '\t') { + chars = st->tabnumber - i%st->tabnumber; + ch = ' '; + } + else chars = 1; + + while (chars--) { + /* Gone too far, go back to last wrap point */ + if (y < 0) { + charp = endj; + loop = 0; + break; /* Exactly at the cursor */ - } - else if(y==0 && i-start==x) { - /* current position could be wrapped to next line */ - /* this should be checked when end of current line would be reached */ - *charp= curs= j; - found= 1; + } + else if (y == 0 && i-start == x) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ + charp = curs= j; + found = 1; /* Prepare curs for next wrap */ + } + else if(i - end == x) { + curs = j; + } + if (i - start >= max) { + if (found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if (charp > endj && !chop && ch!='\0') charp = endj; + loop = 0; + break; } - else if(i-end==x) { - curs= j; + + if(chop) endj = j; + start = end; + end += max; + + if(j < linep->len) + y--; + + chop = 1; + if (y == 0 && i-start >= x) { + charp = curs; + loop = 0; + break; } - if(i-start>=max) { - if(found) { - /* exact cursor position was found, check if it's */ - /* still on needed line (hasn't been wrapped) */ - if(*charp>endj && !chop && ch!='\0') (*charp)= endj; - loop= 0; - break; - } - - if(chop) endj= j; - start= end; - end += max; - - if(j<(*linep)->len) - y--; - - chop= 1; - if(y==0 && i-start>=x) { - *charp= curs; - loop= 0; - break; - } + } + else if (ch == ' ' || ch == '-' || ch == '\0') { + if (found) { + loop = 0; + break; } - else if(ch==' ' || ch=='-' || ch=='\0') { - if(found) { - loop= 0; - break; - } - - if(y==0 && i-start>=x) { - *charp= curs; - loop= 0; - break; - } - end = i+1; - endj = j; - chop= 0; + + if(y == 0 && i-start >= x) { + charp = curs; + loop = 0; + break; } - i++; + end = i + 1; + endj = j; + chop = 0; } - if(ch=='\0') break; + i++; } - if(!loop || found) break; + + if(ch == '\0') break; + } + + if(!loop || found) break; + + if(!linep->next) { + charp = linep->len; + break; + } + + /* On correct line but didn't meet cursor, must be at end */ + if (y == 0) { + charp = linep->len; + break; + } + linep = linep->next; + + y--; + } + + if(sel) { text->sell = linep; text->selc = charp; } + else { text->curl = linep; text->curc = charp; } +} - if(!(*linep)->next) { - *charp= (*linep)->len; - break; - } +static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) +{ + Text *text= st->text; + text_update_character_width(st); + y= (ar->winy - 2 - y)/st->lheight; - /* On correct line but didn't meet cursor, must be at end */ - if(y==0) { - *charp= (*linep)->len; - break; - } - *linep= (*linep)->next; - y--; - } + if(st->showlinenrs) x-= TXT_OFFSET+TEXTXLOC; + else x-= TXT_OFFSET; + if(x<0) x= 0; + x = (x/st->cwidth) + st->left; + + if(st->wordwrap) { + text_cursor_set_to_pos_wrapped(st, ar, x, y, sel); } else { + TextLine **linep; + int *charp; + int w; + + if(sel) { linep= &text->sell; charp= &text->selc; } + else { linep= &text->curl; charp= &text->curc; } + y-= txt_get_span(text->lines.first, *linep) - st->top; if(y>0) { @@ -2516,10 +2551,9 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int } - w= flatten_string(st, &fs, (*linep)->line); - if(x<w) *charp= fs.accum[x]; + w= flatten_len(st, (*linep)->line); + if(x<w) *charp= flatten_index_to_offset(st, (*linep)->line, x); else *charp= (*linep)->len; - flatten_string_free(&fs); } if(!sel) txt_pop_sel(text); } @@ -2762,19 +2796,23 @@ static int text_insert_exec(bContext *C, wmOperator *op) SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); char *str; - int done = 0, i; + int done = 0; + size_t i = 0; + unsigned int code; text_drawcache_tag_update(st, 0); str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); if(st && st->overwrite) { - for(i=0; str[i]; i++) { - done |= txt_replace_char(text, str[i]); + while (str[i]) { + code = BLI_str_utf8_as_unicode_step(str, &i); + done |= txt_replace_char(text, code); } } else { - for(i=0; str[i]; i++) { - done |= txt_add_char(text, str[i]); + while (str[i]) { + code = BLI_str_utf8_as_unicode_step(str, &i); + done |= txt_add_char(text, code); } } @@ -2802,9 +2840,17 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } else { - char str[2]; - str[0]= event->ascii; - str[1]= '\0'; + char str[BLI_UTF8_MAX+1]; + size_t len; + + if (event->utf8_buf[0]) { + len = BLI_str_utf8_size(event->utf8_buf); + memcpy(str, event->utf8_buf, len); + } else { + /* in theory, ghost can set value to extended ascii here */ + len = BLI_str_utf8_from_unicode(event->ascii, str); + } + str[len]= '\0'; RNA_string_set(op->ptr, "text", str); } } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 597adcf4193..060e59265e0 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -231,7 +231,7 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; if(event->shift) - RNA_boolean_set(op->ptr, "extend", 1); + RNA_boolean_set(op->ptr, "extend", TRUE); if(event->alt) { int nr= RNA_int_get(op->ptr, "nr") + 10; diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 22470fe930d..759f3edf20f 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -160,8 +160,11 @@ void view3d_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */ - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0); /* only without camera view */ - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1); + + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */ + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "center", TRUE); /* numpad view hotkeys*/ RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index f2c720ff4dc..a11d5935e22 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3511,8 +3511,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "extend", TRUE); /* border/circle selection */ - WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "pinned", 1); + kmi = WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "pinned", FALSE); + kmi = WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "pinned", TRUE); + WM_keymap_add_item(keymap, "UV_OT_circle_select", CKEY, KM_PRESS, 0, 0); /* selection manipulation */ @@ -3522,16 +3525,21 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE); WM_keymap_add_item(keymap, "UV_OT_unlink_selected", LKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "UV_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + kmi = WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); + kmi = WM_keymap_add_item(keymap, "UV_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, 0, 0); /* uv operations */ WM_keymap_add_item(keymap, "UV_OT_stitch", VKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "UV_OT_pin", PKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_pin", PKEY, KM_PRESS, KM_ALT, 0)->ptr, "clear", 1); + kmi = WM_keymap_add_item(keymap, "UV_OT_pin", PKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "clear", FALSE); + kmi = WM_keymap_add_item(keymap, "UV_OT_pin", PKEY, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "clear", TRUE); /* unwrap */ WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0); @@ -3540,8 +3548,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, KM_PRESS, KM_CTRL, 0); /* hide */ - WM_keymap_add_item(keymap, "UV_OT_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "UV_OT_hide", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "UV_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); + WM_keymap_add_item(keymap, "UV_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); /* cursor */ |