Cleanup: BKE_gpencil naming
authorCampbell Barton <ideasman42@gmail.com>
Tue, 9 Apr 2019 07:22:46 +0000 (09:22 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 9 Apr 2019 08:09:13 +0000 (10:09 +0200)
- The ambiguous term 'handle' was used where 'ensure'
  is typically used (get or add when missing).
- Rename `current` to `active`, all `current` functions which were
  also ensuring.
- Clarify what is being operated on, using `BKE_gpencil_object_*` for
  objects, `BKE_gpencil_brush_*` for brushes.

16 files changed:
source/blender/blenkernel/BKE_gpencil.h
source/blender/blenkernel/intern/gpencil.c
source/blender/draw/engines/gpencil/gpencil_draw_utils.c
source/blender/draw/engines/gpencil/gpencil_engine.c
source/blender/editors/gpencil/gpencil_add_monkey.c
source/blender/editors/gpencil/gpencil_add_stroke.c
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_data.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_fill.c
source/blender/editors/gpencil/gpencil_old.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/gpencil/gpencil_primitive.c
source/blender/editors/gpencil/gpencil_utils.c
source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
source/blender/makesrna/intern/rna_brush.c

index e94ba27a8ea5c1319e870218f1275ec49ca7ec3d..a22d30a01fab9c12c87f49b84fb69d635fc8f042 100644 (file)
@@ -86,7 +86,6 @@ void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe
 /* materials */
 void BKE_gpencil_material_index_remove(struct bGPdata *gpd, int index);
 void BKE_gpencil_material_remap(struct bGPdata *gpd, const unsigned int *remap, unsigned int remap_len);
-int BKE_gpencil_get_material_index(struct Object *ob, struct Material *ma);
 
 /* statistics functions */
 void BKE_gpencil_stats_update(struct bGPdata *gpd);
@@ -131,23 +130,29 @@ struct bGPDlayer *BKE_gpencil_layer_getactive(struct bGPdata *gpd);
 void BKE_gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active);
 void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
 
-struct Material *BKE_gpencil_get_material_from_brush(struct Brush *brush);
-void BKE_gpencil_brush_set_material(struct Brush *brush, struct Material *material);
+/* Brush */
+struct Material *BKE_gpencil_brush_material_get(struct Brush *brush);
+void             BKE_gpencil_brush_material_set(struct Brush *brush, struct Material *material);
 
-struct Material *BKE_gpencil_handle_brush_material(struct Main *bmain, struct Object *ob, struct Brush *brush);
-int BKE_gpencil_handle_material(struct Main *bmain, struct Object *ob, struct Material *material);
+/* Object */
+struct Material *BKE_gpencil_object_material_ensure_active(struct Main *bmain, struct Object *ob);
+struct Material *BKE_gpencil_object_material_ensure_from_brush(struct Main *bmain, struct Object *ob, struct Brush *brush);
+int              BKE_gpencil_object_material_ensure(struct Main *bmain, struct Object *ob, struct Material *material);
 
-struct Material *BKE_gpencil_handle_new_material(struct Main *bmain, struct Object *ob, const char *name, int *r_index);
+struct Material *BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index);
 
-struct Material *BKE_gpencil_get_material_for_brush(struct Object *ob, struct Brush *brush);
-int BKE_gpencil_get_material_index_for_brush(struct Object *ob, struct Brush *brush);
+int              BKE_gpencil_object_material_get_index(struct Object *ob, struct Material *ma);
 
-struct Material *BKE_gpencil_current_input_toolsettings_material(struct Main *bmain, struct Object *ob, struct ToolSettings *ts);
-struct Material *BKE_gpencil_current_input_brush_material(struct Main *bmain, struct Object *ob, struct Brush *brush);
-struct Material *BKE_gpencil_current_input_material(struct Main *bmain, struct Object *ob);
+struct Material *BKE_gpencil_object_material_get_from_brush(struct Object *ob, struct Brush *brush);
+int              BKE_gpencil_object_material_get_index_from_brush(struct Object *ob, struct Brush *brush);
 
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_toolsettings(
+        struct Main *bmain, struct Object *ob, struct ToolSettings *ts);
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_brush(
+        struct Main *bmain, struct Object *ob, struct Brush *brush);
+struct Material *BKE_gpencil_object_material_ensure_from_active_input_material(
+        struct Main *bmain, struct Object *ob);
 
