Commit: 1ae8622d4763581141d207bdb380a20e8c33dcc1
Author: Jeroen Bakker
Date: Wed Mar 23 12:12:53 2022 +0100
Branches: temp-T96709-painting-target
https://developer.blender.org/rB1ae8622d4763581141d207bdb380a20e8c33dcc1
Add initial RNA/DNA struct.
===================================================================
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_scene.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/source/blender/makesdna/DNA_scene_types.h
b/source/blender/makesdna/DNA_scene_types.h
index be8f9f938a3..c1fa4bf40e9 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -922,6 +922,19 @@ typedef struct ImagePaintSettings {
char _pad[4];
} ImagePaintSettings;
+/* ------------------------------------------- */
+/* Paint mode settings */
+
+typedef struct PaintModeSettings {
+ /** Type of canvas to paint on (ePaintCanvasType) */
+ char canvas_type;
+ char _pad[7];
+
+ /** Selected image when canvas_type=PAINT_CANVAS_IMAGE. */
+ Image *image;
+
+} PaintModeSettings;
+
/* ------------------------------------------- */
/* Particle Edit */
@@ -1455,6 +1468,9 @@ typedef struct ToolSettings {
/* Image Paint (8 bytes aligned please!) */
struct ImagePaintSettings imapaint;
+ /** Settings for paint mode. */
+ struct PaintModeSettings paint_mode;
+
/* Particle Editing */
struct ParticleEditSettings particle;
@@ -2273,6 +2289,16 @@ typedef enum eImagePaintMode {
IMAGEPAINT_MODE_IMAGE = 1, /* select texture paint image directly */
} eImagePaintMode;
+/** PaintModeSettings.canvas_type */
+typedef enum ePaintCanvasType {
+ /** Paint on the active vertex color layer. */
+ PAINT_CANVAS_VERTEX = 0,
+ /** Paint on the active texture of the active material slot. */
+ PAINT_CANVAS_MATERIAL = 1,
+ /** Paint on a selected image. */
+ PAINT_CANVAS_IMAGE = 2,
+} ePaintCanvasType;
+
/** #ImagePaintSettings.interp */
enum {
IMAGEPAINT_INTERP_LINEAR = 0,
diff --git a/source/blender/makesrna/intern/rna_scene.c
b/source/blender/makesrna/intern/rna_scene.c
index 04afcd61717..1f6dae4de0a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2964,6 +2964,10 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
RNA_def_property_ui_text(prop, "Image Paint", "");
+ prop = RNA_def_property(srna, "paint_mode", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "paint_mode");
+ RNA_def_property_ui_text(prop, "Paint Mode", "");
+
prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
RNA_def_property_ui_text(prop, "UV Sculpt", "");
@@ -6161,7 +6165,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "hair_subdiv", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 3);
- RNA_def_property_ui_text(prop, "Additional Subdivision", "Additional
subdivision along the hair");
+ RNA_def_property_ui_text(
+ prop, "Additional Subdivision", "Additional subdivision along the hair");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS,
"rna_Scene_glsl_update");
/* Performance */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 97e1f325816..7775f45ded7 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -82,6 +82,13 @@ static const EnumPropertyItem rna_enum_gpencil_paint_mode[]
= {
"Paint the material with custom vertex color"},
{0, NULL, 0, NULL, NULL},
};
+
+static const EnumPropertyItem rna_enum_canvas_type_items[] = {
+ {PAINT_CANVAS_VERTEX, "VERTEX", 0, "Vertex", ""},
+ {PAINT_CANVAS_MATERIAL, "MATERIAL", 0, "Material", ""},
+ {PAINT_CANVAS_IMAGE, "IMAGE", 0, "Image", ""},
+ {0, NULL, 0, NULL, NULL},
+};
#endif
const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
@@ -418,6 +425,11 @@ static char *rna_ImagePaintSettings_path(PointerRNA
*UNUSED(ptr))
return BLI_strdup("tool_settings.image_paint");
}
+static char *rna_PaintModeSettings_path(PointerRNA *UNUSED(ptr))
+{
+ return BLI_strdup("tool_settings.paint_mode");
+}
+
static char *rna_UvSculpt_path(PointerRNA *UNUSED(ptr))
{
return BLI_strdup("tool_settings.uv_sculpt");
@@ -964,6 +976,25 @@ static void rna_def_vertex_paint(BlenderRNA *brna)
prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes
across the surface");
}
+static void rna_def_paint_mode(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "PaintModeSettings", NULL);
+ RNA_def_struct_sdna(srna, "PaintModeSettings");
+ RNA_def_struct_path_func(srna, "rna_PaintModeSettings_path");
+ RNA_def_struct_ui_text(srna, "Paint Mode", "Properties of paint mode");
+
+ prop = RNA_def_property(srna, "canvas_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "canvas_type");
+ RNA_def_property_enum_items(prop, rna_enum_canvas_type_items);
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Texture", "Image used as as painting
target");
+}
+
static void rna_def_image_paint(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1551,6 +1582,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna)
rna_def_gp_sculptpaint(brna);
rna_def_gp_weightpaint(brna);
rna_def_vertex_paint(brna);
+ rna_def_paint_mode(brna);
rna_def_image_paint(brna);
rna_def_particle_edit(brna);
rna_def_gpencil_guides(brna);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs