[vtk-developers] Wrapping vtkConfigure.h, vtkType.h, etc.

David Gobbi david.gobbi at gmail.com
Tue Aug 17 13:59:07 EDT 2010


Wrapping vtkCommand.h is difficult, but not because of the constants.
The vtkCommand class itself is internally handled in a very "special"
way by the wrappers.  So while I do want to wrap this class and its
constants, it won't happen immediately.

For some things, you can substitute a string for the constants i.e.
AddObserver("ModifiedEvent", func).  But I know that this doesn't work
for everything.

   David


On Tue, Aug 17, 2010 at 11:48 AM, Jean-Christophe Fillion-Robin
<jchris.fillionr at kitware.com> wrote:
> Hi David,
>
> That's awesome :)
>
> Question:
>   If we add vtkCommand.h to Kit_WRAP_HEADERS, would the eventid be wrapped ?
>
> By eventid, i mean the enum regrouping ModifedEvent, ...
>
> Thks
> Jc
>
> On Tue, Aug 17, 2010 at 1:42 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> For wrapping VTK constants, I've created an optional variable for the
>> kits, e.g. in Common/CMakeLists.txt:
>>
>> SET(Kit_WRAP_HEADERS
>>  vtkSystemIncludes.h
>>  vtkType.h
>>  ${VTK_BINARY_DIR}/vtkConfigure.h
>>  )
>>
>> This tells the python wrappers to wrap these headers
>> (Filtering/vtkCellType.h is also wrapped).  Since the constants are
>> wrapped directly into the kit python modules, vtkConstants.py is
>> obsolete.
>>
>>  David
>>
>>
>> On Mon, Aug 16, 2010 at 11:45 AM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>> > Hi All,
>> >
>> > I'm looking for the best way to modify the VTK cmake scripts so that I
>> > can automatically wrap constants like VTK_POLY_DATA.  Right now, some
>> > of these constants are hard-coded in e.g. vtkConstants.py but of the
>> > wrapper's "hard-coded" copies of the constants are never up to date.
>> > The only thing that is needed to python-wrap these constants is to
>> > pass the header files vtkConfigure.h, vtkType.h, etc. to
>> > vtkWrapPython. One way to do this is to add these headers to the
>> > source list:
>> >
>> > Set(Kit_SRCS vtkType.h ...)
>> > SET_SOURCE_FILES_PROPERTIES(vtkType.h HEADER_FILE_ONLY)
>> >
>> > However, I'm reluctant do to this because no other VTK header files
>> > are handled this way.  The alternative is to make a separate list for
>> > header files, one that will be used by KitCommonPythonWrapBlock.cmake:
>> >
>> > Set(Kit_HDRS vtkType.h ...)
>> >
>> > And then in KitCommonPythonWrapBlock.cmake:
>> > SET(FILES_TO_WRAP ${Kit_SRCS} ${Kit_HDRS})
>> > VTK_WRAP_PYTHON3(vtk${KIT}Python KitPython_SRCS "${FILES_TO_WRAP}")
>> >
>> > I'm leaning towards this latter method, because it seems to be the
>> > tidier of the two approaches.
>> >
>> >  David
>> >
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>
>
>
> --
> Phone: 1-518-836-2174
> Ext: 304
>



More information about the vtk-developers mailing list