Package mrv :: Module dgfe :: Class FacadeNodeBase
[hide private]
[frames] | no frames]

Class FacadeNodeBase

source code

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

Node having no own plugs, but retrieves them by querying other other nodes and claiming its his own ones.

Using a non-default shell it is possibly to guide all calls through to the virtual PlugShell.

Derived classes must override _plugshells which will be queried when plugs or plugshells are requested. This node will cache the result and do everything required to integrate itself.

It lies in the nature of this class that the plugs are dependent on a specific instance of this node, thus classmethods of NodeBase have been overridden with instance versions of it.

The facade node keeps a plug map allowing it to map plug-shells it got from you back to the original shell respectively. If the map has been missed, your node will be asked for information.


Notes:
Nested Classes [hide private]
  shellcls
All connections from and to the FacadeNode must actually start and end there.

Inherited from dge.NodeBase: __metaclass__

Instance Methods [hide private]
 
__getattr__(self, attr)
Returns: shell on attr made from our plugs - we do not have real ones, so we need to call plugs and find it by name
source code
 
clearPlugCache(self)
if a cache has been build as caching is enabled, this method clears the cache forcing it to be updated on the next demand
source code

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__

    To be Subclass-Implemented
 
_getNodePlugs(self)
Implement this as if it was your plugs method - it will be called by the base - your result needs processing before it can be returned
source code
    Overridden from Object
 
__init__(self, *args, **kwargs)
Initialize the instance
source code

Inherited from dge.NodeBase: __del__, __str__

    iDuplicatable Interface
 
copyFrom(self, other, **kwargs)
Actually, it does nothing because our plugs are linked to the internal nodes in a quite complex way.
source code

Inherited from dge.NodeBase: createInstance

    Base Interface

Inherited from dge.NodeBase: compute

    ID Handling

Inherited from dge.NodeBase: id, setID

    Base
 
plugs(self, **kwargs)
Calls _getNodePlugs method to ask you to actuallly return your actual nodes and plugs or shells.
source code

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

Class Methods [hide private]
    Base

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

Class Variables [hide private]
    Configuration
  caching_enabled = True
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 
Initialize the instance
Parameters:
  • kwargs - 'id' = id of the instance, defaults to None if it is not required
Overrides: object.__init__

__getattr__(self, attr)
(Qualification operator)

source code 
Returns:
shell on attr made from our plugs - we do not have real ones, so we need to call plugs and find it by name

Note: to make this work, you should always name the plug names equal to their class attribute

copyFrom(self, other, **kwargs)

source code 
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
Parameters:
  • add_to_graph - if true, the new node instance will be added to the graph of
Overrides: interface.iDuplicatable.copyFrom

_getNodePlugs(self)

source code 
Implement this as if it was your plugs method - it will be called by the base - your result needs processing before it can be returned
Returns:

list( tuple( node, plug ) ) if you have an existing node that the plug or shell you gave is from, return it in the tuple, otherwise set it to a node with a shell that allows you to handle it - the only time the node is required is when it is used in and with the shells of the node's own shell class.

The node will be altered slightly to allow input of your facade to be reached from the inside

Note: a predicate is not supported as it must be applied on the converted plugs, not on the ones you hand out

plugs(self, **kwargs)

source code 
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
Parameters:
  • predicate - return static plug only if predicate is true
Returns:
list of dynamic plugs as defined on this node - they are usually retrieved on class level, but may be overridden on instance level
Overrides: dge.NodeBase.plugs

clearPlugCache(self)

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