[Bf-blender-cvs] [56a5ffbf08f] greasepencil-refactor: GPencil: Optimize evaluated frame copy
Antonio Vazquez
noreply at git.blender.org
Sun Feb 2 23:36:51 CET 2020
Commit: 56a5ffbf08f65cc23f82e2e03b85477c69c92f50
Author: Antonio Vazquez
Date: Sun Feb 2 23:36:41 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB56a5ffbf08f65cc23f82e2e03b85477c69c92f50
GPencil: Optimize evaluated frame copy
===================================================================
M source/blender/blenkernel/intern/gpencil_modifier.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index dd4d869c651..6eb4c4ea36d 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -766,32 +766,31 @@ static void gpencil_copy_activeframe_to_eval(
Depsgraph *depsgraph, Scene *scene, Object *ob, bGPdata *gpd_orig, bGPdata *gpd_eval)
{
- int layer_index = -1;
+ bGPDlayer *gpl_eval = gpd_eval->layers.first;
LISTBASE_FOREACH (bGPDlayer *, gpl_orig, &gpd_orig->layers) {
- layer_index++;
- int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl_orig);
- bGPDframe *gpf_orig = BKE_gpencil_layer_frame_get(gpl_orig, remap_cfra, GP_GETFRAME_USE_PREV);
- if (gpf_orig == NULL) {
- continue;
- }
- int gpf_index = BLI_findindex(&gpl_orig->frames, gpf_orig);
+ if (gpl_eval != NULL) {
+ int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl_orig);
- bGPDlayer *gpl_eval = BLI_findlink(&gpd_eval->layers, layer_index);
- if (gpl_eval == NULL) {
- continue;
- }
+ bGPDframe *gpf_orig = BKE_gpencil_layer_frame_get(
+ gpl_orig, remap_cfra, GP_GETFRAME_USE_PREV);
- bGPDframe *gpf_eval = BLI_findlink(&gpl_eval->frames, gpf_index);
+ if (gpf_orig != NULL) {
+ int gpf_index = BLI_findindex(&gpl_orig->frames, gpf_orig);
+ bGPDframe *gpf_eval = BLI_findlink(&gpl_eval->frames, gpf_index);
- if ((gpf_orig != NULL) && (gpf_eval != NULL)) {
- /* Delete old strokes. */
- BKE_gpencil_free_strokes(gpf_eval);
- /* Copy again strokes. */
- BKE_gpencil_frame_copy_strokes(gpf_orig, gpf_eval);
+ if (gpf_eval != NULL) {
+ /* Delete old strokes. */
+ BKE_gpencil_free_strokes(gpf_eval);
+ /* Copy again strokes. */
+ BKE_gpencil_frame_copy_strokes(gpf_orig, gpf_eval);
+
+ gpf_eval->runtime.gpf_orig = (bGPDframe *)gpf_orig;
+ BKE_gpencil_frame_original_pointers_update(gpf_orig, gpf_eval);
+ }
+ }
- gpf_eval->runtime.gpf_orig = (bGPDframe *)gpf_orig;
- BKE_gpencil_frame_original_pointers_update(gpf_orig, gpf_eval);
+ gpl_eval = gpl_eval->next;
}
}
}
More information about the Bf-blender-cvs
mailing list