Package mrv :: Package automation :: Module process :: Class ProcessBase
[hide private]
[frames] | no frames]

Class ProcessBase

source code

         object --+            
                  |            
interface.Interface --+        
                      |        
interface.iDuplicatable --+    
                          |    
               dge.NodeBase --+
                              |
                             ProcessBase
Known Subclasses:

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

Nested Classes [hide private]

Inherited from dge.NodeBase: __metaclass__, shellcls

Instance Methods [hide private]

Inherited from interface.iDuplicatable: copyTo, copyToOther, duplicate

Inherited from interface.Interface: supports

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

    iDuplicatable Interface
 
createInstance(self, *args, **kwargs)
Create a copy of self and return it
source code
 
copyFrom(self, other, *args, **kwargs)
thus we do not copy args again
source code
    Query
 
targetRating(self, target, check_input_plugs=True, **kwargs)
Returns: tuple( int, PlugShell ) int between 0 and 255 - 255 means target matches perfectly, 0 means complete incompatability.
source code
 
supportedTargetTypes(self)
Returns: list target types that can be output
source code
    Interface
 
evaluateState(self, plug, mode)
Returns: an instance suitable to be stored in the given plug
source code
 
compute(self, plug, mode)
Base implementation of the output, called by input Method.
source code
    Base
 
prepareProcess(self)
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.
source code
 
workflow(self)
Returns: the workflow instance we are connected with.
source code

Inherited from dge.NodeBase: clearCache, connections, inputPlugs, outputPlugs, plugs, toShell, toShells

    Overridden from Object
 
__init__(self, id, *args, **kwargs)
Initialize process with most common information
source code

Inherited from dge.NodeBase: __del__, __str__

    ID Handling

Inherited from dge.NodeBase: id, setID

Class Methods [hide private]
    Base

Inherited from dge.NodeBase: filterCompatiblePlugs, inputPlugsStatic, outputPlugsStatic, plugsStatic

Class Variables [hide private]
  noun = 'Noun ProcessBase,redefine in subclass'
  verb = 'Verb ProcessBase,redefine in subclass'
  dirty_check = 4
  is_state = 1
  kGood = 127
  kNo = 0
  kPerfect = 255
  target_state = 2
    Configuration
  track_compute_calls = True
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, *args, **kwargs)
(Constructor)

source code 
Initialize process with most common information
Parameters:
  • kwargs -
    • noun: noun describing the process, ( i.e. "Process" )
    • verb: verb describing the process, ( i.e. "processing" )
    • workflow: the workflow this instance is part of
Overrides: object.__init__

createInstance(self, *args, **kwargs)

source code 
Create a copy of self and return it
Returns:
new instance of self
Overrides: interface.iDuplicatable.createInstance

copyFrom(self, other, *args, **kwargs)

source code 
Note: we have already given our args to the class during instance creation,
thus we do not copy args again
Parameters:
  • add_to_graph - if true, the new node instance will be added to the graph of
Overrides: interface.iDuplicatable.copyFrom

targetRating(self, target, check_input_plugs=True, **kwargs)

source code 
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
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.

Raises:
  • TypeError - if the result is ambiguous and raise_on_ambiguity = 1

supportedTargetTypes(self)

source code 
Returns:
list target types that can be output

Note: targetTypes are classes, not instances

evaluateState(self, plug, mode)

source code 
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.

Returns:
an instance suitable to be stored in the given plug

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

compute(self, plug, mode)

source code 
Base implementation of the output, called by input Method. Its used to have a general hook for the flow tracing
Parameters:
  • plug - plug to evaluate
  • mode - the mode of the valuation
Returns:
result of the computation
Decorators:
  • @track_output_call
Overrides: dge.NodeBase.compute

prepareProcess(self)

source code 
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

workflow(self)

source code 
Returns:
the workflow instance we are connected with. Its used to query global data