55 {
SOCK_RGBA,
N_(
"Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
56 {
SOCK_FLOAT,
N_(
"Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
88#define NUM_LEGACY_SOCKETS (ARRAY_SIZE(cmp_node_rlayers_out) - 1)
110 if (
STREQ(
name,
"Transmission Direct")) {
113 if (
STREQ(
name,
"Transmission Indirect")) {
141 return "GreasePencil";
153 const char *passname,
164 if (sock ==
nullptr) {
177 if (sock && sock->
type != type) {
183 if (sock ==
nullptr) {
184 if (rres_index >= 0) {
203 const int after_index = (*prev_index)++;
335 if (scene ==
nullptr || view_layer ==
nullptr ||
data ==
nullptr || node->
id != (
ID *)scene) {
340 if (node_view_layer != view_layer) {
347 ntree, node,
"Image",
name, -1, type,
true,
data->available_sockets, &
data->prev_index);
355 data->available_sockets,
360 ntree, node,
name,
name, -1, type,
true,
data->available_sockets, &
data->prev_index);
393 data->available_sockets = available_sockets;
394 data->prev_index = -1;
472 sock_next = sock->
next;
532 const bNode *src_node)
538 while (dest_output_sock !=
nullptr) {
541 src_output_sock = src_output_sock->
next;
542 dest_output_sock = dest_output_sock->
next;
575 result.allocate_invalid();
586 result.wrap_external(cached_image);
626 ntype.
initfunc = file_ns::node_composit_init_image;
628 ntype,
"ImageUser", file_ns::node_composit_free_image, file_ns::node_composit_copy_image);
629 ntype.
updatefunc = file_ns::cmp_node_image_update;
663 node->
id = &scene->
id;
667 sock = sock->next, sock_index++)
670 sock->storage = sockdata;
688 const bNode *src_node)
693 while (dest_output_sock !=
nullptr) {
696 src_output_sock = src_output_sock->
next;
697 dest_output_sock = dest_output_sock->
next;
720 row = &
col->row(
true);
724 const char *layer_name;
745 row.
text =
RPT_(
"Node Unsupported");
746 row.
tooltip =
TIP_(
"The Render Layers node is only supported for scene compositing");
747 row.
icon = ICON_ERROR;
761 bool is_any_pass_used =
false;
767 if (
output->is_logically_linked()) {
768 is_any_pass_used =
true;
773 if (!is_any_pass_used) {
778 row.
text =
RPT_(
"Passes Not Supported");
779 row.
tooltip =
TIP_(
"Render passes in the Viewport compositor are only supported in EEVEE");
780 row.
icon = ICON_ERROR;
819 if (!
result.should_compute()) {
835 result.allocate_invalid();
839 if (!this->
context().is_valid_compositing_region()) {
840 result.allocate_invalid();
851 if (this->
context().use_gpu()) {
873 result.bind_as_image(shader,
"output_img");
886 return "compositor_read_input_alpha";
889 switch (pass.
type()) {
891 return "compositor_read_input_float";
895 return "compositor_read_input_float4";
925 result.store_pixel(texel, pass.load_pixel<float4>(texel + lower_bound).w);
930 result.store_pixel_generic_type(texel, pass.load_pixel_generic_type(texel + lower_bound));
957 ntype.
ui_name =
"Render Layers";
962 ntype.
draw_buttons = file_ns::node_composit_buts_viewlayers;
963 ntype.
initfunc_api = file_ns::node_composit_init_rlayers;
968 file_ns::node_composit_free_rlayers,
969 file_ns::node_composit_copy_rlayers);
970 ntype.
updatefunc = file_ns::cmp_node_rlayers_update;
SpaceNode * CTX_wm_space_node(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
int BKE_image_sequence_guess_offset(Image *image)
#define CMP_NODE_R_LAYERS
#define BLI_assert_unreachable()
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
void void void void BLI_linklist_append(LinkNodePair *list_pair, void *ptr) ATTR_NONNULL(1)
int BLI_linklist_index(const LinkNode *list, const void *ptr) ATTR_WARN_UNUSED_RESULT
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * STRNCPY(char(&dst)[N], const char *src)
#define STRNCPY_UTF8(dst, src)
@ FREESTYLE_AS_RENDER_PASS
@ GREASE_PENCIL_AS_SEPARATE_PASS
#define RE_PASSNAME_COMBINED
#define RE_PASSNAME_DIFFUSE_INDIRECT
#define RE_PASSNAME_INDEXMA
#define RE_PASSNAME_SUBSURFACE_DIRECT
#define RE_PASSNAME_NORMAL
#define RE_PASSNAME_TRANSM_DIRECT
#define RE_PASSNAME_VECTOR
#define RE_PASSNAME_TRANSM_COLOR
#define RE_PASSNAME_SUBSURFACE_INDIRECT
#define RE_PASSNAME_GLOSSY_COLOR
#define RE_PASSNAME_SUBSURFACE_COLOR
#define RE_PASSNAME_DEPTH
#define RE_PASSNAME_TRANSM_INDIRECT
#define RE_PASSNAME_GLOSSY_DIRECT
#define RE_PASSNAME_SHADOW
#define RE_PASSNAME_ENVIRONMENT
#define RE_PASSNAME_POSITION
#define RE_PASSNAME_DIFFUSE_COLOR
#define RE_PASSNAME_GLOSSY_INDIRECT
#define RE_PASSNAME_DEPRECATED
#define RE_PASSNAME_FREESTYLE
#define RE_PASSNAME_GREASE_PENCIL
#define RE_PASSNAME_DIFFUSE_DIRECT
#define RE_PASSNAME_INDEXOB
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_2iv(blender::gpu::Shader *sh, const char *name, const int data[2])
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, blender::StringRefNull propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, std::optional< blender::StringRef > text=std::nullopt)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
BMesh const char void * data
void append(const T &value)
constexpr const char * data() const
Result get(Context &context, Image *image, const ImageUser *image_user, const char *pass_name)
StaticCacheManager & cache_manager()
virtual void populate_meta_data_for_pass(const Scene *scene, int view_layer_id, const char *pass_name, MetaData &meta_data) const
virtual Result get_pass(const Scene *scene, int view_layer, const char *name)
virtual Bounds< int2 > get_compositing_region() const =0
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
const DNode & node() const
const bNode & bnode() const
bool should_compute_output(StringRef identifier)
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
void allocate_texture(const Domain domain, const bool from_pool=true, const std::optional< ResultStorageType > storage_type=std::nullopt)
void unbind_as_texture() const
bool is_allocated() const
static bool is_single_value_only_type(ResultType type)
static ResultType type(blender::gpu::TextureFormat format)
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
static ResultPrecision precision(blender::gpu::TextureFormat format)
CachedImageContainer cached_images
ImageUser * get_image_user()
void compute_output(StringRef identifier)
const char * get_pass_name(StringRef identifier)
NodeOperation(Context &context, DNode node)
void execute_pass_gpu(const Result &pass, Result &result)
const char * get_shader_name(const Result &pass, const Result &result)
const char * get_pass_name(StringRef identifier)
void execute_pass(const Result &pass, Result &result)
NodeOperation(Context &context, DNode node)
void execute_pass_cpu(const Result &pass, Result &result)
void RE_engine_update_render_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer, update_render_passes_cb_t callback, void *callback_data)
RenderEngineType * RE_engines_find(const char *idname)
RenderEngine * RE_engine_create(RenderEngineType *type)
void RE_engine_free(RenderEngine *engine)
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
bool is_viewport_compositor_used(const bContext &context)
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
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))
void node_type_size_preset(bNodeType &ntype, eNodeSizePreset size)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
void extract_alpha(Context &context, Result &input, Result &output)
void parallel_for(const int2 range, const Function &function)
bool is_socket_available(const bNodeSocket *socket)
static void node_composit_free_image(bNode *node)
static void node_composit_copy_image(bNodeTree *, bNode *dest_node, const bNode *src_node)
static void cmp_node_image_update(bNodeTree *ntree, bNode *node)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void node_composit_init_image(bNodeTree *ntree, bNode *node)
static void node_extra_info(NodeExtraInfoParams ¶meters)
static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node)
static void node_composit_free_rlayers(bNode *node)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void node_composit_copy_rlayers(bNodeTree *, bNode *dest_node, const bNode *src_node)
static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr)
VecBase< int32_t, 2 > int2
static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node, LinkNodePair *available_sockets)
static void register_node_type_cmp_rlayers()
static eNodeSocketDatatype socket_type_from_pass(const RenderPass *pass)
static blender::bke::bNodeSocketTemplate cmp_node_rlayers_out[]
static const char * cmp_node_legacy_pass_name(const char *name)
void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, ViewLayer *view_layer, const char *name, eNodeSocketDatatype type)
static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNodePair *available_sockets)
static void register_node_type_cmp_image()
static void cmp_node_image_add_pass_output(bNodeTree *ntree, bNode *node, const char *name, const char *passname, int rres_index, eNodeSocketDatatype type, int, LinkNodePair *available_sockets, int *prev_index)
void node_cmp_rlayers_outputs(bNodeTree *ntree, bNode *node)
static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node, bool rlayer)
#define NUM_LEGACY_SOCKETS
const char * node_cmp_rlayers_sock_to_pass(int sock_index)
static void cmp_node_rlayer_create_outputs_cb(void *userdata, Scene *scene, ViewLayer *view_layer, const char *name, int, const char *, eNodeSocketDatatype type)
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void cmp_node_update_default(bNodeTree *, bNode *node)
bNodeSocket * node_add_socket_from_template(bNodeTree *ntree, bNode *node, bke::bNodeSocketTemplate *stemp, eNodeSocketInOut in_out)
void node_image_label(const bNodeTree *, const bNode *node, char *label, int label_maxncpy)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
const char * RE_engine_id_BLENDER_EEVEE
LinkNodePair * available_sockets
void(* update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
struct FreestyleConfig freestyle_config
struct bNodeSocket * next
bNodeRuntimeHandle * runtime
Compact definition of a node socket.
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
NodeExtraInfoFunction get_extra_info
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void(* initfunc_api)(const bContext *C, PointerRNA *ptr)
uiLayout & column(bool align)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)