Vuo  2.4.0
VuoRendererComposition.hh
Go to the documentation of this file.
1
10#pragma once
11
12#include "VuoBaseDetail.hh"
13#include "VuoCable.hh"
15
16class VuoCompiler;
18class VuoCompilerNode;
19class VuoComposition;
20class VuoComment;
22class VuoRendererNode;
27
31class VuoRendererComposition : public QGraphicsScene, public VuoBaseDetail<VuoComposition>
32{
33public:
34 VuoRendererComposition(VuoComposition *baseComposition, bool renderMissingAsPresent = false, bool enableCaching = false);
35
37 void setBackgroundTransparent(bool transparent);
40 void addNode(VuoNode *node, bool nodeShouldBeRendered=true, bool nodeShouldBeGivenUniqueIdentifier=true);
41 void addCable(VuoCable *cable);
42 void addComment(VuoComment *comment);
45 void removeComment(VuoRendererComment *rcomment);
46 QList<QGraphicsItem *> createAndConnectInputAttachments(VuoRendererNode *node, VuoCompiler *compiler, bool createButDoNotAdd=false);
47 VuoRendererNode * createAndConnectMakeListNode(VuoNode *toNode, VuoPort *toPort, VuoCompiler *compiler, VuoRendererCable *&rendererCable);
48 void createAndConnectDictionaryAttachmentsForNode(VuoNode *node, VuoCompiler *compiler, set<VuoRendererNode *> &createdNodes, set<VuoRendererCable *> &createdCables);
49 vector<string> extractInputVariableListFromExpressionsConstant(string constant, string nodeClassName);
50 void addPublishedPort(VuoPublishedPort *publishedPort, bool isPublishedInput, VuoCompiler *compiler);
51 int removePublishedPort(VuoPublishedPort *publishedPort, bool isPublishedInput, VuoCompiler *compiler);
53 void setPublishedPortName(VuoRendererPublishedPort *publishedPort, string name, VuoCompiler *compiler);
54 string getUniquePublishedPortName(string baseName);
55 vector<VuoRendererNode *> collapseTypecastNodes(void);
58 void uncollapseTypecastNode(VuoRendererNode *typecastNode);
63 bool getRenderNodeActivity(void);
64 bool getRenderPortActivity(void);
65 bool getRenderHiddenCables(void);
66 void setRenderHiddenCables(bool render);
67 QGraphicsItem::CacheMode getCurrentDefaultCacheMode();
68 map<VuoPort *, string> getPortConstantResourcePathsRelativeToDir(QDir newDir);
69 string getAppIconResourcePathRelativeToDir(QDir newDir);
70 void bundleResourceFiles(string targetResourceDir, bool tmpFilesOnly=false, QString bundledIconPath="");
72 static bool isTmpFile(string filePath);
73
74 static void setGridOpacity(int opacity);
75 static int getGridOpacity();
76
79 {
80 NoGrid,
81 LineGrid,
82 PointGrid
83 };
84 static void setGridType(GridType type);
85 static QPoint quantizeToNearestGridLine(QPointF point, int gridSpacing);
86 static void createAutoreleasePool(void);
87
88 // Drawing configuration
89 static const int majorGridLineSpacing;
90 static const int minorGridLineSpacing;
91
92 static const string deprecatedDefaultDescription;
93
94protected:
95 void drawBackground(QPainter *painter, const QRectF &rect);
96 void setRenderActivity(bool render, bool includePortActivity=true);
97 void setComponentCaching(QGraphicsItem::CacheMode);
100 static bool isDirectory(string path);
101
108
109private:
110 void addNodeInCompositionToCanvas(VuoNode *n);
111 void addCableInCompositionToCanvas(VuoCable *c);
112 void addCommentInCompositionToCanvas(VuoComment *c);
113 QList<QGraphicsItem *> createAndConnectDrawersToListInputPorts(VuoRendererNode *node, VuoCompiler *compiler, bool createButDoNotAdd=false);
114 QList<QGraphicsItem *> createAndConnectDrawersToReadOnlyDictionaryInputPorts(VuoRendererNode *node, VuoCompiler *compiler, bool createButDoNotAdd=false);
115 VuoNode * createPublishedInputNode();
116 VuoNode * createPublishedOutputNode();
117
118 void bundleAuxiliaryFilesForSceneFile(QString sourceFilePath, QString targetFilePath);
119 string modifyResourcePathForBundle(string path);
120 string modifyResourcePathForNewDir(string path, QDir newDir);
121
122 static int gridOpacity;
123 static GridType gridType;
124 bool renderMissingAsPresent;
125 bool renderNodeActivity;
126 bool renderPortActivity;
127};