Skip to content

Commit

Permalink
Ensure VTK nan, above and below colors are serialized (#6763)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Apr 19, 2024
1 parent ac5118e commit b9ea9e2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions panel/pane/vtk/synchronizable_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,11 @@ def lookupTableToColorTransferFunction(lookupTable):
points = linspace(*tableRange, num=len(table))
for x, rgba in zip(points, table):
ctf.AddRGBPoint(x, *[x/255 for x in rgba[:3]])
ctf.SetAboveRangeColor(lookupTable.GetAboveRangeColor()[:3])
ctf.SetBelowRangeColor(lookupTable.GetBelowRangeColor()[:3])
ctf.SetUseAboveRangeColor(lookupTable.GetUseAboveRangeColor())
ctf.SetUseBelowRangeColor(lookupTable.GetUseBelowRangeColor())
ctf.SetNanColorRGBA(lookupTable.GetNanColor())
return ctf

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1173,11 +1178,11 @@ def colorTransferFunctionSerializer(parent, instance, objId, context, depth):
'clamping': 1 if instance.GetClamping() else 0,
'colorSpace': instance.GetColorSpace(),
'hSVWrap': 1 if instance.GetHSVWrap() else 0,
# 'nanColor': instance.GetNanColor(), # Breaks client
# 'belowRangeColor': instance.GetBelowRangeColor(), # Breaks client
# 'aboveRangeColor': instance.GetAboveRangeColor(), # Breaks client
# 'useAboveRangeColor': 1 if instance.GetUseAboveRangeColor() else 0,
# 'useBelowRangeColor': 1 if instance.GetUseBelowRangeColor() else 0,
'nanColor': instance.GetNanColor() + (instance.GetNanOpacity(),),
'belowRangeColor': instance.GetBelowRangeColor() + (1,),
'aboveRangeColor': instance.GetAboveRangeColor() + (1,),
'useAboveRangeColor': 1 if instance.GetUseAboveRangeColor() else 0,
'useBelowRangeColor': 1 if instance.GetUseBelowRangeColor() else 0,
'allowDuplicateScalars': 1 if instance.GetAllowDuplicateScalars() else 0,
'alpha': instance.GetAlpha(),
'vectorComponent': instance.GetVectorComponent(),
Expand Down

0 comments on commit b9ea9e2

Please sign in to comment.