mrv.automation.process

Epydoc: mrv.automation.process

Contains base class and common methods for all processes

Functions

mrv.automation.process.make_path(path)
Returns:A path instance of the correct type
Note:use this constructor if you use the Path.set_separator method at runtime to assure you will always create instances of the actual type, and not only of the type you imported last
mrv.automation.process.track_output_call(func)
Wraps the proecss.evaluateStateBase function allowing to gather plenty of information about the call, as well as error statistics

Classes

Epydoc: mrv.automation.process

class mrv.automation.process.Attribute(typeClass, flags, default=None)

Bases: object

Simple class defining the type of a plug and several flags that affect it. Additionally it can determine how well suited another attribute is

Flags:
exact_type: if True, derived classes of our typecls are not considered to be a valid type. i.e: basestring could be stored in a str attr if exact type is false - its less than we need, but still something. Putting a str into a basestring attribute will always work though, as it would be more than we need readonly: if True, the attribute’s plug cannot be written to. Read-only attributes can be used as storage that the user can read, but not write. You can write read-only plugs by directly setting its cache - this of course - is only for the node itself, but will never be done by the framework
computable:

Nodes are automatically computable if they are affected by another plug. If this is not the case, they are marked input only and are not computed. If this flag is true, even unaffeted plugs are computable. Plugs that affect something are automatically input plugs and will not be computed. If the plug does not affect anything and this flag is False, they are seen as input plugs anyway.

The system does not allow plugs to be input and output plugs at the same time, thus your compute cannot be triggered by your own compute

cls: if True, the plug requires classes to be set ( instances of ‘type’ ) , but no instances of these classes uncached: if False, computed values may be cached, otherwise they will always be recomputed. unconnectable: if True, the node cannot be the destination of a connection check_passing_values: check each value as it flows through a connection - usually compatability is only checked on connection and once values are set, but not if they flow through an existing connection

Default Values:
Although default values can be simple primitives are classes, a callable is specifically supported. It allows you to get a callback whenever a default value is required. The same result could be achieved by connected the plug in question, but dynamic defaults are a quick way to achive that. Your returned value will be type-checked against the required type if check_passing_values is set.
affinity(otherattr)

Compute affinity for otherattr.

Returns:rating from 0 to 255 defining how good the attribtues match each other in general - how good can we store values of otherattr ? Thus this comparison is directed.
Note:for checking connections, use connectionAffinity
compatabilityRate(value)

Compute value’s compatability rate

Returns:value between 0 and 255, 0 means no compatability, 255 a perfect match. if larger than 0, the plug can hold the value ( assumed the flags are set correctly ).
connectionAffinity(destinationattr)

Compute connection affinity for given destination attribute

Returns:rating from 0 to 255 defining the quality of the connection to otherplug. an affinity of 0 mean connection is not possible, 255 mean the connection is perfectly suited. The connection is a directed one from self -> otherplug
default()
Returns:default value stored for this attribute, or raise
Note:handles dynamic defaults, so you should not directly access the default member variable
Raises MissingDefaultValueError:
 if attribute does not have a default value
Raises TypeError:
 if value returned by dynamic attribute has incorrect type

Epydoc: mrv.automation.process

class mrv.automation.process.GraphNodeBase(wrappedGraph, *args, **kwargs)

Bases: mrv.dgfe.FacadeNodeBase

A node wrapping a graph, allowing it to be nested within the node All inputs and outputs on this node are purely virtual, thus they internally connect to the wrapped graph.

Todo:tests deletion of graphnodes and see whether they are being garbage collected. It should work with the new collector as it can handle cyclic references - these strong cycles we have a lot in this structure. Weakrefs will not work for nested facade nodes as they are tuples not allowing weak refs.
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

clearCache()
Clear the cache of all plugs on this node - this basically forces it to recompute the next time an output plug is being queried
clearPlugCache()

if a cache has been build as caching is enabled, this method clears the cache forcing it to be updated on the next demand

Note:this could be more efficient by just deleting plugs that are not required anymore, but probably this method can expect the whole cache to be deleted right away ... so its fine
compute(plug, mode)

Called whenever a plug needs computation as the value its value is not cached or marked dirty ( as one of the inputs changed )

Parameters:
  • plug – the static plug instance that requested which requested the computation. It is the instance you defined on the class
  • mode – the mode of operation. Its completely up to the superclasses how that attribute is going to be used
Note:

to be implemented by superclass

connections(inpt, output)
Returns:

Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell )

Parameters:
  • inpt – include input connections to this node
  • output – include output connections ( from this node to others )
copyFrom(other, **kwargs)
Actually, it does nothing because our plugs are linked to the internal nodes in a quite complex way. The good thing is that this is just a cache that will be updated once someone queries connections again. Basically it comes down to the graph duplicating itself using node and plug methods instead of just doing his ‘internal’ magic
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(**kwargs)
Create a copy of self and return it
duplicate(*args, **kwargs)

Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class

Parameters:
  • args – passed to copyFrom and createInstance method to give additional directions
  • kwargs – see param args
classmethod filterCompatiblePlugs(plugs, attrOrValue, raise_on_ambiguity=False, attr_affinity=False, attr_as_source=True)
Returns:

sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned.

Parameters:
  • attrOrValue – either an attribute or the value you would like to set to the attr at the plug in question.
  • raise_on_ambiguity – if True, the method raises if a plug has the same rating as another plug already on the output list, thus it’s not clear anymore which plug should handle a request
  • attr_affinity – if True, it will not check connection affinity, but attribute affinity only. It checks how compatible the attributes of the plugs are, disregarding whether they can be connected or not Only valid if attrOrValue is an attribute
  • attr_as_source – if True, attrOrValue will be treated as the source of a connection or each plug would need to take its values. if False, attrOrValue is the destination of a connection and it needs to take values of the given plugs or they would connect to it. Only used if attrOrValue is an attribute.
Raises TypeError:
 

if ambiguous input was found

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
id()
Returns:ID of this instance
inputPlugs(**kwargs)
Returns:list of plugs suitable as input
Note:convenience method
classmethod inputPlugsStatic(**kwargs)
Returns:list of static plugs suitable as input
Note:convenience method
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
outputPlugs(**kwargs)
Returns:list of plugs suitable to deliver output
Note:convenience method
classmethod outputPlugsStatic(**kwargs)
Returns:list of static plugs suitable to deliver output
Note:convenience method
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
plugs(**kwargs)
Calls _getNodePlugs method to ask you to actuallly return your actual nodes and plugs or shells. We prepare the returned value to assure we are being called in certain occasion, which actually glues outside and inside worlds together
classmethod plugsStatic(predicate=<function <lambda> at 0x2ed1578>)
Returns:list of static plugs as defined on this node - they are class members
Parameter:predicate – return static plug only if predicate is true
Note:Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one.
root()
Returns:the root of the DAG - it has no further parents
setID(newID)
Set id of this node to newiD :return: previously assigned id
shellcls
alias of _OIShell
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
toShell(plug)
Returns:a plugshell as suitable to for this class
toShells(plugs)
Returns:list of shells made from plugs and our node

Epydoc: mrv.automation.process

class mrv.automation.process.NodeBase(*args, **kwargs)

Bases: mrv.interface.iDuplicatable

Base class that provides support for plugs to the superclass. It will create some simple tracking attriubtes required for the plug system to work

Nodes can compute values of their plugs if these do not have a cache.

Nodes are identified by an ID - the default graph implementation though will be okay with just having instances. It is also being used for string representations of this node

classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

clearCache()
Clear the cache of all plugs on this node - this basically forces it to recompute the next time an output plug is being queried
compute(plug, mode)

Called whenever a plug needs computation as the value its value is not cached or marked dirty ( as one of the inputs changed )

Parameters:
  • plug – the static plug instance that requested which requested the computation. It is the instance you defined on the class
  • mode – the mode of operation. Its completely up to the superclasses how that attribute is going to be used
Note:

to be implemented by superclass

connections(inpt, output)
Returns:

Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell )

Parameters:
  • inpt – include input connections to this node
  • output – include output connections ( from this node to others )
copyFrom(other, add_to_graph=True)

Just take the graph from other, but do not ( never ) duplicate it

