Skip to content

Commit aa34e9a

Browse files
committed
Color equality check in Python
Signed-off-by: Spencer Magnusson <spencer.magnusson@dreamworks.com>
1 parent 7adfb27 commit aa34e9a

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/opentimelineio/color.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ class OTIO_API_TYPE Color
6363
&& lhs.to_agbr_integer() == rhs.to_agbr_integer();
6464
}
6565

66+
friend bool operator!=(Color lhs, Color rhs) noexcept
67+
{
68+
return !(lhs == rhs);
69+
}
70+
6671
OTIO_API std::string to_hex();
6772
OTIO_API std::vector<int> to_rgba_int_list(int base);
6873
OTIO_API unsigned int to_agbr_integer();

src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ define_bases2(py::module m)
355355
"b"_a = 1.0,
356356
"a"_a = 1.0,
357357
py::arg_v("name"_a = std::string()))
358+
.def(py::self == py::self)
359+
.def(py::self != py::self)
358360
.def_property("r", &Color::r, &Color::set_r)
359361
.def_property("g", &Color::g, &Color::set_g)
360362
.def_property("b", &Color::b, &Color::set_b)

0 commit comments

Comments
 (0)