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

Method onKeyframeSelectionChanged

Gui/DopeSheetHierarchyView.cpp:1017–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015}
1016
1017void
1018HierarchyView::onKeyframeSelectionChanged(bool recurse)
1019{
1020 HierarchyViewSelectionModel *mySelecModel
1021 = dynamic_cast<HierarchyViewSelectionModel *>( selectionModel() );
1022
1023 assert(mySelecModel);
1024 if (!mySelecModel) {
1025 throw std::logic_error("HierarchyView::onKeyframeSelectionChanged");
1026 }
1027
1028 // Retrieve the knob contexts with selected keyframes
1029 std::set<DSKnobPtr> toCheck;
1030 DopeSheetKeyPtrList selectedKeys;
1031 std::vector<DSNodePtr> selectedNodes;
1032
1033 _imp->dopeSheetModel->getSelectionModel()->getCurrentSelection(&selectedKeys, &selectedNodes);
1034
1035 for (DopeSheetKeyPtrList::const_iterator it = selectedKeys.begin();
1036 it != selectedKeys.end();
1037 ++it) {
1038 toCheck.insert( (*it)->getContext() );
1039 }
1040
1041
1042 disconnect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
1043 this, SLOT(onSelectionChanged()) );
1044
1045 // Compose tree selection from the selected keyframes
1046 if ( toCheck.empty() && selectedNodes.empty() ) {
1047 mySelecModel->selectWithRecursion(QItemSelection(), QItemSelectionModel::Clear, recurse);
1048 } else {
1049 std::set<QModelIndex> toSelect;
1050
1051 for (std::set<DSKnobPtr>::const_iterator toCheckIt = toCheck.begin();
1052 toCheckIt != toCheck.end();
1053 ++toCheckIt) {
1054 DSKnobPtr dsKnob = (*toCheckIt);
1055 KnobGuiPtr knobGui = dsKnob->getKnobGui();
1056 assert(knobGui);
1057 int dim = dsKnob->getDimension();
1058 KeyFrameSet keyframes = knobGui->getCurve(ViewIdx(0), dim)->getKeyFrames_mt_safe();
1059 bool selectItem = true;
1060
1061 for (KeyFrameSet::const_iterator kfIt = keyframes.begin();
1062 kfIt != keyframes.end();
1063 ++kfIt) {
1064 KeyFrame key = (*kfIt);
1065
1066 if ( !_imp->dopeSheetModel->getSelectionModel()->keyframeIsSelected(dsKnob, key) ) {
1067 selectItem = false;
1068
1069 break;
1070 }
1071 }
1072
1073 QTreeWidgetItem *knobItem = dsKnob->getTreeItem();
1074

Callers

nothing calls this directly

Calls 15

QItemSelectionClass · 0.85
getCurrentSelectionMethod · 0.80
getSelectionModelMethod · 0.80
emptyMethod · 0.80
selectWithRecursionMethod · 0.80
getKeyFrames_mt_safeMethod · 0.80
keyframeIsSelectedMethod · 0.80
getTreeItemMethod · 0.80
ViewIdxClass · 0.50
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected