Commit: c2bbd01b2fb0df665102b8dbf14cdc562d37b617
Author: Hans Goudey
Date:   Fri May 13 19:13:31 2022 +0200
Branches: master
https://developer.blender.org/rBc2bbd01b2fb0df665102b8dbf14cdc562d37b617

Cleanup: Use const arguments

===================================================================

M       source/blender/blenkernel/BKE_camera.h
M       source/blender/blenkernel/intern/camera.c
M       source/blender/editors/include/ED_view3d.h
M       source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M       source/blender/editors/space_view3d/view3d_project.c
M       source/blender/editors/space_view3d/view3d_utils.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_camera.h 
b/source/blender/blenkernel/BKE_camera.h
index 57dc1e288dc..e55b8b1a2da 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -79,7 +79,7 @@ typedef struct CameraParams {
 void BKE_camera_params_init(CameraParams *params);
 void BKE_camera_params_from_object(CameraParams *params, const struct Object 
*cam_ob);
 void BKE_camera_params_from_view3d(CameraParams *params,
-                                   struct Depsgraph *depsgraph,
+                                   const struct Depsgraph *depsgraph,
                                    const struct View3D *v3d,
                                    const struct RegionView3D *rv3d);
 
diff --git a/source/blender/blenkernel/intern/camera.c 
b/source/blender/blenkernel/intern/camera.c
index 32925168437..b59e44aae8a 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -302,7 +302,7 @@ void BKE_camera_params_from_object(CameraParams *params, 
const Object *cam_ob)
 }
 
 void BKE_camera_params_from_view3d(CameraParams *params,
-                                   Depsgraph *depsgraph,
+                                   const Depsgraph *depsgraph,
                                    const View3D *v3d,
                                    const RegionView3D *rv3d)
 {
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 414643dd0d6..48bd86027f9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -700,9 +700,9 @@ void ED_view3d_win_to_vector(const struct ARegion *region, 
const float mval[2],
  * \param do_clip_planes: Optionally clip the ray by the view clipping planes.
  * \return success, false if the segment is totally clipped.
  */
-bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
+bool ED_view3d_win_to_segment_clipped(const struct Depsgraph *depsgraph,
                                       const struct ARegion *region,
-                                      struct View3D *v3d,
+                                      const struct View3D *v3d,
                                       const float mval[2],
                                       float r_ray_start[3],
                                       float r_ray_end[3],
@@ -733,7 +733,7 @@ void ED_view3d_dist_range_get(const struct View3D *v3d, 
float r_dist_range[2]);
 /**
  * \note copies logic of #ED_view3d_viewplane_get(), keep in sync.
  */
-bool ED_view3d_clip_range_get(struct Depsgraph *depsgraph,
+bool ED_view3d_clip_range_get(const struct Depsgraph *depsgraph,
                               const struct View3D *v3d,
                               const struct RegionView3D *rv3d,
                               float *r_clipsta,
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 89470772e1c..dee9615ce76 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -41,9 +41,9 @@ static std::optional<float3> find_curves_brush_position(const 
CurvesGeometry &cu
                                                         const float3 
&ray_start_cu,
                                                         const float3 
&ray_end_cu,
                                                         const float 
brush_radius_re,
-                                                        ARegion &region,
-                                                        RegionView3D &rv3d,
-                                                        Object &object)
+                                                        const ARegion &region,
+                                                        const RegionView3D 
&rv3d,
+                                                        const Object &object)
 {
   /* This value might have to be adjusted based on user feedback. */
   const float brush_inner_radius_re = std::min<float>(brush_radius_re, 
(float)UI_UNIT_X / 3.0f);
@@ -146,14 +146,14 @@ std::optional<CurvesBrush3D> 
sample_curves_3d_brush(bContext &C,
                                                     const float2 &brush_pos_re,
                                                     const float 
brush_radius_re)
 {
-  Depsgraph *depsgraph = CTX_data_depsgraph_pointer(&C);
-  ARegion *region = CTX_wm_region(&C);
-  View3D *v3d = CTX_wm_view3d(&C);
-  RegionView3D *rv3d = CTX_wm_region_view3d(&C);
-
-  Curves &curves_id = *static_cast<Curves *>(curves_object.data);
-  CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry);
-  Object *surface_object = curves_id.surface;
+  const Depsgraph *depsgraph = CTX_data_depsgraph_pointer(&C);
+  const ARegion *region = CTX_wm_region(&C);
+  const View3D *v3d = CTX_wm_view3d(&C);
+  const RegionView3D *rv3d = CTX_wm_region_view3d(&C);
+
+  const Curves &curves_id = *static_cast<Curves *>(curves_object.data);
+  const CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry);
+  const Object *surface_object = curves_id.surface;
 
   float3 center_ray_start_wo, center_ray_end_wo;
   ED_view3d_win_to_segment_clipped(
diff --git a/source/blender/editors/space_view3d/view3d_project.c 
b/source/blender/editors/space_view3d/view3d_project.c
index 85d239507ce..78b873f533c 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -642,9 +642,9 @@ void ED_view3d_win_to_vector(const ARegion *region, const 
float mval[2], float r
   normalize_v3(r_out);
 }
 
-bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
+bool ED_view3d_win_to_segment_clipped(const struct Depsgraph *depsgraph,
                                       const ARegion *region,
-                                      View3D *v3d,
+                                      const View3D *v3d,
                                       const float mval[2],
                                       float r_ray_start[3],
                                       float r_ray_end[3],
diff --git a/source/blender/editors/space_view3d/view3d_utils.c 
b/source/blender/editors/space_view3d/view3d_utils.c
index e6895c0f4a3..0306bfe70bd 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -106,7 +106,7 @@ void ED_view3d_dist_range_get(const View3D *v3d, float 
r_dist_range[2])
   r_dist_range[1] = v3d->clip_end * 10.0f;
 }
 
-bool ED_view3d_clip_range_get(Depsgraph *depsgraph,
+bool ED_view3d_clip_range_get(const Depsgraph *depsgraph,
                               const View3D *v3d,
                               const RegionView3D *rv3d,
                               float *r_clipsta,

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to