Graph#
- class pybmd.graph.Graph(graph)[source]
Bases:
WrapperBasedocstring for Graph.
Methods
__init__(graph)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.
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).
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:
- 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
- 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).
- set_node_enabled(node_index: int, is_enable: bool) bool[source]
Sets the node at the given nodeIndex (int) to isEnabled (bool).
- set_node_cache_mode(node_index: int, cache_value: int) bool[source]
Sets the cache mode type on the node.
- Parameters:
- Returns:
True if successful, False otherwise
- Return type:
- Raises:
APIVersionError – If Resolve version < 19.1.0
- Version:
Added in DaVinci Resolve 19.1.0
- 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:
- 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_layersadded in 21.1.1,keyframe_modeadded in 21.1.2.
- apply_arri_cdl_lut() bool[source]
Applies ARRI CDL and LUT.
- Returns:
True if successful, False otherwise
- Return type:
- reset_all_grades() bool[source]
Resets all grades in the graph.
- Returns:
True if all grades were reset successfully, False otherwise
- Return type:
- set_node_label(node_index: int, label: str) bool[source]
Sets the label of the node at node_index.
- Parameters:
- Returns:
True if successful, False otherwise
- Return type:
- 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:
- 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:
- Returns:
True if successful, False otherwise
- Return type:
- Raises:
APIVersionError – If Resolve version < 21.1.2
- Version:
Added in DaVinci Resolve 21.1.2