60 ot->name =
"Show All Materials";
61 ot->idname =
"GREASE_PENCIL_OT_material_reveal";
62 ot->description =
"Unhide all hidden Grease Pencil materials";
84 const int material_index =
object->actcol - 1;
87 if (
invert &&
i == material_index) {
90 if (!
invert &&
i != material_index) {
112 ot->name =
"Hide Materials";
113 ot->idname =
"GREASE_PENCIL_OT_material_hide";
114 ot->description =
"Hide active/inactive Grease Pencil material(s)";
124 ot->srna,
"invert",
false,
"Invert",
"Hide inactive materials instead of the active one");
138 bool changed =
false;
159 ot->name =
"Lock All Materials";
160 ot->idname =
"GREASE_PENCIL_OT_material_lock_all";
162 "Lock all Grease Pencil materials to prevent them from being accidentally modified";
182 bool changed =
false;
203 ot->name =
"Unlock All Materials";
204 ot->idname =
"GREASE_PENCIL_OT_material_unlock_all";
205 ot->description =
"Unlock all Grease Pencil materials so that they can be edited";
225 bool changed =
false;
247 ot->name =
"Lock Unused Materials";
248 ot->idname =
"GREASE_PENCIL_OT_material_lock_unused";
249 ot->description =
"Lock and hide any material not used";
274 bool changed =
false;
282 *
object, info.drawing, info.layer_index, memory);
291 if (
const std::optional<int> single = material_indices.
get_if_single()) {
292 materials_used.
add(*single);
324 ot->name =
"Lock Unselected Materials";
325 ot->idname =
"GREASE_PENCIL_OT_material_lock_unselected";
326 ot->description =
"Lock any material not used in any selected stroke";
350 if (ma_active ==
nullptr) {
361 if (only_active && ma_src != ma_active) {
365 if (ma_src ==
nullptr) {
386 ot->name =
"Copy Materials to Selected Object";
387 ot->idname =
"GREASE_PENCIL_OT_material_copy_to_object";
388 ot->description =
"Append Materials of the active Grease Pencil to other object";
400 "Append only active material, uncheck to append all materials");
414 bool isolate =
false;
420 if (active_material ==
nullptr) {
427 for (
short i = 0;
i < *totcol;
i++) {
430 if (
ELEM(ma,
nullptr, active_ma)) {
438 if ((gp_style->
flag & flags) == 0) {
447 for (
short i = 0;
i < *totcol;
i++) {
453 if (gp_style == active_material) {
456 gp_style->
flag |= flags;
462 for (
short i = 0;
i < *totcol;
i++) {
468 gp_style->
flag &= ~flags;
482 ot->name =
"Isolate Material";
483 ot->idname =
"GREASE_PENCIL_OT_material_isolate";
485 "Toggle whether the active material is the only one that is editable and/or visible";
499 "In addition to toggling "
500 "the editability, also affect the visibility");
#define CTX_DATA_BEGIN(C, Type, instance, member)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
Low-level operations for curves.
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
short * BKE_object_material_len_p(Object *ob)
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
Material * BKE_gpencil_material(Object *ob, short act)
bool BKE_object_material_slot_used(Object *object, short actcol)
int BKE_object_material_ensure(Main *bmain, Object *ob, Material *material)
Material * BKE_object_material_get(Object *ob, short act)
void DEG_id_tag_update(ID *id, unsigned int flags)
bool contains(const Key &key) const
std::optional< T > get_if_single() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
void foreach_index(Fn &&fn) const
void ED_operatortypes_grease_pencil_material()
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
bool active_grease_pencil_poll(bContext *C)
IndexMask retrieve_editable_and_selected_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static void GREASE_PENCIL_OT_material_lock_unused(wmOperatorType *ot)
static void GREASE_PENCIL_OT_material_copy_to_object(wmOperatorType *ot)
static void GREASE_PENCIL_OT_material_unlock_all(wmOperatorType *ot)
static void GREASE_PENCIL_OT_material_lock_unselected(wmOperatorType *ot)
static void GREASE_PENCIL_OT_material_isolate(wmOperatorType *ot)
static void GREASE_PENCIL_OT_material_lock_all(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_material_lock_unused_exec(bContext *C, wmOperator *)
static wmOperatorStatus material_isolate_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_material_hide(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_material_unlock_all_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_material_reveal_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_material_lock_unselected_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_material_copy_to_object_exec(bContext *C, wmOperator *op)
static wmOperatorStatus grease_pencil_material_lock_all_exec(bContext *C, wmOperator *)
bool active_grease_pencil_material_poll(bContext *C)
Vector< MutableDrawingInfo > retrieve_editable_drawings(const Scene &scene, GreasePencil &grease_pencil)
static void GREASE_PENCIL_OT_material_reveal(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_material_hide_exec(bContext *C, wmOperator *op)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct MaterialGPencilStyle * gp_style
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))