Package mrv :: Module mdepparse :: Class MayaFileGraph
[hide private]
[frames] | no frames]

Class MayaFileGraph

source code

                  object --+        
                           |        
networkx.classes.graph.Graph --+    
                               |    
networkx.classes.digraph.DiGraph --+
                                   |
                                  MayaFileGraph

Contains dependnecies between maya files including utility functions allowing to more easily find what you are looking for
Instance Methods [hide private]

Inherited from networkx.classes.digraph.DiGraph: __init__, add_edge, add_edges_from, add_node, add_nodes_from, clear, degree_iter, edges_iter, has_predecessor, has_successor, in_degree, in_degree_iter, in_edges, in_edges_iter, is_directed, is_multigraph, neighbors, neighbors_iter, out_degree, out_degree_iter, out_edges, out_edges_iter, predecessors, predecessors_iter, remove_edge, remove_edges_from, remove_node, remove_nodes_from, reverse, subgraph, successors, successors_iter, to_directed, to_undirected

Inherited from networkx.classes.graph.Graph: __contains__, __getitem__, __iter__, __len__, __str__, add_cycle, add_path, add_star, add_weighted_edges_from, adjacency_iter, adjacency_list, copy, degree, edges, get_edge_data, has_edge, has_node, nbunch_iter, nodes, nodes_iter, nodes_with_selfloops, number_of_edges, number_of_nodes, number_of_selfloops, order, selfloop_edges, size

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

    Edit
 
_addInvalid(self, invalidfile)
Add an invalid file to our special location :note: we prefix it to assure it does not popup in our results
source code
 
_parseDepends(self, mafile, allPaths)
Returns: list of filepath as parsed from the given mafile.
source code
 
addFromFiles(self, mafiles, parse_all_paths=False, to_os_path=<function <lambda> at 0x2e0d500>, os_path_to_db_key=<function <lambda> at 0x2e0d578>)
Parse the dependencies from the given maya ascii files and add them to this graph
source code
    Query
 
depends(self, filePath, direction=0, to_os_path=<function <lambda> at 0x2e0d668>, os_path_to_db_key=<function <lambda> at 0x2e0d6e0>, return_unresolved=False, invalid_only=False, **kwargs)
Returns: list of paths ( converted to os paths ) that are related to the given filePath
source code
 
invalidFiles(self)
Returns: list of filePaths that could not be parsed, most probably because they could not be found by the system
source code
Class Methods [hide private]
    Edit
 
createFromFiles(cls, fileList, **kwargs)
Returns: MayaFileGraph providing dependency information about the files in fileList and their subReference.
source code
 
_parseReferences(cls, mafile, allPaths=False)
Returns: list of reference strings parsed from the given maya ascii file
source code
Class Variables [hide private]
  refpathregex = re.compile(r'.*-r .*"(.*)";')
  invalidNodeID = '__invalid__'
  invalidPrefix = ':_iv_:'
  kAffectedBy = 1
  kAffects = 0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

createFromFiles(cls, fileList, **kwargs)
Class Method

source code 
Parameters:
  • fileList - iterable providing the filepaths to be parsed and added to this graph
  • kwargs - alll arguemnts of addFromFiles are supported
Returns:
MayaFileGraph providing dependency information about the files in fileList and their subReference.

_parseReferences(cls, mafile, allPaths=False)
Class Method

source code 
Returns:
list of reference strings parsed from the given maya ascii file
Raises:
  • IOError - if the file could not be read

_parseDepends(self, mafile, allPaths)

source code 
Parameters:
  • allPaths - if True, the whole file will be parsed, if False, only the reference section will be parsed
Returns:
list of filepath as parsed from the given mafile.

addFromFiles(self, mafiles, parse_all_paths=False, to_os_path=<function <lambda> at 0x2e0d500>, os_path_to_db_key=<function <lambda> at 0x2e0d578>)

source code 
Parse the dependencies from the given maya ascii files and add them to this graph
Parameters:
  • parse_all_paths - if True, default False, all paths found in the file will be used. This will slow down the parsing as the whole file will be searched for references instead of just the header of the file
  • to_os_path - functor returning an MA file from given posssibly parsed file that should be existing on the system parsing the files. The passed in file could also be an mb file ( which cannot be parsed ), thus it would be advantageous to return a corresponding ma file This is required as references can have environment variables inside of them
  • os_path_to_db_key - converts the given path as used in the filesystem into a path to be used as key in the database. It should be general. Ideally, os_path_to_db_key is the inverse as to_os_path.
Notes:
  • the more files are given, the more efficient the method can be
  • if the parsed path contain environment variables you must start the tool such that these can be resolved by the system. Otherwise files might not be found

To Do: parse_all_paths still to be implemented

depends(self, filePath, direction=0, to_os_path=<function <lambda> at 0x2e0d668>, os_path_to_db_key=<function <lambda> at 0x2e0d6e0>, return_unresolved=False, invalid_only=False, **kwargs)

source code 
Parameters:
  • direction - specifies search direction, either : kAffects = Files that filePath affects kAffectedBy = Files that affect filePath
  • return_unresolved - if True, the output paths will not be translated to an os paths and you get the paths as stored in the graph. Please not that the to_os_path function is still needed to generate a valid key, depending on the format of filepaths stored in this graph
  • invalid_only - if True, only invalid dependencies will be returned, all including the invalid ones otherwise
  • to_os_path - see addFromFiles
  • os_path_to_db_key - see addFromFiles
  • kwargs - passed to iterNetworkxGraph
Returns:
list of paths ( converted to os paths ) that are related to the given filePath

invalidFiles(self)

source code 
Returns:
list of filePaths that could not be parsed, most probably because they could not be found by the system