-struct Material *BKE_gpencil_material_ensure(struct Main *bmain, struct Object *ob);
 
 /* object boundbox */
 bool BKE_gpencil_data_minmax(
index 2ef8568e308ddde142791801aaff614b60e63d4a..7109764faabfd6a675c820c76619ba83c06fbc37 100644 (file)
@@ -985,7 +985,7 @@ void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
        BLI_freelinkN(&gpd->layers, gpl);
 }
 
-Material *BKE_gpencil_get_material_from_brush(Brush *brush)
+Material *BKE_gpencil_brush_material_get(Brush *brush)
 {
        Material *ma = NULL;
 
@@ -998,7 +998,7 @@ Material *BKE_gpencil_get_material_from_brush(Brush *brush)
        return ma;
 }
 
-void BKE_gpencil_brush_set_material(Brush *brush, Material *ma)
+void BKE_gpencil_brush_material_set(Brush *brush, Material *ma)
 {
        BLI_assert(brush);
        BLI_assert(brush->gpencil_settings);
@@ -1014,13 +1014,13 @@ void BKE_gpencil_brush_set_material(Brush *brush, Material *ma)
 }
 
 /* Adds the pinned material to the object if necessary. */
-Material *BKE_gpencil_handle_brush_material(Main *bmain, Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
 {
        if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
-               Material *ma = BKE_gpencil_get_material_from_brush(brush);
+               Material *ma = BKE_gpencil_brush_material_get(brush);
 
                /* check if the material is already on object material slots and add it if missing */
-               if (ma && BKE_gpencil_get_material_index(ob, ma) < 0) {
+               if (ma && BKE_gpencil_object_material_get_index(ob, ma) < 0) {
                        BKE_object_material_slot_add(bmain, ob);
                        assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF);
                }
@@ -1034,12 +1034,12 @@ Material *BKE_gpencil_handle_brush_material(Main *bmain, Object *ob, Brush *brus
 }
 
 /* Assigns the material to object (if not already present) and returns its index (mat_nr). */
-int BKE_gpencil_handle_material(Main *bmain, Object *ob, Material *material)
+int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *material)
 {
        if (!material) {
                return -1;
        }
-       int index = BKE_gpencil_get_material_index(ob, material);
+       int index = BKE_gpencil_object_material_get_index(ob, material);
        if (index < 0) {
                BKE_object_material_slot_add(bmain, ob);
                assign_material(bmain, ob, material, ob->totcol, BKE_MAT_ASSIGN_USERPREF);
@@ -1052,7 +1052,7 @@ int BKE_gpencil_handle_material(Main *bmain, Object *ob, Material *material)
  *
  * \param *r_index: value is set to zero based index of the new material if r_index is not NULL
  */
-Material *BKE_gpencil_handle_new_material(Main *bmain, Object *ob, const char *name, int *r_index)
+Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
 {
        Material *ma = BKE_material_add_gpencil(bmain, name);
        id_us_min(&ma->id); /* no users yet */
@@ -1067,10 +1067,10 @@ Material *BKE_gpencil_handle_new_material(Main *bmain, Object *ob, const char *n
 }
 
 /* Returns the material for a brush with respect to its pinned state. */
-Material *BKE_gpencil_get_material_for_brush(Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_get_from_brush(Object *ob, Brush *brush)
 {
        if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
-               Material *ma = BKE_gpencil_get_material_from_brush(brush);
+               Material *ma = BKE_gpencil_brush_material_get(brush);
                return ma;
        }
        else {
@@ -1079,10 +1079,10 @@ Material *BKE_gpencil_get_material_for_brush(Object *ob, Brush *brush)
 }
 
 /* Returns the material index for a brush with respect to its pinned state. */
-int BKE_gpencil_get_material_index_for_brush(Object *ob, Brush *brush)
+int BKE_gpencil_object_material_get_index_from_brush(Object *ob, Brush *brush)
 {
        if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
-               return BKE_gpencil_get_material_index(ob, brush->gpencil_settings->material);
+               return BKE_gpencil_object_material_get_index(ob, brush->gpencil_settings->material);
        }
        else {
                return ob->actcol - 1;
@@ -1090,21 +1090,21 @@ int BKE_gpencil_get_material_index_for_brush(Object *ob, Brush *brush)
 }
 
 /* Guaranteed to return a material assigned to object. Returns never NULL. */
-Material *BKE_gpencil_current_input_toolsettings_material(Main *bmain, Object *ob, ToolSettings *ts)
+Material *BKE_gpencil_object_material_ensure_from_active_input_toolsettings(Main *bmain, Object *ob, ToolSettings *ts)
 {
        if (ts && ts->gp_paint && ts->gp_paint->paint.brush) {
-               return BKE_gpencil_current_input_brush_material(bmain, ob, ts->gp_paint->paint.brush);
+               return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, ts->gp_paint->paint.brush);
        }
        else {
-               return BKE_gpencil_current_input_brush_material(bmain, ob, NULL);
+               return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, NULL);
        }
 }
 
 /* Guaranteed to return a material assigned to object. Returns never NULL. */
-Material *BKE_gpencil_current_input_brush_material(Main *bmain, Object *ob, Brush *brush)
+Material *BKE_gpencil_object_material_ensure_from_active_input_brush(Main *bmain, Object *ob, Brush *brush)
 {
        if (brush) {
-               Material *ma = BKE_gpencil_handle_brush_material(bmain, ob, brush);
+               Material *ma = BKE_gpencil_object_material_ensure_from_brush(bmain, ob, brush);
                if (ma) {
                        return ma;
                }
@@ -1113,21 +1113,21 @@ Material *BKE_gpencil_current_input_brush_material(Main *bmain, Object *ob, Brus
                        brush->gpencil_settings->flag &= ~GP_BRUSH_MATERIAL_PINNED;
                }
        }
-       return BKE_gpencil_current_input_material(bmain, ob);
+       return BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob);
 }
 
 /* Guaranteed to return a material assigned to object. Returns never NULL. Only use this for materials unrelated to user input */
-Material *BKE_gpencil_current_input_material(Main *bmain, Object *ob)
+Material *BKE_gpencil_object_material_ensure_from_active_input_material(Main *bmain, Object *ob)
 {
        Material *ma = give_current_material(ob, ob->actcol);
        if (ma) {
                return ma;
        }
-       return BKE_gpencil_handle_new_material(bmain, ob, "Material", NULL);
+       return BKE_gpencil_object_material_new(bmain, ob, "Material", NULL);
 }
 
 /* Get active color, and add all default settings if we don't find anything */
-Material *BKE_gpencil_material_ensure(Main *bmain, Object *ob)
+Material *BKE_gpencil_object_material_ensure_active(Main *bmain, Object *ob)
 {
        Material *ma = NULL;
 
@@ -1135,7 +1135,7 @@ Material *BKE_gpencil_material_ensure(Main *bmain, Object *ob)
        if (ELEM(NULL, bmain, ob))
                return NULL;
 
-       ma = BKE_gpencil_current_input_material(bmain, ob);
+       ma = BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob);
        if (ma->gp_style == NULL) {
                BKE_material_init_gpencil_settings(ma);
        }
@@ -1662,7 +1662,7 @@ void BKE_gpencil_stats_update(bGPdata *gpd)
 }
 
 /* get material index (0-based like mat_nr not actcol) */
-int BKE_gpencil_get_material_index(Object *ob, Material *ma)
+int BKE_gpencil_object_material_get_index(Object *ob, Material *ma)
 {
        short *totcol = give_totcolp(ob);
        Material *read_ma = NULL;
index 475a083ac97c6a7ea65ee791a39108facc01795c..6aefd2a69c56cdcd4c5faa7f14c1ffd9ad70e7c0 100644 (file)
@@ -1355,7 +1355,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
        float obscale = mat4_to_scale(ob->obmat);
 
        /* use the brush material */
-       Material *ma = BKE_gpencil_get_material_for_brush(ob, brush);
+       Material *ma = BKE_gpencil_object_material_get_from_brush(ob, brush);
        if (ma != NULL) {
                gp_style = ma->gp_style;
        }
index 1defef334df778b62c0fe3696984afcef5638a95..56ef4b97dcffc87f78677040aeba8e2065e79350 100644 (file)
@@ -316,7 +316,7 @@ void GPENCIL_cache_init(void *vedata)
        if (obact && (obact->type == OB_GPENCIL) && (obact->data)) {
                obact_gpd = (bGPdata *)obact->data;
                /* use the brush material */
-               Material *ma = BKE_gpencil_get_material_for_brush(obact, brush);
+               Material *ma = BKE_gpencil_object_material_get_from_brush(obact, brush);
                if (ma != NULL) {
                        gp_style = ma->gp_style;
                }
index cd28043a6fec58bf9985dc0d03e4705e63ad68f7..de6ecfefb2f644bc82b8ed47d64abe6bd25e362a 100644 (file)
@@ -63,7 +63,7 @@ static int gpencil_monkey_color(
        int idx;
 
        /* create a new one */
-       ma = BKE_gpencil_handle_new_material(bmain, ob, pct->name, &idx);
+       ma = BKE_gpencil_object_material_new(bmain, ob, pct->name, &idx);
 
        copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
        copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
index c56cb94c58daf31524c218a4f4352dad7658fb4e..1107819a09a2320fea75738138fdacff1aa0e9df 100644 (file)
@@ -63,7 +63,7 @@ static int gp_stroke_material(
        int idx;
 
        /* create a new one */
-       ma = BKE_gpencil_handle_new_material(bmain, ob, pct->name, &idx);
+       ma = BKE_gpencil_object_material_new(bmain, ob, pct->name, &idx);
 
        copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
        copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
index 6b64656699637d8fb553ad48db648ab8f0577a21..580d09cefc0adc0657cff69059f3bdd1a8a8895b 100644 (file)
@@ -1101,7 +1101,7 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
 
                        /* Fix color references */
                        Material *ma = BLI_ghash_lookup(data->new_colors, &new_stroke->mat_nr);
-                       gps->mat_nr = BKE_gpencil_get_material_index(ob, ma);
+                       gps->mat_nr = BKE_gpencil_object_material_get_index(ob, ma);
                        if (!ma || gps->mat_nr) {
                                gps->mat_nr = 0;
                        }
index e3d57149d0f92ec1b6b1f57bee47428a4ee6b6bb..710e8a9bc1c10b280884b20aa702fae4f0b36eda 100644 (file)
@@ -521,7 +521,7 @@ static int gp_layer_duplicate_object_exec(bContext *C, wmOperator *op)
                         * otherwise add the slot with the material
                         */
                        Material *ma_src = give_current_material(ob_src, gps_src->mat_nr + 1);
-                       int idx = BKE_gpencil_handle_material(bmain, ob_dst, ma_src);
+                       int idx = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma_src);
 
                        /* reasign the stroke material to the right slot in destination object */
                        gps_dst->mat_nr = idx;
@@ -1379,7 +1379,7 @@ static int gp_stroke_change_color_exec(bContext *C, wmOperator *op)
                }
        }
        /* try to find slot */
-       int idx = BKE_gpencil_get_material_index(ob, ma);
+       int idx = BKE_gpencil_object_material_get_index(ob, ma);
        if (idx < 0) {
                return OPERATOR_CANCELLED;
        }
@@ -2054,7 +2054,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
 
                                for (short i = 0; i < *totcol; i++) {
                                        Material *tmp_ma = give_current_material(ob_src, i + 1);
-                                       BKE_gpencil_handle_material(bmain, ob_dst, tmp_ma);
+                                       BKE_gpencil_object_material_ensure(bmain, ob_dst, tmp_ma);
                                }
 
                                /* duplicate bGPDlayers  */
@@ -2089,7 +2089,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
 
                                                        /* reasign material. Look old material and try to find in dst */
                                                        ma_src = give_current_material(ob_src, gps->mat_nr + 1);
-                                                       gps->mat_nr = BKE_gpencil_handle_material(bmain, ob_dst, ma_src);
+                                                       gps->mat_nr = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma_src);
 
                                                        bGPDspoint *pt;
                                                        int i;
index 99d37f87da790f58dfa6c7af0d6cae68cf6e39dd..e1eaedd435cfe5666a97f7abbd8bd57960f9729a 100644 (file)
@@ -1080,7 +1080,7 @@ GHash *gp_copybuf_validate_colormap(bContext *C)
                char *ma_name = BLI_ghashIterator_getValue(&gh_iter);
                Material *ma = BLI_ghash_lookup(name_to_ma, ma_name);
 
-               BKE_gpencil_handle_material(bmain, ob, ma);
+               BKE_gpencil_object_material_ensure(bmain, ob, ma);
 
                /* Store this mapping (for use later when pasting) */
                if (!BLI_ghash_haskey(new_colors, POINTER_FROM_INT(*key))) {
@@ -1334,7 +1334,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
 
                                /* Remap material */
                                Material *ma = BLI_ghash_lookup(new_colors, POINTER_FROM_INT(new_stroke->mat_nr));
-                               new_stroke->mat_nr = BKE_gpencil_get_material_index(ob, ma);
+                               new_stroke->mat_nr = BKE_gpencil_object_material_get_index(ob, ma);
                                BLI_assert(new_stroke->mat_nr >= 0); /* have to add the material first */
                        }
                }
