diff --git a/src/opentimelineio/unknownSchema.h b/src/opentimelineio/unknownSchema.h index 4ba11087e..e0e738f7b 100644 --- a/src/opentimelineio/unknownSchema.h +++ b/src/opentimelineio/unknownSchema.h @@ -31,6 +31,11 @@ class UnknownSchema : public SerializableObject return _original_schema_version; } + AnyDictionary& data() noexcept + { + return _data; + } + bool read_from(Reader&) override; void write_to(Writer&) const override; diff --git a/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp b/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp index 5a99ed8b8..fcf8fcda8 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp +++ b/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp @@ -182,6 +182,9 @@ static void define_bases1(py::module m) { .def_property_readonly("is_unknown_schema", &SerializableObject::is_unknown_schema); py::class_>(m, "UnknownSchema") + .def_property_readonly("data", [](UnknownSchema* schema) { + auto ptr = schema->data().get_or_create_mutation_stamp(); + return (AnyDictionaryProxy*)(ptr); }, py::return_value_policy::take_ownership) .def_property_readonly("original_schema_name", &UnknownSchema::original_schema_name) .def_property_readonly("original_schema_version", &UnknownSchema::original_schema_version); diff --git a/tests/test_unknown_schema.py b/tests/test_unknown_schema.py index 54e2b89b6..f35d3b63a 100644 --- a/tests/test_unknown_schema.py +++ b/tests/test_unknown_schema.py @@ -63,6 +63,17 @@ def test_is_unknown_schema(self): unknown = self.orig.media_reference.metadata["stuff"] self.assertTrue(unknown.is_unknown_schema) + def test_unknown_to_dict(self): + unknown = self.orig.media_reference.metadata["stuff"] + self.assertTrue(unknown.is_unknown_schema) + self.assertEqual( + unknown.data, + { + "some_data": 895, + "howlongami": otio.opentime.RationalTime(rate=30, value=100) + } + ) + if __name__ == '__main__': unittest.main()