| 212 | } |
| 213 | |
| 214 | void |
| 215 | NodeGui::initialize(NodeGraph* dag, |
| 216 | const NodePtr & internalNode) |
| 217 | { |
| 218 | _internalNode = internalNode; |
| 219 | assert(internalNode); |
| 220 | _graph = dag; |
| 221 | |
| 222 | NodeGuiPtr thisAsShared = shared_from_this(); |
| 223 | |
| 224 | internalNode->setNodeGuiPointer(thisAsShared); |
| 225 | |
| 226 | QObject::connect( internalNode.get(), SIGNAL(labelChanged(QString)), this, SLOT(onInternalNameChanged(QString)) ); |
| 227 | QObject::connect( internalNode.get(), SIGNAL(refreshEdgesGUI()), this, SLOT(refreshEdges()) ); |
| 228 | QObject::connect( internalNode.get(), SIGNAL(knobsInitialized()), this, SLOT(initializeKnobs()) ); |
| 229 | QObject::connect( internalNode.get(), SIGNAL(inputsInitialized()), this, SLOT(initializeInputs()) ); |
| 230 | QObject::connect( internalNode.get(), SIGNAL(previewImageChanged(double)), this, SLOT(updatePreviewImage(double)) ); |
| 231 | QObject::connect( internalNode.get(), SIGNAL(previewRefreshRequested(double)), this, SLOT(forceComputePreview(double)) ); |
| 232 | QObject::connect( internalNode.get(), SIGNAL(deactivated(bool)), this, SLOT(deactivate(bool)) ); |
| 233 | QObject::connect( internalNode.get(), SIGNAL(activated(bool)), this, SLOT(activate(bool)) ); |
| 234 | QObject::connect( internalNode.get(), SIGNAL(inputChanged(int)), this, SLOT(connectEdge(int)) ); |
| 235 | QObject::connect( internalNode.get(), SIGNAL(persistentMessageChanged()), this, SLOT(onPersistentMessageChanged()) ); |
| 236 | QObject::connect( internalNode.get(), SIGNAL(allKnobsSlaved(bool)), this, SLOT(onAllKnobsSlaved(bool)) ); |
| 237 | QObject::connect( internalNode.get(), SIGNAL(knobsLinksChanged()), this, SLOT(onKnobsLinksChanged()) ); |
| 238 | QObject::connect( internalNode.get(), SIGNAL(outputsChanged()), this, SLOT(refreshOutputEdgeVisibility()) ); |
| 239 | QObject::connect( internalNode.get(), SIGNAL(previewKnobToggled()), this, SLOT(onPreviewKnobToggled()) ); |
| 240 | QObject::connect( internalNode.get(), SIGNAL(disabledKnobToggled(bool)), this, SLOT(onDisabledKnobToggled(bool)) ); |
| 241 | QObject::connect( internalNode.get(), SIGNAL(streamWarningsChanged()), this, SLOT(onStreamWarningsChanged()) ); |
| 242 | QObject::connect( internalNode.get(), SIGNAL(nodeExtraLabelChanged(QString)), this, SLOT(refreshNodeText(QString)) ); |
| 243 | QObject::connect( internalNode.get(), SIGNAL(outputLayerChanged()), this, SLOT(onOutputLayerChanged()) ); |
| 244 | QObject::connect( internalNode.get(), SIGNAL(hideInputsKnobChanged(bool)), this, SLOT(onHideInputsKnobValueChanged(bool)) ); |
| 245 | QObject::connect( internalNode.get(), SIGNAL(availableViewsChanged()), this, SLOT(onAvailableViewsChanged()) ); |
| 246 | QObject::connect( internalNode.get(), SIGNAL(rightClickMenuKnobPopulated()), this, SLOT(onRightClickMenuKnobPopulated()) ); |
| 247 | QObject::connect( internalNode.get(), SIGNAL(inputEdgeLabelChanged(int, QString)), this, SLOT(onInputLabelChanged(int,QString)) ); |
| 248 | QObject::connect( internalNode.get(), SIGNAL(inputVisibilityChanged(int)), this, SLOT(onInputVisibilityChanged(int)) ); |
| 249 | QObject::connect( this, SIGNAL(previewImageComputed()), this, SLOT(onPreviewImageComputed()) ); |
| 250 | setCacheMode(DeviceCoordinateCache); |
| 251 | |
| 252 | OutputEffectInstance* isOutput = dynamic_cast<OutputEffectInstance*>( internalNode->getEffectInstance().get() ); |
| 253 | if (isOutput) { |
| 254 | QObject::connect ( isOutput->getRenderEngine().get(), SIGNAL(refreshAllKnobs()), _graph, SLOT(refreshAllKnobsGui()) ); |
| 255 | } |
| 256 | |
| 257 | InspectorNode* isInspector = dynamic_cast<InspectorNode*>( internalNode.get() ); |
| 258 | if (isInspector) { |
| 259 | QObject::connect( isInspector, SIGNAL(refreshOptionalState()), this, SLOT(refreshDashedStateOfEdges()) ); |
| 260 | } |
| 261 | |
| 262 | createGui(); |
| 263 | |
| 264 | NodePtr parent = internalNode->getParentMultiInstance(); |
| 265 | if (parent) { |
| 266 | NodeGuiIPtr parentNodeGui_i = parent->getNodeGui(); |
| 267 | NodeGui* parentGui = dynamic_cast<NodeGui*>( parentNodeGui_i.get() ); |
| 268 | assert(parentGui); |
| 269 | if ( parentGui && parentGui->isSettingsPanelVisible() ) { |
| 270 | ensurePanelCreated(); |
| 271 | MultiInstancePanelPtr panel = parentGui->getMultiInstancePanel(); |
no test coverage detected