@@ -3957,7 +3957,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
 
                                                        /* add duplicate materials */
                                                        ma = give_current_material(ob, gps->mat_nr + 1); /* XXX same material can be in multiple slots */
-                                                       idx = BKE_gpencil_handle_material(bmain, ob_dst, ma);
+                                                       idx = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma);
 
                                                        /* selected points mode */
                                                        if (mode == GP_SEPARATE_POINT) {
@@ -4029,7 +4029,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
                                                continue;
                                        }
                                        ma = give_current_material(ob, gps->mat_nr + 1);
-                                       gps->mat_nr = BKE_gpencil_handle_material(bmain, ob_dst, ma);
+                                       gps->mat_nr = BKE_gpencil_object_material_ensure(bmain, ob_dst, ma);
                                }
                        }
                }
index 5922872070d7a11b6f01c24c628498ac2be2230a..e13dfb38c7ddc81ea2e415db2ce213801a6f0a32 100644 (file)
@@ -1017,7 +1017,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
        gps->flag |= GP_STROKE_CYCLIC;
        gps->flag |= GP_STROKE_3DSPACE;
 
-       gps->mat_nr = BKE_gpencil_handle_material(tgpf->bmain, tgpf->ob, tgpf->mat);
+       gps->mat_nr = BKE_gpencil_object_material_ensure(tgpf->bmain, tgpf->ob, tgpf->mat);
 
        /* allocate memory for storage points */
        gps->totpoints = tgpf->sbuffer_size;
