forked from bartvdbraak/blender
Code cleanup, defined shared stroke properties to one central function.
This commit is contained in:
parent
728687c571
commit
c5a2c08dd9
@ -979,12 +979,6 @@ static int paint_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void PAINT_OT_image_paint(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem stroke_mode_items[] = {
|
||||
{BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
|
||||
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Image Paint";
|
||||
ot->idname = "PAINT_OT_image_paint";
|
||||
@ -1000,11 +994,7 @@ void PAINT_OT_image_paint(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_BLOCKING;
|
||||
|
||||
RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL,
|
||||
"Paint Stroke Mode",
|
||||
"Action taken when a paint stroke is made");
|
||||
|
||||
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
|
||||
paint_stroke_operator_properties(ot);
|
||||
}
|
||||
|
||||
|
||||
|
@ -218,6 +218,9 @@ float paint_get_tex_pixel(struct MTex *mtex, float u, float v, struct ImagePool
|
||||
void paint_get_tex_pixel_col(struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace);
|
||||
|
||||
void paint_sample_color(bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette);
|
||||
|
||||
void paint_stroke_operator_properties(struct wmOperatorType *ot);
|
||||
|
||||
void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
|
||||
|
||||
void PAINT_OT_face_select_linked(struct wmOperatorType *ot);
|
||||
|
@ -214,6 +214,23 @@ void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct
|
||||
CLAMP(rgba[3], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void paint_stroke_operator_properties(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem stroke_mode_items[] = {
|
||||
{BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
|
||||
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
|
||||
{BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"},
|
||||
{0}
|
||||
};
|
||||
|
||||
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
|
||||
|
||||
RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL,
|
||||
"Stroke Mode",
|
||||
"Action taken when a paint stroke is made");
|
||||
|
||||
}
|
||||
|
||||
/* 3D Paint */
|
||||
|
||||
static void imapaint_project(float matrix[4][4], const float co[3], float pco[4])
|
||||
|
@ -75,7 +75,6 @@
|
||||
|
||||
#include "paint_intern.h" /* own include */
|
||||
|
||||
|
||||
/* check if we can do partial updates and have them draw realtime
|
||||
* (without rebuilding the 'derivedFinal') */
|
||||
static bool vertex_paint_use_fast_update_check(Object *ob)
|
||||
@ -2599,7 +2598,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
|
||||
paint_stroke_operator_properties(ot);
|
||||
}
|
||||
|
||||
static int weight_paint_set_exec(bContext *C, wmOperator *op)
|
||||
@ -3118,7 +3117,7 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
|
||||
paint_stroke_operator_properties(ot);
|
||||
}
|
||||
|
||||
/* ********************** weight from bones operator ******************* */
|
||||
|
@ -4479,13 +4479,6 @@ static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
|
||||
|
||||
static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem stroke_mode_items[] = {
|
||||
{BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
|
||||
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
|
||||
{BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Sculpt";
|
||||
ot->idname = "SCULPT_OT_brush_stroke";
|
||||
@ -4503,11 +4496,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
|
||||
|
||||
/* properties */
|
||||
|
||||
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
|
||||
|
||||
RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL,
|
||||
"Sculpt Stroke Mode",
|
||||
"Action taken when a sculpt stroke is made");
|
||||
paint_stroke_operator_properties(ot);
|
||||
|
||||
RNA_def_boolean(ot->srna, "ignore_background_click", 0,
|
||||
"Ignore Background Click",
|
||||
|
Loading…
Reference in New Issue
Block a user