From 9a12eb13add3599f12bc3252852c11cc66eec6fb Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 10 Oct 2025 11:29:20 -0400 Subject: [PATCH] WIP: Support 9.5.2 --- tvtk/vtk_parser.py | 5 ++++- tvtk/wrapper_gen.py | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tvtk/vtk_parser.py b/tvtk/vtk_parser.py index d3e108b0..457321cf 100644 --- a/tvtk/vtk_parser.py +++ b/tvtk/vtk_parser.py @@ -644,7 +644,10 @@ def _find_get_set_methods(self, klass, methods): # These hang on Windows (and maybe Fedora 34) elif (klass_name in ('vtkDataEncoder', 'vtkWebApplication')): continue - # we can actually process it + # On VTK 9.5.2 we get + # Cannot set the undefined 'copy_global_ids' attribute of a 'PointData' object + elif (klass_name == "vtkDataSetAttributes" and method[3:] in ("CopyGlobalIds", "CopyNormals", "CopyPedigreeIds", "CopyScalars", "CopyTCoords", "CopyTensors", "CopyVectors")): + continue elif ('Get' + method[3:]) in methods: key = method[3:] meths.remove('Set' + key) diff --git a/tvtk/wrapper_gen.py b/tvtk/wrapper_gen.py index 1c3cb0d2..f812da62 100644 --- a/tvtk/wrapper_gen.py +++ b/tvtk/wrapper_gen.py @@ -149,17 +149,27 @@ def patch_default(vtk_get_meth, vtk_set_meth, default): # Collect the signatures of the get method # We only use the arguments - all_sigs = vtk_parser.VTKMethodParser.get_method_signature(vtk_get_meth) + # TODO: Unclear why this would be used... but for example if the Get method + # takes a string as an argument, we don't want that to be what we expect the + # *output* to be (which can be for example vtkDataArray*). But presumably + # this was here for a reason so let's just add exceptions for things that are + # known to be problematic on VTK 9.5.2... + all_sigs = [] + #if vtk_get_meth.__name__ not in ("GetGlobalIds", "GetHigherOrderDegrees", "GetNormals", "GetPedigreeIds", "GetProcessIds", "GetRationalWeights", "GetScalars", "GetTCoords", "GetTensors", "GetVectors", "GetTangents"): + # all_sigs.extend( + # vtk_parser.VTKMethodParser.get_method_signature(vtk_get_meth) + # ) # Collect the signatures of the set method all_sigs.extend( - vtk_parser.VTKMethodParser.get_method_signature(vtk_set_meth)) + vtk_parser.VTKMethodParser.get_method_signature(vtk_set_meth) + ) for sig in all_sigs: if sig[1] is None: continue - if len(sig[1]) == 1: + if len(sig[1]) == 1 and not isinstance(sig[1][0], str): # This unpacks tuple of something e.g. (('int', 'int', 'int')) arg_formats.append(tuple(chain.from_iterable(sig[1]))) @@ -168,9 +178,10 @@ def patch_default(vtk_get_meth, vtk_set_meth, default): default_mappings = { 'int' : 0, 'float': 0.0, - 'string': '' + 'string': '', } + # vtkDataArray shows up but isn't used... causes problems for arg_format in arg_formats: try: all_same_type = len(set(arg_format)) == 1