<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Folks,<div><br></div><div>Yesterday I merged a patch that allows std::vector<T> to be used from the Python wrappers, where T can be 'std::string' or any numeric type from 'signed char' to 'float' (including typedefs to those types).</div><div><br></div><div>This means that if you add a C++ method to VTK that takes std::vector<std::string>, then in Python you can pass a list or any other Python sequence and the wrappers will convert it to a vector for you.</div><div><br></div><div>Method examples that can accept any Python sequence:</div><div>    void SetStrings(std::vector<std::string> strings);</div><div>    void SetStrings(const std::vector<std::string>& strings);</div><div><br></div><div>Method example that takes a Python mutable sequence (the C++ method can write back to the container, since this is pass-by-reference):</div><div>    void GetStrings(std::vector<std::string>& strings);</div><div><br></div><div>Method examples that return a vector (which is converted to a Python tuple):</div><div>    const std::vector<std::string>& GetStrings();</div><div>    std::vector<std::string>& GetStrings();</div><div>    std::vector<std::string> GetStrings();</div><div><br></div><div>Note that std::vector is not 'wrapped' per se.  Instead, what is going on here is that the wrappers are converting to/from Python container types. My primary goal was convenience rather than efficiency, we can always add a wrapped std::vector type at a later date without sacrificing the convenience of automatic conversion.</div><div><br></div><div>Chances are good that I'll be able to add std::vectors of VTK objects (smart or dumb pointers) and vtkVariant before VTK 9, but only if someone adds methods to VTK that take parameters of those types (as far as I know, there aren't any yet).</div><div><br></div><div>See the following VTK gitlab issue for additional information:</div><div><a href="https://gitlab.kitware.com/vtk/vtk/issues/17362">https://gitlab.kitware.com/vtk/vtk/issues/17362</a><br></div><div><br></div><div>The following is a list of VTK methods that take std::vector that have been wrapped due to this change (it is a short list, since people have historically avoided using std::vector as part of the VTK public API due to the obvious reason that they didn't want to exclude their methods from wrapping):</div><div><br></div><div><div>vtkActor::ProcessSelectorPixelBuffers</div><div>vtkAMRInformation::GetNumBlocks</div><div>vtkCompositePolyDataMapper2::ProcessSelectorPixelBuffers</div><div>vtkMapper::ProcessSelectorPixelBuffers</div><div>vtkMultiProcessStream::GetRawData</div><div>vtkMultiProcessStream::SetRawData</div><div>vtkOpenGLGlyph3DHelper::GlyphRender</div><div>vtkOpenGLIndexBufferObject::AppendTriangleIndexBuffer</div><div>vtkOpenGLIndexBufferObject::AppendLineIndexBuffer</div><div>vtkOpenGLIndexBufferObject::AppendTriangleLineIndexBuffer</div><div>vtkOpenGLIndexBufferObject::AppendPointIndexBuffer</div><div>vtkOpenGLIndexBufferObject::AppendStripIndexBuffer</div><div>vtkOpenGLIndexBufferObject::AppendEdgeFlagIndexBuffer</div><div>vtkOpenGLMoleculeMapper::ProcessSelectorPixelBuffers</div><div>vtkOpenGLPointGaussianMapper::ProcessSelectorPixelBuffers</div><div>vtkOpenGLPolyDataMapper::HandleAppleBug</div><div>vtkOpenGLPolyDataMapper::ProcessSelectorPixelBuffers</div><div>vtkOpenGLVertexBufferObject::SetShift</div><div>vtkOpenGLVertexBufferObject::SetScale</div><div>vtkOpenGLVertexBufferObject::GetShift</div><div>vtkOpenGLVertexBufferObject::GetScale</div><div>vtkOpenGLVertexBufferObject::GetPackedVBO</div><div>vtkParallelAMRUtilities::DistributeProcessInformation</div><div>vtkProp::ProcessSelectorPixelBuffers</div><div>vtkResourceFileLocator::Locate</div><div>vtkShadowMapPass::ShadowMapTransforms</div><div>vtkShadowMapPass::GetShadowMapTextureUnits</div><div>vtkSparseArray::GetUniqueCoordinates</div><div>vtkUnicodeString::utf16_str</div></div><div><br></div><div>Cheers,</div><div> - David</div></div></div></div>