[Bf-blender-cvs] [9e9e150b747] functions: size parameter in turbulence force node

Jacques Lucke noreply at git.blender.org
Thu Sep 12 16:32:30 CEST 2019


Commit: 9e9e150b7472b3f2d63781c44c106a233a758bc9
Author: Jacques Lucke
Date:   Thu Sep 12 15:55:47 2019 +0200
Branches: functions
https://developer.blender.org/rB9e9e150b7472b3f2d63781c44c106a233a758bc9

size parameter in turbulence force node

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

M	release/scripts/startup/nodes/bparticle_nodes/forces.py
M	source/blender/simulations/bparticles/forces.cpp
M	source/blender/simulations/bparticles/node_frontend.cpp

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

diff --git a/release/scripts/startup/nodes/bparticle_nodes/forces.py b/release/scripts/startup/nodes/bparticle_nodes/forces.py
index 452fffb21dd..bf025c6bb90 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/forces.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/forces.py
@@ -10,6 +10,7 @@ class TurbulenceForceNode(bpy.types.Node, BParticlesNode):
 
     def declaration(self, builder: NodeBuilder):
         builder.fixed_input("strength", "Strength", "Vector", default=(1, 1, 1))
+        builder.fixed_input("size", "Size", "Float", default=0.5)
         builder.fixed_input("falloff", "Falloff", "Falloff")
         builder.particle_effector_output("force", "Force")
 
diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp
index ffd16aca14c..fed9dc35a8c 100644
--- a/source/blender/simulations/bparticles/forces.cpp
+++ b/source/blender/simulations/bparticles/forces.cpp
@@ -37,10 +37,11 @@ void TurbulenceForce::add_force(ForceInterface &interface)
   for (uint pindex : interface.pindices()) {
     float3 pos = positions[pindex];
     float3 strength = inputs->get<float3>("Strength", 0, pindex);
+    float size = inputs->get<float>("Size", 1, pindex);
     float weight = weights[pindex];
-    float x = (BLI_gNoise(0.5f, pos.x, pos.y, pos.z + 1000.0f, false, 1) - 0.5f) * strength.x;
-    float y = (BLI_gNoise(0.5f, pos.x, pos.y + 1000.0f, pos.z, false, 1) - 0.5f) * strength.y;
-    float z = (BLI_gNoise(0.5f, pos.x + 1000.0f, pos.y, pos.z, false, 1) - 0.5f) * strength.z;
+    float x = (BLI_gNoise(size, pos.x, pos.y, pos.z + 1000.0f, false, 1) - 0.5f) * strength.x;
+    float y = (BLI_gNoise(size, pos.x, pos.y + 1000.0f, pos.z, false, 1) - 0.5f) * strength.y;
+    float z = (BLI_gNoise(size, pos.x + 1000.0f, pos.y, pos.z, false, 1) - 0.5f) * strength.z;
     destination[pindex] += float3(x, y, z) * weight;
   }
 }
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index 852bb3f7697..7bbe28e69ff 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -546,7 +546,7 @@ static void PARSE_turbulence_force(BehaviorCollector &collector,
                                    WorldTransition &UNUSED(world_transition),
                                    VirtualNode *vnode)
 {
-  FN::TupleCallBody &body = vtree_data.function_body_for_inputs(vnode, {1});
+  FN::TupleCallBody &body = vtree_data.function_body_for_inputs(vnode, {2});
   FN_TUPLE_CALL_ALLOC_TUPLES(body, fn_in, fn_out);
   body.call__setup_execution_context(fn_in, fn_out);



More information about the Bf-blender-cvs mailing list