[Bf-blender-cvs] [697ec7b55ef] greasepencil-refactor: GPencil: Patch old gradient materials and remove old variables
Antonio Vazquez
noreply at git.blender.org
Tue Feb 4 15:47:38 CET 2020
Commit: 697ec7b55efc4ce2f0c30ac75b3e2b8756e49583
Author: Antonio Vazquez
Date: Tue Feb 4 15:43:56 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB697ec7b55efc4ce2f0c30ac75b3e2b8756e49583
GPencil: Patch old gradient materials and remove old variables
===================================================================
M source/blender/blenloader/intern/versioning_280.c
M source/blender/makesdna/DNA_material_types.h
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 879a870f411..8468533d633 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4381,6 +4381,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
srgb_to_linearrgb_v4(gp_style->stroke_rgba, gp_style->stroke_rgba);
srgb_to_linearrgb_v4(gp_style->fill_rgba, gp_style->fill_rgba);
+ /* Move old gradient variables to texture. */
+ if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) {
+ gp_style->texture_angle = gp_style->gradient_angle;
+ copy_v2_v2(gp_style->texture_scale, gp_style->gradient_scale);
+ copy_v2_v2(gp_style->texture_offset, gp_style->gradient_shift);
+ }
/* Set Checker material as Solid. This fill mode has been removed and replaced
* by textures. */
if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_CHECKER) {
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 97d517b19b8..0db7feffa99 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -72,14 +72,14 @@ typedef struct MaterialGPencilStyle {
/** Factor used to define shader behavior (several uses). */
float mix_factor;
/** Angle used for gradients orientation. */
- float gradient_angle;
+ float gradient_angle DNA_DEPRECATED;
/** Radius for radial gradients. */
- float gradient_radius;
+ float gradient_radius DNA_DEPRECATED;
char _pad2[4];
/** Uv coordinates scale. */
- float gradient_scale[2];
+ float gradient_scale[2] DNA_DEPRECATED;
/** Factor to shift filling in 2d space. */
- float gradient_shift[2];
+ float gradient_shift[2] DNA_DEPRECATED;
/** Angle used for texture orientation. */
float texture_angle;
/** Texture scale (separated of uv scale). */
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index b46c3cf3400..4fb55f02645 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -499,33 +499,6 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mix", "Mix Stroke Factor");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
- /* Scale factor for uv coordinates */
- prop = RNA_def_property(srna, "pattern_scale", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "gradient_scale");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Scale", "Scale Factor for UV coordinates");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Shift factor to move pattern filling in 2d space */
- prop = RNA_def_property(srna, "pattern_shift", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "gradient_shift");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Shift", "Shift filling pattern in 2d space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Gradient angle */
- prop = RNA_def_property(srna, "pattern_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "gradient_angle");
- RNA_def_property_ui_text(prop, "Angle", "Pattern Orientation Angle");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Gradient radius */
- prop = RNA_def_property(srna, "pattern_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gradient_radius");
- RNA_def_property_range(prop, 0.0001f, 10.0f);
- RNA_def_property_ui_text(prop, "Radius", "Pattern Radius");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
/* Texture angle */
prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "texture_angle");
More information about the Bf-blender-cvs
mailing list