Parameter:add_to_graph – if true, the new node instance will be added to the graph of
Note:default implementation does not copy plug caches ( which are stored in the node dict - this is because a reevaluate is usually required on the duplicated node
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create a copy of self and return it

Note:override by subclass - the __init__ methods shuld do the rest
duplicate(*args, **kwargs)

Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class

Parameters:
  • args – passed to copyFrom and createInstance method to give additional directions
  • kwargs – see param args
classmethod filterCompatiblePlugs(plugs, attrOrValue, raise_on_ambiguity=False, attr_affinity=False, attr_as_source=True)
Returns:

sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned.

Parameters:
  • attrOrValue – either an attribute or the value you would like to set to the attr at the plug in question.
  • raise_on_ambiguity – if True, the method raises if a plug has the same rating as another plug already on the output list, thus it’s not clear anymore which plug should handle a request
  • attr_affinity – if True, it will not check connection affinity, but attribute affinity only. It checks how compatible the attributes of the plugs are, disregarding whether they can be connected or not Only valid if attrOrValue is an attribute
  • attr_as_source – if True, attrOrValue will be treated as the source of a connection or each plug would need to take its values. if False, attrOrValue is the destination of a connection and it needs to take values of the given plugs or they would connect to it. Only used if attrOrValue is an attribute.
Raises TypeError:
 

if ambiguous input was found

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
id()
Returns:ID of this instance
inputPlugs(**kwargs)
Returns:list of plugs suitable as input
Note:convenience method
classmethod inputPlugsStatic(**kwargs)
Returns:list of static plugs suitable as input
Note:convenience method
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
outputPlugs(**kwargs)
Returns:list of plugs suitable to deliver output
Note:convenience method
classmethod outputPlugsStatic(**kwargs)
Returns:list of static plugs suitable to deliver output
Note:convenience method
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
plugs(predicate=<function <lambda> at 0x2ed1668>)
Returns:list of dynamic plugs as defined on this node - they are usually retrieved on class level, but may be overridden on instance level
Parameter:predicate – return static plug only if predicate is true
classmethod plugsStatic(predicate=<function <lambda> at 0x2ed1578>)
Returns:list of static plugs as defined on this node - they are class members
Parameter:predicate – return static plug only if predicate is true
Note:Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one.
root()
Returns:the root of the DAG - it has no further parents
setID(newID)
Set id of this node to newiD :return: previously assigned id
shellcls
alias of _PlugShell
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
toShell(plug)
Returns:a plugshell as suitable to for this class
toShells(plugs)
Returns:list of shells made from plugs and our node

Epydoc: mrv.automation.process

class mrv.automation.process.Or(*args)

Bases: object

For use with python’s filter method, simulates logical OR Usage: filter(Or(f1,f2,fn), sequence)

functions

Epydoc: mrv.automation.process.ProcessBase

class mrv.automation.process.ProcessBase(id, *args, **kwargs)

Bases: mrv.dge.NodeBase

The base class for all processes, defining a common interface Inputs and Outputs of this node are statically described using plugs

Note:the process base is able to duplcate properly as it stores in constructor arguments accordingly
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

clearCache()
Clear the cache of all plugs on this node - this basically forces it to recompute the next time an output plug is being queried
compute(plug, mode)
connections(inpt, output)
Returns:

Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell )

Parameters:
  • inpt – include input connections to this node
  • output – include output connections ( from this node to others )
copyFrom(other, *args, **kwargs)
Note: we have already given our args to the class during instance creation,
thus we do not copy args again
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)
Create a copy of self and return it
duplicate(*args, **kwargs)

Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class

Parameters:
  • args – passed to copyFrom and createInstance method to give additional directions
  • kwargs – see param args
evaluateState(plug, mode)
Returns:

an instance suitable to be stored in the given plug

Parameters:
  • plug – plug that triggered the computation - use it to compare against your classes plugs to see which output is required and return a result suitable to be stored in plug
  • mode

    bit flags as follows:

    is_state:
    your return value represents the current state of the process - your output will represent what actually is present. You may not alter the state of your environment, thus this operation is strictly read-only. According to your output, when called you need to setup a certain state and return the results according to that state. This flag means you are requrested to return everything that is right according to the state you shall create. If this state is disabled, you should not return the current state, but behave according to the other ones.
    target_state:
    your return value must represent the ‘should’ state - thus you must assure that the environment is left in a state that matches your plug state - the result of that operation will be returned. Usually, but not necessarily, the is_state is also requested so that the output represents the complete new is_state ( the new state after you changed the environment to match the plug_state )
    dirty_check:
    Always comes in conjunction with is_state. You are required to return the is_state but raise a DirtyException if your inputs would require you to adjust the environment to deliver the plug state. If the is_state if the environment is the plug_state as there is nothing to do for you, do not raise and simply return your output.

    The call takes place as there is no cache for plugType.

Note:

needs to be implemented by subclasses, but subclasses can just call their superclass for all unhandled plugs resulting in consistent error messages

classmethod filterCompatiblePlugs(plugs, attrOrValue, raise_on_ambiguity=False, attr_affinity=False, attr_as_source=True)
Returns:

sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned.

