68 return std::string(prefix,
BLI_strnlen(prefix,
sizeof(prefix)));
73 if (render_layer->
name[0] ==
'\0') {
74 return std::string(render_pass->
name,
78 std::string combined_name =
87 void CryptomatteNode::input_operations_from_render_source(
88 const CompositorContext &
context,
101 if (!render_result) {
105 short view_layer_id = 0;
117 RenderLayersProg *op =
new RenderLayersProg(
119 op->set_scene(
scene);
120 op->set_layer_id(view_layer_id);
121 op->set_render_data(
context.get_render_data());
122 op->set_view_name(
context.get_view_name());
123 r_input_operations.
append(op);
131 void CryptomatteNode::input_operations_from_image_source(
132 const CompositorContext &
context,
134 Vector<NodeOperation *> &r_input_operations)
154 if (iuser->
view == 0) {
178 MultilayerColorOperation *op =
new MultilayerColorOperation(
179 render_layer, render_pass,
view);
180 op->set_image(
image);
181 op->set_image_user(iuser);
182 iuser->
layer = layer_index;
183 op->set_framenumber(
context.get_framenumber());
184 r_input_operations.append(op);
193 Vector<NodeOperation *> CryptomatteNode::create_input_operations(
const CompositorContext &
context,
196 Vector<NodeOperation *> input_operations;
197 switch (
node.custom1) {
199 input_operations_from_render_source(
context,
node, input_operations);
202 input_operations_from_image_source(
context,
node, input_operations);
206 if (input_operations.is_empty()) {
207 SetColorOperation *op =
new SetColorOperation();
208 op->set_channel1(0.0f);
209 op->set_channel2(1.0f);
210 op->set_channel3(0.0f);
211 op->set_channel4(0.0f);
212 input_operations.append(op);
214 return input_operations;
227 for (
int i = 0; i < input_operations.
size(); ++i) {
246 const int num_inputs =
inputs_.size() - 1;
248 if (cryptomatte_settings) {
254 for (
int i = 0; i < num_inputs; i++) {
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
#define CMP_CRYPTOMATTE_SRC_RENDER
#define CMP_CRYPTOMATTE_SRC_IMAGE
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count_at_most(const struct ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findstringindex(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void append(const T &value)
Overall context of the compositor.
virtual CryptomatteOperation * create_cryptomatte_operation(NodeConverter &converter, const CompositorContext &context, const bNode &node, const NodeCryptomatte *cryptomatte_settings) const =0
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
CryptomatteOperation * create_cryptomatte_operation(NodeConverter &converter, const CompositorContext &context, const bNode &node, const NodeCryptomatte *cryptomatte_settings) const override
CryptomatteOperation * create_cryptomatte_operation(NodeConverter &converter, const CompositorContext &context, const bNode &node, const NodeCryptomatte *cryptomatte_settings) const override
void add_object_index(float object_index)
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void add_input_value(NodeOperationInput *input, float value)
void add_operation(NodeOperation *operation)
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
NodeOperationOutput * get_output_socket(unsigned int index=0)
NodeOperationInput * get_input_socket(unsigned int index)
NodeOutput are sockets that can send data/input.
NodeOutput * get_output_socket(unsigned int index=0) const
bNode * get_bnode() const
get the reference to the SDNA bNode struct
NodeInput * get_input_socket(unsigned int index) const
Vector< NodeInput * > inputs_
the list of actual input-sockets
void set_channel(int channel)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
static std::string combined_layer_pass_name(RenderLayer *render_layer, RenderPass *render_pass)
static std::string prefix_from_node(const CompositorContext &context, const bNode &node)
void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, const bNode *node, char *r_prefix, size_t prefix_len)
RenderResult * RE_AcquireResultRead(Render *re)
Render * RE_GetSceneRender(const Scene *scene)
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
void RE_ReleaseResult(Render *re)