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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_double3.hh3
-rw-r--r--source/blender/blenlib/BLI_float2.hh3
-rw-r--r--source/blender/blenlib/BLI_float3.hh3
-rw-r--r--source/blender/blenlib/BLI_mpq2.hh3
-rw-r--r--source/blender/editors/uvedit/uvedit_select.c129
-rw-r--r--source/blender/makesrna/intern/rna_fluid.c2
-rw-r--r--source/blender/modifiers/intern/MOD_nodes.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_object_info.cc7
8 files changed, 65 insertions, 86 deletions
diff --git a/source/blender/blenlib/BLI_double3.hh b/source/blender/blenlib/BLI_double3.hh
index 0d60148e1de..5f7b0f330b9 100644
--- a/source/blender/blenlib/BLI_double3.hh
+++ b/source/blender/blenlib/BLI_double3.hh
@@ -221,7 +221,8 @@ inline double distance(const double3 &a, const double3 &b)
inline double distance_squared(const double3 &a, const double3 &b)
{
- return dot(a, b);
+ const double3 diff = a - b;
+ return dot(diff, diff);
}
inline double3 lerp(const double3 &a, const double3 &b, double t)
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 40cbc272102..77173aaa0d2 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -168,7 +168,8 @@ inline float distance(const float2 &a, const float2 &b)
inline float distance_squared(const float2 &a, const float2 &b)
{
- return dot(a, b);
+ const float2 diff = a - b;
+ return dot(diff, diff);
}
} // namespace blender::math
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index dcbc462cab4..2f78be2bc35 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -231,7 +231,8 @@ inline float distance(const float3 &a, const float3 &b)
inline float distance_squared(const float3 &a, const float3 &b)
{
- return dot(a, b);
+ const float3 diff = a - b;
+ return dot(diff, diff);
}
inline float3 lerp(const float3 &a, const float3 &b, float t)
diff --git a/source/blender/blenlib/BLI_mpq2.hh b/source/blender/blenlib/BLI_mpq2.hh
index de88bd82890..a5b9698b2f2 100644
--- a/source/blender/blenlib/BLI_mpq2.hh
+++ b/source/blender/blenlib/BLI_mpq2.hh
@@ -175,7 +175,8 @@ inline mpq_class distance(const mpq2 &a, const mpq2 &b)
inline mpq_class distance_squared(const mpq2 &a, const mpq2 &b)
{
- return dot(a, b);
+ const mpq2 diff = a - b;
+ return dot(diff, diff);
}
} // namespace blender::math
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 118a2263cc3..067c4df927c 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -724,48 +724,37 @@ bool uv_find_nearest_edge_multi(Scene *scene,
return found;
}
-bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit_final)
+bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit)
{
- BLI_assert((hit_final->scale[0] > 0.0f) && (hit_final->scale[1] > 0.0f));
+ BLI_assert((hit->scale[0] > 0.0f) && (hit->scale[1] > 0.0f));
BMEditMesh *em = BKE_editmesh_from_object(obedit);
bool found = false;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
- /* this will fill in hit.vert1 and hit.vert2 */
- float dist_sq_init = hit_final->dist_sq;
- UvNearestHit hit = *hit_final;
- if (uv_find_nearest_edge(scene, obedit, co, &hit)) {
- hit.dist_sq = dist_sq_init;
- hit.l = NULL;
+ BMIter iter;
+ BMFace *efa;
- BMIter iter;
- BMFace *efa;
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (!uvedit_face_visible_test(scene, efa)) {
+ continue;
+ }
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, efa)) {
- continue;
- }
+ float cent[2];
+ BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
- float cent[2];
- BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
+ float delta[2];
+ sub_v2_v2v2(delta, co, cent);
+ mul_v2_v2(delta, hit->scale);
- float delta[2];
- sub_v2_v2v2(delta, co, cent);
- mul_v2_v2(delta, hit.scale);
+ const float dist_test_sq = len_squared_v2(delta);
- const float dist_test_sq = len_squared_v2(delta);
-
- if (dist_test_sq < hit.dist_sq) {
- hit.efa = efa;
- hit.dist_sq = dist_test_sq;
- found = true;
- }
+ if (dist_test_sq < hit->dist_sq) {
+ hit->efa = efa;
+ hit->dist_sq = dist_test_sq;
+ found = true;
}
}
- if (found) {
- *hit_final = hit;
- }
return found;
}
@@ -796,74 +785,58 @@ static bool uv_nearest_between(const BMLoop *l, const float co[2], const int cd_
(line_point_side_v2(uv_next, uv_curr, co) <= 0.0f));
}
-bool uv_find_nearest_vert(Scene *scene,
- Object *obedit,
- float const co[2],
- const float penalty_dist,
- UvNearestHit *hit_final)
+bool uv_find_nearest_vert(
+ Scene *scene, Object *obedit, float const co[2], const float penalty_dist, UvNearestHit *hit)
{
- BLI_assert((hit_final->scale[0] > 0.0f) && (hit_final->scale[1] > 0.0f));
+ BLI_assert((hit->scale[0] > 0.0f) && (hit->scale[1] > 0.0f));
bool found = false;
- /* This will fill in `hit.l`. */
- float dist_sq_init = hit_final->dist_sq;
- UvNearestHit hit = *hit_final;
- if (uv_find_nearest_edge(scene, obedit, co, &hit)) {
- hit.dist_sq = dist_sq_init;
-
- hit.l = NULL;
-
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMFace *efa;
- BMIter iter;
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ BMFace *efa;
+ BMIter iter;
- BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+ BM_mesh_elem_index_ensure(em->bm, BM_VERT);
- const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
+ const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, efa)) {
- continue;
- }
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (!uvedit_face_visible_test(scene, efa)) {
+ continue;
+ }
- BMIter liter;
- BMLoop *l;
- int i;
- BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
- MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
+ BMIter liter;
+ BMLoop *l;
+ int i;
+ BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+ MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- float delta[2];
+ float delta[2];
- sub_v2_v2v2(delta, co, luv->uv);
- mul_v2_v2(delta, hit.scale);
+ sub_v2_v2v2(delta, co, luv->uv);
+ mul_v2_v2(delta, hit->scale);
- float dist_test_sq = len_squared_v2(delta);
+ float dist_test_sq = len_squared_v2(delta);
- if ((penalty_dist != 0.0f) && uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
- dist_test_sq = square_f(sqrtf(dist_test_sq) + penalty_dist);
- }
+ if ((penalty_dist != 0.0f) && uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
+ dist_test_sq = square_f(sqrtf(dist_test_sq) + penalty_dist);
+ }
- if (dist_test_sq <= hit.dist_sq) {
- if (dist_test_sq == hit.dist_sq) {
- if (!uv_nearest_between(l, co, cd_loop_uv_offset)) {
- continue;
- }
+ if (dist_test_sq <= hit->dist_sq) {
+ if (dist_test_sq == hit->dist_sq) {
+ if (!uv_nearest_between(l, co, cd_loop_uv_offset)) {
+ continue;
}
+ }
- hit.dist_sq = dist_test_sq;
+ hit->dist_sq = dist_test_sq;
- hit.l = l;
- hit.efa = efa;
- found = true;
- }
+ hit->l = l;
+ hit->efa = efa;
+ found = true;
}
}
}
- if (found) {
- *hit_final = hit;
- }
-
return found;
}
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index 9087750f23b..3ea98d610f4 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -1943,7 +1943,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "viscosity_value", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0, 5.0, 0.01, 3);
+ RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 3);
RNA_def_property_ui_text(prop,
"Strength",
"Viscosity of liquid (higher values result in more viscous fluids, a "
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index edd7cb9cfd1..b8729a51df8 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -134,6 +134,7 @@ static void findUsedIds(const bNodeTree &tree, Set<ID *> &ids)
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
+ DEG_add_modifier_to_transform_relation(ctx->node, "Nodes Modifier");
if (nmd->node_group != nullptr) {
DEG_add_node_tree_relation(ctx->node, nmd->node_group, "Nodes Modifier");
diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index f7db1db0dd2..07d6858369d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -50,8 +50,11 @@ static void geo_node_object_info_exec(GeoNodeExecParams params)
const Object *self_object = params.self_object();
if (object != nullptr) {
+ float transform[4][4];
+ mul_m4_m4m4(transform, self_object->imat, object->obmat);
+
float quaternion[4];
- mat4_decompose(location, quaternion, scale, object->obmat);
+ mat4_decompose(location, quaternion, scale, transform);
quat_to_eul(rotation, quaternion);
if (object != self_object) {
@@ -64,8 +67,6 @@ static void geo_node_object_info_exec(GeoNodeExecParams params)
Mesh *copied_mesh = BKE_mesh_copy_for_eval(mesh, false);
/* Transform into the local space of the object that is being modified. */
- float transform[4][4];
- mul_m4_m4m4(transform, self_object->imat, object->obmat);
BKE_mesh_transform(copied_mesh, transform, true);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();