[Bf-blender-cvs] [dfbb13b5931] master: GPencil: Cleanup more comments (cont)

Antonio Vazquez noreply at git.blender.org
Fri Jul 3 13:52:08 CEST 2020


Commit: dfbb13b593126bd50b41c10b9671e6de0dc001fe
Author: Antonio Vazquez
Date:   Fri Jul 3 13:50:27 2020 +0200
Branches: master
https://developer.blender.org/rBdfbb13b593126bd50b41c10b9671e6de0dc001fe

GPencil: Cleanup more comments (cont)

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_modifier.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 3a0449dd4be..6a9511d8275 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -925,7 +925,11 @@ void BKE_gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
 /* ************************************************** */
 /* GP Layer API */
 
-/* Check if the given layer is able to be edited or not */
+/**
+ * Check if the given layer is able to be edited or not.
+ * \param gpl: Grease pencil layer
+ * \return True if layer is editable
+ */
 bool BKE_gpencil_layer_is_editable(const bGPDlayer *gpl)
 {
   /* Sanity check */
@@ -942,7 +946,12 @@ bool BKE_gpencil_layer_is_editable(const bGPDlayer *gpl)
   return false;
 }
 
-/* Look up the gp-frame on the requested frame number, but don't add a new one */
+/**
+ * Look up the gp-frame on the requested frame number, but don't add a new one.
+ * \param gpl: Grease pencil layer
+ * \param cframe: Frame number
+ * \return Pointer to frame
+ */
 bGPDframe *BKE_gpencil_layer_frame_find(bGPDlayer *gpl, int cframe)
 {
   bGPDframe *gpf;
@@ -959,9 +968,14 @@ bGPDframe *BKE_gpencil_layer_frame_find(bGPDlayer *gpl, int cframe)
   return NULL;
 }
 
-/* get the appropriate gp-frame from a given layer
+/** Get the appropriate gp-frame from a given layer
  * - this sets the layer's actframe var (if allowed to)
  * - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
+ *
+ * \param gpl: Grease pencil layer
+ * \param cframe: Frame number
+ * \param addnew: Add option
+ * \return Pointer to new frame
  */
 bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
 {
@@ -1117,7 +1131,12 @@ bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_
   return gpl->actframe;
 }
 
-/* delete the given frame from a layer */
+/**
+ * Delete the given frame from a layer.
+ * \param gpl: Grease pencil layer
+ * \param gpf: Grease pencil frame
+ * \return True if delete was done
+ */
 bool BKE_gpencil_layer_frame_delete(bGPDlayer *gpl, bGPDframe *gpf)
 {
   bool changed = false;
@@ -1141,6 +1160,12 @@ bool BKE_gpencil_layer_frame_delete(bGPDlayer *gpl, bGPDframe *gpf)
   return changed;
 }
 
