Skip to content

Commit

Permalink
[VTK] Implement Glyph3Dmapper serialization - Round 2 (#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavArtley committed Feb 24, 2021
1 parent fd9e09c commit 72441fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 6 additions & 4 deletions panel/pane/vtk/synchronizable_deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ def poly_data_builder(state, zf, register):
if 'points' in state['properties']:
points = state['properties']['points']
vtkpoints = vtk.vtkPoints()
data_arr = ARRAY_TYPES[points['dataType']]()
fill_array(data_arr, points, zf)
vtkpoints.SetData(data_arr)
points_data_arr = ARRAY_TYPES[points['dataType']]()
fill_array(points_data_arr, points, zf)
vtkpoints.SetData(points_data_arr)
instance.SetPoints(vtkpoints)
for cell_type in ['verts', 'lines', 'polys', 'strips']:
if cell_type in state['properties']:
cell_arr = vtk.vtkCellArray()
fill_array(cell_arr.GetData(), state['properties'][cell_type], zf)
cell_data_arr = vtk.vtkIdTypeArray()
fill_array(cell_data_arr, state['properties'][cell_type], zf)
cell_arr.ImportLegacyFormat(cell_data_arr)
getattr(instance, 'Set' + capitalize(cell_type))(cell_arr)

# datasets
Expand Down
2 changes: 1 addition & 1 deletion panel/pane/vtk/synchronizable_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ def mergeToPolydataSerializer(parent, dataObject, dataObjectId, context, depth):
gf.Update()
dataset = gf.GetOutput()
else:
dataset = parent.GetInput()
dataset = dataObject

return polydataSerializer(parent, dataset, dataObjectId, context, depth)

Expand Down
3 changes: 0 additions & 3 deletions panel/pane/vtk/vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def _serialize_ren_win(self, ren_win, context, binary=False, compression=True, e
import panel.pane.vtk.synchronizable_serializer as rws
if exclude_arrays is None:
exclude_arrays = []
store_offscreen_rendering = ren_win.GetOffScreenRendering()
ren_win.OffScreenRenderingOn() # to not pop a vtk windows
ren_win.Modified()
ren_win.Render()
Expand All @@ -322,8 +321,6 @@ def _serialize_ren_win(self, ren_win, context, binary=False, compression=True, e
arrays = {name: context.getCachedDataArray(name, binary=binary, compression=compression)
for name in context.dataArrayCache.keys()
if name not in exclude_arrays}
ren_win.Finalize()
ren_win.SetOffScreenRendering(store_offscreen_rendering)
return scene, arrays

@staticmethod
Expand Down

0 comments on commit 72441fd

Please sign in to comment.