[Bf-blender-cvs] [0102c06cb2b] functions: remove Falloff implementation

Jacques Lucke noreply at git.blender.org
Fri Sep 27 15:27:38 CEST 2019


Commit: 0102c06cb2b1ddb795c553252e869ca3a13788db
Author: Jacques Lucke
Date:   Fri Sep 27 14:14:39 2019 +0200
Branches: functions
https://developer.blender.org/rB0102c06cb2b1ddb795c553252e869ca3a13788db

remove Falloff implementation

The plan is to achieve the same functionality in a different way
that allows more customization.

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

M	release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py
D	release/scripts/startup/nodes/function_nodes/falloffs.py
M	release/scripts/startup/nodes/menu.py
M	release/scripts/startup/nodes/sockets.py
M	release/scripts/startup/nodes/types.py
D	source/blender/blenkernel/BKE_falloff.hpp
M	source/blender/blenkernel/CMakeLists.txt
D	source/blender/blenkernel/intern/falloff.cpp
M	source/blender/functions/CMakeLists.txt
M	source/blender/functions/FN_functions.hpp
M	source/blender/functions/FN_types.hpp
M	source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
M	source/blender/functions/frontends/data_flow_nodes/mappings/socket_loaders.cpp
M	source/blender/functions/frontends/data_flow_nodes/mappings/type_mappings.cpp
D	source/blender/functions/functions/falloffs.cpp
D	source/blender/functions/functions/falloffs.hpp
M	source/blender/functions/functions/lists.cpp
D	source/blender/functions/types/falloff.cpp
D	source/blender/functions/types/falloff.hpp
M	source/blender/functions/types/initialization.cpp
M	source/blender/simulations/bparticles/forces.hpp
M	source/blender/simulations/bparticles/node_frontend.cpp

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

diff --git a/release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py b/release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py
index 8ac3a170fd3..ef8a5fb4f5c 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py
@@ -14,7 +14,6 @@ class MeshEmitterNode(bpy.types.Node, BParticlesNode):
         items=[
             ('UNIFORM', "Uniform", "", 'NONE', 0),
             ('VERTEX_WEIGHTS', "Vertex Weights", "", 'NONE', 1),
-            ('FALLOFF', "Falloff", "", 'NONE', 2),
         ],
         update=BParticlesNode.sync_tree,
     )
@@ -25,8 +24,6 @@ class MeshEmitterNode(bpy.types.Node, BParticlesNode):
 
         if self.density_mode == 'VERTEX_WEIGHTS':
             builder.fixed_input("density_vertex_group", "Density Group", "Text")
-        elif self.density_mode == 'FALLOFF':
-            builder.fixed_input("density_falloff", "Density Falloff", "Falloff")
 
         builder.execute_input("execute_on_birth", "Execute on Birth", "execute_on_birth__prop")
         builder.influences_output("emitter", "Emitter")
diff --git a/release/scripts/startup/nodes/function_nodes/falloffs.py b/release/scripts/startup/nodes/function_nodes/falloffs.py
deleted file mode 100644
index 208fa3a8e21..00000000000
--- a/release/scripts/startup/nodes/function_nodes/falloffs.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import bpy
-from .. node_builder import NodeBuilder
-from .. base import FunctionNode
-
-
-class ConstantFalloffNode(bpy.types.Node, FunctionNode):
-    bl_idname = "fn_ConstantFalloffNode"
-    bl_label = "Constant Falloff"
-
-    def declaration(self, builder: NodeBuilder):
-        builder.fixed_input("weight", "Weight", "Float", default=1.0)
-        builder.fixed_output("falloff", "Falloff", "Falloff")
-
-
-class PointDistanceFalloffNode(bpy.types.Node, FunctionNode):
-    bl_idname = "fn_PointDistanceFalloffNode"
-    bl_label = "Point Distance Falloff"
-
-    def declaration(self, builder: NodeBuilder):
-        builder.fixed_input("point", "Point", "Vector")
-        builder.fixed_input("min_distance", "Min Distance", "Float")
-        builder.fixed_input("max_distance", "Max Distance", "Float", default=1)
-        builder.fixed_output("falloff", "Falloff", "Falloff")
-
-
-class MeshDistanceFalloffNode(bpy.types.Node, FunctionNode):
-    bl_idname = "fn_MeshDistanceFalloffNode"
-    bl_label = "Mesh Distance Falloff"
-
-    def declaration(self, builder: NodeBuilder):
-        builder.fixed_input("object", "Object", "Object")
-        builder.fixed_input("inner_distance", "Inner Distance", "Float")
-        builder.fixed_input("outer_distance", "Outer Distance", "Float", default=1.0)
-        builder.fixed_output("falloff", "Falloff", "Falloff")
diff --git a/release/scripts/startup/nodes/menu.py b/release/scripts/startup/nodes/menu.py
index 70bc477f01f..bc3648b34ad 100644
--- a/release/scripts/startup/nodes/menu.py
+++ b/release/scripts/startup/nodes/menu.py
@@ -49,10 +49,6 @@ class FunctionNodesMenu(bpy.types.Menu):
         insert_node(layout, "fn_SeparateColorNode", "Separate Color")
         insert_node(layout, "fn_CombineColorNode", "Combine Color")
         layout.separator()
