2011-02-23 10:52:22 +00:00
/*
2009-08-16 19:50:00 +00:00
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2010-02-12 13:34:04 +00:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2009-08-16 19:50:00 +00:00
*
* * * * * * END GPL LICENSE BLOCK * * * * *
*/
2011-02-27 20:29:51 +00:00
/** \file blender/editors/sculpt_paint/paint_ops.c
* \ ingroup edsculpt
*/
2011-05-12 01:57:47 +00:00
# include "MEM_guardedalloc.h"
2011-02-27 20:29:51 +00:00
2011-05-12 01:57:47 +00:00
# include <stdlib.h>
# include "BLI_string.h"
2011-01-07 18:36:47 +00:00
# include "BLI_utildefines.h"
2009-08-17 02:49:31 +00:00
# include "DNA_object_types.h"
2009-08-16 19:50:00 +00:00
# include "DNA_scene_types.h"
2011-04-01 06:14:39 +00:00
# include "DNA_brush_types.h"
2009-08-16 19:50:00 +00:00
# include "BKE_brush.h"
# include "BKE_context.h"
# include "BKE_paint.h"
2011-04-01 06:14:39 +00:00
# include "BKE_main.h"
2009-02-19 23:53:40 +00:00
2011-02-14 17:55:27 +00:00
# include "ED_sculpt.h"
2009-10-22 12:59:14 +00:00
# include "ED_screen.h"
2009-08-17 02:49:31 +00:00
# include "UI_resources.h"
2009-02-19 23:53:40 +00:00
# include "WM_api.h"
# include "WM_types.h"
2009-08-16 19:50:00 +00:00
# include "RNA_access.h"
# include "RNA_define.h"
2011-04-01 06:14:39 +00:00
# include "RNA_enum_types.h"
2009-08-16 19:50:00 +00:00
2009-02-19 23:53:40 +00:00
# include "paint_intern.h"
2009-09-18 15:48:49 +00:00
# include "sculpt_intern.h"
2009-02-19 23:53:40 +00:00
2009-08-16 19:50:00 +00:00
# include <string.h>
2010-07-14 14:11:03 +00:00
//#include <stdio.h>
2011-04-01 06:14:39 +00:00
# include <stddef.h>
2009-08-16 19:50:00 +00:00
/* Brush operators */
2010-10-15 01:36:14 +00:00
static int brush_add_exec ( bContext * C , wmOperator * UNUSED ( op ) )
2009-08-16 19:50:00 +00:00
{
2009-08-17 15:05:18 +00:00
/*int type = RNA_enum_get(op->ptr, "type");*/
2010-07-14 14:11:03 +00:00
Paint * paint = paint_get_active ( CTX_data_scene ( C ) ) ;
2010-08-04 04:01:27 +00:00
struct Brush * br = paint_brush ( paint ) ;
2009-08-16 19:50:00 +00:00
2010-07-14 14:11:03 +00:00
if ( br )
br = copy_brush ( br ) ;
else
br = add_brush ( " Brush " ) ;
2009-08-17 02:49:31 +00:00
2010-07-14 14:11:03 +00:00
paint_brush_set ( paint_get_active ( CTX_data_scene ( C ) ) , br ) ;
2009-10-22 12:59:14 +00:00
2009-08-16 19:50:00 +00:00
return OPERATOR_FINISHED ;
}
2011-02-14 17:55:27 +00:00
static void BRUSH_OT_add ( wmOperatorType * ot )
2009-08-16 19:50:00 +00:00
{
/* identifiers */
ot - > name = " Add Brush " ;
2010-03-22 09:30:00 +00:00
ot - > description = " Add brush by mode type " ;
2009-08-17 02:49:31 +00:00
ot - > idname = " BRUSH_OT_add " ;
2009-08-16 19:50:00 +00:00
/* api callbacks */
2009-08-17 02:49:31 +00:00
ot - > exec = brush_add_exec ;
2009-08-16 19:50:00 +00:00
/* flags */
2010-07-22 18:56:46 +00:00
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
2010-07-14 14:11:03 +00:00
}
static int brush_scale_size_exec ( bContext * C , wmOperator * op )
{
2010-07-22 18:56:46 +00:00
Paint * paint = paint_get_active ( CTX_data_scene ( C ) ) ;
2010-08-04 04:01:27 +00:00
struct Brush * brush = paint_brush ( paint ) ;
2010-07-22 22:04:07 +00:00
// Object *ob= CTX_data_active_object(C);
2010-07-22 18:56:46 +00:00
float scalar = RNA_float_get ( op - > ptr , " scalar " ) ;
if ( brush ) {
// pixel radius
{
const int old_size = brush_size ( brush ) ;
int size = ( int ) ( scalar * old_size ) ;
2010-07-22 22:04:07 +00:00
if ( old_size = = size ) {
2010-07-22 18:56:46 +00:00
if ( scalar > 1 ) {
size + + ;
}
else if ( scalar < 1 ) {
size - - ;
}
2010-07-22 22:04:07 +00:00
}
2010-07-22 18:56:46 +00:00
CLAMP ( size , 1 , 2000 ) ; // XXX magic number
brush_set_size ( brush , size ) ;
2010-07-14 14:11:03 +00:00
}
2010-07-22 18:56:46 +00:00
// unprojected radius
{
float unprojected_radius = scalar * brush_unprojected_radius ( brush ) ;
2011-03-27 14:59:55 +00:00
if ( unprojected_radius < 0.001f ) // XXX magic number
2010-07-22 18:56:46 +00:00
unprojected_radius = 0.001f ;
brush_set_unprojected_radius ( brush , unprojected_radius ) ;
2010-07-14 14:11:03 +00:00
}
}
return OPERATOR_FINISHED ;
}
2011-02-14 17:55:27 +00:00
static void BRUSH_OT_scale_size ( wmOperatorType * ot )
2010-07-14 14:11:03 +00:00
{
/* identifiers */
ot - > name = " Scale Sculpt/Paint Brush Size " ;
ot - > description = " Change brush size by a scalar " ;
ot - > idname = " BRUSH_OT_scale_size " ;
/* api callbacks */
ot - > exec = brush_scale_size_exec ;
/* flags */
2010-07-22 18:56:46 +00:00
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
2009-08-16 19:50:00 +00:00
2010-07-14 14:11:03 +00:00
RNA_def_float ( ot - > srna , " scalar " , 1 , 0 , 2 , " Scalar " , " Factor to scale brush size by " , 0 , 2 ) ;
2009-08-16 19:50:00 +00:00
}
2010-10-15 01:36:14 +00:00
static int vertex_color_set_exec ( bContext * C , wmOperator * UNUSED ( op ) )
2009-08-22 02:27:37 +00:00
{
Scene * scene = CTX_data_scene ( C ) ;
2009-10-22 12:59:14 +00:00
Object * obact = CTX_data_active_object ( C ) ;
unsigned int paintcol = vpaint_get_current_col ( scene - > toolsettings - > vpaint ) ;
vpaint_fill ( obact , paintcol ) ;
2009-08-22 02:27:37 +00:00
2009-10-22 12:59:14 +00:00
ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; // XXX - should redraw all 3D views
2009-08-22 02:27:37 +00:00
return OPERATOR_FINISHED ;
}
2011-02-14 17:55:27 +00:00
static void PAINT_OT_vertex_color_set ( wmOperatorType * ot )
2009-08-22 02:27:37 +00:00
{
/* identifiers */
ot - > name = " Set Vertex Colors " ;
ot - > idname = " PAINT_OT_vertex_color_set " ;
/* api callbacks */
ot - > exec = vertex_color_set_exec ;
ot - > poll = vertex_paint_mode_poll ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
}
2010-10-15 01:36:14 +00:00
static int brush_reset_exec ( bContext * C , wmOperator * UNUSED ( op ) )
2010-07-27 16:09:02 +00:00
{
Paint * paint = paint_get_active ( CTX_data_scene ( C ) ) ;
2010-08-04 04:01:27 +00:00
struct Brush * brush = paint_brush ( paint ) ;
2010-07-27 16:09:02 +00:00
Object * ob = CTX_data_active_object ( C ) ;
if ( ! ob ) return OPERATOR_CANCELLED ;
if ( ob - > mode & OB_MODE_SCULPT )
brush_reset_sculpt ( brush ) ;
/* TODO: other modes */
return OPERATOR_FINISHED ;
}
2011-02-14 17:55:27 +00:00
static void BRUSH_OT_reset ( wmOperatorType * ot )
2010-07-27 16:09:02 +00:00
{
/* identifiers */
ot - > name = " Reset Brush " ;
ot - > description = " Return brush to defaults based on current tool " ;
ot - > idname = " BRUSH_OT_reset " ;
/* api callbacks */
ot - > exec = brush_reset_exec ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
}
2011-04-01 06:14:39 +00:00
/* generic functions for setting the active brush based on the tool */
static Brush * brush_tool_cycle ( Main * bmain , Brush * brush_orig , const int tool , const size_t tool_offset , const int ob_mode )
{
struct Brush * brush ;
if ( ! brush_orig & & ! ( brush_orig = bmain - > brush . first ) ) {
return NULL ;
}
/* get the next brush with the active tool */
for ( brush = brush_orig - > id . next ? brush_orig - > id . next : bmain - > brush . first ;
brush ! = brush_orig ;
brush = brush - > id . next ? brush - > id . next : bmain - > brush . first )
{
if ( ( brush - > ob_mode & ob_mode ) & &
( * ( ( ( char * ) brush ) + tool_offset ) = = tool )
) {
return brush ;
}
}
return NULL ;
}
static int brush_generic_tool_set ( Main * bmain , Paint * paint , const int tool , const size_t tool_offset , const int ob_mode )
{
struct Brush * brush , * brush_orig = paint_brush ( paint ) ;
brush = brush_tool_cycle ( bmain , brush_orig , tool , tool_offset , ob_mode ) ;
if ( brush ) {
paint_brush_set ( paint , brush ) ;
WM_main_add_notifier ( NC_BRUSH | NA_EDITED , brush ) ;
return OPERATOR_FINISHED ;
}
else {
return OPERATOR_CANCELLED ;
}
}
static int brush_sculpt_tool_set_exec ( bContext * C , wmOperator * op )
{
Main * bmain = CTX_data_main ( C ) ;
Scene * scene = CTX_data_scene ( C ) ;
return brush_generic_tool_set ( bmain , & scene - > toolsettings - > sculpt - > paint , RNA_enum_get ( op - > ptr , " tool " ) , offsetof ( Brush , sculpt_tool ) , OB_MODE_SCULPT ) ;
}
static void BRUSH_OT_sculpt_tool_set ( wmOperatorType * ot )
{
/* identifiers */
ot - > name = " Sculpt Tool Set " ;
ot - > description = " Set the sculpt tool " ;
ot - > idname = " BRUSH_OT_sculpt_tool_set " ;
/* api callbacks */
ot - > exec = brush_sculpt_tool_set_exec ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
/* props */
ot - > prop = RNA_def_enum ( ot - > srna , " tool " , brush_sculpt_tool_items , 0 , " Tool " , " " ) ;
}
static int brush_vertex_tool_set_exec ( bContext * C , wmOperator * op )
{
Main * bmain = CTX_data_main ( C ) ;
Scene * scene = CTX_data_scene ( C ) ;
return brush_generic_tool_set ( bmain , & scene - > toolsettings - > vpaint - > paint , RNA_enum_get ( op - > ptr , " tool " ) , offsetof ( Brush , vertexpaint_tool ) , OB_MODE_VERTEX_PAINT ) ;
}
static void BRUSH_OT_vertex_tool_set ( wmOperatorType * ot )
{
/* identifiers */
ot - > name = " Vertex Paint Tool Set " ;
ot - > description = " Set the vertex paint tool " ;
ot - > idname = " BRUSH_OT_vertex_tool_set " ;
/* api callbacks */
ot - > exec = brush_vertex_tool_set_exec ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
/* props */
ot - > prop = RNA_def_enum ( ot - > srna , " tool " , brush_vertex_tool_items , 0 , " Tool " , " " ) ;
}
static int brush_weight_tool_set_exec ( bContext * C , wmOperator * op )
{
Main * bmain = CTX_data_main ( C ) ;
Scene * scene = CTX_data_scene ( C ) ;
/* vertexpaint_tool is used for weight paint mode */
return brush_generic_tool_set ( bmain , & scene - > toolsettings - > wpaint - > paint , RNA_enum_get ( op - > ptr , " tool " ) , offsetof ( Brush , vertexpaint_tool ) , OB_MODE_WEIGHT_PAINT ) ;
}
static void BRUSH_OT_weight_tool_set ( wmOperatorType * ot )
{
/* identifiers */
ot - > name = " Weight Paint Tool Set " ;
ot - > description = " Set the weight paint tool " ;
ot - > idname = " BRUSH_OT_weight_tool_set " ;
/* api callbacks */
ot - > exec = brush_weight_tool_set_exec ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
/* props */
ot - > prop = RNA_def_enum ( ot - > srna , " tool " , brush_vertex_tool_items , 0 , " Tool " , " " ) ;
}
static int brush_image_tool_set_exec ( bContext * C , wmOperator * op )
{
Main * bmain = CTX_data_main ( C ) ;
Scene * scene = CTX_data_scene ( C ) ;
return brush_generic_tool_set ( bmain , & scene - > toolsettings - > imapaint . paint , RNA_enum_get ( op - > ptr , " tool " ) , offsetof ( Brush , imagepaint_tool ) , OB_MODE_TEXTURE_PAINT ) ;
}
static void BRUSH_OT_image_tool_set ( wmOperatorType * ot )
{
/* identifiers */
ot - > name = " Image Paint Tool Set " ;
ot - > description = " Set the image tool " ;
ot - > idname = " BRUSH_OT_image_tool_set " ;
/* api callbacks */
ot - > exec = brush_image_tool_set_exec ;
/* flags */
ot - > flag = OPTYPE_REGISTER | OPTYPE_UNDO ;
/* props */
ot - > prop = RNA_def_enum ( ot - > srna , " tool " , brush_image_tool_items , 0 , " Tool " , " " ) ;
}
2009-02-19 23:53:40 +00:00
/**************************** registration **********************************/
void ED_operatortypes_paint ( void )
{
2009-08-14 04:45:29 +00:00
/* brush */
2009-08-17 02:49:31 +00:00
WM_operatortype_append ( BRUSH_OT_add ) ;
2010-07-14 14:11:03 +00:00
WM_operatortype_append ( BRUSH_OT_scale_size ) ;
2009-08-14 04:45:29 +00:00
WM_operatortype_append ( BRUSH_OT_curve_preset ) ;
2010-07-27 16:09:02 +00:00
WM_operatortype_append ( BRUSH_OT_reset ) ;
2010-07-14 14:11:03 +00:00
2011-04-01 06:14:39 +00:00
/* note, particle uses a different system, can be added with existing operators in wm.py */
WM_operatortype_append ( BRUSH_OT_sculpt_tool_set ) ;
WM_operatortype_append ( BRUSH_OT_vertex_tool_set ) ;
WM_operatortype_append ( BRUSH_OT_weight_tool_set ) ;
WM_operatortype_append ( BRUSH_OT_image_tool_set ) ;
2009-02-19 23:53:40 +00:00
/* image */
WM_operatortype_append ( PAINT_OT_texture_paint_toggle ) ;
WM_operatortype_append ( PAINT_OT_image_paint ) ;
WM_operatortype_append ( PAINT_OT_sample_color ) ;
WM_operatortype_append ( PAINT_OT_grab_clone ) ;
2009-03-29 02:15:13 +00:00
WM_operatortype_append ( PAINT_OT_clone_cursor_set ) ;
2010-03-06 19:46:21 +00:00
WM_operatortype_append ( PAINT_OT_project_image ) ;
WM_operatortype_append ( PAINT_OT_image_from_view ) ;
2009-02-19 23:53:40 +00:00
/* weight */
WM_operatortype_append ( PAINT_OT_weight_paint_toggle ) ;
WM_operatortype_append ( PAINT_OT_weight_paint ) ;
2009-10-22 12:59:14 +00:00
WM_operatortype_append ( PAINT_OT_weight_set ) ;
2010-01-26 11:11:53 +00:00
WM_operatortype_append ( PAINT_OT_weight_from_bones ) ;
2011-05-25 10:07:59 +00:00
WM_operatortype_append ( PAINT_OT_weight_sample ) ;
WM_operatortype_append ( PAINT_OT_weight_sample_group ) ;
2009-02-19 23:53:40 +00:00
2011-09-18 17:10:28 +00:00
/* vertex selection */
2011-07-12 19:06:06 +00:00
WM_operatortype_append ( PAINT_OT_vert_select_all ) ;
2011-09-18 01:09:18 +00:00
WM_operatortype_append ( PAINT_OT_vert_select_inverse ) ;
2011-07-12 19:06:06 +00:00
2009-02-19 23:53:40 +00:00
/* vertex */
WM_operatortype_append ( PAINT_OT_vertex_paint_toggle ) ;
WM_operatortype_append ( PAINT_OT_vertex_paint ) ;
2009-08-22 02:27:37 +00:00
WM_operatortype_append ( PAINT_OT_vertex_color_set ) ;
2009-10-22 19:17:46 +00:00
/* face-select */
WM_operatortype_append ( PAINT_OT_face_select_linked ) ;
WM_operatortype_append ( PAINT_OT_face_select_linked_pick ) ;
2009-11-29 22:16:29 +00:00
WM_operatortype_append ( PAINT_OT_face_select_all ) ;
2011-02-24 16:04:36 +00:00
WM_operatortype_append ( PAINT_OT_face_select_inverse ) ;
WM_operatortype_append ( PAINT_OT_face_select_hide ) ;
WM_operatortype_append ( PAINT_OT_face_select_reveal ) ;
2009-02-19 23:53:40 +00:00
}
2010-07-14 14:11:03 +00:00
2010-11-10 08:11:58 +00:00
static void ed_keymap_paint_brush_switch ( wmKeyMap * keymap , const char * mode )
2009-11-17 16:04:17 +00:00
{
wmKeyMapItem * kmi ;
2011-04-01 04:22:30 +00:00
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , ONEKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 0 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , TWOKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 1 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , THREEKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 2 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , FOURKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 3 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , FIVEKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 4 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , SIXKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 5 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , SEVENKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 6 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , EIGHTKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 7 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , NINEKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 8 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , ZEROKEY , KM_PRESS , 0 , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 9 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , ONEKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 10 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , TWOKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 11 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , THREEKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 12 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , FOURKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 13 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , FIVEKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 14 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , SIXKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 15 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , SEVENKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 16 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , EIGHTKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 17 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , NINEKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 18 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_active_index_set " , ZEROKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
RNA_string_set ( kmi - > ptr , " mode " , mode ) ;
2011-04-01 04:22:30 +00:00
RNA_int_set ( kmi - > ptr , " index " , 19 ) ;
2009-11-17 16:04:17 +00:00
}
2010-10-16 14:32:17 +00:00
static void ed_keymap_paint_brush_size ( wmKeyMap * keymap , const char * UNUSED ( path ) )
2010-01-04 00:18:08 +00:00
{
wmKeyMapItem * kmi ;
2010-07-14 14:11:03 +00:00
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_scale_size " , LEFTBRACKETKEY , KM_PRESS , 0 , 0 ) ;
RNA_float_set ( kmi - > ptr , " scalar " , 0.9 ) ;
kmi = WM_keymap_add_item ( keymap , " BRUSH_OT_scale_size " , RIGHTBRACKETKEY , KM_PRESS , 0 , 0 ) ;
RNA_float_set ( kmi - > ptr , " scalar " , 10.0 / 9.0 ) ; // 1.1111....
}
2010-01-04 00:18:08 +00:00
2011-05-12 01:57:47 +00:00
typedef enum {
RC_COLOR = 1 ,
RC_ROTATION = 2 ,
RC_ZOOM = 4 ,
} RCFlags ;
static void set_brush_rc_path ( PointerRNA * ptr , const char * brush_path ,
const char * output_name , const char * input_name )
{
char * path ;
path = BLI_sprintfN ( " %s.%s " , brush_path , input_name ) ;
RNA_string_set ( ptr , output_name , path ) ;
MEM_freeN ( path ) ;
}
static void set_brush_rc_props ( PointerRNA * ptr , const char * paint ,
const char * prop , RCFlags flags )
{
char * brush_path ;
brush_path = BLI_sprintfN ( " tool_settings.%s.brush " , paint ) ;
set_brush_rc_path ( ptr , brush_path , " data_path " , prop ) ;
set_brush_rc_path ( ptr , brush_path , " color_path " , " cursor_color_add " ) ;
set_brush_rc_path ( ptr , brush_path , " rotation_path " , " texture_slot.angle " ) ;
RNA_string_set ( ptr , " image_id " , brush_path ) ;
if ( flags & RC_COLOR )
set_brush_rc_path ( ptr , brush_path , " fill_color_path " , " color " ) ;
if ( flags & RC_ZOOM )
RNA_string_set ( ptr , " zoom_path " , " space_data.zoom " ) ;
MEM_freeN ( brush_path ) ;
}
static void ed_keymap_paint_brush_radial_control ( wmKeyMap * keymap , const char * paint ,
RCFlags flags )
{
wmKeyMapItem * kmi ;
kmi = WM_keymap_add_item ( keymap , " WM_OT_radial_control " , FKEY , KM_PRESS , 0 , 0 ) ;
set_brush_rc_props ( kmi - > ptr , paint , " size " , flags ) ;
kmi = WM_keymap_add_item ( keymap , " WM_OT_radial_control " , FKEY , KM_PRESS , KM_SHIFT , 0 ) ;
set_brush_rc_props ( kmi - > ptr , paint , " strength " , flags ) ;
if ( flags & RC_ROTATION ) {
kmi = WM_keymap_add_item ( keymap , " WM_OT_radial_control " , FKEY , KM_PRESS , KM_CTRL , 0 ) ;
set_brush_rc_props ( kmi - > ptr , paint , " texture_slot.angle " , flags ) ;
}
}
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
void ED_keymap_paint ( wmKeyConfig * keyconf )
2009-09-18 15:48:49 +00:00
{
wmKeyMap * keymap ;
2009-12-23 12:13:48 +00:00
wmKeyMapItem * kmi ;
2009-12-07 19:56:59 +00:00
int i ;
2009-09-18 15:48:49 +00:00
/* Sculpt mode */
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
keymap = WM_keymap_find ( keyconf , " Sculpt " , 0 , 0 ) ;
2009-09-18 15:48:49 +00:00
keymap - > poll = sculpt_poll ;
2011-01-07 22:46:52 +00:00
RNA_enum_set ( WM_keymap_add_item ( keymap , " SCULPT_OT_brush_stroke " , LEFTMOUSE , KM_PRESS , 0 , 0 ) - > ptr , " mode " , BRUSH_STROKE_NORMAL ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " SCULPT_OT_brush_stroke " , LEFTMOUSE , KM_PRESS , KM_CTRL , 0 ) - > ptr , " mode " , BRUSH_STROKE_INVERT ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " SCULPT_OT_brush_stroke " , LEFTMOUSE , KM_PRESS , KM_SHIFT , 0 ) - > ptr , " mode " , BRUSH_STROKE_SMOOTH ) ;
2009-09-18 15:48:49 +00:00
2009-12-23 12:13:48 +00:00
for ( i = 0 ; i < = 5 ; i + + )
2009-12-07 19:56:59 +00:00
RNA_int_set ( WM_keymap_add_item ( keymap , " OBJECT_OT_subdivision_set " , ZEROKEY + i , KM_PRESS , KM_CTRL , 0 ) - > ptr , " level " , i ) ;
2009-12-23 12:13:48 +00:00
/* multires switch */
kmi = WM_keymap_add_item ( keymap , " OBJECT_OT_subdivision_set " , PAGEUPKEY , KM_PRESS , 0 , 0 ) ;
RNA_int_set ( kmi - > ptr , " level " , 1 ) ;
RNA_boolean_set ( kmi - > ptr , " relative " , 1 ) ;
kmi = WM_keymap_add_item ( keymap , " OBJECT_OT_subdivision_set " , PAGEDOWNKEY , KM_PRESS , 0 , 0 ) ;
RNA_int_set ( kmi - > ptr , " level " , - 1 ) ;
RNA_boolean_set ( kmi - > ptr , " relative " , 1 ) ;
2010-11-10 08:11:58 +00:00
ed_keymap_paint_brush_switch ( keymap , " sculpt " ) ;
2010-01-04 00:18:08 +00:00
ed_keymap_paint_brush_size ( keymap , " tool_settings.sculpt.brush.size " ) ;
2011-05-12 01:57:47 +00:00
ed_keymap_paint_brush_radial_control ( keymap , " sculpt " , RC_ROTATION ) ;
2010-07-14 14:11:03 +00:00
2011-04-01 06:14:39 +00:00
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , DKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_DRAW ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , SKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_SMOOTH ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , PKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_PINCH ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , IKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_INFLATE ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , GKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_GRAB ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , LKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_LAYER ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , TKEY , KM_PRESS , KM_SHIFT , 0 ) - > ptr , " tool " , SCULPT_TOOL_FLATTEN ) ; /* was just TKEY in 2.4x */
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , CKEY , KM_PRESS , 0 , 0 ) - > ptr , " tool " , SCULPT_TOOL_CLAY ) ;
RNA_enum_set ( WM_keymap_add_item ( keymap , " BRUSH_OT_sculpt_tool_set " , CKEY , KM_PRESS , KM_SHIFT , 0 ) - > ptr , " tool " , SCULPT_TOOL_CREASE ) ;
2010-07-14 14:11:03 +00:00
/* */
2011-02-15 19:19:36 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_menu_enum " , AKEY , KM_PRESS , 0 , 0 ) ;
RNA_string_set ( kmi - > ptr , " data_path " , " tool_settings.sculpt.brush.stroke_method " ) ;
2009-12-23 12:13:48 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_toggle " , SKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-06-14 03:52:10 +00:00
RNA_string_set ( kmi - > ptr , " data_path " , " tool_settings.sculpt.brush.use_smooth_stroke " ) ;
2009-12-23 12:13:48 +00:00
2011-05-02 08:04:05 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_menu_enum " , RKEY , KM_PRESS , 0 , 0 ) ;
RNA_string_set ( kmi - > ptr , " data_path " , " tool_settings.sculpt.brush.texture_angle_source_random " ) ;
2009-12-23 15:06:47 +00:00
2009-09-18 15:48:49 +00:00
/* Vertex Paint mode */
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
keymap = WM_keymap_find ( keyconf , " Vertex Paint " , 0 , 0 ) ;
2010-01-26 11:11:53 +00:00
keymap - > poll = vertex_paint_mode_poll ;
2009-09-18 15:48:49 +00:00
WM_keymap_verify_item ( keymap , " PAINT_OT_vertex_paint " , LEFTMOUSE , KM_PRESS , 0 , 0 ) ;
WM_keymap_add_item ( keymap , " PAINT_OT_sample_color " , RIGHTMOUSE , KM_PRESS , 0 , 0 ) ;
2009-10-22 12:59:14 +00:00
WM_keymap_add_item ( keymap ,
" PAINT_OT_vertex_color_set " , KKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
ed_keymap_paint_brush_switch ( keymap , " vertex_paint " ) ;
2010-01-04 00:18:08 +00:00
ed_keymap_paint_brush_size ( keymap , " tool_settings.vertex_paint.brush.size " ) ;
2011-05-12 01:57:47 +00:00
ed_keymap_paint_brush_radial_control ( keymap , " vertex_paint " , RC_COLOR ) ;
2009-11-17 16:04:17 +00:00
2010-01-14 18:11:10 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_toggle " , MKEY , KM_PRESS , 0 , 0 ) ; /* mask toggle */
2010-06-14 03:52:10 +00:00
RNA_string_set ( kmi - > ptr , " data_path " , " vertex_paint_object.data.use_paint_mask " ) ;
2010-01-14 18:11:10 +00:00
2009-09-18 15:48:49 +00:00
/* Weight Paint mode */
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
keymap = WM_keymap_find ( keyconf , " Weight Paint " , 0 , 0 ) ;
2010-01-26 11:11:53 +00:00
keymap - > poll = weight_paint_mode_poll ;
2009-09-18 15:48:49 +00:00
WM_keymap_verify_item ( keymap , " PAINT_OT_weight_paint " , LEFTMOUSE , KM_PRESS , 0 , 0 ) ;
2011-05-25 10:07:59 +00:00
/* these keys are from 2.4x but could be changed */
WM_keymap_verify_item ( keymap , " PAINT_OT_weight_sample " , LEFTMOUSE , KM_PRESS , KM_CTRL , 0 ) ;
WM_keymap_verify_item ( keymap , " PAINT_OT_weight_sample_group " , LEFTMOUSE , KM_PRESS , KM_SHIFT , 0 ) ;
2009-10-22 12:59:14 +00:00
WM_keymap_add_item ( keymap ,
" PAINT_OT_weight_set " , KKEY , KM_PRESS , KM_SHIFT , 0 ) ;
2010-11-10 08:11:58 +00:00
ed_keymap_paint_brush_switch ( keymap , " weight_paint " ) ;
2010-01-04 00:18:08 +00:00
ed_keymap_paint_brush_size ( keymap , " tool_settings.weight_paint.brush.size " ) ;
2011-05-12 01:57:47 +00:00
ed_keymap_paint_brush_radial_control ( keymap , " weight_paint " , 0 ) ;
2009-11-17 16:04:17 +00:00
2011-12-20 02:04:35 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_toggle " , MKEY , KM_PRESS , 0 , 0 ) ; /* face mask toggle */
2010-06-14 03:52:10 +00:00
RNA_string_set ( kmi - > ptr , " data_path " , " weight_paint_object.data.use_paint_mask " ) ;
2010-01-14 18:11:10 +00:00
2011-12-20 02:04:35 +00:00
/* note, conflicts with vertex paint, but this is more useful */
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_toggle " , VKEY , KM_PRESS , 0 , 0 ) ; /* vert mask toggle */
RNA_string_set ( kmi - > ptr , " data_path " , " weight_paint_object.data.use_paint_mask_vertex " ) ;
2010-01-26 11:11:53 +00:00
WM_keymap_verify_item ( keymap , " PAINT_OT_weight_from_bones " , WKEY , KM_PRESS , 0 , 0 ) ;
2011-09-18 17:10:28 +00:00
2011-07-13 20:45:09 +00:00
/*Weight paint's Vertex Selection Mode */
keymap = WM_keymap_find ( keyconf , " Weight Paint Vertex Selection " , 0 , 0 ) ;
keymap - > poll = vert_paint_poll ;
WM_keymap_add_item ( keymap , " PAINT_OT_vert_select_all " , AKEY , KM_PRESS , 0 , 0 ) ;
2011-09-18 01:09:18 +00:00
WM_keymap_add_item ( keymap , " PAINT_OT_vert_select_inverse " , IKEY , KM_PRESS , KM_CTRL , 0 ) ;
2011-07-13 20:45:09 +00:00
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 ) ;
2011-07-12 19:06:06 +00:00
WM_keymap_add_item ( keymap , " VIEW3D_OT_select_circle " , CKEY , KM_PRESS , 0 , 0 ) ;
2009-09-18 15:48:49 +00:00
/* Image/Texture Paint mode */
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
keymap = WM_keymap_find ( keyconf , " Image Paint " , 0 , 0 ) ;
2009-09-18 15:48:49 +00:00
keymap - > poll = image_texture_paint_poll ;
WM_keymap_add_item ( keymap , " PAINT_OT_image_paint " , LEFTMOUSE , KM_PRESS , 0 , 0 ) ;
2010-02-02 17:41:32 +00:00
WM_keymap_add_item ( keymap , " PAINT_OT_grab_clone " , RIGHTMOUSE , KM_PRESS , 0 , 0 ) ;
2009-09-18 15:48:49 +00:00
WM_keymap_add_item ( keymap , " PAINT_OT_sample_color " , RIGHTMOUSE , KM_PRESS , 0 , 0 ) ;
WM_keymap_add_item ( keymap , " PAINT_OT_clone_cursor_set " , LEFTMOUSE , KM_PRESS , KM_CTRL , 0 ) ;
2010-11-10 08:11:58 +00:00
ed_keymap_paint_brush_switch ( keymap , " image_paint " ) ;
2010-01-04 00:18:08 +00:00
ed_keymap_paint_brush_size ( keymap , " tool_settings.image_paint.brush.size " ) ;
2011-05-12 01:57:47 +00:00
ed_keymap_paint_brush_radial_control ( keymap , " image_paint " , RC_COLOR | RC_ZOOM ) ;
2009-11-17 16:04:17 +00:00
2010-01-14 18:11:10 +00:00
kmi = WM_keymap_add_item ( keymap , " WM_OT_context_toggle " , MKEY , KM_PRESS , 0 , 0 ) ; /* mask toggle */
2011-04-01 04:22:30 +00:00
RNA_string_set ( kmi - > ptr , " data_path " , " image_paint_object.data.use_paint_mask " ) ;
2010-01-14 18:11:10 +00:00
2009-10-22 19:17:46 +00:00
/* face-mask mode */
keymap = WM_keymap_find ( keyconf , " Face Mask " , 0 , 0 ) ;
keymap - > poll = facemask_paint_poll ;
2009-11-29 22:16:29 +00:00
WM_keymap_add_item ( keymap , " PAINT_OT_face_select_all " , AKEY , KM_PRESS , 0 , 0 ) ;
2011-02-24 16:04:36 +00:00
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 ) ;
WM_keymap_add_item ( keymap , " PAINT_OT_face_select_reveal " , HKEY , KM_PRESS , KM_ALT , 0 ) ;
2009-10-22 19:17:46 +00:00
WM_keymap_add_item ( keymap , " PAINT_OT_face_select_linked " , LKEY , KM_PRESS , KM_CTRL , 0 ) ;
WM_keymap_add_item ( keymap , " PAINT_OT_face_select_linked_pick " , LKEY , KM_PRESS , 0 , 0 ) ;
}