23 b.add_input<
decl::Bool>(
N_(
"Switch")).default_value(
false).supports_field();
24 b.add_input<
decl::Bool>(
N_(
"Switch"),
"Switch_001").default_value(
false);
28 b.add_input<
decl::Int>(
N_(
"False"),
"False_001").
min(-100000).max(100000).supports_field();
29 b.add_input<
decl::Int>(
N_(
"True"),
"True_001").
min(-100000).max(100000).supports_field();
41 .default_value({0.8f, 0.8f, 0.8f, 1.0f})
44 .default_value({0.8f, 0.8f, 0.8f, 1.0f})
63 b.add_output<
decl::Int>(
N_(
"Output"),
"Output_001").dependent_field();
64 b.add_output<
decl::Bool>(
N_(
"Output"),
"Output_002").dependent_field();
65 b.add_output<
decl::Vector>(
N_(
"Output"),
"Output_003").dependent_field();
66 b.add_output<
decl::Color>(
N_(
"Output"),
"Output_004").dependent_field();
67 b.add_output<
decl::String>(
N_(
"Output"),
"Output_005").dependent_field();
78 uiItemR(layout,
ptr,
"input_type", 0,
"", ICON_NONE);
95 const bool fields_type =
ELEM(
118 node_storage(
node).input_type =
params.socket.type;
119 params.update_and_connect_available_socket(
node,
"Output");
126 params.update_and_connect_available_socket(
node,
"Switch");
131 node_storage(
node).input_type =
params.socket.type;
132 params.update_and_connect_available_socket(
node,
"False");
136 node_storage(
node).input_type =
params.socket.type;
137 params.update_and_connect_available_socket(
node,
"True");
144 if (
params.lazy_require_input(
"Switch")) {
148 const std::string name_false =
"False" + suffix;
149 const std::string name_true =
"True" + suffix;
150 const std::string name_output =
"Output" + suffix;
155 const bool require_false =
params.lazy_require_input(name_false);
156 const bool require_true =
params.lazy_require_input(name_true);
157 if (require_false | require_true) {
165 "Switch", [](
bool condition,
const T &false_value,
const T &true_value) {
166 return condition ? true_value : false_value;
170 std::move(switch_fn),
171 {std::move(switches_field), std::move(falses_field), std::move(trues_field)}));
179 params.set_input_unused(name_false);
180 if (
params.lazy_require_input(name_true)) {
186 params.set_input_unused(name_true);
187 if (
params.lazy_require_input(name_false)) {
197 if (
params.lazy_require_input(
"Switch_001")) {
200 bool switch_value =
params.get_input<
bool>(
"Switch_001");
202 const std::string name_false =
"False" + suffix;
203 const std::string name_true =
"True" + suffix;
204 const std::string name_output =
"Output" + suffix;
207 params.set_input_unused(name_false);
208 if (
params.lazy_require_input(name_true)) {
211 params.set_output(name_output,
params.extract_input<
T>(name_true));
214 params.set_input_unused(name_true);
215 if (
params.lazy_require_input(name_false)) {
218 params.set_output(name_output,
params.extract_input<
T>(name_false));
230 switch_fields<float>(
params,
"");
234 switch_fields<int>(
params,
"_001");
238 switch_fields<bool>(
params,
"_002");
242 switch_fields<float3>(
params,
"_003");
246 switch_fields<ColorGeometry4f>(
params,
"_004");
250 switch_fields<std::string>(
params,
"_005");
254 switch_no_fields<GeometrySet>(
params,
"_006");
258 switch_no_fields<Object *>(
params,
"_007");
262 switch_no_fields<Collection *>(
params,
"_008");
266 switch_no_fields<Tex *>(
params,
"_009");
270 switch_no_fields<Material *>(
params,
"_010");
274 switch_no_fields<Image *>(
params,
"_011");
General operations, lookup, etc. for materials.
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
void nodeRegisterType(struct bNodeType *ntype)
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
bool depends_on_input() const
const FieldNode & node() const
void evaluate_constant_field(const GField &field, void *r_value)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_update(bNodeTree *ntree, bNode *node)
static void node_geo_exec(GeoNodeExecParams params)
void switch_fields(GeoNodeExecParams ¶ms, const StringRef suffix)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
void switch_no_fields(GeoNodeExecParams ¶ms, const StringRef suffix)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
void register_node_type_geo_switch()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
struct bNodeSocket * next
NodeGeometryExecFunction geometry_node_execute
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
bool geometry_node_execute_supports_laziness
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare