| 1495 | } |
| 1496 | |
| 1497 | void |
| 1498 | NodeGui::initializeInputs() |
| 1499 | { |
| 1500 | ///Also refresh the output position |
| 1501 | if (_outputEdge) { |
| 1502 | _outputEdge->initLine(); |
| 1503 | } |
| 1504 | |
| 1505 | NodePtr node = getNode(); |
| 1506 | |
| 1507 | ///The actual numbers of inputs of the internal node |
| 1508 | const std::vector<NodeWPtr>& inputs = node->getGuiInputs(); |
| 1509 | |
| 1510 | ///Delete all inputs that may exist |
| 1511 | for (InputEdges::iterator it = _inputEdges.begin(); it != _inputEdges.end(); ++it) { |
| 1512 | delete *it; |
| 1513 | } |
| 1514 | _inputEdges.clear(); |
| 1515 | |
| 1516 | |
| 1517 | ///Make new edge for all non existing inputs |
| 1518 | NodeGuiPtr thisShared = shared_from_this(); |
| 1519 | int inputsCount = 0; |
| 1520 | int emptyInputsCount = 0; |
| 1521 | for (U32 i = 0; i < inputs.size(); ++i) { |
| 1522 | Edge* edge = new Edge( i, 0., thisShared, parentItem() ); |
| 1523 | if ( ( node && node->getEffectInstance()->isInputRotoBrush(i) ) || !isVisible() ) { |
| 1524 | edge->setActive(false); |
| 1525 | edge->hide(); |
| 1526 | } |
| 1527 | |
| 1528 | NodePtr input = inputs[i].lock(); |
| 1529 | if (input) { |
| 1530 | NodeGuiIPtr gui_i = input->getNodeGui(); |
| 1531 | assert(gui_i); |
| 1532 | NodeGuiPtr gui = std::dynamic_pointer_cast<NodeGui>(gui_i); |
| 1533 | assert(gui); |
| 1534 | edge->setSource(gui); |
| 1535 | } |
| 1536 | if ( node && |
| 1537 | !node->getEffectInstance()->isInputMask(i) && |
| 1538 | !node->getEffectInstance()->isInputRotoBrush(i) ) { |
| 1539 | if (!input) { |
| 1540 | ++emptyInputsCount; |
| 1541 | } |
| 1542 | ++inputsCount; |
| 1543 | } |
| 1544 | _inputEdges.push_back(edge); |
| 1545 | } |
| 1546 | |
| 1547 | |
| 1548 | refreshDashedStateOfEdges(); |
| 1549 | |
| 1550 | InspectorNode* isInspector = dynamic_cast<InspectorNode*>( node.get() ); |
| 1551 | if (isInspector) { |
| 1552 | initializeInputsForInspector(); |
| 1553 | } else { |
| 1554 | double piDividedbyX = M_PI / (inputsCount + 1); |
no test coverage detected