[Bf-blender-cvs] [f71eec76048] functions: remove Surface Weight node
Jacques Lucke
noreply at git.blender.org
Sat Nov 30 16:40:21 CET 2019
Commit: f71eec760488c0734604bfe171d1c09923f9d205
Author: Jacques Lucke
Date: Sat Nov 30 14:38:01 2019 +0100
Branches: functions
https://developer.blender.org/rBf71eec760488c0734604bfe171d1c09923f9d205
remove Surface Weight node
===================================================================
M release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
M release/scripts/startup/nodes/menu.py
M source/blender/simulations/bparticles/particle_function_builder.cpp
M source/blender/simulations/bparticles/particle_function_input_providers.cpp
M source/blender/simulations/bparticles/particle_function_input_providers.hpp
===================================================================
diff --git a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
index d55dbb9603d..c14fda45f60 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
@@ -51,19 +51,6 @@ class SurfaceImageNode(bpy.types.Node, SimulationNode):
col.prop(self, "uv_mode", text="")
-class SurfaceWeightNode(bpy.types.Node, SimulationNode):
- bl_idname = "fn_SurfaceWeightNode"
- bl_label = "Surface Weight"
-
- group_name: StringProperty()
-
- def declaration(self, builder: NodeBuilder):
- builder.fixed_output("weight", "Weight", "Float")
-
- def draw(self, layout):
- layout.prop(self, "group_name", text="")
-
-
class ParticleRandomnessInputNode(bpy.types.Node, SimulationNode):
bl_idname = "fn_ParticleRandomnessInputNode"
bl_label = "Particle Randomness Input"
diff --git a/release/scripts/startup/nodes/menu.py b/release/scripts/startup/nodes/menu.py
index d2d0b36e322..b2d6a95aa3c 100644
--- a/release/scripts/startup/nodes/menu.py
+++ b/release/scripts/startup/nodes/menu.py
@@ -100,7 +100,6 @@ class InputNodesMenu(bpy.types.Menu):
insert_node(layout, "fn_ParticleInfoNode", "Particle Info")
insert_node(layout, "fn_SurfaceInfoNode", "Surface Info")
insert_node(layout, "fn_SurfaceImageNode", "Image Colors")
- insert_node(layout, "fn_SurfaceWeightNode", "Vertex Weights")
insert_node(layout, "fn_ParticleRandomnessInputNode", "Particle Randomness")
diff --git a/source/blender/simulations/bparticles/particle_function_builder.cpp b/source/blender/simulations/bparticles/particle_function_builder.cpp
index 4d70ea42387..d96757e1eef 100644
--- a/source/blender/simulations/bparticles/particle_function_builder.cpp
+++ b/source/blender/simulations/bparticles/particle_function_builder.cpp
@@ -75,15 +75,6 @@ static ParticleFunctionInputProvider *INPUT_surface_image(
return new SurfaceImageInputProvider(image, uv_map_name);
}
-static ParticleFunctionInputProvider *INPUT_surface_weight(
- VTreeMFNetwork &UNUSED(inlined_tree_data_graph), const XOutputSocket &xsocket)
-{
- PointerRNA *rna = xsocket.node().rna();
- char group_name[65];
- RNA_string_get(rna, "group_name", group_name);
- return new VertexWeightInputProvider(group_name);
-}
-
static ParticleFunctionInputProvider *INPUT_randomness_input(
VTreeMFNetwork &UNUSED(inlined_tree_data_graph), const XOutputSocket &xsocket)
{
@@ -112,7 +103,6 @@ BLI_LAZY_INIT_STATIC(StringMap<BuildInputProvider>, get_input_providers_map)
StringMap<BuildInputProvider> map;
map.add_new("fn_SurfaceInfoNode", INPUT_surface_info);
map.add_new("fn_SurfaceImageNode", INPUT_surface_image);
- map.add_new("fn_SurfaceWeightNode", INPUT_surface_weight);
map.add_new("fn_ParticleRandomnessInputNode", INPUT_randomness_input);
map.add_new("fn_IsInGroupNode", INPUT_is_in_group);
return map;
diff --git a/source/blender/simulations/bparticles/particle_function_input_providers.cpp b/source/blender/simulations/bparticles/particle_function_input_providers.cpp
index 4601170cbe3..532bf265948 100644
--- a/source/blender/simulations/bparticles/particle_function_input_providers.cpp
+++ b/source/blender/simulations/bparticles/particle_function_input_providers.cpp
@@ -127,68 +127,6 @@ Optional<ParticleFunctionInputArray> SurfaceImageInputProvider::compute_colors(
return ParticleFunctionInputArray(colors.as_ref(), true);
}
-Optional<ParticleFunctionInputArray> VertexWeightInputProvider::get(
- InputProviderInterface &interface)
-{
- ActionContext *action_context = interface.action_context();
-
- if (dynamic_cast<MeshSurfaceContext *>(action_context)) {
- auto *surface_info = dynamic_cast<MeshSurfaceContext *>(action_context);
- return this->compute_weights(
- interface, surface_info, IndexRange(interface.attributes().size()).as_array_ref());
- }
- else if (dynamic_cast<SourceParticleActionContext *>(action_context)) {
- auto *source_info = dynamic_cast<SourceParticleActionContext *>(action_context);
- auto *surface_info = dynamic_cast<MeshSurfaceContext *>(source_info->source_context());
- if (surface_info != nullptr) {
- return this->compute_weights(interface, surface_info, source_info->source_indices());
- }
- }
- return {};
-}
-
-Optional<ParticleFunctionInputArray> VertexWeightInputProvider::compute_weights(
- InputProviderInterface &interface,
- MeshSurfaceContext *surface_info,
- ArrayRef<uint> surface_info_mapping)
-{
- Object *object = surface_info->object();
- Mesh *mesh = (Mesh *)object->data;
- MDeformVert *vertex_weights = mesh->dvert;
-
- int group_index = defgroup_name_index(object, m_group_name.data());
- if (group_index == -1 || vertex_weights == nullptr) {
- return {};
- }
-
- const MLoopTri *triangles = BKE_mesh_runtime_looptri_ensure(mesh);
- ArrayRef<float3> barycentric_coords = surface_info->barycentric_coords();
-
- uint size = interface.attributes().size();
- auto weights = BLI::temporary_allocate_array<float>(size);
-
- for (uint pindex : interface.pindices()) {
- uint source_index = surface_info_mapping[pindex];
- uint triangle_index = surface_info->looptri_indices()[source_index];
- float3 bary_weights = barycentric_coords[source_index];
-
- const MLoopTri &triangle = triangles[triangle_index];
-
- uint vert1 = mesh->mloop[triangle.tri[0]].v;
- uint vert2 = mesh->mloop[triangle.tri[1]].v;
- uint vert3 = mesh->mloop[triangle.tri[2]].v;
-
- float3 corner_weights{defvert_find_weight(vertex_weights + vert1, group_index),
- defvert_find_weight(vertex_weights + vert2, group_index),
- defvert_find_weight(vertex_weights + vert3, group_index)};
-
- float weight = float3::dot(bary_weights, corner_weights);
- weights[pindex] = weight;
- }
-
- return ParticleFunctionInputArray(weights.as_ref(), true);
-}
-
Optional<ParticleFunctionInputArray> RandomFloatInputProvider::get(
InputProviderInterface &interface)
{
diff --git a/source/blender/simulations/bparticles/particle_function_input_providers.hpp b/source/blender/simulations/bparticles/particle_function_input_providers.hpp
index b58ac9f7042..8de94f374b9 100644
--- a/source/blender/simulations/bparticles/particle_function_input_providers.hpp
+++ b/source/blender/simulations/bparticles/particle_function_input_providers.hpp
@@ -39,23 +39,6 @@ class SurfaceImageInputProvider : public ParticleFunctionInputProvider {
ArrayRef<uint> surface_info_mapping);
};
-class VertexWeightInputProvider : public ParticleFunctionInputProvider {
- private:
- std::string m_group_name;
-
- public:
- VertexWeightInputProvider(StringRef group_name) : m_group_name(group_name)
- {
- }
-
- Optional<ParticleFunctionInputArray> get(InputProviderInterface &interface) override;
-
- private:
- Optional<ParticleFunctionInputArray> compute_weights(InputProviderInterface &interface,
- MeshSurfaceContext *surface_info,
- ArrayRef<uint> surface_info_mapping);
-};
-
class RandomFloatInputProvider : public ParticleFunctionInputProvider {
private:
uint m_seed;
More information about the Bf-blender-cvs
mailing list