Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_edit.c
| Show First 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | void ED_object_editmode_exit(bContext *C, int flag) | ||||
| if (flag & EM_WAITCURSOR) waitcursor(0); | if (flag & EM_WAITCURSOR) waitcursor(0); | ||||
| } | } | ||||
| void ED_object_editmode_enter(bContext *C, int flag) | void ED_object_editmode_enter(bContext *C, int flag) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Base *base = NULL; | SceneLayer *sl = CTX_data_scene_layer(C); | ||||
| ObjectBase *base = NULL; | |||||
| Object *ob; | Object *ob; | ||||
| ScrArea *sa = CTX_wm_area(C); | |||||
| View3D *v3d = NULL; | |||||
| bool ok = false; | bool ok = false; | ||||
| if (ID_IS_LINKED_DATABLOCK(scene)) return; | if (ID_IS_LINKED_DATABLOCK(scene)) return; | ||||
| if (sa && sa->spacetype == SPACE_VIEW3D) | |||||
| v3d = sa->spacedata.first; | |||||
| if ((flag & EM_IGNORE_LAYER) == 0) { | if ((flag & EM_IGNORE_LAYER) == 0) { | ||||
| base = CTX_data_active_base(C); /* active layer checked here for view3d */ | base = CTX_data_active_base(C); /* active layer checked here for view3d */ | ||||
| if (base == NULL) return; | if (base == NULL) return; | ||||
| else if (v3d && (base->lay & v3d->lay) == 0) return; | |||||
| else if (!v3d && (base->lay & scene->lay) == 0) return; | |||||
| } | } | ||||
| else { | else { | ||||
| base = scene->basact; | base = sl->basact; | ||||
| } | } | ||||
| if (ELEM(NULL, base, base->object, base->object->data)) return; | if (ELEM(NULL, base, base->object, base->object->data)) return; | ||||
| ob = base->object; | ob = base->object; | ||||
| /* this checks actual object->data, for cases when other scenes have it in editmode context */ | /* this checks actual object->data, for cases when other scenes have it in editmode context */ | ||||
| if (BKE_object_is_in_editmode(ob)) | if (BKE_object_is_in_editmode(ob)) | ||||
| ▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | void OBJECT_OT_editmode_toggle(wmOperatorType *ot) | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /* *************************** */ | /* *************************** */ | ||||
| static int posemode_exec(bContext *C, wmOperator *op) | static int posemode_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Base *base = CTX_data_active_base(C); | ObjectBase *base = CTX_data_active_base(C); | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| const int mode_flag = OB_MODE_POSE; | const int mode_flag = OB_MODE_POSE; | ||||
| const bool is_mode_set = (ob->mode & mode_flag) != 0; | const bool is_mode_set = (ob->mode & mode_flag) != 0; | ||||
| if (!is_mode_set) { | if (!is_mode_set) { | ||||
| if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { | if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,601 Lines • Show Last 20 Lines | |||||