| 1146 | } |
| 1147 | |
| 1148 | void |
| 1149 | DopeSheetViewPrivate::drawRange(const DSNodePtr &dsNode) const |
| 1150 | { |
| 1151 | // Draw the clip |
| 1152 | { |
| 1153 | std::map<DSNode *, FrameRange >::const_iterator foundRange = nodeRanges.find( dsNode.get() ); |
| 1154 | if ( foundRange == nodeRanges.end() ) { |
| 1155 | return; |
| 1156 | } |
| 1157 | |
| 1158 | |
| 1159 | const FrameRange& range = foundRange->second; |
| 1160 | QRectF treeItemRect = hierarchyView->visualItemRect( dsNode->getTreeItem() ); |
| 1161 | QPointF treeRectTopLeft = treeItemRect.topLeft(); |
| 1162 | treeRectTopLeft = zoomContext.toZoomCoordinates( treeRectTopLeft.x(), treeRectTopLeft.y() ); |
| 1163 | QPointF treeRectBtmRight = treeItemRect.bottomRight(); |
| 1164 | treeRectBtmRight = zoomContext.toZoomCoordinates( treeRectBtmRight.x(), treeRectBtmRight.y() ); |
| 1165 | |
| 1166 | RectD clipRectZoomCoords; |
| 1167 | clipRectZoomCoords.x1 = range.first; |
| 1168 | clipRectZoomCoords.x2 = range.second; |
| 1169 | clipRectZoomCoords.y2 = treeRectTopLeft.y(); |
| 1170 | clipRectZoomCoords.y1 = treeRectBtmRight.y(); |
| 1171 | GLProtectAttrib a(GL_CURRENT_BIT); |
| 1172 | QColor fillColor = dsNode->getNodeGui()->getCurrentColor(); |
| 1173 | fillColor = QColor::fromHsl( fillColor.hslHue(), 50, fillColor.lightness() ); |
| 1174 | |
| 1175 | bool isSelected = model->getSelectionModel()->rangeIsSelected(dsNode); |
| 1176 | |
| 1177 | |
| 1178 | // If necessary, draw the original frame range line |
| 1179 | float clipRectCenterY = 0.; |
| 1180 | if ( isSelected && (dsNode->getItemType() == eDopeSheetItemTypeReader) ) { |
| 1181 | NodePtr node = dsNode->getInternalNode(); |
| 1182 | |
| 1183 | KnobIntBase *firstFrameKnob = dynamic_cast<KnobIntBase *>( node->getKnobByName(kReaderParamNameFirstFrame).get() ); |
| 1184 | assert(firstFrameKnob); |
| 1185 | |
| 1186 | double speedValue = 1.0f; |
| 1187 | |
| 1188 | KnobIntBase *originalFrameRangeKnob = dynamic_cast<KnobIntBase *>( node->getKnobByName(kReaderParamNameOriginalFrameRange).get() ); |
| 1189 | assert(originalFrameRangeKnob); |
| 1190 | |
| 1191 | int originalFirstFrame = originalFrameRangeKnob->getValue(0); |
| 1192 | int originalLastFrame = originalFrameRangeKnob->getValue(1); |
| 1193 | int firstFrame = firstFrameKnob->getValue(); |
| 1194 | int lineBegin = range.first - (firstFrame - originalFirstFrame); |
| 1195 | int frameCount = originalLastFrame - originalFirstFrame + 1; |
| 1196 | int lineEnd = lineBegin + (frameCount / speedValue); |
| 1197 | |
| 1198 | clipRectCenterY = (clipRectZoomCoords.y1 + clipRectZoomCoords.y2) / 2.; |
| 1199 | |
| 1200 | GLProtectAttrib aa(GL_CURRENT_BIT | GL_LINE_BIT); |
| 1201 | glLineWidth(2 * _screenPixelRatio); |
| 1202 | |
| 1203 | glColor4f(fillColor.redF(), fillColor.greenF(), fillColor.blueF(), 1.f); |
| 1204 | glLineWidth(1. * _screenPixelRatio); |
| 1205 | glBegin(GL_LINES); |
nothing calls this directly
no test coverage detected