MCPcopy Create free account
hub / github.com/ImageEngine/cortex / PathFromInternedStringVectorData

Class PathFromInternedStringVectorData

src/IECorePython/PathMatcherBinding.cpp:184–210  ·  view source on GitHub ↗

PathMatcher paths are just std::vector , which doesn't exist in Python. So we register a conversion from InternedStringVectorData which contains just such a vector. \todo We could instead do this in the Cortex bindings for all VectorTypedData types.

Source from the content-addressed store, hash-verified

182/// \todo We could instead do this in the Cortex bindings for all
183/// VectorTypedData types.
184struct PathFromInternedStringVectorData
185{
186
187 PathFromInternedStringVectorData()
188 {
189 boost::python::converter::registry::push_back(
190 &convertible,
191 nullptr,
192 boost::python::type_id<std::vector<InternedString>>()
193 );
194 }
195
196 static void *convertible( PyObject *obj )
197 {
198 extract<IECore::InternedStringVectorData *> dataExtractor( obj );
199 if( dataExtractor.check() )
200 {
201 if( IECore::InternedStringVectorData *data = dataExtractor() )
202 {
203 return &(data->writable());
204 }
205 }
206
207 return nullptr;
208 }
209
210};
211
212// As a convenience we also accept strings in place of paths when
213// calling from python. We deliberately don't do the same in c++ to force

Callers 1

bindPathMatcherMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected