Skip to content

Commit 7535219

Browse files
DOC: Improve model glow pipeline example
- Add image of the pipeline - Restrict supported interactions to move event to avoid blocking the camera on hover
1 parent 9357dd7 commit 7535219

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Doc/examples.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Model Glow Pipeline
66

7+
![Model Glow Example](images/model_glow_example.jpg)
8+
79
```{literalinclude} ../Examples/Python/ModelGlowDM/ModelGlowDM.py
810
:language: python
911
:linenos:

Doc/images/model_glow_example.jpg

61 KB
Loading

Examples/Python/ModelGlowDM/ModelGlowDM.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
VTK_OBJECT,
3434
calldata_type,
3535
vtkActor,
36+
vtkCommand,
3637
vtkGeneralTransform,
3738
vtkMath,
3839
vtkNamedColors,
@@ -354,10 +355,16 @@ def CanProcessInteractionEvent(self, eventData: vtkMRMLInteractionEventData) ->
354355
355356
Here, we check if the event interaction is within the glow pass actor bounds and return the distance to it.
356357
358+
To avoid blocking camera interaction, we will also process mouse move events.
359+
Of course we could also check for left click to go further with this widget.
360+
357361
Note: This is not an efficient way to check for interactions. A better way would be to delegate to the model
358362
display node for picking events.
359363
"""
360-
if not self._IsModelVisible() or self._polyData is None:
364+
# Only process mouse move events to avoid blocking camera interaction on click / drag
365+
isMouseMoveEvent = eventData.GetType() == vtkCommand.MouseMoveEvent
366+
367+
if not isMouseMoveEvent or not self._IsModelVisible() or self._polyData is None:
361368
return False, sys.float_info.max
362369

363370
pos = eventData.GetWorldPosition()

0 commit comments

Comments
 (0)