Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/trame_vtk/modules/vtk/serializers/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .registry import class_name
from .serialize import serialize
from .utils import reference_id, rgb_float_to_hex, wrap_id
from .cache import cache_properties
from .cache import cache_properties, get_cached_property

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -69,7 +69,11 @@ def generic_actor_serializer(parent, actor, actor_id, context, depth):
user_matrix[idx] = matrix.GetElement(i, j)
add_on["userMatrix"] = user_matrix

if actor_visibility == 0 or (mapper_instance and property_instance):
should_serialize = mapper_instance and property_instance
if get_cached_property(actor_id, "visibility") and not actor_visibility:
should_serialize = True

if should_serialize:
return {
"parent": reference_id(parent),
"id": actor_id,
Expand Down
4 changes: 4 additions & 0 deletions src/trame_vtk/modules/vtk/serializers/cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
PROP_CACHE = {}


def get_cached_property(obj_id, prop):
return PROP_CACHE.get(obj_id, {}).get(prop, None)


def cache_properties(obj_id, ctx, props):
if not ctx.ignore_last_dependencies:
prev = PROP_CACHE.get(obj_id)
Expand Down