+/**
+ * Get layer by name
+ * \param gpd: Grease pencil data-block
+ * \param name: Layer name
+ * \return Pointer to layer
+ */
 bGPDlayer *BKE_gpencil_layer_named_get(bGPdata *gpd, const char *name)
 {
   if (name[0] == '\0') {
@@ -1149,6 +1174,12 @@ bGPDlayer *BKE_gpencil_layer_named_get(bGPdata *gpd, const char *name)
   return BLI_findstring(&gpd->layers, name, offsetof(bGPDlayer, info));
 }
 
+/**
+ * Get mask layer by name.
+ * \param gpl: Grease pencil layer
+ * \param name: Mask name
+ * \return Pointer to mask layer
+ */
 bGPDlayer_Mask *BKE_gpencil_layer_mask_named_get(bGPDlayer *gpl, const char *name)
 {
   if (name[0] == '\0') {
@@ -1157,6 +1188,12 @@ bGPDlayer_Mask *BKE_gpencil_layer_mask_named_get(bGPDlayer *gpl, const char *nam
   return BLI_findstring(&gpl->mask_layers, name, offsetof(bGPDlayer_Mask, name));
 }
 
+/**
+ * Add grease pencil mask layer.
+ * \param gpl: Grease pencil layer
+ * \param name: Name of the mask
+ * \return Pointer to new mask layer
+ */
 bGPDlayer_Mask *BKE_gpencil_layer_mask_add(bGPDlayer *gpl, const char *name)
 {
 
@@ -1168,6 +1205,11 @@ bGPDlayer_Mask *BKE_gpencil_layer_mask_add(bGPDlayer *gpl, const char *name)
   return mask;
 }
 
+/**
+ * Remove grease pencil mask layer.
+ * \param gpl: Grease pencil layer
+ * \param mask: Grease pencil mask layer
+ */
 void BKE_gpencil_layer_mask_remove(bGPDlayer *gpl, bGPDlayer_Mask *mask)
 {
   BLI_freelinkN(&gpl->mask_layers, mask);
@@ -1175,6 +1217,11 @@ void BKE_gpencil_layer_mask_remove(bGPDlayer *gpl, bGPDlayer_Mask *mask)
   CLAMP_MIN(gpl->act_mask, 0);
 }
 
+/**
+ * Remove any reference to mask layer.
+ * \param gpd: Grease pencil data-block
+ * \param name: Name of the mask layer
+ */
 void BKE_gpencil_layer_mask_remove_ref(bGPdata *gpd, const char *name)
 {
   bGPDlayer_Mask *mask_next;
@@ -1206,6 +1253,11 @@ static int gpencil_cb_sort_masks(const void *arg1, const void *arg2)
   return val;
 }
 
+/**
+ * Sort grease pencil mask layers.
+ * \param gpd: Grease pencil data-block
+ * \param gpl: Grease pencil layer
+ */
 void BKE_gpencil_layer_mask_sort(bGPdata *gpd, bGPDlayer *gpl)
 {
   /* Update sort index. */
@@ -1221,6 +1273,10 @@ void BKE_gpencil_layer_mask_sort(bGPdata *gpd, bGPDlayer *gpl)
   BLI_listbase_sort(&gpl->mask_layers, gpencil_cb_sort_masks);
 }
 
+/**
+ * Sort all grease pencil mask layer.
+ * \param gpd: Grease pencil data-block
+ */
 void BKE_gpencil_layer_mask_sort_all(bGPdata *gpd)
 {
   LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
@@ -1249,12 +1305,21 @@ static int gpencil_cb_cmp_frame(void *thunk, const void *a, const void *b)
   return 0;
 }
 
+/**
+ * Sort grease pencil frames.
+ * \param gpl: Grease pencil layer
+ * \param r_has_duplicate_frames: Duplicated frames flag
+ */
 void BKE_gpencil_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames)
 {
   BLI_listbase_sort_r(&gpl->frames, gpencil_cb_cmp_frame, r_has_duplicate_frames);
 }
 
-/* get the active gp-layer for editing */
+/**
+ * Get the active grease pencil layer for editing.
+ * \param gpd: Grease pencil data-block
+ * \return Pointer to layer
+ */
 bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
 {
   /* error checking */
@@ -1273,7 +1338,11 @@ bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
   return NULL;
 }
 
-/* set the active gp-layer */
+/**
+ * Set active grease pencil layer.
+ * \param gpd: Grease pencil data-block
+ * \param active: Grease pencil layer to set as active
+ */
 void BKE_gpencil_layer_active_set(bGPdata *gpd, bGPDlayer *active)
 {
   /* error checking */
@@ -1296,7 +1365,11 @@ void BKE_gpencil_layer_active_set(bGPdata *gpd, bGPDlayer *active)
   }
 }
 
-/* Set locked layers for autolock mode. */
+/**
+ * Set locked layers for autolock mode.
+ * \param gpd: Grease pencil data-block
+ * \param unlock: Unlock flag
+ */
 void BKE_gpencil_layer_autolock_set(bGPdata *gpd, const bool unlock)
 {
   BLI_assert(gpd != NULL);
@@ -1327,7 +1400,11 @@ void BKE_gpencil_layer_autolock_set(bGPdata *gpd, const bool unlock)
   }
 }
 