Parameters:
  • attrOrValue – either an attribute or the value you would like to set to the attr at the plug in question.
  • raise_on_ambiguity – if True, the method raises if a plug has the same rating as another plug already on the output list, thus it’s not clear anymore which plug should handle a request
  • attr_affinity – if True, it will not check connection affinity, but attribute affinity only. It checks how compatible the attributes of the plugs are, disregarding whether they can be connected or not Only valid if attrOrValue is an attribute
  • attr_as_source – if True, attrOrValue will be treated as the source of a connection or each plug would need to take its values. if False, attrOrValue is the destination of a connection and it needs to take values of the given plugs or they would connect to it. Only used if attrOrValue is an attribute.
Raises TypeError:
 

if ambiguous input was found

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
id()
Returns:ID of this instance
inputPlugs(**kwargs)
Returns:list of plugs suitable as input
Note:convenience method
classmethod inputPlugsStatic(**kwargs)
Returns:list of static plugs suitable as input
Note:convenience method
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
outputPlugs(**kwargs)
Returns:list of plugs suitable to deliver output
Note:convenience method
classmethod outputPlugsStatic(**kwargs)
Returns:list of static plugs suitable to deliver output
Note:convenience method
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
plugs(predicate=<function <lambda> at 0x2ed1668>)
Returns:list of dynamic plugs as defined on this node - they are usually retrieved on class level, but may be overridden on instance level
Parameter:predicate – return static plug only if predicate is true
classmethod plugsStatic(predicate=<function <lambda> at 0x2ed1578>)
Returns:list of static plugs as defined on this node - they are class members
Parameter:predicate – return static plug only if predicate is true
Note:Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one.
prepareProcess()
Will be called on all processes of the workflow once before a target is actually being queried by someone It should be used to do whatever you think is required to work as process. This uauslly is a special case for most preocesses
root()
Returns:the root of the DAG - it has no further parents
setID(newID)
Set id of this node to newiD :return: previously assigned id
shellcls
alias of _PlugShell
supportedTargetTypes()
Returns:list target types that can be output
Note:targetTypes are classes, not instances
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
targetRating(target, check_input_plugs=True, **kwargs)
Returns:

tuple( int, PlugShell ) int between 0 and 255 - 255 means target matches perfectly, 0 means complete incompatability. Any inbetweens indicate the target can be achieved, but maybe just in a basic way

If rate is 0, the object will be None, otherwise its a plugShell to the input attribute that can take target as input. In process terms this means that at least one output plug exists that produces the target.

Parameters:
  • target – instance or class of target to check for compatability
  • check_input_plugs – if True, input plugs will be checked for compatability of target, otherwise the output plugs
Raises TypeError:
 

if the result is ambiguous and raise_on_ambiguity = 1

toShell(plug)
Returns:a plugshell as suitable to for this class
toShells(plugs)
Returns:list of shells made from plugs and our node
workflow()
Returns:the workflow instance we are connected with. Its used to query global data

Epydoc: mrv.automation.process.WorkflowProcessBase

class mrv.automation.process.WorkflowProcessBase(id, wflInstance=None, **kwargs)

Bases: mrv.dgfe.GraphNodeBase, mrv.automation.process.ProcessBase

A process wrapping a workflow, allowing workflows to be nested Derive from this class and initialize it with the workflow you would like to have wrapped The process works by transmitting relevant calls to its underlying workflow, allowing nodeInsideNestedWorkflow -> thisworkflow.node.plug connections

Workflows are standin nodes - they can connect anything their wrapped nodes can connect

Note:to prevent dependency issues, the workflow instance will be bound on first use
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

clearCache()
Clear the cache of all plugs on this node - this basically forces it to recompute the next time an output plug is being queried
clearPlugCache()

if a cache has been build as caching is enabled, this method clears the cache forcing it to be updated on the next demand

Note:this could be more efficient by just deleting plugs that are not required anymore, but probably this method can expect the whole cache to be deleted right away ... so its fine
compute(plug, mode)
connections(inpt, output)
Returns:

Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell )

Parameters:
  • inpt – include input connections to this node
  • output – include output connections ( from this node to others )
copyFrom(other, **kwargs)
Actually, it does nothing because our plugs are linked to the internal nodes in a quite complex way. The good thing is that this is just a cache that will be updated once someone queries connections again. Basically it comes down to the graph duplicating itself using node and plug methods instead of just doing his ‘internal’ magic
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)
Create a copy of self and return it - required due to our very special constructor
duplicate(*args, **kwargs)

Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class

Parameters:
  • args – passed to copyFrom and createInstance method to give additional directions
  • kwargs – see param args
evaluateState(plug, mode)
Returns:

an instance suitable to be stored in the given plug

Parameters:
  • plug – plug that triggered the computation - use it to compare against your classes plugs to see which output is required and return a result suitable to be stored in plug
  • mode

    bit flags as follows:

    is_state:
    your return value represents the current state of the process - your output will represent what actually is present. You may not alter the state of your environment, thus this operation is strictly read-only. According to your output, when called you need to setup a certain state and return the results according to that state. This flag means you are requrested to return everything that is right according to the state you shall create. If this state is disabled, you should not return the current state, but behave according to the other ones.
    target_state:
    your return value must represent the ‘should’ state - thus you must assure that the environment is left in a state that matches your plug state - the result of that operation will be returned. Usually, but not necessarily, the is_state is also requested so that the output represents the complete new is_state ( the new state after you changed the environment to match the plug_state )
    dirty_check:
    Always comes in conjunction with is_state. You are required to return the is_state but raise a DirtyException if your inputs would require you to adjust the environment to deliver the plug state. If the is_state if the environment is the plug_state as there is nothing to do for you, do not raise and simply return your output.

    The call takes place as there is no cache for plugType.

Note:

needs to be implemented by subclasses, but subclasses can just call their superclass for all unhandled plugs resulting in consistent error messages

classmethod filterCompatiblePlugs(plugs, attrOrValue, raise_on_ambiguity=False, attr_affinity=False, attr_as_source=True)
Returns:

sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned.

Parameters:
  • attrOrValue – either an attribute or the value you would like to set to the attr at the plug in question.
  • raise_on_ambiguity – if True, the method raises if a plug has the same rating as another plug already on the output list, thus it’s not clear anymore which plug should handle a request
  • attr_affinity – if True, it will not check connection affinity, but attribute affinity only. It checks how compatible the attributes of the plugs are, disregarding whether they can be connected or not Only valid if attrOrValue is an attribute
  • attr_as_source – if True, attrOrValue will be treated as the source of a connection or each plug would need to take its values. if False, attrOrValue is the destination of a connection and it needs to take values of the given plugs or they would connect to it. Only used if attrOrValue is an attribute.
Raises TypeError:
 

if ambiguous input was found

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
id()
Returns:ID of this instance
inputPlugs(**kwargs)
Returns:list of plugs suitable as input
Note:convenience method
classmethod inputPlugsStatic(**kwargs)
Returns:list of static plugs suitable as input
Note:convenience method
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
outputPlugs(**kwargs)
Returns:list of plugs suitable to deliver output
Note:convenience method
classmethod outputPlugsStatic(**kwargs)
Returns:list of static plugs suitable to deliver output
Note:convenience method
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
plugs(**kwargs)
Calls _getNodePlugs method to ask you to actuallly return your actual nodes and plugs or shells. We prepare the returned value to assure we are being called in certain occasion, which actually glues outside and inside worlds together
classmethod plugsStatic(predicate=<function <lambda> at 0x2ed1578>)
Returns:list of static plugs as defined on this node - they are class members
Parameter:predicate – return static plug only if predicate is true
Note:Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one.
prepareProcess()

As we have different callgraphs, but want proper reports, just swap in the callgraph of our own workflow to allow it to be maintained correctly when the nodes of the wrapped graph evaluate.

Note:this requires that we get called after the callgraph has bene initialized
root()
Returns:the root of the DAG - it has no further parents
setID(newID)
Set id of this node to newiD :return: previously assigned id
shellcls
alias of _OIShell
supportedTargetTypes()
Returns:list target types that can be output
Note:targetTypes are classes, not instances
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
targetRating(target, check_input_plugs=True, **kwargs)
Returns:

tuple( int, PlugShell ) int between 0 and 255 - 255 means target matches perfectly, 0 means complete incompatability. Any inbetweens indicate the target can be achieved, but maybe just in a basic way

If rate is 0, the object will be None, otherwise its a plugShell to the input attribute that can take target as input. In process terms this means that at least one output plug exists that produces the target.

Parameters:
  • target – instance or class of target to check for compatability
  • check_input_plugs – if True, input plugs will be checked for compatability of target, otherwise the output plugs
Raises TypeError:
 

if the result is ambiguous and raise_on_ambiguity = 1

toShell(plug)
Returns:a plugshell as suitable to for this class
toShells(plugs)
Returns:list of shells made from plugs and our node
workflow()
Returns:the workflow instance we are connected with. Its used to query global data

Table Of Contents

Previous topic

mrv.maya.nt.geometry

Next topic

mrv.automation.base

This Page