Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-09 10:22:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-09 11:09:13 +0300
commitf55026d46861a3cb0108ad3f7bab8ed0610f660d (patch)
tree5eef1d0cb4400250eec037f92b8e1147adad96eb /source/blender/editors/gpencil
parenteb9237eb20ccec08bce364db5f768b854a5bb440 (diff)
Cleanup: BKE_gpencil naming
- 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.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_old.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c4
10 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index cd28043a6fe..de6ecfefb2f 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -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);
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index c56cb94c58d..1107819a09a 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -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);
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 6b646566996..580d09cefc0 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -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;
}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index e3d57149d0f..710e8a9bc1c 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -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;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 99d37f87da7..e1eaedd435c 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -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);
}
}
}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 5922872070d..e13dfb38c7d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -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;
diff --git a/source/blender/editors/gpencil/gpencil_old.c b/source/blender/editors/gpencil/gpencil_old.c
index a5f552e411b..a6d63fadbd4 100644
--- a/source/blender/editors/gpencil/gpencil_old.c
+++ b/source/blender/editors/gpencil/gpencil_old.c
@@ -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;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d544bd8f9b6..daea24ecaa3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -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;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index f6571773706..f92398520fa 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -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");
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 6601bfe9d2f..bb3da77ffac 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -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;