Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_modes.c
| Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | bool ED_object_mode_generic_enter( | ||||
| WM_operator_properties_free(&ptr); | WM_operator_properties_free(&ptr); | ||||
| return (workspace->object_mode == object_mode); | return (workspace->object_mode == object_mode); | ||||
| } | } | ||||
| /** | /** | ||||
| * Use for changing works-paces or changing active object. | * Use for changing works-paces or changing active object. | ||||
| * Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run. | * Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run. | ||||
| */ | */ | ||||
| static bool ed_object_mode_generic_exit_ex( | void ED_object_mode_generic_exit( | ||||
| const struct EvaluationContext *eval_ctx, | const struct EvaluationContext *eval_ctx, | ||||
| struct WorkSpace *workspace, struct Scene *scene, struct Object *ob, | struct WorkSpace *workspace, struct Scene *scene, struct Object *ob) | ||||
| bool only_test) | |||||
| { | { | ||||
| if (eval_ctx->object_mode & OB_MODE_EDIT) { | if (eval_ctx->object_mode & OB_MODE_EDIT) { | ||||
| if (BKE_object_is_in_editmode(ob)) { | if (BKE_object_is_in_editmode(ob)) { | ||||
| if (only_test) { | |||||
| return true; | |||||
| } | |||||
| ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA); | ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA); | ||||
| } | } | ||||
| } | } | ||||
| else if (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT) { | else if (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT) { | ||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) { | if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) { | ||||
| if (only_test) { | |||||
| return true; | |||||
| } | |||||
| ED_object_vpaintmode_exit_ex(workspace, ob); | ED_object_vpaintmode_exit_ex(workspace, ob); | ||||
| } | } | ||||
| } | } | ||||
| else if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { | else if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { | ||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) { | if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) { | ||||
| if (only_test) { | |||||
| return true; | |||||
| } | |||||
| ED_object_wpaintmode_exit_ex(workspace, ob); | ED_object_wpaintmode_exit_ex(workspace, ob); | ||||
| } | } | ||||
| } | } | ||||
| else if (eval_ctx->object_mode & OB_MODE_SCULPT) { | else if (eval_ctx->object_mode & OB_MODE_SCULPT) { | ||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) { | if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) { | ||||
| if (only_test) { | |||||
| return true; | |||||
| } | |||||
| ED_object_sculptmode_exit_ex(eval_ctx, workspace, scene, ob); | ED_object_sculptmode_exit_ex(eval_ctx, workspace, scene, ob); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (only_test) { | |||||
| return false; | |||||
| } | |||||
| BLI_assert((eval_ctx->object_mode & OB_MODE_ALL_MODE_DATA) == 0); | BLI_assert((eval_ctx->object_mode & OB_MODE_ALL_MODE_DATA) == 0); | ||||
| } | } | ||||
| return false; | |||||
| } | |||||
| void ED_object_mode_generic_exit( | |||||
| const struct EvaluationContext *eval_ctx, | |||||
| struct WorkSpace *workspace, struct Scene *scene, struct Object *ob) | |||||
| { | |||||
| ed_object_mode_generic_exit_ex(eval_ctx, workspace, scene, ob, false); | |||||
| } | |||||
| bool ED_object_mode_generic_has_data( | |||||
| const struct EvaluationContext *eval_ctx, | |||||
| struct Object *ob) | |||||
| { | |||||
| return ed_object_mode_generic_exit_ex(eval_ctx, NULL, NULL, ob, true); | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Mode Syncing Utils | /** \name Mode Syncing Utils | ||||
| * | * | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||