|
4 | 4 | #ifndef INCLUDED_OCIO_PYOPENCOLORIO_H |
5 | 5 | #define INCLUDED_OCIO_PYOPENCOLORIO_H |
6 | 6 |
|
| 7 | +#include <typeinfo> |
| 8 | + |
7 | 9 | #include <pybind11/pybind11.h> |
8 | 10 | #include <pybind11/operators.h> |
9 | 11 | #include <pybind11/stl.h> |
@@ -58,142 +60,140 @@ void bindPyMixingHelpers(pybind11::module & m); |
58 | 60 | // is needed to return Transform subclass types from the OCIO API. See: |
59 | 61 | // https://pybind11.readthedocs.io/en/stable/advanced/classes.html#custom-automatic-downcasters |
60 | 62 |
|
61 | | -namespace OCIO = OCIO_NAMESPACE; |
62 | | - |
63 | 63 | namespace PYBIND11_NAMESPACE |
64 | 64 | { |
65 | 65 |
|
66 | 66 | template<> |
67 | | -struct polymorphic_type_hook<OCIO::ImageDesc> { |
68 | | - static const void *get(const OCIO::ImageDesc *const src, const std::type_info*& type) { |
| 67 | +struct polymorphic_type_hook<OCIO_NAMESPACE::ImageDesc> { |
| 68 | + static const void *get(const OCIO_NAMESPACE::ImageDesc *const src, const std::type_info*& type) { |
69 | 69 | // Note: src may be nullptr |
70 | 70 | if (src) |
71 | 71 | { |
72 | | - if(dynamic_cast<const OCIO::PackedImageDesc*>(src)) |
| 72 | + if(dynamic_cast<const OCIO_NAMESPACE::PackedImageDesc*>(src)) |
73 | 73 | { |
74 | | - type = &typeid(OCIO::PackedImageDesc); |
| 74 | + type = &typeid(OCIO_NAMESPACE::PackedImageDesc); |
75 | 75 | } |
76 | | - else if(dynamic_cast<const OCIO::PlanarImageDesc*>(src)) |
| 76 | + else if(dynamic_cast<const OCIO_NAMESPACE::PlanarImageDesc*>(src)) |
77 | 77 | { |
78 | | - type = &typeid(OCIO::PlanarImageDesc); |
| 78 | + type = &typeid(OCIO_NAMESPACE::PlanarImageDesc); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | return src; |
82 | 82 | } |
83 | 83 | }; |
84 | 84 |
|
85 | 85 | template<> |
86 | | -struct polymorphic_type_hook<OCIO::GpuShaderCreator> { |
87 | | - static const void *get(const OCIO::GpuShaderCreator *const src, const std::type_info*& type) { |
| 86 | +struct polymorphic_type_hook<OCIO_NAMESPACE::GpuShaderCreator> { |
| 87 | + static const void *get(const OCIO_NAMESPACE::GpuShaderCreator *const src, const std::type_info*& type) { |
88 | 88 | // Note: src may be nullptr |
89 | 89 | if (src) |
90 | 90 | { |
91 | | - if(dynamic_cast<const OCIO::GpuShaderDesc*>(src)) |
| 91 | + if(dynamic_cast<const OCIO_NAMESPACE::GpuShaderDesc*>(src)) |
92 | 92 | { |
93 | | - type = &typeid(OCIO::GpuShaderDesc); |
| 93 | + type = &typeid(OCIO_NAMESPACE::GpuShaderDesc); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | return src; |
97 | 97 | } |
98 | 98 | }; |
99 | 99 |
|
100 | 100 | template<> |
101 | | -struct polymorphic_type_hook<OCIO::Transform> { |
102 | | - static const void *get(const OCIO::Transform *const src, const std::type_info*& type) { |
| 101 | +struct polymorphic_type_hook<OCIO_NAMESPACE::Transform> { |
| 102 | + static const void *get(const OCIO_NAMESPACE::Transform *const src, const std::type_info*& type) { |
103 | 103 | // Note: src may be nullptr |
104 | 104 | if (src) |
105 | 105 | { |
106 | | - if(dynamic_cast<const OCIO::AllocationTransform*>(src)) |
| 106 | + if(dynamic_cast<const OCIO_NAMESPACE::AllocationTransform*>(src)) |
107 | 107 | { |
108 | | - type = &typeid(OCIO::AllocationTransform); |
| 108 | + type = &typeid(OCIO_NAMESPACE::AllocationTransform); |
109 | 109 | } |
110 | | - else if(dynamic_cast<const OCIO::BuiltinTransform*>(src)) |
| 110 | + else if(dynamic_cast<const OCIO_NAMESPACE::BuiltinTransform*>(src)) |
111 | 111 | { |
112 | | - type = &typeid(OCIO::BuiltinTransform); |
| 112 | + type = &typeid(OCIO_NAMESPACE::BuiltinTransform); |
113 | 113 | } |
114 | | - else if(dynamic_cast<const OCIO::CDLTransform*>(src)) |
| 114 | + else if(dynamic_cast<const OCIO_NAMESPACE::CDLTransform*>(src)) |
115 | 115 | { |
116 | | - type = &typeid(OCIO::CDLTransform); |
| 116 | + type = &typeid(OCIO_NAMESPACE::CDLTransform); |
117 | 117 | } |
118 | | - else if(dynamic_cast<const OCIO::ColorSpaceTransform*>(src)) |
| 118 | + else if(dynamic_cast<const OCIO_NAMESPACE::ColorSpaceTransform*>(src)) |
119 | 119 | { |
120 | | - type = &typeid(OCIO::ColorSpaceTransform); |
| 120 | + type = &typeid(OCIO_NAMESPACE::ColorSpaceTransform); |
121 | 121 | } |
122 | | - else if(dynamic_cast<const OCIO::DisplayViewTransform*>(src)) |
| 122 | + else if(dynamic_cast<const OCIO_NAMESPACE::DisplayViewTransform*>(src)) |
123 | 123 | { |
124 | | - type = &typeid(OCIO::DisplayViewTransform); |
| 124 | + type = &typeid(OCIO_NAMESPACE::DisplayViewTransform); |
125 | 125 | } |
126 | | - else if(dynamic_cast<const OCIO::ExponentTransform*>(src)) |
| 126 | + else if(dynamic_cast<const OCIO_NAMESPACE::ExponentTransform*>(src)) |
127 | 127 | { |
128 | | - type = &typeid(OCIO::ExponentTransform); |
| 128 | + type = &typeid(OCIO_NAMESPACE::ExponentTransform); |
129 | 129 | } |
130 | | - else if(dynamic_cast<const OCIO::ExponentWithLinearTransform*>(src)) |
| 130 | + else if(dynamic_cast<const OCIO_NAMESPACE::ExponentWithLinearTransform*>(src)) |
131 | 131 | { |
132 | | - type = &typeid(OCIO::ExponentWithLinearTransform); |
| 132 | + type = &typeid(OCIO_NAMESPACE::ExponentWithLinearTransform); |
133 | 133 | } |
134 | | - else if(dynamic_cast<const OCIO::ExposureContrastTransform*>(src)) |
| 134 | + else if(dynamic_cast<const OCIO_NAMESPACE::ExposureContrastTransform*>(src)) |
135 | 135 | { |
136 | | - type = &typeid(OCIO::ExposureContrastTransform); |
| 136 | + type = &typeid(OCIO_NAMESPACE::ExposureContrastTransform); |
137 | 137 | } |
138 | | - else if(dynamic_cast<const OCIO::FileTransform*>(src)) |
| 138 | + else if(dynamic_cast<const OCIO_NAMESPACE::FileTransform*>(src)) |
139 | 139 | { |
140 | | - type = &typeid(OCIO::FileTransform); |
| 140 | + type = &typeid(OCIO_NAMESPACE::FileTransform); |
141 | 141 | } |
142 | | - else if(dynamic_cast<const OCIO::FixedFunctionTransform*>(src)) |
| 142 | + else if(dynamic_cast<const OCIO_NAMESPACE::FixedFunctionTransform*>(src)) |
143 | 143 | { |
144 | | - type = &typeid(OCIO::FixedFunctionTransform); |
| 144 | + type = &typeid(OCIO_NAMESPACE::FixedFunctionTransform); |
145 | 145 | } |
146 | | - else if (dynamic_cast<const OCIO::GradingPrimaryTransform*>(src)) |
| 146 | + else if (dynamic_cast<const OCIO_NAMESPACE::GradingPrimaryTransform*>(src)) |
147 | 147 | { |
148 | | - type = &typeid(OCIO::GradingPrimaryTransform); |
| 148 | + type = &typeid(OCIO_NAMESPACE::GradingPrimaryTransform); |
149 | 149 | } |
150 | | - else if (dynamic_cast<const OCIO::GradingRGBCurveTransform*>(src)) |
| 150 | + else if (dynamic_cast<const OCIO_NAMESPACE::GradingRGBCurveTransform*>(src)) |
151 | 151 | { |
152 | | - type = &typeid(OCIO::GradingRGBCurveTransform); |
| 152 | + type = &typeid(OCIO_NAMESPACE::GradingRGBCurveTransform); |
153 | 153 | } |
154 | | - else if (dynamic_cast<const OCIO::GradingHueCurveTransform*>(src)) |
| 154 | + else if (dynamic_cast<const OCIO_NAMESPACE::GradingHueCurveTransform*>(src)) |
155 | 155 | { |
156 | | - type = &typeid(OCIO::GradingHueCurveTransform); |
| 156 | + type = &typeid(OCIO_NAMESPACE::GradingHueCurveTransform); |
157 | 157 | } |
158 | | - else if(dynamic_cast<const OCIO::GradingToneTransform*>(src)) |
| 158 | + else if(dynamic_cast<const OCIO_NAMESPACE::GradingToneTransform*>(src)) |
159 | 159 | { |
160 | | - type = &typeid(OCIO::GradingToneTransform); |
| 160 | + type = &typeid(OCIO_NAMESPACE::GradingToneTransform); |
161 | 161 | } |
162 | | - else if(dynamic_cast<const OCIO::GroupTransform*>(src)) |
| 162 | + else if(dynamic_cast<const OCIO_NAMESPACE::GroupTransform*>(src)) |
163 | 163 | { |
164 | | - type = &typeid(OCIO::GroupTransform); |
| 164 | + type = &typeid(OCIO_NAMESPACE::GroupTransform); |
165 | 165 | } |
166 | | - else if(dynamic_cast<const OCIO::LogAffineTransform*>(src)) |
| 166 | + else if(dynamic_cast<const OCIO_NAMESPACE::LogAffineTransform*>(src)) |
167 | 167 | { |
168 | | - type = &typeid(OCIO::LogAffineTransform); |
| 168 | + type = &typeid(OCIO_NAMESPACE::LogAffineTransform); |
169 | 169 | } |
170 | | - else if(dynamic_cast<const OCIO::LogCameraTransform*>(src)) |
| 170 | + else if(dynamic_cast<const OCIO_NAMESPACE::LogCameraTransform*>(src)) |
171 | 171 | { |
172 | | - type = &typeid(OCIO::LogCameraTransform); |
| 172 | + type = &typeid(OCIO_NAMESPACE::LogCameraTransform); |
173 | 173 | } |
174 | | - else if(dynamic_cast<const OCIO::LogTransform*>(src)) |
| 174 | + else if(dynamic_cast<const OCIO_NAMESPACE::LogTransform*>(src)) |
175 | 175 | { |
176 | | - type = &typeid(OCIO::LogTransform); |
| 176 | + type = &typeid(OCIO_NAMESPACE::LogTransform); |
177 | 177 | } |
178 | | - else if(dynamic_cast<const OCIO::LookTransform*>(src)) |
| 178 | + else if(dynamic_cast<const OCIO_NAMESPACE::LookTransform*>(src)) |
179 | 179 | { |
180 | | - type = &typeid(OCIO::LookTransform); |
| 180 | + type = &typeid(OCIO_NAMESPACE::LookTransform); |
181 | 181 | } |
182 | | - else if(dynamic_cast<const OCIO::Lut1DTransform*>(src)) |
| 182 | + else if(dynamic_cast<const OCIO_NAMESPACE::Lut1DTransform*>(src)) |
183 | 183 | { |
184 | | - type = &typeid(OCIO::Lut1DTransform); |
| 184 | + type = &typeid(OCIO_NAMESPACE::Lut1DTransform); |
185 | 185 | } |
186 | | - else if(dynamic_cast<const OCIO::Lut3DTransform*>(src)) |
| 186 | + else if(dynamic_cast<const OCIO_NAMESPACE::Lut3DTransform*>(src)) |
187 | 187 | { |
188 | | - type = &typeid(OCIO::Lut3DTransform); |
| 188 | + type = &typeid(OCIO_NAMESPACE::Lut3DTransform); |
189 | 189 | } |
190 | | - else if(dynamic_cast<const OCIO::MatrixTransform*>(src)) |
| 190 | + else if(dynamic_cast<const OCIO_NAMESPACE::MatrixTransform*>(src)) |
191 | 191 | { |
192 | | - type = &typeid(OCIO::MatrixTransform); |
| 192 | + type = &typeid(OCIO_NAMESPACE::MatrixTransform); |
193 | 193 | } |
194 | | - else if(dynamic_cast<const OCIO::RangeTransform*>(src)) |
| 194 | + else if(dynamic_cast<const OCIO_NAMESPACE::RangeTransform*>(src)) |
195 | 195 | { |
196 | | - type = &typeid(OCIO::RangeTransform); |
| 196 | + type = &typeid(OCIO_NAMESPACE::RangeTransform); |
197 | 197 | } |
198 | 198 | } |
199 | 199 | return src; |
|
0 commit comments