Commit: ac4abb99e9a5a2da32bf606c703e219d98c047a2 Author: Antonio Vazquez Date: Mon Dec 30 19:44:30 2019 +0100 Branches: greasepencil-refactor https://developer.blender.org/rBac4abb99e9a5a2da32bf606c703e219d98c047a2
Merge branch 'greasepencil-object' into greasepencil-refactor Conflicts: source/blender/blenloader/intern/versioning_280.c =================================================================== =================================================================== diff --cc source/blender/blenloader/intern/versioning_280.c index 6da703fb6ac,1011f3e1043..55a0fb00963 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@@ -4347,121 -4345,10 +4347,127 @@@ void blo_do_versions_280(FileData *fd, } } + /* Update Grease Pencil Materials */ + /* TODO: This requires version bump!! (we keep as is for testing). */ + { + 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) { + gp_style->fill_style = GP_STYLE_FILL_STYLE_SOLID; + } + /* Update Alpha channel for texture opacity. */ + if (gp_style->fill_style == GP_STYLE_FILL_STYLE_TEXTURE) { + gp_style->fill_rgba[3] *= gp_style->texture_opacity; + } + /* Stroke stencil mask to mix = 1. */ + if (gp_style->flag & GP_STYLE_STROKE_PATTERN) { + gp_style->mix_stroke_factor = 1.0f; + gp_style->flag &= ~GP_STYLE_STROKE_PATTERN; + } + /* Mix disabled, set mix factor to 0. */ + else if ((gp_style->flag & GP_STYLE_STROKE_TEX_MIX) == 0) { + gp_style->mix_stroke_factor = 0.0f; + } + } + + /* Fix Grease Pencil VFX and modifiers. */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + if (ob->type != OB_GPENCIL) { + continue; + } + /* VFX. */ + LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) { + switch (fx->type) { + case eShaderFxType_Colorize: { + ColorizeShaderFxData *vfx = (ColorizeShaderFxData *)fx; + if (ELEM(vfx->mode, eShaderFxColorizeMode_GrayScale, eShaderFxColorizeMode_Sepia)) { + vfx->factor = 1.0f; + } + srgb_to_linearrgb_v4(vfx->low_color, vfx->low_color); + srgb_to_linearrgb_v4(vfx->high_color, vfx->high_color); + break; + } + case eShaderFxType_Pixel: { + PixelShaderFxData *vfx = (PixelShaderFxData *)fx; + srgb_to_linearrgb_v4(vfx->rgba, vfx->rgba); + break; + } + case eShaderFxType_Rim: { + RimShaderFxData *vfx = (RimShaderFxData *)fx; + srgb_to_linearrgb_v3_v3(vfx->rim_rgb, vfx->rim_rgb); + srgb_to_linearrgb_v3_v3(vfx->mask_rgb, vfx->mask_rgb); + break; + } + case eShaderFxType_Shadow: { + ShadowShaderFxData *vfx = (ShadowShaderFxData *)fx; + srgb_to_linearrgb_v4(vfx->shadow_rgba, vfx->shadow_rgba); + break; + } + case eShaderFxType_Glow: { + GlowShaderFxData *vfx = (GlowShaderFxData *)fx; + srgb_to_linearrgb_v3_v3(vfx->glow_color, vfx->glow_color); + srgb_to_linearrgb_v3_v3(vfx->select_color, vfx->select_color); + break; + } + default: + break; + } + } + + /* Modifiers. */ + LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) { + const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo(md->type); + switch (mti->type) { + case eGpencilModifierTypeType_Gpencil: { + TintGpencilModifierData *mmd = (TintGpencilModifierData *)md; + srgb_to_linearrgb_v3_v3(mmd->rgb, mmd->rgb); + break; + } + default: + break; + } + } + } + + /* Fix Layers Colors and Vertex Colors to Linear. */ + LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) { + if (gpd->flag & GP_DATA_ANNOTATIONS) { + continue; + } + /* Onion colors. */ + srgb_to_linearrgb_v3_v3(gpd->gcolor_prev, gpd->gcolor_prev); + srgb_to_linearrgb_v3_v3(gpd->gcolor_next, gpd->gcolor_next); + + 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); + } + } + } + } + } + } ++ + /* Brush cursor alpha */ + for (Brush *br = bmain->brushes.first; br; br = br->id.next) { + br->add_col[3] = 0.9f; + br->sub_col[3] = 0.9f; + } } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs