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

Method drawKeyframes

Gui/DopeSheetView.cpp:1282–1436  ·  view source on GitHub ↗

* @brief DopeSheetViewPrivate::drawKeyframes * * */

Source from the content-addressed store, hash-verified

1280 *
1281 */
1282void
1283DopeSheetViewPrivate::drawKeyframes(const DSNodePtr &dsNode) const
1284{
1285 running_in_main_thread_and_context(q_ptr);
1286
1287 SettingsPtr settings = appPTR->getCurrentSettings();
1288 double selectionColorRGB[3];
1289 settings->getSelectionColor(&selectionColorRGB[0], &selectionColorRGB[1], &selectionColorRGB[2]);
1290 QColor selectionColor;
1291 selectionColor.setRgbF(selectionColorRGB[0], selectionColorRGB[1], selectionColorRGB[2]);
1292
1293 // Perform drawing
1294 {
1295 GLProtectAttrib a(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
1296
1297 glEnable(GL_BLEND);
1298 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1299
1300 const DSTreeItemKnobMap& knobItems = dsNode->getItemKnobMap();
1301 double kfTimeSelected;
1302 int hasSingleKfTimeSelected = model->getSelectionModel()->hasSingleKeyFrameTimeSelected(&kfTimeSelected);
1303 std::map<double, bool> nodeKeytimes;
1304 std::map<DSKnob *, std::map<double, bool> > knobsKeytimes;
1305
1306 for (DSTreeItemKnobMap::const_iterator it = knobItems.begin();
1307 it != knobItems.end();
1308 ++it) {
1309 DSKnobPtr dsKnob = (*it).second;
1310 QTreeWidgetItem *knobTreeItem = dsKnob->getTreeItem();
1311
1312 // The knob is no longer animated
1313 if ( knobTreeItem->isHidden() ) {
1314 continue;
1315 }
1316
1317 int dim = dsKnob->getDimension();
1318
1319 if (dim == -1) {
1320 continue;
1321 }
1322
1323 KeyFrameSet keyframes = dsKnob->getKnobGui()->getCurve(ViewIdx(0), dim)->getKeyFrames_mt_safe();
1324
1325 for (KeyFrameSet::const_iterator kIt = keyframes.begin();
1326 kIt != keyframes.end();
1327 ++kIt) {
1328 KeyFrame kf = (*kIt);
1329 double keyTime = kf.getTime();
1330
1331 // Clip keyframes horizontally //TODO Clip vertically too
1332 if ( ( keyTime < zoomContext.left() ) || ( keyTime > zoomContext.right() ) ) {
1333 continue;
1334 }
1335
1336 double rowCenterYWidget = hierarchyView->visualItemRect( dsKnob->getTreeItem() ).center().y();
1337 RectD zoomKfRect = getKeyFrameBoundingRectZoomCoords(keyTime, rowCenterYWidget);
1338 bool kfSelected = model->getSelectionModel()->keyframeIsSelected(dsKnob, kf);
1339

Callers

nothing calls this directly

Calls 15

getCurrentSettingsMethod · 0.80
getSelectionColorMethod · 0.80
getSelectionModelMethod · 0.80
getTreeItemMethod · 0.80
getKeyFrames_mt_safeMethod · 0.80
getTimeMethod · 0.80
centerMethod · 0.80
visualItemRectMethod · 0.80
keyframeIsSelectedMethod · 0.80

Tested by

no test coverage detected