Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_armature.c
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | bool OVERLAY_armature_is_pose_mode(Object *ob, const DRWContextState *draw_ctx) | ||||
| /* Pose armature is handled by pose mode engine. */ | /* Pose armature is handled by pose mode engine. */ | ||||
| if (((ob == active_ob) || (ob->mode & OB_MODE_POSE)) && | if (((ob == active_ob) || (ob->mode & OB_MODE_POSE)) && | ||||
| ((draw_ctx->object_mode & OB_MODE_POSE) != 0)) { | ((draw_ctx->object_mode & OB_MODE_POSE) != 0)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* Armature parent is also handled by pose mode engine. */ | /* Armature parent is also handled by pose mode engine. */ | ||||
| if ((active_ob != NULL) && ((draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) != 0)) { | if ((active_ob != NULL) && | ||||
| (ELEM(draw_ctx->object_mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL))) { | |||||
campbellbarton: We can use `(draw_ctx->object_mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_WEIGHT_GPENCIL)) != 0)`… | |||||
| if (ob == draw_ctx->object_pose) { | if (ob == draw_ctx->object_pose) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,871 Lines • ▼ Show 20 Lines | is_pose_select = | ||||
| /* When we're in object mode, which may select bones. */ | /* When we're in object mode, which may select bones. */ | ||||
| ((ob->mode & OB_MODE_POSE) && | ((ob->mode & OB_MODE_POSE) && | ||||
| ( | ( | ||||
| /* Switch from object mode when object lock is disabled. */ | /* Switch from object mode when object lock is disabled. */ | ||||
| ((draw_ctx->object_mode == OB_MODE_OBJECT) && | ((draw_ctx->object_mode == OB_MODE_OBJECT) && | ||||
| (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) || | (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) || | ||||
| /* Allow selection when in weight-paint mode | /* Allow selection when in weight-paint mode | ||||
| * (selection code ensures this wont become active). */ | * (selection code ensures this wont become active). */ | ||||
| ((draw_ctx->object_mode == OB_MODE_WEIGHT_PAINT) && | (ELEM(draw_ctx->object_mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL) && | ||||
| (draw_ctx->object_pose != NULL))))) && | (draw_ctx->object_pose != NULL))))) && | ||||
| DRW_state_is_select(); | DRW_state_is_select(); | ||||
| if (is_pose_select) { | if (is_pose_select) { | ||||
| const Object *ob_orig = DEG_get_original_object(ob); | const Object *ob_orig = DEG_get_original_object(ob); | ||||
| index = ob_orig->runtime.select_id; | index = ob_orig->runtime.select_id; | ||||
| } | } | ||||
| } | } | ||||
| /* In weight paint mode retrieve the vertex group lock status. */ | /* In weight paint mode retrieve the vertex group lock status. */ | ||||
| if ((draw_ctx->object_mode == OB_MODE_WEIGHT_PAINT) && (draw_ctx->object_pose == ob) && | if (ELEM(draw_ctx->object_mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL) && | ||||
| (draw_ctx->obact != NULL)) { | (draw_ctx->object_pose == ob) && (draw_ctx->obact != NULL)) { | ||||
| draw_locked_weights = true; | draw_locked_weights = true; | ||||
| for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { | for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { | ||||
| pchan->bone->flag &= ~BONE_DRAW_LOCKED_WEIGHT; | pchan->bone->flag &= ~BONE_DRAW_LOCKED_WEIGHT; | ||||
| } | } | ||||
| const Object *obact_orig = DEG_get_original_object(draw_ctx->obact); | const Object *obact_orig = DEG_get_original_object(draw_ctx->obact); | ||||
| ▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines | |||||
We can use (draw_ctx->object_mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_WEIGHT_GPENCIL)) != 0) here.
I'd prefer this since it's in keeping with flag use elsewhere, see: OB_MODE_ALL_SCULPT, OB_MODE_ALL_MODE_DATA... etc.