diff --git a/src/OpenColorIO/Config.cpp b/src/OpenColorIO/Config.cpp index 2ac057244..d4d5fbe7f 100644 --- a/src/OpenColorIO/Config.cpp +++ b/src/OpenColorIO/Config.cpp @@ -798,7 +798,7 @@ class Config::Impl } const ViewVec & views = searchShared ? m_sharedViews : iter->second.m_views; - const auto & viewIt = FindView(views, view); + const auto viewIt = FindView(views, view); if (viewIt != views.end()) { diff --git a/src/OpenColorIO/fileformats/ctf/CTFReaderHelper.cpp b/src/OpenColorIO/fileformats/ctf/CTFReaderHelper.cpp index f8ecd7eb6..1bf162db3 100644 --- a/src/OpenColorIO/fileformats/ctf/CTFReaderHelper.cpp +++ b/src/OpenColorIO/fileformats/ctf/CTFReaderHelper.cpp @@ -856,25 +856,25 @@ void CTFReaderInfoElt::end() ////////////////////////////////////////////////////////// -void CTFReaderDescElt::start(const char ** atttributes ) +void CTFReaderDescElt::start(const char ** atts ) { m_desc = {}; m_language = {}; - const char ** attr = atttributes; - while (*attr) + unsigned i = 0; + while (atts[i] && *atts[i]) { - if (0 == Platform::Strcasecmp(ATTR_LANGUAGE, *attr)) + if (0 == Platform::Strcasecmp(ATTR_LANGUAGE, *atts)) { - if (!attr || !(attr + 1)) + if (!atts[i + 1] || !*atts[i + 1]) { throwMessage("Attribute 'language' does not have a value."); } - m_language = *(attr + 1); + m_language = atts[i + 1]; } - attr += 2; + i += 2; } } diff --git a/src/bindings/python/PyGradingData.cpp b/src/bindings/python/PyGradingData.cpp index a1a093d7b..c34179cf4 100644 --- a/src/bindings/python/PyGradingData.cpp +++ b/src/bindings/python/PyGradingData.cpp @@ -21,11 +21,14 @@ using GradingControlPointIterator = PyIteratorsetSplineType(from->getSplineType()); + const size_t numPt = from->getNumControlPoints(); to->setNumControlPoints(numPt); for (size_t pt = 0; pt < numPt; ++pt) { to->getControlPoint(pt) = from->getControlPoint(pt); + to->setSlope(pt, from->getSlope(pt)); } } diff --git a/tests/python/GradingDataTest.py b/tests/python/GradingDataTest.py index 39cd8ba5c..34abd89ff 100644 --- a/tests/python/GradingDataTest.py +++ b/tests/python/GradingDataTest.py @@ -368,6 +368,29 @@ def test_huecurve(self): assertEqualBSpline(self, hcrv.lum_sat, ls) self.assertEqual(hcrv.lum_sat, ls) + # Check that setting the hue curve preserves the spline type. + hcrv.hue_sat = ls + ls2 = hcrv.hue_sat + # Spline type is now different than what hue_sat normally uses (PERIODIC_1_B_SPLINE). + self.assertEqual(ls2.getSplineType(), OCIO.HORIZONTAL1_B_SPLINE) + self.assertEqual(hcrv.hue_sat, ls) + self.assertEqual(ls2, ls) + + # Check that setting the hue curve preserves the slopes. + self.assertEqual(ls.slopesAreDefault(), True) + slopes = ls.getSlopes() + slopes[1] = 0.5 + ls.setSlopes(slopes) + self.assertEqual(ls.slopesAreDefault(), False) + hcrv.hue_sat = ls + ls2 = hcrv.hue_sat + self.assertEqual(ls2.slopesAreDefault(), False) + slopes2 = ls2.getSlopes() + self.assertEqual(slopes2[1], 0.5) + self.assertEqual(slopes2, slopes) + self.assertEqual(hcrv.hue_sat, ls) + self.assertEqual(ls2, ls) + def test_rgbmsw(self): """ Test the GradingRGBMSW struct.