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

Class RemoveNodeCommand

Gui/MultiInstancePanel.cpp:895–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893}
894
895class RemoveNodeCommand
896 : public QUndoCommand
897{
898 Q_DECLARE_TR_FUNCTIONS(RemoveNodeCommand)
899
900private:
901 MultiInstancePanel* _panel;
902 std::list<NodePtr> _nodes;
903
904public:
905
906 RemoveNodeCommand(MultiInstancePanel* panel,
907 const std::list<NodePtr> & nodes,
908 QUndoCommand* parent = 0)
909 : QUndoCommand(parent)
910 , _panel(panel)
911 , _nodes(nodes)
912 {
913 setText( tr("Remove instance(s)") );
914 }
915
916 virtual ~RemoveNodeCommand()
917 {
918 }
919
920 virtual void undo() OVERRIDE FINAL
921 {
922 _panel->setRedrawOnSelectionChanged(false);
923 _panel->addInstances(_nodes);
924 _panel->setRedrawOnSelectionChanged(true);
925 _panel->getMainInstance()->getApp()->triggerAutoSave();
926 _panel->getMainInstance()->getApp()->redrawAllViewers();
927 }
928
929 virtual void redo() OVERRIDE FINAL
930 {
931 _panel->setRedrawOnSelectionChanged(false);
932 _panel->removeInstances(_nodes);
933 _panel->setRedrawOnSelectionChanged(true);
934 _panel->getMainInstance()->getApp()->triggerAutoSave();
935 _panel->getMainInstance()->getApp()->redrawAllViewers();
936 }
937};
938
939void
940MultiInstancePanel::removeInstances(const std::list<NodePtr>& instances)

Callers

nothing calls this directly

Calls 7

addInstancesMethod · 0.80
getMainInstanceMethod · 0.80
removeInstancesMethod · 0.80
triggerAutoSaveMethod · 0.45
getAppMethod · 0.45
redrawAllViewersMethod · 0.45

Tested by

no test coverage detected