35 const char **r_disabled_hint)
38 *r_disabled_hint =
RPT_(
"Not a shader node tree");
46 const char **r_disabled_hint)
48 if (!
STR_ELEM(ntree->
idname,
"ShaderNodeTree",
"GeometryNodeTree")) {
49 *r_disabled_hint =
RPT_(
"Not a shader or geometry node tree");
57 const char **r_disabled_hint)
59 if (!
STR_ELEM(ntree->
idname,
"ShaderNodeTree",
"GeometryNodeTree",
"CompositorNodeTree")) {
60 *r_disabled_hint =
RPT_(
"Not a shader, geometry, or compositor node tree");
68 const std::optional<int16_t> legacy_type)
79 const std::optional<int16_t> legacy_type)
90 const std::optional<int16_t> legacy_type)
130 return STREQ(engine_type->
idname,
"BLENDER_EEVEE") ||
138 const float *from = ns->
vec;
153 *
in = (from[0] + from[1] + from[2]) / 3.0f;
156 *
in = (from[0] + from[1] + from[2] + from[3]) / 4.0f;
255 const float eul[3] = {from[0], from[0], from[0]};
297 gs->
value = std::monostate{};
311 switch (socket->
type) {
318 gs->
value = int(vec.x);
322 gs->
value = vec.x > 0.0f;
350 gs->
value = std::monostate{};
354 gs->
value = std::monostate{};
373 vec.x = std::get<float>(gs->
value);
382 vec =
float4(std::get<float2>(gs->
value), 0.0f, 0.0f);
388 vec = std::get<float4>(gs->
value);
399 ListBaseT<bNodeSocket> *sockets,
428 switch (sub_activity) {
441 bNode *inactivenode =
nullptr, *activetexnode =
nullptr, *activegroup =
nullptr;
442 bool hasgroup =
false;
449 if (
node->flag & sub_activity) {
450 activetexnode =
node;
479 return activetexnode;
487 if (tnode && ((tnode->
flag & sub_activity) || !inactivenode)) {
513 const int *depth_level)
526 for (n = 0, nodeexec = exec->
nodeexec; n < exec->totnodes; n++, nodeexec++) {
529 if (depth_level &&
node->runtime->tmp_flag != *depth_level) {
536 if ((output_node !=
nullptr) && (
node == output_node)) {
541 do_it =
node->runtime->need_exec;
542 node->runtime->need_exec = 0;
547 if (
node->typeinfo->gpu_fn) {
551 if (
node->typeinfo->gpu_fn(mat,
node, &nodeexec->
data, gpuin, gpuout)) {
561 GPU_link(mat,
"differentiate_texco", *link, link);
585 GPUNodeLink *tmin, *tmax, *tmat0, *tmat1, *tmat2, *tmat3;
594 GPU_link(mat,
"mapping_mat4",
in[0].link, tmat0, tmat1, tmat2, tmat3, tmin, tmax, &
in[0].link);
597 GPU_link(mat,
"vector_normalize",
in[0].link, &
in[0].link);
618 static Set<UString> skip_socket_identifiers = {
"Weight"_ustr};
625 "LightIndex"_ustr,
"ShaderZoneIO"_ustr,
"Weight"_ustr};
#define NODE_CLASS_OUTPUT
#define NODE_CLASS_TEXTURE
#define SH_NODE_TEX_IMAGE
#define SH_NODE_ATTRIBUTE
#define BLI_assert_unreachable()
bNode * node_get_active(bNodeTree &ntree)
bNode * node_get_active_texture(bNodeTree &ntree)
void node_type_base(bNodeType &ntype, UString idname, std::optional< int16_t > legacy_type=std::nullopt)
bNode * node_get_active_paint_canvas(bNodeTree &ntree)
bool node_supports_active_flag(const bNode &node, int sub_activity)
Does the given node supports the sub active flag.
void search_link_ops_for_basic_node(GatherLinkSearchOpParams ¶ms)
void search_filtered_link_ops_for_basic_node(GatherLinkSearchOpParams ¶ms, const Set< UString > &skip_socket_identifiers)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ NODE_ACTIVE_PAINT_CANVAS
void node_gpu_stack_from_data(GPUNodeStack *gs, bNodeSocket *socket, bNodeStack *ns)
bool object_shader_nodes_poll(const bContext *C)
MINLINE void copy_v3_v3(float r[3], const float a[3])
bool sh_node_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
bool object_cycles_shader_nodes_poll(const bContext *C)
static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBaseT< bNodeSocket > *sockets, bNodeStack **ns)
MINLINE void copy_v4_fl(float r[4], float f)
static void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
RenderEngineType * CTX_data_engine_type(const bContext *C)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static void data_from_gpu_stack_list(ListBaseT< bNodeSocket > *sockets, bNodeStack **ns, GPUNodeStack *gs)
GPUNodeLink * GPU_uniform(const float *num)
MINLINE bool is_zero_v4(const float v[4]) ATTR_WARN_UNUSED_RESULT
static bool sh_geo_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
VecBase< float, 4 > float4
void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
bool line_style_shader_nodes_poll(const bContext *C)
void sh_geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
VecBase< float, 2 > float2
bool GPU_link(GPUMaterial *mat, const char *name,...)
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *)
BMesh const char void * data
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void search_link_ops_for_shader_bsdf_node(nodes::GatherLinkSearchOpParams ¶ms)
void eul_to_quat(float quat[4], const float eul[3])
bool world_shader_nodes_poll(const bContext *C)
SpaceNode * CTX_wm_space_node(const bContext *C)
bool node_insert_link_default(bke::NodeInsertLinkParams &)
bool object_eevee_shader_nodes_poll(const bContext *C)
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data)
MatBase< float, 3, 3 > float3x3
void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *, GPUNodeLink **link)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
MINLINE void copy_v3_fl(float r[3], float f)
float3x3 IMB_colormanagement_get_xyz_to_scene_linear()
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
MINLINE void copy_v4_v4(float r[4], const float a[4])
VecBase< float, 3 > float3
void search_link_ops_for_shader_material_lighting_node(nodes::GatherLinkSearchOpParams ¶ms)
void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack **out)
static bool common_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node, const int *depth_level)
void common_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
color xyz_to_rgb(float x, float y, float z)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eSpaceNode_ShaderFrom shaderfrom
bool(*) poll(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
bool(*) insert_link(NodeInsertLinkParams ¶ms)