Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/intern/COM_NodeOperationBuilder.cc
| Show First 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | if (link.from() == output) { | ||||
| inputs.append(link.to()); | inputs.append(link.to()); | ||||
| } | } | ||||
| } | } | ||||
| return inputs; | return inputs; | ||||
| } | } | ||||
| WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation( | WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation( | ||||
| NodeOperationOutput *output) const | NodeOperationOutput *output) const | ||||
| { | { | ||||
manzanilla: When connecting two operations that inherit from WriteBufferOperation, ReadBufferOperation is… | |||||
| for (const Link &link : m_links) { | for (const Link &link : m_links) { | ||||
| if (link.from() == output) { | if (link.from() == output) { | ||||
| NodeOperation &op = link.to()->getOperation(); | NodeOperation &op = link.to()->getOperation(); | ||||
| if (op.get_flags().is_write_buffer_operation) { | if (op.get_flags().is_write_buffer_operation) { | ||||
| return (WriteBufferOperation *)(&op); | return (WriteBufferOperation *)(&op); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* cache connected sockets, so we can safely remove links first before replacing them */ | /* cache connected sockets, so we can safely remove links first before replacing them */ | ||||
| Vector<NodeOperationInput *> targets = cache_output_links(output); | Vector<NodeOperationInput *> targets = cache_output_links(output); | ||||
| if (targets.is_empty()) { | if (targets.is_empty()) { | ||||
| return; | return; | ||||
| } | } | ||||
| WriteBufferOperation *writeOperation = nullptr; | WriteBufferOperation *writeOperation = nullptr; | ||||
| /* Check if the current operation can handle writing to buffer. | |||||
| * If this is the case we don't need to add a separate write buffer operation. */ | |||||
| if (operation->get_flags().is_write_buffer_operation) { | |||||
| writeOperation = static_cast<WriteBufferOperation *>(operation); | |||||
| writeOperation->setbNodeTree(m_context->getbNodeTree()); | |||||
| } | |||||
| for (NodeOperationInput *target : targets) { | for (NodeOperationInput *target : targets) { | ||||
| /* try to find existing write buffer operation */ | /* Try to find existing write buffer operation. Don't select complex write buffer operation as | ||||
| if (target->getOperation().get_flags().is_write_buffer_operation) { | * they are complex operations that handle their own writing, but haven't been isolated with | ||||
| * read operators. */ | |||||
| NodeOperationFlags target_flags = target->getOperation().get_flags(); | |||||
| if (target_flags.is_write_buffer_operation && !target_flags.complex) { | |||||
| BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */ | BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */ | ||||
| writeOperation = (WriteBufferOperation *)(&target->getOperation()); | writeOperation = (WriteBufferOperation *)(&target->getOperation()); | ||||
| } | } | ||||
| else { | else { | ||||
| /* remove all links to other nodes */ | /* remove all links to other nodes */ | ||||
| removeInputLink(target); | removeInputLink(target); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines | |||||
When connecting two operations that inherit from WriteBufferOperation, ReadBufferOperation is not added in between. Causes issues. This code fixes it:
NodeOperation &output_op = output->getOperation(); if (output_op.get_flags().is_write_buffer_operation) { return (WriteBufferOperation *)&output_op; }