mari.current

Contains convenience functions for easy access to currently-active elements.

These functions are all only wrappers for other functions, and are mainly useful for simple scripts that only need to access one item of a given type: the current one, which is usually the most relevant.

mari.current.canvas()

Return the canvas/viewport that is currently active.

This is the same as calling: mari.canvases.current()

Returns:

mari.Canvas – The currently-active canvas

Raises:

RuntimeError – Raised if there is no project open.

mari.current.channel()

Return the currently-selected channel.

This is the current channel on the current geo entity, and is the same as calling: mari.geo.current().currentChannel()

Returns:

mari.Channel – The currently-selected channel

Raises:

RuntimeError – Raised if there is no project open.

mari.current.geo()

Return the currently-selected geometry object.

This is the same as calling: mari.geo.current()

Returns:

mari.GeoEntity – The currently-selected geometry object

Raises:

RuntimeError – Raised if there is no project open.

mari.current.geoVersion()

Return the currently-selected geometry version.

This is the current version on the current geo entity, and is the same as calling: mari.geo.current().currentVersion()

Returns:

mari.GeoEntityVersion – The currently-selected geometry version

Raises:

RuntimeError – Raised if there is no project open.

mari.current.layer()

Return the currently-active layer.

This is the current layer in the current channel on the current geo entity, and is the same as calling: mari.geo.current().currentChannel().currentLayer()

Returns:

mari.Layer – The current layer, as whichever subtype of mari.Layer is appropriate

Raises:

RuntimeError – Raised if there is no project open.

mari.current.light()

Return the currently-selected light.

This is the same as calling: mari.lights.current()

Returns:

mari.Light – The currently-selected light

Raises:

RuntimeError – Raised if there is no project open.

mari.current.nodeGraph()

Return the nodegraph of the currently-selected tab in the Node Graph palette.

Returns:

mari.NodeGraph – The nodegraph of the currently selected tab in the Node Graph palette.

mari.current.nodeSelection()

Return the currently-selected nodes.

This is a list of the selected nodes in the root node graph on the current geo entity, and is the same as calling: mari.geo.current().nodeGraph().selectedNodeList()

Returns:

list – A list of the selected nodes in the root node graph of the current geo entity

Raises:

RuntimeError – Raised if there is no project open.

mari.current.project()

Return the project that is currently open, if any.

This is the same as calling: mari.projects.current()

Returns:

mari.Project – The project that is currently open, or None

mari.current.projector()

Return the projector that is currently selected in the GUI.

This is the same as calling: mari.projectors.current()

Returns:

mari.Projector – The projector that is currently selected in the GUI

Raises:

RuntimeError – Raised if there is no project open.

mari.current.shader()

Return the currently-selected shader.

This is the current shader on the current geo entity, and is the same as calling: mari.geo.current().currentShader()

Returns:

mari.Shader – The currently-selected shader

Raises:

RuntimeError – Raised if there is no project open.

mari.current.tool()

Return the currently-selected tool.

This is the same as calling: mari.tools.current()

Returns:

str – The name of the currently-selected tool