36 #pragma clang diagnostic push
37 #pragma clang diagnostic ignored "-Wdocumentation"
38 #include <json-c/json.h>
39 #pragma clang diagnostic pop
55 bool isOutput,
bool isRefreshPort,
bool isFunctionPort)
64 this->isOutput = isOutput;
66 this->isFunctionPort = isFunctionPort;
68 this->isEligibleForSelection =
false;
70 this->typecastParentPort = NULL;
75 const int maxAnimationsPerPort = 4;
79 for (
int i = 0; i < maxAnimationsPerPort; ++i)
81 QGraphicsItemAnimation *animation =
new QGraphicsItemAnimation();
83 animations.push_back(animation);
89 setFlag(QGraphicsItem::ItemIsFocusable,
true);
90 setAcceptHoverEvents(
true);
106 void VuoRendererPort::addRoundedTriangle(QPainterPath &p, QPointF center, qreal radius, qreal cornerRadius)
108 p.moveTo(center + QPointF(radius,0));
109 for (
int theta = 0; theta <= 360; theta += 120)
111 QRectF rect(center.x() + (radius - cornerRadius)*cos(theta*M_PI/180.) - cornerRadius,
112 center.y() - (radius - cornerRadius)*sin(theta*M_PI/180.) - cornerRadius,
115 bool first = theta==0;
116 bool last = theta==360;
119 theta - (first ? 0 : 60),
120 (first||last ? 60 : 120));
144 getBase()->getClass()->getPortType(),
157 QString constantText,
164 QRectF innerPortRect = outerPortRect.adjusted(inset,inset,-inset,-inset);
169 QPointF topLeftCorner(left + .5, innerPortRect.top() - .24);
170 QPointF topRightCorner(innerPortRect.right() + .5, innerPortRect.top() - .24);
171 QPointF bottomRightCorner(innerPortRect.right() + .5, innerPortRect.bottom() - .43);
172 QPointF bottomLeftCorner(left + .5, innerPortRect.bottom() - .43);
174 p.moveTo(innerPortRect.right() + .5, innerPortRect.center().y());
176 addRoundedCorner(p,
true, bottomRightCorner, adjustedPortRadius,
false,
false);
177 addRoundedCorner(p,
true, bottomLeftCorner, adjustedPortRadius,
false,
true);
202 QRectF barrierRect = QRectF();
230 if (!paintDataAntenna && !paintEventAntenna)
231 return QPainterPath();
239 const qreal pixelOffset = -.3;
240 QPointF startPoint = (
getInput()? -QPointF(mastLength - (paintDataAntenna ? 0.5 : 0 ) + constantWidth, -pixelOffset) : QPointF(0, pixelOffset));
241 QPointF endPoint = (
getInput()? QPointF(-constantWidth, pixelOffset) : QPointF(mastLength + (paintDataAntenna ? 0.5 : 0 ), pixelOffset));
243 VuoCable cableBase(NULL, NULL, NULL, NULL);
247 QPainterPathStroker mastStroker;
248 mastStroker.setWidth(cableWidth);
249 mastStroker.setCapStyle(Qt::RoundCap);
250 QPainterPath antennaOutline = mastStroker.createStroke(mastPath);
253 qreal outerCrossbarXOffset = (paintDataAntenna? 1 : 0.5);
254 const QPointF outerCrossbarPos = (
getInput()? startPoint - QPointF(outerCrossbarXOffset, 0) :
255 endPoint + QPointF(outerCrossbarXOffset, 0));
256 const int crossbarSpacing = 5;
259 QPainterPath crossbars;
260 for (
int i = 0; i < 2; ++i)
262 crossbars.moveTo((outerCrossbarPos +
263 QPointF(QPointF(0, -0.5*crossbarHeight) +
264 QPointF((
getInput()? 1 : -1)*crossbarSpacing*i, 0))));
265 crossbars.lineTo((outerCrossbarPos +
266 QPointF(QPointF(0, 0.5*crossbarHeight) +
267 QPointF((
getInput()? 1 : -1)*crossbarSpacing*i, 0))));
271 QPainterPathStroker crossbarStroker;
272 crossbarStroker.setWidth(cableWidth*3/5);
273 crossbarStroker.setCapStyle(Qt::RoundCap);
274 antennaOutline += crossbarStroker.createStroke(crossbars);
276 return antennaOutline;
285 for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
286 if ((*cable)->hasRenderer() && (*cable)->getRenderer()->effectivelyCarriesData() &&
287 (*cable)->getRenderer()->getEffectivelyWireless() &&
288 (*cable)->getRenderer()->paintingDisabled())
299 for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
300 if ((*cable)->hasRenderer() && !(*cable)->getRenderer()->effectivelyCarriesData() &&
301 (*cable)->getRenderer()->getEffectivelyWireless() &&
302 (*cable)->getRenderer()->paintingDisabled())
313 if (renderedParentNode)
326 return VuoNode::TintNone;
340 set<VuoNode::TintColor> connectedPortTints;
344 if (connectedPortTints.size() > 1)
345 return VuoNode::TintNone;
348 if (connectedPortTints.size() == 1)
349 return *connectedPortTints.begin();
351 return VuoNode::TintNone;
359 set<VuoRendererPort *> connectedPorts;
360 foreach (
VuoCable *cable,
getBase()->getConnectedCables(includePublishedCables))
368 connectedPorts.insert(connectedPort->
getRenderer());
372 return connectedPorts;
391 if (underlyingAttachment &&
398 else if (underlyingAttachment)
405 return upstreamDrawer;
441 set<VuoRendererInputAttachment *> allUpstreamAttachments;
443 if (!directUpstreamAttachment)
444 return allUpstreamAttachments;
446 allUpstreamAttachments.insert(directUpstreamAttachment);
449 foreach (
VuoPort *port, inputPorts)
452 allUpstreamAttachments.insert(indirectUpstreamAttachments.begin(), indirectUpstreamAttachments.end());
455 return allUpstreamAttachments;
476 static QHash<QString, int> cachedTextWidths;
477 QHash<QString, int>::iterator i = cachedTextWidths.find(text);
478 if (i != cachedTextWidths.end())
482 .boundingRect(QRectF(0,0,0,0), Qt::TextIncludeTrailingSpaces, text)
484 cachedTextWidths.insert(text, textWidth);
502 return textRect.toAlignedRect();
520 QFont font = getPortNameFont();
521 QSizeF textSize = QFontMetricsF(font).size(0,text);
569 if (!parentItem()->parentItem())
580 return typecastParentPort;
588 this->typecastParentPort = typecastParentPort;
665 painter->drawPoint(barrierRect.center() + QPointF(0, -barrierRect.height()/2. + 1.75 + .17));
666 painter->drawPoint(barrierRect.center() + QPointF(0, barrierRect.height()/2. - 1.75 + .17));
674 QFont VuoRendererPort::getPortNameFont(
void)
const
702 painter->setFont(getPortNameFont());
703 painter->drawText(
getNameRect(), isOutput? Qt::AlignRight : Qt::AlignLeft, QString::fromStdString(name));
764 QFontMetricsF fontMetrics = QFontMetricsF(getPortNameFont());
765 const qreal marginFromPortName = 4;
766 const qreal triangleSize = 6;
767 qreal triangleLeft = qRound(
getNameRect().right() + marginFromPortName );
768 qreal triangleTop = qRound(
getNameRect().bottom() - fontMetrics.descent() - fontMetrics.xHeight() );
770 return QRectF(triangleLeft, triangleTop, triangleSize, triangleSize);
786 painter->fillPath(p, color);
814 if (!(scene() || publishedPort))
817 painter->setRenderHint(QPainter::Antialiasing,
true);
823 VuoRendererColors::noSelection);
825 bool isHovered = isEligibleForSelection;
834 qint64 timeOfLastActivity = ((! renderNodeActivity)? VuoRendererItem::notTrackingActivity :
835 ((isTriggerPort && renderPortActivity)? timeLastEventFired :
838 VuoRendererItem::notTrackingActivity))));
842 bool effectivelyHovered = isHovered;
847 if (drawerHighlight < _eligibilityHighlight)
849 effectiveHighlight = drawerHighlight;
852 effectivelyHovered =
false;
878 else if (publishedPort)
892 bool showRightHalfOnly = !isHovered && drawerChildPort &&
895 if (showRightHalfOnly)
898 painter->fillPath(portPath, portBrush);
900 if (showRightHalfOnly)
901 painter->setClipping(
false);
912 QColor swatchColor = QColor(c.r*255, c.g*255, c.b*255, c.a*255 * portBrush.color().alphaF());
916 bool isDark = colors->
isDark();
921 if ((a < 1) || (isDark ? l < .25 : l > .75))
924 QColor topLeftColor = colors->
nodeFrame();
925 painter->fillPath(portPath, topLeftColor);
929 QColor bottomRightColor = isDark ? Qt::black : Qt::white;
930 QTransform transform;
931 transform.scale(0.87, 0.87);
932 QPainterPath smallerCircle = portPath * transform;
934 QRectF r = portPath.boundingRect();
935 QPainterPath bottomRight;
936 bottomRight.moveTo(r.bottomLeft());
937 bottomRight.lineTo(r.topRight());
938 bottomRight.lineTo(r.bottomRight());
939 painter->setClipPath(smallerCircle);
940 painter->fillPath(bottomRight, bottomRightColor);
941 painter->setClipping(
false);
945 painter->fillPath(smallerCircle, swatchColor);
950 painter->fillPath(portPath, swatchColor);
954 painter->fillPath(portPath, portBrush);
957 QBrush constantFlagBackgroundBrush = colors->
constantFill();
963 painter->drawText(textRect, Qt::AlignLeft, constantText);
972 painter->fillPath(p, colors->
portIcon());
981 delete antennaColors;
990 return isEligibleForSelection;
1008 _eligibilityHighlight = eligibility;
1016 return _eligibilityHighlight;
1034 QGraphicsItem::CacheMode normalCacheMode = cacheMode();
1035 setCacheMode(QGraphicsItem::NoCache);
1037 prepareGeometryChange();
1040 setCacheMode(normalCacheMode);
1044 if (!cableDragUnderway && !disableConnectedCableHighlight)
1049 VuoRendererCable *cableToDisconnect = connectedCables.back()->getRenderer();
1061 QGraphicsItem::CacheMode normalCacheMode = cacheMode();
1062 setCacheMode(QGraphicsItem::NoCache);
1064 prepareGeometryChange();
1065 isEligibleForSelection =
false;
1067 setCacheMode(normalCacheMode);
1074 VuoRendererCable *cableToDisconnect = connectedCables.back()->getRenderer();
1094 bool fromPortIsEnabledOutput = (this->
getOutput() && this->isEnabled());
1095 bool toPortIsEnabledInput = (toPort && toPort->
getInput() && toPort->isEnabled());
1097 if (!(fromPortIsEnabledOutput && toPortIsEnabledInput))
1101 if (eventOnlyConnection)
1110 if (!fromDataType || !toDataType)
1114 if (!
dynamic_cast<VuoGenericType *
>(fromDataType) && (fromDataType == toDataType))
1148 string specializedTypeName =
"";
1168 *portToSpecialize = NULL;
1169 specializedTypeName =
"";
1174 bool fromPortIsEnabledOutput = (this->
getOutput() && this->isEnabled());
1175 bool toPortIsEnabledInput = (toPort && toPort->
getInput() && toPort->isEnabled());
1177 if (!(fromPortIsEnabledOutput && toPortIsEnabledInput))
1186 if (!(originalFromDataType && originalToDataType && currentFromDataType && currentToDataType))
1199 *portToSpecialize =
this;
1200 specializedTypeName = originalToDataType->
getModuleKey();
1208 *portToSpecialize = toPort;
1209 specializedTypeName = originalFromDataType->
getModuleKey();
1223 for (vector<VuoCable *>::iterator cable = cables.begin(); cable != cables.end(); ++cable)
1224 if ((*cable)->getToPort() == toPort->
getBase())
1247 (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter))
1269 return ((! isOutput) && (! isFunctionPort));
1293 return isFunctionPort;
1310 (
getBase()->getClass()->hasCompiler() &&
1320 this->prepareGeometryChange();
1330 if (change == QGraphicsItem::ItemPositionHasChanged)
1337 return QGraphicsItem::itemChange(change, value);
1367 if (portName ==
"url")
1372 if (portName ==
"folder")
1402 if (details && json_object_object_get_ex(details,
"isSave", &isSaveValue) && json_object_get_boolean(isSaveValue))
1409 return isRelativePath;
1428 for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
1429 if ((*cable)->hasRenderer() && (*cable)->getRenderer()->effectivelyCarriesData())
1442 int size = vsnprintf(NULL, 0,
format, args);
1445 char *formattedString = (
char *)malloc(size+1);
1447 vsnprintf(formattedString, size+1,
format, args);
1450 string s(formattedString);
1451 free(formattedString);
1474 if (! compilerEventPort)
1497 size_t maxLength = strlen(
"Matches wildcard (not case-sensitive)");
1499 VuoTextTruncation_Beginning :
1500 VuoTextTruncation_End);
1536 double real = json_object_get_double(js);
1537 json_object_put(js);
1543 if (json_object_object_get_ex(portDetails,
"auto", &autoObject))
1544 if (real == json_object_get_double(autoObject))
1560 if (details && json_object_object_get_ex(details,
"menuItems", &menuItemsValue))
1564 if (portValue ==
"false")
1566 else if (portValue ==
"true")
1569 int len = json_object_array_length(menuItemsValue);
1570 for (
int i = 0; i < len; ++i)
1572 json_object *menuItem = json_object_array_get_idx(menuItemsValue, i);
1573 if (json_object_is_type(menuItem, json_type_object))
1576 if (json_object_object_get_ex(menuItem,
"value", &value))
1577 if ((json_object_is_type(value, json_type_string) && portValue == json_object_get_string(value))
1578 || (json_object_is_type(value, json_type_int ) && atol(portValue.c_str()) == json_object_get_int64(value)))
1581 if (json_object_object_get_ex(menuItem,
"name", &name))
1597 json_object_put(js);
1603 if (json_object_object_get_ex(portDetails,
"auto", &autoObject))
1604 if (i == json_object_get_int64(autoObject))
1608 return format(
"%lld", i);
1613 QList<float> pointList = QList<float>() << p.x << p.y;
1619 QList<float> pointList = QList<float>() << p.x << p.y << p.z;
1625 QList<float> pointList = QList<float>() << p.x << p.y << p.z << p.w;
1633 const char *fontName = NULL;
1634 if (json_object_object_get_ex(js,
"fontName", &o))
1635 fontName = json_object_get_string(o);
1637 double pointSize = 0;
1638 if (json_object_object_get_ex(js,
"pointSize", &o))
1639 pointSize = json_object_get_double(o);
1641 bool underline =
false;
1642 if (json_object_object_get_ex(js,
"underline", &o))
1643 underline = json_object_get_boolean(o);
1644 const char *underlineString = underline ?
" [U]" :
"";
1646 string outputString;
1648 outputString =
format(
"%s %gpt%s", fontName, pointSize, underlineString);
1650 json_object_put(js);
1652 return outputString;
1654 if (
getDataType()->getModuleKey()==
"VuoMathExpressionList")
1660 if (json_object_object_get_ex(js,
"expressions", &expressionsObject))
1662 if (json_object_get_type(expressionsObject) == json_type_array)
1664 int itemCount = json_object_array_length(expressionsObject);
1667 json_object *itemObject = json_object_array_get_idx(expressionsObject, 0);
1668 if (json_object_get_type(itemObject) == json_type_string)
1670 expression = json_object_get_string(itemObject);
1671 json_object_put(itemObject);
1677 json_object_put(js);
1681 if (
getDataType()->getModuleKey()==
"VuoRealRegulation")
1686 string outputString;
1687 if (json_object_object_get_ex(js,
"name", &o))
1688 outputString = json_object_get_string(o);
1690 json_object_put(js);
1692 return outputString;
1703 if (
getDataType()->getModuleKey()==
"VuoTransform")
1710 if (value.type == VuoTransformTypeTargeted)
1711 return format(
"(%g,%g,%g) toward (%g,%g,%g)",
1712 value.translation.x, value.translation.y, value.translation.z, value.rotationSource.target.x, value.rotationSource.target.y, value.rotationSource.target.z);
1715 if (value.type == VuoTransformTypeQuaternion)
1716 rotation =
format(
"‹%g,%g,%g,%g›",
1717 value.rotationSource.quaternion.x, value.rotationSource.quaternion.y, value.rotationSource.quaternion.z, value.rotationSource.quaternion.w);
1721 rotation =
format(
"(%g°,%g°,%g°)",
1725 return format(
"(%g,%g,%g) %s %g×%g×%g",
1726 value.translation.x, value.translation.y, value.translation.z, rotation.c_str(), value.scale.x, value.scale.y, value.scale.z);
1728 if (
getDataType()->getModuleKey()==
"VuoTransform2d")
1736 return format(
"(%g,%g) %g° %g×%g",
1737 value.translation.x, value.translation.y, rotationInDegrees, value.scale.x, value.scale.y);
1739 if (
getDataType()->getModuleKey()==
"VuoMovieFormat")
1744 const char *imageEncoding = NULL;
1745 if (json_object_object_get_ex(js,
"imageEncoding", &o))
1747 imageEncoding = json_object_get_string(o);
1748 if (strcasecmp(imageEncoding,
"jpeg") == 0)
1749 imageEncoding =
"JPEG";
1750 else if (strcasecmp(imageEncoding,
"h264") == 0)
1751 imageEncoding =
"H.264";
1752 else if (strcasecmp(imageEncoding,
"prores4444") == 0)
1753 imageEncoding =
"ProRes 4444";
1754 else if (strcasecmp(imageEncoding,
"prores422") == 0)
1755 imageEncoding =
"ProRes 422";
1756 else if (strcasecmp(imageEncoding,
"prores422-hq") == 0)
1757 imageEncoding =
"ProRes 422 HQ";
1758 else if (strcasecmp(imageEncoding,
"prores422-lt") == 0)
1759 imageEncoding =
"ProRes 422 LT";
1760 else if (strcasecmp(imageEncoding,
"prores422-proxy") == 0)
1761 imageEncoding =
"ProRes 422 Proxy";
1762 else if (strcmp(imageEncoding,
"hevc") == 0)
1763 imageEncoding =
"HEVC";
1764 else if (strcmp(imageEncoding,
"hevc-alpha") == 0)
1765 imageEncoding =
"HEVC+Alpha";
1768 const char *audioEncoding = NULL;
1769 if (json_object_object_get_ex(js,
"audioEncoding", &o))
1771 audioEncoding = json_object_get_string(o);
1772 if (strcmp(audioEncoding,
"LinearPCM") == 0)
1773 audioEncoding =
"Linear PCM";
1776 string outputString;
1777 if (imageEncoding && audioEncoding)
1778 outputString =
format(
"%s, %s", imageEncoding, audioEncoding);
1780 json_object_put(js);
1782 return outputString;
1790 if (json_object_object_get_ex(js,
"type", &o))
1794 if (type == VuoScreenType_Active)
1796 else if (type == VuoScreenType_Primary)
1798 else if (type == VuoScreenType_Secondary)
1799 label =
"Secondary";
1800 else if (type == VuoScreenType_MatchName)
1802 if (json_object_object_get_ex(js,
"name", &o))
1803 label = json_object_get_string(o);
1805 else if (type == VuoScreenType_MatchId)
1810 label = realizedScreen.
name;
1813 json_object_put(js);
1817 if (
getDataType()->getModuleKey()==
"VuoSerialDevice")
1822 const char *name = NULL;
1823 if (json_object_object_get_ex(js,
"name", &o))
1824 name = json_object_get_string(o);
1825 else if (json_object_object_get_ex(js,
"path", &o))
1826 name = json_object_get_string(o);
1828 string outputString =
"First";
1829 if (name && strlen(name))
1830 outputString = name;
1832 json_object_put(js);
1834 return outputString;
1836 if (
getDataType()->getModuleKey()==
"VuoMidiInputDevice")
1841 const char *name = NULL;
1842 if (json_object_object_get_ex(js,
"name", &o))
1843 name = json_object_get_string(o);
1845 string outputString =
"First";
1846 if (name && strlen(name))
1847 outputString = name;
1849 json_object_put(js);
1851 return outputString;
1853 if (
getDataType()->getModuleKey()==
"VuoMidiOutputDevice")
1858 const char *name = NULL;
1859 if (json_object_object_get_ex(js,
"name", &o))
1860 name = json_object_get_string(o);
1862 string outputString =
"First";
1863 if (name && strlen(name))
1864 outputString = name;
1866 json_object_put(js);
1868 return outputString;
1870 if (
getDataType()->getModuleKey()==
"VuoSyphonServerDescription")
1875 const char *name = NULL;
1876 if (json_object_object_get_ex(js,
"serverName", &o))
1878 const char *n = json_object_get_string(o);
1882 if (!name && json_object_object_get_ex(js,
"applicationName", &o))
1884 const char *n = json_object_get_string(o);
1889 string outputString =
"First";
1890 if (name && strlen(name))
1891 outputString = name;
1893 json_object_put(js);
1895 return outputString;
1897 if (
getDataType()->getModuleKey()==
"VuoVideoInputDevice")
1902 const char *name = NULL;
1903 if (json_object_object_get_ex(js,
"name", &o))
1904 name = json_object_get_string(o);
1905 else if (json_object_object_get_ex(js,
"id", &o))
1906 name = json_object_get_string(o);
1908 string outputString =
"Default";
1909 if (name && strlen(name))
1910 outputString = name;
1912 json_object_put(js);
1914 return outputString;
1916 if (
getDataType()->getModuleKey()==
"VuoAudioInputDevice")
1921 const char *name = NULL;
1922 if (json_object_object_get_ex(js,
"name", &o))
1923 name = json_object_get_string(o);
1925 string outputString =
"Default";
1926 if (name && strlen(name))
1927 outputString = name;
1929 json_object_put(js);
1931 return outputString;
1933 if (
getDataType()->getModuleKey()==
"VuoAudioOutputDevice")
1938 const char *name = NULL;
1939 if (json_object_object_get_ex(js,
"name", &o))
1940 name = json_object_get_string(o);
1942 string outputString =
"Default";
1943 if (name && strlen(name))
1944 outputString = name;
1946 json_object_put(js);
1948 return outputString;
1950 if (
getDataType()->getModuleKey()==
"VuoHidDevice")
1955 QString outputString;
1956 if (json_object_object_get_ex(js,
"name", &o))
1958 outputString = json_object_get_string(o);
1961 outputString = outputString.section(
" (", 0, 0);
1963 json_object_put(js);
1965 return outputString.toStdString();
1967 if (
getDataType()->getModuleKey()==
"VuoOscInputDevice"
1968 ||
getDataType()->getModuleKey()==
"VuoOscOutputDevice")
1973 const char *name = NULL;
1974 if (json_object_object_get_ex(js,
"name", &o))
1975 name = json_object_get_string(o);
1977 string outputString =
"Auto";
1978 if (name && strlen(name))
1979 outputString = name;
1981 json_object_put(js);
1983 return outputString;
1985 if (
getDataType()->getModuleKey()==
"VuoArtNetInputDevice"
1986 ||
getDataType()->getModuleKey()==
"VuoArtNetOutputDevice")
1991 const char *name = NULL;
1992 if (json_object_object_get_ex(js,
"name", &o))
1993 name = json_object_get_string(o);
1996 if (
getDataType()->getModuleKey()==
"VuoArtNetInputDevice")
2003 if (json_object_object_get_ex(js,
"net", &o))
2004 net = json_object_get_int64(o);
2005 if (json_object_object_get_ex(js,
"subNet", &o))
2006 subNet = json_object_get_int64(o);
2007 if (json_object_object_get_ex(js,
"universe", &o))
2008 universe = json_object_get_int64(o);
2010 string outputString =
format(
"%s (%lld:%lld:%lld)", name, net, subNet, universe);
2012 json_object_put(js);
2014 return outputString;
2016 if (
getDataType()->getModuleKey()==
"VuoTempoRange")
2019 const char *tempoRange = json_object_get_string(js);
2022 if (strcmp(tempoRange,
"andante") == 0)
2023 return "70–110 BPM";
2024 else if (strcmp(tempoRange,
"moderato") == 0)
2025 return "100–140 BPM";
2026 else if (strcmp(tempoRange,
"allegro") == 0)
2027 return "120–180 BPM";
2028 else if (strcmp(tempoRange,
"presto") == 0)
2029 return "170–250 BPM";
2030 else if (strcmp(tempoRange,
"prestissimo") == 0)
2031 return "220–320 BPM";
2033 if (
getDataType()->getModuleKey()==
"VuoEdgeBlend")
2037 double cutoff = 0, gamma = 0, crop = 0;
2040 if (json_object_object_get_ex(js,
"cutoff", &o))
2041 cutoff = json_object_get_double(o);
2043 if (json_object_object_get_ex(js,
"gamma", &o))
2044 gamma = json_object_get_double(o);
2046 if (json_object_object_get_ex(js,
"crop", &o))
2047 crop = json_object_get_double(o);
2049 json_object_put(js);
2051 double cropPercent = -crop * 100;
2052 double cutoffPercent = cutoff * 100;
2056 return format(
"%.0f%%", cropPercent);
2058 return format(
"%.0f%% %.0f%%", cropPercent, cutoffPercent);
2060 return format(
"%.0f%% %.0f%% @ %.2gγ", cropPercent, cutoffPercent, gamma);
2070 if (json_object_object_get_ex(js,
"minimum", &o))
2071 minimum = json_object_get_double(o);
2073 if (json_object_object_get_ex(js,
"maximum", &o))
2074 maximum = json_object_get_double(o);
2076 json_object_put(js);
2079 return format(
"%.4g to %.4g", minimum, maximum);
2081 return format(
"%.4g to ∞", minimum);
2083 return format(
"-∞ to %.4g", maximum);
2085 return format(
"-∞ to ∞");
2087 if (
getDataType()->getModuleKey()==
"VuoIntegerRange")
2095 if (json_object_object_get_ex(js,
"minimum", &o))
2096 minimum = json_object_get_int64(o);
2098 if (json_object_object_get_ex(js,
"maximum", &o))
2099 maximum = json_object_get_int64(o);
2101 json_object_put(js);
2104 return format(
"%lld to %lld", minimum, maximum);
2106 return format(
"%lld to ∞", minimum);
2108 return format(
"-∞ to %lld", maximum);
2110 return format(
"-∞ to ∞");
2117 if (
getDataType()->getModuleKey() ==
"VuoTextComparison")
2122 if (
getDataType()->getModuleKey() ==
"VuoBlackmagicInputDevice"
2123 ||
getDataType()->getModuleKey() ==
"VuoBlackmagicOutputDevice")
2127 if (json_object_object_get_ex(js,
"name", &o))
2128 return json_object_get_string(o);
2132 if (
getDataType()->getModuleKey() ==
"VuoSpeechVoice")
2137 if (
getDataType()->getModuleKey() ==
"VuoRectangle")
2146 if (json_object_get_type(js) == json_type_string)
2148 string textWithoutQuotes = json_object_get_string(js);
2149 json_object_put(js);
2156 if (type ==
"VuoText"
2157 || type ==
"VuoImageFormat"
2158 || type ==
"VuoAudioEncoding"
2159 || type ==
"VuoBlackmagicConnection"
2160 || type ==
"VuoBlackmagicVideoMode"
2161 || type ==
"VuoMovieImageEncoding")
2162 return textWithoutQuotes;
2165 if (type ==
"VuoTableFormat")
2167 std::transform(textWithoutQuotes.begin(), textWithoutQuotes.end(), textWithoutQuotes.begin(), ::toupper);
2168 return textWithoutQuotes;
2173 for (
auto it = textWithoutQuotes.begin(); it != textWithoutQuotes.end();)
2176 textWithoutQuotes.erase(it);
2184 json_object_put(js);
2197 QGraphicsItem::CacheMode normalCacheMode = cacheMode();
2198 setCacheMode(QGraphicsItem::NoCache);
2208 setCacheMode(normalCacheMode);
2215 for (set<VuoCable *>::iterator i = cables.begin(); i != cables.end(); ++i)
2217 (*i)->getRenderer()->setPortConstantsChanged();
2218 (*i)->getRenderer()->updateGeometry();
2234 if (name.empty() || isAnimated)
2238 else if (sidebarPaintMode)
2240 else if (
isRefreshPort || isFunctionPort || typecastParentPort)
2255 const QString coordSeparator = QString(QLocale::system().decimalPoint() !=
','? QChar(
',') : QChar(
';')).append(
" ");
2256 QStringList coordStringList;
2258 foreach (
float coord, coordList)
2261 QString pointString = QString(
"(").append(coordStringList.join(coordSeparator).append(
")"));
2262 return pointString.toStdString();
2272 QString valueAsStringInUserLocale = QLocale::system().toString(value,
'g', 11);
2273 if (qAbs(value) >= 1000.0)
2274 valueAsStringInUserLocale.remove(QLocale::system().groupSeparator());
2276 return valueAsStringInUserLocale.toStdString();
2286 QString valueAsStringInUserLocale = QLocale::system().toString(value,
'g', 7);
2287 if (qAbs(value) >= 1000.0)
2288 valueAsStringInUserLocale.remove(QLocale::system().groupSeparator());
2290 return valueAsStringInUserLocale.toStdString();
2305 bool isMathExpressionInputToCalculateNode = (this->
getDataType() &&
2313 return (!isGeneric && !hasDictionaryType && !isMathExpressionInputToCalculateNode && !
dynamic_cast<const VuoRendererPublishedPort *
>(
this));
2322 vector <VuoRendererPublishedPort *> publishedPorts;
2331 return publishedPorts;
2340 vector <VuoRendererPublishedPort *> publishedPorts;
2349 return publishedPorts;
2366 this->timeLastEventFired = QDateTime::currentMSecsSinceEpoch();
2383 return this->animations;
2392 this->isAnimated = animated;
2401 this->setCacheMode(mode);
2415 setEnabled(!isAnimated &&
2416 ((
getBase()->hasCompiler() &&
getBase()->getClass()->hasCompiler()) ||
2433 return QString(
"[A-Za-z][A-Za-z0-9]{0,30}")
2435 .append(
"[0-9]{1,31}");
2449 portID.remove(QRegExp(
"[^A-Za-z0-9]"));
2452 if (!portID.contains(QRegExp(
"^[0-9]+$")))
2454 while (!portID.isEmpty() && !portID.contains(QRegExp(
"^[A-Za-z]")))
2455 portID = portID.right(portID.size()-1);
2459 portID = portID.left(31);
2464 VuoRendererPort::~VuoRendererPort()
2466 foreach (QGraphicsItemAnimation *animation, animations)