884 if (!(scene() || publishedPort))
887 painter->setRenderHint(QPainter::Antialiasing,
true);
893 VuoRendererColors::noSelection);
895 bool isHovered = isEligibleForSelection;
900 bool effectivelyHovered = isHovered;
905 if (drawerHighlight < _eligibilityHighlight)
907 effectiveHighlight = drawerHighlight;
910 effectivelyHovered =
false;
936 else if (publishedPort)
944 bool showRightHalfOnly =
false;
954 qint64 timeNow = QDateTime::currentMSecsSinceEpoch();
955 const double fadeThreshold = 0.3;
956 qint64 childTimeOfLastActivity = drawerChildPort? drawerChildPort->
getTimeOfLastActivity() : VuoRendererItem::notTrackingActivity;
957 bool showingActiveEvent = (timeOfLastActivity != VuoRendererItem::notTrackingActivity) &&
959 (timeOfLastActivity == VuoRendererItem::activityInProgress));
960 bool childShowingActiveEvent = (childTimeOfLastActivity != VuoRendererItem::notTrackingActivity) &&
962 (childTimeOfLastActivity == VuoRendererItem::activityInProgress));
963 showRightHalfOnly = !effectivelyHovered && drawerChildPort &&
965 !(showingActiveEvent && !childShowingActiveEvent);
968 if (showRightHalfOnly)
971 painter->fillPath(portPath, portBrush);
973 if (showRightHalfOnly)
974 painter->setClipping(
false);
984 QColor swatchColor = QColor(c.r*255, c.g*255, c.b*255, c.a*255 * portBrush.color().alphaF());
988 bool isDark = colors->
isDark();
993 if ((a < 1) || (isDark ? l < .25 : l > .75))
996 QColor topLeftColor = colors->
nodeFrame();
997 painter->fillPath(portPath, topLeftColor);
1001 QColor bottomRightColor = isDark ? Qt::black : Qt::white;
1002 QTransform transform;
1003 transform.scale(0.87, 0.87);
1004 QPainterPath smallerCircle = portPath * transform;
1006 QRectF r = portPath.boundingRect();
1007 QPainterPath bottomRight;
1008 bottomRight.moveTo(r.bottomLeft());
1009 bottomRight.lineTo(r.topRight());
1010 bottomRight.lineTo(r.bottomRight());
1011 painter->setClipPath(smallerCircle);
1012 painter->fillPath(bottomRight, bottomRightColor);
1013 painter->setClipping(
false);
1017 painter->fillPath(smallerCircle, swatchColor);
1022 painter->fillPath(portPath, swatchColor);
1026 painter->fillPath(portPath, portBrush);
1029 QBrush constantFlagBackgroundBrush = colors->
constantFill();
1035 painter->drawText(textRect, Qt::AlignLeft, constantText);
1044 painter->fillPath(p, colors->
portIcon());
1053 delete antennaColors;
1627 if (typeName ==
"VuoData")
1635 double real = json_object_get_double(js);
1636 json_object_put(js);
1641 json_object *autoObject = NULL;
1642 if (json_object_object_get_ex(portDetails,
"auto", &autoObject))
1643 if (real == json_object_get_double(autoObject))
1652 json_object *details = NULL;
1658 json_object *menuItemsValue = NULL;
1659 if (details && json_object_object_get_ex(details,
"menuItems", &menuItemsValue))
1663 if (portValue ==
"false")
1665 else if (portValue ==
"true")
1668 int len = json_object_array_length(menuItemsValue);
1669 for (
int i = 0; i < len; ++i)
1671 json_object *menuItem = json_object_array_get_idx(menuItemsValue, i);
1672 if (json_object_is_type(menuItem, json_type_object))
1674 json_object *value = NULL;
1675 if (json_object_object_get_ex(menuItem,
"value", &value))
1676 if ((json_object_is_type(value, json_type_string) && portValue == json_object_get_string(value))
1677 || (json_object_is_type(value, json_type_int ) && atol(portValue.c_str()) == json_object_get_int64(value)))
1679 json_object *name = NULL;
1680 if (json_object_object_get_ex(menuItem,
"name", &name))
1696 json_object_put(js);
1701 json_object *autoObject = NULL;
1702 if (json_object_object_get_ex(portDetails,
"auto", &autoObject))
1707 return format(
"%lld", i);
1712 QList<float> pointList = QList<float>() << p.x << p.y;
1718 QList<float> pointList = QList<float>() << p.x << p.y << p.z;
1724 QList<float> pointList = QList<float>() << p.x << p.y << p.z << p.w;
1730 json_object *o = NULL;
1732 const char *fontName = NULL;
1733 if (json_object_object_get_ex(js,
"fontName", &o))
1734 fontName = json_object_get_string(o);
1736 double pointSize = 0;
1737 if (json_object_object_get_ex(js,
"pointSize", &o))
1738 pointSize = json_object_get_double(o);
1740 bool underline =
false;
1741 if (json_object_object_get_ex(js,
"underline", &o))
1742 underline = json_object_get_boolean(o);
1743 const char *underlineString = underline ?
" [U]" :
"";
1745 string outputString;
1747 outputString =
format(
"%s %gpt%s", fontName, pointSize, underlineString);
1749 json_object_put(js);
1751 return outputString;
1753 if (
getDataType()->getModuleKey()==
"VuoMathExpressionList")
1756 json_object *expressionsObject = NULL;
1759 if (json_object_object_get_ex(js,
"expressions", &expressionsObject))
1761 if (json_object_get_type(expressionsObject) == json_type_array)
1763 int itemCount = json_object_array_length(expressionsObject);
1766 json_object *itemObject = json_object_array_get_idx(expressionsObject, 0);
1767 if (json_object_get_type(itemObject) == json_type_string)
1768 expression = json_object_get_string(itemObject);
1773 json_object_put(js);
1777 if (
getDataType()->getModuleKey()==
"VuoRealRegulation")
1780 json_object *o = NULL;
1782 string outputString;
1783 if (json_object_object_get_ex(js,
"name", &o))
1784 outputString = json_object_get_string(o);
1786 json_object_put(js);
1788 return outputString;
1796 string s =
format(
"%lu×%lu", value->pixelsWide, value->pixelsHigh);
1800 if (
getDataType()->getModuleKey()==
"VuoTransform")
1807 if (value.type == VuoTransformTypeTargeted)
1808 return format(
"(%g,%g,%g) toward (%g,%g,%g)",
1809 value.translation.x, value.translation.y, value.translation.z, value.rotationSource.target.x, value.rotationSource.target.y, value.rotationSource.target.z);
1812 if (value.type == VuoTransformTypeQuaternion)
1813 rotation =
format(
"‹%g,%g,%g,%g›",
1814 value.rotationSource.quaternion.x, value.rotationSource.quaternion.y, value.rotationSource.quaternion.z, value.rotationSource.quaternion.w);
1818 rotation =
format(
"(%g°,%g°,%g°)",
1822 return format(
"(%g,%g,%g) %s %g×%g×%g",
1823 value.translation.x, value.translation.y, value.translation.z, rotation.c_str(), value.scale.x, value.scale.y, value.scale.z);
1825 if (
getDataType()->getModuleKey()==
"VuoTransform2d")
1833 return format(
"(%g,%g) %g° %g×%g",
1834 value.translation.x, value.translation.y, rotationInDegrees, value.scale.x, value.scale.y);
1836 if (
getDataType()->getModuleKey()==
"VuoMovieFormat")
1839 json_object *o = NULL;
1841 const char *imageEncoding = NULL;
1842 if (json_object_object_get_ex(js,
"imageEncoding", &o))
1844 imageEncoding = json_object_get_string(o);
1845 if (strcasecmp(imageEncoding,
"jpeg") == 0)
1846 imageEncoding =
"JPEG";
1847 else if (strcasecmp(imageEncoding,
"h264") == 0)
1848 imageEncoding =
"H.264";
1849 else if (strcasecmp(imageEncoding,
"prores4444") == 0)
1850 imageEncoding =
"ProRes 4444";
1851 else if (strcasecmp(imageEncoding,
"prores422") == 0)
1852 imageEncoding =
"ProRes 422";
1853 else if (strcasecmp(imageEncoding,
"prores422-hq") == 0)
1854 imageEncoding =
"ProRes 422 HQ";
1855 else if (strcasecmp(imageEncoding,
"prores422-lt") == 0)
1856 imageEncoding =
"ProRes 422 LT";
1857 else if (strcasecmp(imageEncoding,
"prores422-proxy") == 0)
1858 imageEncoding =
"ProRes 422 Proxy";
1859 else if (strcmp(imageEncoding,
"hevc") == 0)
1860 imageEncoding =
"HEVC";
1861 else if (strcmp(imageEncoding,
"hevc-alpha") == 0)
1862 imageEncoding =
"HEVC+Alpha";
1865 const char *audioEncoding = NULL;
1866 if (json_object_object_get_ex(js,
"audioEncoding", &o))
1868 audioEncoding = json_object_get_string(o);
1869 if (strcmp(audioEncoding,
"LinearPCM") == 0)
1870 audioEncoding =
"Linear PCM";
1873 string outputString;
1874 if (imageEncoding && audioEncoding)
1875 outputString =
format(
"%s, %s", imageEncoding, audioEncoding);
1877 json_object_put(js);
1879 return outputString;
1884 json_object *o = NULL;
1887 if (json_object_object_get_ex(js,
"type", &o))
1891 if (type == VuoScreenType_Active)
1893 else if (type == VuoScreenType_Primary)
1895 else if (type == VuoScreenType_Secondary)
1896 label =
"Secondary";
1897 else if (type == VuoScreenType_MatchName)
1899 if (json_object_object_get_ex(js,
"name", &o))
1900 label = json_object_get_string(o);
1902 else if (type == VuoScreenType_MatchId)
1907 label = realizedScreen.
name;
1910 json_object_put(js);
1914 if (
getDataType()->getModuleKey()==
"VuoSerialDevice")
1917 json_object *o = NULL;
1919 const char *name = NULL;
1920 if (json_object_object_get_ex(js,
"name", &o))
1921 name = json_object_get_string(o);
1922 else if (json_object_object_get_ex(js,
"path", &o))
1923 name = json_object_get_string(o);
1925 string outputString =
"First";
1926 if (name && strlen(name))
1927 outputString = name;
1929 json_object_put(js);
1931 return outputString;
1933 if (
getDataType()->getModuleKey()==
"VuoMidiInputDevice")
1936 json_object *o = NULL;
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 =
"First";
1943 if (name && strlen(name))
1944 outputString = name;
1946 json_object_put(js);
1948 return outputString;
1950 if (
getDataType()->getModuleKey()==
"VuoMidiOutputDevice")
1953 json_object *o = NULL;
1955 const char *name = NULL;
1956 if (json_object_object_get_ex(js,
"name", &o))
1957 name = json_object_get_string(o);
1959 string outputString =
"First";
1960 if (name && strlen(name))
1961 outputString = name;
1963 json_object_put(js);
1965 return outputString;
1967 if (
getDataType()->getModuleKey()==
"VuoSyphonServerDescription")
1970 json_object *o = NULL;
1972 const char *name = NULL;
1973 if (json_object_object_get_ex(js,
"serverName", &o))
1975 const char *n = json_object_get_string(o);
1979 if (!name && json_object_object_get_ex(js,
"applicationName", &o))
1981 const char *n = json_object_get_string(o);
1986 string outputString =
"First";
1987 if (name && strlen(name))
1988 outputString = name;
1990 json_object_put(js);
1992 return outputString;
1994 if (
getDataType()->getModuleKey()==
"VuoVideoInputDevice")
1997 json_object *o = NULL;
1999 const char *name = NULL;
2000 if (json_object_object_get_ex(js,
"name", &o))
2001 name = json_object_get_string(o);
2002 else if (json_object_object_get_ex(js,
"id", &o))
2003 name = json_object_get_string(o);
2005 string outputString =
"Default";
2006 if (name && strlen(name))
2007 outputString = name;
2009 json_object_put(js);
2011 return outputString;
2015 if (
getDataType()->getModuleKey()==
"VuoHidDevice")
2018 json_object *o = NULL;
2020 QString outputString;
2021 if (json_object_object_get_ex(js,
"name", &o))
2023 outputString = json_object_get_string(o);
2026 outputString = outputString.section(
" (", 0, 0);
2028 else if (json_object_object_get_ex(js,
"matchType", &o))
2030 const char *matchType = json_object_get_string(o);
2031 if (strcmp(matchType,
"usage") == 0)
2034 if (json_object_object_get_ex(js,
"usagePage", &o))
2035 usagePage = json_object_get_int(o);
2037 if (json_object_object_get_ex(js,
"usage", &o))
2038 usage = json_object_get_int(o);
2039 json_object_put(js);
2043 json_object_put(js);
2045 return outputString.toStdString();
2047 if (
getDataType()->getModuleKey()==
"VuoOscInputDevice"
2048 ||
getDataType()->getModuleKey()==
"VuoOscOutputDevice")
2051 json_object *o = NULL;
2053 const char *name = NULL;
2054 if (json_object_object_get_ex(js,
"name", &o))
2055 name = json_object_get_string(o);
2057 string outputString =
"Auto";
2058 if (name && strlen(name))
2059 outputString = name;
2061 json_object_put(js);
2063 return outputString;
2065 if (
getDataType()->getModuleKey()==
"VuoArtNetInputDevice"
2066 ||
getDataType()->getModuleKey()==
"VuoArtNetOutputDevice")
2069 json_object *o = NULL;
2071 const char *name = NULL;
2072 if (json_object_object_get_ex(js,
"name", &o))
2073 name = json_object_get_string(o);
2076 if (
getDataType()->getModuleKey()==
"VuoArtNetInputDevice")
2083 if (json_object_object_get_ex(js,
"net", &o))
2084 net = json_object_get_int64(o);
2085 if (json_object_object_get_ex(js,
"subNet", &o))
2086 subNet = json_object_get_int64(o);
2087 if (json_object_object_get_ex(js,
"universe", &o))
2088 universe = json_object_get_int64(o);
2090 string outputString =
format(
"%s (%lld:%lld:%lld)", name, net, subNet, universe);
2092 json_object_put(js);
2094 return outputString;
2096 if (
getDataType()->getModuleKey()==
"VuoTempoRange")
2099 const char *tempoRange = json_object_get_string(js);
2102 if (strcmp(tempoRange,
"andante") == 0)
2103 return "70–110 BPM";
2104 else if (strcmp(tempoRange,
"moderato") == 0)
2105 return "100–140 BPM";
2106 else if (strcmp(tempoRange,
"allegro") == 0)
2107 return "120–180 BPM";
2108 else if (strcmp(tempoRange,
"presto") == 0)
2109 return "170–250 BPM";
2110 else if (strcmp(tempoRange,
"prestissimo") == 0)
2111 return "220–320 BPM";
2113 if (
getDataType()->getModuleKey()==
"VuoEdgeBlend")
2117 double cutoff = 0, gamma = 0, crop = 0;
2118 json_object *o = NULL;
2120 if (json_object_object_get_ex(js,
"cutoff", &o))
2121 cutoff = json_object_get_double(o);
2123 if (json_object_object_get_ex(js,
"gamma", &o))
2124 gamma = json_object_get_double(o);
2126 if (json_object_object_get_ex(js,
"crop", &o))
2127 crop = json_object_get_double(o);
2129 json_object_put(js);
2131 double cropPercent = -crop * 100;
2132 double cutoffPercent = cutoff * 100;
2136 return format(
"%.0f%%", cropPercent);
2138 return format(
"%.0f%% %.0f%%", cropPercent, cutoffPercent);
2140 return format(
"%.0f%% %.0f%% @ %.2gγ", cropPercent, cutoffPercent, gamma);
2148 json_object *o = NULL;
2150 if (json_object_object_get_ex(js,
"minimum", &o))
2151 minimum = json_object_get_double(o);
2153 if (json_object_object_get_ex(js,
"maximum", &o))
2154 maximum = json_object_get_double(o);
2156 json_object_put(js);
2159 return format(
"%.4g to %.4g", minimum, maximum);
2161 return format(
"%.4g to ∞", minimum);
2163 return format(
"-∞ to %.4g", maximum);
2165 return format(
"-∞ to ∞");
2167 if (
getDataType()->getModuleKey()==
"VuoIntegerRange")
2173 json_object *o = NULL;
2175 if (json_object_object_get_ex(js,
"minimum", &o))
2176 minimum = json_object_get_int64(o);
2178 if (json_object_object_get_ex(js,
"maximum", &o))
2179 maximum = json_object_get_int64(o);
2181 json_object_put(js);
2184 return format(
"%lld to %lld", minimum, maximum);
2186 return format(
"%lld to ∞", minimum);
2188 return format(
"-∞ to %lld", maximum);
2190 return format(
"-∞ to ∞");
2194 if (
getDataType()->getModuleKey() ==
"VuoBlackmagicInputDevice"
2195 ||
getDataType()->getModuleKey() ==
"VuoBlackmagicOutputDevice")
2199 if (json_object_object_get_ex(js,
"name", &o))
2200 return json_object_get_string(o);
2206 if (
getDataType()->getModuleKey() ==
"VuoNdiSource")
2209 json_object *o, *o2;
2210 if (json_object_object_get_ex(js,
"name", &o))
2211 return json_object_get_string(o);
2212 else if (json_object_object_get_ex(js,
"ipAddress", &o)
2213 && json_object_object_get_ex(js,
"port", &o2))
2214 return format(
"%s:%lld", json_object_get_string(o), json_object_get_int(o2));
2215 else if (json_object_object_get_ex(js,
"ipAddress", &o))
2216 return json_object_get_string(o);
2224 if (json_object_get_type(js) == json_type_string)
2226 string textWithoutQuotes = json_object_get_string(js);
2227 json_object_put(js);
2237 if (type ==
"VuoText"
2238 || type ==
"VuoImageFormat"
2239 || type ==
"VuoAudioEncoding"
2240 || type ==
"VuoBlackmagicConnection"
2241 || type ==
"VuoBlackmagicVideoMode"
2242 || type ==
"VuoMovieImageEncoding")
2243 return textWithoutQuotes;
2246 if (type ==
"VuoTableFormat")
2248 std::transform(textWithoutQuotes.begin(), textWithoutQuotes.end(), textWithoutQuotes.begin(), ::toupper);
2249 return textWithoutQuotes;
2254 for (
auto it = textWithoutQuotes.begin(); it != textWithoutQuotes.end();)
2257 textWithoutQuotes.erase(it);
2265 json_object_put(js);