OverviewFilesCommitsIssuesDocsReleasesPeers

proc-nodes / src / nodes / utility_nodes.h

63 lines · c ref:
#ifndef PROC_NODES_UTILITY_NODES_H
#define PROC_NODES_UTILITY_NODES_H

#include "../graph/proc_node.h"

namespace godot {

// Accumulate Field — running sum of a float field
class AccumulateFieldNode : public ProcNode {
	GDCLASS(AccumulateFieldNode, ProcNode);

protected:
	static void _bind_methods();

	int data_type = 10; // Blender's CD_PROP_*: FLOAT 10, INT 11, VECTOR 48, TRANSFORM 20
	int domain = 0; // AttrDomain, carried so the property round-trips

public:
	StringName get_node_type() const override { return "AccumulateField"; }
	String get_node_title() const override { return "Accumulate Field"; }
	String get_node_category() const override { return "Utility"; }

	void set_data_type(int p_t);
	int get_data_type() const { return data_type; }
	void set_domain(int p_d) { domain = p_d; }
	int get_domain() const { return domain; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	AccumulateFieldNode();
};

// Sample Index — sample attribute at specific element index
class SampleIndexNode : public ProcNode {
	GDCLASS(SampleIndexNode, ProcNode);

protected:
	static void _bind_methods();

	int data_type = 10; // CD_PROP_*
	int domain = 0; // AttrDomain
	bool clamp_index = false;

public:
	StringName get_node_type() const override { return "SampleIndex"; }
	String get_node_title() const override { return "Sample Index"; }
	String get_node_category() const override { return "Utility"; }

	void set_data_type(int p_t);
	int get_data_type() const { return data_type; }
	void set_domain(int p_d) { domain = p_d; }
	int get_domain() const { return domain; }
	void set_clamp(bool p_c) { clamp_index = p_c; }
	bool get_clamp() const { return clamp_index; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;
	SampleIndexNode();
};

} // namespace godot

#endif // PROC_NODES_UTILITY_NODES_H