[Bf-blender-cvs] [a00fdc28986] greasepencil-refactor: GPencil: Patch old files color to Linear
Antonio Vazquez
noreply at git.blender.org
Fri Dec 20 10:43:36 CET 2019
Commit: a00fdc289863ee27b9c195e30a6a542e555f0296
Author: Antonio Vazquez
Date: Fri Dec 20 10:38:43 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBa00fdc289863ee27b9c195e30a6a542e555f0296
GPencil: Patch old files color to Linear
Still pending to review VFX and Modifiers.
===================================================================
M source/blender/blenloader/intern/versioning_280.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 18ee78f15f4..89bf1bec60d 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4347,12 +4347,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Update Grease Pencil Materials */
+ /* TODO: This requires version bump!! (we keep as is for testing). */
{
- for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+ LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
MaterialGPencilStyle *gp_style = mat->gp_style;
if (gp_style == NULL) {
continue;
}
+ /* Fix Grease Pencil Material colors to Linear. */
+ srgb_to_linearrgb_v4(gp_style->stroke_rgba, gp_style->stroke_rgba);
+ srgb_to_linearrgb_v4(gp_style->fill_rgba, gp_style->fill_rgba);
+
/* Set Checker material as Solid. This fill mode has been removed and replaced
* by textures. */
if (gp_style->fill_style == GP_STYLE_FILL_STYLE_CHECKER) {
@@ -4374,10 +4379,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
gp_style->mix_stroke_factor = 0.0f;
}
}
- }
- /* Fix Grease Pencil VFX*/
- {
+ /* Fix Grease Pencil VFX*/
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) {
switch (fx->type) {
@@ -4393,6 +4396,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Fix Layers Colors and Vertex Colors to Linear. */
+ LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ srgb_to_linearrgb_v4(gpl->tintcolor, gpl->tintcolor);
+
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ srgb_to_linearrgb_v4(gps->mix_color_fill, gps->mix_color_fill);
+ int i;
+ bGPDspoint *pt;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ srgb_to_linearrgb_v4(pt->mix_color, pt->mix_color);
+ }
+ }
+ }
+ }
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list