@@ -1222,7 +1222,7 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
        int totcol = tgpf->ob->totcol;
 
        /* get color info */
-       Material *ma = BKE_gpencil_current_input_brush_material(bmain, tgpf->ob, brush);
+       Material *ma = BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, tgpf->ob, brush);
 
        tgpf->mat = ma;
 
index a5f552e411b375d6655017cc096c40d38df2a7f9..a6d63fadbd428d30ab71d103f0b2c42105500ac4 100644 (file)
@@ -112,7 +112,7 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
                        for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
 
                                /* create material slot */
-                               Material *ma = BKE_gpencil_handle_new_material(bmain, ob, palcolor->info, NULL);
+                               Material *ma = BKE_gpencil_object_material_new(bmain, ob, palcolor->info, NULL);
 
                                /* copy color settings */
                                MaterialGPencilStyle *gp_style = ma->gp_style;
index d544bd8f9b648986ecb593f29d601fe8ebeeda22..daea24ecaa3253d1cdd0b68c73b50fa7db7e377f 100644 (file)
@@ -1223,7 +1223,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
        }
 
        /* Save material index */
-       gps->mat_nr = BKE_gpencil_get_material_index_for_brush(p->ob, p->brush);
+       gps->mat_nr = BKE_gpencil_object_material_get_index_from_brush(p->ob, p->brush);
 
        /* calculate UVs along the stroke */
        ED_gpencil_calc_stroke_uv(obact, gps);
