ovito.nonpublic
This page documents selected internal/advanced APIs from the ovito.nonpublic module. These are not
part of OVITO’s stable, documented Python interface and are normally left out of the end-user manual;
they are included here only for AI agent consumption.
- class ovito.nonpublic.ActiveObject
Abstract base class for pipeline-related objects that perform potentially long-running background computations and that can be enabled or disabled, such as
Modifier,DataVis,PipelineNode(and thusModificationNode,FileSource, etc.),ViewportOverlay, andModifierGroup. It provides a commontitle, anenabledflag, and astatusreporting the outcome of the object’s most recent computation.- property enabled: bool
Controls whether this object is currently active. Setting this to
Falsedisables the object, e.g. excluding aModifierfrom being applied within its pipeline, without removing it.- Default:
True
- property status: PipelineStatus
Reports the outcome of this object’s most recently performed computation.
Attention
In some cases this field is only updated when OVITO is running in GUI mode.
- class ovito.nonpublic.AnimationKey
Abstract base class for a single keyframe of a
KeyframeController, storing atimeand a type-specificvalueat that time (see the concrete subclassesFloatAnimationKey,IntegerAnimationKey,Vector3AnimationKey,PositionAnimationKey,RotationAnimationKey, andScalingAnimationKey). Between consecutive keys, the owning controller’s value is obtained through interpolation.
- class ovito.nonpublic.AnimationSettings
Stores the global animation/playback settings and state associated with a
Scene, accessible through theScene.animattribute (i.e.ovito.scene.anim). This includes the length of the animation interval (first_frame/last_frame), the position of the time slider (current_frame), and the playback-related parameters used by the interactive viewports and by movie export (frames_per_second,playback_speed,loop_playback,play_every_nth_frame).See also manual:animation.animation_settings_dialog in the OVITO user manual, which describes the corresponding animation settings dialog in the GUI
- property auto_adjust_interval: bool
Controls whether the animation interval (
first_frame/last_frame) is automatically adjusted to accommodate all trajectory frames produced by the data pipelines in theScene. When enabled, loading a new simulation trajectory or importing an additional trajectory automatically extendslast_frameto cover its full length.In other words, if this option is enabled, the animation interval always covers the maximum
Pipeline.num_framesof all data pipelines in the current scene. If this option is disabled, the animation interval is not automatically adjusted, and you can setfirst_frameandlast_framemanually to any values you like, even if they are outside the range of the loaded simulation trajectory.- Default:
True
- property current_frame: int
The current animation frame. This parameter controls the position of the time slider in OVITO’s main window and determines which animation frame is shown in the viewports. It also affects various other functions that operate on the current animation frame.
- Default:
0
- property frames_per_second: float
Controls the playback speed of the animation. This parameter also determines the playback speed of movie files generated by OVITO.
- Default:
10.0
- jump_to_animation_end()
Sets
current_frametolast_frame, moving the time slider to the end of the animation interval.
- jump_to_animation_start()
Sets
current_frametofirst_frame, moving the time slider to the start of the animation interval.
- jump_to_next_frame()
Advances
current_frameby one frame, unless it is already atlast_frame.
- jump_to_previous_frame()
Moves
current_frameback by one frame, unless it is already atfirst_frame.
- property last_frame: int
The zero-based index of the last animation frame. You can set this property to change the animation length.
- Default:
0
- property loop_playback: bool
Controls whether interactive playback in the viewports restarts from
first_frameafter reachinglast_frame, instead of stopping there.- Default:
True
- property play_every_nth_frame: int
Specifies the number of animation frames to advance per step during interactive playback in the viewports. A value of 1 plays every frame; a value of n skips ahead by n frames on each playback step, which can be used to move through long trajectories more quickly at the cost of temporal resolution. This setting has no effect on movie export.
- Default:
1
- property playback_speed: int
An integer speed factor controlling the rate of interactive playback in the viewports, using an asymmetric encoding: values greater than 1 play the animation faster than realtime, at playback_speed times the normal rate; values less than -1 play it slower than realtime, at a rate of 1 / abs(playback_speed) times the normal rate. This setting has no effect on movie export, which is governed by
frames_per_secondinstead.- Default:
1
- class ovito.nonpublic.Controller
Abstract base class for animatable parameter controllers. A
Controllermanages the time-dependent value of a single animatable quantity – a scalar (float or int), a 3d vector or RGB color, a position, a rotation, a scaling, or a full position/rotation/scaling transformation – and is queried and manipulated through whicheverget_*_value/set_*_valuemethod pair matches itstype.Concrete controller implementations differ in how they compute a value for a given time. The most common kind, a
KeyframeController, interpolates between a sequence of user-definedAnimationKeyinstances (seeKeyframeController.keysand manual:usage.animation.keyframes in the OVITO user manual), while aPRSTransformationControllerinstead delegates to three separate sub-controllers for position, rotation and scaling. Controllers are attached, for example, toSceneNodeinstances (transform_ctrl) to animate their position and orientation in the scene.- get_color_value(time: int) tuple[float, float, float]
Returns this controller’s value, reinterpreted as an RGB color, at the given animation time (a zero-based frame number). Only meaningful if
typeisController.Type.Vector3; equivalent toget_vector3_value().
- get_float_value(time: int) float
Returns this controller’s value at the given animation time (a zero-based frame number). Only meaningful if
typeisController.Type.Float.
- get_int_value(time: int) int
Returns this controller’s value at the given animation time (a zero-based frame number). Only meaningful if
typeisController.Type.Int.
- get_position_value(time: int) ArrayLike
Returns this controller’s position value at the given animation time (a zero-based frame number). Only meaningful if
typeisController.Type.Position.
- get_rotation_value(time: int) ArrayLike
Returns this controller’s rotation value at the given animation time (a zero-based frame number), encoded as a Rodrigues vector in units of radians: the axis of rotation is given by the vector’s direction, while its length gives the rotation angle around that axis. Only meaningful if
typeisController.Type.Rotation.
- get_vector3_value(time: int) ArrayLike
Returns this controller’s value at the given animation time (a zero-based frame number). Only meaningful if
typeisController.Type.Vector3. See alsoget_color_value(), which reinterprets the same kind of controller’s value as an RGB color.
- property is_animated: bool
Indicates whether this controller’s value actually changes over the course of the animation.
- set_color_value(time: int, value: tuple[float, float, float]) None
Sets this controller’s value, given as an RGB color, at the given animation time (a zero-based frame number). Only applicable if
typeisController.Type.Vector3; equivalent toset_vector3_value().
- set_float_value(time: int, value: float) None
Sets this controller’s value at the given animation time (a zero-based frame number). Only applicable if
typeisController.Type.Float.
- set_int_value(time: int, value: int) None
Sets this controller’s value at the given animation time (a zero-based frame number). Only applicable if
typeisController.Type.Int.
- set_position_value(time: int, value: ArrayLike, is_absolute: bool) None
Sets this controller’s position value at the given animation time (a zero-based frame number). If is_absolute is
True, value replaces the controller’s current value; ifFalse, value is added to it instead. Only applicable iftypeisController.Type.Position.
- set_rotation_value(time: int, value: ArrayLike, is_absolute: bool) None
Sets this controller’s rotation value at the given animation time (a zero-based frame number), given as a Rodrigues vector in units of radians (see
get_rotation_value()). If is_absolute isTrue, value replaces the controller’s current rotation; ifFalse, value is applied on top of it instead. Only applicable iftypeisController.Type.Rotation.
- set_scaling_value(time: int, value: Any, is_absolute: bool) None
Sets this controller’s scaling value at the given animation time (a zero-based frame number). If is_absolute is
True, value replaces the controller’s current value; ifFalse, value is applied on top of it instead. Only applicable iftypeisController.Type.Scaling.
- set_vector3_value(time: int, value: ArrayLike) None
Sets this controller’s value at the given animation time (a zero-based frame number). Only applicable if
typeisController.Type.Vector3.
- property type: Controller.Type
The kind of value managed by this controller, which determines which
get_*_value/set_*_valuemethod pair is applicable.
- class ovito.nonpublic.FloatAnimationKey
Base:
AnimationKeyA keyframe of a float-valuedKeyframeController(typeController.Type.Float).
- class ovito.nonpublic.IntegerAnimationKey
Base:
AnimationKeyA keyframe of an integer-valuedKeyframeController(typeController.Type.Int).
- class ovito.nonpublic.KeyframeController
Base:
ControllerA
Controllerwhose value is defined by a time-sorted sequence ofkeys, each an instance of a concrete subclass ofAnimationKey. Between two neighboring keys, the controller’s value at a given time is obtained by interpolation; outside the first/last key, the value of that nearest key is used unchanged. Usecreate_key()to add a new key at a given animation time.- create_key(time: int, value: Any) AnimationKey
Creates a new animation key with the given value at the given animation time (a zero-based frame number), or updates the value of an already existing key at that exact time. Returns the (possibly newly created)
AnimationKey, which is also automatically inserted intokeysat the correct, time-sorted position.
- property keys: Sequence[AnimationKey]
The time-sorted list of
AnimationKeyinstances defining this controller’s value over the course of the animation. Usecreate_key()to add a new key.
- class ovito.nonpublic.PRSTransformationController
Base:
ControllerStandard implementation of a combined position/rotation/scaling transformation controller, as used for example by
SceneNode.transform_ctrl. Internally, it delegates to three separate sub-controllers forposition,rotationandscaling, which are combined into a single transformation matrix.- property position: Controller
The sub-controller (of
typeController.Type.Position) managing the translational component of the transformation.
- property rotation: Controller
The sub-controller (of
typeController.Type.Rotation) managing the rotational component of the transformation.
- property scaling: Controller
The sub-controller (of
typeController.Type.Scaling) managing the scaling component of the transformation.
- class ovito.nonpublic.PipelineStatus
Reports the outcome of the most recent computation performed by an
ActiveObject, e.g. aModifieror aPipelineNode. Accessible through the object’sstatusfield.- property text: str
A human-readable message describing the status in more detail, e.g. an error or warning message; empty if there is nothing to report.
- property type: PipelineStatus.Type
Indicates whether the computation completed successfully (
PipelineStatus.Type.Success), completed with a non-fatal warning (PipelineStatus.Type.Warning), or failed (PipelineStatus.Type.Error).
- class ovito.nonpublic.PositionAnimationKey
Base:
AnimationKeyA keyframe of a positionKeyframeController(typeController.Type.Position).
- class ovito.nonpublic.RenderSettings
Stores general settings related to image and movie rendering, accessible through the
Scene.render_settingsattribute (i.e.ovito.scene.render_settings). This includes the output image/movie resolution (output_image_width/output_image_height), the range of animation frames to render (range), the output file path (output_filename), and the active rendering engine (renderer) along with its engine-specific parameters.See also
manual:core.render_settings in the OVITO user manual
- property background_color: tuple[float, float, float]
Controls the background color of the rendered image.
- Default:
(1.0, 1.0, 1.0)– white
- property custom_frame: int
The single animation frame to render when
rangeis set toRenderSettings.Range.CustomFrame.- Default:
0
- property custom_range
Specifies the range of animation frames to render if
rangeis set toCustomInterval.- Default:
(0,100)
- property custom_range_end: int
The last animation frame to render when
rangeis set toRenderSettings.Range.CustomInterval.- Default:
100
- property custom_range_start: int
The first animation frame to render when
rangeis set toRenderSettings.Range.CustomInterval.- Default:
0
- property every_nth_frame: int
Specifies which fraction of the animation frames in the selected
rangeis actually rendered. A value of 1 renders every frame; a value of n renders only every n-th frame. Use this to reduce the number of frames generated for extremely long animation sequences.- Default:
1
- property file_number_base: int
When rendering an animation as a sequence of image files (rather than a single movie file), OVITO appends the frame number to the output filename. This setting specifies an offset added to those frame numbers, which can be useful to collect frames from several rendering passes in one directory before combining them into one contiguous movie externally.
- Default:
0
- property filename
A string specifying the file path under which the rendered image or movie should be saved.
- Default:
None
- property frames_per_second: int
The frame rate (FPS) used when encoding a movie file. A value less than or equal to 0 makes the renderer fall back to the frame rate given by
AnimationSettings.frames_per_secondof the associatedScene.animinstead. Has no effect when rendering to an image file sequence.- Default:
0
- property generate_alpha: bool
When saving the image to a file format that supports transparency information (e.g. PNG), this option will make those parts of the output image transparent which are not covered by objects.
- Default:
False
- property layout_separator_color: tuple
The RGB color of the separator lines drawn between viewports when
layout_separators_enabledis set.- Default:
(0.5, 0.5, 0.5)
- property layout_separator_width: int
The width, in pixels, of the separator lines drawn between viewports when
layout_separators_enabledis set.- Default:
2
- property layout_separators_enabled: bool
Controls the visibility of separator lines drawn between the individual viewports when
render_all_viewportsis enabled and an entire viewport layout is rendered.- Default:
False
- property output_filename: str
The output file path for the rendered image or movie. Only used if
save_to_fileis set toTrue. The filename’s extension determines the output format: if it denotes a video container format (e.g. AVI, MP4), all rendered animation frames are written to a single movie file; otherwise a sequence of image files is produced, one per frame, with the frame number automatically appended to the base filename (or substituted for a*wildcard if present).- Default:
''
- property output_image_height: int
The height of the rendered image or movie in pixels.
- Default:
480
- property range: RenderSettings.Range
Selects the animation frames to be rendered. The current animation frame and the total animation range are determined by the
AnimationSettingsobject associated with the scene.- Possible values:
RenderSettings.Range.CurrentFrame(default): Renders a single image at the current animation time.RenderSettings.Range.Animation: Renders a movie of the entire animation sequence.RenderSettings.Range.CustomInterval: Renders a movie of the animation interval given by thecustom_range_start/custom_range_endattributes.RenderSettings.Range.CustomFrame: Renders a single image at the animation frame given by thecustom_frameattribute.
- render(viewport_config: ViewportConfiguration, anim: AnimationSettings)
Low-level method that renders one or more images using this rendering settings object, in exactly the same way as the Render active viewport button does in the OVITO GUI.
viewport_config is normally the scene’s
Scene.viewport_configobject, which determines which viewport (active_vp) gets rendered, or, ifrender_all_viewportsis set, the entirelayout_root_celllayout. anim is normally the scene’sScene.animobject, which supplies the current animation frame as well as the animation interval used whenrangeis set to render more than a single frame.How many frames get rendered, and which ones, is controlled by
range: a single frame is rendered if it is set toRenderSettings.Range.CurrentFrameorRenderSettings.Range.CustomFrame, whereasRenderSettings.Range.AnimationandRenderSettings.Range.CustomIntervalrender every frame of the respective sequence in turn (subject toevery_nth_frame), writing each one to disk ifsave_to_fileis enabled. Regardless of how many frames were rendered, the method always returns only the last rendered frame, as aPySide6.QtGui.QImageobject; usesave_to_fileandoutput_filenamebeforehand if the earlier frames of a sequence need to be retained.Unlike
Viewport.render_image()andViewport.render_anim(), which are the recommended, high-level entry points for scripts, this method reads all rendering parameters, including which frames to render, from thisRenderSettingsobject itself rather than from separate method arguments. In GUI mode, the rendered frame(s) are additionally displayed in the frame buffer window, and the operation can be canceled by the user.
- property render_all_viewports: bool
Controls whether a composed output image with multiple side-by-side views is generated, one for each viewport of the current viewport layout, instead of rendering just the single active viewport.
- Default:
False
- property renderer: SceneRenderer
The renderer that is used to generate the image or movie. Depending on the selected renderer you can use this to set additional parameters such as the anti-aliasing level.
See the
OpenGLRenderer,TachyonRenderer,OSPRayRenderer, andAnariRendererclasses for the list of parameters specific to each rendering backend.
- property save_to_file: bool
Controls whether the rendered image or movie is saved to the file path given by
output_filename. IfFalse, the image is still generated and displayed in the frame buffer window (in GUI mode), but not written to disk.- Default:
False
- property size
The size of the image or movie to be generated in pixels.
- Default:
(640,480)
- property skip_existing_images: bool
Controls whether animation frames for which the output image file already exists will be skipped when rendering an animation sequence. This flag is ignored when directly rendering to a movie file and not an image file sequence. Use this flag when the image sequence has already been partially rendered and you want to render just the missing frames.
- Default:
False
- class ovito.nonpublic.RotationAnimationKey
Base:
AnimationKeyA keyframe of a rotationKeyframeController(typeController.Type.Rotation).- property value: ArrayLike
The value of this animation key, encoded as a Rodrigues vector in units of radians (see
Controller.get_rotation_value()).
- class ovito.nonpublic.ScalingAnimationKey
Base:
AnimationKeyA keyframe of a scalingKeyframeController(typeController.Type.Scaling).- property value: Any
The value of this animation key.
- class ovito.nonpublic.SceneNode
A node in the tree of
SceneNodeinstances that make up the three-dimensional scene of aScene(i.e.ovito.scene). Each such node positions and orients (translation/rotation) the output of an optionally associatedpipelinewithin the scene, and may have any number ofchildrensub-nodes, forming a tree that is rooted atSceneRoot(seeScene.scene_root).Ordinary pipelines added to the scene via
Pipeline.add_to_scene()each get their ownSceneNode, directly parented under the scene root. Nodes without apipeline(pipelineisNone) act as pure group/container nodes and do not themselves contribute any visual output.- property children: MutableSequence[SceneNode]
The list of child nodes directly below this node in the scene tree.
Returns whether this node is currently hidden in every interactive viewport of the scene (see
is_hidden_in_viewport()).
Returns whether this node has been hidden specifically in the given viewport via
set_viewport_visibility(). If include_hierarchy_parent isTrue, the node is also considered hidden if any of its ancestor nodes in the scene tree is hidden in that viewport.
- property is_selected: bool
Indicates whether this node is currently part of the scene’s
selectionset.
- property lookat_node: SceneNode | None
The target node that this node is bound to look at (via a look-at rotation controller assigned to
transform_ctrl), used for example by camera and light source nodes; orNoneif this node is not bound to any target.
- property name: str
The name of the scene node, as it appears, for example, in the pipeline editor of the OVITO GUI. If the name is an empty string, the node will adopt the name from its
pipeline, if any.- Default:
''
- property parent_node: SceneNode | None
The parent node of this node in the scene tree; or
Noneif this is thescene_rootnode itself, which has no parent.
- property pipeline: Pipeline | None
The
Pipelinewhose output is displayed by this scene node; orNoneif this node acts as a pure group node without any visual output of its own. Every pipeline that is part of the scene is displayed through exactly one such node, created byPipeline.add_to_scene().
- property rotation: ArrayLike
The node’s rotation relative to
parent_node, specified as a Rodrigues vector in units of radians: the axis of rotation is given by the vector’s direction, while its length gives the rotation angle around that axis. This is a convenience shortcut that reads and writes the keyframe value oftransform_ctrlat animation time zero, ignoring any other keyframes the controller might have.- Default:
(0.0, 0.0, 0.0)
- set_viewport_visibility(viewport: Viewport, visible: bool) None
Shows or hides this individual scene node in a specific interactive viewport window, independently of the other viewports. Corresponds to the Pipeline Visibility function found in a viewport’s context menu in the OVITO GUI. See also
Pipeline.set_viewport_visibility(), which applies the same setting to every scene node associated with a given pipeline at once.
- property transform_ctrl: Controller
The low-level, animatable
Controllerobject managing this node’s position and orientation relative to itsparent_node. This is normally an instance ofPRSTransformationController, which is what gets created by default for every newSceneNode. Thetranslationandrotationproperties are convenience shortcuts for reading and writing this controller’s keyframe values at animation time zero.
- property translation: ArrayLike
The position, in local coordinates relative to
parent_node, at which the node’spipelineoutput (and anychildrennodes) is placed in the scene. This is a convenience shortcut that reads and writes the keyframe value oftransform_ctrlat animation time zero, ignoring any other keyframes the controller might have.- Default:
(0.0, 0.0, 0.0)
- class ovito.nonpublic.SceneRenderer
Abstract base class for all rendering backends available in OVITO:
See also
manual:rendering in the OVITO user manual
- class ovito.nonpublic.SceneRoot
The root node of the tree of
SceneNodeinstances that make up the three-dimensional scene, accessible through theScene.scene_rootattribute (i.e.ovito.scene.scene_root). Do not confuse this internalSceneRootclass with the public, top-levelSceneobject (ovito.scene), of which it is just one component.In addition to the inherited
childrenlist (the top-level pipeline nodes of the scene), this class provides access to the scene’sanimandselectionstate. The former is also reachable more directly throughScene.anim.- property anim: AnimationSettings
The
AnimationSettingsinstance associated with the scene. Equivalent toScene.anim.
- property selection: SelectionSet
The
SelectionSetholding the scene nodes that are currently selected in the OVITO GUI.
- class ovito.nonpublic.SelectionSet
Stores the current selection of
SceneNodeinstances in the three-dimensional scene, i.e. the set of nodes highlighted in OVITO’s viewports, command panel, and data inspector panel. It is accessible through theSceneRoot.selectionattribute of the scene root node (Scene.scene_root).The public
Scene.selected_pipelinefield provides more direct access to thePipelineassociated with the currently selectedSceneNode, i.e. it is equivalent toovito.scene.scene_root.selection.first.pipeline.- property first: SceneNode | None
The first
SceneNodein thenodeslist; orNoneif the selection is empty.
- property nodes: MutableSequence[SceneNode]
The list of currently selected
SceneNodeinstances.
- class ovito.nonpublic.Vector3AnimationKey
Base:
AnimationKeyA keyframe of a vector- or color-valuedKeyframeController(typeController.Type.Vector3).
- class ovito.nonpublic.ViewportConfiguration
Encapsulates the current arrangement of
Viewportwindows of the OVITO desktop application, accessible through theScene.viewport_configattribute (i.e.ovito.scene.viewport_config). This includes the flat list of all existing viewports (viewports), the tree of nestedViewportLayoutCellinstances describing how they are arranged on screen (layout_root_cell), and which viewport is currently active (active_vp) or maximized (maximized_vp).You can render a
ViewportConfigurationby passing it to theRenderSettings.render()method. TheRenderSettings.render_all_viewportsoption determines whether all viewports are rendered or only the currently active one.See also
manual:viewport_layouts in the OVITO user manual
- property active_vp: Viewport | None
The viewport that is currently active. It is marked with a colored border in OVITO’s
MainWindow.
- get_viewport_rectangles() list[tuple[Viewport, tuple[float, float, float, float]]]
Computes the effective rectangular area occupied by each viewport in the current
layout_root_cellhierarchy. Returns a list of(viewport, rect)pairs, where eachrectis a(x, y, width, height)tuple given in normalized coordinates relative to the overall layout area, with(0, 0)denoting the top-left corner and(1, 1)the bottom-right corner.
- property layout_root_cell: ViewportLayoutCell
The root cell of the tree of nested
ViewportLayoutCellinstances that describes the current arrangement of viewport windows, see manual:viewport_layouts.
- property maximized_vp: Viewport | None
The viewport that is currently maximized; or
Noneif no viewport is maximized.
- property viewports: Sequence[Viewport]
The flat list of all
Viewportinstances that are part of the current viewport layout, in no particular order. Uselayout_root_cellto determine their on-screen arrangement.
- zoom_all_when_ready() None
Schedules all viewports in the
viewportslist to be zoomed to the extents of the scene once all data pipelines in the scene have been fully evaluated and their spatial extents are known. Unlike an immediate zoom operation, this defers the camera adjustment until the pending pipeline evaluations complete.
- class ovito.nonpublic.ViewportLayoutCell
A single node in the tree of nested layout cells that describes how the
Viewportwindows of the OVITO desktop application are arranged on screen, rooted atViewportConfiguration.layout_root_cell.A leaf cell directly hosts a single
viewport, while an interior cell instead subdivides its rectangular area, eitherhorizontally or vertically, among itschildrencells according to their relativechild_weights.See also
manual:viewport_layouts in the OVITO user manual
- property child_weights: list[float]
The relative sizes of the
childrencells along thesplit_directionaxis. This list has the same length aschildren; the fraction of the available space given to a child cell equals its weight divided by the sum of all weights.
- property children: MutableSequence[ViewportLayoutCell]
The list of sub-cells that this interior cell’s area is subdivided into, arranged according to
split_directionand sized according tochild_weights. Empty for a leaf cell that directly hosts aviewport.
- property parent: ViewportLayoutCell | None
The parent cell in the layout tree that this cell is a child of; or
Noneif this is thelayout_root_cell.
- property split_direction: int
For an interior cell with two or more
children, specifies the axis along which this cell’s area is subdivided among them.- Possible values:
0(None): This is a leaf cell hosting a singleviewportand has no children.1(Horizontal): The children are arranged side by side, left to right.2(Vertical): The children are stacked on top of each other, top to bottom.