diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-12-13 11:03:13 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-12-13 11:03:13 +0300 |
commit | a1f87064c4c0cd9e8eafc19c599c4ad4ccdba49f (patch) | |
tree | d016e95050f10eda7bc44e1bdfa2f7c4fc0fc024 /source/blender/makesrna | |
parent | d9ee88d126ddb59b68d2561694b522a99e4923b6 (diff) |
Grease Pencil: Merge GPencil_Editing_Stage3 branch into master
This commit merges all the work done in the GPencil_Editing_Stage3 branch
as of ef2aecf2db981b5344e0d14e7f074f1742b0b2f7 into master. For more details
about the changes that this brings, see the WIP release notes:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.77/GPencil
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil.c | 91 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 64 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 105 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 6 |
8 files changed, 252 insertions, 27 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 480d34ae34e..8b785c8a65f 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -259,6 +259,8 @@ extern StructRNA RNA_GPencilFrame; extern StructRNA RNA_GPencilLayer; extern StructRNA RNA_GPencilStroke; extern StructRNA RNA_GPencilStrokePoint; +extern StructRNA RNA_GPencilSculptSettings; +extern StructRNA RNA_GPencilSculptBrush; extern StructRNA RNA_GameBooleanProperty; extern StructRNA RNA_GameFloatProperty; extern StructRNA RNA_GameIntProperty; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 0066236e3f0..0576820e08f 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -111,6 +111,8 @@ extern EnumPropertyItem rna_enum_brush_sculpt_tool_items[]; extern EnumPropertyItem rna_enum_brush_vertex_tool_items[]; extern EnumPropertyItem rna_enum_brush_image_tool_items[]; +extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[]; + extern EnumPropertyItem rna_enum_symmetrize_direction_items[]; extern EnumPropertyItem rna_enum_texture_type_items[]; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 9ae9f11b462..5d90b9fcae8 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -495,6 +495,14 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Display Grease Pencil", "Include visualization of Grease Pencil related animation data and frames"); RNA_def_property_ui_icon(prop, ICON_GREASEPENCIL, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + + /* GPencil Mode Settings */ + prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY); + RNA_def_property_ui_text(prop, "Active Scene Only", + "Only show Grease Pencil datablocks used as part of the active scene"); + RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0); + RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); } static void rna_def_action_group(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 80a52a0a3d1..6367b8a4738 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -50,11 +50,46 @@ #include "BKE_gpencil.h" +#include "DNA_object_types.h" + + static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } +static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +{ + /* Notify all places where GPencil data lives that the editing state is different */ + WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); + WM_main_add_notifier(NC_SCENE | ND_MODE, NULL); +} + +static void rna_GPencil_onion_skinning_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPDlayer *gpl; + bool enabled = false; + + /* Ensure that the datablock's onionskinning toggle flag + * stays in sync with the status of the actual layers + */ + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { + if (gpl->flag & GP_LAYER_ONIONSKIN) { + enabled = true; + } + } + + if (enabled) + gpd->flag |= GP_DATA_SHOW_ONIONSKINS; + else + gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; + + + /* Now do standard updates... */ + rna_GPencil_update(bmain, scene, ptr); +} + static char *rna_GPencilLayer_path(PointerRNA *ptr) { bGPDlayer *gpl = (bGPDlayer *)ptr->data; @@ -201,6 +236,30 @@ static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value) BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); } +static void rna_GPencil_use_onion_skinning_set(PointerRNA *ptr, const int value) +{ + bGPdata *gpd = ptr->id.data; + bGPDlayer *gpl; + + /* set new value */ + if (value) { + /* enable on active layer (it's the one that's most likely to be of interest right now) */ + gpl = gpencil_layer_getactive(gpd); + if (gpl) { + gpl->flag |= GP_LAYER_ONIONSKIN; + } + + gpd->flag |= GP_DATA_SHOW_ONIONSKINS; + } + else { + /* disable on all layers - allowa quickly turning them all off, without having to check */ + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { + gpl->flag &= ~GP_LAYER_ONIONSKIN; + } + + gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; + } +} static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, const bGPDspoint *pt, bGPDlayer **r_gpl, bGPDframe **r_gpf) { @@ -701,7 +760,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN); RNA_def_property_ui_text(prop, "Onion Skinning", "Ghost frames on either side of frame"); - RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_onion_skinning_update"); prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gstep"); @@ -849,14 +908,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna) PropertyRNA *prop; FunctionRNA *func; - static EnumPropertyItem draw_mode_items[] = { - {GP_DATA_VIEWALIGN, "CURSOR", 0, "Cursor", "Draw stroke at the 3D cursor"}, - {0, "VIEW", 0, "View", "Stick stroke to the view "}, /* weird, GP_DATA_VIEWALIGN is inverted */ - {GP_DATA_VIEWALIGN | GP_DATA_DEPTH_VIEW, "SURFACE", 0, "Surface", "Stick stroke to surfaces"}, - {GP_DATA_VIEWALIGN | GP_DATA_DEPTH_STROKE, "STROKE", 0, "Stroke", "Stick stroke to other strokes"}, - {0, NULL, 0, NULL, NULL} - }; - srna = RNA_def_struct(brna, "GreasePencil", "ID"); RNA_def_struct_sdna(srna, "bGPdata"); RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook"); @@ -873,21 +924,17 @@ static void rna_def_gpencil_data(BlenderRNA *brna) rna_def_animdata_common(srna); /* Flags */ - prop = RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, draw_mode_items); - RNA_def_property_ui_text(prop, "Draw Mode", ""); - RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); - - prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_DEPTH_STROKE_ENDPOINTS); - RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping"); - RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); - prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE); - RNA_def_property_ui_text(prop, "Stroke Edit Mode", "Enable alternative keymap to make editing stroke points easier"); - RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_update"); + RNA_def_property_ui_text(prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update"); + + prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS); + RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_use_onion_skinning_set"); + RNA_def_property_ui_text(prop, "Onion Skins", + "Show ghosts of the frames before and after the current frame, toggle to enable on active layer or disable all"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); /* API Functions */ func = RNA_def_function(srna, "clear", "rna_GPencil_clear"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 96749e32e45..81b1e4ac4be 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -69,6 +69,7 @@ EnumPropertyItem rna_enum_object_mode_items[] = { {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, + {OB_MODE_GPENCIL, "GPENCIL_EDIT", ICON_GREASEPENCIL, "Edit Strokes", "Edit Grease Pencil Strokes"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 4f9fe8b45ab..2624e351c74 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2057,11 +2057,19 @@ static void rna_def_tool_settings(BlenderRNA *brna) "unless the active object already has Grease Pencil data (i.e. for old files)"}, {GP_TOOL_SOURCE_OBJECT, "OBJECT", 0, "Object", "Grease Pencil data-blocks attached to the active object are used " - "(required using pre 2.73 add-ons, e.g. BSurfaces)"}, + "(required when using pre 2.73 add-ons, e.g. BSurfaces)"}, {0, NULL, 0, NULL, NULL} }; - - + + static EnumPropertyItem gpencil_stroke_placement_items[] = { + {GP_PROJECT_VIEWSPACE, "CURSOR", 0, "Cursor", "Draw stroke at the 3D cursor"}, + {0, "VIEW", 0, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */ + {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", 0, "Surface", "Stick stroke to surfaces"}, + {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", 0, "Stroke", "Stick stroke to other strokes"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "ToolSettings", NULL); RNA_def_struct_path_func(srna, "rna_ToolSettings_path"); RNA_def_struct_ui_text(srna, "Tool Settings", ""); @@ -2269,12 +2277,19 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ /* Grease Pencil */ - prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_gpencil_continuous_drawing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON); - RNA_def_property_ui_text(prop, "Use Sketching Sessions", + RNA_def_property_ui_text(prop, "Use Continuous Drawing", "Allow drawing multiple strokes at a time with Grease Pencil"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */ + prop = RNA_def_property(srna, "use_gpencil_additive_drawing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST); + RNA_def_property_ui_text(prop, "Use Additive Drawing", + "When creating new frames, the strokes from the previous/active frame " + "are included as the basis for the new one"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "grease_pencil_source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_3d_items); @@ -2282,6 +2297,45 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Datablock where active Grease Pencil data is found from"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt"); + RNA_def_property_struct_type(prop, "GPencilSculptSettings"); + RNA_def_property_ui_text(prop, "Grease Pencil Sculpt", ""); + + /* Grease Pencil - 3D View Stroke Placement */ + prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align"); + RNA_def_property_enum_items(prop, gpencil_stroke_placement_items); + RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", ""); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + + prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS); + RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + + /* Grease Pencil - 2D Views Stroke Placement */ + prop = RNA_def_property(srna, "gpencil_stroke_placement_view2d", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align"); + RNA_def_property_enum_items(prop, gpencil_stroke_placement_items); + RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", ""); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + + /* Grease Pencil - Sequencer Preview Stroke Placement */ + prop = RNA_def_property(srna, "gpencil_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align"); + RNA_def_property_enum_items(prop, gpencil_stroke_placement_items); + RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", ""); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + + /* Grease Pencil - Image Editor Stroke Placement */ + prop = RNA_def_property(srna, "gpencil_stroke_placement_image_editor", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align"); + RNA_def_property_enum_items(prop, gpencil_stroke_placement_items); + RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", ""); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + + /* Auto Keying */ prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 9e70d6ce3d6..94161d95426 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -60,6 +60,20 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { + {GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"}, + {GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"}, + {GP_EDITBRUSH_TYPE_GRAB, "GRAB", 0, "Grab", "Translate the set of points initially within the brush circle"}, + {GP_EDITBRUSH_TYPE_PUSH, "PUSH", 0, "Push", "Move points out of the way, as if combing them"}, + {GP_EDITBRUSH_TYPE_TWIST, "TWIST", 0, "Twist", "Rotate points around the midpoint of the brush"}, + {GP_EDITBRUSH_TYPE_PINCH, "PINCH", 0, "Pinch", "Pull points towards the midpoint of the brush"}, + {GP_EDITBRUSH_TYPE_RANDOMISE, "RANDOMISE", 0, "Randomise", "Introduce jitter/randomness into strokes"}, + //{GP_EDITBRUSH_TYPE_SUBDIVIDE, "SUBDIVIDE", 0, "Subdivide", "Increase point density for higher resolution strokes when zoomed in"}, + //{GP_EDITBRUSH_TYPE_SIMPLIFY, "SIMPLIFY", 0, "Simplify", "Reduce density of stroke points"}, + {GP_EDITBRUSH_TYPE_CLONE, "CLONE", 0, "Clone", "Paste copies of the strokes stored on the clipboard"}, + {0, NULL, 0, NULL, NULL} +}; + EnumPropertyItem rna_enum_symmetrize_direction_items[] = { {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""}, {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""}, @@ -359,6 +373,30 @@ static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) { return imapaint->missing_data == 0; } + + +static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr) +{ + GP_BrushEdit_Settings *gset = (GP_BrushEdit_Settings *)ptr->data; + GP_EditBrush_Data *brush = NULL; + + if ((gset->brushtype >= 0) && (gset->brushtype < TOT_GP_EDITBRUSH_TYPES)) + brush = &gset->brush[gset->brushtype]; + + return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush); +} + +static char *rna_GPencilSculptSettings_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.gpencil_sculpt"); +} + +static char *rna_GPencilSculptBrush_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.gpencil_sculpt.brush"); +} + + #else static void rna_def_paint_curve(BlenderRNA *brna) @@ -945,6 +983,72 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Curve", ""); } +static void rna_def_gpencil_sculpt(BlenderRNA *brna) +{ + static EnumPropertyItem prop_direction_items[]= { + {0, "ADD", 0, "Add", "Add effect of brush"}, + {GP_EDITBRUSH_FLAG_INVERT, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"}, + {0, NULL, 0, NULL, NULL}}; + + StructRNA *srna; + PropertyRNA *prop; + + /* == Settings == */ + srna = RNA_def_struct(brna, "GPencilSculptSettings", NULL); + RNA_def_struct_sdna(srna, "GP_BrushEdit_Settings"); + RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path"); + RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool"); + + prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "brushtype"); + RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items); + RNA_def_property_ui_text(prop, "Tool", ""); + + prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "GPencilSculptBrush"); + RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_SELECT_MASK); + RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points"); + RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); // FIXME: this needs a custom icon + + + /* brush */ + srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL); + RNA_def_struct_sdna(srna, "GP_EditBrush_Data"); + RNA_def_struct_path_func(srna, "rna_GPencilSculptBrush_path"); + RNA_def_struct_ui_text(srna, "GPencil Sculpt Brush", "Stroke editing brush"); + + prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL); + RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS); + RNA_def_property_ui_range(prop, 1, 100, 10, 3); // XXX: too big + RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); + + prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, 0.001, 1.0); + RNA_def_property_ui_text(prop, "Strength", "Brush strength"); + + prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength"); + + prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_FALLOFF); + RNA_def_property_ui_text(prop, "Use Falloff", "Strength of brush decays with distance from cursor"); + + prop = RNA_def_property(srna, "affect_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE); + RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes"); + + prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, prop_direction_items); + RNA_def_property_ui_text(prop, "Direction", ""); +} + void RNA_def_sculpt_paint(BlenderRNA *brna) { /* *** Non-Animated *** */ @@ -956,6 +1060,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna) rna_def_vertex_paint(brna); rna_def_image_paint(brna); rna_def_particle_edit(brna); + rna_def_gpencil_sculpt(brna); RNA_define_animate_sdna(true); } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 20e9d64a47a..8e01e15b9a3 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -86,6 +86,9 @@ static EnumPropertyItem event_mouse_type_items[] = { {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action", ""}, {SELECTMOUSE, "SELECTMOUSE", 0, "Select", ""}, {0, "", 0, NULL, NULL}, + {TABLET_STYLUS, "PEN", 0, "Pen", ""}, + {TABLET_ERASER, "ERASER", 0, "Eraser", ""}, + {0, "", 0, NULL, NULL}, {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""}, {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""}, {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""}, @@ -180,6 +183,9 @@ EnumPropertyItem rna_enum_event_type_items[] = { {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", "MBA"}, {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", "MBS"}, {0, "", 0, NULL, NULL}, + {TABLET_STYLUS, "PEN", 0, "Pen", ""}, + {TABLET_ERASER, "ERASER", 0, "Eraser", ""}, + {0, "", 0, NULL, NULL}, {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"}, {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"}, {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"}, |