-        insert_node(layout, "fn_ConstantFalloffNode", "Constant Falloff")
-        insert_node(layout, "fn_PointDistanceFalloffNode", "Point Distance Falloff")
-        insert_node(layout, "fn_MeshDistanceFalloffNode", "Mesh Distance Falloff")
-        layout.separator()
         insert_node(layout, "fn_GetListElementNode", "Get List Element")
         insert_node(layout, "fn_ListLengthNode", "List Length")
         insert_node(layout, "fn_PackListNode", "Pack List")
diff --git a/release/scripts/startup/nodes/sockets.py b/release/scripts/startup/nodes/sockets.py
index 32088697892..cb472d52da6 100644
--- a/release/scripts/startup/nodes/sockets.py
+++ b/release/scripts/startup/nodes/sockets.py
@@ -154,28 +154,6 @@ class TextSocket(bpy.types.NodeSocket, DataSocket):
     def restore_state(self, state):
         self.value = state
 
-class FalloffSocket(bpy.types.NodeSocket, DataSocket):
-    bl_idname = "fn_FalloffSocket"
-    bl_label = "Falloff Socket"
-    data_type = "Falloff"
-    color = (0.2, 0.8, 0.2, 1)
-
-    value: FloatProperty(
-        name="Value",
-        default=1.0,
-        soft_min=0.0,
-        soft_max=1.0,
-    )
-
-    def draw_property(self, layout, node, text):
-        layout.prop(self, "value", text=text, slider=True)
-
-    def get_state(self):
-        return self.value
-
-    def restore_state(self, state):
-        self.value = state
-
 def create_simple_data_socket(idname, data_type, color):
     return type(idname, (bpy.types.NodeSocket, DataSocket),
         {
@@ -199,8 +177,6 @@ ColorListSocket = create_simple_data_socket(
     "fn_ColorListSocket", "Color List", (0.8, 0.8, 0.2, 0.5))
 TextListSocket = create_simple_data_socket(
     "fn_TextListSocket", "Text List", (0.8, 0.8, 0.8, 0.5))
-FalloffListSocket = create_simple_data_socket(
-    "fn_FalloffListSocket", "Falloff List", (0.2, 0.8, 0.2, 0.5))
 
 class ExecuteSocket(bpy.types.NodeSocket, BaseSocket):
     bl_idname = "bp_ExecuteSocket"
diff --git a/release/scripts/startup/nodes/types.py b/release/scripts/startup/nodes/types.py
index 3883080c461..6ad800d983f 100644
--- a/release/scripts/startup/nodes/types.py
+++ b/release/scripts/startup/nodes/types.py
@@ -10,6 +10,5 @@ type_infos.insert_data_type(s.BooleanSocket, s.BooleanListSocket)
 type_infos.insert_data_type(s.ObjectSocket, s.ObjectListSocket)
 type_infos.insert_data_type(s.ColorSocket, s.ColorListSocket)
 type_infos.insert_data_type(s.TextSocket, s.TextListSocket)
-type_infos.insert_data_type(s.FalloffSocket, s.FalloffListSocket)
 
 type_infos.insert_conversion_group(["Boolean", "Integer", "Float"])
diff --git a/source/blender/blenkernel/BKE_falloff.hpp b/source/blender/blenkernel/BKE_falloff.hpp
deleted file mode 100644
index 626c9036a15..00000000000
--- a/source/blender/blenkernel/BKE_falloff.hpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#pragma once
-
-#include "BKE_attributes_ref.hpp"
-#include "BKE_bvhutils.h"
-
-#include "BLI_kdopbvh.h"
-#include "BLI_kdtree.h"
-
-#include "DNA_object_types.h"
-
-namespace BKE {
-
-using BLI::float4x4;
-
-class Falloff {
- public:
-#ifdef WITH_CXX_GUARDEDALLOC
-  MEM_CXX_CLASS_ALLOC_FUNCS("BKE:Falloff")
-#endif
-
-  virtual ~Falloff();
-
-  /**
-   * Create an identical copy of this falloff.
-   */
-  virtual Falloff *clone() const = 0;
-
-  /**
-   * The indices are expected to be sorted. Also no index must exist more than once.
-   */
-  virtual void compute(AttributesRef attributes,
-                       ArrayRef<uint> indices,
-                       MutableArrayRef<float> r_weights) const = 0;
-};
-
-class ConstantFalloff : public Falloff {
- private:
-  float m_weight;
-
- public:
-  ConstantFalloff(float weight) : m_weight(weight)
-  {
-  }
-
-  Falloff *clone() const override
-  {
-    return new ConstantFalloff(m_weight);
-  }
-
-  void compute(AttributesRef UNUSED(attributes),
-               ArrayRef<uint> indices,
-               MutableArrayRef<float> r_weights) const override;
-};
-
-class PointDistanceFalloff : public Falloff {
- private:
-  float3 m_point;
-  float m_min_distance;
-  float m_max_distance;
-
- public:
-  PointDistanceFalloff(float3 point, float min_distance, float max_distance)
-      : m_point(point), m_min_distance(min_distance), m_max_distance(max_distance)
-  {
-  }
-
-  Falloff *clone() const override
-  {
-    return new PointDistanceFalloff(m_point, m_min_distance, m_max_distance);
-  }
-
-  void compute(AttributesRef attributes,
-               ArrayRef<uint> indices,
-               MutableArrayRef<float> r_weights) const override;
-};
-
-class MeshDistanceFalloff : public Falloff {
- private:
-  Object *m_object;
-  BVHTreeFromMesh m_bvhtree_data;
-  float4x4 m_local_to_world;
-  float4x4 m_world_to_local;
-  float m_inner_distance;
-  float m_outer_distance;
-
- public:
-  MeshDistanceFalloff(Object *object, float inner_distance, float outer_distance);
-  ~MeshDistanceFalloff();
-
-  Falloff *clone() const override
-  {
-    return new MeshDistanceFalloff(m_object, m_inner_distance, m_outer_distance);
-  }
-
-  void compute(AttributesRef attributes,
-               ArrayRef<uint> indices,
-               MutableArrayRef<float> r_weights) const override;
-};
-
-}  // namespace BKE
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index cc09116f7ae..fed52559f83 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -115,7 +115,6 @@ set(SRC
   intern/editmesh_cache.c
   intern/editmesh_tangent.c
   intern/effect.c
-  intern/falloff.cpp
   intern/fcurve.c
   intern/fluidsim.c
   intern/fmodifier.c
@@ -283,7 +282,6 @@ set(SRC
   BKE_editmesh_cache.h
   BKE_editmesh_tangent.h
   BKE_effect.h
-  BKE_falloff.hpp
   BKE_fcurve.h
   BKE_fluidsim.h
   BKE_font.h
diff --git a/source/blender/blenkernel/intern/falloff.cpp b/source/blender/blenkernel/intern/falloff.cpp
deleted file mode 100644
index 16b340a1f13..00000000000
--- a/source/blender/blenkernel/intern/falloff.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "BKE_falloff.hpp"
-
-#include "BLI_array_cxx.h"
-
-namespace BKE {
-
-using BLI::TemporaryArray;
-
-Falloff::~Falloff()
-{
-}
-
-void ConstantFalloff::compute(AttributesRef UNUSED(attributes),
-                              ArrayRef<uint> indices,
-                              MutableArrayRef<float> r_weights) const
-{
-  for (uint index : indices) {
-    r_weights[index] = m_weight;
-  }
-}
-
-void PointDistanceFalloff::compute(AttributesRef attributes,
-                                   ArrayRef<uint> indices,
-                                   MutableArrayRef<float> r_weights) const
-{
-  auto positions = attributes.get<float3>("Position");
-  float distance_diff = m_max_distance - m_min_distance;
-
-  for (uint index : indices) {
-    float3 position = positions[index];
-    float distance = float3::distance(position, m_point);
-
-    float weight = 0;
-    if (distance_diff > 0) {
-      weight = 1.0f - (distance - m_min_distance) / distance_diff;
-      CLAMP(

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list