SoViewportRegion¶
-
InventorModule
¶ genre Visualization
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll SoUtils
definition utils.def see also SoOrientationInset
keywords overlay
Purpose¶
The module SoViewportRegion
renders a sub graph into a specified viewport region (VPR).
It can be compared with the picture-in-picture-function of modern TVs.
Interaction is possible in the displayed rendering. The module can also be used with SoView2D
renderings. That way, you can build your own ortho-views very easily.
Usage¶
Connect the subgraph to the child input(s) of the SoViewportRegion
.
The self-output should be connected to a viewer.
The viewer might display other graphs directly or may have additional SoViewportRegion
attached (see example network).
Modify the viewport according to your needs. You can use one of the presets to start and then adjust the viewport settings according to your needs.
You can use SoViewportRegion
in a nested manner. This means, a SoViewportRegion
that is the child of another SoViewportRegion
, may use the previously defined viewport region and modify it instead of modifying the original window (“Relate to existing viewport region” has to be activated; see example network). This may be useful if you want to define some kind of margin, which may be complicated with the viewport definition parameters alone.
Details¶
The fields of this module allow for certain viewport region definition behaviors dependent on the size of the window or an existing/previous viewport region. However, this field based definition is limited. More complex behavior can be implemented using a python callback function. For that, the field Use Python Callback
must be enabled. Then, the module python wrapper can be accessed and the function registered:
wrapper = CTX.module(“SoViewportRegion”).object()
wrapper.setViewportRegionDefinitionCallback(callbackFunc)
The registered function is called with 7 parameters: windowWidth, windowHeight, currentVPROriginX, currentVPROriginY, currentVPRWidth, currentVPRHeight, HiDPIScaleFactor
and is expected to return a list of 4 values that define the viewport region: [originX, originY, width, height]
The input and output values are all related to the system internal display resolution. Hence, for HiDPI displays this might be upscaled values. This scale factor is given by HiDPIScaleFactor and should be multiplied onto any constant pixel values that are used in the function.
If no python function is used, the HiDPI scaling is done automatically if Auto scale high DPI (pixel domain)
is active. Hence, pixel values specified in the fields must not be adapted.
Input Fields¶
Output Fields¶
Parameter Fields¶
Field Index¶
Visible Fields¶
Modify viewport region¶
-
name:
modifyVP
, type:
Bool
, default:
TRUE
¶ If checked, the current viewport region will be modified.
Otherwise, the module uses the whole viewer or a previously attached viewport region.
Relate to existing viewport region¶
-
name:
usePreviousVP
, type:
Bool
, default:
FALSE
¶ If checked, the modifications will relate to an existing/previous viewport region (which may have been defined by another
SoViewportRegion
instance in the scene graph already).Otherwise, the changes relate to the original window and the existing viewport region will be overridden for the child graph.
Auto scale high DPI (pixel domain)¶
-
name:
autoScaleAbsoluteValuesHiDPI
, type:
Bool
, default:
TRUE
, deprecated name:
autoScaleAbsoluteValuesHDPI
¶ Enable automatic rescaling of absolute values (if domain is set to pixels) in high DPI rendering. Given values of
X1
,X2
,Y1
andY2
are then multiplied with the global rescale factor (set by the OS or by modules such asOffscreenRenderer
). Otherwise, the values are used as they are, which will lead to different results depending on the scale factor. Typically, this should be activated and field values should be independent of high DPI rendering. It has no influence on relative values. Note: There are some issues with event handling in high DPI rendering if domain is set to pixels andRender Delayed Paths
is enabled!
Cache Viewport Region¶
-
name:
cacheViewportRegion
, type:
Bool
, default:
FALSE
¶ If true, the determined viewport region is used until the window or an existing/previous viewport region changes.
Use Python Callback¶
-
name:
useViewportRegionDefinitionCallback
, type:
Bool
, default:
FALSE
¶ Enables usage of a registered callback function. If no function is registered, the whole window is used. See details for more information.
Mode (xPositionMode)¶
-
name:
xPositionMode
, type:
Enum
, default:
POSITION_MODE_MIN_AND_MAX
¶ Defines the positioning mode in x-direction.
Values:
Title | Name | Description |
---|---|---|
Define left and right border of viewport region (VPR) | POSITION_MODE_MIN_AND_MAX | X1 and X2 act as minimum and maximum values horizontally. |
Define center and width of viewport region (VPR) | POSITION_MODE_CENTER_AND_SIZE | X1 and X2 act as center and size horizontally. |
Define left border and width of viewport region (VPR) | POSITION_MODE_MIN_AND_SIZE | X1 and X2 act as minimum value and size horizontally. |
Define right border and width of viewport region (VPR) | POSITION_MODE_MAX_AND_SIZE | X1 and X2 act as maximum value and size horizontally. |
Reference (x1ReferenceMode)¶
-
name:
x1ReferenceMode
, type:
Enum
, default:
REFERENCE_MODE_MIN
¶ Defines from where the values for
X1
are measured.Basically,the parameter allows to specify the alignment. Note, that you can use different reference for the left and right border for example. This allows for the definition of some kind of border for example (see example network).
Values:
Title | Name | Description |
---|---|---|
Left window border | REFERENCE_MODE_MIN | Value (X1 , X2 , Y1 , Y2 ) relates to the left (x) / lower (y) border of the window (or previously defined viewport). |
Window center | REFERENCE_MODE_CENTER | Value relates window center (or to the center of a previously defined viewport). |
Right window border | REFERENCE_MODE_MAX | Value relates to the right (x) / upper (y) border of the window (or previously defined viewport). |
Domain (x1DomainMode)¶
-
name:
x1DomainMode
, type:
Enum
, default:
DOMAIN_MODE_RELATIVE_TO_WIDTH
¶ Defines how the value of
X1
is interpreted.
Values:
Title | Name | Description |
---|---|---|
Pixels | DOMAIN_MODE_ABSOLUTE | Value is interpreted as an absolute value in pixel. |
Fraction of height | DOMAIN_MODE_RELATIVE_TO_HEIGHT | value is interpreted relative to the viewer’s height. |
Fraction of width | DOMAIN_MODE_RELATIVE_TO_WIDTH | Value is interpreted relative to the viewer’s width. |
Fraction of smallest dimension | DOMAIN_MODE_RELATIVE_TO_MIN | Value is interpreted relative to the viewer’s minimum value. |
Fraction of largest dimension | DOMAIN_MODE_RELATIVE_TO_MAX | Value is interpreted relative to the viewer’s maximum value. |
Reference (x2ReferenceMode)¶
-
name:
x2ReferenceMode
, type:
Enum
, default:
REFERENCE_MODE_MIN
¶ Defines from where the values for
X2
are measured.
Values:
Title | Name |
---|---|
Left window border | REFERENCE_MODE_MIN |
Window center | REFERENCE_MODE_CENTER |
Right window border | REFERENCE_MODE_MAX |
Domain (x2DomainMode)¶
-
name:
x2DomainMode
, type:
Enum
, default:
DOMAIN_MODE_RELATIVE_TO_WIDTH
¶ Defines how the value of
X2
is interpreted.
Values:
Title | Name |
---|---|
Pixels | DOMAIN_MODE_ABSOLUTE |
Fraction of height | DOMAIN_MODE_RELATIVE_TO_HEIGHT |
Fraction of width | DOMAIN_MODE_RELATIVE_TO_WIDTH |
Fraction of smallest dimension | DOMAIN_MODE_RELATIVE_TO_MIN |
Fraction of largest dimension | DOMAIN_MODE_RELATIVE_TO_MAX |
Mode (yPositionMode)¶
-
name:
yPositionMode
, type:
Enum
, default:
POSITION_MODE_MIN_AND_MAX
¶ Defines the positioning mode in y-direction.
Values:
Title | Name |
---|---|
Define lower and upper border of viewport region (VPR) | POSITION_MODE_MIN_AND_MAX |
Define center and height of viewport region (VPR) | POSITION_MODE_CENTER_AND_SIZE |
Define lower border and height of viewport region (VPR) | POSITION_MODE_MIN_AND_SIZE |
Define upper border and height of viewport region (VPR) | POSITION_MODE_MAX_AND_SIZE |
Reference (y1ReferenceMode)¶
-
name:
y1ReferenceMode
, type:
Enum
, default:
REFERENCE_MODE_MAX
¶ Defines from where the values for
Y1
are measured.
Values:
Title | Name |
---|---|
Lower window border | REFERENCE_MODE_MIN |
Window center | REFERENCE_MODE_CENTER |
Upper window border | REFERENCE_MODE_MAX |
Domain (y1DomainMode)¶
-
name:
y1DomainMode
, type:
Enum
, default:
DOMAIN_MODE_RELATIVE_TO_HEIGHT
¶ Defines how the value of
Y1
is interpreted.
Values:
Title | Name |
---|---|
Pixels | DOMAIN_MODE_ABSOLUTE |
Fraction of height | DOMAIN_MODE_RELATIVE_TO_HEIGHT |
Fraction of width | DOMAIN_MODE_RELATIVE_TO_WIDTH |
Fraction of smallest dimension | DOMAIN_MODE_RELATIVE_TO_MIN |
Fraction of largest dimension | DOMAIN_MODE_RELATIVE_TO_MAX |
Reference (y2ReferenceMode)¶
-
name:
y2ReferenceMode
, type:
Enum
, default:
REFERENCE_MODE_MAX
¶ Defines from where the values for
Y2
are measured.
Values:
Title | Name |
---|---|
Lower window border | REFERENCE_MODE_MIN |
Window center | REFERENCE_MODE_CENTER |
Upper window border | REFERENCE_MODE_MAX |
Domain (y2DomainMode)¶
-
name:
y2DomainMode
, type:
Enum
, default:
DOMAIN_MODE_RELATIVE_TO_HEIGHT
¶ Defines how the value of
Y2
is interpreted.
Values:
Title | Name |
---|---|
Pixels | DOMAIN_MODE_ABSOLUTE |
Fraction of height | DOMAIN_MODE_RELATIVE_TO_HEIGHT |
Fraction of width | DOMAIN_MODE_RELATIVE_TO_WIDTH |
Fraction of smallest dimension | DOMAIN_MODE_RELATIVE_TO_MIN |
Fraction of largest dimension | DOMAIN_MODE_RELATIVE_TO_MAX |
Projection Type¶
-
name:
projectionType
, type:
Enum
, default:
UNMODIFIED
¶ Defines, what camera is used for the rendering of the scene
Values:
Title | Name | Description |
---|---|---|
Orthographic | ORTHOGRAPHIC | Creates its own orthographic camera. |
Perspective | PERSPECTIVE | Creates its own perspective camera. |
Auto | AUTO | Uses camera from the state. |
Unmodified | UNMODIFIED | Uses camera from the child graph. |
Render Delayed Paths¶
-
name:
renderDelayedPaths
, type:
Bool
, default:
FALSE
¶ If enabled, the rendering is done using the delayed path rendering of Open Inventor. This should be disabled if direct rendering is desired or even required, e.g. when using the
SoPostEffectRenderer
,SoFramebufferSampler
, orSoDepthPeelRenderer
. Other modules however, such asSoAnnotation
orSo3DMarkerEditor
, require delayed path rendering.
Detect if mouse is over the viewport¶
-
name:
detectMouseOver
, type:
Bool
, default:
FALSE
¶ If checked, the module detects whether the mouse is over the viewport.
Mouse is over¶
-
name:
mouseOverViewport
, type:
Bool
, persistent:
no
¶ Shows whether the mouse is over the viewport.
Forward events to child graph¶
-
name:
forwardEvents
, type:
Bool
, default:
TRUE
¶ If checked, events will be evaluated by the child graph.
In viewport only¶
-
name:
forwardEventsInViewportOnly
, type:
Bool
, default:
TRUE
¶ If checked, only events that occur in the viewport are forwarded to the child graph (should be checked in most cases).
Do not change ‘mouse over’ while dragging¶
-
name:
keepViewportWhileDragging
, type:
Bool
, default:
TRUE
¶ If this is set the
Mouse is over
field will not change its value while there is a drag operation in the viewer (some mouse button is down and the mouse is moved). This also means that - ifIn viewport only
is set - the mouse events will still be sent to the viewport scene even when the mouse leaves the viewport region while dragging, and vice versa will not be sent if the dragging started outside the viewport region.
Map to viewport¶
-
name:
mapEventToViewport
, type:
Bool
, default:
TRUE
¶ If checked, the event coordinates will be mapped to the viewport region (should be checked in most cases).
Otherwise event handling inside the child graph will not work as expected.
Consume events in viewport¶
-
name:
consumeEventsInViewport
, type:
Bool
, default:
TRUE
¶ If checked, all events that occur in the viewport region will be consumed.
Even if there is no module in the sub graph that reacts to the event, the event will be consumed by the
SoViewportRegion
module itself. This avoids the handling of the event by a module that is not in theSoViewportRegion
. Note: under certain circumstances, this might interfere with MDL EventFilters controls!
Color (borderColor)¶
-
name:
borderColor
, type:
Color
, default:
1 1 1
¶ Color used for drawing the border
Alpha (borderAlpha)¶
-
name:
borderAlpha
, type:
Float
, default:
1
, minimum:
0
, maximum:
1
¶ Alpha used for drawing the border
Color (backgroundColor)¶
-
name:
backgroundColor
, type:
Color
, default:
1 1 1
¶ Color used for drawing the background
Alpha (backgroundAlpha)¶
-
name:
backgroundAlpha
, type:
Float
, default:
1
, minimum:
0
, maximum:
1
¶ Alpha used for drawing the background
Preset¶
-
name:
preset
, type:
Enum
, default:
centeredThird
¶ Defines a preset for positioning the viewport inside a viewer.
Values:
Title | Name |
---|---|
Centered and third of dimensions | centeredThird |
Centered and third of minimum dimension | centeredMinThird |
Centered and fixed size | centeredFixed |
Upper left corner and third of minimum dimension | upperLeftMinThird |
Upper right corner and third of minimum dimension | upperRightMinThird |
Lower left corner and third of minimum dimension | lowerLeftMinThird |
Lower right corner and third of minimum dimension | lowerRightMinThird |
20 Pixel margin | margin |