[Bf-blender-cvs] [c4f7f59c659] master: Curves: Add support for new curves type in Set Material node

Christophe Hery noreply at git.blender.org
Mon Apr 11 21:56:54 CEST 2022


Commit: c4f7f59c659f7d986e4a2602eff4135fc58cf2f1
Author: Christophe Hery
Date:   Mon Apr 11 14:52:20 2022 -0500
Branches: master
https://developer.blender.org/rBc4f7f59c659f7d986e4a2602eff4135fc58cf2f1

Curves: Add support for new curves type in Set Material node

Simply add the few lines so that the Cycles renderable New Curves
(with a small temporary patch to output the new type to render engines)
would get assigned a shader (in particular a hair shader).

Differential Revision: https://developer.blender.org/D14622

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

M	source/blender/nodes/geometry/nodes/node_geo_set_material.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
index c48129acbdc..70063b3af19 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
@@ -9,6 +9,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_pointcloud_types.h"
 #include "DNA_volume_types.h"
+#include "DNA_curves_types.h"
 
 #include "BKE_material.h"
 
@@ -63,6 +64,7 @@ static void node_geo_exec(GeoNodeExecParams params)
   /* Only add the warnings once, even if there are many unique instances. */
   bool point_selection_warning = false;
   bool volume_selection_warning = false;
+  bool curves_selection_warning = false;
 
   geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
     if (geometry_set.has_mesh()) {
@@ -89,6 +91,12 @@ static void node_geo_exec(GeoNodeExecParams params)
         point_selection_warning = true;
       }
     }
+    if (Curves *curves = geometry_set.get_curves_for_write()) {
+      BKE_id_material_eval_assign(&curves->id, 1, material);
+      if (selection_field.node().depends_on_input()) {
+        curves_selection_warning = true;
+      }
+    }
   });
 
   if (volume_selection_warning) {
@@ -101,6 +109,11 @@ static void node_geo_exec(GeoNodeExecParams params)
         NodeWarningType::Info,
         TIP_("Point clouds only support a single material; selection input can not be a field"));
   }
+  if (curves_selection_warning) {
+    params.error_message_add(
+        NodeWarningType::Info,
+        TIP_("Curves only support a single material; selection input can not be a field"));
+  }
 
   params.set_output("Geometry", std::move(geometry_set));
 }



More information about the Bf-blender-cvs mailing list