GPencil: Rename old color operators to material

The color was used in old version when palettes were used, but now all are materials
This commit is contained in:
Antonio Vazquez
2020-03-17 18:29:18 +01:00
parent bf9c4af9bb
commit f1eb86c458
5 changed files with 66 additions and 66 deletions

View File

@@ -605,7 +605,7 @@ class GreasePencilMaterialsPanel:
col.separator()
col.menu("GPENCIL_MT_color_context_menu", icon='DOWNARROW_HLT', text="")
col.menu("GPENCIL_MT_material_context_menu", icon='DOWNARROW_HLT', text="")
if is_sortable:
col.separator()
@@ -616,8 +616,8 @@ class GreasePencilMaterialsPanel:
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.color_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
sub.operator("gpencil.color_isolate", icon='LOCKED', text="").affect_visibility = False
sub.operator("gpencil.material_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
sub.operator("gpencil.material_isolate", icon='LOCKED', text="").affect_visibility = False
if show_full_ui:
row = layout.row()

View File

@@ -27,21 +27,21 @@ from bl_ui.properties_grease_pencil_common import (
)
class GPENCIL_MT_color_context_menu(Menu):
class GPENCIL_MT_material_context_menu(Menu):
bl_label = "Material Specials"
def draw(self, _context):
layout = self.layout
layout.operator("gpencil.color_reveal", icon='RESTRICT_VIEW_OFF', text="Show All")
layout.operator("gpencil.color_hide", icon='RESTRICT_VIEW_ON', text="Hide Others").unselected = True
layout.operator("gpencil.material_reveal", icon='RESTRICT_VIEW_OFF', text="Show All")
layout.operator("gpencil.material_hide", icon='RESTRICT_VIEW_ON', text="Hide Others").unselected = True
layout.separator()
layout.operator("gpencil.color_lock_all", icon='LOCKED', text="Lock All")
layout.operator("gpencil.color_unlock_all", icon='UNLOCKED', text="UnLock All")
layout.operator("gpencil.material_lock_all", icon='LOCKED', text="Lock All")
layout.operator("gpencil.material_unlock_all", icon='UNLOCKED', text="UnLock All")
layout.operator("gpencil.stroke_lock_color", text="Lock Unselected")
layout.operator("gpencil.material_lock_unused", text="Lock Unselected")
layout.operator("gpencil.lock_layer", text="Lock Unused")
layout.separator()
@@ -261,7 +261,7 @@ class MATERIAL_PT_gpencil_material_presets(PresetPanel, Panel):
classes = (
GPENCIL_UL_matslots,
GPENCIL_MT_color_context_menu,
GPENCIL_MT_material_context_menu,
MATERIAL_PT_gpencil_slots,
MATERIAL_PT_gpencil_preview,
MATERIAL_PT_gpencil_material_presets,

View File

@@ -1599,7 +1599,7 @@ void GPENCIL_OT_stroke_change_color(wmOperatorType *ot)
/* ******************* Lock color of non selected Strokes colors ************************** */
static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
static int gp_material_lock_unsused_exec(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
@@ -1655,15 +1655,15 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
void GPENCIL_OT_stroke_lock_color(wmOperatorType *ot)
void GPENCIL_OT_material_lock_unused(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Lock Unused Colors";
ot->idname = "GPENCIL_OT_stroke_lock_color";
ot->description = "Lock any color not used in any selected stroke";
ot->name = "Lock Unused Materials";
ot->idname = "GPENCIL_OT_material_lock_unused";
ot->description = "Lock any material not used in any selected stroke";
/* api callbacks */
ot->exec = gp_stroke_lock_color_exec;
ot->exec = gp_material_lock_unsused_exec;
ot->poll = gp_active_layer_poll;
/* flags */
@@ -2757,7 +2757,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
}
/* Color Handle operator */
static bool gpencil_active_color_poll(bContext *C)
static bool gpencil_active_material_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
if (ob && ob->data && (ob->type == OB_GPENCIL)) {
@@ -2847,7 +2847,7 @@ void GPENCIL_OT_lock_layer(wmOperatorType *ot)
/* ********************** Isolate gpencil_ color **************************** */
static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
static int gpencil_material_isolate_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
Object *ob = CTX_data_active_object(C);
@@ -2929,17 +2929,17 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void GPENCIL_OT_color_isolate(wmOperatorType *ot)
void GPENCIL_OT_material_isolate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Isolate Color";
ot->idname = "GPENCIL_OT_color_isolate";
ot->name = "Isolate Material";
ot->idname = "GPENCIL_OT_material_isolate";
ot->description =
"Toggle whether the active color is the only one that is editable and/or visible";
"Toggle whether the active material is the only one that is editable and/or visible";
/* callbacks */
ot->exec = gpencil_color_isolate_exec;
ot->poll = gpencil_active_color_poll;
ot->exec = gpencil_material_isolate_exec;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2955,7 +2955,7 @@ void GPENCIL_OT_color_isolate(wmOperatorType *ot)
/* *********************** Hide colors ******************************** */
static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
static int gpencil_material_hide_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = (bGPdata *)ob->data;
@@ -3000,16 +3000,16 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void GPENCIL_OT_color_hide(wmOperatorType *ot)
void GPENCIL_OT_material_hide(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Hide Color(s)";
ot->idname = "GPENCIL_OT_color_hide";
ot->description = "Hide selected/unselected Grease Pencil colors";
ot->name = "Hide Material(s)";
ot->idname = "GPENCIL_OT_material_hide";
ot->description = "Hide selected/unselected Grease Pencil materials";
/* callbacks */
ot->exec = gpencil_color_hide_exec;
ot->poll = gpencil_active_color_poll; /* NOTE: we need an active color to play with */
ot->exec = gpencil_material_hide_exec;
ot->poll = gpencil_active_material_poll; /* NOTE: we need an active color to play with */
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3021,7 +3021,7 @@ void GPENCIL_OT_color_hide(wmOperatorType *ot)
/* ********************** Show All Colors ***************************** */
static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
static int gpencil_material_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = (bGPdata *)ob->data;
@@ -3056,16 +3056,16 @@ static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
void GPENCIL_OT_color_reveal(wmOperatorType *ot)
void GPENCIL_OT_material_reveal(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Show All Colors";
ot->idname = "GPENCIL_OT_color_reveal";
ot->description = "Unhide all hidden Grease Pencil colors";
ot->name = "Show All Materials";
ot->idname = "GPENCIL_OT_material_reveal";
ot->description = "Unhide all hidden Grease Pencil materials";
/* callbacks */
ot->exec = gpencil_color_reveal_exec;
ot->poll = gpencil_active_color_poll;
ot->exec = gpencil_material_reveal_exec;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3073,7 +3073,7 @@ void GPENCIL_OT_color_reveal(wmOperatorType *ot)
/* ***************** Lock/Unlock All colors ************************ */
static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
static int gpencil_material_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
@@ -3109,17 +3109,17 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
void GPENCIL_OT_color_lock_all(wmOperatorType *ot)
void GPENCIL_OT_material_lock_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Lock All Colors";
ot->idname = "GPENCIL_OT_color_lock_all";
ot->name = "Lock All Materials";
ot->idname = "GPENCIL_OT_material_lock_all";
ot->description =
"Lock all Grease Pencil colors to prevent them from being accidentally modified";
"Lock all Grease Pencil materials to prevent them from being accidentally modified";
/* callbacks */
ot->exec = gpencil_color_lock_all_exec;
ot->poll = gpencil_active_color_poll;
ot->exec = gpencil_material_lock_all_exec;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3127,7 +3127,7 @@ void GPENCIL_OT_color_lock_all(wmOperatorType *ot)
/* -------------------------- */
static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
static int gpencil_material_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = (bGPdata *)ob->data;
@@ -3162,16 +3162,16 @@ static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
void GPENCIL_OT_color_unlock_all(wmOperatorType *ot)
void GPENCIL_OT_material_unlock_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Unlock All Colors";
ot->idname = "GPENCIL_OT_color_unlock_all";
ot->description = "Unlock all Grease Pencil colors so that they can be edited";
ot->name = "Unlock All Materials";
ot->idname = "GPENCIL_OT_material_unlock_all";
ot->description = "Unlock all Grease Pencil materials so that they can be edited";
/* callbacks */
ot->exec = gpencil_color_unlock_all_exec;
ot->poll = gpencil_active_color_poll;
ot->exec = gpencil_material_unlock_all_exec;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3258,7 +3258,7 @@ void GPENCIL_OT_select_material(wmOperatorType *ot)
/* callbacks */
ot->exec = gpencil_select_material_exec;
ot->poll = gpencil_active_color_poll;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3310,7 +3310,7 @@ void GPENCIL_OT_set_active_material(wmOperatorType *ot)
/* callbacks */
ot->exec = gpencil_set_active_material_exec;
ot->poll = gpencil_active_color_poll;
ot->poll = gpencil_active_material_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

View File

@@ -491,7 +491,6 @@ enum {
void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_lock_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
@@ -547,11 +546,12 @@ void GPENCIL_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
/* color handle */
void GPENCIL_OT_lock_layer(struct wmOperatorType *ot);
void GPENCIL_OT_color_isolate(struct wmOperatorType *ot);
void GPENCIL_OT_color_hide(struct wmOperatorType *ot);
void GPENCIL_OT_color_reveal(struct wmOperatorType *ot);
void GPENCIL_OT_color_lock_all(struct wmOperatorType *ot);
void GPENCIL_OT_color_unlock_all(struct wmOperatorType *ot);
void GPENCIL_OT_material_isolate(struct wmOperatorType *ot);
void GPENCIL_OT_material_hide(struct wmOperatorType *ot);
void GPENCIL_OT_material_reveal(struct wmOperatorType *ot);
void GPENCIL_OT_material_lock_all(struct wmOperatorType *ot);
void GPENCIL_OT_material_unlock_all(struct wmOperatorType *ot);
void GPENCIL_OT_material_lock_unused(struct wmOperatorType *ot);
void GPENCIL_OT_select_material(struct wmOperatorType *ot);
void GPENCIL_OT_set_active_material(struct wmOperatorType *ot);

View File

@@ -608,7 +608,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_arrange);
WM_operatortype_append(GPENCIL_OT_stroke_change_color);
WM_operatortype_append(GPENCIL_OT_stroke_lock_color);
WM_operatortype_append(GPENCIL_OT_material_lock_unused);
WM_operatortype_append(GPENCIL_OT_stroke_apply_thickness);
WM_operatortype_append(GPENCIL_OT_stroke_cyclical_set);
WM_operatortype_append(GPENCIL_OT_stroke_caps_set);
@@ -648,11 +648,11 @@ void ED_operatortypes_gpencil(void)
/* color handle */
WM_operatortype_append(GPENCIL_OT_lock_layer);
WM_operatortype_append(GPENCIL_OT_color_isolate);
WM_operatortype_append(GPENCIL_OT_color_hide);
WM_operatortype_append(GPENCIL_OT_color_reveal);
WM_operatortype_append(GPENCIL_OT_color_lock_all);
WM_operatortype_append(GPENCIL_OT_color_unlock_all);
WM_operatortype_append(GPENCIL_OT_material_isolate);
WM_operatortype_append(GPENCIL_OT_material_hide);
WM_operatortype_append(GPENCIL_OT_material_reveal);
WM_operatortype_append(GPENCIL_OT_material_lock_all);
WM_operatortype_append(GPENCIL_OT_material_unlock_all);
WM_operatortype_append(GPENCIL_OT_select_material);
/* Editing (Time) --------------- */