Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_facemap_ops.c
| Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | static bool face_map_supported_edit_mode_poll(bContext *C) | ||||
| if (face_map_supported_poll(C)) { | if (face_map_supported_poll(C)) { | ||||
| if (ob->mode == OB_MODE_EDIT) { | if (ob->mode == OB_MODE_EDIT) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static bool face_map_supported_remove_poll(bContext *C) | |||||
| { | |||||
| if (!face_map_supported_poll(C)) { | |||||
| return false; | |||||
| } | |||||
| Object *ob = ED_object_context(C); | |||||
| bFaceMap *fmap = BLI_findlink(&ob->fmaps, ob->actfmap - 1); | |||||
| if (fmap) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| static int face_map_add_exec(bContext *C, wmOperator *UNUSED(op)) | static int face_map_add_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_object_context(C); | Object *ob = ED_object_context(C); | ||||
| BKE_object_facemap_add(ob); | BKE_object_facemap_add(ob); | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | ||||
| Show All 33 Lines | |||||
| void OBJECT_OT_face_map_remove(struct wmOperatorType *ot) | void OBJECT_OT_face_map_remove(struct wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Remove Face Map"; | ot->name = "Remove Face Map"; | ||||
| ot->idname = "OBJECT_OT_face_map_remove"; | ot->idname = "OBJECT_OT_face_map_remove"; | ||||
| ot->description = "Remove a face map from the active object"; | ot->description = "Remove a face map from the active object"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->poll = face_map_supported_poll; | ot->poll = face_map_supported_remove_poll; | ||||
| ot->exec = face_map_remove_exec; | ot->exec = face_map_remove_exec; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int face_map_assign_exec(bContext *C, wmOperator *UNUSED(op)) | static int face_map_assign_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines | |||||