<div dir="ltr">The filenames shouldn't matter. The check for the vtk prefix is hard-coded into the wrappers but it doesn't really need to be. If you do your own VTK build, you can try removing the hard-coding to see what happens. Look in vtkWrap.c for vtkWrap_IsVTKObject(), vtkWrap_IsSpecialObject(), and vtkWrap_IsPythonObject(). You might just have to change vtkWrap_IsSpecialObject() so that it reads like this:<div><br></div><div><div><div>int vtkWrap_IsSpecialObject(ValueInfo *val)</div><div>{</div><div> unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE);</div><div> return ((t == VTK_PARSE_OBJECT ||</div><div>      t == VTK_PARSE_OBJECT_REF ||</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">      t == VTK_PARSE_UNKNOWN ||<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">      t == VTK_PARSE_UNKNOWN_REF) &&</div></span></div><div>     !val->IsEnum &&</div><div>     !vtkWrap_IsPythonObject(val));</div><div>}</div></div><div><br></div><div> - David</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 24, 2018 at 10:14 AM, Kyle Sunderland <span dir="ltr"><<a href="mailto:1krs1@queensu.ca" target="_blank">1krs1@queensu.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-4237274065629506509divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi David,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">When wrapping classes, does the wrapping rely on the "vtk" prefix for both filenames and class names?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="margin-top:0;margin-bottom:0">I imagine that renaming the classes would fix the issue, but are<span style="font-size:12pt"> there any other workarounds </span>for wrapping classes that begin with a different prefix, or to wrap functions using these
classes as arguments?</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px"></span>Is it possible to
specify a prefix other than "vtk" for use with the wrapper?<span style="font-size:12pt"></span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks again for your help!</p>
<p style="margin-top:0;margin-bottom:0">- Kyle</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-4237274065629506509divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Andras Lasso<br>
<b>Sent:</b> May 17, 2018 9:05:36 PM<br>
<b>To:</b> David Gobbi<br>
<b>Cc:</b> Kyle Sunderland; <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> RE: [vtkusers] Questions About Python Wrapping</font>
<div>Â </div>
</div><div><div class="h5">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-4237274065629506509x_WordSection1">
<p class="m_-4237274065629506509x_MsoNormal">VTK_NEWINSTANCE hint is great! For Python, it solves the returned object ownership issue completely in a nice and robust way (now we just need to figure out how to update all our code base to use this).</p>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<p class="m_-4237274065629506509x_MsoNormal">For C++, a new smart pointer type (vtkSafePointer<…>?) could be added that is exclusively used for returning new instances. This smart pointer type would not have explicit converter to raw pointer but could be directly assigned to vtkSmartPointer<…>.
It could also have a helper method for backward compatibility, which would increment reference count and return a raw pointer. This new pointer type could be easily introduced for new classes, but for existing classes it would require small change in all code
where new VTK object instances are returned, which developers would probably not like. Maybe it could be done when changes around this are required anyway for some other reasons.</p>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<p class="m_-4237274065629506509x_MsoNormal">Andras</p>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<p class="m_-4237274065629506509x_MsoNormal"><b>From:</b> David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
<b>Sent:</b> Thursday, May 17, 2018 7:04 PM<br>
<b>To:</b> Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>><br>
<b>Cc:</b> Kyle Sunderland <<a href="mailto:1krs1@queensu.ca" target="_blank">1krs1@queensu.ca</a>>; <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Questions About Python Wrapping</p>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">The vtkSmartPointer isn't very safe in this regard. It is easy to accidentally do the following, since VTK smart pointers implicitly convert to raw pointers:</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â vtkSmartPointer<vtkObject> MyMethod();</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â vtkObject *obj = MyMethod(); // ownership is not caught, object is autodeleted</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">The preferred way of dealing with transfer of ownership for returned values in VTK is to add the VTK_NEWINSTANCE hint to the return value. Then the wrappers will automatically handle the reference count. As for people who use these
methods from C++, they still have to worry about memory leaks, but at least they don't have to worry about memory corruption caused by mistakes like the one in the example above.</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â - David</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<div>
<p class="m_-4237274065629506509x_MsoNormal">On Thu, May 17, 2018 at 4:29 PM, Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>> wrote:</p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<div>
<p class="m_-4237274065629506509x_MsoNormal"><span style="font-size:12.0pt;color:#1f497d">The main advantage of the ability to return smart pointers would be that ownership of VTK objects could be transferred safely to the caller, without requiring calling UnRegister(None). C++
developers are aware of pointers but for Python users it is a mistery why sometimes they need to call UnRegister to avoid memory leaks.
</span></p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Â </span></p>
</div>
<div id="m_-4237274065629506509x_m_5083259659620692987signature-x">
<p class="m_-4237274065629506509x_MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Andras</span></p>
</div>
</div>
<div id="m_-4237274065629506509x_m_5083259659620692987quoted_header">
<div class="m_-4237274065629506509x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" noshade align="center" style="color:#e1e1e1">
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal"><b>From:</b> David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>><br>
<b>Sent:</b> Thursday, May 17, 2018 4:55 PM<br>
<b>To:</b> Kyle Sunderland<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Questions About Python Wrapping</p>
</div>
</div>
<div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Hi Kyle, </p>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Thanks for sending the files. I see that the parameters for those methods are actually smart pointers, and as you have already noted, smart pointers aren't wrapped.</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">This has never been an issue in VTK proper or for most VTK projects, since VTK methods generally use raw pointers. The header file you sent is closer to ITK style than to VTK style.</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">I definitely think that it would be worthwhile to add better smart pointer handling to the wrappers.</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â - David</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
<div>
<p class="m_-4237274065629506509x_MsoNormal">On Thu, May 17, 2018 at 12:13 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:</p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="m_-4237274065629506509x_MsoNormal" style="margin-bottom:12.0pt">On Thu, May 17, 2018 at 10:10 AM, Kyle Sunderland <<a href="mailto:1krs1@queensu.ca" target="_blank">1krs1@queensu.ca</a>> wrote:<br>
> It (mostly) works, however I noticed that no functions are wrapped which have a definition that contains any of the wrapped classes. Does anyone have insight into what I might have missed?<br>
<br>
Is a vtk..Hierarchy.txt file generated for the wrapped module when you build it? If so, send it to me along with the header files you're wrapping, and I can take a look.<br>
<br>
> Also, as an additional question, is it still not possible to wrap functions that return a smart pointer?</p>
<div>
<p class="m_-4237274065629506509x_MsoNormal">If this is a feature that you need, then add it to the bug tracker.</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Cheers,</p>
</div>
<div>
<p class="m_-4237274065629506509x_MsoNormal">Â - David</p>
</div>
</div>
</blockquote>
</div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="m_-4237274065629506509x_MsoNormal">Â </p>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</blockquote></div><br></div>