[Bf-blender-cvs] [32663fc2878] temp-sample-sound-node: storage

Jacques Lucke noreply at git.blender.org
Sun Nov 14 14:29:39 CET 2021


Commit: 32663fc287866017632706abf63543c5e14dc2e6
Author: Jacques Lucke
Date:   Sun Nov 14 11:34:37 2021 +0100
Branches: temp-sample-sound-node
https://developer.blender.org/rB32663fc287866017632706abf63543c5e14dc2e6

storage

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

M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/NOD_static_types.h
M	source/blender/nodes/geometry/nodes/node_geo_sample_sound.cc

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

diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 53b3f07dbbc..9e4b2c458c2 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -11091,6 +11091,18 @@ static void def_geo_viewer(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
 }
 
+static void def_geo_sample_sound(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
+  RNA_def_property_pointer_sdna(prop, NULL, "id");
+  RNA_def_property_struct_type(prop, "Sound");
+  RNA_def_property_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Sound", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 /* -------------------------------------------------------------------------- */
 
 static void rna_def_shader_node(BlenderRNA *brna)
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 8d549306cd5..32c6e317694 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -418,7 +418,7 @@ DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, "TRIANGULATE",
 DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, def_geo_curve_trim, "TRIM_CURVE", TrimCurve, "Trim Curve", "")
 DefNode(GeometryNode, GEO_NODE_VIEWER, def_geo_viewer, "VIEWER", Viewer, "Viewer", "")
 DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "")
-DefNode(GeometryNode, GEO_NODE_SAMPLE_SOUND, 0, "SAMPLE_SOUND", SampleSound, "Sample Sound", "")
+DefNode(GeometryNode, GEO_NODE_SAMPLE_SOUND, def_geo_sample_sound, "SAMPLE_SOUND", SampleSound, "Sample Sound", "")
 
 /* undefine macros */
 #undef DefNode
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_sound.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_sound.cc
index e5a07b22ddc..64326107a15 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_sound.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_sound.cc
@@ -14,6 +14,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "UI_interface.h"
+#include "UI_resources.h"
+
 #include "node_geometry_util.hh"
 
 namespace blender::nodes {
@@ -26,6 +29,11 @@ static void geo_node_sample_sound_declare(NodeDeclarationBuilder &b)
   b.add_output<decl::Float>(N_("Volume")).dependent_field();
 }
 
+static void geo_node_sample_sound_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+  uiItemR(layout, ptr, "sound", 0, "", ICON_NONE);
+}
+
 static void geo_node_sample_sound_exec(GeoNodeExecParams params)
 {
   params.set_output("Volume", 0.0f);
@@ -41,5 +49,6 @@ void register_node_type_geo_sample_sound()
   node_type_size(&ntype, 200, 40, 1000);
   ntype.declare = blender::nodes::geo_node_sample_sound_declare;
   ntype.geometry_node_execute = blender::nodes::geo_node_sample_sound_exec;
+  ntype.draw_buttons = blender::nodes::geo_node_sample_sound_layout;
   nodeRegisterType(&ntype);
 }



More information about the Bf-blender-cvs mailing list