Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex.c
| Show First 20 Lines • Show All 1,370 Lines • ▼ Show 20 Lines | else { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); | Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); | ||||
| if (depsgraph) { | if (depsgraph) { | ||||
| depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| } | } | ||||
| ED_object_wpaintmode_enter_ex(bmain, depsgraph, scene, ob); | ED_object_wpaintmode_enter_ex(bmain, depsgraph, scene, ob); | ||||
| BKE_paint_toolslots_brush_validate(bmain, &ts->wpaint->paint); | BKE_paint_toolslots_brush_validate(bmain, &ts->wpaint->paint); | ||||
| } | } | ||||
| /* When locked, it's almost impossible to select the pose-object | /* Prepare armature posemode. */ | ||||
| * then the mesh-object to enter weight paint mode. | ED_object_posemode_set_for_weight_paint(C, bmain, ob, is_mode_set); | ||||
| * Even when the object mode is not locked this is inconvenient - so allow in either case. | |||||
| * | |||||
| * In this case move our pose object in/out of pose mode. | |||||
| * This is in fits with the convention of selecting multiple objects and entering a mode. | |||||
| */ | |||||
| { | |||||
| VirtualModifierData virtualModifierData; | |||||
| ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData); | |||||
| if (md != NULL) { | |||||
| /* Can be NULL. */ | |||||
| View3D *v3d = CTX_wm_view3d(C); | |||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | |||||
| for (; md; md = md->next) { | |||||
| if (md->type == eModifierType_Armature) { | |||||
| ArmatureModifierData *amd = (ArmatureModifierData *)md; | |||||
| Object *ob_arm = amd->object; | |||||
| if (ob_arm != NULL) { | |||||
| const Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm); | |||||
| if (base_arm && BASE_VISIBLE(v3d, base_arm)) { | |||||
| if (is_mode_set) { | |||||
| if ((ob_arm->mode & OB_MODE_POSE) != 0) { | |||||
| ED_object_posemode_exit_ex(bmain, ob_arm); | |||||
| } | |||||
| } | |||||
| else { | |||||
| /* Only check selected status when entering weight-paint mode | |||||
| * because we may have multiple armature objects. | |||||
| * Selecting one will de-select the other, which would leave it in pose-mode | |||||
| * when exiting weight paint mode. While usable, this looks like inconsistent | |||||
| * behavior from a user perspective. */ | |||||
| if (base_arm->flag & BASE_SELECTED) { | |||||
| if ((ob_arm->mode & OB_MODE_POSE) == 0) { | |||||
| ED_object_posemode_enter_ex(bmain, ob_arm); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Weight-paint works by overriding colors in mesh, | /* Weight-paint works by overriding colors in mesh, | ||||
| * so need to make sure we recalculate on enter and | * so need to make sure we recalculate on enter and | ||||
| * exit (exit needs doing regardless because we | * exit (exit needs doing regardless because we | ||||
| * should re-deform). | * should re-deform). | ||||
| */ | */ | ||||
| DEG_id_tag_update(&me->id, 0); | DEG_id_tag_update(&me->id, 0); | ||||
| ▲ Show 20 Lines • Show All 2,119 Lines • Show Last 20 Lines | |||||