84 return std::string(prefix,
BLI_strnlen(prefix,
sizeof(prefix)));
89 if (render_layer->
name[0] ==
'\0') {
90 return std::string(render_pass->
name,
94 std::string combined_name =
100 return combined_name;
103 void CryptomatteNode::input_operations_from_render_source(
104 const CompositorContext &
context,
117 if (!render_result) {
121 short view_layer_id = 0;
129 RenderLayersProg *op =
new RenderLayersProg(
132 op->setLayerId(view_layer_id);
133 op->setRenderData(
context.getRenderData());
134 op->setViewName(
context.getViewName());
135 r_input_operations.
append(op);
143 void CryptomatteNode::input_operations_from_image_source(
144 const CompositorContext &
context,
146 Vector<NodeOperation *> &r_input_operations)
166 if (iuser->
view == 0) {
190 MultilayerColorOperation *op =
new MultilayerColorOperation(
191 render_layer, render_pass,
view);
193 op->setImageUser(iuser);
194 iuser->
layer = layer_index;
195 op->setFramenumber(
context.getFramenumber());
196 r_input_operations.append(op);
205 Vector<NodeOperation *> CryptomatteNode::create_input_operations(
const CompositorContext &
context,
208 Vector<NodeOperation *> input_operations;
209 switch (
node.custom1) {
211 input_operations_from_render_source(
context,
node, input_operations);
214 input_operations_from_image_source(
context,
node, input_operations);
218 if (input_operations.is_empty()) {
219 SetColorOperation *op =
new SetColorOperation();
220 op->setChannel1(0.0f);
221 op->setChannel2(1.0f);
222 op->setChannel3(0.0f);
223 op->setChannel4(0.0f);
224 input_operations.append(op);
226 return input_operations;
239 for (
int i = 0; i < input_operations.
size(); ++i) {
257 const int num_inputs =
inputs.size() - 1;
259 if (cryptomatte_settings) {
265 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)
void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, const bNode *node, char *r_prefix, size_t prefix_len)
#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, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_strnlen(const char *str, const 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 convertToOperations(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 addObjectIndex(float objectIndex)
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void addInputValue(NodeOperationInput *input, float value)
void addOperation(NodeOperation *operation)
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void addLink(NodeOperationOutput *from, NodeOperationInput *to)
NodeOperationInput * getInputSocket(unsigned int index)
NodeOperationOutput * getOutputSocket(unsigned int index=0)
NodeOutput are sockets that can send data/input.
Vector< NodeInput * > inputs
the list of actual input-sockets
NodeOutput * getOutputSocket(const unsigned int index=0) const
bNode * getbNode() const
get the reference to the SDNA bNode struct
NodeInput * getInputSocket(const unsigned int index) const
void setChannel(int channel)
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)
RenderResult * RE_AcquireResultRead(Render *re)
Render * RE_GetSceneRender(const Scene *scene)
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
void RE_ReleaseResult(Render *re)