Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| #include "MOD_gpencil_modifiertypes.h" | #include "MOD_gpencil_modifiertypes.h" | ||||
| static void initData(GpencilModifierData *md) | static void initData(GpencilModifierData *md) | ||||
| { | { | ||||
| TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; | TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; | ||||
| gpmd->pass_index = 0; | gpmd->pass_index = 0; | ||||
| gpmd->factor = 0.5f; | gpmd->factor = 0.5f; | ||||
| gpmd->layername[0] = '\0'; | gpmd->layername[0] = '\0'; | ||||
| gpmd->materialname[0] = '\0'; | |||||
| ARRAY_SET_ITEMS(gpmd->rgb, 1.0f, 1.0f, 1.0f); | ARRAY_SET_ITEMS(gpmd->rgb, 1.0f, 1.0f, 1.0f); | ||||
| gpmd->flag |= GP_TINT_CREATE_COLORS; | gpmd->flag |= GP_TINT_CREATE_COLORS; | ||||
| gpmd->modify_color = GP_MODIFY_COLOR_BOTH; | gpmd->modify_color = GP_MODIFY_COLOR_BOTH; | ||||
| } | } | ||||
| static void copyData(const GpencilModifierData *md, GpencilModifierData *target) | static void copyData(const GpencilModifierData *md, GpencilModifierData *target) | ||||
| { | { | ||||
| BKE_gpencil_modifier_copyData_generic(md, target); | BKE_gpencil_modifier_copyData_generic(md, target); | ||||
| } | } | ||||
| /* tint strokes */ | /* tint strokes */ | ||||
| static void deformStroke(GpencilModifierData *md, | static void deformStroke(GpencilModifierData *md, | ||||
| Depsgraph *UNUSED(depsgraph), | Depsgraph *UNUSED(depsgraph), | ||||
| Object *ob, | Object *ob, | ||||
| bGPDlayer *gpl, | bGPDlayer *gpl, | ||||
| bGPDframe *UNUSED(gpf), | bGPDframe *UNUSED(gpf), | ||||
| bGPDstroke *gps) | bGPDstroke *gps) | ||||
| { | { | ||||
| TintGpencilModifierData *mmd = (TintGpencilModifierData *)md; | TintGpencilModifierData *mmd = (TintGpencilModifierData *)md; | ||||
| if (!is_stroke_affected_by_modifier(ob, | if (!is_stroke_affected_by_modifier(ob, | ||||
| mmd->layername, | mmd->layername, | ||||
| mmd->materialname, | |||||
| mmd->pass_index, | mmd->pass_index, | ||||
| mmd->layer_pass, | mmd->layer_pass, | ||||
| 1, | 1, | ||||
| gpl, | gpl, | ||||
| gps, | gps, | ||||
| mmd->flag & GP_TINT_INVERT_LAYER, | mmd->flag & GP_TINT_INVERT_LAYER, | ||||
| mmd->flag & GP_TINT_INVERT_PASS, | mmd->flag & GP_TINT_INVERT_PASS, | ||||
| mmd->flag & GP_TINT_INVERT_LAYERPASS)) { | mmd->flag & GP_TINT_INVERT_LAYERPASS, | ||||
| mmd->flag & GP_TINT_INVERT_MATERIAL)) { | |||||
| return; | return; | ||||
| } | } | ||||
| if (mmd->modify_color != GP_MODIFY_COLOR_FILL) { | if (mmd->modify_color != GP_MODIFY_COLOR_FILL) { | ||||
| interp_v3_v3v3( | interp_v3_v3v3( | ||||
| gps->runtime.tmp_stroke_rgba, gps->runtime.tmp_stroke_rgba, mmd->rgb, mmd->factor); | gps->runtime.tmp_stroke_rgba, gps->runtime.tmp_stroke_rgba, mmd->rgb, mmd->factor); | ||||
| /* if factor is > 1, the alpha must be changed to get full tint */ | /* if factor is > 1, the alpha must be changed to get full tint */ | ||||
| if (mmd->factor > 1.0f) { | if (mmd->factor > 1.0f) { | ||||
| ▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines | |||||