@@ -1832,7 +1832,7 @@ static void gp_init_colors(tGPsdata *p)
        MaterialGPencilStyle *gp_style = NULL;
 
        /* use brush material */
-       p->material = BKE_gpencil_current_input_brush_material(p->bmain, p->ob, brush);
+       p->material = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
 
        /* assign color information to temp tGPsdata */
        gp_style = p->material->gp_style;
index f657177370624a8a6f2c4dc06dda848711eaf301..f92398520fa4a6891472f8e163f118261d4f6519 100644 (file)
@@ -140,7 +140,7 @@ static void gp_init_colors(tGPDprimitive *p)
        MaterialGPencilStyle *gp_style = NULL;
 
        /* use brush material */
-       p->mat = BKE_gpencil_current_input_brush_material(p->bmain, p->ob, brush);
+       p->mat = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
 
        /* assign color information to temp data */
        gp_style = p->mat->gp_style;
@@ -331,7 +331,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
 
        gps->flag |= GP_STROKE_3DSPACE;
 
-       gps->mat_nr = BKE_gpencil_get_material_index(tgpi->ob, tgpi->mat);
+       gps->mat_nr = BKE_gpencil_object_material_get_index(tgpi->ob, tgpi->mat);
 
        /* allocate memory for storage points, but keep empty */
        gps->totpoints = 0;
