13#include "RNA_prototypes.hh"
37 b.use_custom_socket_order();
38 b.allow_any_socket_order();
40 b.add_default_layout();
52 auto &panel =
b.add_panel(
"Attributes"_ustr).default_closed(
true);
53 if (
node !=
nullptr) {
62 const UString output_identifier(
68 panel.add_output(data_type, name, output_identifier).align_with_previous();
73 const UString alpha_name(std::string(name.
c_str()) +
" Alpha");
74 const UString alpha_output_identifier(
76 panel.add_output(
CD_PROP_FLOAT, alpha_name, alpha_output_identifier);
80 panel.add_input<
decl::Extend>(
""_ustr,
"__extend__"_ustr)
81 .custom_draw(socket_items::ui::draw_extend_socket_fn<RaycastSampleAttributeItemsAccessor>());
82 panel.add_output<
decl::Extend>(
""_ustr,
"__extend__"_ustr).align_with_previous();
112 C,
"sample_attribute_items",
false,
IFACE_(
"Sample Attributes")))
114 socket_items::ui::draw_items_list_with_operators<RaycastSampleAttributeItemsAccessor>(
115 C, panel, tree,
node);
116 socket_items::ui::draw_active_item_props<RaycastSampleAttributeItemsAccessor>(
118 panel->use_property_split_set(
true);
119 panel->use_property_decorate_set(
false);
120 panel->prop(item_ptr,
"data_type",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
133 if (
storage.sample_attribute_items_num == 0) {
138 row.
text =
RPT_(
"Attributes Not Supported");
139 row.
tooltip =
TIP_(
"Accessing attributes is not supported by EEVEE renderer");
140 row.
icon = ICON_STATUS_ERROR;
141 parameters.
rows.append(std::move(row));
160 dst_node->
storage = dst_storage;
197 static const float ZERO[4] = {0.0f, 0.0f, 0.0f, 0.0f};
199 const UString output_identifier(
205 const UString alpha_output_identifier(
212 const bool only_local =
node->custom1;
213 const char *shader_name = only_local ?
"node_raycast_only_local" :
"node_raycast";
235 return get_output_default(socket_out_->identifier, NodeItem::Type::Any);
251 ntype.
ui_description =
"Cast rays and retrieve information from the hit point";
254 ntype.
initfunc = file_ns::node_shader_init;
260 ntype.
declare = file_ns::node_declare;
261 ntype.
gpu_fn = file_ns::node_shader_gpu;
268 ntype,
"NodeShaderRaycast", file_ns::node_free_storage, file_ns::node_copy_storage);
#define NODE_STORAGE_FUNCS(StorageT)
const char * c_str() const
StringRefNull ref() const
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
static void node_free_storage(bNode *node)
static void node_shader_buts(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_shader_init(bNodeTree *, bNode *node)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void node_extra_info(NodeExtraInfoParams ¶meters)
static void node_operators()
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
static int node_shader_gpu(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
void make_common_operators()
void blend_write(BlendWriter *writer, const bNode &node)
void destruct_array(bNode &node)
void blend_read_data(BlendDataReader *reader, bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
bool try_add_item_via_any_extend_socket(bNodeTree &ntree, bNode &extend_node, bNode &storage_node, bNodeLink &link, const std::optional< StringRef > socket_identifier=std::nullopt, typename Accessor::ItemT **r_new_item=nullptr)
@ ITEM_R_SPLIT_EMPTY_NAME
bool object_shader_nodes_poll(const bContext *C)
GPUNodeLink * GPU_node_get_input_link(const bNode &node, GPUNodeStack inputs[], StringRef identifier)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const char * RE_engine_id_BLENDER_EEVEE
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
BMesh const char void * data
GPUNodeStack & GPU_node_get_output(const bNode &node, GPUNodeStack outputs[], StringRef identifier)
void register_node_type_sh_raycast()
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_shading_data()
GPUNodeLink * GPU_kernel_globals()
Scene * CTX_data_scene(const bContext *C)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void write_string(const char *data)
NodeMaterialXFunction materialx_fn
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
NodeBlendWriteFunction blend_write_storage_content
void(*) register_operators()
std::string ui_description
NodeBlendDataReadFunction blend_data_read_storage_content
NodeGPUExecFunction gpu_fn
NodeExtraInfoFunction get_extra_info
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
bool(*) add_ui_poll(const bContext *C)
bool(*) insert_link(NodeInsertLinkParams ¶ms)
static StructRNA ** item_srna
static std::string output_socket_identifier_for_item_alpha(const NodeRaycastSampleAttributeItem &item)
NodeRaycastSampleAttributeItem ItemT
static std::string input_socket_identifier_for_item(const NodeRaycastSampleAttributeItem &item)
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static std::string output_socket_identifier_for_item(const NodeRaycastSampleAttributeItem &item)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)