diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_sculpt_paint.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 7b30aa84cfb..acde663a799 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -77,6 +77,8 @@ EnumPropertyItem symmetrize_direction_items[] = { #include "BKE_context.h" #include "BKE_DerivedMesh.h" +#include "BKE_editstrands.h" +#include "BKE_effect.h" #include "BKE_pointcache.h" #include "BKE_particle.h" #include "BKE_depsgraph.h" @@ -221,6 +223,8 @@ static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) mode = OB_MODE_VERTEX_PAINT; else if (ptr->data == ts->wpaint) mode = OB_MODE_WEIGHT_PAINT; + else if (ptr->data == &ts->hair_edit) + mode = OB_MODE_HAIR_EDIT; return brush->ob_mode & mode; } @@ -359,6 +363,30 @@ static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) { return imapaint->missing_data == 0; } + +/* ==== Hair Edit ==== */ + +static char *rna_HairEdit_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.hair_edit"); +} + +static void rna_HairEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + Object *ob = OBACT; + + if (ob) + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); +} + +static void rna_HairEdit_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + HairEditSettings *settings = ptr->data; + Brush *brush = settings->brush; + BKE_paint_invalidate_overlay_all(); + WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); +} + #else static void rna_def_paint_curve(BlenderRNA *brna) @@ -911,6 +939,10 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Puff Volume", "Apply puff to unselected end-points (helps maintain hair volume when puffing root)"); + prop = RNA_def_property(srna, "use_add_stroke", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PE_BRUSH_DATA_ADD_SINGLE); + RNA_def_property_ui_text(prop, "Add Stroke", "Add multiple particles per brush stroke"); + prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "invert"); RNA_def_property_enum_items(prop, length_mode); @@ -923,6 +955,41 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Curve", ""); } +static void rna_def_hair_edit(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem select_mode_items[] = { + {HAIR_SELECT_STRAND, "STRAND", ICON_PARTICLE_PATH, "Strand", "Strand edit mode"}, + {HAIR_SELECT_VERTEX, "VERTEX", ICON_PARTICLE_POINT, "Vertex", "Vertex select mode"}, + {HAIR_SELECT_TIP, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "HairEdit", NULL); + RNA_def_struct_sdna(srna, "HairEditSettings"); + RNA_def_struct_path_func(srna, "rna_HairEdit_path"); + RNA_def_struct_ui_text(srna, "Hair Edit", "Settings for hair editing mode"); + + prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll"); + RNA_def_property_ui_text(prop, "Brush", "Active Brush"); + RNA_def_property_update(prop, 0, "rna_HairEdit_brush_update"); + + prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "select_mode"); + RNA_def_property_enum_items(prop, select_mode_items); + RNA_def_property_ui_text(prop, "Selection Mode", "Hair selection mode"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update"); + + prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update"); +} + void RNA_def_sculpt_paint(BlenderRNA *brna) { /* *** Non-Animated *** */ @@ -934,6 +1001,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_hair_edit(brna); RNA_define_animate_sdna(true); } |