[Bf-blender-cvs] [49c73d4afc2] asset-greasepencil: GPencil: Cleanup unselect code

Antonio Vazquez noreply at git.blender.org
Mon Aug 2 15:51:41 CEST 2021


Commit: 49c73d4afc2cd0366dd946c95659f16892a0cc74
Author: Antonio Vazquez
Date:   Mon Aug 2 15:51:36 2021 +0200
Branches: asset-greasepencil
https://developer.blender.org/rB49c73d4afc2cd0366dd946c95659f16892a0cc74

GPencil: Cleanup unselect code

===================================================================

M	source/blender/editors/gpencil/gpencil_asset.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_asset.c b/source/blender/editors/gpencil/gpencil_asset.c
index 5010a4ccc11..d678bd4a8d1 100644
--- a/source/blender/editors/gpencil/gpencil_asset.c
+++ b/source/blender/editors/gpencil/gpencil_asset.c
@@ -305,6 +305,16 @@ static bool gpencil_asset_create(const bContext *C,
           }
         }
       }
+      /* Unselect all strokes and points. */
+      LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+        gps->flag &= ~GP_STROKE_SELECT;
+        bGPDspoint *pt;
+        int i;
+        for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+          pt->flag &= ~GP_SPOINT_SELECT;
+        }
+      }
+
       /* If Frame is empty, remove. */
       if (BLI_listbase_count(&gpf->strokes) == 0) {
         BKE_gpencil_layer_frame_delete(gpl, gpf);
@@ -356,19 +366,10 @@ static bool gpencil_asset_create(const bContext *C,
     int index = (is_animation) ? 1 : 0;
     BKE_asset_metadata_tag_ensure(gpd->id.asset_data, tags[index]);
 
-    /* Retime frame number to start by 1. Must be done after generate the render preview.
-     * Use same loop to deselect all. */
+    /* Retime frame number to start by 1. Must be done after generate the render preview. */
     LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
       LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
         gpf->framenum -= f_min - 1;
-        LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
-          gps->flag &= ~GP_STROKE_SELECT;
-          bGPDspoint *pt;
-          int i;
-          for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-            pt->flag &= ~GP_SPOINT_SELECT;
-          }
-        }
       }
     }
   }



More information about the Bf-blender-cvs mailing list