48 {
SOCK_RGBA,
N_(
"Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
49 {
SOCK_FLOAT,
N_(
"Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
81#define NUM_LEGACY_SOCKETS (ARRAY_SIZE(cmp_node_rlayers_out) - 1)
97 if (sock && sock->
type != type) {
103 if (sock ==
nullptr) {
104 if (rres_index >= 0) {
123 const int after_index = (*prev_index)++;
161 if (rpass->channels == 1) {
234 if (scene ==
nullptr || view_layer ==
nullptr || data ==
nullptr || node->id != (
ID *)scene) {
239 if (node_view_layer != view_layer) {
246 ntree, node,
"Image", name, -1, type,
true, data->available_sockets, &data->prev_index);
254 data->available_sockets,
259 ntree, node, name, name, -1, type,
true, data->available_sockets, &data->prev_index);
292 "render layer update data");
294 data->prev_index = -1;
295 node->storage =
data;
312 node->storage =
nullptr;
366 for (sock = (
bNodeSocket *)node->outputs.first; sock; sock = sock_next, sock_index++) {
367 sock_next = sock->
next;
369 sock->
flag &= ~SOCK_HIDDEN;
406 ImageUser *iuser = MEM_cnew<ImageUser>(__func__);
407 node->storage = iuser;
428 const bNode *src_node)
434 while (dest_output_sock !=
nullptr) {
437 src_output_sock = src_output_sock->
next;
438 dest_output_sock = dest_output_sock->
next;
466 result.allocate_invalid();
471 if (identifier ==
"Alpha") {
511 ntype.
initfunc = file_ns::node_composit_init_image;
513 &ntype,
"ImageUser", file_ns::node_composit_free_image, file_ns::node_composit_copy_image);
514 ntype.
updatefunc = file_ns::cmp_node_image_update;
547 node->id = &scene->id;
551 sock = sock->next, sock_index++)
554 sock->storage = sockdata;
562 const char **r_disabled_hint)
565 *r_disabled_hint =
RPT_(
"Not a compositor node tree");
576 if (scene->nodetree == ntree) {
581 if (scene ==
nullptr) {
582 *r_disabled_hint =
RPT_(
583 "The node tree must be the compositing node tree of any scene in the file");
601 const bNode *src_node)
606 while (dest_output_sock !=
nullptr) {
609 src_output_sock = src_output_sock->
next;
610 dest_output_sock = dest_output_sock->
next;
637 const char *layer_name;
678 execute_pass(image_result, combined_texture,
"compositor_read_input_color");
681 execute_pass(alpha_result, combined_texture,
"compositor_read_input_alpha");
687 if (
STR_ELEM(output->identifier,
"Image",
"Alpha")) {
692 if (!result.should_compute()) {
697 scene, view_layer, output->identifier, result.meta_data);
700 scene, view_layer, output->identifier);
702 execute_pass(result, pass_texture,
"compositor_read_input_float");
705 execute_pass(result, pass_texture,
"compositor_read_input_vector");
708 execute_pass(result, pass_texture,
"compositor_read_input_color");
718 if (pass_texture ==
nullptr) {
720 result.allocate_invalid();
725 if (!
context().is_valid_compositing_region()) {
726 result.allocate_invalid();
737 const int2 lower_bound =
int2(compositing_region.
xmin, compositing_region.
ymin);
743 result.set_precision(precision);
746 result.allocate_texture(
Domain(compositing_region_size));
747 result.bind_as_image(shader,
"output_img");
753 result.unbind_as_image();
772 ntype.
draw_buttons = file_ns::node_composit_buts_viewlayers;
773 ntype.
initfunc_api = file_ns::node_composit_init_rlayers;
774 ntype.
poll = file_ns::node_composit_poll_rlayers;
777 "Render passes not supported in the Viewport compositor");
780 &ntype,
nullptr, file_ns::node_composit_free_rlayers, file_ns::node_composit_copy_rlayers);
781 ntype.
updatefunc = file_ns::cmp_node_rlayers_update;
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 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_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY(dst, src)
@ FREESTYLE_AS_RENDER_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_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_DIFFUSE_DIRECT
#define RE_PASSNAME_INDEXOB
int GPU_shader_get_sampler_binding(GPUShader *shader, const char *name)
void GPU_shader_uniform_2iv(GPUShader *sh, const char *name, const int data[2])
void GPU_shader_bind(GPUShader *shader)
void GPU_texture_bind(GPUTexture *texture, int unit)
void GPU_texture_unbind(GPUTexture *texture)
eGPUTextureFormat GPU_texture_format(const GPUTexture *texture)
void uiItemFullO(uiLayout *layout, const char *opname, const char *name, int icon, IDProperty *properties, wmOperatorCallContext context, eUI_Item_Flag flag, PointerRNA *r_opptr)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, const char *text=nullptr)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
struct GPUShader GPUShader
DOutputSocket output_by_identifier(StringRef identifier) const
ImageUser * get_image_user()
void compute_output(StringRef identifier)
const char * get_pass_name(StringRef identifier)
void execute_pass(Result &result, GPUTexture *pass_texture, const char *shader_name)
Result * get(Context &context, Image *image, const ImageUser *image_user, const char *pass_name)
virtual rcti get_compositing_region() const =0
StaticCacheManager & cache_manager()
GPUShader * get_shader(const char *info_name, ResultPrecision precision)
int2 get_compositing_region_size() const
virtual void set_info_message(StringRef message) const =0
virtual GPUTexture * get_input_texture(const Scene *scene, int view_layer, const char *pass_name)=0
virtual void populate_meta_data_for_pass(const Scene *scene, int view_layer_id, const char *pass_name, MetaData &meta_data) const
NodeOperation(Context &context, DNode node)
bool should_compute_output(StringRef identifier)
const bNode & bnode() const
const DNode & node() const
Result & get_result(StringRef identifier)
Context & context() const
ResultPrecision precision() const
void pass_through(Result &target)
bool is_allocated() const
CachedImageContainer cached_images
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_freeN(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size)
bNodeSocket * node_add_static_socket(bNodeTree *ntree, bNode *node, eNodeSocketInOut in_out, int type, int subtype, const char *identifier, const char *name)
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
void node_remove_socket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
void node_set_socket_availability(bNodeTree *ntree, bNodeSocket *sock, bool is_available)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
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 cmp_node_rlayers_update(bNodeTree *ntree, bNode *node)
static bool node_composit_poll_rlayers(const blender::bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
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)
void extract_alpha(Context &context, Result &input, Result &output)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< int32_t, 2 > int2
static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node, LinkNodePair *available_sockets)
void register_node_type_cmp_image()
static blender::bke::bNodeSocketTemplate cmp_node_rlayers_out[]
void register_node_type_cmp_rlayers()
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 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, int type, const char *name, short nclass)
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)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
LinkNodePair * available_sockets
void(* update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
struct FreestyleConfig freestyle_config
struct bNodeSocket * next
Compact definition of a node socket.
const char * realtime_compositor_unsupported_message
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
bool(* poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void(* initfunc_api)(const bContext *C, PointerRNA *ptr)