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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-01-11 16:33:51 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-11 16:33:51 +0300
commitfe4c2970a090dabc54cc0670fd78f8c2bc8c4dac (patch)
treed174a877cb743b7bb2aa823dbee3e63f432d4a89
parentf72f4d96bf007ef8caf98663912c4218535fdf8d (diff)
Remove file scope `using namespace blender;`
-rw-r--r--source/blender/blenkernel/intern/object_dupli.cc7
-rw-r--r--source/blender/blenkernel/intern/pointcloud.cc23
-rw-r--r--source/blender/blenkernel/intern/spline_base.cc3
-rw-r--r--source/blender/blenkernel/intern/spline_bezier.cc9
-rw-r--r--source/blender/editors/space_node/node_select.cc6
5 files changed, 28 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc
index 7b7e7e6fdd0..567b8540ec3 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -75,7 +75,6 @@ using blender::float3;
using blender::float4x4;
using blender::Span;
using blender::Vector;
-using namespace blender;
/* -------------------------------------------------------------------- */
/** \name Internal Duplicate Context
@@ -1027,6 +1026,8 @@ static void get_dupliface_transform_from_coords(Span<float3> coords,
const float scale_fac,
float r_mat[4][4])
{
+ using namespace blender::math;
+
/* Location. */
float3 location(0);
for (const float3 &coord : coords) {
@@ -1037,9 +1038,7 @@ static void get_dupliface_transform_from_coords(Span<float3> coords,
/* Rotation. */
float quat[4];
- float3 f_no;
- cross_poly_v3(f_no, (const float(*)[3])coords.data(), (uint)coords.size());
- f_no = math::normalize(f_no);
+ float3 f_no = normalize(cross_poly(coords));
tri_to_quat_ex(quat, coords[0], coords[1], coords[2], f_no);
/* Scale. */
diff --git a/source/blender/blenkernel/intern/pointcloud.cc b/source/blender/blenkernel/intern/pointcloud.cc
index 614e17ecfd4..c9548e9827d 100644
--- a/source/blender/blenkernel/intern/pointcloud.cc
+++ b/source/blender/blenkernel/intern/pointcloud.cc
@@ -57,7 +57,6 @@
using blender::float3;
using blender::IndexRange;
using blender::Span;
-using namespace blender;
/* PointCloud datablock */
@@ -276,6 +275,8 @@ struct MinMaxResult {
static MinMaxResult min_max_no_radii(Span<float3> positions)
{
+ using namespace blender::math;
+
return blender::threading::parallel_reduce(
positions.index_range(),
1024,
@@ -283,17 +284,19 @@ static MinMaxResult min_max_no_radii(Span<float3> positions)
[&](IndexRange range, const MinMaxResult &init) {
MinMaxResult result = init;
for (const int i : range) {
- math::min_max(positions[i], result.min, result.max);
+ min_max(positions[i], result.min, result.max);
}
return result;
},
[](const MinMaxResult &a, const MinMaxResult &b) {
- return MinMaxResult{math::min(a.min, b.min), math::max(a.max, b.max)};
+ return MinMaxResult{min(a.min, b.min), max(a.max, b.max)};
});
}
static MinMaxResult min_max_with_radii(Span<float3> positions, Span<float> radii)
{
+ using namespace blender::math;
+
return blender::threading::parallel_reduce(
positions.index_range(),
1024,
@@ -301,18 +304,20 @@ static MinMaxResult min_max_with_radii(Span<float3> positions, Span<float> radii
[&](IndexRange range, const MinMaxResult &init) {
MinMaxResult result = init;
for (const int i : range) {
- result.min = math::min(positions[i] - radii[i], result.min);
- result.max = math::max(positions[i] + radii[i], result.max);
+ result.min = min(positions[i] - radii[i], result.min);
+ result.max = max(positions[i] + radii[i], result.max);
}
return result;
},
[](const MinMaxResult &a, const MinMaxResult &b) {
- return MinMaxResult{math::min(a.min, b.min), math::max(a.max, b.max)};
+ return MinMaxResult{min(a.min, b.min), max(a.max, b.max)};
});
}
bool BKE_pointcloud_minmax(const PointCloud *pointcloud, float r_min[3], float r_max[3])
{
+ using namespace blender::math;
+
if (!pointcloud->totpoint) {
return false;
}
@@ -323,8 +328,8 @@ bool BKE_pointcloud_minmax(const PointCloud *pointcloud, float r_min[3], float r
{pointcloud->radius, pointcloud->totpoint}) :
min_max_no_radii(positions);
- copy_v3_v3(r_min, math::min(min_max.min, float3(r_min)));
- copy_v3_v3(r_max, math::max(min_max.max, float3(r_max)));
+ copy_v3_v3(r_min, min(min_max.min, float3(r_min)));
+ copy_v3_v3(r_max, max(min_max.max, float3(r_max)));
return true;
}
@@ -341,7 +346,7 @@ BoundBox *BKE_pointcloud_boundbox_get(Object *ob)
ob->runtime.bb = static_cast<BoundBox *>(MEM_callocN(sizeof(BoundBox), "pointcloud boundbox"));
}
- blender::float3 min, max;
+ float3 min, max;
INIT_MINMAX(min, max);
if (ob->runtime.geometry_set_eval != nullptr) {
ob->runtime.geometry_set_eval->compute_boundbox_without_instances(&min, &max);
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index f8563d34b01..3262d768b6c 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -36,7 +36,6 @@ using blender::bke::AttributeIDRef;
using blender::fn::GMutableSpan;
using blender::fn::GSpan;
using blender::fn::GVArray;
-using namespace blender;
Spline::Type Spline::type() const
{
@@ -278,7 +277,7 @@ static float3 rotate_direction_around_axis(const float3 &direction,
const float3 axis_scaled = axis * dot(direction, axis);
const float3 diff = direction - axis_scaled;
- const float3 cross = math::cross(axis, diff);
+ const float3 cross = blender::math::cross(axis, diff);
return axis_scaled + diff * std::cos(angle) + cross * std::sin(angle);
}
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index 0fafa83a5b9..980437014b1 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -27,7 +27,6 @@ using blender::MutableSpan;
using blender::Span;
using blender::VArray;
using blender::fn::GVArray;
-using namespace blender;
void BezierSpline::copy_settings(Spline &dst) const
{
@@ -200,6 +199,8 @@ void BezierSpline::ensure_auto_handles() const
}
for (const int i : IndexRange(this->size())) {
+ using namespace blender;
+
if (ELEM(HandleType::Auto, handle_types_left_[i], handle_types_right_[i])) {
const float3 prev_diff = positions_[i] - previous_position(positions_, is_cyclic_, i);
const float3 next_diff = next_position(positions_, is_cyclic_, i) - positions_[i];
@@ -276,6 +277,8 @@ static void set_handle_position(const float3 &position,
float3 &handle,
float3 &handle_other)
{
+ using namespace blender::math;
+
/* Don't bother when the handle positions are calculated automatically anyway. */
if (ELEM(type, BezierSpline::HandleType::Auto, BezierSpline::HandleType::Vector)) {
return;
@@ -284,9 +287,9 @@ static void set_handle_position(const float3 &position,
handle = new_value;
if (type_other == BezierSpline::HandleType::Align) {
/* Keep track of the old length of the opposite handle. */
- const float length = math::distance(handle_other, position);
+ const float length = distance(handle_other, position);
/* Set the other handle to directly opposite from the current handle. */
- const float3 dir = math::normalize(handle - position);
+ const float3 dir = normalize(handle - position);
handle_other = position - dir * length;
}
}
diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc
index 0b4a0cb4e8a..803cf38c53a 100644
--- a/source/blender/editors/space_node/node_select.cc
+++ b/source/blender/editors/space_node/node_select.cc
@@ -62,7 +62,7 @@
#include "node_intern.hh" /* own include */
-using namespace blender;
+using blender::float2;
/**
* Function to detect if there is a visible view3d that uses workbench in texture mode.
@@ -111,11 +111,13 @@ static bNode *node_under_mouse_select(bNodeTree &ntree, int mx, int my)
static bNode *node_under_mouse_tweak(bNodeTree &ntree, const float2 &mouse)
{
+ using namespace blender::math;
+
LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) {
if (node->type == NODE_REROUTE) {
bNodeSocket *socket = (bNodeSocket *)node->inputs.first;
const float2 location{socket->locx, socket->locy};
- if (math::distance(mouse, location) < 24.0f) {
+ if (distance(mouse, location) < 24.0f) {
return node;
}
}