[Bf-blender-cvs] [60d953ae300] greasepencil-object: GP: New curve to define thickness in primitives
Antonioya
noreply at git.blender.org
Fri Dec 7 11:16:20 CET 2018
Commit: 60d953ae300523c2537274f3949242c6ed24fa00
Author: Antonioya
Date: Fri Dec 7 11:16:09 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB60d953ae300523c2537274f3949242c6ed24fa00
GP: New curve to define thickness in primitives
===================================================================
M source/blender/blenloader/intern/versioning_280.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 17859d257d0..a9359a5ff3b 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2490,5 +2490,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
dir[0] = -dir[0];
}
}
+
+ /* Grease pencil primitive curve */
+ if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_primitive")) {
+ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
+ if ((gset) && (gset->cur_primitive == NULL)) {
+ gset->cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ curvemapping_initialize(gset->cur_primitive);
+ curvemap_reset(gset->cur_primitive->cm,
+ &gset->cur_primitive->clipr,
+ CURVE_PRESET_GAUSS,
+ CURVEMAP_SLOPE_POSITIVE);
+ }
+ }
+ }
}
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c34bf32d0cb..880180802d8 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1035,6 +1035,7 @@ typedef struct GP_Sculpt_Settings {
int weighttype; /* eGP_Sculpt_Types (weight paint) */
char pad[4];
struct CurveMapping *cur_falloff; /* multiframe edit falloff effect by frame */
+ struct CurveMapping *cur_primitive; /* Curve used for primitve tools */
} GP_Sculpt_Settings;
/* GP_Sculpt_Settings.flag */
@@ -1053,6 +1054,8 @@ typedef enum eGP_Sculpt_SettingsFlag {
GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 5),
/* apply brush to uv data */
GP_SCULPT_SETT_FLAG_APPLY_UV = (1 << 6),
+ /* apply primitve curve */
+ GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE = (1 << 7),
} eGP_Sculpt_SettingsFlag;
/* Settings for GP Interpolation Operators */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index d106e2db6eb..f7f336a8fef 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1250,6 +1250,12 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ prop = RNA_def_property(srna, "use_thickness_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE);
+ RNA_def_property_ui_text(prop, "Use Curve", "Use curvbe to define primitive stroke thickness");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
/* custom falloff curve */
prop = RNA_def_property(srna, "multiframe_falloff_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "cur_falloff");
@@ -1259,6 +1265,15 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ /* custom primitive curve */
+ prop = RNA_def_property(srna, "thickness_primitive_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cur_primitive");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve",
+ "Custom curve to control primitive thickness");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
/* lock axis */
prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "lock_axis");
More information about the Bf-blender-cvs
mailing list