Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_select.c24
-rw-r--r--source/blender/editors/armature/armature_skinning.c8
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c8
-rw-r--r--source/blender/editors/armature/pose_edit.c5
-rw-r--r--source/blender/editors/armature/pose_lib.c12
-rw-r--r--source/blender/editors/armature/pose_transform.c12
-rw-r--r--source/blender/editors/armature/pose_utils.c6
7 files changed, 28 insertions, 47 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 63864e75edc..6ad33125a25 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -242,27 +242,25 @@ void *get_nearest_bone(
bContext *C, const int xy[2], bool findunsel,
Base **r_base)
{
- EvaluationContext eval_ctx;
ViewContext vc;
rcti rect;
unsigned int buffer[MAXPICKBUF];
short hits;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
// rect.xmin = ... mouseco!
rect.xmin = rect.xmax = xy[0];
rect.ymin = rect.ymax = xy[1];
- hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
*r_base = NULL;
if (hits > 0) {
uint bases_len = 0;
Base **bases = BKE_view_layer_array_from_bases_in_mode(
- eval_ctx.view_layer, &bases_len, {
+ vc.view_layer, &bases_len, {
.object_mode = vc.obedit ? OB_MODE_EDIT : OB_MODE_POSE,
.no_dup_data = true});
@@ -382,7 +380,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits12, const
/* does bones and points */
/* note that BONE ROOT only gets drawn for root bones (or without IK) */
static EditBone *get_nearest_editbonepoint(
- const EvaluationContext *eval_ctx, ViewContext *vc,
+ ViewContext *vc,
bool findunsel, bool use_cycle,
Base **r_base, int *r_selmask)
{
@@ -436,7 +434,7 @@ static EditBone *get_nearest_editbonepoint(
view3d_opengl_select_cache_begin();
BLI_rcti_init_pt_radius(&rect, vc->mval, 12);
- hits12 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode);
+ hits12 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode);
if (hits12 == 1) {
hits = selectbuffer_ret_hits_12(buffer, hits12);
goto cache_end;
@@ -446,7 +444,7 @@ static EditBone *get_nearest_editbonepoint(
offs = 4 * hits12;
BLI_rcti_init_pt_radius(&rect, vc->mval, 5);
- hits5 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode);
+ hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode);
if (hits5 == 1) {
hits = selectbuffer_ret_hits_5(buffer, hits12, hits5);
@@ -461,7 +459,7 @@ cache_end:
view3d_opengl_select_cache_end();
uint bases_len;
- Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(eval_ctx->view_layer, &bases_len);
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(vc->view_layer, &bases_len);
/* See if there are any selected bones in this group */
if (hits > 0) {
@@ -595,13 +593,11 @@ static int ebone_select_flag(EditBone *ebone)
/* context: editmode armature in view3d */
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
- EvaluationContext eval_ctx;
ViewContext vc;
EditBone *nearBone = NULL;
int selmask;
Base *basact = NULL;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
vc.mval[0] = mval[0];
vc.mval[1] = mval[1];
@@ -610,14 +606,14 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, b
return true;
}
- nearBone = get_nearest_editbonepoint(&eval_ctx, &vc, true, true, &basact, &selmask);
+ nearBone = get_nearest_editbonepoint(&vc, true, true, &basact, &selmask);
if (nearBone) {
ED_view3d_viewcontext_init_object(&vc, basact->object);
bArmature *arm = vc.obedit->data;
if (!extend && !deselect && !toggle) {
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(eval_ctx.view_layer, &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(vc.view_layer, &objects_len);
ED_armature_edit_deselect_all_multi(objects, objects_len);
MEM_freeN(objects);
}
@@ -698,8 +694,8 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, b
arm->act_edbone = nearBone;
}
- if (eval_ctx.view_layer->basact != basact) {
- eval_ctx.view_layer->basact = basact;
+ if (vc.view_layer->basact != basact) {
+ vc.view_layer->basact = basact;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene);
}
}
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index e25056a7a4a..c98eb9218cc 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -251,7 +251,7 @@ static void envelope_bone_weighting(
}
static void add_verts_to_dgroups(
- ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+ ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par,
int heat, const bool mirror)
{
/* This functions implements the automatic computation of vertex group
@@ -377,7 +377,7 @@ static void add_verts_to_dgroups(
if (wpmode) {
/* if in weight paint mode, use final verts from derivedmesh */
- DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
if (dm->foreachMappedVert) {
mesh_get_mapped_verts_coords(dm, verts, mesh->totvert);
@@ -432,7 +432,7 @@ static void add_verts_to_dgroups(
}
void ED_object_vgroup_calc_from_armature(
- ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+ ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par,
const int mode, const bool mirror)
{
/* Lets try to create some vertex groups
@@ -459,6 +459,6 @@ void ED_object_vgroup_calc_from_armature(
* that are populated with the vertices for which the
* bone is closest.
*/
- add_verts_to_dgroups(reports, eval_ctx, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
+ add_verts_to_dgroups(reports, depsgraph, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
}
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 26f11f8fd60..4c208ef5411 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -998,7 +998,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
* the ideal would be to call this function only at the beginning of the snap operation,
* or at the beginning of the operator itself */
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- CTX_data_main(C), CTX_data_scene(C), CTX_data_view_layer(C), 0,
+ CTX_data_main(C), CTX_data_scene(C), 0,
CTX_wm_region(C), CTX_wm_view3d(C));
float mvalf[2] = {UNPACK2(dd->mval)};
@@ -1486,7 +1486,7 @@ static int cmpIntersections(const void *i1, const void *i2)
/* returns the maximum number of intersections per stroke */
static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Stroke *gesture)
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ARegion *ar = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
@@ -1925,18 +1925,16 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
static bool sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], const bool extend)
{
- EvaluationContext eval_ctx;
ViewContext vc;
rcti rect;
unsigned int buffer[MAXPICKBUF];
short hits;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
BLI_rcti_init_pt_radius(&rect, mval, 5);
- hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
if (hits > 0) {
int besthitresult = -1;
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index ea93e024f8e..80eeda1dd0c 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -178,8 +178,7 @@ static bool pose_has_protected_selected(Object *ob, short warn)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
{
struct Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
/* set flag to force recalc, then grab the relevant bones to target */
@@ -187,7 +186,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
animviz_get_object_motionpaths(ob, &targets);
/* recalculate paths, then free */
- animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets);
+ animviz_calc_motionpaths(depsgraph, bmain, scene, &targets);
BLI_freelistN(&targets);
}
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 54c40621a14..609281a7bf2 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1080,9 +1080,6 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData
static void poselib_preview_apply(bContext *C, wmOperator *op)
{
tPoseLib_PreviewData *pld = (tPoseLib_PreviewData *)op->customdata;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* only recalc pose (and its dependencies) if pose has changed */
if (pld->redraw == PL_PREVIEW_REDRAWALL) {
@@ -1107,7 +1104,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
if ((pld->arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&pld->ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, pld->scene, pld->ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), pld->scene, pld->ob);
}
/* do header print - if interactively previewing */
@@ -1598,9 +1595,6 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
bArmature *arm = pld->arm;
bAction *act = pld->act;
TimeMarker *marker = pld->marker;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* redraw the header so that it doesn't show any of our stuff anymore */
ED_area_headerprint(pld->sa, NULL);
@@ -1618,7 +1612,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
if ((arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), scene, ob);
}
else if (pld->state == PL_PREVIEW_CONFIRM) {
/* tag poses as appropriate */
@@ -1636,7 +1630,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
//remake_action_ipos(ob->action);
}
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), scene, ob);
}
/* Request final redraw of the view. */
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 7fc40d00042..a8ba3ad646c 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -73,10 +73,8 @@
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Object *armob)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object workob, *ob;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* go through all objects in database */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
@@ -87,7 +85,7 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
*/
BKE_object_apply_mat4(ob, ob->obmat, false, false);
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
}
@@ -96,16 +94,14 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
/* set the current pose as the restpose */
static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
- EvaluationContext eval_ctx;
bArmature *arm = BKE_armature_from_object(ob);
bPose *pose;
bPoseChannel *pchan;
EditBone *curbone;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* don't check if editmode (should be done by caller) */
if (ob->type != OB_ARMATURE)
return OPERATOR_CANCELLED;
@@ -196,7 +192,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
ED_armature_edit_free(arm);
/* flush positions of posebones */
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
/* fix parenting of objects which are bone-parented */
applyarmature_fix_boneparents(C, scene, ob);
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index acb9363cf10..0dc89aa4716 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -183,10 +183,8 @@ void poseAnim_mapping_free(ListBase *pfLinks)
/* helper for apply() / reset() - refresh the data */
void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
bArmature *arm = (bArmature *)ob->data;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* old optimize trick... this enforces to bypass the depgraph
* - note: code copied from transform_generics.c -> recalcData()
@@ -195,7 +193,7 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
if ((arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);