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

Method onItemDataChanged

Gui/TrackerPanel.cpp:1356–1415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1354}
1355
1356void
1357TrackerPanel::onItemDataChanged(TableItem* item)
1358{
1359 if (_imp->itemDataChangedRecursion) {
1360 return;
1361 }
1362
1363 int time = _imp->node.lock()->getDagGui()->getGui()->getApp()->getTimeLine()->currentFrame();
1364
1365 for (std::size_t it = 0; it < _imp->items.size(); ++it) {
1366 for (std::size_t i = 0; i < _imp->items[it].items.size(); ++i) {
1367 if (_imp->items[it].items[i].item == item) {
1368 TrackMarkerPtr marker = _imp->items[it].marker.lock();
1369 if (!marker) {
1370 continue;
1371 }
1372 switch (i) {
1373 case COL_ENABLED:
1374 case COL_MOTION_MODEL:
1375 //Columns with a custom cell widget are handled in their respective slots
1376 break;
1377 case COL_LABEL: {
1378 std::string label = item->data(Qt::DisplayRole).toString().toStdString();
1379 marker->setLabel(label);
1380 marker->setScriptName(label);
1381 _imp->items[it].items[COL_LABEL].item->setToolTip( labelToolTipFromScriptName(*marker) );
1382 NodePtr node = getContext()->getNode();
1383 if (node) {
1384 node->getApp()->redrawAllViewers();
1385 }
1386 break;
1387 }
1388 case COL_CENTER_X:
1389 case COL_CENTER_Y:
1390 case COL_OFFSET_X:
1391 case COL_OFFSET_Y:
1392 case COL_ERROR: {
1393 KnobDoublePtr knob = std::dynamic_pointer_cast<KnobDouble>( _imp->items[it].items[i].knob.lock() );
1394 assert(knob);
1395 int dim = _imp->items[it].items[i].dimension;
1396 double value = item->data(Qt::DisplayRole).toDouble();
1397 if ( knob->isAnimationEnabled() && knob->isAnimated(dim) ) {
1398 KeyFrame kf;
1399 knob->setValueAtTime(time, value, ViewSpec(0), dim, eValueChangedReasonNatronGuiEdited, &kf);
1400 } else {
1401 knob->setValue(value, ViewSpec(0), dim, eValueChangedReasonNatronGuiEdited, 0);
1402 }
1403 if (i != COL_ERROR) {
1404 NodePtr node = getContext()->getNode();
1405 if (node) {
1406 node->getApp()->redrawAllViewers();
1407 }
1408 }
1409 break;
1410 }
1411 }
1412 }
1413 }

Callers

nothing calls this directly

Calls 15

ViewSpecFunction · 0.85
getDagGuiMethod · 0.80
toStdStringMethod · 0.80
currentFrameMethod · 0.45
getTimeLineMethod · 0.45
getAppMethod · 0.45
getGuiMethod · 0.45
lockMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
setLabelMethod · 0.45

Tested by

no test coverage detected