MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / drawRange

Method drawRange

Gui/DopeSheetView.cpp:1148–1275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1146}
1147
1148void
1149DopeSheetViewPrivate::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);

Callers

nothing calls this directly

Calls 15

renderTextFunction · 0.85
visualItemRectMethod · 0.80
getTreeItemMethod · 0.80
rangeIsSelectedMethod · 0.80
getSelectionModelMethod · 0.80
getItemTypeMethod · 0.80
getCurrentSettingsMethod · 0.80
getSelectionColorMethod · 0.80
findMethod · 0.45
getMethod · 0.45
endMethod · 0.45
toZoomCoordinatesMethod · 0.45

Tested by

no test coverage detected