Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-12-07 17:09:30 +0300
committerHans Goudey <h.goudey@me.com>2021-12-07 17:09:30 +0300
commit2309fa20af416d479fc220d0841483eb3bcf55b0 (patch)
tree5ece68f40841756e8a2293f926f8f93fcebbe7c5 /source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
parent6a9775ec6fd38c26e66ca513cf2914d7344b8f51 (diff)
Cleanup: Add macro and functions for node storage
The `node_storage` functions to retrieve const and mutable structs from a node are generated by a short macro that can be placed at the top of each relevant file. I use this in D8286 to make code snippets in the socket declarations much shorter, but I thought it would be good to use it consistently everywhere else too. The functions are also useful to avoid copy and paste errors, like the one corrected in the cylinder node in this commit. Differential Revision: https://developer.blender.org/D13491
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
index a4b080b11e7..381bb0fc1d0 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
@@ -23,6 +23,8 @@
namespace blender::nodes::node_geo_curve_handle_type_selection_cc {
+NODE_STORAGE_FUNCS(NodeGeometryCurveSelectHandles)
+
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Bool>(N_("Selection")).field_source();
@@ -136,11 +138,10 @@ class HandleTypeFieldInput final : public GeometryFieldInput {
static void node_geo_exec(GeoNodeExecParams params)
{
- const NodeGeometryCurveSelectHandles *storage =
- (const NodeGeometryCurveSelectHandles *)params.node().storage;
+ const NodeGeometryCurveSelectHandles &storage = node_storage(params.node());
const BezierSpline::HandleType handle_type = handle_type_from_input_type(
- (GeometryNodeCurveHandleType)storage->handle_type);
- const GeometryNodeCurveHandleMode mode = (GeometryNodeCurveHandleMode)storage->mode;
+ (GeometryNodeCurveHandleType)storage.handle_type);
+ const GeometryNodeCurveHandleMode mode = (GeometryNodeCurveHandleMode)storage.mode;
Field<bool> selection_field{std::make_shared<HandleTypeFieldInput>(handle_type, mode)};
params.set_output("Selection", std::move(selection_field));