diff options
Diffstat (limited to 'source/blender')
177 files changed, 1276 insertions, 1030 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6c4a090904a..c86595cd509 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -658,18 +658,18 @@ void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int /* */ DerivedMesh *mesh_get_derived_final( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_get_derived_deform( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_for_modifier( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ModifierData *md, int build_shapekey_layers); DerivedMesh *mesh_create_derived_render( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *getEditDerivedBMesh( @@ -677,37 +677,37 @@ DerivedMesh *getEditDerivedBMesh( float (*vertexCos)[3]); DerivedMesh *mesh_create_derived_index_render( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index); /* same as above but wont use render settings */ DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]); DerivedMesh *mesh_create_derived_view( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform_render( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); /* for gameengine */ DerivedMesh *mesh_create_derived_no_virtual( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *mesh_create_derived_physics( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *editbmesh_get_derived_base( struct Object *ob, struct BMEditMesh *em, CustomDataMask data_mask); DerivedMesh *editbmesh_get_derived_cage( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, struct BMEditMesh *em, CustomDataMask dataMask); DerivedMesh *editbmesh_get_derived_cage_and_final( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, struct BMEditMesh *em, CustomDataMask dataMask, DerivedMesh **r_final); @@ -716,7 +716,7 @@ DerivedMesh *object_get_derived_final(struct Object *ob, const bool for_render); float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *r_numVerts))[3]; bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); void makeDerivedMesh( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct BMEditMesh *em, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct BMEditMesh *em, CustomDataMask dataMask, const bool build_shapekey_layers); void weight_to_rgb(float r_rgb[3], const float weight); diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index ef8a1c7e417..9beff85b87c 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -66,8 +66,8 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl /* ---------------------------------------------------- */ /* Dupli-Geometry */ -struct ListBase *object_duplilist_ex(struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob, bool update); -struct ListBase *object_duplilist(struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob); +struct ListBase *object_duplilist_ex(const struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob, bool update); +struct ListBase *object_duplilist(const struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob); void free_object_duplilist(struct ListBase *lb); int count_duplilist(struct Object *ob); @@ -81,7 +81,7 @@ typedef struct DupliApplyData { DupliExtraData *extra; } DupliApplyData; -DupliApplyData *duplilist_apply(struct EvaluationContext *eval_ctx, struct Object *ob, struct Scene *scene, struct ListBase *duplilist); +DupliApplyData *duplilist_apply(const struct EvaluationContext *eval_ctx, struct Object *ob, struct Scene *scene, struct ListBase *duplilist); void duplilist_restore(struct ListBase *duplilist, DupliApplyData *apply_data); void duplilist_free_apply_data(DupliApplyData *apply_data); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 7984202f03f..622767baa10 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -195,8 +195,8 @@ void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, struct EvaluationContext; -void BKE_animsys_eval_animdata(struct EvaluationContext *eval_ctx, struct ID *id); -void BKE_animsys_eval_driver(struct EvaluationContext *eval_ctx, struct ID *id, struct FCurve *fcurve); +void BKE_animsys_eval_animdata(const struct EvaluationContext *eval_ctx, struct ID *id); +void BKE_animsys_eval_driver(const struct EvaluationContext *eval_ctx, struct ID *id, struct FCurve *fcurve); /* ************************************* */ diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 8e67bc43b3f..453a6432d83 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -100,8 +100,8 @@ void BKE_armature_where_is(struct bArmature *arm); void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone, const bool use_recursion); void BKE_pose_clear_pointers(struct bPose *pose); void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm); -void BKE_pose_where_is(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_pose_where_is_bone(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra); +void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_pose_where_is_bone(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra); void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan); /* get_objectspace_bone_matrix has to be removed still */ @@ -118,7 +118,7 @@ void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4]); -void BKE_armature_mat_pose_to_bone_ex(struct EvaluationContext *eval_ctx, struct Object *ob, struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); +void BKE_armature_mat_pose_to_bone_ex(const struct EvaluationContext *eval_ctx, struct Object *ob, struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[3][3], bool use_compat); void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_comat); @@ -165,42 +165,44 @@ struct bPoseChannel *BKE_armature_splineik_solver_find_root( struct bSplineIKConstraint *data); void BKE_pose_splineik_init_tree(struct Scene *scene, struct Object *ob, float ctime); -void BKE_splineik_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); +void BKE_splineik_execute_tree( + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Object *ob, struct bPoseChannel *pchan_root, float ctime); -void BKE_pose_eval_init(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_init(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPose *pose); -void BKE_pose_eval_bone(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); -void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); -void BKE_pose_bone_done(struct EvaluationContext *eval_ctx, +void BKE_pose_bone_done(const struct EvaluationContext *eval_ctx, struct bPoseChannel *pchan); -void BKE_pose_iktree_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *rootchan); -void BKE_pose_splineik_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *rootchan); -void BKE_pose_eval_flush(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_flush(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPose *pose); -void BKE_pose_eval_proxy_copy(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_proxy_copy(const struct EvaluationContext *eval_ctx, struct Object *ob); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 67723209e75..7f7cbd678e2 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -227,7 +227,7 @@ void cloth_free_contacts(ColliderContacts *collider_contacts, int totcolliders); void cloth_free_modifier_extern (struct ClothModifierData *clmd ); void cloth_free_modifier (struct ClothModifierData *clmd ); void cloth_init (struct ClothModifierData *clmd ); -void clothModifier_do (struct ClothModifierData *clmd, struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]); +void clothModifier_do(struct ClothModifierData *clmd, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]); int cloth_uses_vgroup(struct ClothModifierData *clmd); diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 33fc91b2c3c..cf7e2908360 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -103,7 +103,7 @@ typedef struct bConstraintTypeInfo { /* evaluation */ /* set the ct->matrix for the given constraint target (at the given ctime) */ - void (*get_target_matrix)(struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime); + void (*get_target_matrix)(const struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime); /* evaluate the constraint for the given time */ void (*evaluate_constraint)(struct bConstraint *con, struct bConstraintOb *cob, struct ListBase *targets); } bConstraintTypeInfo; @@ -148,10 +148,10 @@ void BKE_constraints_clear_evalob(struct bConstraintOb *cob); void BKE_constraint_mat_convertspace( struct Object *ob, struct bPoseChannel *pchan, float mat[4][4], short from, short to, const bool keep_scale); -void BKE_constraint_target_matrix_get(struct EvaluationContext *eval_ctx, struct Scene *scene, struct bConstraint *con, +void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct bConstraint *con, int n, short ownertype, void *ownerdata, float mat[4][4], float ctime); -void BKE_constraint_targets_for_solving_get(struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); -void BKE_constraints_solve(struct EvaluationContext *eval_ctx, struct ListBase *conlist, struct bConstraintOb *cob, float ctime); +void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); +void BKE_constraints_solve(const struct EvaluationContext *eval_ctx, struct ListBase *conlist, struct bConstraintOb *cob, float ctime); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h index 4fe52370f47..31542cd6f8a 100644 --- a/source/blender/blenkernel/BKE_crazyspace.h +++ b/source/blender/blenkernel/BKE_crazyspace.h @@ -42,20 +42,20 @@ struct EvaluationContext; /* crazyspace.c */ float (*BKE_crazyspace_get_mapped_editverts( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *obedit))[3]; + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *obedit))[3]; void BKE_crazyspace_set_quats_editmesh( struct BMEditMesh *em, float (*origcos)[3], float (*mappedcos)[3], float (*quats)[4], const bool use_select); void BKE_crazyspace_set_quats_mesh( struct Mesh *me, float (*origcos)[3], float (*mappedcos)[3], float (*quats)[4]); int BKE_crazyspace_get_first_deform_matrices_editbmesh( - struct EvaluationContext *eval_ctx, struct Scene *, struct Object *, struct BMEditMesh *em, + const struct EvaluationContext *eval_ctx, struct Scene *, struct Object *, struct BMEditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]); int BKE_sculpt_get_first_deform_matrices( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); void BKE_crazyspace_build_sculpt( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index ebce4643a87..1ebb092a939 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -123,13 +123,14 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex); void BKE_curve_editNurb_free(struct Curve *cu); struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu); -float *BKE_curve_make_orco(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, int *r_numVerts); +float *BKE_curve_make_orco(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, int *r_numVerts); float *BKE_curve_surf_make_orco(struct Object *ob); void BKE_curve_bevelList_free(struct ListBase *bev); void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render); -void BKE_curve_bevel_make(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *disp, - const bool for_render, const bool use_render_resolution); +void BKE_curve_bevel_make( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *disp, + const bool for_render, const bool use_render_resolution); void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); void BKE_curve_forward_diff_tangent_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); @@ -214,11 +215,13 @@ void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles); /* **** Depsgraph evaluation **** */ -void BKE_curve_eval_geometry(struct EvaluationContext *eval_ctx, - struct Curve *curve); +void BKE_curve_eval_geometry( + const struct EvaluationContext *eval_ctx, + struct Curve *curve); -void BKE_curve_eval_path(struct EvaluationContext *eval_ctx, - struct Curve *curve); +void BKE_curve_eval_path( + const struct EvaluationContext *eval_ctx, + struct Curve *curve); /* Draw Cache */ enum { diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h index 497319819de..d5f0313ca64 100644 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@ -130,12 +130,12 @@ enum { }; void BKE_object_data_transfer_layout( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX]); bool BKE_object_data_transfer_mesh( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, @@ -144,7 +144,7 @@ bool BKE_object_data_transfer_mesh( const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports); bool BKE_object_data_transfer_dm( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 641abc54216..c2229976dd9 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -86,23 +86,30 @@ void BKE_displist_count(struct ListBase *lb, int *totvert, int *totface, int *to void BKE_displist_free(struct ListBase *lb); bool BKE_displist_has_faces(struct ListBase *lb); -void BKE_displist_make_surf(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, - struct DerivedMesh **r_dm_final, const bool for_render, const bool for_orco, const bool use_render_resolution); -void BKE_displist_make_curveTypes(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, const bool for_orco); -void BKE_displist_make_curveTypes_forRender(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, - struct DerivedMesh **r_dm_final, const bool for_orco, const bool use_render_resolution); -void BKE_displist_make_curveTypes_forOrco(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); -void BKE_displist_make_mball(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_displist_make_mball_forRender(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); +void BKE_displist_make_surf( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, + struct DerivedMesh **r_dm_final, const bool for_render, const bool for_orco, const bool use_render_resolution); +void BKE_displist_make_curveTypes( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, const bool for_orco); +void BKE_displist_make_curveTypes_forRender( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, + struct DerivedMesh **r_dm_final, const bool for_orco, const bool use_render_resolution); +void BKE_displist_make_curveTypes_forOrco( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); +void BKE_displist_make_mball( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_displist_make_mball_forRender( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4); void BKE_displist_fill(struct ListBase *dispbase, struct ListBase *to, const float normal_proj[3], const bool flipnormal); -float BKE_displist_calc_taper(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *taperobj, int cur, int tot); +float BKE_displist_calc_taper(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *taperobj, int cur, int tot); /* add Orco layer to the displist object which has got derived mesh and return orco */ -float *BKE_displist_make_orco(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm_final, - const bool for_render, const bool use_render_resolution); +float *BKE_displist_make_orco( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm_final, + const bool for_render, const bool use_render_resolution); void BKE_displist_minmax(struct ListBase *dispbase, float min[3], float max[3]); diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 1360d0c730f..cee10d2bd56 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -62,7 +62,7 @@ typedef struct PaintWavePoint { short state; } PaintWavePoint; -struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd, struct EvaluationContext *eval_ctx, struct Scene *scene, +struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd); void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd); @@ -86,7 +86,7 @@ struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings /* image sequence baking */ int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface, float *progress, short *do_update); -int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cObject, int frame); +int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cObject, int frame); void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer); /* PaintPoint state */ diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 02ad8777e60..af1aeff230f 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -99,6 +99,7 @@ float (*BKE_editmesh_vertexCos_get_orco(BMEditMesh *em, int *r_numVerts))[3] void BKE_editmesh_statvis_calc(BMEditMesh *em, struct DerivedMesh *dm, const struct MeshStatVis *statvis); -float (*BKE_editmesh_vertexCos_get(struct EvaluationContext *eval_ctx, struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3]; +float (*BKE_editmesh_vertexCos_get( + const struct EvaluationContext *eval_ctx, struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3]; #endif /* __BKE_EDITMESH_H__ */ diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 383e6d0cb62..6fa19d4aaf6 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -94,7 +94,7 @@ typedef struct EffectorData { typedef struct EffectorCache { struct EffectorCache *next, *prev; - struct EvaluationContext *eval_ctx; + const struct EvaluationContext *eval_ctx; struct Scene *scene; struct Object *ob; struct ParticleSystem *psys; @@ -112,10 +112,11 @@ typedef struct EffectorCache { } EffectorCache; void free_partdeflect(struct PartDeflect *pd); -struct ListBase *pdInitEffectors(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, - struct EffectorWeights *weights, bool for_simulation); +struct ListBase *pdInitEffectors( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, + struct EffectorWeights *weights, bool for_simulation); void pdEndEffectors(struct ListBase **effectors); -void pdPrecalculateEffectors(struct EvaluationContext *eval_ctx, struct ListBase *effectors); +void pdPrecalculateEffectors(const struct EvaluationContext *eval_ctx, struct ListBase *effectors); void pdDoEffectors(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *impulse); void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point); diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h index 0345382271b..4ec58b2a0e5 100644 --- a/source/blender/blenkernel/BKE_fluidsim.h +++ b/source/blender/blenkernel/BKE_fluidsim.h @@ -40,7 +40,7 @@ struct EvaluationContext; /* old interface */ -void initElbeemMesh(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +void initElbeemMesh(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex); diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index fd0b23b242a..205f42d6643 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -54,6 +54,6 @@ bool BKE_group_object_cyclic_check(struct Main *bmain, struct Object *o bool BKE_group_is_animated(struct Group *group, struct Object *parent); void BKE_group_tag_recalc(struct Group *group); -void BKE_group_handle_recalc_and_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *parent, struct Group *group); +void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *parent, struct Group *group); #endif /* __BKE_GROUP_H__ */ diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 181dc5d31ae..52d6dc53808 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -62,10 +62,12 @@ void end_latt_deform(struct LatticeDeformData *lattice_deform_data); bool object_deform_mball(struct Object *ob, struct ListBase *dispbase); void outside_lattice(struct Lattice *lt); -void curve_deform_verts(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cuOb, struct Object *target, - struct DerivedMesh *dm, float (*vertexCos)[3], +void curve_deform_verts( + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Object *cuOb, struct Object *target, + struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts, const char *vgroup, short defaxis); -void curve_deform_vector(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cuOb, struct Object *target, +void curve_deform_vector(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cuOb, struct Object *target, float orco[3], float vec[3], float mat[3][3], int no_rot_axis); void lattice_deform_verts(struct Object *laOb, struct Object *target, @@ -78,7 +80,7 @@ void armature_deform_verts(struct Object *armOb, struct Object *target, float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3]; void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]); -void BKE_lattice_modifiers_calc(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_lattice_modifiers_calc(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice); struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt); @@ -102,7 +104,7 @@ void BKE_lattice_bitmap_from_flag(struct Lattice *lt, unsigned int *bitmap, cons struct EvaluationContext; -void BKE_lattice_eval_geometry(struct EvaluationContext *eval_ctx, +void BKE_lattice_eval_geometry(const struct EvaluationContext *eval_ctx, struct Lattice *latt); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 0a26fe08016..5f95a69ed1e 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -144,13 +144,13 @@ void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, con /* evaluation */ -void BKE_layer_eval_layer_collection_pre(struct EvaluationContext *eval_ctx, +void BKE_layer_eval_layer_collection_pre(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *scene_layer); -void BKE_layer_eval_layer_collection(struct EvaluationContext *eval_ctx, +void BKE_layer_eval_layer_collection(const struct EvaluationContext *eval_ctx, struct LayerCollection *layer_collection, struct LayerCollection *parent_layer_collection); -void BKE_layer_eval_layer_collection_post(struct EvaluationContext *eval_ctx, +void BKE_layer_eval_layer_collection_post(const struct EvaluationContext *eval_ctx, struct SceneLayer *scene_layer); /* iterators */ diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index d42bd1c8c35..49fb128417e 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -123,7 +123,7 @@ void paste_matcopybuf(struct Material *ma); struct EvaluationContext; -void BKE_material_eval(struct EvaluationContext *eval_ctx, struct Material *material); +void BKE_material_eval(const struct EvaluationContext *eval_ctx, struct Material *material); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index f02704ba903..0c07ce55781 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -73,7 +73,7 @@ void BKE_mball_select_swap(struct MetaBall *mb); struct EvaluationContext; -void BKE_mball_eval_geometry(struct EvaluationContext *eval_ctx, +void BKE_mball_eval_geometry(const struct EvaluationContext *eval_ctx, struct MetaBall *mball); #endif diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h b/source/blender/blenkernel/BKE_mball_tessellate.h index 361f31b704c..40cdc80e280 100644 --- a/source/blender/blenkernel/BKE_mball_tessellate.h +++ b/source/blender/blenkernel/BKE_mball_tessellate.h @@ -28,7 +28,7 @@ struct Object; struct Scene; void BKE_mball_polygonize( - struct EvaluationContext *eval_ctx, struct Scene *scene, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); void BKE_mball_cubeTable_free(void); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 4ec2594b599..d68712202c9 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -119,7 +119,7 @@ void BKE_mesh_from_nurbs_displist( struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv, const char *obdata_name); void BKE_mesh_from_nurbs(struct Object *ob); void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test); -void BKE_mesh_to_curve(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_mesh_to_curve(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); void BKE_mesh_material_index_remove(struct Mesh *me, short index); void BKE_mesh_material_index_clear(struct Mesh *me); void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len); @@ -140,7 +140,7 @@ float (*BKE_mesh_vertexCos_get(const struct Mesh *me, int *r_numVerts))[3]; void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals); -struct Mesh *BKE_mesh_new_from_object(struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *sce, struct Object *ob, +struct Mesh *BKE_mesh_new_from_object(const struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *sce, struct Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed); /* vertex level transformations & checks (no derived mesh) */ @@ -401,7 +401,7 @@ void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select); /* **** Depsgraph evaluation **** */ -void BKE_mesh_eval_geometry(struct EvaluationContext *eval_ctx, +void BKE_mesh_eval_geometry(const struct EvaluationContext *eval_ctx, struct Mesh *mesh); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 412805e6cc6..76a36bdf3ff 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -159,25 +159,25 @@ typedef struct ModifierTypeInfo { * the object it can obtain it from the derivedData argument if non-NULL, * and otherwise the ob argument. */ - void (*deformVerts)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + void (*deformVerts)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag); /* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */ - void (*deformMatrices)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + void (*deformMatrices)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts); /* Like deformVerts but called during editmode (for supporting modifiers) */ - void (*deformVertsEM)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + void (*deformVertsEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts); /* Set deform matrix per vertex for crazyspace correction */ - void (*deformMatricesEM)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + void (*deformMatricesEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts); @@ -203,7 +203,7 @@ typedef struct ModifierTypeInfo { * The modifier may reuse the derivedData argument (i.e. return it in * modified form), but must not release it. */ - struct DerivedMesh *(*applyModifier)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + struct DerivedMesh *(*applyModifier)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct DerivedMesh *derivedData, ModifierApplyFlag flag); @@ -214,7 +214,7 @@ typedef struct ModifierTypeInfo { * are expected from editmode objects. The same qualifications regarding * derivedData apply as for applyModifier. */ - struct DerivedMesh *(*applyModifierEM)(struct ModifierData *md, struct EvaluationContext *eval_ctx, + struct DerivedMesh *(*applyModifierEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, ModifierApplyFlag flag); @@ -420,24 +420,24 @@ const char *modifier_path_relbase(struct Object *ob); /* wrappers for modifier callbacks */ struct DerivedMesh *modwrap_applyModifier( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag); struct DerivedMesh *modwrap_applyModifierEM( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, ModifierApplyFlag flag); void modwrap_deformVerts( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag); void modwrap_deformVertsEM( - ModifierData *md, struct EvaluationContext *eval_ctx, struct Object *ob, + ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts); diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 5ddc67b7a8c..761bb7e8acb 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -81,18 +81,18 @@ struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm, struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene, struct ModifierData *lastmd); struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first); -struct DerivedMesh *get_multires_dm(struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +struct DerivedMesh *get_multires_dm(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob); void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction); void multiresModifier_base_apply(struct MultiresModifierData *mmd, struct Object *ob); void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob, int updateblock, int simple); void multiresModifier_sync_levels_ex( struct Object *ob_dst, struct MultiresModifierData *mmd_src, struct MultiresModifierData *mmd_dst); -int multiresModifier_reshape(struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshape(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *dst, struct Object *src); -int multiresModifier_reshapeFromDM(struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshapeFromDM(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob, struct DerivedMesh *srcdm); -int multiresModifier_reshapeFromDeformMod(struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob, struct ModifierData *md); void multires_stitch_grids(struct Object *); @@ -110,8 +110,8 @@ void multires_free(struct Multires *mr); void multires_load_old(struct Object *ob, struct Mesh *me); void multires_load_old_250(struct Mesh *); -void multiresModifier_scale_disp(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void multiresModifier_prepare_join(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *to_ob); +void multiresModifier_scale_disp(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void multiresModifier_prepare_join(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *to_ob); int multires_mdisp_corners(struct MDisps *s); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index b63a7173d7d..35cde742ff0 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -51,7 +51,7 @@ struct HookModifierData; struct ModifierData; void BKE_object_workob_clear(struct Object *workob); -void BKE_object_workob_calc_parent(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *workob); +void BKE_object_workob_calc_parent(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *workob); void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); struct SoftBody *copy_softbody(const struct SoftBody *sb, const int flag); @@ -128,10 +128,10 @@ struct Object *BKE_object_pose_armature_get(struct Object *ob); void BKE_object_get_parent_matrix(struct Scene *scene, struct Object *ob, struct Object *par, float parentmat[4][4]); -void BKE_object_where_is_calc(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_where_is_calc_ex(struct EvaluationContext *eval_ctx, struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]); -void BKE_object_where_is_calc_time(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void BKE_object_where_is_calc_time_ex(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime, +void BKE_object_where_is_calc(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_object_where_is_calc_ex(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]); +void BKE_object_where_is_calc_time(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); +void BKE_object_where_is_calc_time_ex(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime, struct RigidBodyWorld *rbw, float r_originmat[3][3]); void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); @@ -179,39 +179,43 @@ void BKE_object_tfm_protected_restore(struct Object *ob, const short protectflag); /* Dependency graph evaluation callbacks. */ -void BKE_object_eval_local_transform(struct EvaluationContext *eval_ctx, +void BKE_object_eval_local_transform(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_eval_parent(struct EvaluationContext *eval_ctx, +void BKE_object_eval_parent(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_eval_constraints(struct EvaluationContext *eval_ctx, +void BKE_object_eval_constraints(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_eval_done(struct EvaluationContext *eval_ctx, struct Object *ob); +void BKE_object_eval_done(const struct EvaluationContext *eval_ctx, struct Object *ob); -void BKE_object_eval_uber_transform(struct EvaluationContext *eval_ctx, +void BKE_object_eval_uber_transform(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_eval_uber_data(struct EvaluationContext *eval_ctx, +void BKE_object_eval_uber_data(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_eval_cloth(struct EvaluationContext *eval_ctx, +void BKE_object_eval_cloth(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *object); -void BKE_object_eval_update_shading(struct EvaluationContext *eval_ctx, +void BKE_object_eval_update_shading(const struct EvaluationContext *eval_ctx, struct Object *object); -void BKE_object_handle_data_update(struct EvaluationContext *eval_ctx, - struct Scene *scene, - struct Object *ob); -void BKE_object_handle_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_object_handle_update_ex(struct EvaluationContext *eval_ctx, - struct Scene *scene, struct Object *ob, - struct RigidBodyWorld *rbw, - const bool do_proxy_update); +void BKE_object_handle_data_update( + const struct EvaluationContext *eval_ctx, + struct Scene *scene, + struct Object *ob); +void BKE_object_handle_update( + const struct EvaluationContext *eval_ctx, + struct Scene *scene, struct Object *ob); +void BKE_object_handle_update_ex( + const struct EvaluationContext *eval_ctx, + struct Scene *scene, struct Object *ob, + struct RigidBodyWorld *rbw, + const bool do_proxy_update); void BKE_object_sculpt_modifiers_changed(struct Object *ob); int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot); @@ -262,7 +266,7 @@ struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot); bool BKE_object_modifier_use_time(struct Object *ob, struct ModifierData *md); -bool BKE_object_modifier_update_subframe(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +bool BKE_object_modifier_update_subframe(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, bool update_mesh, int parent_recursion, float frame, int type); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index e73e3800af0..3f4941f222e 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -213,8 +213,9 @@ void BKE_sculptsession_free(struct Object *ob); void BKE_sculptsession_free_deformMats(struct SculptSession *ss); void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder); void BKE_sculptsession_bm_to_me_for_render(struct Object *object); -void BKE_sculpt_update_mesh_elements(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Sculpt *sd, struct Object *ob, - bool need_pmap, bool need_mask); +void BKE_sculpt_update_mesh_elements( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Sculpt *sd, struct Object *ob, + bool need_pmap, bool need_mask); struct MultiresModifierData *BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob); int BKE_sculpt_mask_layers_ensure(struct Object *ob, struct MultiresModifierData *mmd); diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index fed4e98c9f9..a563fcbc99e 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -78,7 +78,7 @@ struct EvaluationContext; /* common stuff that many particle functions need */ typedef struct ParticleSimulationData { - struct EvaluationContext *eval_ctx; + const struct EvaluationContext *eval_ctx; struct Scene *scene; struct Object *ob; struct ParticleSystem *psys; @@ -337,9 +337,9 @@ void psys_reset(struct ParticleSystem *psys, int mode); void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params); void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, const bool use_render_params); -void psys_cache_edit_paths(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params); +void psys_cache_edit_paths(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params); void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params); -int do_guides(struct EvaluationContext *eval_ctx, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int pa_num, float time); +int do_guides(const struct EvaluationContext *eval_ctx, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int pa_num, float time); void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors); float psys_get_timestep(struct ParticleSimulationData *sim); float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime); @@ -371,7 +371,7 @@ void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int end void psys_tasks_free(struct ParticleTask *tasks, int numtasks); void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]); -void psys_apply_hair_lattice(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); +void psys_apply_hair_lattice(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); /* particle_system.c */ struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt); @@ -386,7 +386,7 @@ void psys_check_boid_data(struct ParticleSystem *psys); void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra); -void particle_system_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); +void particle_system_update(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); /* Callback format for performing operations on ID-pointers for particle systems */ typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag); @@ -478,12 +478,12 @@ typedef struct ParticleRenderData { struct EvaluationContext; -void BKE_particle_system_settings_eval(struct EvaluationContext *eval_ctx, +void BKE_particle_system_settings_eval(const struct EvaluationContext *eval_ctx, struct ParticleSystem *psys); void BKE_particle_system_settings_recalc_clear(struct EvaluationContext *UNUSED(eval_ctx), struct ParticleSettings *particle_settings); -void BKE_particle_system_eval_init(struct EvaluationContext *eval_ctx, +void BKE_particle_system_eval_init(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index ec68253e162..6aa43665427 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -100,19 +100,19 @@ void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[ void BKE_rigidbody_sync_transforms(struct RigidBodyWorld *rbw, struct Object *ob, float ctime); bool BKE_rigidbody_check_sim_running(struct RigidBodyWorld *rbw, float ctime); void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw); -void BKE_rigidbody_rebuild_world(struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); -void BKE_rigidbody_do_simulation(struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); +void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); +void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); /* -------------------- */ /* Depsgraph evaluation */ -void BKE_rigidbody_rebuild_sim(struct EvaluationContext *eval_ctx, +void BKE_rigidbody_rebuild_sim(const struct EvaluationContext *eval_ctx, struct Scene *scene); -void BKE_rigidbody_eval_simulation(struct EvaluationContext *eval_ctx, +void BKE_rigidbody_eval_simulation(const struct EvaluationContext *eval_ctx, struct Scene *scene); -void BKE_rigidbody_object_sync_transforms(struct EvaluationContext *eval_ctx, +void BKE_rigidbody_object_sync_transforms(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 0ceaa9bdd71..d0c913d7235 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -99,8 +99,9 @@ typedef struct SceneBaseIter { int phase; } SceneBaseIter; -int BKE_scene_base_iter_next(struct EvaluationContext *eval_ctx, struct SceneBaseIter *iter, - struct Scene **scene, int val, struct BaseLegacy **base, struct Object **ob); +int BKE_scene_base_iter_next( + const struct EvaluationContext *eval_ctx, struct SceneBaseIter *iter, + struct Scene **scene, int val, struct BaseLegacy **base, struct Object **ob); void BKE_scene_base_flag_to_objects(struct SceneLayer *sl); void BKE_scene_base_flag_from_objects(struct Scene *scene); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 6e29db9529d..bcc06a4ab25 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -422,7 +422,7 @@ struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seq /* view3d draw callback, run when not in background view */ typedef struct ImBuf *(*SequencerDrawView)( - struct EvaluationContext *eval_ctx, struct Scene *, struct SceneLayer *sl, struct Object *, int, int, + const struct EvaluationContext *eval_ctx, struct Scene *, struct SceneLayer *sl, struct Object *, int, int, unsigned int, int, bool, bool, bool, int, int, bool, const char *, struct GPUFX *, struct GPUOffScreen *, char[256]); diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h index 40b349c9cbc..64d70e8e209 100644 --- a/source/blender/blenkernel/BKE_smoke.h +++ b/source/blender/blenkernel/BKE_smoke.h @@ -35,7 +35,7 @@ typedef float (*bresenham_callback)(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, struct EvaluationContext *eval_ctx, +struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index 89aaf4b39ec..e2255bdb779 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -60,7 +60,7 @@ extern void sbFree(struct SoftBody *sb); extern void sbFreeSimulation(struct SoftBody *sb); /* do one simul step, reading and writing vertex locs from given array */ -extern void sbObjectStep(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +extern void sbObjectStep(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float framnr, float (*vertexCos)[3], int numVerts); /* makes totally fresh start situation, resets time */ diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index f6127956597..ea0cd125b06 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -48,7 +48,7 @@ void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool lib struct EvaluationContext; -void BKE_world_eval(struct EvaluationContext *eval_ctx, struct World *world); +void BKE_world_eval(const struct EvaluationContext *eval_ctx, struct World *world); #endif diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 90e228d0494..309fcad0d0a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1136,7 +1136,7 @@ DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3]) } DerivedMesh *mesh_create_derived_for_modifier( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md, int build_shapekey_layers) { Mesh *me = ob->data; @@ -1742,7 +1742,7 @@ static void dm_ensure_display_normals(DerivedMesh *dm) * - apply deform modifiers and input vertexco */ static void mesh_calc_modifiers( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*inputVertexCos)[3], + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*inputVertexCos)[3], const bool useRenderParams, int useDeform, const bool need_mapping, CustomDataMask dataMask, const int index, const bool useCache, const bool build_shapekey_layers, @@ -2297,7 +2297,7 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh * } static void editbmesh_calc_modifiers( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, CustomDataMask dataMask, /* return args */ DerivedMesh **r_cage, DerivedMesh **r_final) @@ -2627,7 +2627,7 @@ static bool calc_modifiers_skip_orco(Scene *scene, #endif static void mesh_build_data( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, const bool build_shapekey_layers, const bool need_mapping) { BLI_assert(ob->type == OB_MESH); @@ -2663,7 +2663,9 @@ static void mesh_build_data( BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS)); } -static void editbmesh_build_data(struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask) +static void editbmesh_build_data( + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *obedit, BMEditMesh *em, CustomDataMask dataMask) { BKE_object_free_derived_caches(obedit); BKE_object_sculpt_modifiers_changed(obedit); @@ -2730,7 +2732,7 @@ static CustomDataMask object_get_datamask(const Scene *scene, Object *ob, bool * } void makeDerivedMesh( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, CustomDataMask dataMask, const bool build_shapekey_layers) { bool need_mapping; @@ -2746,7 +2748,8 @@ void makeDerivedMesh( /***/ -DerivedMesh *mesh_get_derived_final(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) +DerivedMesh *mesh_get_derived_final( + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh @@ -2765,7 +2768,7 @@ DerivedMesh *mesh_get_derived_final(struct EvaluationContext *eval_ctx, Scene *s return ob->derivedFinal; } -DerivedMesh *mesh_get_derived_deform(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) +DerivedMesh *mesh_get_derived_deform(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh @@ -2784,7 +2787,7 @@ DerivedMesh *mesh_get_derived_deform(struct EvaluationContext *eval_ctx, Scene * return ob->derivedDeform; } -DerivedMesh *mesh_create_derived_render(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) +DerivedMesh *mesh_create_derived_render(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) { DerivedMesh *final; @@ -2795,7 +2798,7 @@ DerivedMesh *mesh_create_derived_render(struct EvaluationContext *eval_ctx, Scen return final; } -DerivedMesh *mesh_create_derived_index_render(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, int index) +DerivedMesh *mesh_create_derived_index_render(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, int index) { DerivedMesh *final; @@ -2807,7 +2810,7 @@ DerivedMesh *mesh_create_derived_index_render(struct EvaluationContext *eval_ctx } DerivedMesh *mesh_create_derived_view( - struct EvaluationContext *eval_ctx, Scene *scene, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) { DerivedMesh *final; @@ -2828,7 +2831,7 @@ DerivedMesh *mesh_create_derived_view( } DerivedMesh *mesh_create_derived_no_deform( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; @@ -2841,7 +2844,7 @@ DerivedMesh *mesh_create_derived_no_deform( } DerivedMesh *mesh_create_derived_no_virtual( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; @@ -2854,7 +2857,7 @@ DerivedMesh *mesh_create_derived_no_virtual( } DerivedMesh *mesh_create_derived_physics( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; @@ -2867,7 +2870,7 @@ DerivedMesh *mesh_create_derived_physics( } DerivedMesh *mesh_create_derived_no_deform_render( - struct EvaluationContext *eval_ctx, Scene *scene, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { @@ -2883,7 +2886,7 @@ DerivedMesh *mesh_create_derived_no_deform_render( /***/ DerivedMesh *editbmesh_get_derived_cage_and_final( - struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask, /* return args */ DerivedMesh **r_final) @@ -2904,7 +2907,9 @@ DerivedMesh *editbmesh_get_derived_cage_and_final( return em->derivedCage; } -DerivedMesh *editbmesh_get_derived_cage(struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask) +DerivedMesh *editbmesh_get_derived_cage( + const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, + CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 68556354a6c..f71238031a2 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2850,7 +2850,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) #define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf -void BKE_animsys_eval_animdata(EvaluationContext *eval_ctx, ID *id) +void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id) { AnimData *adt = BKE_animdata_from_id(id); Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates, @@ -2860,7 +2860,7 @@ void BKE_animsys_eval_animdata(EvaluationContext *eval_ctx, ID *id) BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM); } -void BKE_animsys_eval_driver(EvaluationContext *eval_ctx, +void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, ID *id, FCurve *fcu) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 0f989f0a8ed..7dfc4df114c 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1461,7 +1461,7 @@ void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], fl copy_v3_v3(outloc, nLocMat[3]); } -void BKE_armature_mat_pose_to_bone_ex(struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) +void BKE_armature_mat_pose_to_bone_ex(const struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) { bPoseChannel work_pchan = *pchan; @@ -2194,7 +2194,9 @@ void BKE_pose_where_is_bone_tail(bPoseChannel *pchan) /* pchan is validated, as having bone and parent pointer * 'do_extra': when zero skips loc/size/rot, constraints and strip modifiers. */ -void BKE_pose_where_is_bone(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, bool do_extra) +void BKE_pose_where_is_bone( + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, bPoseChannel *pchan, float ctime, bool do_extra) { /* This gives a chan_mat with actions (ipos) results. */ if (do_extra) @@ -2255,7 +2257,7 @@ void BKE_pose_where_is_bone(struct EvaluationContext *eval_ctx, Scene *scene, Ob /* This only reads anim data from channels, and writes to channels */ /* This is the only function adding poses */ -void BKE_pose_where_is(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) { bArmature *arm; Bone *bone; diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 5d579b97619..0bd4d3b864f 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -266,8 +266,9 @@ static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime)) /* ----------- */ /* Evaluate spline IK for a given bone */ -static void splineik_evaluate_bone(struct EvaluationContext *eval_ctx, tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan, - int index, float ctime) +static void splineik_evaluate_bone( + const struct EvaluationContext *eval_ctx, tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan, + int index, float ctime) { bSplineIKConstraint *ikData = tree->ikData; float poseHead[3], poseTail[3], poseMat[4][4]; @@ -516,7 +517,7 @@ static void splineik_evaluate_bone(struct EvaluationContext *eval_ctx, tSplineIK } /* Evaluate the chain starting from the nominated bone */ -static void splineik_execute_tree(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +static void splineik_execute_tree(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { tSplineIK_Tree *tree; @@ -549,14 +550,16 @@ void BKE_pose_splineik_init_tree(Scene *scene, Object *ob, float ctime) splineik_init_tree(scene, ob, ctime); } -void BKE_splineik_execute_tree(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +void BKE_splineik_execute_tree( + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, bPoseChannel *pchan_root, float ctime) { splineik_execute_tree(eval_ctx, scene, ob, pchan_root, ctime); } /* *************** Depsgraph evaluation callbacks ************ */ -void BKE_pose_eval_init(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_init(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPose *pose) @@ -590,7 +593,7 @@ void BKE_pose_eval_init(struct EvaluationContext *eval_ctx, BKE_pose_splineik_init_tree(scene, ob, ctime); } -void BKE_pose_eval_bone(struct EvaluationContext *eval_ctx, +void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan) @@ -625,7 +628,7 @@ void BKE_pose_eval_bone(struct EvaluationContext *eval_ctx, } } -void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan) @@ -646,7 +649,7 @@ void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx, } } -void BKE_pose_bone_done(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx), bPoseChannel *pchan) { float imat[4][4]; @@ -657,7 +660,7 @@ void BKE_pose_bone_done(struct EvaluationContext *UNUSED(eval_ctx), } } -void BKE_pose_iktree_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *rootchan) @@ -667,7 +670,7 @@ void BKE_pose_iktree_evaluate(struct EvaluationContext *eval_ctx, BIK_execute_tree(eval_ctx, scene, ob, rootchan, ctime); } -void BKE_pose_splineik_evaluate(struct EvaluationContext *eval_ctx, +void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *rootchan) @@ -677,7 +680,7 @@ void BKE_pose_splineik_evaluate(struct EvaluationContext *eval_ctx, BKE_splineik_execute_tree(eval_ctx, scene, ob, rootchan, ctime); } -void BKE_pose_eval_flush(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *ob, bPose *UNUSED(pose)) @@ -692,7 +695,7 @@ void BKE_pose_eval_flush(struct EvaluationContext *UNUSED(eval_ctx), ob->recalc &= ~OB_RECALC_ALL; } -void BKE_pose_eval_proxy_copy(struct EvaluationContext *UNUSED(eval_ctx), Object *ob) +void BKE_pose_eval_proxy_copy(const struct EvaluationContext *UNUSED(eval_ctx), Object *ob) { BLI_assert(ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from != NULL); DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 825a5870e54..09b793629f7 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -345,7 +345,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul return 1; } -static int do_step_cloth(struct EvaluationContext *eval_ctx, Object *ob, ClothModifierData *clmd, DerivedMesh *result, int framenr) +static int do_step_cloth(const struct EvaluationContext *eval_ctx, Object *ob, ClothModifierData *clmd, DerivedMesh *result, int framenr) { ClothVertex *verts = NULL; Cloth *cloth; @@ -400,7 +400,7 @@ static int do_step_cloth(struct EvaluationContext *eval_ctx, Object *ob, ClothMo /************************************************ * clothModifier_do - main simulation function ************************************************/ -void clothModifier_do(ClothModifierData *clmd, struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm, float (*vertexCos)[3]) +void clothModifier_do(ClothModifierData *clmd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm, float (*vertexCos)[3]) { PointCache *cache; PTCacheID pid; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 1bd7a01b1b8..e87086380bd 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -689,7 +689,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { /* This function should be used for the get_target_matrix member of all * constraints that are not picky about what happens to their target matrix. */ -static void default_get_tarmat(struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) +static void default_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail); @@ -1155,7 +1155,7 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void kinematic_get_tarmat(struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void kinematic_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bKinematicConstraint *data = con->data; @@ -1242,7 +1242,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy } } -static void followpath_get_tarmat(struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void followpath_get_tarmat(const struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bFollowPathConstraint *data = con->data; @@ -2024,7 +2024,7 @@ static void pycon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userd } /* Whether this approach is maintained remains to be seen (aligorith) */ -static void pycon_get_tarmat(struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void pycon_get_tarmat(const struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { #ifdef WITH_PYTHON bPythonConstraint *data = con->data; @@ -2142,7 +2142,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void actcon_get_tarmat(struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void actcon_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bActionConstraint *data = con->data; @@ -3131,7 +3131,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void clampto_get_tarmat(struct EvaluationContext *eval_ctx, bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void clampto_get_tarmat(const struct EvaluationContext *eval_ctx, bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { #ifdef CYCLIC_DEPENDENCY_WORKAROUND if (VALID_CONS_TARGET(ct)) { @@ -3474,7 +3474,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy } -static void shrinkwrap_get_tarmat(struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void shrinkwrap_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; @@ -3806,7 +3806,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void splineik_get_tarmat(struct EvaluationContext *eval_ctx, bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void splineik_get_tarmat(const struct EvaluationContext *eval_ctx, bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { #ifdef CYCLIC_DEPENDENCY_WORKAROUND if (VALID_CONS_TARGET(ct)) { @@ -4864,7 +4864,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan) * None of the actual calculations of the matrices should be done here! Also, this function is * not to be used by any new constraints, particularly any that have multiple targets. */ -void BKE_constraint_target_matrix_get(struct EvaluationContext *eval_ctx, Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime) +void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; @@ -4931,7 +4931,7 @@ void BKE_constraint_target_matrix_get(struct EvaluationContext *eval_ctx, Scene } /* Get the list of targets required for solving a constraint */ -void BKE_constraint_targets_for_solving_get(struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) +void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); @@ -4966,7 +4966,7 @@ void BKE_constraint_targets_for_solving_get(struct EvaluationContext *eval_ctx, * BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and * after running this function, to sort out cob */ -void BKE_constraints_solve(struct EvaluationContext *eval_ctx, ListBase *conlist, bConstraintOb *cob, float ctime) +void BKE_constraints_solve(const struct EvaluationContext *eval_ctx, ListBase *conlist, bConstraintOb *cob, float ctime) { bConstraint *con; float oldmat[4][4]; diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index da05c05a694..d2ffbbcf27b 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -99,7 +99,8 @@ static int modifiers_disable_subsurf_temporary(Object *ob) } /* disable subsurf temporal, get mapped cos, and enable it */ -float (*BKE_crazyspace_get_mapped_editverts(struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit))[3] +float (*BKE_crazyspace_get_mapped_editverts( + const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit))[3] { Mesh *me = obedit->data; DerivedMesh *dm; @@ -250,8 +251,9 @@ void BKE_crazyspace_set_quats_mesh(Mesh *me, float (*origcos)[3], float (*mapped /** returns an array of deform matrices for crazyspace correction, and the * number of modifiers left */ -int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, - float (**deformmats)[3][3], float (**deformcos)[3]) +int BKE_crazyspace_get_first_deform_matrices_editbmesh( + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, + float (**deformmats)[3][3], float (**deformcos)[3]) { ModifierData *md; DerivedMesh *dm; @@ -310,7 +312,9 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct EvaluationContext return numleft; } -int BKE_sculpt_get_first_deform_matrices(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) +int BKE_sculpt_get_first_deform_matrices( + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) { ModifierData *md; DerivedMesh *dm; @@ -369,7 +373,7 @@ int BKE_sculpt_get_first_deform_matrices(struct EvaluationContext *eval_ctx, Sce return numleft; } -void BKE_crazyspace_build_sculpt(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) +void BKE_crazyspace_build_sculpt(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) { int totleft = BKE_sculpt_get_first_deform_matrices(eval_ctx, scene, ob, deformmats, deformcos); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d44ddd8171c..351f443cbc9 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1622,7 +1622,7 @@ float *BKE_curve_surf_make_orco(Object *ob) /* NOTE: This routine is tied to the order of vertex * built by displist and as passed to the renderer. */ -float *BKE_curve_make_orco(EvaluationContext *eval_ctx, Scene *scene, Object *ob, int *r_numVerts) +float *BKE_curve_make_orco(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, int *r_numVerts) { Curve *cu = ob->data; DispList *dl; @@ -1721,8 +1721,9 @@ float *BKE_curve_make_orco(EvaluationContext *eval_ctx, Scene *scene, Object *ob /* ***************** BEVEL ****************** */ -void BKE_curve_bevel_make(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *disp, - const bool for_render, const bool use_render_resolution) +void BKE_curve_bevel_make( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *disp, + const bool for_render, const bool use_render_resolution) { DispList *dl, *dlnew; Curve *bevcu, *cu; @@ -4674,7 +4675,7 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *t /* **** Depsgraph evaluation **** */ -void BKE_curve_eval_geometry(EvaluationContext *UNUSED(eval_ctx), +void BKE_curve_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), Curve *curve) { if (G.debug & G_DEBUG_DEPSGRAPH) { @@ -4685,7 +4686,7 @@ void BKE_curve_eval_geometry(EvaluationContext *UNUSED(eval_ctx), } } -void BKE_curve_eval_path(EvaluationContext *UNUSED(eval_ctx), +void BKE_curve_eval_path(const EvaluationContext *UNUSED(eval_ctx), Curve *curve) { /* TODO(sergey): This will probably need to be a part of diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 0b88cc48a96..00b8063110d 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1010,7 +1010,8 @@ static bool data_transfer_layersmapping_generate( * to get (as much as possible) exact copy of source data layout. */ void BKE_object_data_transfer_layout( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, const bool use_delete, + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob_src, Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX]) { DerivedMesh *dm_src; @@ -1085,7 +1086,7 @@ void BKE_object_data_transfer_layout( } bool BKE_object_data_transfer_dm( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, DerivedMesh *dm_dst, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, DerivedMesh *dm_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, @@ -1457,7 +1458,7 @@ bool BKE_object_data_transfer_dm( } bool BKE_object_data_transfer_mesh( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index fd22aaa291b..8316d68b35c 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -678,7 +678,7 @@ static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dis * - first point left, last point right * - based on subdivided points in original curve, not on points in taper curve (still) */ -static float displist_calc_taper(EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, float fac) +static float displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, float fac) { DispList *dl; @@ -718,14 +718,14 @@ static float displist_calc_taper(EvaluationContext *eval_ctx, Scene *scene, Obje return 1.0; } -float BKE_displist_calc_taper(EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, int cur, int tot) +float BKE_displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, int cur, int tot) { float fac = ((float)cur) / (float)(tot - 1); return displist_calc_taper(eval_ctx, scene, taperobj, fac); } -void BKE_displist_make_mball(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_displist_make_mball(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { if (!ob || ob->type != OB_MBALL) return; @@ -748,7 +748,7 @@ void BKE_displist_make_mball(EvaluationContext *eval_ctx, Scene *scene, Object * } } -void BKE_displist_make_mball_forRender(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) +void BKE_displist_make_mball_forRender(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) { BKE_mball_polygonize(eval_ctx, scene, ob, dispbase); BKE_mball_texspace_calc(ob); @@ -798,8 +798,9 @@ static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, return pretessellatePoint; } -static void curve_calc_modifiers_pre(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, - const bool for_render, const bool use_render_resolution) +static void curve_calc_modifiers_pre( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, + const bool for_render, const bool use_render_resolution) { VirtualModifierData virtualModifierData; ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); @@ -908,9 +909,10 @@ static void displist_apply_allverts(ListBase *dispbase, float (*allverts)[3]) } } -static void curve_calc_modifiers_post(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, - ListBase *dispbase, DerivedMesh **r_dm_final, - const bool for_render, const bool use_render_resolution) +static void curve_calc_modifiers_post( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, + ListBase *dispbase, DerivedMesh **r_dm_final, + const bool for_render, const bool use_render_resolution) { VirtualModifierData virtualModifierData; ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); @@ -1090,7 +1092,7 @@ static void displist_surf_indices(DispList *dl) } } -static DerivedMesh *create_orco_dm(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +static DerivedMesh *create_orco_dm(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { DerivedMesh *dm; ListBase disp = {NULL, NULL}; @@ -1134,8 +1136,9 @@ static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm) DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, orco); } -static void curve_calc_orcodm(EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, - const bool for_render, const bool use_render_resolution) +static void curve_calc_orcodm( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, + const bool for_render, const bool use_render_resolution) { /* this function represents logic of mesh's orcodm calculation * for displist-based objects @@ -1201,9 +1204,10 @@ static void curve_calc_orcodm(EvaluationContext *eval_ctx, Scene *scene, Object orcodm->release(orcodm); } -void BKE_displist_make_surf(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, - DerivedMesh **r_dm_final, - const bool for_render, const bool for_orco, const bool use_render_resolution) +void BKE_displist_make_surf( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + DerivedMesh **r_dm_final, + const bool for_render, const bool for_orco, const bool use_render_resolution) { ListBase nubase = {NULL, NULL}; Nurb *nu; @@ -1513,9 +1517,10 @@ static void calc_bevfac_mapping(Curve *cu, BevList *bl, Nurb *nu, } } -static void do_makeDispListCurveTypes(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, - DerivedMesh **r_dm_final, - const bool for_render, const bool for_orco, const bool use_render_resolution) +static void do_makeDispListCurveTypes( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + DerivedMesh **r_dm_final, + const bool for_render, const bool for_orco, const bool use_render_resolution) { Curve *cu = ob->data; @@ -1761,7 +1766,7 @@ static void do_makeDispListCurveTypes(EvaluationContext *eval_ctx, Scene *scene, } } -void BKE_displist_make_curveTypes(EvaluationContext *eval_ctx, Scene *scene, Object *ob, const bool for_orco) +void BKE_displist_make_curveTypes(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, const bool for_orco) { ListBase *dispbase; @@ -1784,9 +1789,10 @@ void BKE_displist_make_curveTypes(EvaluationContext *eval_ctx, Scene *scene, Obj boundbox_displist_object(ob); } -void BKE_displist_make_curveTypes_forRender(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, - DerivedMesh **r_dm_final, const bool for_orco, - const bool use_render_resolution) +void BKE_displist_make_curveTypes_forRender( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + DerivedMesh **r_dm_final, const bool for_orco, + const bool use_render_resolution) { if (ob->curve_cache == NULL) { ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); @@ -1795,7 +1801,8 @@ void BKE_displist_make_curveTypes_forRender(EvaluationContext *eval_ctx, Scene * do_makeDispListCurveTypes(eval_ctx, scene, ob, dispbase, r_dm_final, true, for_orco, use_render_resolution); } -void BKE_displist_make_curveTypes_forOrco(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) +void BKE_displist_make_curveTypes_forOrco( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) { if (ob->curve_cache == NULL) { ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); @@ -1805,9 +1812,10 @@ void BKE_displist_make_curveTypes_forOrco(EvaluationContext *eval_ctx, Scene *sc } /* add Orco layer to the displist object which has got derived mesh and return orco */ -float *BKE_displist_make_orco(EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, - const bool for_render, - const bool use_render_resolution) +float *BKE_displist_make_orco( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, + const bool for_render, + const bool use_render_resolution) { float *orco; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 50a476c3fde..724b30d0cb1 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1975,7 +1975,9 @@ static void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMe /* * Updates derived mesh copy and processes dynamic paint step / caches. */ -static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) +static void dynamicPaint_frameUpdate( + DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, DerivedMesh *dm) { if (pmd->canvas) { DynamicPaintCanvasSettings *canvas = pmd->canvas; @@ -2057,7 +2059,9 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, struct Evalu } /* Modifier call. Processes dynamic paint modifier step. */ -DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) +DerivedMesh *dynamicPaint_Modifier_do( + DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, DerivedMesh *dm) { if (pmd->canvas) { DerivedMesh *ret; @@ -3578,7 +3582,8 @@ static void dynamic_paint_brush_velocity_compute_cb(void *userdata, const int i) } static void dynamicPaint_brushMeshCalculateVelocity( - struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DynamicPaintBrushSettings *brush, Vec3f **brushVel, float timescale) + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, DynamicPaintBrushSettings *brush, Vec3f **brushVel, float timescale) { float prev_obmat[4][4]; DerivedMesh *dm_p, *dm_c; @@ -3636,7 +3641,7 @@ static void dynamicPaint_brushMeshCalculateVelocity( } /* calculate velocity for object center point */ -static void dynamicPaint_brushObjectCalculateVelocity(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) +static void dynamicPaint_brushObjectCalculateVelocity(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) { float prev_obmat[4][4]; float cur_loc[3] = {0.0f}, prev_loc[3] = {0.0f}; @@ -4032,7 +4037,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( } } -static int dynamicPaint_paintMesh(struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, +static int dynamicPaint_paintMesh(const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, @@ -4526,7 +4531,7 @@ static void dynamic_paint_paint_single_point_cb_ex( } static int dynamicPaint_paintSinglePoint( - struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, + const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale) { PaintSurfaceData *sData = surface->data; @@ -4841,7 +4846,7 @@ static void dynamic_paint_prepare_effect_cb(void *userdata, const int index) } static int dynamicPaint_prepareEffectStep( - struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, Scene *scene, Object *ob, float **force, float timescale) + const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, Scene *scene, Object *ob, float **force, float timescale) { double average_force = 0.0f; float shrink_speed = 0.0f, spread_speed = 0.0f; @@ -5754,7 +5759,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Sce /* * Do Dynamic Paint step. Paints scene brush objects of current state/frame to the surface. */ -static int dynamicPaint_doStep(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) +static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; @@ -5925,7 +5930,9 @@ static int dynamicPaint_doStep(struct EvaluationContext *eval_ctx, Scene *scene, /* * Calculate a single frame and included subframes for surface */ -int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, struct EvaluationContext *eval_ctx, Scene *scene, Object *cObject, int frame) +int dynamicPaint_calculateFrame( + DynamicPaintSurface *surface, const struct EvaluationContext *eval_ctx, + Scene *scene, Object *cObject, int frame) { float timescale = 1.0f; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 040768dddef..2beb15ed995 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -2169,7 +2169,7 @@ static void cage_mapped_verts_callback( } } -float (*BKE_editmesh_vertexCos_get(struct EvaluationContext *eval_ctx, BMEditMesh *em, Scene *scene, int *r_numVerts))[3] +float (*BKE_editmesh_vertexCos_get(const struct EvaluationContext *eval_ctx, BMEditMesh *em, Scene *scene, int *r_numVerts))[3] { DerivedMesh *cage, *final; BLI_bitmap *visit_bitmap; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 521f91b2afa..36f7f6d604e 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -147,7 +147,7 @@ void free_partdeflect(PartDeflect *pd) MEM_freeN(pd); } -static EffectorCache *new_effector_cache(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd) +static EffectorCache *new_effector_cache(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd) { EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache"); eff->eval_ctx = eval_ctx; @@ -158,7 +158,7 @@ static EffectorCache *new_effector_cache(struct EvaluationContext *eval_ctx, Sce eff->frame = -1; return eff; } -static void add_object_to_effectors(ListBase **effectors, struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, Object *ob_src, bool for_simulation) +static void add_object_to_effectors(ListBase **effectors, const struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, Object *ob_src, bool for_simulation) { EffectorCache *eff = NULL; @@ -183,7 +183,7 @@ static void add_object_to_effectors(ListBase **effectors, struct EvaluationConte BLI_addtail(*effectors, eff); } -static void add_particles_to_effectors(ListBase **effectors, struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation) +static void add_particles_to_effectors(ListBase **effectors, const struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation) { ParticleSettings *part= psys->part; @@ -209,8 +209,9 @@ static void add_particles_to_effectors(ListBase **effectors, struct EvaluationCo } /* returns ListBase handle with objects taking part in the effecting */ -ListBase *pdInitEffectors(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, ParticleSystem *psys_src, - EffectorWeights *weights, bool for_simulation) +ListBase *pdInitEffectors( + const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, ParticleSystem *psys_src, + EffectorWeights *weights, bool for_simulation) { SceneLayer *sl; Base *base; @@ -278,7 +279,7 @@ void pdEndEffectors(ListBase **effectors) } } -static void precalculate_effector(struct EvaluationContext *eval_ctx, EffectorCache *eff) +static void precalculate_effector(const struct EvaluationContext *eval_ctx, EffectorCache *eff) { unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra); if (!eff->pd->rng) @@ -318,7 +319,7 @@ static void precalculate_effector(struct EvaluationContext *eval_ctx, EffectorCa } } -void pdPrecalculateEffectors(struct EvaluationContext *eval_ctx, ListBase *effectors) +void pdPrecalculateEffectors(const struct EvaluationContext *eval_ctx, ListBase *effectors) { if (effectors) { EffectorCache *eff = effectors->first; diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 96637fa5458..12b9abc6d03 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -65,7 +65,7 @@ // file handling //------------------------------------------------------------------------------- -void initElbeemMesh(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +void initElbeemMesh(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex) diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index d584cb03b90..5ccbe9f7054 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -327,7 +327,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode) * you can draw everything, leaves tags in objects to signal it needs further updating */ /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */ -void BKE_group_handle_recalc_and_update(struct EvaluationContext *eval_ctx, Scene *scene, Object *UNUSED(parent), Group *group) +void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx, Scene *scene, Object *UNUSED(parent), Group *group) { GroupObject *go; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 9f382020555..0f26f53113f 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -603,7 +603,7 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di /* co: local coord, result local too */ /* returns quaternion for rotation, using cd->no_rot_axis */ /* axis is using another define!!! */ -static bool calc_curve_deform(struct EvaluationContext *eval_ctx, Scene *scene, Object *par, float co[3], +static bool calc_curve_deform(const struct EvaluationContext *eval_ctx, Scene *scene, Object *par, float co[3], const short axis, CurveDeform *cd, float r_quat[4]) { Curve *cu = par->data; @@ -707,7 +707,8 @@ static bool calc_curve_deform(struct EvaluationContext *eval_ctx, Scene *scene, } void curve_deform_verts( - struct EvaluationContext *eval_ctx, Scene *scene, Object *cuOb, Object *target, DerivedMesh *dm, float (*vertexCos)[3], + const struct EvaluationContext *eval_ctx, Scene *scene, + Object *cuOb, Object *target, DerivedMesh *dm, float (*vertexCos)[3], int numVerts, const char *vgroup, short defaxis) { Curve *cu; @@ -825,7 +826,7 @@ void curve_deform_verts( /* input vec and orco = local coord in armature space */ /* orco is original not-animated or deformed reference point */ /* result written in vec and mat */ -void curve_deform_vector(struct EvaluationContext *eval_ctx, Scene *scene, Object *cuOb, Object *target, +void curve_deform_vector(const struct EvaluationContext *eval_ctx, Scene *scene, Object *cuOb, Object *target, float orco[3], float vec[3], float mat[3][3], int no_rot_axis) { CurveDeform cd; @@ -1034,7 +1035,7 @@ void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]) } } -void BKE_lattice_modifiers_calc(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_lattice_modifiers_calc(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) { Lattice *lt = ob->data; VirtualModifierData virtualModifierData; @@ -1235,7 +1236,7 @@ void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys) /* **** Depsgraph evaluation **** */ -void BKE_lattice_eval_geometry(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_lattice_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx), Lattice *UNUSED(latt)) { } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 56b9bd2cc1e..16a4477977f 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1734,7 +1734,7 @@ static void idproperty_reset(IDProperty **props, IDProperty *props_ref) } } -void BKE_layer_eval_layer_collection_pre(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_layer_eval_layer_collection_pre(const struct EvaluationContext *UNUSED(eval_ctx), Scene *scene, SceneLayer *scene_layer) { DEBUG_PRINT("%s on %s (%p)\n", __func__, scene_layer->name, scene_layer); @@ -1751,7 +1751,7 @@ void BKE_layer_eval_layer_collection_pre(struct EvaluationContext *UNUSED(eval_c scene_layer->flag |= SCENE_LAYER_ENGINE_DIRTY; } -void BKE_layer_eval_layer_collection(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_layer_eval_layer_collection(const struct EvaluationContext *UNUSED(eval_ctx), LayerCollection *layer_collection, LayerCollection *parent_layer_collection) { @@ -1798,7 +1798,7 @@ void BKE_layer_eval_layer_collection(struct EvaluationContext *UNUSED(eval_ctx), } } -void BKE_layer_eval_layer_collection_post(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_layer_eval_layer_collection_post(const struct EvaluationContext *UNUSED(eval_ctx), SceneLayer *scene_layer) { DEBUG_PRINT("%s on %s (%p)\n", __func__, scene_layer->name, scene_layer); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 5caeff4df1c..be3cc288818 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1815,7 +1815,7 @@ bool BKE_object_material_edit_image_set(Object *ob, short mat_nr, Image *image) return false; } -void BKE_material_eval(struct EvaluationContext *UNUSED(eval_ctx), Material *material) +void BKE_material_eval(const struct EvaluationContext *UNUSED(eval_ctx), Material *material) { if (G.debug & G_DEBUG_DEPSGRAPH) { printf("%s on %s (%p)\n", __func__, material->id.name, material); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index fe3ae9ccb18..f1e549b1400 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -538,7 +538,7 @@ void BKE_mball_select_swap(struct MetaBall *mb) /* **** Depsgraph evaluation **** */ -void BKE_mball_eval_geometry(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_mball_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx), MetaBall *UNUSED(mball)) { } diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index d897213d362..1d9c580d45b 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -1079,7 +1079,7 @@ static void polygonize(PROCESS *process) * Iterates over ALL objects in the scene and all of its sets, including * making all duplis(not only metas). Copies metas to mainb array. * Computes bounding boxes for building BVH. */ -static void init_meta(EvaluationContext *eval_ctx, PROCESS *process, Scene *scene, Object *ob) +static void init_meta(const EvaluationContext *eval_ctx, PROCESS *process, Scene *scene, Object *ob) { Scene *sce_iter = scene; BaseLegacy *base; @@ -1256,7 +1256,7 @@ static void init_meta(EvaluationContext *eval_ctx, PROCESS *process, Scene *scen } } -void BKE_mball_polygonize(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) +void BKE_mball_polygonize(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) { MetaBall *mb; DispList *dl; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a52b8cc030d..a0edc75a7b4 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1631,7 +1631,7 @@ void BKE_mesh_to_curve_nurblist(DerivedMesh *dm, ListBase *nurblist, const int e } } -void BKE_mesh_to_curve(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_mesh_to_curve(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { /* make new mesh data from the original copy */ DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_MESH); @@ -2469,7 +2469,7 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) /* settings: 1 - preview, 2 - render */ Mesh *BKE_mesh_new_from_object( - EvaluationContext *eval_ctx, Main *bmain, Scene *sce, Object *ob, + const EvaluationContext *eval_ctx, Main *bmain, Scene *sce, Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed) { Mesh *tmpmesh; @@ -2706,7 +2706,7 @@ Mesh *BKE_mesh_new_from_object( /* **** Depsgraph evaluation **** */ -void BKE_mesh_eval_geometry(EvaluationContext *UNUSED(eval_ctx), +void BKE_mesh_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), Mesh *mesh) { if (G.debug & G_DEBUG_DEPSGRAPH) { diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index cefdbc3edc1..1a146dc67d1 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -757,7 +757,7 @@ void modifier_path_init(char *path, int path_maxlen, const char *name) /* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */ struct DerivedMesh *modwrap_applyModifier( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag) { @@ -771,7 +771,7 @@ struct DerivedMesh *modwrap_applyModifier( } struct DerivedMesh *modwrap_applyModifierEM( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, DerivedMesh *dm, ModifierApplyFlag flag) @@ -786,7 +786,7 @@ struct DerivedMesh *modwrap_applyModifierEM( } void modwrap_deformVerts( - ModifierData *md, struct EvaluationContext *eval_ctx, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag) @@ -801,7 +801,7 @@ void modwrap_deformVerts( } void modwrap_deformVertsEM( - ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 3e4828afb55..7ef4b588dcd 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -276,7 +276,7 @@ static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level) return mdisps; } -DerivedMesh *get_multires_dm(struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *ob) +DerivedMesh *get_multires_dm(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *ob) { ModifierData *md = (ModifierData *)mmd; const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -397,7 +397,7 @@ void multires_force_render_update(Object *ob) multires_force_update(ob); } -int multiresModifier_reshapeFromDM(struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, +int multiresModifier_reshapeFromDM(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *ob, DerivedMesh *srcdm) { DerivedMesh *mrdm = get_multires_dm(eval_ctx, scene, mmd, ob); @@ -419,13 +419,13 @@ int multiresModifier_reshapeFromDM(struct EvaluationContext *eval_ctx, Scene *sc } /* Returns 1 on success, 0 if the src's totvert doesn't match */ -int multiresModifier_reshape(struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *dst, Object *src) +int multiresModifier_reshape(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *dst, Object *src) { DerivedMesh *srcdm = mesh_get_derived_final(eval_ctx, scene, src, CD_MASK_BAREMESH); return multiresModifier_reshapeFromDM(eval_ctx, scene, mmd, dst, srcdm); } -int multiresModifier_reshapeFromDeformMod(struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, +int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *ob, ModifierData *md) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -2174,7 +2174,7 @@ static void multires_sync_levels(Scene *scene, Object *ob_src, Object *ob_dst) } } -static void multires_apply_smat(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float smat[3][3]) +static void multires_apply_smat(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float smat[3][3]) { DerivedMesh *dm = NULL, *cddm = NULL, *subdm = NULL; CCGElem **gridData, **subGridData; @@ -2276,7 +2276,7 @@ int multires_mdisp_corners(MDisps *s) return 0; } -void multiresModifier_scale_disp(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void multiresModifier_scale_disp(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) { float smat[3][3]; @@ -2286,7 +2286,7 @@ void multiresModifier_scale_disp(struct EvaluationContext *eval_ctx, Scene *scen multires_apply_smat(eval_ctx, scene, ob, smat); } -void multiresModifier_prepare_join(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *to_ob) +void multiresModifier_prepare_join(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *to_ob) { float smat[3][3], tmat[3][3], mat[3][3]; multires_sync_levels(scene, to_ob, ob); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b90371a448e..9f48d8f6b11 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2104,8 +2104,9 @@ static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat } /* note, scene is the active scene while actual_scene is the scene the object resides in */ -void BKE_object_where_is_calc_time_ex(EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime, - RigidBodyWorld *rbw, float r_originmat[3][3]) +void BKE_object_where_is_calc_time_ex( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime, + RigidBodyWorld *rbw, float r_originmat[3][3]) { if (ob == NULL) return; @@ -2149,7 +2150,7 @@ void BKE_object_where_is_calc_time_ex(EvaluationContext *eval_ctx, Scene *scene, else ob->transflag &= ~OB_NEG_SCALE; } -void BKE_object_where_is_calc_time(EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +void BKE_object_where_is_calc_time(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) { BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, ctime, NULL, NULL); } @@ -2176,17 +2177,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) } } -void BKE_object_where_is_calc_ex(EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3]) +void BKE_object_where_is_calc_ex(const EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3]) { BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat); } -void BKE_object_where_is_calc(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_object_where_is_calc(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), NULL, NULL); } /* for calculation of the inverse parent transform, only used for editor */ -void BKE_object_workob_calc_parent(EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *workob) +void BKE_object_workob_calc_parent(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *workob) { BKE_object_workob_clear(workob); @@ -2638,7 +2639,7 @@ bool BKE_object_parent_loop_check(const Object *par, const Object *ob) /* the main object update call, for object matrix, constraints, keys and displist (modifiers) */ /* requires flags to be set! */ /* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */ -void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, +void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, RigidBodyWorld *rbw, const bool do_proxy_update) @@ -2717,7 +2718,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world */ -void BKE_object_handle_update(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_object_handle_update(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { BKE_object_handle_update_ex(eval_ctx, scene, ob, NULL, true); } @@ -3633,9 +3634,9 @@ static void object_cacheIgnoreClear(Object *ob, int state) /* Note: this function should eventually be replaced by depsgraph functionality. * Avoid calling this in new code unless there is a very good reason for it! */ -bool BKE_object_modifier_update_subframe(EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update_mesh, - int parent_recursion, float frame, - int type) +bool BKE_object_modifier_update_subframe( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update_mesh, + int parent_recursion, float frame, int type) { ModifierData *md = modifiers_findByType(ob, (ModifierType)type); bConstraint *con; diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 66cacd67a85..c25207d81bf 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -69,7 +69,7 @@ /* Dupli-Geometry */ typedef struct DupliContext { - EvaluationContext *eval_ctx; + const EvaluationContext *eval_ctx; bool do_update; bool animated; Group *group; /* XXX child objects are selected from this group if set, could be nicer */ @@ -95,7 +95,7 @@ typedef struct DupliGenerator { static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); /* create initial context for root object */ -static void init_context(DupliContext *r_ctx, EvaluationContext *eval_ctx, Scene *scene, Object *ob, float space_mat[4][4], bool update) +static void init_context(DupliContext *r_ctx, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float space_mat[4][4], bool update) { r_ctx->eval_ctx = eval_ctx; r_ctx->scene = scene; @@ -1216,7 +1216,7 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) /* ---- ListBase dupli container implementation ---- */ /* Returns a list of DupliObject */ -ListBase *object_duplilist_ex(EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update) +ListBase *object_duplilist_ex(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update) { ListBase *duplilist = MEM_callocN(sizeof(ListBase), "duplilist"); DupliContext ctx; @@ -1231,7 +1231,7 @@ ListBase *object_duplilist_ex(EvaluationContext *eval_ctx, Scene *scene, Object /* note: previously updating was always done, this is why it defaults to be on * but there are likely places it can be called without updating */ -ListBase *object_duplilist(EvaluationContext *eval_ctx, Scene *sce, Object *ob) +ListBase *object_duplilist(const EvaluationContext *eval_ctx, Scene *sce, Object *ob) { return object_duplilist_ex(eval_ctx, sce, ob, true); } @@ -1272,7 +1272,7 @@ int count_duplilist(Object *ob) return 1; } -DupliApplyData *duplilist_apply(EvaluationContext *eval_ctx, Object *ob, Scene *scene, ListBase *duplilist) +DupliApplyData *duplilist_apply(const EvaluationContext *eval_ctx, Object *ob, Scene *scene, ListBase *duplilist) { DupliApplyData *apply_data = NULL; int num_objects = BLI_listbase_count(duplilist); diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 0bbfbb8a4e7..c5d267ace9d 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -69,7 +69,7 @@ static ThreadMutex material_lock = BLI_MUTEX_INITIALIZER; -void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *ob) { @@ -81,7 +81,7 @@ void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx), /* Evaluate parent */ /* NOTE: based on solve_parenting(), but with the cruft stripped out */ -void BKE_object_eval_parent(EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_parent(const EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *ob) { @@ -113,7 +113,7 @@ void BKE_object_eval_parent(EvaluationContext *UNUSED(eval_ctx), } } -void BKE_object_eval_constraints(EvaluationContext *eval_ctx, +void BKE_object_eval_constraints(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { @@ -136,7 +136,7 @@ void BKE_object_eval_constraints(EvaluationContext *eval_ctx, BKE_constraints_clear_evalob(cob); } -void BKE_object_eval_done(EvaluationContext *UNUSED(eval_ctx), Object *ob) +void BKE_object_eval_done(const EvaluationContext *UNUSED(eval_ctx), Object *ob) { DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); @@ -145,9 +145,10 @@ void BKE_object_eval_done(EvaluationContext *UNUSED(eval_ctx), Object *ob) else ob->transflag &= ~OB_NEG_SCALE; } -void BKE_object_handle_data_update(EvaluationContext *eval_ctx, - Scene *scene, - Object *ob) +void BKE_object_handle_data_update( + const EvaluationContext *eval_ctx, + Scene *scene, + Object *ob) { ID *data_id = (ID *)ob->data; AnimData *adt = BKE_animdata_from_id(data_id); @@ -296,7 +297,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx, /* quick cache removed */ } -void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_uber_transform(const EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *ob) { @@ -326,7 +327,7 @@ void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx), } } -void BKE_object_eval_uber_data(EvaluationContext *eval_ctx, +void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { @@ -401,13 +402,13 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx, ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME); } -void BKE_object_eval_cloth(EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *object) +void BKE_object_eval_cloth(const EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *object) { DEBUG_PRINT("%s on %s\n", __func__, object->id.name); BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH); } -void BKE_object_eval_update_shading(EvaluationContext *UNUSED(eval_ctx), Object *object) +void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), Object *object) { DEBUG_PRINT("%s on %s\n", __func__, object->id.name); if (object->type == OB_MESH) { diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 1831ca02ee8..cc195f67a7a 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -840,8 +840,9 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) /** * \param need_mask So the DerivedMesh thats returned has mask data */ -void BKE_sculpt_update_mesh_elements(EvaluationContext *eval_ctx, Scene *scene, Sculpt *sd, Object *ob, - bool need_pmap, bool need_mask) +void BKE_sculpt_update_mesh_elements( + const EvaluationContext *eval_ctx, Scene *scene, Sculpt *sd, Object *ob, + bool need_pmap, bool need_mask) { DerivedMesh *dm; SculptSession *ss = ob->sculpt; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index bf9c693d903..7ba7c13fe40 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1845,7 +1845,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors) } } -int do_guides(EvaluationContext *eval_ctx, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time) +int do_guides(const EvaluationContext *eval_ctx, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time) { CurveMapping *clumpcurve = (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) ? part->clumpcurve : NULL; CurveMapping *roughcurve = (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) ? part->roughcurve : NULL; @@ -2757,7 +2757,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re if (vg_length) MEM_freeN(vg_length); } -void psys_cache_edit_paths(EvaluationContext *eval_ctx, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) +void psys_cache_edit_paths(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) { ParticleCacheKey *ca, **cache = edit->pathcache; ParticleEditSettings *pset = &scene->toolsettings->particle; @@ -4314,7 +4314,7 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] madd_v3_v3fl(center, yvec, bb->offset[1]); } -void psys_apply_hair_lattice(EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys) +void psys_apply_hair_lattice(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys) { ParticleSimulationData sim = {0}; sim.eval_ctx = eval_ctx; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 044f52832e6..0591ea073cc 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -980,7 +980,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic } /* recursively evaluate emitter parent anim at cfra */ -static void evaluate_emitter_anim(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra) +static void evaluate_emitter_anim(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra) { if (ob->parent) evaluate_emitter_anim(eval_ctx, scene, ob->parent, cfra); @@ -4158,7 +4158,7 @@ static int hair_needs_recalc(ParticleSystem *psys) /* main particle update call, checks that things are ok on the large scale and * then advances in to actual particle calculations depending on particle type */ -void particle_system_update(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params) +void particle_system_update(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params) { ParticleSimulationData sim= {0}; ParticleSettings *part = psys->part; @@ -4361,7 +4361,7 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, /* **** Depsgraph evaluation **** */ -void BKE_particle_system_settings_eval(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_particle_system_settings_eval(const struct EvaluationContext *UNUSED(eval_ctx), ParticleSystem *psys) { if (G.debug & G_DEBUG_DEPSGRAPH) { @@ -4379,7 +4379,7 @@ void BKE_particle_system_settings_recalc_clear(struct EvaluationContext *UNUSED( particle_settings->recalc = 0; } -void BKE_particle_system_eval_init(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_particle_system_eval_init(const struct EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *ob) { diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 396190fd578..df048ce5036 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1222,7 +1222,7 @@ static void rigidbody_update_sim_world(Scene *scene, RigidBodyWorld *rbw) rigidbody_update_ob_array(rbw); } -static void rigidbody_update_sim_ob(struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, RigidBodyOb *rbo) +static void rigidbody_update_sim_ob(const struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, RigidBodyOb *rbo) { float loc[3]; float rot[4]; @@ -1311,7 +1311,7 @@ static void rigidbody_update_sim_ob(struct EvaluationContext *eval_ctx, Scene *s * * \param rebuild Rebuild entire simulation */ -static void rigidbody_update_simulation(struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, bool rebuild) +static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, bool rebuild) { GroupObject *go; @@ -1555,7 +1555,7 @@ void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) /* Rebuild rigid body world */ /* NOTE: this needs to be called before frame update to work correctly */ -void BKE_rigidbody_rebuild_world(struct EvaluationContext *eval_ctx, Scene *scene, float ctime) +void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) { RigidBodyWorld *rbw = scene->rigidbody_world; PointCache *cache; @@ -1583,7 +1583,7 @@ void BKE_rigidbody_rebuild_world(struct EvaluationContext *eval_ctx, Scene *scen } /* Run RigidBody simulation for the specified physics world */ -void BKE_rigidbody_do_simulation(struct EvaluationContext *eval_ctx, Scene *scene, float ctime) +void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) { float timestep; RigidBodyWorld *rbw = scene->rigidbody_world; @@ -1671,8 +1671,8 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle) {} bool BKE_rigidbody_check_sim_running(RigidBodyWorld *rbw, float ctime) { return false; } void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {} -void BKE_rigidbody_rebuild_world(struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} -void BKE_rigidbody_do_simulation(struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} +void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} +void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} #ifdef __GNUC__ # pragma GCC diagnostic pop @@ -1683,7 +1683,7 @@ void BKE_rigidbody_do_simulation(struct EvaluationContext *eval_ctx, Scene *scen /* -------------------- */ /* Depsgraph evaluation */ -void BKE_rigidbody_rebuild_sim(struct EvaluationContext *eval_ctx, +void BKE_rigidbody_rebuild_sim(const struct EvaluationContext *eval_ctx, Scene *scene) { float ctime = BKE_scene_frame_get(scene); @@ -1698,7 +1698,7 @@ void BKE_rigidbody_rebuild_sim(struct EvaluationContext *eval_ctx, } } -void BKE_rigidbody_eval_simulation(struct EvaluationContext *eval_ctx, +void BKE_rigidbody_eval_simulation(const struct EvaluationContext *eval_ctx, Scene *scene) { float ctime = BKE_scene_frame_get(scene); @@ -1713,7 +1713,7 @@ void BKE_rigidbody_eval_simulation(struct EvaluationContext *eval_ctx, } } -void BKE_rigidbody_object_sync_transforms(struct EvaluationContext *UNUSED(eval_ctx), +void BKE_rigidbody_object_sync_transforms(const struct EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *ob) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6aca6e1be7f..5760e13b800 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1178,8 +1178,9 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name) } /* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */ -int BKE_scene_base_iter_next(EvaluationContext *eval_ctx, SceneBaseIter *iter, - Scene **scene, int val, BaseLegacy **base, Object **ob) +int BKE_scene_base_iter_next( + const EvaluationContext *eval_ctx, SceneBaseIter *iter, + Scene **scene, int val, BaseLegacy **base, Object **ob) { bool run_again = true; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index cad4b2e1dd0..218ac64f3e0 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -128,7 +128,7 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color), float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {} -struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), struct EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; } +struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), const struct EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; } float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; } #endif /* WITH_SMOKE */ @@ -2073,7 +2073,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value } } -static void update_flowsfluids(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) +static void update_flowsfluids(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) { Object **flowobjs = NULL; EmissionMap *emaps = NULL; @@ -2489,7 +2489,7 @@ static void update_effectors_task_cb(void *userdata, const int x) } } -static void update_effectors(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt)) +static void update_effectors(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt)) { ListBase *effectors; /* make sure smoke flow influence is 0.0f */ @@ -2518,7 +2518,7 @@ static void update_effectors(struct EvaluationContext *eval_ctx, Scene *scene, O pdEndEffectors(&effectors); } -static void step(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) +static void step(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) { SmokeDomainSettings *sds = smd->domain; /* stability values copied from wturbulence.cpp */ @@ -2685,7 +2685,8 @@ static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob) return result; } -static void smokeModifier_process(SmokeModifierData *smd, struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) +static void smokeModifier_process( + SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) { if ((smd->type & MOD_SMOKE_TYPE_FLOW)) { @@ -2827,7 +2828,8 @@ static void smokeModifier_process(SmokeModifierData *smd, struct EvaluationConte } } -struct DerivedMesh *smokeModifier_do(SmokeModifierData *smd, struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) +struct DerivedMesh *smokeModifier_do( + SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) { /* lock so preview render does not read smoke data while it gets modified */ if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 28dea3e1669..7cea1e4940f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1546,7 +1546,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow, } -static void scan_for_ext_spring_forces(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float timenow) +static void scan_for_ext_spring_forces(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float timenow) { SoftBody *sb = ob->soft; ListBase *do_effector = NULL; @@ -1563,7 +1563,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return NULL; } -static void sb_sfesf_threads_run(struct EvaluationContext *eval_ctx, Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void))) +static void sb_sfesf_threads_run(const struct EvaluationContext *eval_ctx, Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void))) { ListBase *do_effector = NULL; ListBase threads; @@ -2235,7 +2235,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t MEM_freeN(sb_threads); } -static void softbody_calc_forcesEx(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) +static void softbody_calc_forcesEx(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) { /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) @@ -2280,7 +2280,7 @@ static void softbody_calc_forcesEx(struct EvaluationContext *eval_ctx, Scene *sc } -static void softbody_calc_forces(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) +static void softbody_calc_forces(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) { /* redirection to the new threaded Version */ if (!(G.debug_value & 0x10)) { // 16 @@ -3512,7 +3512,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int } } -static void softbody_step(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SoftBody *sb, float dtime) +static void softbody_step(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SoftBody *sb, float dtime) { /* the simulator */ float forcetime; @@ -3646,7 +3646,7 @@ static void softbody_step(struct EvaluationContext *eval_ctx, Scene *scene, Obje } /* simulates one step. framenr is in frames */ -void sbObjectStep(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts) +void sbObjectStep(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts) { SoftBody *sb= ob->soft; PointCache *cache; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index d20dac5a4ae..cbe00e3bbc6 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -192,7 +192,7 @@ void BKE_world_make_local(Main *bmain, World *wrld, const bool lib_local) BKE_id_make_local_generic(bmain, &wrld->id, true, lib_local); } -void BKE_world_eval(struct EvaluationContext *UNUSED(eval_ctx), World *world) +void BKE_world_eval(const struct EvaluationContext *UNUSED(eval_ctx), World *world) { if (G.debug & G_DEBUG_DEPSGRAPH) { printf("%s on %s (%p)\n", __func__, world->id.name, world); diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 42dde0be266..ffd11514ea0 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -34,7 +34,7 @@ void forEachObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set) } } -bool AnimationExporter::exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce) +bool AnimationExporter::exportAnimations(const struct EvaluationContext *eval_ctx, Scene *sce) { bool has_animations = hasAnimations(sce); if (has_animations) { diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index d21f3a74ceb..5af5d884455 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -85,7 +85,7 @@ class AnimationExporter: COLLADASW::LibraryAnimations { private: Scene *scene; - struct EvaluationContext *eval_ctx; + const struct EvaluationContext *eval_ctx; COLLADASW::StreamWriter *sw; public: @@ -95,7 +95,7 @@ public: { this->sw = sw; } - bool exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce); + bool exportAnimations(const struct EvaluationContext *eval_ctx, Scene *sce); // called for each exported object void operator() (Object *ob); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index ad5ffadebc5..844be2dd60b 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -62,7 +62,7 @@ ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSett } // write bone nodes -void ArmatureExporter::add_armature_bones(EvaluationContext *eval_ctx, Object *ob_arm, +void ArmatureExporter::add_armature_bones(const EvaluationContext *eval_ctx, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { @@ -157,7 +157,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O #endif // parent_mat is armature-space -void ArmatureExporter::add_bone_node(EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, +void ArmatureExporter::add_bone_node(const EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index f0582e97643..a3ed97c3a43 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -60,7 +60,7 @@ public: ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); // write bone nodes - void add_armature_bones(struct EvaluationContext *eval_ctx, Object *ob_arm, Scene *sce, SceneExporter *se, + void add_armature_bones(const struct EvaluationContext *eval_ctx, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); bool add_instance_controller(Object *ob); @@ -85,7 +85,7 @@ private: // Scene, SceneExporter and the list of child_objects // are required for writing bone parented objects - void add_bone_node(struct EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, + void add_bone_node(const struct EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node); diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 3dd2490edfc..f413651167c 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -104,7 +104,7 @@ bool ControllerExporter::add_instance_controller(Object *ob) return true; } -void ControllerExporter::export_controllers(struct EvaluationContext *eval_ctx, Scene *sce) +void ControllerExporter::export_controllers(const struct EvaluationContext *eval_ctx, Scene *sce) { this->eval_ctx = eval_ctx; scene = sce; diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h index c96015c7817..a1d46c5aafb 100644 --- a/source/blender/collada/ControllerExporter.h +++ b/source/blender/collada/ControllerExporter.h @@ -66,12 +66,12 @@ public: bool add_instance_controller(Object *ob); - void export_controllers(struct EvaluationContext *eval_ctx, Scene *sce); + void export_controllers(const struct EvaluationContext *eval_ctx, Scene *sce); void operator()(Object *ob); private: - struct EvaluationContext *eval_ctx; + const struct EvaluationContext *eval_ctx; Scene *scene; UnitConverter converter; const ExportSettings *export_settings; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 46628ed028e..24a09562a7b 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -179,7 +179,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char * // COLLADA allows this through multiple <channel>s in <animation>. // For this to work, we need to know objects that use a certain action. -int DocumentExporter::exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce) +int DocumentExporter::exportCurrentScene(const EvaluationContext *eval_ctx, Scene *sce) { PointerRNA sceneptr, unit_settings; PropertyRNA *system; /* unused , *scale; */ diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h index 1d32c87610e..895787c7bbc 100644 --- a/source/blender/collada/DocumentExporter.h +++ b/source/blender/collada/DocumentExporter.h @@ -39,7 +39,7 @@ class DocumentExporter { public: DocumentExporter(const ExportSettings *export_settings); - int exportCurrentScene(struct EvaluationContext *eval_ctx, Scene *sce); + int exportCurrentScene(const struct EvaluationContext *eval_ctx, Scene *sce); void exportScenes(const char *filename); private: const ExportSettings *export_settings; diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 715f0ab5370..4365c70b910 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -57,7 +57,7 @@ GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSett { } -void GeometryExporter::exportGeom(struct EvaluationContext *eval_ctx, Scene *sce) +void GeometryExporter::exportGeom(const struct EvaluationContext *eval_ctx, Scene *sce) { openLibrary(); diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index 91062ef8f19..7527195fdd8 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -74,13 +74,13 @@ class GeometryExporter : COLLADASW::LibraryGeometries Normal n; - struct EvaluationContext *mEvalCtx; + const struct EvaluationContext *mEvalCtx; Scene *mScene; public: GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); - void exportGeom(struct EvaluationContext *eval_ctx, Scene *sce); + void exportGeom(const struct EvaluationContext *eval_ctx, Scene *sce); void operator()(Object *ob); diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index 1447cd7f72f..aa98f2ee96c 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -43,7 +43,7 @@ void SceneExporter::setExportTransformationType(BC_export_transformation_type tr this->transformation_type = transformation_type; } -void SceneExporter::exportScene(EvaluationContext *eval_ctx, Scene *sce) +void SceneExporter::exportScene(const EvaluationContext *eval_ctx, Scene *sce) { // <library_visual_scenes> <visual_scene> std::string id_naming = id_name(sce); @@ -53,7 +53,7 @@ void SceneExporter::exportScene(EvaluationContext *eval_ctx, Scene *sce) closeLibrary(); } -void SceneExporter::exportHierarchy(EvaluationContext *eval_ctx, Scene *sce) +void SceneExporter::exportHierarchy(const EvaluationContext *eval_ctx, Scene *sce) { LinkNode *node; std::vector<Object *> base_objects; @@ -91,7 +91,7 @@ void SceneExporter::exportHierarchy(EvaluationContext *eval_ctx, Scene *sce) } -void SceneExporter::writeNodes(EvaluationContext *eval_ctx, Object *ob, Scene *sce) +void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Scene *sce) { // Add associated armature first if available bool armature_exported = false; diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h index 8dd6da4db05..ded48983bd9 100644 --- a/source/blender/collada/SceneExporter.h +++ b/source/blender/collada/SceneExporter.h @@ -96,15 +96,15 @@ class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, { public: SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings); - void exportScene(struct EvaluationContext *eval_ctx, Scene *sce); + void exportScene(const struct EvaluationContext *eval_ctx, Scene *sce); void setExportTransformationType(BC_export_transformation_type transformation_type); private: BC_export_transformation_type transformation_type; // required for writeNodes() for bone-parented objects friend class ArmatureExporter; - void exportHierarchy(struct EvaluationContext *eval_ctx, Scene *sce); - void writeNodes(struct EvaluationContext *eval_ctx, Object *ob, Scene *sce); + void exportHierarchy(const struct EvaluationContext *eval_ctx, Scene *sce); + void writeNodes(const struct EvaluationContext *eval_ctx, Object *ob, Scene *sce); ArmatureExporter *arm_exporter; const ExportSettings *export_settings; diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 5c5b2ec2dc2..e9285bf24ff 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -67,7 +67,7 @@ int collada_import(bContext *C, return 0; } -int collada_export(EvaluationContext *eval_ctx, +int collada_export(const EvaluationContext *eval_ctx, Scene *sce, SceneLayer *scene_layer, const char *filepath, diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h index c42338002cd..1cec6a53922 100644 --- a/source/blender/collada/collada.h +++ b/source/blender/collada/collada.h @@ -64,7 +64,7 @@ int collada_import(struct bContext *C, int keep_bind_info); -int collada_export(struct EvaluationContext *eval_ctx, +int collada_export(const struct EvaluationContext *eval_ctx, struct Scene *sce, struct SceneLayer *scene_layer, const char *filepath, diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 85ac0eb8d3d..3bdd22a53f8 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -147,7 +147,7 @@ Object *bc_add_object(Scene *scene, int type, const char *name) return ob; } -Mesh *bc_get_mesh_copy(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) +Mesh *bc_get_mesh_copy(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) { Mesh *tmpmesh; CustomDataMask mask = CD_MASK_MESH; diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index df972c5b89c..75e9fb5dcea 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -68,7 +68,7 @@ extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsi extern int bc_test_parent_loop(Object *par, Object *ob); extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true); extern Object *bc_add_object(Scene *scene, int type, const char *name); -extern Mesh *bc_get_mesh_copy(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); +extern Mesh *bc_get_mesh_copy(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); extern Object *bc_get_assigned_armature(Object *ob); extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob); diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index bffa58dbf05..cbf16d38f6b 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -53,6 +53,8 @@ #include "ED_screen.h" #include "ED_view3d.h" +#include "DEG_depsgraph.h" + #include "armature_intern.h" /* utility macros for storing a temp int in the bone (selection flag) */ @@ -166,18 +168,20 @@ void *get_bone_from_selectbuffer( /* x and y are mouse coords (area space) */ void *get_nearest_bone(bContext *C, const int xy[2], bool findunsel) { + EvaluationContext eval_ctx; ViewContext vc; rcti rect; unsigned int buffer[MAXPICKBUF]; short hits; - + + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); // rect.xmin = ... mouseco! rect.xmin = rect.xmax = xy[0]; rect.ymin = rect.ymax = xy[1]; - hits = view3d_opengl_select(C, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); + hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); if (hits > 0) return get_bone_from_selectbuffer(vc.scene, vc.scene_layer->basact, buffer, hits, findunsel, true); @@ -291,7 +295,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 bContext *C, ViewContext *vc, const int mval[2], + const EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], ListBase *edbo, bool findunsel, bool use_cycle, int *r_selmask) { bArmature *arm = (bArmature *)vc->obedit->data; @@ -344,7 +348,7 @@ static EditBone *get_nearest_editbonepoint( view3d_opengl_select_cache_begin(); BLI_rcti_init_pt_radius(&rect, mval, 12); - hits12 = view3d_opengl_select(C, vc, buffer, MAXPICKBUF, &rect, select_mode); + hits12 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode); if (hits12 == 1) { hits = selectbuffer_ret_hits_12(buffer, hits12); goto cache_end; @@ -354,7 +358,7 @@ static EditBone *get_nearest_editbonepoint( offs = 4 * hits12; BLI_rcti_init_pt_radius(&rect, mval, 5); - hits5 = view3d_opengl_select(C, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits5 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits5 == 1) { hits = selectbuffer_ret_hits_5(buffer, hits12, hits5); @@ -482,17 +486,19 @@ bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool d { Object *obedit = CTX_data_edit_object(C); bArmature *arm = obedit->data; + EvaluationContext eval_ctx; ViewContext vc; EditBone *nearBone = NULL; int selmask; + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); - + if (BIF_sk_selectStroke(C, mval, extend)) { return true; } - nearBone = get_nearest_editbonepoint(C, &vc, mval, arm->edbo, true, true, &selmask); + nearBone = get_nearest_editbonepoint(&eval_ctx, &vc, mval, arm->edbo, true, true, &selmask); if (nearBone) { if (!extend && !deselect && !toggle) { diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 7407d12f7d7..e167d4edb94 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -50,6 +50,8 @@ #include "ED_transform.h" #include "ED_transform_snap_object_context.h" +#include "DEG_depsgraph.h" + #include "WM_api.h" #include "WM_types.h" @@ -1922,16 +1924,18 @@ 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); view3d_set_viewcontext(C, &vc); BLI_rcti_init_pt_radius(&rect, mval, 5); - hits = view3d_opengl_select(C, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); + hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); if (hits > 0) { int besthitresult = -1; diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 25bad71af88..ef708a4edec 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -1091,10 +1091,13 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event) if ((cps->depth_mode == CURVE_PAINT_PROJECT_SURFACE) && (v3d->drawtype > OB_WIRE)) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + /* needed or else the draw matrix can be incorrect */ view3d_operator_needs_opengl(C); - ED_view3d_autodist_init(C, cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0); + ED_view3d_autodist_init(&eval_ctx, cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0); if (cdd->vc.rv3d->depths) { cdd->vc.rv3d->depths->damaged = true; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index ced7cd07347..4cd628b7fd3 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -79,6 +79,8 @@ #include "ED_view3d.h" #include "ED_space_api.h" +#include "DEG_depsgraph.h" + #include "gpencil_intern.h" /* ************************************************ */ @@ -2106,9 +2108,12 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) /* init autodist for geometry projection */ if (mode == GP_REPROJECT_SURFACE) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + struct Depsgraph *graph = CTX_data_depsgraph(C); view3d_region_operator_needs_opengl(CTX_wm_window(C), gsc.ar); - ED_view3d_autodist_init(C, graph, gsc.ar, CTX_wm_view3d(C), 0); + ED_view3d_autodist_init(&eval_ctx, graph, gsc.ar, CTX_wm_view3d(C), 0); } // TODO: For deforming geometry workflow, create new frames? diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 834a1ced69d..ffad8da84ff 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -80,6 +80,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "DEG_depsgraph.h" + #include "gpencil_intern.h" /* ******************************************* */ @@ -114,6 +116,7 @@ typedef enum eGPencil_PaintFlags { * "p" = op->customdata */ typedef struct tGPsdata { + EvaluationContext eval_ctx; Scene *scene; /* current scene from context */ struct Depsgraph *graph; @@ -484,7 +487,8 @@ static void gp_brush_angle(bGPdata *gpd, bGPDbrush *brush, tGPspoint *pt, const } /* add current stroke-point to buffer (returns whether point was successfully added) */ -static short gp_stroke_addpoint(const bContext *C, tGPsdata *p, const int mval[2], float pressure, double curtime) +static short gp_stroke_addpoint( + tGPsdata *p, const int mval[2], float pressure, double curtime) { bGPdata *gpd = p->gpd; bGPDbrush *brush = p->brush; @@ -643,7 +647,7 @@ static short gp_stroke_addpoint(const bContext *C, tGPsdata *p, const int mval[2 view3d_region_operator_needs_opengl(p->win, p->ar); ED_view3d_autodist_init( - C, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + &p->eval_ctx, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); } /* convert screen-coordinates to appropriate coordinates (and store them) */ @@ -679,7 +683,7 @@ static short gp_stroke_addpoint(const bContext *C, tGPsdata *p, const int mval[2 * - applies a reverse Chaikin filter * - code adapted from etch-a-ton branch (editarmature_sketch.c) */ -static void gp_stroke_simplify(const bContext *C, tGPsdata *p) +static void gp_stroke_simplify(tGPsdata *p) { bGPdata *gpd = p->gpd; tGPspoint *old_points = (tGPspoint *)gpd->sbuffer; @@ -715,7 +719,7 @@ static void gp_stroke_simplify(const bContext *C, tGPsdata *p) } (void)0 /* XXX Here too, do not lose start and end points! */ - gp_stroke_addpoint(C, p, &old_points->x, old_points->pressure, p->inittime + (double)old_points->time); + gp_stroke_addpoint(p, &old_points->x, old_points->pressure, p->inittime + (double)old_points->time); for (i = 0, j = 0; i < num_points; i++) { if (i - j == 3) { float co[2], pressure, time; @@ -738,12 +742,12 @@ static void gp_stroke_simplify(const bContext *C, tGPsdata *p) mco[1] = (int)co[1]; /* ignore return values on this... assume to be ok for now */ - gp_stroke_addpoint(C, p, mco, pressure, p->inittime + (double)time); - + gp_stroke_addpoint(p, mco, pressure, p->inittime + (double)time); + j += 2; } } - gp_stroke_addpoint(C, p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure, + gp_stroke_addpoint(p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure, p->inittime + (double)old_points[num_points - 1].time); /* free old buffer */ @@ -1228,7 +1232,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, } /* erase strokes which fall under the eraser strokes */ -static void gp_stroke_doeraser(const bContext *C, tGPsdata *p) +static void gp_stroke_doeraser(tGPsdata *p) { bGPDlayer *gpl; bGPDstroke *gps, *gpn; @@ -1244,7 +1248,7 @@ static void gp_stroke_doeraser(const bContext *C, tGPsdata *p) if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { View3D *v3d = p->sa->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->ar); - ED_view3d_autodist_init(C, p->graph, p->ar, v3d, 0); + ED_view3d_autodist_init(&p->eval_ctx, p->graph, p->ar, v3d, 0); } } @@ -1397,6 +1401,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p) } /* pass on current scene and window */ + CTX_data_eval_ctx(C, &p->eval_ctx); p->scene = CTX_data_scene(C); p->graph = CTX_data_depsgraph(C); p->win = CTX_wm_window(C); @@ -1800,7 +1805,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode) } /* finish off a stroke (clears buffer, but doesn't finish the paint operation) */ -static void gp_paint_strokeend(const bContext *C, tGPsdata *p) +static void gp_paint_strokeend(tGPsdata *p) { ToolSettings *ts = p->scene->toolsettings; /* for surface sketching, need to set the right OpenGL context stuff so that @@ -1811,14 +1816,14 @@ static void gp_paint_strokeend(const bContext *C, tGPsdata *p) /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(p->win, p->ar); - ED_view3d_autodist_init(C, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + ED_view3d_autodist_init(&p->eval_ctx, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); } /* check if doing eraser or not */ if ((p->gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) { /* simplify stroke before transferring? */ - gp_stroke_simplify(C, p); - + gp_stroke_simplify(p); + /* transfer stroke to frame */ gp_stroke_newfrombuffer(p); } @@ -1828,14 +1833,14 @@ static void gp_paint_strokeend(const bContext *C, tGPsdata *p) } /* finish off stroke painting operation */ -static void gp_paint_cleanup(const bContext *C, tGPsdata *p) +static void gp_paint_cleanup(tGPsdata *p) { /* p->gpd==NULL happens when stroke failed to initialize, * for example when GP is hidden in current space (sergey) */ if (p->gpd) { /* finish off a stroke */ - gp_paint_strokeend(C, p); + gp_paint_strokeend(p); } /* "unlock" frame */ @@ -1941,7 +1946,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) U.gp_eraser = p->radius; /* cleanup */ - gp_paint_cleanup(C, p); + gp_paint_cleanup(p); gp_session_cleanup(p); /* finally, free the temp data */ @@ -2051,13 +2056,13 @@ static void gpencil_draw_status_indicators(tGPsdata *p) /* ------------------------------- */ /* create a new stroke point at the point indicated by the painting context */ -static void gpencil_draw_apply(const bContext *C, wmOperator *op, tGPsdata *p) +static void gpencil_draw_apply(wmOperator *op, tGPsdata *p) { /* handle drawing/erasing -> test for erasing first */ if (p->paintmode == GP_PAINTMODE_ERASER) { /* do 'live' erasing now */ - gp_stroke_doeraser(C, p); - + gp_stroke_doeraser(p); + /* store used values */ p->mvalo[0] = p->mval[0]; p->mvalo[1] = p->mval[1]; @@ -2066,12 +2071,12 @@ static void gpencil_draw_apply(const bContext *C, wmOperator *op, tGPsdata *p) /* only add current point to buffer if mouse moved (even though we got an event, it might be just noise) */ else if (gp_stroke_filtermval(p, p->mval, p->mvalo)) { /* try to add point */ - short ok = gp_stroke_addpoint(C, p, p->mval, p->pressure, p->curtime); - + short ok = gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime); + /* handle errors while adding point */ if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) { /* finish off old stroke */ - gp_paint_strokeend(C, p); + gp_paint_strokeend(p); /* And start a new one!!! Else, projection errors! */ gp_paint_initstroke(p, p->paintmode); @@ -2080,12 +2085,12 @@ static void gpencil_draw_apply(const bContext *C, wmOperator *op, tGPsdata *p) /* XXX We only need to reuse previous point if overflow! */ if (ok == GP_STROKEADD_OVERFLOW) { p->inittime = p->ocurtime; - gp_stroke_addpoint(C, p, p->mvalo, p->opressure, p->ocurtime); + gp_stroke_addpoint(p, p->mvalo, p->opressure, p->ocurtime); } else { p->inittime = p->curtime; } - gp_stroke_addpoint(C, p, p->mval, p->pressure, p->curtime); + gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime); } else if (ok == GP_STROKEADD_INVALID) { /* the painting operation cannot continue... */ @@ -2106,7 +2111,7 @@ static void gpencil_draw_apply(const bContext *C, wmOperator *op, tGPsdata *p) } /* handle draw event */ -static void gpencil_draw_apply_event(const bContext *C, wmOperator *op, const wmEvent *event) +static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event) { tGPsdata *p = op->customdata; PointerRNA itemptr; @@ -2211,8 +2216,8 @@ static void gpencil_draw_apply_event(const bContext *C, wmOperator *op, const wm RNA_float_set(&itemptr, "time", p->curtime - p->inittime); /* apply the current latest drawing point */ - gpencil_draw_apply(C, op, p); - + gpencil_draw_apply(op, p); + /* force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ } @@ -2259,7 +2264,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op) */ if ((p->flags & GP_PAINTFLAG_FIRSTRUN) == 0) { /* TODO: both of these ops can set error-status, but we probably don't need to worry */ - gp_paint_strokeend(C, p); + gp_paint_strokeend(p); gp_paint_initstroke(p, p->paintmode); } } @@ -2275,7 +2280,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op) } /* apply this data as necessary now (as per usual) */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); } RNA_END; @@ -2334,7 +2339,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event p->status = GP_STATUS_PAINTING; /* handle the initial drawing - i.e. for just doing a simple dot */ - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); op->flag |= OP_IS_MODAL_CURSOR_REGION; } else { @@ -2385,12 +2390,12 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op) return op->customdata; } -static void gpencil_stroke_end(bContext *C, wmOperator *op) +static void gpencil_stroke_end(wmOperator *op) { tGPsdata *p = op->customdata; - - gp_paint_cleanup(C, p); - + + gp_paint_cleanup(p); + gpencil_undo_push(p->gpd); gp_session_cleanup(p); @@ -2523,8 +2528,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) if (sketch) { /* end stroke only, and then wait to resume painting soon */ /* printf("\t\tGP - end stroke only\n"); */ - gpencil_stroke_end(C, op); - + gpencil_stroke_end(op); + /* If eraser mode is on, turn it off after the stroke finishes * NOTE: This just makes it nicer to work with drawing sessions */ @@ -2666,8 +2671,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) { /* handle drawing event */ /* printf("\t\tGP - add point\n"); */ - gpencil_draw_apply_event(C, op, event); - + gpencil_draw_apply_event(op, event); + /* finish painting operation if anything went wrong just now */ if (p->status == GP_STATUS_ERROR) { printf("\t\t\t\tGP - add error done!\n"); diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 07fac0fdfac..fae08bd771e 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -65,6 +65,8 @@ #include "ED_clip.h" #include "ED_view3d.h" +#include "DEG_depsgraph.h" + #include "gpencil_intern.h" /* ******************************************************** */ @@ -538,11 +540,14 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) View3D *v3d = (View3D *)CTX_wm_space_data(C); RegionView3D *rv3d = ar->regiondata; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + /* init 3d depth buffers */ view3d_operator_needs_opengl(C); view3d_region_operator_needs_opengl(win, ar); - ED_view3d_autodist_init(C, graph, ar, v3d, 0); + ED_view3d_autodist_init(&eval_ctx, graph, ar, v3d, 0); /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index c3186f7afdf..52edfc22d21 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -36,6 +36,7 @@ extern "C" { #endif struct ID; +struct EvaluationContext; struct View3D; struct ARegion; struct bContext; @@ -134,35 +135,36 @@ void EDBM_select_mirrored( int *r_totmirr, int *r_totfail); void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag); -bool EDBM_backbuf_border_init(const struct bContext *C, struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); +bool EDBM_backbuf_border_init(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); bool EDBM_backbuf_check(unsigned int index); void EDBM_backbuf_free(void); -bool EDBM_backbuf_border_mask_init(const struct bContext *C, struct ViewContext *vc, const int mcords[][2], short tot, - short xmin, short ymin, short xmax, short ymax); -bool EDBM_backbuf_circle_init(const struct bContext *C, struct ViewContext *vc, short xs, short ys, short rads); +bool EDBM_backbuf_border_mask_init( + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, const int mcords[][2], short tot, + short xmin, short ymin, short xmax, short ymax); +bool EDBM_backbuf_circle_init(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, short xs, short ys, short rads); struct BMVert *EDBM_vert_find_nearest_ex( - const struct bContext *C, struct ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist, const bool use_select_bias, bool use_cycle); struct BMVert *EDBM_vert_find_nearest( - const struct bContext *C, struct ViewContext *vc, float *r_dist); + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist); struct BMEdge *EDBM_edge_find_nearest_ex( - const struct bContext *C, struct ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist, float *r_dist_center, const bool use_select_bias, const bool use_cycle, struct BMEdge **r_eed_zbuf); struct BMEdge *EDBM_edge_find_nearest( - const struct bContext *C, struct ViewContext *vc, float *r_dist); + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist); struct BMFace *EDBM_face_find_nearest_ex( - const struct bContext *C, struct ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist, float *r_dist_center, const bool use_select_bias, const bool use_cycle, struct BMFace **r_efa_zbuf); struct BMFace *EDBM_face_find_nearest( - const struct bContext *C, struct ViewContext *vc, float *r_dist); + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist); bool EDBM_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); @@ -199,7 +201,7 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd /* editface.c */ void paintface_flush_flags(struct Object *ob, short flag); bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle); -int do_paintface_box_select(const struct bContext *C, struct ViewContext *vc, struct rcti *rect, bool select, bool extend); +int do_paintface_box_select(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, struct rcti *rect, bool select, bool extend); void paintface_deselect_all_visible(struct Object *ob, int action, bool flush_flags); void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select); bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 7bce95182bf..f8bd8a22897 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -46,15 +46,16 @@ int PE_start_edit(struct PTCacheEdit *edit); /* access */ struct PTCacheEdit *PE_get_current(struct Scene *scene, struct SceneLayer *sl, struct Object *ob); -struct PTCacheEdit *PE_create_current(const struct bContext *C, struct Scene *scene, struct Object *ob); -void PE_current_changed(const struct bContext *C, struct Scene *scene, struct Object *ob); +struct PTCacheEdit *PE_create_current(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void PE_current_changed(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); int PE_minmax(struct Scene *scene, struct SceneLayer *sl, float min[3], float max[3]); struct ParticleEditSettings *PE_settings(struct Scene *scene); /* update calls */ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra); -void PE_update_object(const struct bContext *C, struct Scene *scene, - struct SceneLayer *sl, struct Object *ob, int useflag); +void PE_update_object( + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct SceneLayer *sl, struct Object *ob, int useflag); /* selection tools */ int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 4b7eaa4f3d4..0dcfd68c0f1 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -152,20 +152,20 @@ typedef enum { /* foreach iterators */ void meshobject_foreachScreenVert( - const struct bContext *C, struct ViewContext *vc, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index), void *userData, const eV3DProjTest clip_flag); void mesh_foreachScreenVert( - const struct bContext *C, struct ViewContext *vc, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index), void *userData, const eV3DProjTest clip_flag); void mesh_foreachScreenEdge( - const struct bContext *C, struct ViewContext *vc, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *userData, const eV3DProjTest clip_flag); void mesh_foreachScreenFace( - const struct bContext *C, struct ViewContext *vc, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index), void *userData, const eV3DProjTest clip_flag); void nurbs_foreachScreenVert( @@ -295,21 +295,23 @@ float ED_view3d_radius_to_dist( void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos); /* backbuffer select and draw support */ -void ED_view3d_backbuf_validate(const struct bContext *C, struct ViewContext *vc); -struct ImBuf *ED_view3d_backbuf_read(const struct bContext *C, struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax); +void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, struct ViewContext *vc); +struct ImBuf *ED_view3d_backbuf_read( + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax); unsigned int ED_view3d_backbuf_sample_rect( - const struct bContext *C, struct ViewContext *vc, const int mval[2], int size, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, float *r_dist); int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); -unsigned int ED_view3d_backbuf_sample(const struct bContext *C, struct ViewContext *vc, int x, int y); +unsigned int ED_view3d_backbuf_sample( + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, int x, int y); bool ED_view3d_autodist( - const struct bContext *C, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, + const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]); /* only draw so ED_view3d_autodist_simple can be called many times after */ -void ED_view3d_autodist_init(const struct bContext *C, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, int mode); +void ED_view3d_autodist_init(const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, int mode); bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); @@ -331,7 +333,7 @@ void view3d_opengl_select_cache_begin(void); void view3d_opengl_select_cache_end(void); int view3d_opengl_select( - const struct bContext *C, struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input, + const struct EvaluationContext *eval_ctx, struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input, eV3DSelectMode select_mode); /* view3d_select.c */ @@ -363,26 +365,27 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active); struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d); void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); -void ED_draw_object_facemap(const struct bContext *C, struct Scene *scene, struct Object *ob, const float col[4], const int facemap); +void ED_draw_object_facemap(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, const float col[4], const int facemap); bool ED_view3d_context_activate(struct bContext *C); -void ED_view3d_draw_offscreen_init(struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d); +void ED_view3d_draw_offscreen_init( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d); void ED_view3d_draw_offscreen( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, struct GPUFX *fx, struct GPUFXSettings *fx_settings, struct GPUOffScreen *ofs); void ED_view3d_draw_setup_view( - struct wmWindow *win, const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, + struct wmWindow *win, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); struct ImBuf *ED_view3d_draw_offscreen_imbuf( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct Object *camera, int width, int height, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct Object *camera, int width, int height, unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); @@ -390,7 +393,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( struct BaseLegacy *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip); void ED_view3d_update_viewmat( - struct EvaluationContext *eval_ctx, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); bool ED_view3d_quat_from_axis_view(const char view, float quat[4]); char ED_view3d_quat_to_axis_view(const float quat[4], const float epsilon); diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 40c6058c7c3..2695d4c9dd9 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -913,6 +913,9 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx, my - ar->winrct.ymin}; float co[3]; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + CTX_wm_area_set(C, sa); CTX_wm_region_set(C, ar); @@ -921,7 +924,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx, view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(C, graph, ar, v3d, mval, co, true, NULL)) { + if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval, co, true, NULL)) { const float mval_center_fl[2] = { (float)ar->winx / 2, (float)ar->winy / 2}; diff --git a/source/blender/editors/manipulator_library/manipulator_library_presets.c b/source/blender/editors/manipulator_library/manipulator_library_presets.c index e8111bda657..e552a7a6aa3 100644 --- a/source/blender/editors/manipulator_library/manipulator_library_presets.c +++ b/source/blender/editors/manipulator_library/manipulator_library_presets.c @@ -46,6 +46,7 @@ #include "MEM_guardedalloc.h" +#include "DEG_depsgraph.h" #include "RNA_access.h" @@ -139,9 +140,12 @@ void ED_manipulator_draw_preset_facemap( GPU_select_load_id(select_id); } + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + gpuPushMatrix(); gpuMultMatrix(ob->obmat); - ED_draw_object_facemap(C, scene, ob, color, facemap); + ED_draw_object_facemap(&eval_ctx, scene, ob, color, facemap); gpuPopMatrix(); if (is_select) { diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 8aa3b63f795..94fe433e5d7 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -396,7 +396,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b return true; } -int do_paintface_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) +int do_paintface_box_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend) { Object *ob = vc->obact; Mesh *me; @@ -427,7 +427,7 @@ int do_paintface_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool } } - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); ibuf = IMB_allocImBuf(size[0], size[1], 32, IB_rect); rt = ibuf->rect; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 37d86ee313f..5aa10620936 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -161,6 +161,7 @@ typedef struct KnifePosData { typedef struct KnifeTool_OpData { ARegion *ar; /* region that knifetool was activated in */ void *draw_handle; /* for drawing preview loop */ + EvaluationContext eval_ctx; ViewContext vc; /* note: _don't_ use 'mval', instead use the one we define below */ float mval[2]; /* mouse value with snapping applied */ //bContext *C; @@ -1814,7 +1815,7 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], mul_m4_v3(kcd->ob->imat, r_origin_ofs); } -static BMFace *knife_find_closest_face(const bContext *C, KnifeTool_OpData *kcd, float co[3], float cageco[3], bool *is_space) +static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float cageco[3], bool *is_space) { BMFace *f; float dist = KMAXDIST; @@ -1839,7 +1840,7 @@ static BMFace *knife_find_closest_face(const bContext *C, KnifeTool_OpData *kcd, if (!f) { if (kcd->is_interactive) { /* try to use backbuffer selection method if ray casting failed */ - f = EDBM_face_find_nearest(C, &kcd->vc, &dist); + f = EDBM_face_find_nearest(&kcd->eval_ctx, &kcd->vc, &dist); /* cheat for now; just put in the origin instead * of a true coordinate on the face. @@ -1853,7 +1854,7 @@ static BMFace *knife_find_closest_face(const bContext *C, KnifeTool_OpData *kcd, /* find the 2d screen space density of vertices within a radius. used to scale snapping * distance for picking edges/verts.*/ -static int knife_sample_screen_density(const bContext *C, KnifeTool_OpData *kcd, const float radius) +static int knife_sample_screen_density(KnifeTool_OpData *kcd, const float radius) { BMFace *f; bool is_space; @@ -1861,7 +1862,7 @@ static int knife_sample_screen_density(const bContext *C, KnifeTool_OpData *kcd, BLI_assert(kcd->is_interactive == true); - f = knife_find_closest_face(C, kcd, co, cageco, &is_space); + f = knife_find_closest_face(kcd, co, cageco, &is_space); if (f && !is_space) { const float radius_sq = radius * radius; @@ -1904,15 +1905,15 @@ static int knife_sample_screen_density(const bContext *C, KnifeTool_OpData *kcd, /* returns snapping distance for edges/verts, scaled by the density of the * surrounding mesh (in screen space)*/ -static float knife_snap_size(const bContext *C, KnifeTool_OpData *kcd, float maxsize) +static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize) { - float density = (float)knife_sample_screen_density(C, kcd, maxsize * 2.0f); + float density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f); return min_ff(maxsize / (density * 0.5f), maxsize); } /* p is closest point on edge to the mouse cursor */ -static KnifeEdge *knife_find_closest_edge(const bContext *C, KnifeTool_OpData *kcd, float p[3], float cagep[3], +static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr, bool *is_space) { BMFace *f; @@ -1920,7 +1921,7 @@ static KnifeEdge *knife_find_closest_edge(const bContext *C, KnifeTool_OpData *k float maxdist; if (kcd->is_interactive) { - maxdist = knife_snap_size(C, kcd, kcd->ethresh); + maxdist = knife_snap_size(kcd, kcd->ethresh); if (kcd->ignore_vert_snapping) { maxdist *= 0.5f; @@ -1930,7 +1931,7 @@ static KnifeEdge *knife_find_closest_edge(const bContext *C, KnifeTool_OpData *k maxdist = KNIFE_FLT_EPS; } - f = knife_find_closest_face(C, kcd, co, cageco, NULL); + f = knife_find_closest_face(kcd, co, cageco, NULL); *is_space = !f; kcd->curr.bmface = f; @@ -2044,7 +2045,7 @@ static KnifeEdge *knife_find_closest_edge(const bContext *C, KnifeTool_OpData *k } /* find a vertex near the mouse cursor, if it exists */ -static KnifeVert *knife_find_closest_vert(const bContext *C, KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr, +static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr, bool *is_space) { BMFace *f; @@ -2052,7 +2053,7 @@ static KnifeVert *knife_find_closest_vert(const bContext *C, KnifeTool_OpData *k float maxdist; if (kcd->is_interactive) { - maxdist = knife_snap_size(C, kcd, kcd->vthresh); + maxdist = knife_snap_size(kcd, kcd->vthresh); if (kcd->ignore_vert_snapping) { maxdist *= 0.5f; } @@ -2061,7 +2062,7 @@ static KnifeVert *knife_find_closest_vert(const bContext *C, KnifeTool_OpData *k maxdist = KNIFE_FLT_EPS; } - f = knife_find_closest_face(C, kcd, co, cageco, is_space); + f = knife_find_closest_face(kcd, co, cageco, is_space); kcd->curr.bmface = f; @@ -2183,7 +2184,7 @@ static bool knife_snap_angle(KnifeTool_OpData *kcd) } /* update active knife edge/vert pointers */ -static int knife_update_active(const bContext *C, KnifeTool_OpData *kcd) +static int knife_update_active(KnifeTool_OpData *kcd) { knife_pos_data_clear(&kcd->curr); copy_v2_v2(kcd->curr.mval, kcd->mval); @@ -2198,13 +2199,13 @@ static int knife_update_active(const bContext *C, KnifeTool_OpData *kcd) kcd->is_angle_snapping = false; } - kcd->curr.vert = knife_find_closest_vert(C, kcd, kcd->curr.co, kcd->curr.cage, &kcd->curr.bmface, &kcd->curr.is_space); + kcd->curr.vert = knife_find_closest_vert(kcd, kcd->curr.co, kcd->curr.cage, &kcd->curr.bmface, &kcd->curr.is_space); if (!kcd->curr.vert && /* no edge snapping while dragging (edges are too sticky when cuts are immediate) */ !kcd->is_drag_hold) { - kcd->curr.edge = knife_find_closest_edge(C, kcd, kcd->curr.co, kcd->curr.cage, + kcd->curr.edge = knife_find_closest_edge(kcd, kcd->curr.co, kcd->curr.cage, &kcd->curr.bmface, &kcd->curr.is_space); } @@ -2571,30 +2572,27 @@ static void knifetool_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static void knifetool_update_mval(const bContext *C, KnifeTool_OpData *kcd, const float mval[2]) +static void knifetool_update_mval(KnifeTool_OpData *kcd, const float mval[2]) { knife_recalc_projmat(kcd); copy_v2_v2(kcd->mval, mval); - if (knife_update_active(C, kcd)) { + if (knife_update_active(kcd)) { ED_region_tag_redraw(kcd->ar); } } -static void knifetool_update_mval_i(const bContext *C, KnifeTool_OpData *kcd, const int mval_i[2]) +static void knifetool_update_mval_i(KnifeTool_OpData *kcd, const int mval_i[2]) { float mval[2] = {UNPACK2(mval_i)}; - knifetool_update_mval(C, kcd, mval); + knifetool_update_mval(kcd, mval); } -static void knifetool_init_bmbvh(const bContext *C, KnifeTool_OpData *kcd) +static void knifetool_init_bmbvh(KnifeTool_OpData *kcd) { - EvaluationContext eval_ctx; BM_mesh_elem_index_ensure(kcd->em->bm, BM_VERT); - CTX_data_eval_ctx(C, &eval_ctx); - - kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(&eval_ctx, kcd->em, kcd->scene, NULL); + kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(&kcd->eval_ctx, kcd->em, kcd->scene, NULL); kcd->bmbvh = BKE_bmbvh_new_from_editmesh( kcd->em, @@ -2628,6 +2626,7 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd, kcd->ob = obedit; kcd->ar = CTX_wm_region(C); + CTX_data_eval_ctx(C, &kcd->eval_ctx); em_setup_viewcontext(C, &kcd->vc); kcd->em = BKE_editmesh_from_object(kcd->ob); @@ -2637,7 +2636,7 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd, kcd->cut_through = cut_through; kcd->only_select = only_select; - knifetool_init_bmbvh(C, kcd); + knifetool_init_bmbvh(kcd); kcd->arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 15), "knife"); #ifdef USE_NET_ISLAND_CONNECT @@ -2709,7 +2708,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) WM_cursor_modal_set(CTX_wm_window(C), BC_KNIFECURSOR); WM_event_add_modal_handler(C, op); - knifetool_update_mval_i(C, kcd, event->mval); + knifetool_update_mval_i(kcd, event->mval); knife_update_header(C, op, kcd); @@ -2782,6 +2781,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } + CTX_data_eval_ctx(C, &kcd->eval_ctx); em_setup_viewcontext(C, &kcd->vc); kcd->ar = kcd->vc.ar; @@ -2815,7 +2815,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) kcd->snap_midpoints = true; knife_recalc_projmat(kcd); - knife_update_active(C, kcd); + knife_update_active(kcd); knife_update_header(C, op, kcd); ED_region_tag_redraw(kcd->ar); do_refresh = true; @@ -2824,7 +2824,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) kcd->snap_midpoints = false; knife_recalc_projmat(kcd); - knife_update_active(C, kcd); + knife_update_active(kcd); knife_update_header(C, op, kcd); ED_region_tag_redraw(kcd->ar); do_refresh = true; @@ -2879,7 +2879,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) kcd->is_drag_hold = false; /* needed because the last face 'hit' is ignored when dragging */ - knifetool_update_mval(C, kcd, kcd->curr.mval); + knifetool_update_mval(kcd, kcd->curr.mval); } ED_region_tag_redraw(kcd->ar); @@ -2890,14 +2890,14 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) /* shouldn't be possible with default key-layout, just incase... */ if (kcd->is_drag_hold) { kcd->is_drag_hold = false; - knifetool_update_mval(C, kcd, kcd->curr.mval); + knifetool_update_mval(kcd, kcd->curr.mval); } kcd->prev = kcd->curr; kcd->curr = kcd->init; knife_project_v2(kcd, kcd->curr.cage, kcd->curr.mval); - knifetool_update_mval(C, kcd, kcd->curr.mval); + knifetool_update_mval(kcd, kcd->curr.mval); knife_add_cut(kcd); @@ -2931,7 +2931,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_PASS_THROUGH; case MOUSEMOVE: /* mouse moved somewhere to select another loop */ if (kcd->mode != MODE_PANNING) { - knifetool_update_mval_i(C, kcd, event->mval); + knifetool_update_mval_i(kcd, event->mval); if (kcd->is_drag_hold) { if (kcd->totlinehit >= 2) { @@ -2954,7 +2954,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) if (do_refresh) { /* we don't really need to update mval, * but this happens to be the best way to refresh at the moment */ - knifetool_update_mval_i(C, kcd, event->mval); + knifetool_update_mval_i(kcd, event->mval); } /* keep going until the user confirms */ @@ -3042,7 +3042,7 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug int i; for (i = 0; i < mval_tot; i++) { - knifetool_update_mval(C, kcd, mval_fl[i]); + knifetool_update_mval(kcd, mval_fl[i]); if (i == 0) { knife_start_cut(kcd); kcd->mode = MODE_DRAGGING; @@ -3073,7 +3073,7 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug /* freed on knifetool_finish_ex, but we need again to check if points are visible */ if (kcd->cut_through == false) { - knifetool_init_bmbvh(C, kcd); + knifetool_init_bmbvh(kcd); } ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, projmat); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 8db3a2c8d04..a4a6ad82dfb 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -63,6 +63,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "DEG_depsgraph.h" + #include "mesh_intern.h" /* own include */ #define SUBD_SMOOTH_MAX 4.0f @@ -556,20 +558,23 @@ static void loopcut_update_edge(RingSelOpData *lcd, BMEdge *e, const int preview } } -static void loopcut_mouse_move(const bContext *C, RingSelOpData *lcd, const int previewlines) +static void loopcut_mouse_move(const struct EvaluationContext *eval_ctx, RingSelOpData *lcd, const int previewlines) { float dist = ED_view3d_select_dist_px(); - BMEdge *e = EDBM_edge_find_nearest(C, &lcd->vc, &dist); + BMEdge *e = EDBM_edge_find_nearest(eval_ctx, &lcd->vc, &dist); loopcut_update_edge(lcd, e, previewlines); } /* called by both init() and exec() */ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) { + EvaluationContext eval_ctx; const bool is_interactive = (event != NULL); Object *obedit = CTX_data_edit_object(C); RingSelOpData *lcd; + CTX_data_eval_ctx(C, &eval_ctx); + if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit)) BKE_report(op->reports, RPT_WARNING, "Loop cut does not work well on deformed edit mesh display"); @@ -597,7 +602,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) if (is_interactive) { copy_v2_v2_int(lcd->vc.mval, event->mval); - loopcut_mouse_move(C, lcd, is_interactive ? 1 : 0); + loopcut_mouse_move(&eval_ctx, lcd, is_interactive ? 1 : 0); } else { const int e_index = RNA_int_get(op->ptr, "edge_index"); @@ -670,12 +675,14 @@ static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op) static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) { + EvaluationContext eval_ctx; RingSelOpData *lcd = op->customdata; float cuts = lcd->cuts; float smoothness = lcd->smoothness; bool show_cuts = false; const bool has_numinput = hasNumInput(&lcd->num); + CTX_data_eval_ctx(C, &eval_ctx); em_setup_viewcontext(C, &lcd->vc); lcd->ar = lcd->vc.ar; @@ -761,7 +768,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) if (!has_numinput) { lcd->vc.mval[0] = event->mval[0]; lcd->vc.mval[1] = event->mval[1]; - loopcut_mouse_move(C, lcd, (int)lcd->cuts); + loopcut_mouse_move(&eval_ctx, lcd, (int)lcd->cuts); ED_region_tag_redraw(lcd->ar); handled = true; diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 0a36b735f39..29bca00f1a9 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -59,6 +59,8 @@ #include "bmesh.h" #include "bmesh_tools.h" +#include "DEG_depsgraph.h" + #include "mesh_intern.h" /* own include */ struct PathSelectParams { @@ -570,19 +572,19 @@ static bool edbm_shortest_path_pick_ex( static int edbm_shortest_path_pick_exec(bContext *C, wmOperator *op); -static BMElem *edbm_elem_find_nearest(const bContext *C, ViewContext *vc, const char htype) +static BMElem *edbm_elem_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, const char htype) { BMEditMesh *em = vc->em; float dist = ED_view3d_select_dist_px(); if ((em->selectmode & SCE_SELECT_VERTEX) && (htype == BM_VERT)) { - return (BMElem *)EDBM_vert_find_nearest(C, vc, &dist); + return (BMElem *)EDBM_vert_find_nearest(eval_ctx, vc, &dist); } else if ((em->selectmode & SCE_SELECT_EDGE) && (htype == BM_EDGE)) { - return (BMElem *)EDBM_edge_find_nearest(C, vc, &dist); + return (BMElem *)EDBM_edge_find_nearest(eval_ctx, vc, &dist); } else if ((em->selectmode & SCE_SELECT_FACE) && (htype == BM_FACE)) { - return (BMElem *)EDBM_face_find_nearest(C, vc, &dist); + return (BMElem *)EDBM_face_find_nearest(eval_ctx, vc, &dist); } return NULL; @@ -605,10 +607,12 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE return edbm_shortest_path_pick_exec(C, op); } + EvaluationContext eval_ctx; ViewContext vc; BMEditMesh *em; bool track_active = true; + CTX_data_eval_ctx(C, &eval_ctx); em_setup_viewcontext(C, &vc); copy_v2_v2_int(vc.mval, event->mval); em = vc.em; @@ -617,14 +621,14 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE BMElem *ele_src, *ele_dst; if (!(ele_src = edbm_elem_active_elem_or_face_get(em->bm)) || - !(ele_dst = edbm_elem_find_nearest(C, &vc, ele_src->head.htype))) + !(ele_dst = edbm_elem_find_nearest(&eval_ctx, &vc, ele_src->head.htype))) { /* special case, toggle edge tags even when we don't have a path */ if (((em->selectmode & SCE_SELECT_EDGE) && (vc.scene->toolsettings->edge_mode != EDGE_MODE_SELECT)) && /* check if we only have a destination edge */ ((ele_src == NULL) && - (ele_dst = edbm_elem_find_nearest(C, &vc, BM_EDGE)))) + (ele_dst = edbm_elem_find_nearest(&eval_ctx, &vc, BM_EDGE)))) { ele_src = ele_dst; track_active = false; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 97ae8ae166d..7fe4e58d2e0 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -68,6 +68,8 @@ #include "bmesh_tools.h" +#include "DEG_depsgraph.h" + #include "mesh_intern.h" /* own include */ /* use bmesh operator flags for a few operators */ @@ -194,7 +196,9 @@ static BLI_bitmap *edbm_backbuf_alloc(const int size) /* reads rect, and builds selection array for quick lookup */ /* returns if all is OK */ -bool EDBM_backbuf_border_init(const bContext *C, ViewContext *vc, short xmin, short ymin, short xmax, short ymax) +bool EDBM_backbuf_border_init( + const struct EvaluationContext *eval_ctx, ViewContext *vc, short xmin, + short ymin, short xmax, short ymax) { struct ImBuf *buf; unsigned int *dr; @@ -204,7 +208,7 @@ bool EDBM_backbuf_border_init(const bContext *C, ViewContext *vc, short xmin, sh return false; } - buf = ED_view3d_backbuf_read(C, vc, xmin, ymin, xmax, ymax); + buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax); if ((buf == NULL) || (bm_vertoffs == 0)) { return false; } @@ -267,7 +271,7 @@ static void edbm_mask_lasso_px_cb(int x, int x_end, int y, void *user_data) * - grab again and compare * returns 'OK' */ -bool EDBM_backbuf_border_mask_init(const bContext *C, ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) +bool EDBM_backbuf_border_mask_init(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) { unsigned int *dr, *dr_mask, *dr_mask_arr; struct ImBuf *buf; @@ -284,7 +288,7 @@ bool EDBM_backbuf_border_mask_init(const bContext *C, ViewContext *vc, const int return false; } - buf = ED_view3d_backbuf_read(C, vc, xmin, ymin, xmax, ymax); + buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax); if ((buf == NULL) || (bm_vertoffs == 0)) { return false; } @@ -317,7 +321,9 @@ bool EDBM_backbuf_border_mask_init(const bContext *C, ViewContext *vc, const int } /* circle shaped sample area */ -bool EDBM_backbuf_circle_init(const bContext *C, ViewContext *vc, short xs, short ys, short rads) +bool EDBM_backbuf_circle_init( + const struct EvaluationContext *eval_ctx, ViewContext *vc, + short xs, short ys, short rads) { struct ImBuf *buf; unsigned int *dr; @@ -336,7 +342,7 @@ bool EDBM_backbuf_circle_init(const bContext *C, ViewContext *vc, short xs, shor xmin = xs - rads; xmax = xs + rads; ymin = ys - rads; ymax = ys + rads; - buf = ED_view3d_backbuf_read(C, vc, xmin, ymin, xmax, ymax); + buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax); if ((buf == NULL) || (bm_vertoffs == 0)) { return false; } @@ -435,7 +441,7 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, const float * \param use_cycle Cycle over elements within #FIND_NEAR_CYCLE_THRESHOLD_MIN in order of index. */ BMVert *EDBM_vert_find_nearest_ex( - const bContext *C, ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist, const bool use_select_bias, bool use_cycle) { BMesh *bm = vc->em->bm; @@ -447,10 +453,10 @@ BMVert *EDBM_vert_find_nearest_ex( BMVert *eve; /* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */ - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); index = ED_view3d_backbuf_sample_rect( - C, vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &dist_test); + eval_ctx, vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &dist_test); eve = index ? BM_vert_at_index_find_or_table(bm, index - 1) : NULL; if (eve) { @@ -485,7 +491,7 @@ BMVert *EDBM_vert_find_nearest_ex( data.cycle_index_prev = prev_select_index; ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenVert(C, vc, findnearestvert__doClosest, &data, clip_flag); + mesh_foreachScreenVert(eval_ctx, vc, findnearestvert__doClosest, &data, clip_flag); hit = (data.use_cycle && data.hit_cycle.vert) ? &data.hit_cycle : &data.hit; *r_dist = hit->dist; @@ -497,9 +503,9 @@ BMVert *EDBM_vert_find_nearest_ex( } } -BMVert *EDBM_vert_find_nearest(const bContext *C, ViewContext *vc, float *r_dist) +BMVert *EDBM_vert_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist) { - return EDBM_vert_find_nearest_ex(C, vc, r_dist, false, false); + return EDBM_vert_find_nearest_ex(eval_ctx, vc, r_dist, false, false); } /* find the distance to the edge we already have */ @@ -621,7 +627,7 @@ static void find_nearest_edge__doClosest( } BMEdge *EDBM_edge_find_nearest_ex( - const bContext *C, ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist, float *r_dist_center, const bool use_select_bias, const bool use_cycle, BMEdge **r_eed_zbuf) @@ -635,9 +641,9 @@ BMEdge *EDBM_edge_find_nearest_ex( BMEdge *eed; /* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */ - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); - index = ED_view3d_backbuf_sample_rect(C, vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test); + index = ED_view3d_backbuf_sample_rect(eval_ctx, vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test); eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL; if (r_eed_zbuf) { @@ -655,7 +661,7 @@ BMEdge *EDBM_edge_find_nearest_ex( ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenEdge(C, vc, find_nearest_edge_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenEdge(eval_ctx, vc, find_nearest_edge_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT); *r_dist_center = data.dist; } @@ -695,7 +701,7 @@ BMEdge *EDBM_edge_find_nearest_ex( data.cycle_index_prev = prev_select_index; ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenEdge(C, vc, find_nearest_edge__doClosest, &data, clip_flag); + mesh_foreachScreenEdge(eval_ctx, vc, find_nearest_edge__doClosest, &data, clip_flag); hit = (data.use_cycle && data.hit_cycle.edge) ? &data.hit_cycle : &data.hit; *r_dist = hit->dist; @@ -711,9 +717,9 @@ BMEdge *EDBM_edge_find_nearest_ex( } BMEdge *EDBM_edge_find_nearest( - const bContext *C, ViewContext *vc, float *r_dist) + const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist) { - return EDBM_edge_find_nearest_ex(C, vc, r_dist, NULL, false, false, NULL); + return EDBM_edge_find_nearest_ex(eval_ctx, vc, r_dist, NULL, false, false, NULL); } /* find the distance to the face we already have */ @@ -787,7 +793,7 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, const float BMFace *EDBM_face_find_nearest_ex( - const bContext *C, ViewContext *vc, float *r_dist, + const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist, float *r_dist_center, const bool use_select_bias, const bool use_cycle, BMFace **r_efa_zbuf) @@ -799,9 +805,9 @@ BMFace *EDBM_face_find_nearest_ex( unsigned int index; BMFace *efa; - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); - index = ED_view3d_backbuf_sample(C, vc, vc->mval[0], vc->mval[1]); + index = ED_view3d_backbuf_sample(eval_ctx, vc, vc->mval[0], vc->mval[1]); efa = index ? BM_face_at_index_find_or_table(bm, index - 1) : NULL; if (r_efa_zbuf) { @@ -819,7 +825,7 @@ BMFace *EDBM_face_find_nearest_ex( ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenFace(C, vc, find_nearest_face_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(eval_ctx, vc, find_nearest_face_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT); *r_dist_center = data.dist; } @@ -857,7 +863,7 @@ BMFace *EDBM_face_find_nearest_ex( data.cycle_index_prev = prev_select_index; ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenFace(C, vc, findnearestface__doClosest, &data, clip_flag); + mesh_foreachScreenFace(eval_ctx, vc, findnearestface__doClosest, &data, clip_flag); hit = (data.use_cycle && data.hit_cycle.face) ? &data.hit_cycle : &data.hit; *r_dist = hit->dist; @@ -872,9 +878,9 @@ BMFace *EDBM_face_find_nearest_ex( } } -BMFace *EDBM_face_find_nearest(const bContext *C, ViewContext *vc, float *r_dist) +BMFace *EDBM_face_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist) { - return EDBM_face_find_nearest_ex(C, vc, r_dist, NULL, false, false, NULL); + return EDBM_face_find_nearest_ex(eval_ctx, vc, r_dist, NULL, false, false, NULL); } #undef FIND_NEAR_SELECT_BIAS @@ -886,7 +892,9 @@ BMFace *EDBM_face_find_nearest(const bContext *C, ViewContext *vc, float *r_dist * selected vertices and edges get disadvantage * return 1 if found one */ -static int unified_findnearest(const bContext *C, ViewContext *vc, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa) +static int unified_findnearest( + const struct EvaluationContext *eval_ctx, ViewContext *vc, + BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa) { BMEditMesh *em = vc->em; static short mval_prev[2] = {-1, -1}; @@ -905,12 +913,12 @@ static int unified_findnearest(const bContext *C, ViewContext *vc, BMVert **r_ev /* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */ - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); if ((dist > 0.0f) && em->selectmode & SCE_SELECT_FACE) { float dist_center = 0.0f; float *dist_center_p = (em->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_VERTEX)) ? &dist_center : NULL; - efa = EDBM_face_find_nearest_ex(C, vc, &dist, dist_center_p, true, use_cycle, &efa_zbuf); + efa = EDBM_face_find_nearest_ex(eval_ctx, vc, &dist, dist_center_p, true, use_cycle, &efa_zbuf); if (efa && dist_center_p) { dist = min_ff(dist_margin, dist_center); } @@ -919,14 +927,14 @@ static int unified_findnearest(const bContext *C, ViewContext *vc, BMVert **r_ev if ((dist > 0.0f) && (em->selectmode & SCE_SELECT_EDGE)) { float dist_center = 0.0f; float *dist_center_p = (em->selectmode & SCE_SELECT_VERTEX) ? &dist_center : NULL; - eed = EDBM_edge_find_nearest_ex(C, vc, &dist, dist_center_p, true, use_cycle, &eed_zbuf); + eed = EDBM_edge_find_nearest_ex(eval_ctx, vc, &dist, dist_center_p, true, use_cycle, &eed_zbuf); if (eed && dist_center_p) { dist = min_ff(dist_margin, dist_center); } } if ((dist > 0.0f) && em->selectmode & SCE_SELECT_VERTEX) { - eve = EDBM_vert_find_nearest_ex(C, vc, &dist, true, use_cycle); + eve = EDBM_vert_find_nearest_ex(eval_ctx, vc, &dist, true, use_cycle); } /* return only one of 3 pointers, for frontbuffer redraws */ @@ -1559,6 +1567,7 @@ static void mouse_mesh_loop_edge(BMEditMesh *em, BMEdge *eed, bool select, bool static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool ring) { + EvaluationContext eval_ctx; ViewContext vc; BMEditMesh *em; BMEdge *eed; @@ -1568,15 +1577,16 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de float dist = ED_view3d_select_dist_px() * 0.6666f; float mvalf[2]; + CTX_data_eval_ctx(C, &eval_ctx); em_setup_viewcontext(C, &vc); mvalf[0] = (float)(vc.mval[0] = mval[0]); mvalf[1] = (float)(vc.mval[1] = mval[1]); em = vc.em; /* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */ - ED_view3d_backbuf_validate(C, &vc); + ED_view3d_backbuf_validate(&eval_ctx, &vc); - eed = EDBM_edge_find_nearest_ex(C, &vc, &dist, NULL, true, true, NULL); + eed = EDBM_edge_find_nearest_ex(&eval_ctx, &vc, &dist, NULL, true, true, NULL); if (eed == NULL) { return false; } @@ -1819,17 +1829,19 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot) /* gets called via generic mouse select operator */ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) { + EvaluationContext eval_ctx; ViewContext vc; BMVert *eve = NULL; BMEdge *eed = NULL; BMFace *efa = NULL; /* setup view context for argument to callbacks */ + CTX_data_eval_ctx(C, &eval_ctx); em_setup_viewcontext(C, &vc); vc.mval[0] = mval[0]; vc.mval[1] = mval[1]; - if (unified_findnearest(C, &vc, &eve, &eed, &efa)) { + if (unified_findnearest(&eval_ctx, &vc, &eve, &eed, &efa)) { /* Deselect everything */ if (extend == false && deselect == false && toggle == false) @@ -2793,6 +2805,7 @@ static void edbm_select_linked_pick_ex(BMEditMesh *em, BMElem *ele, bool sel, in static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Object *obedit = CTX_data_edit_object(C); + EvaluationContext eval_ctx; ViewContext vc; BMEditMesh *em; BMesh *bm; @@ -2810,6 +2823,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE view3d_operator_needs_opengl(C); /* setup view context for argument to callbacks */ + CTX_data_eval_ctx(C, &eval_ctx); em_setup_viewcontext(C, &vc); em = vc.em; bm = em->bm; @@ -2822,7 +2836,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE vc.mval[1] = event->mval[1]; /* return warning! */ - if (unified_findnearest(C, &vc, &eve, &eed, &efa) == 0) { + if (unified_findnearest(&eval_ctx, &vc, &eve, &eed, &efa) == 0) { WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 7ec8e42e6df..8fddf2551b8 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -88,6 +88,7 @@ static void join_mesh_single( Material **matar, int *matmap, int totcol, int *vertofs, int *edgeofs, int *loopofs, int *polyofs) { + EvaluationContext eval_ctx; int a, b; Mesh *me = base_src->object->data; @@ -95,7 +96,6 @@ static void join_mesh_single( MEdge *medge = *medge_pp; MLoop *mloop = *mloop_pp; MPoly *mpoly = *mpoly_pp; - EvaluationContext eval_ctx; CTX_data_eval_ctx(C, &eval_ctx); @@ -1106,6 +1106,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, DerivedMesh *dm) */ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size) { + EvaluationContext eval_ctx; ViewContext vc; Mesh *me = ob->data; @@ -1114,6 +1115,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int if (!me || me->totpoly == 0) return false; + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); if (size) { @@ -1121,11 +1123,11 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int * on an edge in the backbuf, we can still select a face */ float dummy_dist; - *index = ED_view3d_backbuf_sample_rect(C, &vc, mval, size, 1, me->totpoly + 1, &dummy_dist); + *index = ED_view3d_backbuf_sample_rect(&eval_ctx, &vc, mval, size, 1, me->totpoly + 1, &dummy_dist); } else { /* sample only on the exact position */ - *index = ED_view3d_backbuf_sample(C, &vc, mval[0], mval[1]); + *index = ED_view3d_backbuf_sample(&eval_ctx, &vc, mval[0], mval[1]); } if ((*index) == 0 || (*index) > (unsigned int)me->totpoly) @@ -1293,11 +1295,11 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int * on an face in the backbuf, we can still select a vert */ float dummy_dist; - *index = ED_view3d_backbuf_sample_rect(C, &vc, mval, size, 1, me->totvert + 1, &dummy_dist); + *index = ED_view3d_backbuf_sample_rect(&eval_ctx, &vc, mval, size, 1, me->totvert + 1, &dummy_dist); } else { /* sample only on the exact position */ - *index = ED_view3d_backbuf_sample(C, &vc, mval[0], mval[1]); + *index = ED_view3d_backbuf_sample(&eval_ctx, &vc, mval[0], mval[1]); } if ((*index) == 0 || (*index) > (unsigned int)me->totvert) diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index f8d30f4c8f3..47d354ac72a 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -584,6 +584,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese { static MetaElem *startelem = NULL; Object *obedit = CTX_data_edit_object(C); + EvaluationContext eval_ctx; ViewContext vc; MetaBall *mb = (MetaBall *)obedit->data; MetaElem *ml, *ml_act = NULL; @@ -591,11 +592,12 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese unsigned int buffer[MAXPICKBUF]; rcti rect; + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); BLI_rcti_init_pt_radius(&rect, mval, 12); - hits = view3d_opengl_select(C, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); + hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); /* does startelem exist? */ ml = mb->editelems->first; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 32059759fb9..1baa1926bd2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1277,7 +1277,11 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons return OPERATOR_PASS_THROUGH; } - ED_view3d_autodist_init(C, vc.depsgraph, vc.ar, vc.v3d, 0); + EvaluationContext eval_ctx; + + CTX_data_eval_ctx(C, &eval_ctx); + + ED_view3d_autodist_init(&eval_ctx, vc.depsgraph, vc.ar, vc.v3d, 0); if (vc.rv3d->depths != NULL) { vc.rv3d->depths->damaged = true; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 1838c0fba5f..171c5f4ed30 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -86,7 +86,9 @@ #include "physics_intern.h" -void PE_create_particle_edit(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, PointCache *cache, ParticleSystem *psys); +void PE_create_particle_edit( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, + PointCache *cache, ParticleSystem *psys); void PTCacheUndo_clear(PTCacheEdit *edit); void recalc_lengths(PTCacheEdit *edit); void recalc_emitter_field(Object *ob, ParticleSystem *psys); @@ -216,7 +218,8 @@ static float pe_brush_size_get(const Scene *UNUSED(scene), ParticleBrushData *br * * note: this function runs on poll, therefor it can runs many times a second * keep it fast! */ -static PTCacheEdit *pe_get_current(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, int create) +static PTCacheEdit *pe_get_current( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, int create) { ParticleEditSettings *pset= PE_settings(scene); PTCacheEdit *edit = NULL; @@ -256,18 +259,18 @@ static PTCacheEdit *pe_get_current(const bContext *C, Scene *scene, SceneLayer * if (psys->part && psys->part->type == PART_HAIR) { if (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) { if (create && !psys->pointcache->edit) - PE_create_particle_edit(C, scene, sl, ob, pid->cache, NULL); + PE_create_particle_edit(eval_ctx, scene, sl, ob, pid->cache, NULL); edit = pid->cache->edit; } else { if (create && !psys->edit && psys->flag & PSYS_HAIR_DONE) - PE_create_particle_edit(C, scene, sl, ob, NULL, psys); + PE_create_particle_edit(eval_ctx, scene, sl, ob, NULL, psys); edit = psys->edit; } } else { if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) - PE_create_particle_edit(C, scene, sl, ob, pid->cache, psys); + PE_create_particle_edit(eval_ctx, scene, sl, ob, pid->cache, psys); edit = pid->cache->edit; } @@ -278,7 +281,7 @@ static PTCacheEdit *pe_get_current(const bContext *C, Scene *scene, SceneLayer * if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) { pset->flag |= PE_FADE_TIME; // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; - PE_create_particle_edit(C, scene, sl, ob, pid->cache, NULL); + PE_create_particle_edit(eval_ctx, scene, sl, ob, pid->cache, NULL); } edit = pid->cache->edit; break; @@ -287,7 +290,7 @@ static PTCacheEdit *pe_get_current(const bContext *C, Scene *scene, SceneLayer * if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) { pset->flag |= PE_FADE_TIME; // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; - PE_create_particle_edit(C, scene, sl, ob, pid->cache, NULL); + PE_create_particle_edit(eval_ctx, scene, sl, ob, pid->cache, NULL); } edit = pid->cache->edit; break; @@ -307,15 +310,16 @@ PTCacheEdit *PE_get_current(Scene *scene, SceneLayer *sl, Object *ob) return pe_get_current(NULL, scene, sl, ob, 0); } -PTCacheEdit *PE_create_current(const bContext *C, Scene *scene, Object *ob) +PTCacheEdit *PE_create_current(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { - return pe_get_current(C, scene, NULL, ob, 1); + return pe_get_current(eval_ctx, scene, NULL, ob, 1); } -void PE_current_changed(const bContext *C, Scene *scene, Object *ob) +void PE_current_changed(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { - if (ob->mode == OB_MODE_PARTICLE_EDIT) - PE_create_current(C, scene, ob); + if (ob->mode == OB_MODE_PARTICLE_EDIT) { + PE_create_current(eval_ctx, scene, ob); + } } void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra) @@ -408,10 +412,13 @@ static void PE_set_view3d_data(bContext *C, PEData *data) if (V3D_IS_ZBUF(data->vc.v3d)) { if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + /* needed or else the draw matrix can be incorrect */ view3d_operator_needs_opengl(C); - ED_view3d_backbuf_validate(C, &data->vc); + ED_view3d_backbuf_validate(&eval_ctx, &data->vc); /* we may need to force an update here by setting the rv3d as dirty * for now it seems ok, but take care!: * rv3d->depths->dirty = 1; */ @@ -1266,20 +1273,17 @@ static void update_velocities(PTCacheEdit *edit) } } -void PE_update_object(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, int useflag) +void PE_update_object(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, int useflag) { /* use this to do partial particle updates, not usable when adding or * removing, then a full redo is necessary and calling this may crash */ ParticleEditSettings *pset= PE_settings(scene); PTCacheEdit *edit = PE_get_current(scene, sl, ob); - EvaluationContext eval_ctx; POINT_P; if (!edit) return; - CTX_data_eval_ctx(C, &eval_ctx); - /* flag all particles to be updated if not using flag */ if (!useflag) LOOP_POINTS { @@ -1299,7 +1303,7 @@ void PE_update_object(const bContext *C, Scene *scene, SceneLayer *sl, Object *o PE_hide_keys_time(scene, edit, CFRA); /* regenerate path caches */ - psys_cache_edit_paths(&eval_ctx, scene, ob, edit, CFRA, G.is_rendering); + psys_cache_edit_paths(eval_ctx, scene, ob, edit, CFRA, G.is_rendering); /* disable update flag */ LOOP_POINTS { @@ -2200,6 +2204,9 @@ static int rekey_exec(bContext *C, wmOperator *op) { PEData data; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + PE_set_data(C, &data); data.dval= 1.0f / (float)(data.totrekey-1); @@ -2208,7 +2215,7 @@ static int rekey_exec(bContext *C, wmOperator *op) foreach_selected_point(&data, rekey_particle); recalc_lengths(data.edit); - PE_update_object(C, data.scene, data.scene_layer, data.ob, 1); + PE_update_object(&eval_ctx, data.scene, data.scene_layer, data.ob, 1); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob); return OPERATOR_FINISHED; @@ -2542,11 +2549,14 @@ static int subdivide_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + PE_set_data(C, &data); foreach_point(&data, subdivide_particle); recalc_lengths(data.edit); - PE_update_object(C, data.scene, data.scene_layer, data.ob, 1); + PE_update_object(&eval_ctx, data.scene, data.scene_layer, data.ob, 1); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob); return OPERATOR_FINISHED; @@ -3821,6 +3831,9 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) if (!PE_start_edit(edit)) return; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + RNA_float_get_array(itemptr, "mouse", mousef); mouse[0] = mousef[0]; mouse[1] = mousef[1]; @@ -4002,8 +4015,9 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) psys_free_path_cache(NULL, edit); DEG_id_tag_update(&ob->id, OB_RECALC_DATA); } - else - PE_update_object(C, scene, sl, ob, 1); + else { + PE_update_object(&eval_ctx, scene, sl, ob, 1); + } } if (edit->psys) { @@ -4236,6 +4250,9 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op)) if (!PE_start_edit(edit)) return OPERATOR_CANCELLED; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + /* disable locking temporatily for disconnected hair */ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR) pset->flag &= ~PE_LOCK_FIRST; @@ -4263,8 +4280,9 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op)) psys_free_path_cache(NULL, edit); DEG_id_tag_update(&ob->id, OB_RECALC_DATA); } - else - PE_update_object(C, scene, sl, ob, 1); + else { + PE_update_object(&eval_ctx, scene, sl, ob, 1); + } if (edit->psys) { WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); @@ -4626,7 +4644,8 @@ int PE_minmax(Scene *scene, SceneLayer *sl, float min[3], float max[3]) /************************ particle edit toggle operator ************************/ /* initialize needed data for bake edit */ -void PE_create_particle_edit(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, PointCache *cache, ParticleSystem *psys) +void PE_create_particle_edit( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, PointCache *cache, ParticleSystem *psys) { PTCacheEdit *edit; ParticleSystemModifierData *psmd = (psys) ? psys_get_modifier(ob, psys) : NULL; @@ -4727,7 +4746,7 @@ void PE_create_particle_edit(const bContext *C, Scene *scene, SceneLayer *sl, Ob recalc_lengths(edit); if (psys && !cache) recalc_emitter_field(ob, psys); - PE_update_object(C, scene, sl, ob, 1); + PE_update_object(eval_ctx, scene, sl, ob, 1); PTCacheUndo_clear(edit); PE_undo_push(scene, sl, "Original"); @@ -4768,8 +4787,11 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) if (!is_mode_set) { PTCacheEdit *edit; + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + ob->mode |= mode_flag; - edit= PE_create_current(C, scene, ob); + edit= PE_create_current(&eval_ctx, scene, ob); /* mesh may have changed since last entering editmode. * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */ @@ -4940,12 +4962,16 @@ static int unify_length_exec(bContext *C, wmOperator *UNUSED(op)) SceneLayer *sl = CTX_data_scene_layer(C); PTCacheEdit *edit = PE_get_current(scene, sl, ob); float average_length = calculate_average_length(edit); + if (average_length == 0.0f) { return OPERATOR_CANCELLED; } scale_points_to_length(edit, average_length); - PE_update_object(C, scene, sl, ob, 1); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + + PE_update_object(&eval_ctx, scene, sl, ob, 1); if (edit->psys) { WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 2a526e28c44..571a8ab18f0 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -568,7 +568,9 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot) /************************ connect/disconnect hair operators *********************/ -static void disconnect_hair(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, ParticleSystem *psys) +static void disconnect_hair( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + Object *ob, ParticleSystem *psys) { ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); ParticleEditSettings *pset= PE_settings(scene); @@ -614,7 +616,7 @@ static void disconnect_hair(const bContext *C, Scene *scene, SceneLayer *sl, Obj if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF)) pset->brushtype = PE_BRUSH_NONE; - PE_update_object(C, scene, sl, ob, 0); + PE_update_object(eval_ctx, scene, sl, ob, 0); } static int disconnect_hair_exec(bContext *C, wmOperator *op) @@ -625,17 +627,20 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op) ParticleSystem *psys= NULL; const bool all = RNA_boolean_get(op->ptr, "all"); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + if (!ob) return OPERATOR_CANCELLED; if (all) { for (psys=ob->particlesystem.first; psys; psys=psys->next) { - disconnect_hair(C, scene, sl, ob, psys); + disconnect_hair(&eval_ctx, scene, sl, ob, psys); } } else { psys = psys_get_current(ob); - disconnect_hair(C, scene, sl, ob, psys); + disconnect_hair(&eval_ctx, scene, sl, ob, psys); } DEG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -661,9 +666,10 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot) /* from/to_world_space : whether from/to particles are in world or hair space * from/to_mat : additional transform for from/to particles (e.g. for using object space copying) */ -static bool remap_hair_emitter(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, ParticleSystem *psys, - Object *target_ob, ParticleSystem *target_psys, PTCacheEdit *target_edit, - float from_mat[4][4], float to_mat[4][4], bool from_global, bool to_global) +static bool remap_hair_emitter( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, ParticleSystem *psys, + Object *target_ob, ParticleSystem *target_psys, PTCacheEdit *target_edit, + float from_mat[4][4], float to_mat[4][4], bool from_global, bool to_global) { ParticleSystemModifierData *target_psmd = psys_get_modifier(target_ob, target_psys); ParticleData *pa, *tpa; @@ -847,19 +853,23 @@ static bool remap_hair_emitter(const bContext *C, Scene *scene, SceneLayer *sl, psys_free_path_cache(target_psys, target_edit); - PE_update_object(C, scene, sl, target_ob, 0); + PE_update_object(eval_ctx, scene, sl, target_ob, 0); return true; } -static bool connect_hair(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, ParticleSystem *psys) +static bool connect_hair( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + Object *ob, ParticleSystem *psys) { bool ok; if (!psys) return false; - ok = remap_hair_emitter(C, scene, sl, ob, psys, ob, psys, psys->edit, ob->obmat, ob->obmat, psys->flag & PSYS_GLOBAL_HAIR, false); + ok = remap_hair_emitter( + eval_ctx, scene, sl, ob, psys, ob, psys, psys->edit, + ob->obmat, ob->obmat, psys->flag & PSYS_GLOBAL_HAIR, false); psys->flag &= ~PSYS_GLOBAL_HAIR; return ok; @@ -867,6 +877,7 @@ static bool connect_hair(const bContext *C, Scene *scene, SceneLayer *sl, Object static int connect_hair_exec(bContext *C, wmOperator *op) { + EvaluationContext eval_ctx; Scene *scene= CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); Object *ob= ED_object_context(C); @@ -877,14 +888,16 @@ static int connect_hair_exec(bContext *C, wmOperator *op) if (!ob) return OPERATOR_CANCELLED; + CTX_data_eval_ctx(C, &eval_ctx); + if (all) { for (psys=ob->particlesystem.first; psys; psys=psys->next) { - any_connected |= connect_hair(C, scene, sl, ob, psys); + any_connected |= connect_hair(&eval_ctx, scene, sl, ob, psys); } } else { psys = psys_get_current(ob); - any_connected |= connect_hair(C, scene, sl, ob, psys); + any_connected |= connect_hair(&eval_ctx, scene, sl, ob, psys); } if (!any_connected) { @@ -920,7 +933,9 @@ typedef enum eCopyParticlesSpace { PAR_COPY_SPACE_WORLD = 1, } eCopyParticlesSpace; -static void copy_particle_edit(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, ParticleSystem *psys, ParticleSystem *psys_from) +static void copy_particle_edit( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + Object *ob, ParticleSystem *psys, ParticleSystem *psys_from) { PTCacheEdit *edit_from = psys_from->edit, *edit; ParticleData *pa; @@ -970,7 +985,7 @@ static void copy_particle_edit(const bContext *C, Scene *scene, SceneLayer *sl, recalc_lengths(edit); recalc_emitter_field(ob, psys); - PE_update_object(C, scene, sl, ob, true); + PE_update_object(eval_ctx, scene, sl, ob, true); PTCacheUndo_clear(edit); PE_undo_push(scene, sl, "Original"); @@ -1087,8 +1102,9 @@ static bool copy_particle_systems_to_object(const bContext *C, CDDM_calc_normals(psmd->dm_final); DM_ensure_tessface(psmd->dm_final); - if (psys_from->edit) - copy_particle_edit(C, scene, sl, ob_to, psys, psys_from); + if (psys_from->edit) { + copy_particle_edit(&eval_ctx, scene, sl, ob_to, psys, psys_from); + } if (duplicate_settings) { id_us_min(&psys->part->id); @@ -1122,7 +1138,9 @@ static bool copy_particle_systems_to_object(const bContext *C, break; } if (ob_from != ob_to) { - remap_hair_emitter(C, scene, sl, ob_from, psys_from, ob_to, psys, psys->edit, from_mat, to_mat, psys_from->flag & PSYS_GLOBAL_HAIR, psys->flag & PSYS_GLOBAL_HAIR); + remap_hair_emitter( + &eval_ctx, scene, sl, ob_from, psys_from, ob_to, psys, psys->edit, + from_mat, to_mat, psys_from->flag & PSYS_GLOBAL_HAIR, psys->flag & PSYS_GLOBAL_HAIR); } /* tag for recalc */ diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index b7ec80bb74e..2ffd9757f92 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5027,6 +5027,7 @@ void paint_proj_stroke( /* clone gets special treatment here to avoid going through image initialization */ if (ps_handle->is_clone_cursor_pick) { + EvaluationContext eval_ctx; Scene *scene = ps_handle->scene; struct Depsgraph *graph = CTX_data_depsgraph(C); View3D *v3d = CTX_wm_view3d(C); @@ -5036,7 +5037,9 @@ void paint_proj_stroke( view3d_operator_needs_opengl(C); - if (!ED_view3d_autodist(C, graph, ar, v3d, mval_i, cursor, false, NULL)) { + CTX_data_eval_ctx(C, &eval_ctx); + + if (!ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval_i, cursor, false, NULL)) { return; } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index b581c785b3c..17ecb309e27 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -348,13 +348,15 @@ static void imapaint_pick_uv(EvaluationContext *eval_ctx, Scene *scene, Object * } /* returns 0 if not found, otherwise 1 */ -static int imapaint_pick_face(const bContext *C, ViewContext *vc, const int mval[2], unsigned int *r_index, unsigned int totpoly) +static int imapaint_pick_face( + const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], + unsigned int *r_index, unsigned int totpoly) { if (totpoly == 0) return 0; /* sample only on the exact position */ - *r_index = ED_view3d_backbuf_sample(C, vc, mval[0], mval[1]); + *r_index = ED_view3d_backbuf_sample(eval_ctx, vc, mval[0], mval[1]); if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) { return 0; @@ -466,7 +468,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr view3d_operator_needs_opengl(C); - if (imapaint_pick_face(C, &vc, mval, &faceindex, totpoly)) { + if (imapaint_pick_face(&eval_ctx, &vc, mval, &faceindex, totpoly)) { Image *image; if (use_material) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index b395ac5c49d..321ce1fe306 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -814,7 +814,9 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo } -static int sample_backbuf_area(const bContext *C, ViewContext *vc, int *indexar, int totpoly, int x, int y, float size) +static int sample_backbuf_area( + const EvaluationContext *eval_ctx, ViewContext *vc, + int *indexar, int totpoly, int x, int y, float size) { struct ImBuf *ibuf; int a, tot = 0, index; @@ -823,7 +825,7 @@ static int sample_backbuf_area(const bContext *C, ViewContext *vc, int *indexar, * brushes with size > 64, why is this here? */ /*if (size > 64.0) size = 64.0;*/ - ibuf = ED_view3d_backbuf_read(C, vc, x - size, y - size, x + size, y + size); + ibuf = ED_view3d_backbuf_read(eval_ctx, vc, x - size, y - size, x + size, y + size); if (ibuf) { unsigned int *rt = ibuf->rect; @@ -2162,6 +2164,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P VPaint *wp = ts->wpaint; Brush *brush = BKE_paint_brush(&wp->paint); struct WPaintData *wpd = paint_stroke_mode_data(stroke); + EvaluationContext eval_ctx; ViewContext *vc; Object *ob; Mesh *me; @@ -2201,9 +2204,12 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P me = ob->data; indexar = wpd->indexar; + view3d_operator_needs_opengl(C); ED_view3d_init_mats_rv3d(ob, vc->rv3d); + CTX_data_eval_ctx(C, &eval_ctx); + /* load projection matrix */ mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); @@ -2243,7 +2249,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* Ugly x2, we need this so hidden faces don't draw */ me->editflag |= ME_EDIT_PAINT_FACE_SEL; } - totindex = sample_backbuf_area(C, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); + totindex = sample_backbuf_area(&eval_ctx, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); me->editflag = editflag_prev; if (use_face_sel && me->totpoly) { @@ -2799,6 +2805,7 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) { + EvaluationContext eval_ctx; Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); struct VPaintData *vpd = paint_stroke_mode_data(stroke); @@ -2827,7 +2834,8 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); /* which faces are involved */ - totindex = sample_backbuf_area(C, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); + CTX_data_eval_ctx(C, &eval_ctx); + totindex = sample_backbuf_area(&eval_ctx, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); if ((me->editflag & ME_EDIT_PAINT_FACE_SEL) && me->mpoly) { for (index = 0; index < totindex; index++) { diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index b4e968226f4..6f395e2c761 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1610,8 +1610,10 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag } } -static void draw_custom_bone(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, - const short dt, int armflag, int boneflag, unsigned int id, float length) +static void draw_custom_bone( + const struct EvaluationContext *eval_ctx, + Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, + const short dt, int armflag, int boneflag, unsigned int id, float length) { if (ob == NULL) return; @@ -1626,7 +1628,7 @@ static void draw_custom_bone(const bContext *C, Scene *scene, SceneLayer *sl, Vi GPU_select_load_id((GLuint) id | BONESEL_BONE); } - draw_object_instance(C, scene, sl, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); + draw_object_instance(eval_ctx, scene, sl, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); } @@ -1930,9 +1932,10 @@ static void bone_matrix_translate_y(float mat[4][4], float y) } /* assumes object is Armature with pose */ -static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, - const short dt, const unsigned char ob_wire_col[4], - const bool do_const_color, const bool is_outline) +static void draw_pose_bones( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const short dt, const unsigned char ob_wire_col[4], + const bool do_const_color, const bool is_outline) { RegionView3D *rv3d = ar->regiondata; Object *ob = base->object; @@ -2057,7 +2060,7 @@ static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, Vie glDisable(GL_CULL_FACE); } - draw_custom_bone(C, scene, sl, v3d, rv3d, pchan->custom, + draw_custom_bone(eval_ctx, scene, sl, v3d, rv3d, pchan->custom, OB_SOLID, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); } } @@ -2153,7 +2156,7 @@ static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, Vie if (bone == arm->act_bone) flag |= BONE_DRAW_ACTIVE; - draw_custom_bone(C, scene, sl, v3d, rv3d, pchan->custom, + draw_custom_bone(eval_ctx, scene, sl, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); gpuPopMatrix(); @@ -2659,9 +2662,9 @@ static void ghost_poses_tag_unselected(Object *ob, short unset) /* draw ghosts that occur within a frame range * note: object should be in posemode */ -static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) +static void draw_ghost_poses_range( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bArmature *arm = ob->data; @@ -2669,8 +2672,6 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * float start, end, stepsize, range, colfac; int cfrao, flago; unsigned char col[4]; - - CTX_data_eval_ctx(C, &eval_ctx); start = (float)arm->ghostsf; end = (float)arm->ghostef; @@ -2706,8 +2707,8 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * UI_GetThemeColorShadeAlpha4ubv(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)), col); BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2729,9 +2730,10 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * /* draw ghosts on keyframes in action within range * - object should be in posemode */ -static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, BaseLegacy *base) +static void draw_ghost_poses_keys( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + View3D *v3d, ARegion *ar, BaseLegacy *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bAction *act = (adt) ? adt->action : NULL; @@ -2742,8 +2744,6 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s float start, end, range, colfac, i; int cfrao, flago; unsigned char col[4]; - - CTX_data_eval_ctx(C, &eval_ctx); start = (float)arm->ghostsf; end = (float)arm->ghostef; @@ -2790,8 +2790,8 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s CFRA = (int)ak->cfra; BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2814,9 +2814,10 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s /* draw ghosts around current frame * - object is supposed to be armature in posemode */ -static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) +static void draw_ghost_poses( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + View3D *v3d, ARegion *ar, Base *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bArmature *arm = ob->data; @@ -2825,8 +2826,6 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi int cfrao, flago; unsigned char col[4]; - CTX_data_eval_ctx(C, &eval_ctx); - /* pre conditions, get an action with sufficient frames */ if (ELEM(NULL, adt, adt->action)) return; @@ -2871,8 +2870,8 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } } @@ -2886,8 +2885,8 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } } } @@ -2912,9 +2911,10 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi /* called from drawobject.c, return true if nothing was drawn * (ob_wire_col == NULL) when drawing ghost */ -bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4], - const bool is_outline) +bool draw_armature( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4], + const bool is_outline) { Object *ob = base->object; bArmature *arm = ob->data; @@ -2972,14 +2972,14 @@ bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, } else if (ob->mode & OB_MODE_POSE) { if (arm->ghosttype == ARM_GHOST_RANGE) { - draw_ghost_poses_range(C, scene, sl, v3d, ar, base); + draw_ghost_poses_range(eval_ctx, scene, sl, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_KEYS) { - draw_ghost_poses_keys(C, scene, sl, v3d, ar, base); + draw_ghost_poses_keys(eval_ctx, scene, sl, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_CUR) { if (arm->ghostep) - draw_ghost_poses(C, scene, sl, v3d, ar, base); + draw_ghost_poses(eval_ctx, scene, sl, v3d, ar, base); } if ((dflag & DRAW_SCENESET) == 0) { if (ob == OBACT_NEW(sl)) @@ -2992,7 +2992,7 @@ bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, } } } - draw_pose_bones(C, scene, sl, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; } else { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1490ad6288f..b0d5406e517 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2395,7 +2395,8 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i } #ifdef SEQUENCER_DAG_WORKAROUND -static void ensure_curve_cache(const bContext *C, Scene *scene, Object *object) +static void ensure_curve_cache( + const EvaluationContext *eval_ctx, Scene *scene, Object *object) { bool need_recalc = object->curve_cache == NULL; /* Render thread might have freed the curve cache if the @@ -2420,21 +2421,17 @@ static void ensure_curve_cache(const bContext *C, Scene *scene, Object *object) object->curve_cache->bev.first != NULL; } if (need_recalc) { - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); - switch (object->type) { case OB_CURVE: case OB_SURF: case OB_FONT: - BKE_displist_make_curveTypes(&eval_ctx, scene, object, false); + BKE_displist_make_curveTypes(eval_ctx, scene, object, false); break; case OB_MBALL: - BKE_displist_make_mball(&eval_ctx, scene, object); + BKE_displist_make_mball(eval_ctx, scene, object); break; case OB_LATTICE: - BKE_lattice_modifiers_calc(&eval_ctx, scene, object); + BKE_lattice_modifiers_calc(eval_ctx, scene, object); break; } } @@ -4300,8 +4297,9 @@ static bool object_is_halo(Scene *scene, Object *ob) return (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); } -static void draw_mesh_fancy(EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const unsigned char ob_wire_col[4], const short dflag) +static void draw_mesh_fancy( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const unsigned char ob_wire_col[4], const short dflag) { #ifdef WITH_GAMEENGINE Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, sl) : base->object; @@ -4564,18 +4562,16 @@ static void draw_mesh_fancy(EvaluationContext *eval_ctx, Scene *scene, SceneLaye } /* returns true if nothing was drawn, for detecting to draw an object center */ -static bool draw_mesh_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, BaseLegacy *base, - const char dt, const unsigned char ob_wire_col[4], const short dflag) +static bool draw_mesh_object( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, BaseLegacy *base, + const char dt, const unsigned char ob_wire_col[4], const short dflag) { - EvaluationContext eval_ctx; Object *ob = base->object; Object *obedit = scene->obedit; Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; bool do_alpha_after = false, drawlinked = false, retval = false; - CTX_data_eval_ctx(C, &eval_ctx); - /* If we are drawing shadows and any of the materials don't cast a shadow, * then don't draw the object */ if (v3d->flag2 & V3D_RENDER_SHADOW) { @@ -4608,7 +4604,7 @@ static bool draw_mesh_object(const bContext *C, Scene *scene, SceneLayer *sl, AR } else { cageDM = editbmesh_get_derived_cage_and_final( - &eval_ctx, scene, ob, em, scene->customdata_mask, + eval_ctx, scene, ob, em, scene->customdata_mask, &finalDM); } @@ -4649,7 +4645,7 @@ static bool draw_mesh_object(const bContext *C, Scene *scene, SceneLayer *sl, AR } } - draw_mesh_fancy(&eval_ctx, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); + draw_mesh_fancy(eval_ctx, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); GPU_end_object_materials(); @@ -5585,8 +5581,9 @@ static bool drawDispList_nobackface(Scene *scene, SceneLayer *sl, View3D *v3d, R return false; } -static bool drawDispList(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +static bool drawDispList( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { bool retval; @@ -5598,7 +5595,7 @@ static bool drawDispList(const bContext *C, Scene *scene, SceneLayer *sl, View3D } #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, base->object); + ensure_curve_cache(eval_ctx, scene, base->object); #endif if (drawCurveDerivedMesh(scene, sl, v3d, rv3d, base, dt) == false) { @@ -5907,9 +5904,10 @@ static void draw_particle_data(ParticleSystem *psys, RegionView3D *rv3d, * 6. draw the arrays * 7. clean up */ -static void draw_new_particle_system(EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, - Base *base, ParticleSystem *psys, - const char ob_dt, const short dflag) +static void draw_new_particle_system( + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, + Base *base, ParticleSystem *psys, + const char ob_dt, const short dflag) { Object *ob = base->object; ParticleEditSettings *pset = PE_settings(scene); @@ -6593,18 +6591,15 @@ static void draw_new_particle_system(EvaluationContext *eval_ctx, Scene *scene, } } -static void draw_update_ptcache_edit(const bContext *C, Scene *scene, SceneLayer *sl, Object *ob, PTCacheEdit *edit) +static void draw_update_ptcache_edit( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, PTCacheEdit *edit) { if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED) - PE_update_object(C, scene, sl, ob, 0); + PE_update_object(eval_ctx, scene, sl, ob, 0); /* create path and child path cache if it doesn't exist already */ if (edit->pathcache == NULL) { - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); - - psys_cache_edit_paths(&eval_ctx, scene, ob, edit, CFRA, G.is_rendering); + psys_cache_edit_paths(eval_ctx, scene, ob, edit, CFRA, G.is_rendering); } } @@ -7339,7 +7334,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } static void draw_editnurb( - const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, const char dt, const short dflag, const unsigned char UNUSED(ob_wire_col[4])) { ToolSettings *ts = scene->toolsettings; @@ -7353,7 +7349,7 @@ static void draw_editnurb( /* DispList */ UI_GetThemeColor3ubv(TH_WIRE_EDIT, wire_col); - drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, wire_col); + drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, wire_col); /* for shadows only show solid faces */ if (v3d->flag2 & V3D_RENDER_SHADOW) @@ -7478,8 +7474,9 @@ static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) immUnbindProgram(); } -static void draw_editfont(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +static void draw_editfont( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; Curve *cu = ob->data; @@ -7491,11 +7488,11 @@ static void draw_editfont(const bContext *C, Scene *scene, SceneLayer *sl, View3 if (cu->flag & CU_FAST) { imm_cpack(0xFFFFFF); set_inverted_drawing(1); - drawDispList(C, scene, sl, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col); + drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col); set_inverted_drawing(0); } else { - drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); } if (cu->linewidth != 0.0f) { @@ -7797,8 +7794,9 @@ static void imm_drawcone(const float vec[3], float radius, float height, float t } /* return true if nothing was drawn */ -static bool drawmball(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +static bool drawmball( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; MetaElem *ml; @@ -7811,13 +7809,13 @@ static bool drawmball(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v if ((G.f & G_PICKSEL) == 0) { unsigned char wire_col[4]; UI_GetThemeColor4ubv(TH_WIRE_EDIT, wire_col); - drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, wire_col); + drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, wire_col); } ml = mb->editelems->first; } else { if ((base->flag_legacy & OB_FROMDUPLI) == 0) { - drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); } ml = mb->elems.first; } @@ -8265,7 +8263,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3]) /* draws wire outline */ static void draw_object_selected_outline( - const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, const unsigned char ob_wire_col[4]) { RegionView3D *rv3d = ar->regiondata; @@ -8277,7 +8275,7 @@ static void draw_object_selected_outline( bool has_faces = false; #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, ob); + ensure_curve_cache(eval_ctx, scene, ob); #endif DerivedMesh *dm = ob->derivedFinal; @@ -8314,7 +8312,7 @@ static void draw_object_selected_outline( else if (ob->type == OB_ARMATURE) { if (!(ob->mode & OB_MODE_POSE && base == sl->basact)) { glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f); - draw_armature(C, scene, sl, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); + draw_armature(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); } } @@ -8566,7 +8564,9 @@ void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4]) * main object drawing function, draws in selection * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET */ -void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, Base *base, const short dflag) +void draw_object( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, + Base *base, const short dflag) { ModifierData *md = NULL; Object *ob = base->object; @@ -8581,9 +8581,6 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V const bool has_particles = (ob->particlesystem.first != NULL); bool skip_object = false; /* Draw particles but not their emitter object. */ SmokeModifierData *smd = NULL; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); if (ob != scene->obedit) { if (ob->restrictflag & OB_RESTRICT_VIEW) @@ -8751,7 +8748,7 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V if ((v3d->flag & V3D_SELECT_OUTLINE) && !render_override && ob->type != OB_MESH) { if (dt > OB_WIRE && (ob->mode & OB_MODE_EDIT) == 0 && (dflag & DRAW_SCENESET) == 0) { if (!(ob->dtx & OB_DRAWWIRE) && (base->flag & BASE_SELECTED) && !(dflag & (DRAW_PICKING | DRAW_CONSTCOLOR))) { - draw_object_selected_outline(C, scene, sl, v3d, ar, base, ob_wire_col); + draw_object_selected_outline(eval_ctx, scene, sl, v3d, ar, base, ob_wire_col); } } } @@ -8765,7 +8762,7 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V switch (ob->type) { case OB_MESH: - empty_object = draw_mesh_object(C, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); + empty_object = draw_mesh_object(eval_ctx, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); if ((dflag & DRAW_CONSTCOLOR) == 0) { /* mesh draws wire itself */ dtx &= ~OB_DRAWWIRE; @@ -8775,18 +8772,18 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V case OB_FONT: cu = ob->data; if (cu->editfont) { - draw_editfont(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + draw_editfont(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); } else if (dt == OB_BOUNDBOX) { if ((render_override && v3d->drawtype >= OB_WIRE) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, base->object); + ensure_curve_cache(eval_ctx, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else if (ED_view3d_boundbox_clip(rv3d, ob->bb)) { - empty_object = drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); } break; @@ -8796,18 +8793,18 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V if (cu->editnurb) { ListBase *nurbs = BKE_curve_editNurbs_get(cu); - draw_editnurb(C, scene, sl, v3d, rv3d, base, nurbs->first, dt, dflag, ob_wire_col); + draw_editnurb(eval_ctx, scene, sl, v3d, rv3d, base, nurbs->first, dt, dflag, ob_wire_col); } else if (dt == OB_BOUNDBOX) { if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, base->object); + ensure_curve_cache(eval_ctx, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else if (ED_view3d_boundbox_clip(rv3d, ob->bb)) { - empty_object = drawDispList(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawDispList(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); } break; case OB_MBALL: @@ -8815,17 +8812,17 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V MetaBall *mb = ob->data; if (mb->editelems) - drawmball(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawmball(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); else if (dt == OB_BOUNDBOX) { if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, base->object); + ensure_curve_cache(eval_ctx, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else - empty_object = drawmball(C, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawmball(eval_ctx, scene, sl, v3d, rv3d, base, dt, dflag, ob_wire_col); break; } case OB_EMPTY: @@ -8864,7 +8861,7 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V } else { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(C, scene, ob); + ensure_curve_cache(eval_ctx, scene, ob); #endif drawlattice(v3d, ob, dflag, ob_wire_col); } @@ -8889,7 +8886,7 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V else copy_v4_v4_uchar(arm_col, ob_wire_col); - empty_object = draw_armature(C, scene, sl, v3d, ar, base, dt, dflag, arm_col, false); + empty_object = draw_armature(eval_ctx, scene, sl, v3d, ar, base, dt, dflag, arm_col, false); } } break; @@ -8942,12 +8939,12 @@ afterdraw: for (psys = ob->particlesystem.first; psys; psys = psys->next) { /* run this so that possible child particles get cached */ if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) { - PTCacheEdit *edit = PE_create_current(C, scene, ob); + PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob); if (edit && edit->psys == psys) - draw_update_ptcache_edit(C, scene, sl, ob, edit); + draw_update_ptcache_edit(eval_ctx, scene, sl, ob, edit); } - draw_new_particle_system(&eval_ctx, scene, v3d, rv3d, base, psys, dt, dflag); + draw_new_particle_system(eval_ctx, scene, v3d, rv3d, base, psys, dt, dflag); } invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 0); @@ -8963,10 +8960,10 @@ afterdraw: { if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) { - PTCacheEdit *edit = PE_create_current(C, scene, ob); + PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob); if (edit) { gpuLoadMatrix(rv3d->viewmat); - draw_update_ptcache_edit(C, scene, sl, ob, edit); + draw_update_ptcache_edit(eval_ctx, scene, sl, ob, edit); draw_ptcache_edit(scene, v3d, edit); gpuMultMatrix(ob->obmat); } @@ -9281,7 +9278,7 @@ afterdraw: for (ct = targets.first; ct; ct = ct->next) { /* calculate target's matrix */ if (cti->get_target_matrix) - cti->get_target_matrix(&eval_ctx, curcon, cob, ct, BKE_scene_frame_get(scene)); + cti->get_target_matrix(eval_ctx, curcon, cob, ct, BKE_scene_frame_get(scene)); else unit_m4(ct->matrix); @@ -9330,10 +9327,12 @@ afterdraw: * Drawing for selection picking, * caller must have called 'GPU_select_load_id(base->selcode)' first. */ -void draw_object_select(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, Base *base, const short dflag) +void draw_object_select( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, + Base *base, const short dflag) { BLI_assert(dflag & DRAW_PICKING && dflag & DRAW_CONSTCOLOR); - draw_object(C, scene, sl, ar, v3d, base, dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag); /* we draw duplicators for selection too */ if ((base->object->transflag & OB_DUPLI)) { @@ -9342,7 +9341,7 @@ void draw_object_select(const bContext *C, Scene *scene, SceneLayer *sl, ARegion Base tbase; tbase.flag_legacy = OB_FROMDUPLI; - lb = object_duplilist(G.main->eval_ctx, scene, base->object); + lb = object_duplilist(eval_ctx, scene, base->object); for (dob = lb->first; dob; dob = dob->next) { float omat[4][4]; @@ -9356,7 +9355,7 @@ void draw_object_select(const bContext *C, Scene *scene, SceneLayer *sl, ARegion char dt = tbase.object->dt; tbase.object->dt = MIN2(tbase.object->dt, base->object->dt); short dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx; - draw_object(C, scene, sl, ar, v3d, &tbase, dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, &tbase, dflag); tbase.object->dt = dt; tbase.object->dtx = dtx; @@ -9615,7 +9614,7 @@ static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index) } } -static void bbs_mesh_solid_verts(EvaluationContext *eval_ctx, Scene *scene, Object *ob) +static void bbs_mesh_solid_verts(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { Mesh *me = ob->data; DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask); @@ -9650,13 +9649,11 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) GWN_batch_draw(batch); } -void draw_object_backbufsel(const bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) +void draw_object_backbufsel( + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) { - EvaluationContext eval_ctx; ToolSettings *ts = scene->toolsettings; - CTX_data_eval_ctx(C, &eval_ctx); - gpuMultMatrix(ob->obmat); glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT); @@ -9668,7 +9665,7 @@ void draw_object_backbufsel(const bContext *C, Scene *scene, View3D *v3d, Region Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; - DerivedMesh *dm = editbmesh_get_derived_cage(&eval_ctx, scene, ob, em, CD_MASK_BAREMESH); + DerivedMesh *dm = editbmesh_get_derived_cage(eval_ctx, scene, ob, em, CD_MASK_BAREMESH); BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); @@ -9705,7 +9702,7 @@ void draw_object_backbufsel(const bContext *C, Scene *scene, View3D *v3d, Region /* currently vertex select only supports weight paint */ (ob->mode & OB_MODE_WEIGHT_PAINT)) { - bbs_mesh_solid_verts(&eval_ctx, scene, ob); + bbs_mesh_solid_verts(eval_ctx, scene, ob); } else { bbs_mesh_solid_faces(scene, ob); @@ -9725,21 +9722,19 @@ void draw_object_backbufsel(const bContext *C, Scene *scene, View3D *v3d, Region /* assumes all matrices/etc set OK */ /* helper function for drawing object instances - meshes */ -static void draw_object_mesh_instance(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, - Object *ob, const short dt, int outline, const unsigned char ob_wire_col[4]) +static void draw_object_mesh_instance( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, + Object *ob, const short dt, int outline, const unsigned char ob_wire_col[4]) { - EvaluationContext eval_ctx; Mesh *me = ob->data; DerivedMesh *dm = NULL, *edm = NULL; - - CTX_data_eval_ctx(C, &eval_ctx); if (ob->mode & OB_MODE_EDIT) { edm = editbmesh_get_derived_base(ob, me->edit_btmesh, CD_MASK_BAREMESH); DM_update_materials(edm, ob); } else { - dm = mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH); + dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH); DM_update_materials(dm, ob); } @@ -9775,7 +9770,7 @@ static void draw_object_mesh_instance(const bContext *C, Scene *scene, SceneLaye if (dm) dm->release(dm); } -void draw_object_instance(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) +void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) { if (ob == NULL) return; @@ -9785,7 +9780,7 @@ void draw_object_instance(const bContext *C, Scene *scene, SceneLayer *sl, View3 switch (ob->type) { case OB_MESH: - draw_object_mesh_instance(C, scene, sl, v3d, rv3d, ob, dt, outline, bcol); + draw_object_mesh_instance(eval_ctx, scene, sl, v3d, rv3d, ob, dt, outline, bcol); break; case OB_EMPTY: if (ob->empty_drawtype == OB_EMPTY_IMAGE) { @@ -9798,13 +9793,11 @@ void draw_object_instance(const bContext *C, Scene *scene, SceneLayer *sl, View3 } } -void ED_draw_object_facemap(const bContext *C, Scene *scene, Object *ob, const float col[4], const int facemap) +void ED_draw_object_facemap( + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, const float col[4], const int facemap) { - EvaluationContext eval_ctx; DerivedMesh *dm = NULL; - CTX_data_eval_ctx(C, &eval_ctx); - /* happens on undo */ if (ob->type != OB_MESH || !ob->data) return; @@ -9814,7 +9807,7 @@ void ED_draw_object_facemap(const bContext *C, Scene *scene, Object *ob, const f return; } - dm = mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH); + dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH); if (!dm || !CustomData_has_layer(&dm->polyData, CD_FACEMAP)) return; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 037e3b26b9f..c85cf689068 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -119,7 +119,9 @@ static bool use_depth_doit(Scene *scene, View3D *v3d) /** * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore */ -void ED_view3d_update_viewmat(EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4], const rcti *rect) +void ED_view3d_update_viewmat( + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, + float viewmat[4][4], float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = ar->regiondata; @@ -181,7 +183,8 @@ void ED_view3d_update_viewmat(EvaluationContext *eval_ctx, Scene *scene, View3D } static void view3d_main_region_setup_view( - EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4], const rcti *rect) + const EvaluationContext *eval_ctx, Scene *scene, + View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = ar->regiondata; @@ -235,14 +238,12 @@ static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, Reg * we do a small hack to replace it temporarily so we don't need to change the * view3d)main_region_setup_view() code to account for that. */ -static void view3d_stereo3d_setup(const bContext *C, Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect) +static void view3d_stereo3d_setup( + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect) { bool is_left; const char *names[2] = { STEREO_LEFT_NAME, STEREO_RIGHT_NAME }; const char *viewname; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); /* show only left or right camera */ if (v3d->stereo3d_camera != STEREO_3D_ID) @@ -264,7 +265,7 @@ static void view3d_stereo3d_setup(const bContext *C, Scene *scene, View3D *v3d, data->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname); BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat); - view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, viewmat, NULL, rect); + view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, NULL, rect); data->shiftx = shiftx; BLI_unlock_thread(LOCK_VIEW3D); @@ -278,7 +279,7 @@ static void view3d_stereo3d_setup(const bContext *C, Scene *scene, View3D *v3d, v3d->camera = camera; BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat); - view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, viewmat, NULL, rect); + view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, NULL, rect); v3d->camera = view_ob; BLI_unlock_thread(LOCK_VIEW3D); @@ -289,20 +290,17 @@ static void view3d_stereo3d_setup(const bContext *C, Scene *scene, View3D *v3d, * Set the correct matrices */ void ED_view3d_draw_setup_view( - wmWindow *win, const bContext *C, Scene *scene, ARegion *ar, View3D *v3d, + wmWindow *win, const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d, float viewmat[4][4], float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = ar->regiondata; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); /* Setup the view matrix. */ if (view3d_stereo3d_active(win, scene, v3d, rv3d)) { - view3d_stereo3d_setup(C, scene, v3d, ar, rect); + view3d_stereo3d_setup(eval_ctx, scene, v3d, ar, rect); } else { - view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, viewmat, winmat, rect); + view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, rect); } } @@ -702,7 +700,7 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) } void ED_view3d_draw_depth( - const bContext *C, struct Depsgraph *graph, + const EvaluationContext *eval_ctx, struct Depsgraph *graph, ARegion *ar, View3D *v3d, bool alphaoverride) { Scene *scene = DEG_get_evaluated_scene(graph); @@ -718,7 +716,7 @@ void ED_view3d_draw_depth( U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */ U.obcenter_dia = 0; - ED_view3d_draw_setup_view(NULL, C, scene, ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); @@ -1865,7 +1863,10 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset) static void view3d_draw_view(const bContext *C, ARegion *ar) { - ED_view3d_draw_setup_view(CTX_wm_window(C), C, CTX_data_scene(C), ar, CTX_wm_view3d(C), NULL, NULL, NULL); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + + ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, CTX_wm_view3d(C), NULL, NULL, NULL); /* Only 100% compliant on new spec goes bellow */ DRW_draw_view(C); @@ -1903,7 +1904,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar) * \{ */ static void view3d_stereo3d_setup_offscreen( - EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float winmat[4][4], const char *viewname) { /* update the viewport matrices with the new camera */ @@ -1923,7 +1924,7 @@ static void view3d_stereo3d_setup_offscreen( } } -void ED_view3d_draw_offscreen_init(EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d) +void ED_view3d_draw_offscreen_init(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d) { RenderEngineType *type = RE_engines_find(scene->r.engine); if (type->flag & RE_USE_LEGACY_PIPELINE) { @@ -1953,7 +1954,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) * stuff like shadow buffers */ void ED_view3d_draw_offscreen( - EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int winx, int winy, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, GPUFX *fx, GPUFXSettings *fx_settings, @@ -2025,7 +2026,7 @@ void ED_view3d_draw_offscreen( v3d->fx_settings.ssao = ssao; } - VP_deprecated_view3d_draw_objects(NULL, scene, v3d, ar, NULL, do_bgpic, true, do_compositing ? fx : NULL); + VP_deprecated_view3d_draw_objects(NULL, eval_ctx, scene, v3d, ar, NULL, do_bgpic, true, do_compositing ? fx : NULL); /* post process */ if (do_compositing) { @@ -2073,7 +2074,7 @@ void ED_view3d_draw_offscreen( * (avoids re-creating when doing multiple GL renders). */ ImBuf *ED_view3d_draw_offscreen_imbuf( - EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int sizex, int sizey, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, /* output vars */ @@ -2238,7 +2239,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( * \note used by the sequencer */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *camera, int width, int height, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *camera, int width, int height, unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) @@ -2341,23 +2342,21 @@ void VP_legacy_drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool drawfloor(scene, v3d, grid_unit, write_depth); } -void VP_legacy_view3d_main_region_setup_view(const bContext *C, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]) +void VP_legacy_view3d_main_region_setup_view( + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, + ARegion *ar, float viewmat[4][4], float winmat[4][4]) { - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); - - view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); + view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); } -bool VP_legacy_view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d) +bool VP_legacy_view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d) { - return view3d_stereo3d_active(CTX_wm_window(C), scene, v3d, rv3d); + return view3d_stereo3d_active(win, scene, v3d, rv3d); } -void VP_legacy_view3d_stereo3d_setup(const bContext *C, Scene *scene, View3D *v3d, ARegion *ar) +void VP_legacy_view3d_stereo3d_setup(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar) { - view3d_stereo3d_setup(C, scene, v3d, ar, NULL); + view3d_stereo3d_setup(eval_ctx, scene, v3d, ar, NULL); } bool VP_legacy_use_depth(Scene *scene, View3D *v3d) diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index c458539be3e..6184ed63543 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -213,7 +213,7 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect) /* *********************** backdraw for selection *************** */ -static void backdrawview3d(const bContext *C, Scene *scene, SceneLayer *sl, wmWindow *win, ARegion *ar, View3D *v3d) +static void backdrawview3d(const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, wmWindow *win, ARegion *ar, View3D *v3d) { RegionView3D *rv3d = ar->regiondata; struct Base *base = sl->basact; @@ -314,7 +314,7 @@ static void backdrawview3d(const bContext *C, Scene *scene, SceneLayer *sl, wmWi G.f |= G_BACKBUFSEL; if (base && ((base->flag & BASE_VISIBLED) != 0)) - draw_object_backbufsel(C, scene, v3d, rv3d, base->object); + draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, base->object); if (rv3d->gpuoffscreen) GPU_offscreen_unbind(rv3d->gpuoffscreen, true); @@ -355,10 +355,11 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data); } -void ED_view3d_backbuf_validate(const bContext *C, ViewContext *vc) +void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, ViewContext *vc) { - if (vc->v3d->flag & V3D_INVALID_BACKBUF) - backdrawview3d(C, vc->scene, vc->scene_layer, vc->win, vc->ar, vc->v3d); + if (vc->v3d->flag & V3D_INVALID_BACKBUF) { + backdrawview3d(eval_ctx, vc->scene, vc->scene_layer, vc->win, vc->ar, vc->v3d); + } } /** @@ -371,13 +372,14 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist) } /* samples a single pixel (copied from vpaint) */ -unsigned int ED_view3d_backbuf_sample(const bContext *C, ViewContext *vc, int x, int y) +unsigned int ED_view3d_backbuf_sample( + const EvaluationContext *eval_ctx, ViewContext *vc, int x, int y) { if (x >= vc->ar->winx || y >= vc->ar->winy) { return 0; } - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); unsigned int col; view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); @@ -391,7 +393,8 @@ unsigned int ED_view3d_backbuf_sample(const bContext *C, ViewContext *vc, int x, } /* reads full rect, converts indices */ -ImBuf *ED_view3d_backbuf_read(const bContext *C, ViewContext *vc, int xmin, int ymin, int xmax, int ymax) +ImBuf *ED_view3d_backbuf_read( + const EvaluationContext *eval_ctx, ViewContext *vc, int xmin, int ymin, int xmax, int ymax) { /* clip */ const rcti clip = { @@ -409,7 +412,7 @@ ImBuf *ED_view3d_backbuf_read(const bContext *C, ViewContext *vc, int xmin, int ImBuf *ibuf_clip = IMB_allocImBuf(size_clip[0], size_clip[1], 32, IB_rect); - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); view3d_opengl_read_pixels(vc->ar, clip.xmin, clip.ymin, size_clip[0], size_clip[1], GL_RGBA, GL_UNSIGNED_BYTE, ibuf_clip->rect); @@ -448,7 +451,7 @@ ImBuf *ED_view3d_backbuf_read(const bContext *C, ViewContext *vc, int xmin, int /* smart function to sample a rect spiralling outside, nice for backbuf selection */ unsigned int ED_view3d_backbuf_sample_rect( - const bContext *C, ViewContext *vc, const int mval[2], int size, + const EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, float *r_dist) { int dirvec[4][2]; @@ -457,7 +460,7 @@ unsigned int ED_view3d_backbuf_sample_rect( const int minx = mval[0] - (amount + 1); const int miny = mval[1] - (amount + 1); - ImBuf *buf = ED_view3d_backbuf_read(C, vc, minx, miny, minx + size - 1, miny + size - 1); + ImBuf *buf = ED_view3d_backbuf_read(eval_ctx, vc, minx, miny, minx + size - 1, miny + size - 1); if (!buf) return 0; unsigned index = 0; @@ -837,7 +840,8 @@ void ED_view3d_after_add(ListBase *lb, BaseLegacy *base, const short dflag) } /* disables write in zbuffer and draws it over */ -static void view3d_draw_transp(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d) +static void view3d_draw_transp( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d) { View3DAfter *v3da; @@ -845,7 +849,7 @@ static void view3d_draw_transp(const bContext *C, Scene *scene, SceneLayer *sl, v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, v3da->dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } v3d->transp = false; @@ -855,7 +859,8 @@ static void view3d_draw_transp(const bContext *C, Scene *scene, SceneLayer *sl, } /* clears zbuffer and draws it over */ -static void view3d_draw_xray(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, bool *clear) +static void view3d_draw_xray( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, bool *clear) { if (*clear && v3d->zbuf) { glClear(GL_DEPTH_BUFFER_BIT); @@ -865,7 +870,7 @@ static void view3d_draw_xray(const bContext *C, Scene *scene, SceneLayer *sl, AR v3d->xray = true; View3DAfter *v3da; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, v3da->dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } v3d->xray = false; @@ -873,7 +878,8 @@ static void view3d_draw_xray(const bContext *C, Scene *scene, SceneLayer *sl, AR /* clears zbuffer and draws it over */ -static void view3d_draw_xraytransp(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, const bool clear) +static void view3d_draw_xraytransp( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, const bool clear) { if (clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT); @@ -885,7 +891,7 @@ static void view3d_draw_xraytransp(const bContext *C, Scene *scene, SceneLayer * View3DAfter *v3da; while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, v3da->dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } @@ -897,7 +903,8 @@ static void view3d_draw_xraytransp(const bContext *C, Scene *scene, SceneLayer * /* clears zbuffer and draws it over, * note that in the select version we don't care about transparent flag as with regular drawing */ -static void view3d_draw_xray_select(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, bool *clear) +static void view3d_draw_xray_select( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, bool *clear) { /* Not ideal, but we need to read from the previous depths before clearing * otherwise we could have a function to load the depths after drawing. @@ -917,7 +924,7 @@ static void view3d_draw_xray_select(const bContext *C, Scene *scene, SceneLayer v3d->xray = true; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { if (GPU_select_load_id(v3da->base->object->select_color)) { - draw_object_select(C, scene, sl, ar, v3d, v3da->base, v3da->dflag); + draw_object_select(eval_ctx, scene, sl, ar, v3d, v3da->base, v3da->dflag); } MEM_freeN(v3da); } @@ -953,7 +960,7 @@ static DupliObject *dupli_step(DupliObject *dob) } static void draw_dupli_objects_color( - const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base, const short dflag, const int color) { RegionView3D *rv3d = ar->regiondata; @@ -967,9 +974,6 @@ static void draw_dupli_objects_color( char dt; short dtx; DupliApplyData *apply_data; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); if ((base->flag & BASE_VISIBLED) == 0) return; if ((base->object->restrictflag & OB_RESTRICT_RENDER) && (v3d->flag2 & V3D_RENDER_OVERRIDE)) return; @@ -983,10 +987,10 @@ static void draw_dupli_objects_color( tbase.flag_legacy = OB_FROMDUPLI | base->flag_legacy; tbase.flag = base->flag; - lb = object_duplilist(G.main->eval_ctx, scene, base->object); + lb = object_duplilist(eval_ctx, scene, base->object); // BLI_listbase_sort(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ - apply_data = duplilist_apply(&eval_ctx, base->object, scene, lb); + apply_data = duplilist_apply(eval_ctx, base->object, scene, lb); DupliObject *dob_next = NULL; DupliObject *dob = dupli_step(lb->first); @@ -1039,7 +1043,7 @@ static void draw_dupli_objects_color( if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { copy_m4_m4(dob->ob->obmat, dob->mat); GPU_begin_dupli_object(dob); - draw_object(C, scene, sl, ar, v3d, &tbase, dflag_dupli); + draw_object(eval_ctx, scene, sl, ar, v3d, &tbase, dflag_dupli); GPU_end_dupli_object(); } @@ -1057,7 +1061,7 @@ static void draw_dupli_objects_color( free_object_duplilist(lb); } -void draw_dupli_objects(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base) +void draw_dupli_objects(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base) { /* define the color here so draw_dupli_objects_color can be called * from the set loop */ @@ -1067,7 +1071,7 @@ void draw_dupli_objects(const bContext *C, Scene *scene, SceneLayer *sl, ARegion if (base->object->dup_group && base->object->dup_group->id.us < 1) color = TH_REDALERT; - draw_dupli_objects_color(C, scene, sl, ar, v3d, base, 0, color); + draw_dupli_objects_color(eval_ctx, scene, sl, ar, v3d, base, 0, color); } /* XXX warning, not using gpu offscreen here */ @@ -1180,12 +1184,13 @@ float view3d_depth_near(ViewDepths *d) return far == far_real ? FLT_MAX : far; } -void ED_view3d_draw_depth_gpencil(const bContext *C, Scene *scene, ARegion *ar, View3D *v3d) +void ED_view3d_draw_depth_gpencil( + const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d) { bool zbuf = v3d->zbuf; /* Setup view matrix. */ - ED_view3d_draw_setup_view(NULL, C, scene, ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); @@ -1200,10 +1205,10 @@ void ED_view3d_draw_depth_gpencil(const bContext *C, Scene *scene, ARegion *ar, if (!zbuf) glDisable(GL_DEPTH_TEST); } -void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, View3D *v3d) +void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d) { Base *base; - SceneLayer *sl = CTX_data_scene_layer(C); + SceneLayer *sl = eval_ctx->scene_layer; /* no need for color when drawing depth buffer */ const short dflag_depth = DRAW_CONSTCOLOR; @@ -1212,9 +1217,9 @@ void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, Vie Scene *sce_iter; for (SETLOOPER(scene->set, sce_iter, base)) { if ((base->flag & BASE_VISIBLED) != 0) { - draw_object(C, scene, sl, ar, v3d, base, 0); + draw_object(eval_ctx, scene, sl, ar, v3d, base, 0); if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(C, scene, sl, ar, v3d, base, dflag_depth, TH_UNDEFINED); + draw_dupli_objects_color(eval_ctx, scene, sl, ar, v3d, base, dflag_depth, TH_UNDEFINED); } } } @@ -1224,9 +1229,9 @@ void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, Vie if ((base->flag & BASE_VISIBLED) != 0) { /* dupli drawing */ if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(C, scene, sl, ar, v3d, base, dflag_depth, TH_UNDEFINED); + draw_dupli_objects_color(eval_ctx, scene, sl, ar, v3d, base, dflag_depth, TH_UNDEFINED); } - draw_object(C, scene, sl, ar, v3d, base, dflag_depth); + draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag_depth); } } @@ -1247,7 +1252,7 @@ void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, Vie if (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) { glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */ for (v3da = v3d->afterdraw_xray.first; v3da; v3da = v3da->next) { - draw_object(C, scene, sl, ar, v3d, v3da->base, dflag_depth); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, dflag_depth); } glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */ } @@ -1256,21 +1261,21 @@ void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, Vie v3d->xray = false; v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, dflag_depth); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } v3d->xray = true; v3d->transp = false; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, dflag_depth); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } v3d->xray = true; v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) { - draw_object(C, scene, sl, ar, v3d, v3da->base, dflag_depth); + draw_object(eval_ctx, scene, sl, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } @@ -1283,19 +1288,19 @@ void ED_view3d_draw_depth_loop(const bContext *C, Scene *scene, ARegion *ar, Vie } void ED_view3d_draw_select_loop( - const bContext *C, ViewContext *vc, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, - bool use_obedit_skip, bool use_nearest) + const struct EvaluationContext *eval_ctx, ViewContext *vc, Scene *scene, SceneLayer *sl, + View3D *v3d, ARegion *ar, bool use_obedit_skip, bool use_nearest) { short code = 1; const short dflag = DRAW_PICKING | DRAW_CONSTCOLOR; if (vc->obedit && vc->obedit->type == OB_MBALL) { - draw_object(C, scene, sl, ar, v3d, BASACT_NEW(sl), dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, BASACT_NEW(sl), dflag); } else if ((vc->obedit && vc->obedit->type == OB_ARMATURE)) { /* if not drawing sketch, draw bones */ if (!BDR_drawSketchNames(vc)) { - draw_object(C, scene, sl, ar, v3d, BASACT_NEW(sl), dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, BASACT_NEW(sl), dflag); } } else { @@ -1316,7 +1321,7 @@ void ED_view3d_draw_select_loop( } else { if (GPU_select_load_id(code)) { - draw_object(C, scene, sl, ar, v3d, base, dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag); } } code++; @@ -1327,7 +1332,7 @@ void ED_view3d_draw_select_loop( if (use_nearest) { bool xrayclear = true; if (v3d->afterdraw_xray.first) { - view3d_draw_xray_select(C, scene, sl, ar, v3d, &xrayclear); + view3d_draw_xray_select(eval_ctx, scene, sl, ar, v3d, &xrayclear); } } } @@ -1367,7 +1372,7 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, } } -static void gpu_update_lamps_shadows_world(EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) +static void gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) { ListBase shadows; Scene *sce_iter; @@ -1500,6 +1505,7 @@ CustomDataMask ED_view3d_screen_datamask(const Scene *scene, const bScreen *scre */ static void view3d_draw_objects( const bContext *C, + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen, GPUFX *fx) @@ -1563,10 +1569,10 @@ static void view3d_draw_objects( for (SETLOOPER(scene->set, sce_iter, base)) { if ((base->flag & BASE_VISIBLED) != 0) { UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f); - draw_object(C, scene, sl, ar, v3d, base, dflag); + draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag); if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(C, scene, sl, ar, v3d, base, dflag, TH_UNDEFINED); + draw_dupli_objects_color(eval_ctx, scene, sl, ar, v3d, base, dflag, TH_UNDEFINED); } } } @@ -1578,10 +1584,11 @@ static void view3d_draw_objects( for (base = sl->object_bases.first; base; base = base->next) { if ((base->flag & BASE_VISIBLED) != 0) { /* dupli drawing */ - if (base->object->transflag & OB_DUPLI) - draw_dupli_objects(C, scene, sl, ar, v3d, base); + if (base->object->transflag & OB_DUPLI) { + draw_dupli_objects(eval_ctx, scene, sl, ar, v3d, base); + } - draw_object(C, scene, sl, ar, v3d, base, 0); + draw_object(eval_ctx, scene, sl, ar, v3d, base, 0); } } } @@ -1596,11 +1603,11 @@ static void view3d_draw_objects( /* dupli drawing */ if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects(C, scene, sl, ar, v3d, base); + draw_dupli_objects(eval_ctx, scene, sl, ar, v3d, base); } if ((base->flag & BASE_SELECTED) == 0) { if (base->object != scene->obedit) - draw_object(C, scene, sl, ar, v3d, base, 0); + draw_object(eval_ctx, scene, sl, ar, v3d, base, 0); } } } @@ -1612,7 +1619,7 @@ static void view3d_draw_objects( for (base = sl->object_bases.first; base; base = base->next) { if ((base->flag & BASE_VISIBLED) != 0) { if (base->object == scene->obedit || (base->flag & BASE_SELECTED)) { - draw_object(C, scene, sl, ar, v3d, base, 0); + draw_object(eval_ctx, scene, sl, ar, v3d, base, 0); } } } @@ -1634,7 +1641,7 @@ static void view3d_draw_objects( } /* transp and X-ray afterdraw stuff */ - if (v3d->afterdraw_transp.first) view3d_draw_transp(C, scene, sl, ar, v3d); + if (v3d->afterdraw_transp.first) view3d_draw_transp(eval_ctx, scene, sl, ar, v3d); /* always do that here to cleanup depth buffers if none needed */ if (fx) { @@ -1642,8 +1649,8 @@ static void view3d_draw_objects( GPU_fx_compositor_setup_XRay_pass(fx, do_composite_xray); } - if (v3d->afterdraw_xray.first) view3d_draw_xray(C, scene, sl, ar, v3d, &xrayclear); - if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(C, scene, sl, ar, v3d, xrayclear); + if (v3d->afterdraw_xray.first) view3d_draw_xray(eval_ctx, scene, sl, ar, v3d, &xrayclear); + if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(eval_ctx, scene, sl, ar, v3d, xrayclear); if (fx && do_composite_xray) { GPU_fx_compositor_XRay_resolve(fx); @@ -1823,14 +1830,16 @@ bool ED_view3d_calc_render_border(const Scene *scene, View3D *v3d, ARegion *ar, * IMPORTANT: this is deprecated, any changes made in this function should * be mirrored in view3d_draw_render_draw() in view3d_draw.c */ -static bool view3d_main_region_draw_engine(const bContext *C, Scene *scene, - ARegion *ar, View3D *v3d, - bool clip_border, const rcti *border_rect) +static bool view3d_main_region_draw_engine( + const bContext *C, const EvaluationContext *eval_ctx, Scene *scene, + ARegion *ar, View3D *v3d, + bool clip_border, const rcti *border_rect) { RegionView3D *rv3d = ar->regiondata; RenderEngineType *type; GLint scissor[4]; + /* create render engine */ if (!rv3d->render_engine) { RenderEngine *engine; @@ -1851,7 +1860,7 @@ static bool view3d_main_region_draw_engine(const bContext *C, Scene *scene, } /* setup view matrices */ - VP_legacy_view3d_main_region_setup_view(C, scene, v3d, ar, NULL, NULL); + VP_legacy_view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, NULL, NULL); /* background draw */ ED_region_pixelspace(ar); @@ -1955,10 +1964,12 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Sce } /* setup the view matrix */ - if (VP_legacy_view3d_stereo3d_active(C, scene, v3d, rv3d)) - VP_legacy_view3d_stereo3d_setup(C, scene, v3d, ar); - else - VP_legacy_view3d_main_region_setup_view(C, scene, v3d, ar, NULL, NULL); + if (VP_legacy_view3d_stereo3d_active(win, scene, v3d, rv3d)) { + VP_legacy_view3d_stereo3d_setup(&eval_ctx, scene, v3d, ar); + } + else { + VP_legacy_view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, NULL, NULL); + } rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; #ifdef WITH_GAMEENGINE @@ -1992,7 +2003,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Sce } /* main drawing call */ - view3d_draw_objects(C, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL); + view3d_draw_objects(C, &eval_ctx, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL); /* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */ /* TODO depth culling manipulators is not yet supported, just drawing _3D here, should @@ -2089,6 +2100,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) { + EvaluationContext eval_ctx; Scene *scene = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); View3D *v3d = CTX_wm_view3d(C); @@ -2105,6 +2117,8 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) gpuPushMatrix(); gpuLoadIdentity(); + CTX_data_eval_ctx(C, &eval_ctx); + /* draw viewport using opengl */ if (v3d->drawtype != OB_RENDER || !view3d_main_region_do_render_draw(scene) || clip_border) { VP_view3d_main_region_clear(scene, v3d, ar); /* background */ @@ -2118,10 +2132,11 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) } /* draw viewport using external renderer */ - if (v3d->drawtype == OB_RENDER) - view3d_main_region_draw_engine(C, scene, ar, v3d, clip_border, &border_rect); + if (v3d->drawtype == OB_RENDER) { + view3d_main_region_draw_engine(C, &eval_ctx, scene, ar, v3d, clip_border, &border_rect); + } - VP_legacy_view3d_main_region_setup_view(C, scene, v3d, ar, NULL, NULL); + VP_legacy_view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); ED_region_pixelspace(ar); @@ -2153,14 +2168,15 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) void VP_deprecated_view3d_draw_objects( const bContext *C, + const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen, GPUFX *fx) { - view3d_draw_objects(C, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen, fx); + view3d_draw_objects(C, eval_ctx, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen, fx); } -void VP_deprecated_gpu_update_lamps_shadows_world(EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) +void VP_deprecated_gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) { gpu_update_lamps_shadows_world(eval_ctx, scene, v3d); } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index eef0710b59c..fd29658061e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -737,15 +737,18 @@ static void viewops_data_create_ex( /* we need the depth info before changing any viewport options */ if (orbit_mode & VIEWOPS_ORBIT_DEPTH) { + EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); float fallback_depth_pt[3]; + CTX_data_eval_ctx(C, &eval_ctx); + view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ negate_v3_v3(fallback_depth_pt, rv3d->ofs); vod->use_dyn_ofs = ED_view3d_autodist( - C, graph, vod->ar, vod->v3d, + &eval_ctx, graph, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt); } else { @@ -3320,15 +3323,18 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev ARegion *ar = CTX_wm_region(C); if (rv3d) { + EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); float new_ofs[3]; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); + CTX_data_eval_ctx(C, &eval_ctx); + ED_view3d_smooth_view_force_finish(C, v3d, ar); view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(C, graph, ar, v3d, event->mval, new_ofs, false, NULL)) { + if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, event->mval, new_ofs, false, NULL)) { /* pass */ } else { @@ -3583,6 +3589,7 @@ void VIEW3D_OT_clear_render_border(wmOperatorType *ot) static int view3d_zoom_border_exec(bContext *C, wmOperator *op) { + EvaluationContext eval_ctx; ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); @@ -3605,6 +3612,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* note; otherwise opengl won't work */ view3d_operator_needs_opengl(C); + CTX_data_eval_ctx(C, &eval_ctx); + /* get border select values using rna */ WM_operator_properties_border_to_rcti(op, &rect); @@ -3614,7 +3623,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ED_view3d_dist_range_get(v3d, dist_range); /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(C, CTX_data_depsgraph(C), ar, v3d, true); + ED_view3d_draw_depth(&eval_ctx, CTX_data_depsgraph(C), ar, v3d, true); { /* avoid allocating the whole depth buffer */ @@ -4714,9 +4723,13 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) } if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */ + EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); + + CTX_data_eval_ctx(C, &eval_ctx); + view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(C, graph, ar, v3d, mval, fp, true, NULL)) { + if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval, fp, true, NULL)) { depth_used = true; } } @@ -4900,7 +4913,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg * \param fallback_depth_pt: Use this points depth when no depth can be found. */ bool ED_view3d_autodist( - const bContext *C, struct Depsgraph *graph, ARegion *ar, View3D *v3d, + const EvaluationContext *eval_ctx, struct Depsgraph *graph, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]) { @@ -4910,7 +4923,7 @@ bool ED_view3d_autodist( bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(C, graph, ar, v3d, alphaoverride); + ED_view3d_draw_depth(eval_ctx, graph, ar, v3d, alphaoverride); /* Attempt with low margin's first */ i = 0; @@ -4939,18 +4952,18 @@ bool ED_view3d_autodist( } void ED_view3d_autodist_init( - const bContext *C, struct Depsgraph *graph, + const EvaluationContext *eval_ctx, struct Depsgraph *graph, ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { case 0: - ED_view3d_draw_depth(C, graph, ar, v3d, true); + ED_view3d_draw_depth(eval_ctx, graph, ar, v3d, true); break; case 1: { Scene *scene = DEG_get_evaluated_scene(graph); - ED_view3d_draw_depth_gpencil(C, scene, ar, v3d); + ED_view3d_draw_depth_gpencil(eval_ctx, scene, ar, v3d); break; } } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 1f27e3b1519..cdba5ce8b81 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -144,14 +144,18 @@ void draw_motion_paths_cleanup(View3D *v3d); /* drawobject.c */ -void draw_object(const struct bContext *C, Scene *scene, struct SceneLayer *sl, struct ARegion *ar, View3D *v3d, BaseLegacy *base, const short dflag); -void draw_object_select(const struct bContext *C, Scene *scene, struct SceneLayer *sl, struct ARegion *ar, View3D *v3d, Base *base, const short dflag); +void draw_object( + const struct EvaluationContext *eval_ctx, Scene *scene, struct SceneLayer *sl, struct ARegion *ar, View3D *v3d, + BaseLegacy *base, const short dflag); +void draw_object_select( + const struct EvaluationContext *eval_ctx, Scene *scene, struct SceneLayer *sl, struct ARegion *ar, View3D *v3d, + Base *base, const short dflag); void draw_mesh_object_outline(View3D *v3d, Object *ob, struct DerivedMesh *dm, const unsigned char ob_wire_col[4]); bool draw_glsl_material(Scene *scene, struct SceneLayer *sl, struct Object *ob, View3D *v3d, const char dt); -void draw_object_instance(const struct bContext *C, Scene *scene, struct SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline, const float wire_col[4]); -void draw_object_backbufsel(const struct bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); +void draw_object_instance(const struct EvaluationContext *eval_ctx, Scene *scene, struct SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline, const float wire_col[4]); +void draw_object_backbufsel(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); void draw_object_wire_color(Scene *scene, struct SceneLayer *, Base *base, unsigned char r_ob_wire_col[4]); void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const unsigned char color[4]); @@ -183,9 +187,10 @@ enum { int view3d_effective_drawtype(const struct View3D *v3d); /* drawarmature.c */ -bool draw_armature(const struct bContext *C, Scene *scene, struct SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4], - const bool is_outline); +bool draw_armature( + const struct EvaluationContext *eval_ctx, Scene *scene, struct SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4], + const bool is_outline); /* drawmesh.c */ void draw_mesh_textured(Scene *scene, struct SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, @@ -212,18 +217,19 @@ void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar); void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar, const int offset); void ED_view3d_draw_depth( - const struct bContext *C, struct Depsgraph *graph, + const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, struct ARegion *ar, View3D *v3d, bool alphaoverride); /* view3d_draw_legacy.c */ void view3d_main_region_draw_legacy(const struct bContext *C, struct ARegion *ar); -void ED_view3d_draw_depth_gpencil(const struct bContext *C, Scene *scene, ARegion *ar, View3D *v3d); +void ED_view3d_draw_depth_gpencil(const struct EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d); void ED_view3d_draw_select_loop( - const struct bContext *C, ViewContext *vc, Scene *scene, struct SceneLayer *sl, View3D *v3d, ARegion *ar, + const struct EvaluationContext *eval_ctx, ViewContext *vc, Scene *scene, struct SceneLayer *sl, View3D *v3d, ARegion *ar, bool use_obedit_skip, bool use_nearest); -void ED_view3d_draw_depth_loop(const struct bContext *C, Scene *scene, ARegion *ar, View3D *v3d); +void ED_view3d_draw_depth_loop( + const struct EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d); void ED_view3d_after_add(ListBase *lb, BaseLegacy *base, const short dflag); @@ -269,7 +275,7 @@ void ED_view3d_smooth_view_force_finish( struct View3D *v3d, struct ARegion *ar); void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rcti *rect); -void view3d_viewmatrix_set(struct EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d); +void view3d_viewmatrix_set(const struct EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d); void fly_modal_keymap(struct wmKeyConfig *keyconf); void walk_modal_keymap(struct wmKeyConfig *keyconf); @@ -353,10 +359,10 @@ void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect); void VP_legacy_draw_selected_name(Scene *scene, Object *ob, rcti *rect); void VP_legacy_drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit); void VP_legacy_drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool write_depth); -void VP_legacy_view3d_main_region_setup_view(const struct bContext *C, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]); -bool VP_legacy_view3d_stereo3d_active(const struct bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d); -void VP_legacy_view3d_stereo3d_setup(const struct bContext *C, Scene *scene, View3D *v3d, ARegion *ar); -void draw_dupli_objects(const struct bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base); +void VP_legacy_view3d_main_region_setup_view(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]); +bool VP_legacy_view3d_stereo3d_active(struct wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d); +void VP_legacy_view3d_stereo3d_setup(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar); +void draw_dupli_objects(const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base); bool VP_legacy_use_depth(Scene *scene, View3D *v3d); void VP_drawviewborder(Scene *scene, ARegion *ar, View3D *v3d); void VP_drawrenderborder(ARegion *ar, View3D *v3d); @@ -365,9 +371,10 @@ void VP_view3d_draw_background_world(Scene *scene, View3D *v3d, RegionView3D *rv void VP_view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar); /* temporary legacy calls, only when there is a switch between new/old draw calls */ -void VP_deprecated_gpu_update_lamps_shadows_world(struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d); +void VP_deprecated_gpu_update_lamps_shadows_world(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d); void VP_deprecated_view3d_draw_objects( const struct bContext *C, + const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen, struct GPUFX *fx); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 48dd3d64e86..4f80270e1e7 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -107,17 +107,14 @@ static void meshobject_foreachScreenVert__mapFunc(void *userData, int index, con } void meshobject_foreachScreenVert( - const bContext *C, ViewContext *vc, + const EvaluationContext *eval_ctx, ViewContext *vc, void (*func)(void *userData, MVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenObjectVert_userData data; - EvaluationContext eval_ctx; DerivedMesh *dm; - CTX_data_eval_ctx(C, &eval_ctx); - - dm = mesh_get_derived_deform(&eval_ctx, vc->scene, vc->obact, CD_MASK_BAREMESH); + dm = mesh_get_derived_deform(eval_ctx, vc->scene, vc->obact, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -153,17 +150,14 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenVert( - const bContext *C, ViewContext *vc, + const EvaluationContext *eval_ctx, ViewContext *vc, void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenVert_userData data; - EvaluationContext eval_ctx; DerivedMesh *dm; - CTX_data_eval_ctx(C, &eval_ctx); - - dm = editbmesh_get_derived_cage(&eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -212,17 +206,14 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenEdge( - const bContext *C, ViewContext *vc, + const EvaluationContext *eval_ctx, ViewContext *vc, void (*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenEdge_userData data; - EvaluationContext eval_ctx; DerivedMesh *dm; - CTX_data_eval_ctx(C, &eval_ctx); - - dm = editbmesh_get_derived_cage(&eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -263,17 +254,14 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenFace( - const bContext *C, ViewContext *vc, + const EvaluationContext *eval_ctx, ViewContext *vc, void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index), void *userData, const eV3DProjTest clip_flag) { foreachScreenFace_userData data; - EvaluationContext eval_ctx; DerivedMesh *dm; - CTX_data_eval_ctx(C, &eval_ctx); - - dm = editbmesh_get_derived_cage(&eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 526d0b979e2..c02925078a6 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -456,7 +456,9 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons } } -static void do_lasso_select_mesh(const bContext *C, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) +static void do_lasso_select_mesh( + const struct EvaluationContext *eval_ctx, ViewContext *vc, + const int mcords[][2], short moves, bool extend, bool select) { LassoSelectUserData data; ToolSettings *ts = vc->scene->toolsettings; @@ -477,24 +479,24 @@ static void do_lasso_select_mesh(const bContext *C, ViewContext *vc, const int m ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); gpuLoadMatrix(vc->rv3d->viewmat); - bbsel = EDBM_backbuf_border_mask_init(C, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + bbsel = EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(C, vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(eval_ctx, vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; - mesh_foreachScreenEdge(C, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(eval_ctx, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); if (data.is_done == false) { data.pass = 1; - mesh_foreachScreenEdge(C, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(eval_ctx, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -503,7 +505,7 @@ static void do_lasso_select_mesh(const bContext *C, ViewContext *vc, const int m edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(C, vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(eval_ctx, vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -702,7 +704,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv, BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); } } -static void do_lasso_select_paintvert(const bContext *C, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) +static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Object *ob = vc->obact; @@ -720,7 +722,7 @@ static void do_lasso_select_paintvert(const bContext *C, ViewContext *vc, const if (use_zbuf) { bm_vertoffs = me->totvert + 1; /* max index array */ - EDBM_backbuf_border_mask_init(C, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); edbm_backbuf_check_and_select_verts_obmode(me, select); @@ -733,7 +735,7 @@ static void do_lasso_select_paintvert(const bContext *C, ViewContext *vc, const ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); - meshobject_foreachScreenVert(C, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } @@ -742,7 +744,7 @@ static void do_lasso_select_paintvert(const bContext *C, ViewContext *vc, const } paintvert_flush_flags(ob); } -static void do_lasso_select_paintface(const bContext *C, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) +static void do_lasso_select_paintface(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) { Object *ob = vc->obact; Mesh *me = ob->data; @@ -757,7 +759,7 @@ static void do_lasso_select_paintface(const bContext *C, ViewContext *vc, const bm_vertoffs = me->totpoly + 1; /* max index array */ BLI_lasso_boundbox(&rect, mcords, moves); - EDBM_backbuf_border_mask_init(C, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); edbm_backbuf_check_and_select_tfaces(me, select); @@ -803,16 +805,22 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, { Object *ob = CTX_data_active_object(C); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + if (vc->obedit == NULL) { /* Object Mode */ - if (BKE_paint_select_face_test(ob)) - do_lasso_select_paintface(C, vc, mcords, moves, extend, select); - else if (BKE_paint_select_vert_test(ob)) - do_lasso_select_paintvert(C, vc, mcords, moves, extend, select); + if (BKE_paint_select_face_test(ob)) { + do_lasso_select_paintface(&eval_ctx, vc, mcords, moves, extend, select); + } + else if (BKE_paint_select_vert_test(ob)) { + do_lasso_select_paintvert(&eval_ctx, vc, mcords, moves, extend, select); + } else if (ob && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) { /* pass */ } - else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) + else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) { PE_lasso_select(C, mcords, moves, extend, select); + } else { do_lasso_select_objects(vc, mcords, moves, extend, select); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene); @@ -821,7 +829,7 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, else { /* Edit Mode */ switch (vc->obedit->type) { case OB_MESH: - do_lasso_select_mesh(C, vc, mcords, moves, extend, select); + do_lasso_select_mesh(&eval_ctx, vc, mcords, moves, extend, select); break; case OB_CURVE: case OB_SURF: @@ -1176,7 +1184,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const /* we want a select buffer with bones, if there are... */ /* so check three selection levels and compare */ static int mixed_bones_object_selectbuffer( - const bContext *C, ViewContext *vc, unsigned int *buffer, const int mval[2], + const EvaluationContext *eval_ctx, ViewContext *vc, unsigned int *buffer, const int mval[2], bool use_cycle, bool enumerate, bool *r_do_nearest) { @@ -1216,7 +1224,7 @@ static int mixed_bones_object_selectbuffer( view3d_opengl_select_cache_begin(); BLI_rcti_init_pt_radius(&rect, mval, 14); - hits15 = view3d_opengl_select(C, vc, buffer, MAXPICKBUF, &rect, select_mode); + hits15 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode); if (hits15 == 1) { hits = selectbuffer_ret_hits_15(buffer, hits15); goto finally; @@ -1227,7 +1235,7 @@ static int mixed_bones_object_selectbuffer( offs = 4 * hits15; BLI_rcti_init_pt_radius(&rect, mval, 9); - hits9 = view3d_opengl_select(C, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits9 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits9 == 1) { hits = selectbuffer_ret_hits_9(buffer, hits15, hits9); goto finally; @@ -1237,7 +1245,7 @@ static int mixed_bones_object_selectbuffer( offs += 4 * hits9; BLI_rcti_init_pt_radius(&rect, mval, 5); - hits5 = view3d_opengl_select(C, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits5 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits5 == 1) { hits = selectbuffer_ret_hits_5(buffer, hits15, hits9, hits5); goto finally; @@ -1349,6 +1357,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int /* mval comes from event->mval, only use within region handlers */ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) { + EvaluationContext eval_ctx; ViewContext vc; Base *basact = NULL; unsigned int buffer[MAXPICKBUF]; @@ -1357,9 +1366,11 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) /* setup view context for argument to callbacks */ view3d_operator_needs_opengl(C); + + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); - hits = mixed_bones_object_selectbuffer(C, &vc, buffer, mval, false, false, &do_nearest); + hits = mixed_bones_object_selectbuffer(&eval_ctx, &vc, buffer, mval, false, false, &do_nearest); if (hits > 0) { const bool has_bones = selectbuffer_has_bones(buffer, hits); @@ -1393,6 +1404,7 @@ static bool ed_object_select_pick( bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool obcenter, bool enumerate, bool object) { + EvaluationContext eval_ctx; ViewContext vc; ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); @@ -1406,6 +1418,7 @@ static bool ed_object_select_pick( /* setup view context for argument to callbacks */ + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); is_obedit = (vc.obedit != NULL); @@ -1456,7 +1469,7 @@ static bool ed_object_select_pick( // TIMEIT_START(select_time); /* if objects have posemode set, the bones are in the same selection buffer */ - hits = mixed_bones_object_selectbuffer(C, &vc, buffer, mval, true, enumerate, &do_nearest); + hits = mixed_bones_object_selectbuffer(&eval_ctx, &vc, buffer, mval, true, enumerate, &do_nearest); // TIMEIT_END(select_time); @@ -1649,7 +1662,8 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); } } -static int do_paintvert_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) +static int do_paintvert_box_select( + const EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Mesh *me; @@ -1673,7 +1687,7 @@ static int do_paintvert_box_select(const bContext *C, ViewContext *vc, rcti *rec if (use_zbuf) { selar = MEM_callocN(me->totvert + 1, "selar"); - ED_view3d_backbuf_validate(C, vc); + ED_view3d_backbuf_validate(eval_ctx, vc); ibuf = IMB_allocImBuf(size[0], size[1], 32, IB_rect); rt = ibuf->rect; @@ -1721,7 +1735,7 @@ static int do_paintvert_box_select(const bContext *C, ViewContext *vc, rcti *rec ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); - meshobject_foreachScreenVert(C, vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(eval_ctx, vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } if (select == false) { @@ -1836,7 +1850,8 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const BM_face_select_set(data->vc->em->bm, efa, data->select); } } -static int do_mesh_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) +static int do_mesh_box_select( + const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend) { BoxSelectUserData data; ToolSettings *ts = vc->scene->toolsettings; @@ -1851,25 +1866,25 @@ static int do_mesh_box_select(const bContext *C, ViewContext *vc, rcti *rect, bo ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); gpuLoadMatrix(vc->rv3d->viewmat); - bbsel = EDBM_backbuf_border_init(C, vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); + bbsel = EDBM_backbuf_border_init(eval_ctx, vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(C, vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(eval_ctx, vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; - mesh_foreachScreenEdge(C, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(eval_ctx, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); if (data.is_done == 0) { data.pass = 1; - mesh_foreachScreenEdge(C, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(eval_ctx, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -1878,7 +1893,7 @@ static int do_mesh_box_select(const bContext *C, ViewContext *vc, rcti *rect, bo edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(C, vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(eval_ctx, vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -1889,7 +1904,9 @@ static int do_mesh_box_select(const bContext *C, ViewContext *vc, rcti *rect, bo return OPERATOR_FINISHED; } -static int do_meta_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) +static int do_meta_box_select( + const struct EvaluationContext *eval_ctx, ViewContext *vc, + const rcti *rect, bool select, bool extend) { MetaBall *mb = (MetaBall *)vc->obedit->data; MetaElem *ml; @@ -1898,7 +1915,7 @@ static int do_meta_box_select(const bContext *C, ViewContext *vc, rcti *rect, bo unsigned int buffer[MAXPICKBUF]; int hits; - hits = view3d_opengl_select(C, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); if (extend == false && select) BKE_mball_deselect_all(mb); @@ -1923,7 +1940,9 @@ static int do_meta_box_select(const bContext *C, ViewContext *vc, rcti *rect, bo return OPERATOR_FINISHED; } -static int do_armature_box_select(const bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) +static int do_armature_box_select( + const struct EvaluationContext *eval_ctx, ViewContext *vc, + const rcti *rect, bool select, bool extend) { bArmature *arm = vc->obedit->data; EditBone *ebone; @@ -1932,7 +1951,7 @@ static int do_armature_box_select(const bContext *C, ViewContext *vc, rcti *rect unsigned int buffer[MAXPICKBUF]; int hits; - hits = view3d_opengl_select(C, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); /* clear flag we use to detect point was affected */ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) @@ -2019,6 +2038,7 @@ static int opengl_select_buffer_cmp(const void *sel_a_p, const void *sel_b_p) static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) { + EvaluationContext eval_ctx; Bone *bone; Object *ob = vc->obact; unsigned int *vbuffer = NULL; /* selection buffer */ @@ -2028,6 +2048,8 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b int totobj = MAXPICKBUF; /* XXX solve later */ int hits; + CTX_data_eval_ctx(C, &eval_ctx); + if ((ob) && (ob->mode & OB_MODE_POSE)) bone_only = 1; else @@ -2050,7 +2072,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b /* selection buffer now has bones potentially too, so we add MAXPICKBUF */ vbuffer = MEM_mallocN(4 * (totobj + MAXPICKELEMS) * sizeof(unsigned int), "selection buffer"); - hits = view3d_opengl_select(C, vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(&eval_ctx, vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, VIEW3D_SELECT_ALL); /* * LOGIC NOTES (theeth): * The buffer and ListBase have the same relative order, which makes the selection @@ -2124,6 +2146,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b static int view3d_borderselect_exec(bContext *C, wmOperator *op) { + EvaluationContext eval_ctx; ViewContext vc; rcti rect; bool extend; @@ -2134,6 +2157,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) view3d_operator_needs_opengl(C); /* setup view context for argument to callbacks */ + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); @@ -2144,7 +2168,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) switch (vc.obedit->type) { case OB_MESH: vc.em = BKE_editmesh_from_object(vc.obedit); - ret = do_mesh_box_select(C, &vc, &rect, select, extend); + ret = do_mesh_box_select(&eval_ctx, &vc, &rect, select, extend); // if (EM_texFaceCheck()) if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); @@ -2158,13 +2182,13 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) } break; case OB_MBALL: - ret = do_meta_box_select(C, &vc, &rect, select, extend); + ret = do_meta_box_select(&eval_ctx, &vc, &rect, select, extend); if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); } break; case OB_ARMATURE: - ret = do_armature_box_select(C, &vc, &rect, select, extend); + ret = do_armature_box_select(&eval_ctx, &vc, &rect, select, extend); if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, vc.obedit); } @@ -2185,10 +2209,10 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) ret = ED_sculpt_mask_box_select(C, &vc, &rect, select, extend); } else if (vc.obact && BKE_paint_select_face_test(vc.obact)) { - ret = do_paintface_box_select(C, &vc, &rect, select, extend); + ret = do_paintface_box_select(&eval_ctx, &vc, &rect, select, extend); } else if (vc.obact && BKE_paint_select_vert_test(vc.obact)) { - ret = do_paintvert_box_select(C, &vc, &rect, select, extend); + ret = do_paintvert_box_select(&eval_ctx, &vc, &rect, select, extend); } else if (vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) { ret = PE_border_select(C, &rect, select, extend); @@ -2432,13 +2456,13 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc } } -static void mesh_circle_select(const bContext *C, ViewContext *vc, const bool select, const int mval[2], float rad) +static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) { ToolSettings *ts = vc->scene->toolsettings; int bbsel; CircleSelectUserData data; - bbsel = EDBM_backbuf_circle_init(C, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ vc->em = BKE_editmesh_from_object(vc->obedit); @@ -2450,7 +2474,7 @@ static void mesh_circle_select(const bContext *C, ViewContext *vc, const bool se edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(C, vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(eval_ctx, vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -2459,7 +2483,7 @@ static void mesh_circle_select(const bContext *C, ViewContext *vc, const bool se edbm_backbuf_check_and_select_edges(vc->em, select); } else { - mesh_foreachScreenEdge(C, vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(eval_ctx, vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -2468,7 +2492,7 @@ static void mesh_circle_select(const bContext *C, ViewContext *vc, const bool se edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(C, vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(eval_ctx, vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -2476,7 +2500,7 @@ static void mesh_circle_select(const bContext *C, ViewContext *vc, const bool se EDBM_selectmode_flush(vc->em); } -static void paint_facesel_circle_select(const bContext *C, ViewContext *vc, const bool select, const int mval[2], float rad) +static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) { Object *ob = vc->obact; Mesh *me = ob->data; @@ -2484,7 +2508,7 @@ static void paint_facesel_circle_select(const bContext *C, ViewContext *vc, cons bm_vertoffs = me->totpoly + 1; /* max index array */ - bbsel = EDBM_backbuf_circle_init(C, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); if (bbsel) { edbm_backbuf_check_and_select_tfaces(me, select); EDBM_backbuf_free(); @@ -2500,7 +2524,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); } } -static void paint_vertsel_circle_select(const bContext *C, ViewContext *vc, const bool select, const int mval[2], float rad) +static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Object *ob = vc->obact; @@ -2511,7 +2535,7 @@ static void paint_vertsel_circle_select(const bContext *C, ViewContext *vc, cons if (use_zbuf) { bm_vertoffs = me->totvert + 1; /* max index array */ - bbsel = EDBM_backbuf_circle_init(C, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); if (bbsel) { edbm_backbuf_check_and_select_verts_obmode(me, select); EDBM_backbuf_free(); @@ -2523,7 +2547,7 @@ static void paint_vertsel_circle_select(const bContext *C, ViewContext *vc, cons ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */ view3d_userdata_circleselect_init(&data, vc, select, mval, rad); - meshobject_foreachScreenVert(C, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } if (select != LEFTMOUSE) { @@ -2777,11 +2801,12 @@ static void mball_circle_select(ViewContext *vc, const bool select, const int mv /** Callbacks for circle selection in Editmode */ -static void obedit_circle_select(const bContext *C, ViewContext *vc, const bool select, const int mval[2], float rad) +static void obedit_circle_select( + const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) { switch (vc->obedit->type) { case OB_MESH: - mesh_circle_select(C, vc, select, mval, rad); + mesh_circle_select(eval_ctx, vc, select, mval, rad); break; case OB_CURVE: case OB_SURF: @@ -2842,22 +2867,24 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(obact) || (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) ) { + EvaluationContext eval_ctx; ViewContext vc; view3d_operator_needs_opengl(C); + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); if (CTX_data_edit_object(C)) { - obedit_circle_select(C, &vc, select, mval, (float)radius); + obedit_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (BKE_paint_select_face_test(obact)) { - paint_facesel_circle_select(C, &vc, select, mval, (float)radius); + paint_facesel_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (BKE_paint_select_vert_test(obact)) { - paint_vertsel_circle_select(C, &vc, select, mval, (float)radius); + paint_vertsel_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (obact->mode & OB_MODE_POSE) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 3ffd21294df..4be03e31b0d 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1106,7 +1106,7 @@ bool ED_view3d_lock(RegionView3D *rv3d) } /* don't set windows active in here, is used by renderwin too */ -void view3d_viewmatrix_set(EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d) +void view3d_viewmatrix_set(const EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d) { if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */ if (v3d->camera) { @@ -1195,7 +1195,7 @@ void view3d_opengl_select_cache_end(void) * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. */ int view3d_opengl_select( - const bContext *C, ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, + const EvaluationContext *eval_ctx, ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, eV3DSelectMode select_mode) { Depsgraph *graph = vc->depsgraph; @@ -1256,7 +1256,7 @@ int view3d_opengl_select( /* Important we use the 'viewmat' and don't re-calculate since * the object & bone view locking takes 'rect' into account, see: T51629. */ - ED_view3d_draw_setup_view(vc->win, C, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect); + ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect); if (v3d->drawtype > OB_WIRE) { v3d->zbuf = true; @@ -1300,7 +1300,7 @@ int view3d_opengl_select( } G.f &= ~G_PICKSEL; - ED_view3d_draw_setup_view(vc->win, C, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); + ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); if (v3d->drawtype > OB_WIRE) { v3d->zbuf = 0; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index ca52625ef1e..7f33856358b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2051,7 +2051,9 @@ void flushTransParticles(TransInfo *t) point->flag |= PEP_EDIT_RECALC; } - PE_update_object(t->context, scene, sl, OBACT_NEW(sl), 1); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(t->context, &eval_ctx); + PE_update_object(&eval_ctx, scene, sl, OBACT_NEW(sl), 1); } /* ********************* mesh ****************** */ diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h index 8fd13507d3a..ad842029941 100644 --- a/source/blender/ikplugin/BIK_api.h +++ b/source/blender/ikplugin/BIK_api.h @@ -62,8 +62,8 @@ struct BIK_ParamValue { }; typedef struct BIK_ParamValue BIK_ParamValue; -void BIK_initialize_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void BIK_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); +void BIK_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); +void BIK_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); void BIK_release_tree(struct Scene *scene, struct Object *ob, float ctime); void BIK_clear_data(struct bPose *pose); void BIK_clear_cache(struct bPose *pose); diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c index 09a2c3b88ed..0ee26ff45f1 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.c +++ b/source/blender/ikplugin/intern/ikplugin_api.c @@ -89,7 +89,7 @@ static IKPlugin *get_plugin(bPose *pose) /*----------------------------------------*/ /* Plugin API */ -void BIK_initialize_tree(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +void BIK_initialize_tree(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) { IKPlugin *plugin = get_plugin(ob->pose); @@ -97,7 +97,7 @@ void BIK_initialize_tree(struct EvaluationContext *eval_ctx, Scene *scene, Objec plugin->initialize_tree_func(eval_ctx, scene, ob, ctime); } -void BIK_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan, float ctime) +void BIK_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan, float ctime) { IKPlugin *plugin = get_plugin(ob->pose); diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h index 07dd601012f..9a71463ede4 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.h +++ b/source/blender/ikplugin/intern/ikplugin_api.h @@ -45,8 +45,8 @@ struct EvaluationContext; struct IKPlugin { - void (*initialize_tree_func)(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); - void (*execute_tree_func)(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); + void (*initialize_tree_func)(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); + void (*execute_tree_func)(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); void (*release_tree_func)(struct Scene *scene, struct Object *ob, float ctime); void (*remove_armature_func)(struct bPose *pose); void (*clear_cache)(struct bPose *pose); diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 1917db24d4f..5169b72590c 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -252,7 +252,7 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[3][3]) // nr = /* called from within the core BKE_pose_where_is loop, all animsystems and constraints * were executed & assigned. Now as last we do an IK pass */ -static void execute_posetree(struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, PoseTree *tree) +static void execute_posetree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, PoseTree *tree) { float R_parmat[3][3], identity[3][3]; float iR_parmat[3][3]; @@ -534,7 +534,7 @@ static void free_posetree(PoseTree *tree) ///---------------------------------------- /// Plugin API for legacy iksolver -void iksolver_initialize_tree(struct EvaluationContext *UNUSED(eval_ctx), struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) +void iksolver_initialize_tree(const struct EvaluationContext *UNUSED(eval_ctx), struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; @@ -545,7 +545,7 @@ void iksolver_initialize_tree(struct EvaluationContext *UNUSED(eval_ctx), struct ob->pose->flag &= ~POSE_WAS_REBUILT; } -void iksolver_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +void iksolver_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { while (pchan_root->iktree.first) { PoseTree *tree = pchan_root->iktree.first; diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h index b9bdbd892ec..f1ca91ebb49 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.h +++ b/source/blender/ikplugin/intern/iksolver_plugin.h @@ -40,9 +40,11 @@ extern "C" { #endif -void iksolver_initialize_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void iksolver_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, - struct bPoseChannel *pchan_root, float ctime); +void iksolver_initialize_tree( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); +void iksolver_execute_tree( + const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct bPoseChannel *pchan_root, float ctime); #ifdef __cplusplus } diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 2227747e7a1..93460559067 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -542,7 +542,7 @@ static void GetJointRotation(KDL::Rotation& boneRot, int type, double *rot) } } -static bool target_callback(struct EvaluationContext *eval_ctx, const iTaSC::Timestamp& timestamp, const iTaSC::Frame& current, iTaSC::Frame& next, void *param) +static bool target_callback(const struct EvaluationContext *eval_ctx, const iTaSC::Timestamp& timestamp, const iTaSC::Frame& current, iTaSC::Frame& next, void *param) { IK_Target *target = (IK_Target *)param; // compute next target position @@ -577,7 +577,7 @@ static bool target_callback(struct EvaluationContext *eval_ctx, const iTaSC::Tim return true; } -static bool base_callback(struct EvaluationContext *eval_ctx, const iTaSC::Timestamp& timestamp, const iTaSC::Frame& current, iTaSC::Frame& next, void *param) +static bool base_callback(const struct EvaluationContext *eval_ctx, const iTaSC::Timestamp& timestamp, const iTaSC::Frame& current, iTaSC::Frame& next, void *param) { IK_Scene *ikscene = (IK_Scene *)param; // compute next armature base pose @@ -863,7 +863,7 @@ static bool joint_callback(const iTaSC::Timestamp& timestamp, iTaSC::ConstraintV } // build array of joint corresponding to IK chain -static int convert_channels(struct EvaluationContext *eval_ctx, IK_Scene *ikscene, PoseTree *tree, float ctime) +static int convert_channels(const struct EvaluationContext *eval_ctx, IK_Scene *ikscene, PoseTree *tree, float ctime) { IK_Channel *ikchan; bPoseChannel *pchan; @@ -1056,7 +1056,7 @@ static void BKE_pose_rest(IK_Scene *ikscene) } } -static IK_Scene *convert_tree(struct EvaluationContext *eval_ctx, Scene *blscene, Object *ob, bPoseChannel *pchan, float ctime) +static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *blscene, Object *ob, bPoseChannel *pchan, float ctime) { PoseTree *tree = (PoseTree *)pchan->iktree.first; PoseTarget *target; @@ -1526,7 +1526,7 @@ static IK_Scene *convert_tree(struct EvaluationContext *eval_ctx, Scene *blscene return ikscene; } -static void create_scene(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +static void create_scene(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) { bPoseChannel *pchan; @@ -1576,7 +1576,7 @@ static int init_scene(Object *ob) return 0; } -static void execute_scene(struct EvaluationContext *eval_ctx, Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, float ctime, float frtime) +static void execute_scene(const struct EvaluationContext *eval_ctx, Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, float ctime, float frtime) { int i; IK_Channel *ikchan; @@ -1744,7 +1744,7 @@ static void execute_scene(struct EvaluationContext *eval_ctx, Scene *blscene, IK //--------------------------------------------------- // plugin interface // -void itasc_initialize_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, float ctime) +void itasc_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, float ctime) { bPoseChannel *pchan; int count = 0; @@ -1770,7 +1770,7 @@ void itasc_initialize_tree(struct EvaluationContext *eval_ctx, struct Scene *sce ob->pose->flag &= ~POSE_WAS_REBUILT; } -void itasc_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +void itasc_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { if (ob->pose->ikdata) { IK_Data *ikdata = (IK_Data *)ob->pose->ikdata; diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h index fb948e98696..2f4e4036d76 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.h +++ b/source/blender/ikplugin/intern/itasc_plugin.h @@ -40,8 +40,8 @@ extern "C" { #endif -void itasc_initialize_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void itasc_execute_tree(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); +void itasc_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); +void itasc_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); void itasc_release_tree(struct Scene *scene, struct Object *ob, float ctime); void itasc_clear_data(struct bPose *pose); void itasc_clear_cache(struct bPose *pose); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 47fb01cd281..60c7998853e 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -110,7 +110,7 @@ static void updateDepsgraph(ModifierData *md, } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -131,7 +131,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; @@ -154,7 +154,7 @@ static void deformVertsEM( } static void deformMatricesEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { @@ -169,7 +169,7 @@ static void deformMatricesEM( if (!derivedData) dm->release(dm); } -static void deformMatrices(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformMatrices(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index fcd38f904d8..66ff1fe0a85 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -356,7 +356,7 @@ static void dm_merge_transform( } static DerivedMesh *arrayModifier_doArray( - ArrayModifierData *amd, EvaluationContext *eval_ctx, + ArrayModifierData *amd, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { @@ -725,7 +725,7 @@ static DerivedMesh *arrayModifier_doArray( } -static DerivedMesh *applyModifier(ModifierData *md, EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 42f451b74ac..35b8a3fd9cb 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -86,7 +86,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* * This calls the new bevel code (added since 2.64) */ -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), struct Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 22609ec46b7..26b4bf883a6 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -402,7 +402,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED( } static DerivedMesh *applyModifier( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 640412e1d27..0a0ad11fe16 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -75,7 +75,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index c2515c5f5de..93a5b9607bf 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -433,7 +433,7 @@ static void cuboid_do( } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -456,7 +456,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 10603e6dccf..b234cc63228 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -69,7 +69,7 @@ static void initData(ModifierData *md) cloth_init(clmd); } -static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], +static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 3159b4c5c38..b9a2310366a 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -98,7 +98,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 831b3034235..716b918d0f0 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -713,7 +713,7 @@ error: static void deformVerts( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -727,7 +727,7 @@ static void deformVerts( static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index c232a32fe00..198f08334f0 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -115,7 +115,7 @@ static void updateDepsgraph(ModifierData *md, DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Curve Modifier"); } -static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, +static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -130,7 +130,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index 89ae1d364cf..e7069937868 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -152,7 +152,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) DT_TYPE_SHARP_FACE \ ) -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { DataTransferModifierData *dtmd = (DataTransferModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 80e1b09ddb5..078a3085fc7 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -86,7 +86,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 28b388208b8..c9ccdc3b8c2 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -371,7 +371,7 @@ static void displaceModifier_do( } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -387,7 +387,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md)); diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 3c5afc6bb69..cf3f84364ea 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -114,7 +114,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index bee65cb0f4a..0e344a851f2 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -121,7 +121,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 3d013d273d0..38785abbc19 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -785,9 +785,10 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) return splitdm; } -static DerivedMesh *explodeMesh(ExplodeModifierData *emd, - ParticleSystemModifierData *psmd, struct EvaluationContext *eval_ctx, Scene *scene, - Object *ob, DerivedMesh *to_explode) +static DerivedMesh *explodeMesh( + ExplodeModifierData *emd, + ParticleSystemModifierData *psmd, const struct EvaluationContext *eval_ctx, Scene *scene, + Object *ob, DerivedMesh *to_explode) { DerivedMesh *explode, *dm = to_explode; MFace *mf = NULL, *mface; @@ -994,7 +995,7 @@ static ParticleSystemModifierData *findPrecedingParticlesystem(Object *ob, Modif } return psmd; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 4a6c2328d53..f9e7f10653b 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -82,7 +82,7 @@ static void copyData(ModifierData *md, ModifierData *target) -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 354b131c74b..25617c84dac 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -356,7 +356,7 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { @@ -372,7 +372,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ dm->release(dm); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { HookModifierData *hmd = (HookModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 7626ea4af81..a1c126313a2 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -724,7 +724,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -736,7 +736,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 66cc3deb727..d7bc7b6c427 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -506,7 +506,7 @@ static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm; @@ -524,7 +524,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index d150bf3c8e0..cd8b6139d75 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -103,7 +103,7 @@ static void updateDepsgraph(ModifierData *md, DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -119,7 +119,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b66007b8a87..d942b23b216 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -94,7 +94,7 @@ static void updateDepsgraph(ModifierData *md, } } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 4c377f7fe90..c990951c578 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -272,7 +272,7 @@ static void meshcache_do( } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -284,7 +284,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *UNUSED(editData), + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 35fc40b82d3..ab43204365d 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -272,7 +272,7 @@ static void meshdeform_vert_task(void *userdata, const int iter) } static void meshdeformModifier_do( - ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, + ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; @@ -402,7 +402,7 @@ static void meshdeformModifier_do( cagedm->release(cagedm); } -static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, +static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -418,7 +418,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, Ob dm->release(dm); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index e5431c0fba9..86c2a24eddf 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -94,7 +94,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0'); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index a9e07fe4448..5c40bad90c4 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -321,7 +321,7 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd, return result; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index b63b507586c..2b675d36140 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -67,7 +67,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { MultiresModifierData *mmd = (MultiresModifierData *)md; diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index ca6aa71eb37..1c7c640b971 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -521,7 +521,7 @@ static void updateDepsgraph(ModifierData *md, } } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { return normalEditModifier_do((NormalEditModifierData *)md, ob, dm); diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 878f17dd04a..189cfb8553e 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -542,7 +542,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), } #endif /* WITH_OCEANSIM */ -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index f25b6b225a5..de59635f335 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -166,7 +166,7 @@ static int particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *psy return 0; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 777487fabcf..9cc6e5f56b5 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } /* saves the current emitter state for a particle system and calculates particles */ -static void deformVerts(ModifierData *md, struct EvaluationContext *eval_ctx, +static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index f5fa6abe37b..c9070cced7e 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -143,7 +143,7 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4]) } static DerivedMesh *applyModifier(ModifierData *md, - struct EvaluationContext *UNUSED(eval_ctx), + const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) @@ -205,7 +205,7 @@ static DerivedMesh *applyModifier(ModifierData *md, #else /* !WITH_MOD_REMESH */ static DerivedMesh *applyModifier(ModifierData *UNUSED(md), - struct EvaluationContext *UNUSED(eval_ctx), + const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 04599fcb535..b951c4afc00 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -133,7 +133,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index b5039669b63..822decea423 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -44,7 +44,7 @@ #include "MOD_modifiertypes.h" -static void deformVerts(ModifierData *UNUSED(md), struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *UNUSED(md), const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, @@ -61,7 +61,7 @@ static void deformVerts(ModifierData *UNUSED(md), struct EvaluationContext *UNUS } } -static void deformMatrices(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, +static void deformMatrices(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { Key *key = BKE_key_from_object(ob); @@ -83,7 +83,7 @@ static void deformMatrices(ModifierData *md, struct EvaluationContext *eval_ctx, deformVerts(md, eval_ctx, ob, derivedData, vertexCos, numVerts, 0); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], @@ -95,7 +95,7 @@ static void deformVertsEM(ModifierData *md, struct EvaluationContext *eval_ctx, deformVerts(md, eval_ctx, ob, derivedData, vertexCos, numVerts, 0); } -static void deformMatricesEM(ModifierData *UNUSED(md), struct EvaluationContext *UNUSED(eval_ctx), +static void deformMatricesEM(ModifierData *UNUSED(md), const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index c197e2ff7b1..c87fdd321ab 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -103,7 +103,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, &smd->auxTarget, IDWALK_CB_NOP); } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -124,7 +124,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ dm->release(dm); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 658c8b54c62..146e882a6b6 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -302,7 +302,7 @@ static void updateDepsgraph(ModifierData *md, } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -322,7 +322,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ dm->release(dm); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 92c4cea9c17..9d1c6913c1c 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1917,7 +1917,7 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, - struct EvaluationContext *UNUSED(eval_ctx), + const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index c2a43f8b42e..e66afe07841 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -102,7 +102,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 148a0d01230..be55030e18a 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -215,7 +215,7 @@ static void smoothModifier_do( MEM_freeN(uctmp); } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -228,7 +228,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index f59d28fca84..020dd3da6a5 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -49,7 +49,7 @@ #include "MOD_modifiertypes.h" -static void deformVerts(ModifierData *md, EvaluationContext *eval_ctx, Object *ob, +static void deformVerts(ModifierData *md, const EvaluationContext *eval_ctx, Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 1389622bdcb..81f19539803 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -205,7 +205,7 @@ BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f) } static DerivedMesh *applyModifier( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 93a2e1e1c06..6a07f842cf3 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -98,7 +98,7 @@ static bool isDisabled(ModifierData *md, int useRenderParams) return get_render_subsurf_level(&md->scene->r, levels, useRenderParams != 0) == 0; } -static DerivedMesh *applyModifier(ModifierData *md, EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag flag) { @@ -162,10 +162,11 @@ static DerivedMesh *applyModifier(ModifierData *md, EvaluationContext *UNUSED(ev return result; } -static DerivedMesh *applyModifierEM(ModifierData *md, EvaluationContext *UNUSED(eval_ctx), - Object *UNUSED(ob), struct BMEditMesh *UNUSED(editData), - DerivedMesh *derivedData, - ModifierApplyFlag flag) +static DerivedMesh *applyModifierEM( + ModifierData *md, const EvaluationContext *UNUSED(eval_ctx), + Object *UNUSED(ob), struct BMEditMesh *UNUSED(editData), + DerivedMesh *derivedData, + ModifierApplyFlag flag) { SubsurfModifierData *smd = (SubsurfModifierData *) md; DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 00ac9452be2..c408b4fbd63 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -85,7 +85,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 9a108df0bdd..b623293ed5c 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1162,7 +1162,7 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un } } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) @@ -1170,7 +1170,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ surfacedeformModifier_do(md, vertexCos, numVerts, ob); } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts) diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index 9124032e3d8..5dd7e3dfda4 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -85,7 +85,7 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, - struct EvaluationContext *UNUSED(eval_ctx), + const struct EvaluationContext *UNUSED(eval_ctx), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 473b3ec045c..c9a842621b6 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -335,7 +335,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, return dm; } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index b24ea55696e..3773eed26dc 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -143,7 +143,7 @@ static void uv_warp_compute(void *userdata, const int i) } } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index b275d02f5a8..566ee5b2d24 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -313,7 +313,7 @@ static int warp_needs_dm(WarpModifierData *wmd) return wmd->texture || wmd->defgrp_name[0]; } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = NULL; @@ -330,7 +330,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } } -static void deformVertsEM(ModifierData *md, struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, +static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 9d924ce4fe3..8b7af867b7d 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -310,7 +310,7 @@ static void waveModifier_do(WaveModifierData *md, if (wmd->texture) MEM_freeN(tex_co); } -static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -331,7 +331,7 @@ static void deformVerts(ModifierData *md, struct EvaluationContext *UNUSED(eval_ } static void deformVertsEM( - ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 89c0761f762..dbdaafaa5a7 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -163,7 +163,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) } static DerivedMesh *applyModifier(ModifierData *md, - struct EvaluationContext *UNUSED(eval_ctx), + const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 9ef99563dc1..5f30d4ca72a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -213,7 +213,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (wmd->defgrp_name_a[0] == '\0'); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 0f197b8b5be..c8bbbfe44b2 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -370,7 +370,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (wmd->proximity_ob_target == NULL); } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index b5825d9aab2..6fc1907ba0a 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -107,7 +107,7 @@ static DerivedMesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, } -static DerivedMesh *applyModifier(ModifierData *md, struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { return WireframeModifier_do((WireframeModifierData *)md, ob, dm); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index 366996a2e03..4273bc75cc9 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -50,6 +50,8 @@ #include "WM_types.h" #include "wm_event_system.h" +#include "DEG_depsgraph.h" + /* own includes */ #include "wm_manipulator_wmapi.h" #include "wm_manipulator_intern.h" @@ -462,6 +464,7 @@ static int manipulator_find_intersected_3d_intern( ListBase *visible_manipulators, const bContext *C, const int co[2], const int hotspot) { + EvaluationContext eval_ctx; ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = sa->spacedata.first; @@ -473,7 +476,9 @@ static int manipulator_find_intersected_3d_intern( BLI_rcti_init_pt_radius(&rect, co, hotspot); - ED_view3d_draw_setup_view(CTX_wm_window(C), C, CTX_data_scene(C), ar, v3d, NULL, NULL, &rect); + CTX_data_eval_ctx(C, &eval_ctx); + + ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, v3d, NULL, NULL, &rect); if (do_passes) GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0); @@ -490,7 +495,7 @@ static int manipulator_find_intersected_3d_intern( GPU_select_end(); } - ED_view3d_draw_setup_view(CTX_wm_window(C), C, CTX_data_scene(C), ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, v3d, NULL, NULL, NULL); const GLuint *hit_near = GPU_select_buffer_near(buffer, hits); |