Cleanup: Rename function `create_new_layer_dialog`

* Renamed function to include `ED_gpencil_` prefix.
* Removed redundant `else`.
This commit is contained in:
Antonio Vazquez 2022-12-29 16:09:37 +01:00
parent f53bb93af9
commit 2bd8c67d10
4 changed files with 8 additions and 12 deletions

View File

@ -252,13 +252,11 @@ static int gpencil_layer_add_exec(bContext *C, wmOperator *op)
}
static int gpencil_layer_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
int tmp = create_new_layer_dialog(C, op);
const int tmp = ED_gpencil_new_layer_dialog(C, op);
if (tmp != 0) {
return tmp;
}
else {
return gpencil_layer_add_exec(C, op);
}
return gpencil_layer_add_exec(C, op);
}
void GPENCIL_OT_layer_add(wmOperatorType *ot)
{

View File

@ -1905,13 +1905,11 @@ static int gpencil_move_to_layer_exec(bContext *C, wmOperator *op)
static int gpencil_move_to_layer_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
int tmp = create_new_layer_dialog(C, op);
const int tmp = ED_gpencil_new_layer_dialog(C, op);
if (tmp != 0) {
return tmp;
}
else {
return gpencil_move_to_layer_exec(C, op);
}
return gpencil_move_to_layer_exec(C, op);
}
void GPENCIL_OT_move_to_layer(wmOperatorType *ot)

View File

@ -368,7 +368,7 @@ bool gpencil_active_layer_poll(struct bContext *C);
bool gpencil_active_brush_poll(struct bContext *C);
bool gpencil_brush_create_presets_poll(bContext *C);
int create_new_layer_dialog(bContext *C, wmOperator *op);
int ED_gpencil_new_layer_dialog(bContext *C, wmOperator *op);
/* Copy/Paste Buffer --------------------------------- */
/* gpencil_edit.c */

View File

@ -3356,7 +3356,7 @@ void ED_gpencil_layer_merge(bGPdata *gpd,
}
}
void layer_new_name_get(bGPdata *gpd, char *rname)
void gpencil_layer_new_name_get(bGPdata *gpd, char *rname)
{
int index = 0;
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
@ -3374,7 +3374,7 @@ void layer_new_name_get(bGPdata *gpd, char *rname)
MEM_freeN(name);
}
int create_new_layer_dialog(bContext *C, wmOperator *op)
int ED_gpencil_new_layer_dialog(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
PropertyRNA *prop;
@ -3383,7 +3383,7 @@ int create_new_layer_dialog(bContext *C, wmOperator *op)
if (!RNA_property_is_set(op->ptr, prop)) {
char name[MAX_NAME];
bGPdata *gpd = ob->data;
layer_new_name_get(gpd, name);
gpencil_layer_new_name_get(gpd, name);
RNA_property_string_set(op->ptr, prop, name);
return WM_operator_props_dialog_popup(C, op, 200);
}