Skip to content

Commit a92f394

Browse files
committed
chore: make the part re-serialize private to the local renderer
1 parent 43acf7b commit a92f394

3 files changed

Lines changed: 22 additions & 35 deletions

File tree

‎src/ansys/visor/viewer/renderer/base.py‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,29 +150,16 @@ def apply_color_variable(
150150
min_val / max_val:
151151
Scalar display range.
152152
153-
Re-serializes the part's served state after the write. **Serialize
154-
only; do not notify.** No-op on a renderer that serves the client no
155-
VTK object state.
153+
On return, the state this renderer serves to the client reflects the
154+
write, and the client is not notified.
156155
"""
157156

158157
@abstractmethod
159158
def clear_color_variable(self, node_id: int) -> None:
160159
"""Disable scalar colouring on *node_id*, reverting to solid diffuse.
161160
162-
Re-serializes the part's served state after the write. **Serialize
163-
only; do not notify.** No-op on a renderer that serves the client no
164-
VTK object state.
165-
"""
166-
167-
@abstractmethod
168-
def serialize_part_state(self, node_id: int) -> None:
169-
"""Make the state served to the client current for one part's mapper.
170-
171-
A mapper write without this leaves the served cache holding the old
172-
content under a new version number, so the next client fetch gets the
173-
pre-write range. **Serialize only; do not notify.** An unknown
174-
*node_id* is a logged no-op. No-op on a renderer that serves the
175-
client no VTK object state.
161+
On return, the state this renderer serves to the client reflects the
162+
write, and the client is not notified.
176163
"""
177164

178165
@abstractmethod
@@ -238,8 +225,7 @@ def set_projection(self, parallel: bool) -> None:
238225
def serialize_camera_state(self) -> None:
239226
"""Make the state served to the client current for the camera.
240227
241-
The camera alone; a part's mapper is
242-
:meth:`serialize_part_state`'s job. Writing the pipeline camera
228+
The camera alone. Writing the pipeline camera
243229
makes the server correct: it does not make the state the client is
244230
served correct, and the two are separate steps that can each silently
245231
do nothing.

‎src/ansys/visor/viewer/renderer/local_renderer.py‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ def apply_color_variable(
247247
registry and is not needed to configure the mapper. An unknown
248248
*node_id* is a logged no-op, never a raise.
249249
250-
Ends with :meth:`serialize_part_state`, after the mapper write, so
251-
the state served to the client carries the new range.
250+
Ends with :meth:`_serialize_part_state`, after the mapper write, so
251+
the state served to the client carries the new range. Does not
252+
notify the client.
252253
"""
253254
pipe = self._pipelines.get(node_id)
254255
if pipe is None:
@@ -257,7 +258,7 @@ def apply_color_variable(
257258
)
258259
return
259260
pipe.set_color_variable(array_type, array_name, component, min_val, max_val)
260-
self.serialize_part_state(node_id)
261+
self._serialize_part_state(node_id)
261262

262263
def clear_color_variable(self, node_id: int) -> None:
263264
"""See :meth:`IRenderer.clear_color_variable`.
@@ -266,8 +267,9 @@ def clear_color_variable(self, node_id: int) -> None:
266267
:meth:`VtkNodePipeline.clear_color_variable`. An unknown
267268
*node_id* is a logged no-op, never a raise.
268269
269-
Ends with :meth:`serialize_part_state`, after the mapper write, so
270-
the state served to the client has scalar colouring off.
270+
Ends with :meth:`_serialize_part_state`, after the mapper write, so
271+
the state served to the client has scalar colouring off. Does not
272+
notify the client.
271273
"""
272274
pipe = self._pipelines.get(node_id)
273275
if pipe is None:
@@ -276,10 +278,15 @@ def clear_color_variable(self, node_id: int) -> None:
276278
)
277279
return
278280
pipe.clear_color_variable()
279-
self.serialize_part_state(node_id)
281+
self._serialize_part_state(node_id)
280282

281-
def serialize_part_state(self, node_id: int) -> None:
282-
"""See :meth:`IRenderer.serialize_part_state`.
283+
def _serialize_part_state(self, node_id: int) -> None:
284+
"""Make the state served to the client current for one part's mapper.
285+
286+
A mapper write without this leaves the served cache holding the old
287+
content under a new version number, so the next client fetch gets the
288+
pre-write range. **Serialize only; do not notify.** An unknown
289+
*node_id* is a logged no-op.
283290
284291
Names the mapper's id alone, derived with ``GetId`` on the object as
285292
:meth:`serialize_camera_state` derives the camera's. An id of ``0``
@@ -290,13 +297,13 @@ def serialize_part_state(self, node_id: int) -> None:
290297
pipe = self._pipelines.get(node_id)
291298
if pipe is None:
292299
logger.debug(
293-
"serialize_part_state: no pipeline for node %s; skipping.", node_id
300+
"_serialize_part_state: no pipeline for node %s; skipping.", node_id
294301
)
295302
return
296303
mapper_id = self._object_manager.GetId(pipe.mapper)
297304
if mapper_id == 0:
298305
logger.debug(
299-
"serialize_part_state: mapper of node %s is not registered yet; skipping.",
306+
"_serialize_part_state: mapper of node %s is not registered yet; skipping.",
300307
node_id,
301308
)
302309
return

‎src/ansys/visor/viewer/renderer/null_renderer.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ def apply_color_variable(
101101
def clear_color_variable(self, node_id: int) -> None:
102102
pass
103103

104-
def serialize_part_state(self, node_id: int) -> None:
105-
"""See :meth:`IRenderer.serialize_part_state`.
106-
107-
No-op: this renderer serves the client no VTK object state.
108-
"""
109-
110104
def refresh_color_variable_range(
111105
self,
112106
node_id: int,

0 commit comments

Comments
 (0)