Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/OpenColorIO/fileformats/ctf/CTFReaderHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,11 +862,11 @@ void CTFReaderDescElt::start(const char ** atttributes )
m_language = {};

const char ** attr = atttributes;
while (*attr)
while (attr && *attr)
{
if (0 == Platform::Strcasecmp(ATTR_LANGUAGE, *attr))
{
if (!attr || !(attr + 1))
if (!(attr + 1) || !*(attr + 1))
{
throwMessage("Attribute 'language' does not have a value.");
}
Expand Down
3 changes: 3 additions & 0 deletions src/bindings/python/PyGradingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ using GradingControlPointIterator = PyIterator<GradingBSplineCurveRcPtr, IT_CONT

void CopyGradingBSpline(GradingBSplineCurveRcPtr to, const ConstGradingBSplineCurveRcPtr from)
{
to->setSplineType(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));
}
}

Expand Down
23 changes: 23 additions & 0 deletions tests/python/GradingDataTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading