Graph#

class pybmd.graph.Graph(graph)[source]

Bases: WrapperBase

docstring for Graph.

Methods

__init__(graph)

apply_arri_cdl_lut()

Applies ARRI CDL and LUT.

apply_grade_from_drx(path[, grade_mode, ...])

Loads a still from given file path and applies grade to graph.

get_lut(node_index)

Gets relative LUT path based on the node index provided

get_node_cache_mode(node_index)

Gets the cache mode type on the node.

get_node_color(node_index)

Returns the color of the node at node_index.

get_node_label(node_index)

Returns the label of the node at nodeIndex.

get_num_nodes()

Returns the number of nodes in the graph

get_tools_in_node(node_index)

Returns toolsList (list of strings) of the tools used in the node indicated by given nodeIndex (int).

reset_all_grades()

Resets all grades in the graph.

set_lut(node_index, lut_path)

Sets LUT on the node mapping the node index provided :param node_index: 1 <= nodeIndex <= self.GetNumNodes().

set_node_cache_mode(node_index, cache_value)

Sets the cache mode type on the node.

set_node_color(node_index, color_name)

Sets the color of the node at node_index.

set_node_enabled(node_index, is_enable)

Sets the node at the given nodeIndex (int) to isEnabled (bool).

set_node_label(node_index, label)

Sets the label of the node at node_index.

get_num_nodes() → int[source]

Returns the number of nodes in the graph

Returns:

number of nodes in the graph

Return type:

int

set_lut(node_index: int, lut_path: str) → bool[source]

Sets LUT on the node mapping the node index provided :param node_index: 1 <= nodeIndex <= self.GetNumNodes(). :type node_index: int :param lut_path: The lutPath can be an absolute path, or a relative path (based off custom LUT paths or the master LUT path). :type lut_path: str

Returns:

The operation is successful for valid lut paths that Resolve has already discovered (see Project.RefreshLUTList).

Return type:

bool

Parameters:
  • node_index (int)

  • lut_path (str)

get_lut(node_index: str) → str[source]

Gets relative LUT path based on the node index provided

Parameters:

node_index (str) – 1 <= nodeIndex <= total number of nodes.

Returns:

relative LUT path

Return type:

str

get_node_label(node_index: int) → str[source]

Returns the label of the node at nodeIndex.

Parameters:

node_index (int) – 1 <= nodeIndex <= total number of nodes.

Returns:

the label of the node at nodeIndex.

Return type:

str

get_tools_in_node(node_index: int) → List[str][source]

Returns toolsList (list of strings) of the tools used in the node indicated by given nodeIndex (int).

Parameters:

node_index (int) – 1 <= nodeIndex <= total number of nodes.

Returns:

toolsList (list of strings) of the tools used in the node indicated by given nodeIndex (int).

Return type:

List[str]

set_node_enabled(node_index: int, is_enable: bool) → bool[source]

Sets the node at the given nodeIndex (int) to isEnabled (bool).

Parameters:
  • node_index (int) – 1 <= nodeIndex <= self.GetNumNodes().

  • is_enable (bool) – node is enabled or not

Returns:

Return True if the operation is successful.

Return type:

bool

set_node_cache_mode(node_index: int, cache_value: int) → bool[source]

Sets the cache mode type on the node.

Parameters:
  • node_index (int) – 1 <= nodeIndex <= total number of nodes

  • cache_value (int) – Cache mode value to set

  • values (cache_value is an enumerated integer with one of the following) –

    • resolve.CACHE_AUTO_ENABLED = -1

    • resolve.CACHE_DISABLED = 0

    • resolve.CACHE_ENABLED = 1

Returns:

True if successful, False otherwise

Return type:

bool

Raises:

APIVersionError – If Resolve version < 19.1.0

Version:

Added in DaVinci Resolve 19.1.0

get_node_cache_mode(node_index: int) → int[source]

Gets the cache mode type on the node.

Parameters:

node_index (int) – 1 <= nodeIndex <= total number of nodes

Returns:

Cache mode value of the node.cache_value is an enumerated integer with one of the following values:
  • resolve.CACHE_AUTO_ENABLED = -1

  • resolve.CACHE_DISABLED = 0

  • resolve.CACHE_ENABLED = 1

Return type:

int

apply_grade_from_drx(path: str, grade_mode: int = 0, apply_to_all_layers: bool = False, keyframe_mode: KeyframeMode | int | None = None) → bool[source]

Loads a still from given file path and applies grade to graph.

Applying a grade replaces the graph: after a successful call this Graph object no longer refers to a valid graph. Call get_node_graph() again to keep working with the new one.

Parameters:
  • path (str) – File path to the DRX file

  • grade_mode (int, optional) – 0=”No keyframes”, 1=”Source Timecode aligned”, 2=”Start Frames aligned”. Defaults to 0.

  • apply_to_all_layers (bool, optional) – Apply the grade to all node-stack layers instead of only the active layer. Needs DR 21.1.1+; only sent when True. Defaults to False.

  • keyframe_mode (KeyframeMode | int, optional) – What to apply: all, color only or sizing only. Needs DR 21.1.2+; DaVinci Resolve applies everything when omitted. Defaults to None.

Returns:

True if successful, False otherwise

Return type:

bool

Raises:

APIVersionError – If Resolve version < 19.1.0, or an argument is used on a version that predates it

Version:

Added in DaVinci Resolve 19.1.0. apply_to_all_layers added in 21.1.1, keyframe_mode added in 21.1.2.

apply_arri_cdl_lut() → bool[source]

Applies ARRI CDL and LUT.

Returns:

True if successful, False otherwise

Return type:

bool

reset_all_grades() → bool[source]

Resets all grades in the graph.

Returns:

True if all grades were reset successfully, False otherwise

Return type:

bool

set_node_label(node_index: int, label: str) → bool[source]

Sets the label of the node at node_index.

Parameters:
  • node_index (int) – 1 <= node_index <= get_num_nodes()

  • label (str) – new node label

Returns:

True if successful, False otherwise

Return type:

bool

Raises:

APIVersionError – If Resolve version < 21.1.2

Version:

Added in DaVinci Resolve 21.1.2

get_node_color(node_index: int) → str[source]

Returns the color of the node at node_index.

Parameters:

node_index (int) – 1 <= node_index <= get_num_nodes()

Returns:

the node color, e.g. “Orange”, or an empty string if none is set

Return type:

str

Raises:

APIVersionError – If Resolve version < 21.1.2

Version:

Added in DaVinci Resolve 21.1.2

set_node_color(node_index: int, color_name: Literal['Orange', 'Apricot', 'Yellow', 'Lime', 'Olive', 'Green', 'Teal', 'Navy', 'Blue', 'Purple', 'Violet', 'Pink', 'Tan', 'Beige', 'Brown', 'Chocolate', ''] | str) → bool[source]

Sets the color of the node at node_index.

Parameters:
  • node_index (int) – 1 <= node_index <= get_num_nodes()

  • color_name (str) – one of the clip colors, e.g. “Orange”, “Teal” or “Chocolate”. An empty string clears the color.

Returns:

True if successful, False otherwise

Return type:

bool

Raises:

APIVersionError – If Resolve version < 21.1.2

Version:

Added in DaVinci Resolve 21.1.2