-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathVuoCommandChangeNode.hh
More file actions
72 lines (62 loc) · 2.38 KB
/
Copy pathVuoCommandChangeNode.hh
File metadata and controls
72 lines (62 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @file
* VuoCommandChangeNode interface.
*
* @copyright Copyright © 2012–2026 Kosada Incorporated.
* This code may be modified and distributed under the terms of the GNU Lesser General Public License (LGPL) version 2 or later.
* For more information, see https://vuo.org/license.
*/
#pragma once
#include "VuoCommandCommon.hh"
class VuoCable;
class VuoCompilerCompositionDiff;
class VuoEditorComposition;
class VuoEditorWindow;
class VuoPort;
class VuoRendererNode;
/**
* An undoable action for replacing a set of nodes with a provided set of replacements.
*
* Use this for replacing a node with a dissimilar node (the right-click "Change To" menu item).
* This command uses heuristics to try to map ports on the old node onto similar ports on the new node.
*
* @see VuoCommandReplaceNode for replacing a node with a very similar node
*/
class VuoCommandChangeNode : public VuoCommandCommon
{
public:
VuoCommandChangeNode(VuoRendererNode *oldNode, VuoRendererNode *newNode, VuoEditorWindow *window);
int id() const;
void undo();
void redo();
private:
static const int commandID;
VuoEditorWindow *window;
VuoEditorComposition *composition;
string revertedSnapshot;
string updatedSnapshot;
VuoCompilerCompositionDiff *diffInfo;
bool operationInvolvesGenericPort;
VuoRendererNode *oldNode;
VuoRendererNode *newNode;
map<VuoPort *, VuoPort *> updatedPortForOriginalPort;
set<VuoCable *> incomingCables;
set<VuoCable *> outgoingCables;
vector<VuoRendererNode *> collapsedTypecasts;
map<VuoRendererNode *, set<VuoCable *> > incomingCablesForTypecast;
map<VuoRendererNode *, VuoPort *> hostPortForTypecast;
vector<pair<VuoPort *, VuoPublishedPort *> > revertedPublishedInternalExternalPortCombinations;
vector<pair<VuoPort *, VuoPublishedPort *> > updatedPublishedInternalExternalPortCombinations;
map<VuoRendererNode *, vector<pair<VuoPort *, VuoPublishedPort *> > > publishedInternalExternalPortCombinationsForTypecast;
map<pair<VuoPort *, VuoPublishedPort *>, bool> publishedConnectionCarriedData;
map<VuoCable *, VuoPort *> originalFromPortForCable;
map<VuoCable *, VuoPort *> originalToPortForCable;
map<VuoCable *, bool> cableCarriedData;
map<VuoPort *, string> constantValueForOriginalPort;
void createAllMappings();
void createAllPortMappings();
void createSwappedNodePortMappings();
void removeStrandedAttachments();
void swapNodes();
void createNecessaryAttachments();
};