<div dir="ltr">Hi Marcus,<div><br></div><div>Thanks for your information.<br></div><div>I first found vtkAbstractObjectFactoryNewMacro, and did not notice <span style="font-family:arial,sans-serif;font-size:13px">vtkObjectFactoryNewMacro until a few hours ago,</span><span style="font-family:arial,sans-serif;font-size:13px"> that suited best for this case.</span></div>
<div><font face="arial, sans-serif">But i didn't know about </font><span style="font-family:arial,sans-serif;font-size:13px">VTK_ALL_NEW_OBJECT_FACTORY, that's interesting to support old versions.</span></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I'm reworking my code in vtk style and push it to gerrit soon.</span></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">By any chance, have you an idea about my cmake warning?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">my unit test does not use any image data, include file, or specific code for png...</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-18 13:06 GMT+01:00 Marcus D. Hanwell <span dir="ltr"><<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div class=""><br>
On Thu, Mar 13, 2014 at 10:31 AM, Xabi Riobe <<a href="mailto:xabivtk@gmail.com">xabivtk@gmail.com</a>> wrote:<br>
> Hi,<br>
> I have a set of painter classes using VBO (adapted from VTKEdge) and<br>
> VertexArrays that i'm willing to share via gerrit, but there is an issue i<br>
> would like to resolve before, in order to add the test class.<br>
><br>
> Currently i use them with vtk 5.10.1, and i have a rendering factory to<br>
> instantiate them instead of vtkPolygonsPainter, vtkLinesPainter and<br>
> vtkTStripsPainter.<br>
><br>
> but with vtk 6.1, the factory mechanism has changed and i can not manage to<br>
> make it work properly. So i first try to localy test my classes with the new<br>
> version by incorporating them directly in vtkRenderingOpenGLObjectFactory,<br>
> adding these lines in Rendering\OpenGL\CMakeLists.txt :<br>
><br>
> list(APPEND vtk_module_overrides "vtkPolygonsPainter")<br>
> set(vtk_module_vtkPolygonsPainter_override<br>
> "vtkOpenGLVertexArrayPolygonsPainter")<br>
><br>
> Runing my test in debug, i can see that the class is added in the factory,<br>
> but when the vtkChooserPainter creates the vtkPolygonsPainter, my own class<br>
> is not instantiated, nor it is if i directly call vtkPolygonsPainter::New()<br>
> in the test.<br>
><br>
> Is there something else i am missing to use my class in a factory with vtk<br>
> 6.1?<br>
><br>
</div>Part of the VTK 6 changes involved moving from all VTK classes<br>
checking for overrides to only those designed to do so. If you look<br>
the vtkPolygonsPainter uses vtkStandardNewMacro in its implementation,<br>
if you want to override it using the factory mechanism then it should<br>
use vtkObjectFactoryNewMacro which will check the object factory<br>
before falling back to the actual class that was instantiated.<br>
<br>
There is also a compile time switch, VTK_ALL_NEW_OBJECT_FACTORY, which<br>
defaults to off and will force all classes to use the object factory<br>
(as was the default before VTK 6.<br>
<br>
Hope that makes things clearer.<br>
<span class="HOEnZb"><font color="#888888"><br>
Marcus<br>
</font></span></blockquote></div><br></div>