<s> from nodefactory_final import OpenMaya , OpenMayaMPx <EOL> import sys <EOL> sys . COMPUTES = [ ] <EOL> def create_attrmaker ( <EOL> attrspec , ln , sn , <EOL> affectors = ( ) , default = None ) : <EOL> def createattr ( nodeclass ) : <EOL> fnattr = attrspec . createfnattr ( ) <EOL> attrobj = attrspec . create ( fnattr , ln , sn ) <EOL> if default is not None : <EOL> attrspec . setdefault ( fnattr , default ) <EOL> isinput = not bool ( affectors ) <EOL> fnattr . setWritable ( isinput ) <EOL> fnattr . setStorable ( isinput ) <EOL> nodeclass . addAttribute ( attrobj ) <EOL> setattr ( nodeclass , ln , attrobj ) <EOL> for affectedby in affectors : <EOL> inattrobj = getattr ( nodeclass , affectedby ) <EOL> nodeclass . attributeAffects ( inattrobj , attrobj ) <EOL> return createattr <EOL> def create_node ( nodespec , nodename , typeid , attrmakers ) : <EOL> def compute ( * _ ) : <EOL> sys . COMPUTES . append ( '<STR_LIT>' ) <EOL> print '<STR_LIT>' <EOL> methods = { '<STR_LIT>' : compute } <EOL> nodetype = type ( nodename , nodespec . nodebase ( ) , methods ) <EOL> tid = OpenMaya . MTypeId ( typeid ) <EOL> def creator ( ) : <EOL> return OpenMayaMPx . asMPxPtr ( nodetype ( ) ) <EOL> def init ( ) : <EOL> for makeattr in attrmakers : <EOL> makeattr ( nodetype ) <EOL> def register ( plugin ) : <EOL> nodespec . register ( plugin , nodename , tid , creator , init ) <EOL> def deregister ( plugin ) : <EOL> nodespec . deregister ( plugin , tid ) <EOL> return register , deregister <EOL> from nodefactory_final import ( <EOL> NT_DEPENDSNODE , A_FLOAT , <EOL> ) <EOL> _deregister_funcs = [ ] <EOL> def floatattr ( * args , ** kwargs ) : <EOL> return create_attrmaker ( A_FLOAT , * args , ** kwargs ) <EOL> def register_circler ( fnplugin ) : <EOL> inputnames = [ '<STR_LIT:input>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> reg , dereg = create_node ( <EOL> NT_DEPENDSNODE , '<STR_LIT>' , <NUM_LIT> , [ <EOL> floatattr ( '<STR_LIT:input>' , '<STR_LIT>' ) , <EOL> floatattr ( '<STR_LIT>' , '<STR_LIT>' , default = <NUM_LIT> ) , <EOL> floatattr ( '<STR_LIT>' , '<STR_LIT>' , default = <NUM_LIT> ) , <EOL> floatattr ( '<STR_LIT>' , '<STR_LIT>' , inputnames ) , <EOL> floatattr ( '<STR_LIT>' , '<STR_LIT>' , inputnames ) , <EOL> ] ) <EOL> reg ( fnplugin ) <EOL> _deregister_funcs . append ( dereg ) <EOL> def _toplugin ( mobject ) : <EOL> return OpenMayaMPx . MFnPlugin ( mobject , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def initializePlugin ( mobject ) : <EOL> register_circler ( _toplugin ( mobject ) ) <EOL> def uninitializePlugin ( mobject ) : <EOL> plugin = _toplugin ( mobject ) <EOL> for func in _deregister_funcs : <EOL> func ( plugin ) </s>