-/* delete the active gp-layer */
+/**
+ * Delete grease pencil layer.
+ * \param gpd: Grease pencil data-block
+ * \param gpl: Grease pencil layer
+ */
 void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
 {
   /* error checking */
@@ -1350,6 +1427,11 @@ void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
   BLI_freelinkN(&gpd->layers, gpl);
 }
 
+/**
+ * Get grease pencil material from brush.
+ * \param brush: Brush
+ * \return Pointer to material
+ */
 Material *BKE_gpencil_brush_material_get(Brush *brush)
 {
   Material *ma = NULL;
@@ -1362,6 +1444,11 @@ Material *BKE_gpencil_brush_material_get(Brush *brush)
   return ma;
 }
 
+/**
+ * Set grease pencil brush material.
+ * \param brush: Brush
+ * \param ma: Material
+ */
 void BKE_gpencil_brush_material_set(Brush *brush, Material *ma)
 {
   BLI_assert(brush);
@@ -1377,7 +1464,13 @@ void BKE_gpencil_brush_material_set(Brush *brush, Material *ma)
   }
 }
 
-/* Adds the pinned material to the object if necessary. */
+/**
+ * Adds the pinned material to the object if necessary.
+ * \param bmain: Main pointer
+ * \param ob: Grease pencil object
+ * \param brush: Brush
+ * \return Pointer to material
+ */
 Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
 {
   if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
@@ -1397,7 +1490,13 @@ Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob,
   }
 }
 
-/* Assigns the material to object (if not already present) and returns its index (mat_nr). */
+/**
+ * Assigns the material to object (if not already present) and returns its index (mat_nr).
+ * \param bmain: Main pointer
+ * \param ob: Grease pencil object
+ * \param material: Material
+ * \return Index of the material
+ */
 int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *material)
 {
   if (!material) {
@@ -1414,8 +1513,11 @@ int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *materi
 
 /**
  * Creates a new gpencil material and assigns it to object.
- *
- * \param *r_index: value is set to zero based index of the new material if \a r_index is not NULL.
+ * \param bmain: Main pointer
+ * \param ob: Grease pencil object
+ * \param name: Material name
+ * \param r_index: value is set to zero based index of the new material if \a r_index is not NULL.
+ * \return Materil pointer
  */
 Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
 {
@@ -1431,7 +1533,12 @@ Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *n
   return ma;
 }
 
-/* Returns the material for a brush with respect to its pinned state. */
+/**
+ * Returns the material for a brush with respect to its pinned state.
+ * \param ob: Grease pencil object
+ * \param brush: Brush
+ * \return Material pointer
+ */
 Material *BKE_gpencil_object_material_from_brush_get(Object *ob, Brush *brush)
 {
   if ((brush) && (brush->gpencil_settings) &&
@@ -1444,7 +1551,12 @@ Material *BKE_gpencil_object_material_from_brush_get(Object *ob, Brush *brush)
   }
 }
 
-/* Returns the material index for a brush with respect to its pinned state. */
+/**
+ * Returns the material index for a brush with respect to its pinned state.
+ * \param ob: Grease pencil object
+ * \param brush: Brush
+ * \return Materil index
+ */
 int BKE_gpencil_object_material_get_index_from_brush(Object *ob, Brush *brush)
 {
   if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
@@ -1455,7 +1567,13 @@ int BKE_gpencil_object_material_get_index_from_brush(Object *ob, Brush *brush)
   }
 }
 
-/* Guaranteed to return a material assigned to object. Returns never NULL. */
+/**
+ * Guaranteed to return a material assigned to object. Returns never NULL.
+ * \param bmain: Main pointer
+ * \param ob: Grease pencil object
+ * \param ts: Toolsetting

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list