Skip to content

Commit

Permalink
fix(serializer): add encoding option
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Feb 13, 2024
1 parent abf0bd1 commit 9c20a89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion trame_vtk/modules/vtk/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .export import extract_array_hash
from .synchronization_context import SynchronizationContext
from .utils import reference_id
from .initialize import encode_lut
from .initialize import encode_lut, skip_light

logger = logging.getLogger(__name__)
# By default, only show critical messages for serializers
Expand All @@ -17,8 +17,16 @@
# If this environment variable is set, print out all messages
logger.setLevel(logging.DEBUG)


def configure_serializer(**options):
skip_light(options.get("skip_light", True))
encode_lut(options.get("encode_lut", True))


__all__ = [
"configure_serializer",
"encode_lut",
"skip_light",
"reference_id",
"initialize_serializers",
"mesh",
Expand Down
10 changes: 9 additions & 1 deletion trame_vtk/modules/vtk/serializers/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@
logger = logging.getLogger(__name__)

CONVERT_LUT = False
SKIP_LIGHT = False


def encode_lut(value=True):
global CONVERT_LUT
CONVERT_LUT = value


def skip_light(value=True):
global SKIP_LIGHT
SKIP_LIGHT = value


def lookup_table_serializer_selector(*args, **kwargs):
global CONVERT_LUT
if CONVERT_LUT:
Expand Down Expand Up @@ -125,7 +131,9 @@ def initialize_serializers():
"vtkOpenGLRenderer",
],
# Lights
light_serializer: [
light_serializer: []
if SKIP_LIGHT
else [
"vtkLight",
"vtkPVLight",
"vtkOpenGLLight",
Expand Down

0 comments on commit 9c20a89

Please sign in to comment.