nxt_layer module

Ways to operate on and ask questions of nxt layers.

get_active_layers(layers)[source]

Given a list of layers, return those that should contribute to comp.

If there are soloed layers, only the soloed layers that are not muted will be returned. If there are not soloed layers, only the non-muted layers will be returned.

Parameters:layers (list) – list of layers to filter
Returns:list of layers that should contribute to a comp.
Return type:list
get_soloed_layers(layers)[source]

Given a list of layers, return only those that are soloed

Parameters:layers (list) – list of layers to filter
Returns:list of layers that are soloed.
Return type:list
get_muted_layers(layers)[source]

Given a list of layers, return only those that are muted

Parameters:layers (list) – list of layers to filter
Returns:list of layers that are muted.
Return type:list
get_node_local_attr_names(node_path, layers)[source]

Get all attribute names that are local to the given node path within the given layers.

NOTE that layers are filtered to active layers.

Parameters:
  • node_path (str) – node path to find local attributes of
  • layers (list) – list of layers to look for attributes of given node within
Returns:

list of local attributes found in given layers

Return type:

list

order_nodes_dict(node_dict)[source]

Given a dictionary mapping node paths to node data, return an ordered dict where the keys are sorted.

Parameters:node_dict (dict) – dictionary mapping node paths to node data
Returns:ordered dctionary with keys sosrted
Return type:OrderedDict
class SpecLayer(layer_data=None)[source]

Layer object representing layer data from disk.

classmethod load_from_filepath(filepath)[source]

Given a filepath, return a SpecLayer loaded from that path.

Parameters:filepath (str) – path to file to load
Returns:Loaded SpecLayer
Return type:SpecLayer
add_reference(layer_path=None, layer=None, insert_idx=None)[source]

Given a layer path, a layer object, or both, add a reference to specified layer on this layer, optionally at a specified insert index.

Parameters:
  • layer_path (str, optional) – Path to use as reference path, defaults to None, if None is given, defaults to given layer.real_path
  • layer (SpecLayer) – layer to add as reference layer in this layer
  • insert_idx (int, optional) – index to insert given layer at, defaults to None, if None is given, defaults to lowest reference layer.
Returns:

index given layer was inserted at.

Return type:

int

Raises:

ValueError – If not provided with a layer path or layer.

save(filepath=None)[source]

Save this layer, optionally to new, given filepath.

Parameters:filepath (str, optional) – file path to save to, defaults to None