| 1089 | } |
| 1090 | |
| 1091 | int |
| 1092 | Node::disconnectInput(int inputNumber) |
| 1093 | { |
| 1094 | assert(_imp->inputsInitialized); |
| 1095 | |
| 1096 | NodePtr inputShared; |
| 1097 | bool useGuiValues = isNodeRendering(); |
| 1098 | bool destroyed; |
| 1099 | { |
| 1100 | QMutexLocker k(&_imp->isBeingDestroyedMutex); |
| 1101 | destroyed = _imp->isBeingDestroyed; |
| 1102 | } |
| 1103 | if (!destroyed) { |
| 1104 | _imp->effect->abortAnyEvaluation(); |
| 1105 | } |
| 1106 | |
| 1107 | { |
| 1108 | QMutexLocker l(&_imp->inputsMutex); |
| 1109 | if ( (inputNumber < 0) || |
| 1110 | ( inputNumber > (int)_imp->inputs.size() ) || |
| 1111 | ( !useGuiValues && !_imp->inputs[inputNumber].lock() ) || |
| 1112 | ( useGuiValues && !_imp->guiInputs[inputNumber].lock() ) ) { |
| 1113 | return -1; |
| 1114 | } |
| 1115 | inputShared = useGuiValues ? _imp->guiInputs[inputNumber].lock() : _imp->inputs[inputNumber].lock(); |
| 1116 | } |
| 1117 | |
| 1118 | |
| 1119 | QObject::disconnect( inputShared.get(), SIGNAL(labelChanged(QString)), this, SLOT(onInputLabelChanged(QString)) ); |
| 1120 | inputShared->disconnectOutput(useGuiValues, this); |
| 1121 | |
| 1122 | { |
| 1123 | QMutexLocker l(&_imp->inputsMutex); |
| 1124 | if (!useGuiValues) { |
| 1125 | _imp->inputs[inputNumber].reset(); |
| 1126 | _imp->guiInputs[inputNumber].reset(); |
| 1127 | } else { |
| 1128 | _imp->guiInputs[inputNumber].reset(); |
| 1129 | } |
| 1130 | } |
| 1131 | |
| 1132 | { |
| 1133 | QMutexLocker k(&_imp->isBeingDestroyedMutex); |
| 1134 | if (_imp->isBeingDestroyed) { |
| 1135 | return -1; |
| 1136 | } |
| 1137 | } |
| 1138 | |
| 1139 | Q_EMIT inputChanged(inputNumber); |
| 1140 | bool mustCallEnd = false; |
| 1141 | if (!useGuiValues) { |
| 1142 | beginInputEdition(); |
| 1143 | mustCallEnd = true; |
| 1144 | onInputChanged(inputNumber); |
| 1145 | } |
| 1146 | bool creatingNodeTree = getApp()->isCreatingNodeTree(); |
| 1147 | if (!creatingNodeTree) { |
| 1148 | ///Recompute the hash |
nothing calls this directly
no test coverage detected