Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r--source/blender/makesrna/intern/rna_brush.c83
1 files changed, 79 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 423cb084f27..a6778ef67da 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -14,8 +14,12 @@
#include "DNA_texture_types.h"
#include "DNA_workspace_types.h"
+#include "BKE_layer.h"
+
#include "BLI_math.h"
+#include "BLT_translation.h"
+
#include "RNA_define.h"
#include "RNA_enum_types.h"
@@ -251,9 +255,14 @@ const EnumPropertyItem rna_enum_brush_curves_sculpt_tool_items[] = {
{CURVES_SCULPT_TOOL_ADD, "ADD", ICON_BRUSH_CURVES_ADD, "Add Curves", ""},
{CURVES_SCULPT_TOOL_GROW_SHRINK, "GROW_SHRINK", ICON_BRUSH_CURVES_GROW_SHRINK, "Grow / Shrink Curves", ""},
{CURVES_SCULPT_TOOL_SELECTION_PAINT, "SELECTION_PAINT", ICON_BRUSH_PAINT_SELECT, "Paint Selection", ""},
+ {CURVES_SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_CURVES_PINCH, "Pinch Curves", ""},
+ {CURVES_SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_CURVES_SMOOTH, "Smooth Curves", ""},
+ {CURVES_SCULPT_TOOL_PUFF, "PUFF", ICON_BRUSH_CURVES_PUFF, "Puff Curves", ""},
+ {CURVES_SCULPT_TOOL_DENSITY, "DENSITY", ICON_BRUSH_CURVES_DENSITY, "Density Curves", ""},
+ {CURVES_SCULPT_TOOL_SLIDE, "SLIDE", ICON_BRUSH_CURVES_SLIDE, "Slide Curves", ""},
{0, NULL, 0, NULL, NULL},
};
-/* clang-format om */
+/* clang-format on */
#ifndef RNA_RUNTIME
static EnumPropertyItem rna_enum_gpencil_brush_eraser_modes_items[] = {
@@ -760,11 +769,11 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value)
brush->size = value;
}
-static void rna_Brush_use_gradient_set(PointerRNA *ptr, bool value)
+static void rna_Brush_use_gradient_set(PointerRNA *ptr, int value)
{
Brush *br = (Brush *)ptr->data;
- if (value) {
+ if (value & BRUSH_USE_GRADIENT) {
br->flag |= BRUSH_USE_GRADIENT;
}
else {
@@ -889,6 +898,7 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
switch (me->curves_sculpt_tool) {
case CURVES_SCULPT_TOOL_GROW_SHRINK:
case CURVES_SCULPT_TOOL_SELECTION_PAINT:
+ case CURVES_SCULPT_TOOL_PINCH:
return prop_direction_items;
default:
return DummyRNA_DEFAULT_items;
@@ -962,8 +972,10 @@ static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain,
static void rna_BrushGpencilSettings_use_material_pin_update(bContext *C, PointerRNA *ptr)
{
+ const Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
+ BKE_view_layer_synced_ensure(scene, view_layer);
+ Object *ob = BKE_view_layer_active_object_get(view_layer);
Brush *brush = (Brush *)ptr->owner_id;
if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
@@ -1318,6 +1330,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "draw_jitter");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Jitter", "Jitter factor for new strokes");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
@@ -1645,6 +1658,15 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+ /* Factor to determine outline external perimeter thickness. */
+ prop = RNA_def_property(srna, "outline_thickness_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "outline_fac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(
+ prop, "Thickness", "Thickness of the outline stroke relative to current brush thickness");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
/* Flags */
prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_PRESSURE);
@@ -1814,6 +1836,12 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Trim Stroke Ends", "Trim intersecting stroke ends");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ prop = RNA_def_property(srna, "use_settings_outline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_OUTLINE_STROKE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Outline", "Convert stroke to perimeter");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "sculpt_flag");
RNA_def_property_enum_items(prop, prop_direction_items);
@@ -1877,6 +1905,15 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_Brush_material_update");
+ /* Secondary Material */
+ prop = RNA_def_property(srna, "material_alt", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_BrushGpencilSettings_material_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Material", "Material used for secondary uses for this brush");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_Brush_material_update");
+
prop = RNA_def_property(srna, "show_fill_boundary", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_SHOW_HELPLINES);
RNA_def_property_boolean_default(prop, true);
@@ -1949,6 +1986,26 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static const EnumPropertyItem density_mode_items[] = {
+ {BRUSH_CURVES_SCULPT_DENSITY_MODE_AUTO,
+ "AUTO",
+ ICON_AUTO,
+ "Auto",
+ "Either add or remove curves depending on the minimum distance of the curves under the "
+ "cursor"},
+ {BRUSH_CURVES_SCULPT_DENSITY_MODE_ADD,
+ "ADD",
+ ICON_ADD,
+ "Add",
+ "Add new curves between existing curves, taking the minimum distance into account"},
+ {BRUSH_CURVES_SCULPT_DENSITY_MODE_REMOVE,
+ "REMOVE",
+ ICON_REMOVE,
+ "Remove",
+ "Remove curves whose root points are too close"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "BrushCurvesSculptSettings", NULL);
RNA_def_struct_sdna(srna, "BrushCurvesSculptSettings");
RNA_def_struct_ui_text(srna, "Curves Sculpt Brush Settings", "");
@@ -1997,6 +2054,22 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna)
prop,
"Curve Length",
"Length of newly added curves when it is not interpolated from other curves");
+
+ prop = RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1000.0f, 0.001, 2);
+ RNA_def_property_ui_text(
+ prop, "Minimum Distance", "Goal distance between curve roots for the Density brush");
+
+ prop = RNA_def_property(srna, "density_add_attempts", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, INT32_MAX);
+ RNA_def_property_ui_text(
+ prop, "Density Add Attempts", "How many times the Density brush tries to add a new curve");
+
+ prop = RNA_def_property(srna, "density_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, density_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Density Mode", "Determines whether the brush adds or removes curves");
}
static void rna_def_brush(BlenderRNA *brna)
@@ -2549,6 +2622,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 1000.0f);
RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 4);
RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "jitter_absolute", PROP_INT, PROP_PIXEL);
@@ -2556,6 +2630,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 1000000);
RNA_def_property_ui_text(
prop, "Jitter", "Jitter the position of the brush in pixels while painting");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);