Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/gpencil/gpencil_draw_utils.c
| Show First 20 Lines • Show All 1,864 Lines • ▼ Show 20 Lines | void gpencil_populate_multiedit(GPENCIL_e_data *e_data, | ||||
| Object *ob, | Object *ob, | ||||
| tGPencilObjectCache *cache_ob) | tGPencilObjectCache *cache_ob) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| bGPDframe *gpf = NULL; | bGPDframe *gpf = NULL; | ||||
| GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; | GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| Scene *scene = draw_ctx->scene; | |||||
| int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph); | int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph); | ||||
| GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval); | GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval); | ||||
| /* check if playing animation */ | /* check if playing animation */ | ||||
| const bool playing = stl->storage->is_playing; | const bool playing = stl->storage->is_playing; | ||||
| /* calc max size of VBOs */ | /* calc max size of VBOs */ | ||||
| gpencil_calc_vertex(stl, cache_ob, cache, gpd); | gpencil_calc_vertex(stl, cache_ob, cache, gpd); | ||||
| /* draw strokes */ | /* draw strokes */ | ||||
| for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { | for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { | ||||
| /* don't draw layer if hidden */ | /* don't draw layer if hidden */ | ||||
| if (gpl->flag & GP_LAYER_HIDE) { | if (gpl->flag & GP_LAYER_HIDE) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| const float alpha = GPENCIL_SIMPLIFY_TINT(scene, playing) ? 0.0f : gpl->tintcolor[3]; | |||||
| const float tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha}; | |||||
| /* list of frames to draw */ | /* list of frames to draw */ | ||||
| if (!playing) { | if (!playing) { | ||||
| for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { | for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { | ||||
| if ((gpf == gpl->actframe) || (gpf->flag & GP_FRAME_SELECT)) { | if ((gpf == gpl->actframe) || (gpf->flag & GP_FRAME_SELECT)) { | ||||
| gpencil_draw_strokes(cache, | gpencil_draw_strokes( | ||||
| e_data, | cache, e_data, vedata, ob, gpd, gpl, gpf, gpl->opacity, tintcolor, false, cache_ob); | ||||
| vedata, | |||||
| ob, | |||||
| gpd, | |||||
| gpl, | |||||
| gpf, | |||||
| gpl->opacity, | |||||
| gpl->tintcolor, | |||||
| false, | |||||
| cache_ob); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV); | gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV); | ||||
| if (gpf) { | if (gpf) { | ||||
| gpencil_draw_strokes(cache, | gpencil_draw_strokes( | ||||
| e_data, | cache, e_data, vedata, ob, gpd, gpl, gpf, gpl->opacity, tintcolor, false, cache_ob); | ||||
| vedata, | |||||
| ob, | |||||
| gpd, | |||||
| gpl, | |||||
| gpf, | |||||
| gpl->opacity, | |||||
| gpl->tintcolor, | |||||
| false, | |||||
| cache_ob); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* create batchs and shading groups */ | /* create batchs and shading groups */ | ||||
| gpencil_create_batches(cache); | gpencil_create_batches(cache); | ||||
| gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); | gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | if (!ID_IS_LINKED(&gpd->id)) { | ||||
| (gpd->id.us <= 1)) { | (gpd->id.us <= 1)) { | ||||
| if ((!stl->storage->is_render) || | if ((!stl->storage->is_render) || | ||||
| ((stl->storage->is_render) && (gpd->onion_flag & GP_ONION_GHOST_ALWAYS))) { | ((stl->storage->is_render) && (gpd->onion_flag & GP_ONION_GHOST_ALWAYS))) { | ||||
| gpencil_draw_onionskins(cache, vedata, ob, gpd, gpl, gpf); | gpencil_draw_onionskins(cache, vedata, ob, gpd, gpl, gpf); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* draw normal strokes */ | /* draw normal strokes */ | ||||
| const float alpha = GPENCIL_SIMPLIFY_TINT(scene, playing) ? 0.0f : gpl->tintcolor[3]; | |||||
| const float tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha}; | |||||
| gpencil_draw_strokes( | gpencil_draw_strokes( | ||||
| cache, e_data, vedata, ob, gpd, gpl, gpf_eval, opacity, gpl->tintcolor, false, cache_ob); | cache, e_data, vedata, ob, gpd, gpl, gpf_eval, opacity, tintcolor, false, cache_ob); | ||||
| } | } | ||||
| /* create batchs and shading groups */ | /* create batchs and shading groups */ | ||||
| gpencil_create_batches(cache); | gpencil_create_batches(cache); | ||||
| gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); | gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); | ||||
| cache->is_dirty = false; | cache->is_dirty = false; | ||||
| } | } | ||||
| Show All 23 Lines | |||||