@@ -1111,7 +1111,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
        tgpi->gpd->runtime.tot_cp_points = 0;
 
        /* getcolor info */
-       tgpi->mat = BKE_gpencil_current_input_toolsettings_material(bmain, tgpi->ob, ts);
+       tgpi->mat = BKE_gpencil_object_material_ensure_from_active_input_toolsettings(bmain, tgpi->ob, ts);
 
        /* set parameters */
        tgpi->type = RNA_enum_get(op->ptr, "type");
index 6601bfe9d2f02940880ca8c2d6bcb2f7712243b2..bb3da77ffac6d44841071856fc78cdf9e38fd878 100644 (file)
@@ -1332,7 +1332,7 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob)
        }
 
        /* ensure a color exists and is assigned to object */
-       BKE_gpencil_current_input_toolsettings_material(bmain, ob, ts);
+       BKE_gpencil_object_material_ensure_from_active_input_toolsettings(bmain, ob, ts);
 
        /* ensure multiframe falloff curve */
        if (ts->gp_sculpt.cur_falloff == NULL) {
@@ -1701,7 +1701,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
                }
 
                /* get current drawing color */
-               ma = BKE_gpencil_get_material_for_brush(ob, brush);
+               ma = BKE_gpencil_object_material_get_from_brush(ob, brush);
 
                if (ma) {
                        gp_style = ma->gp_style;
index cc6d316bd3a2810adb1be2ade9b4b412f52a8efa..c66580cd5d4d5b8e04a3b330a0b61ccab8a9c8b7 100644 (file)
@@ -188,7 +188,7 @@ void gpencil_apply_modifier_material(
                        DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
                }
                /* reasign color index */
-               int idx = BKE_gpencil_get_material_index(ob, newmat);
+               int idx = BKE_gpencil_object_material_get_index(ob, newmat);
                gps->mat_nr = idx - 1;
        }
        else {
index a5f43a580c552a8684c2728a527df14b55666a51..ce5b18331c69a4f3a68bab77c695d186c14a6574 100644 (file)
@@ -713,10 +713,10 @@ static void rna_BrushGpencilSettings_use_material_pin_update(bContext *C, Pointe
 
        if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
                Material *material = give_current_material(ob, ob->actcol);
-               BKE_gpencil_brush_set_material(brush, material);
+               BKE_gpencil_brush_material_set(brush, material);
        }
        else {
-               BKE_gpencil_brush_set_material(brush, NULL);
+               BKE_gpencil_brush_material_set(brush, NULL);
        }
 
        /* number of material users changed */