Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/intern/COM_NodeOperation.cc
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| void NodeOperation::addOutputSocket(DataType datatype) | void NodeOperation::addOutputSocket(DataType datatype) | ||||
| { | { | ||||
| m_outputs.append(NodeOperationOutput(this, datatype)); | m_outputs.append(NodeOperationOutput(this, datatype)); | ||||
| } | } | ||||
| void NodeOperation::determineResolution(unsigned int resolution[2], | void NodeOperation::determineResolution(unsigned int resolution[2], | ||||
| unsigned int preferredResolution[2]) | unsigned int preferredResolution[2]) | ||||
| { | { | ||||
| if (m_resolutionInputSocketIndex < m_inputs.size()) { | unsigned int used_resolution_index = 0; | ||||
| if (m_resolutionInputSocketIndex == RESOLUTION_INPUT_ANY) { | |||||
| for (NodeOperationInput &input : m_inputs) { | |||||
| unsigned int any_resolution[2] = {0, 0}; | |||||
| input.determineResolution(any_resolution, preferredResolution); | |||||
| if (any_resolution[0] * any_resolution[1] > 0) { | |||||
| resolution[0] = any_resolution[0]; | |||||
| resolution[1] = any_resolution[1]; | |||||
| break; | |||||
| } | |||||
| used_resolution_index += 1; | |||||
| } | |||||
| } | |||||
| else if (m_resolutionInputSocketIndex < m_inputs.size()) { | |||||
| NodeOperationInput &input = m_inputs[m_resolutionInputSocketIndex]; | NodeOperationInput &input = m_inputs[m_resolutionInputSocketIndex]; | ||||
| input.determineResolution(resolution, preferredResolution); | input.determineResolution(resolution, preferredResolution); | ||||
| used_resolution_index = m_resolutionInputSocketIndex; | |||||
| } | } | ||||
| unsigned int temp2[2] = {resolution[0], resolution[1]}; | unsigned int temp2[2] = {resolution[0], resolution[1]}; | ||||
| unsigned int temp[2]; | unsigned int temp[2]; | ||||
| for (unsigned int index = 0; index < m_inputs.size(); index++) { | for (unsigned int index = 0; index < m_inputs.size(); index++) { | ||||
| if (index == this->m_resolutionInputSocketIndex) { | if (index == used_resolution_index) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| NodeOperationInput &input = m_inputs[index]; | NodeOperationInput &input = m_inputs[index]; | ||||
| if (input.isConnected()) { | if (input.isConnected()) { | ||||
| input.determineResolution(temp, temp2); | input.determineResolution(temp, temp2); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| NodeOperation &operation = getOperation(); | NodeOperation &operation = getOperation(); | ||||
| if (operation.get_flags().is_resolution_set) { | if (operation.get_flags().is_resolution_set) { | ||||
| resolution[0] = operation.getWidth(); | resolution[0] = operation.getWidth(); | ||||
| resolution[1] = operation.getHeight(); | resolution[1] = operation.getHeight(); | ||||
| } | } | ||||
| else { | else { | ||||
| operation.determineResolution(resolution, preferredResolution); | operation.determineResolution(resolution, preferredResolution); | ||||
| if (resolution[0] > 0 && resolution[1] > 0) { | |||||
| operation.setResolution(resolution); | operation.setResolution(resolution); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operation_flags) | std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operation_flags) | ||||
| { | { | ||||
| if (node_operation_flags.complex) { | if (node_operation_flags.complex) { | ||||
| os << "complex,"; | os << "complex,"; | ||||
| } | } | ||||
| if (node_operation_flags.open_cl) { | if (node_operation_flags.open_cl) { | ||||
| os << "open_cl,"; | os << "open_cl,"; | ||||
| ▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines | |||||