ECToo / pymel

Automatically exported from code.google.com/p/pymel
0 stars 0 forks source link

internal.factories.registerVirtualClass #260

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the problem.
Just updated our internal pymel to git trunk as 2012 and 2013 cmds have been 
updated, plus some fixes.  2011 will boot fine with this version but we get the 
following errors with newer versions.  We use these 2 methods to register 
virtual class's.  For some reason this has produced this error.  Rolling back 
the pymel version fixes this.

What Version of Maya are you using?
2012 SAP + 2013

On what operating system? (be as specific as possible and include service
packs, 64bit vs 32bit, etc)
Windows 7 x64

What Version of PyMEL are you using?
Git Trunk

What is the expected output? What do you see instead?
NA

If possible, provide a few lines of code to reproduce the problem. It helps
us if your code will reproduce the problem from a new scene.

Methods used to register our own pynodes

global dynamicKlassList
dynamicKlassList = [("euroHwShader", "EuroHwShader", "dependNode"),
                    ("cgfxShader", "CgfxShader", "dependNode"),
                    ("cgfxVector", "CgfxVector", "dependNode")]

def RegisterDynamicKlassList(KlassList):
    '''
    Patch the Module with the class definitions for the plug-ins that may or
    mat not be loaded into Maya yet that register Maya Nodes
    '''
    for mayaNodeName, pyNodeName, parentType in KlassList:
        if not getattr(pCore.nt, pyNodeName, False):
            log.info("RegisterDynamicKlass : %s" % pyNodeName)
            internal.factories.addPyNode(pCore.nt, mayaNodeName, parentType)

def RegeristerVirtualClasses(classRegister):
    '''
    Called on import of ePymel.  Looks at the module property `classRegister` that contains
    all the class's that we'd like to register within the pymel environment.

    '''
    # We have to make sure any unloaded plug-ins are loaded!
    for cls in classRegister:
        try:
            internal.factories.registerVirtualClass(cls, nameRequired=False)
            log.info("Registering Custom PyNode %r" % cls)
        except StandardError, Err:
            log.warning("Failed to register Custom PyNode :: %s\n%s" % (cls, Err))

def PatchPymel():
    '''
    This function applies Eurocom's extended leaf node patches
    '''
    try:
        global dynamicKlassList
        RegisterDynamicKlassList(dynamicKlassList)

    except StandardError, Err:
        log.exception(Err)

    try:
        import eNodeTypes
        reload(eNodeTypes)
        RegeristerVirtualClasses(eNodeTypes.classRegister)
    except StandardError, Err:
        log.exception(Err)

Does maya.cmds exhibit the same problem?
NA

Please provide any additional information below.

Failed to execute userSetup.py
Traceback (most recent call last):
  File "C:/Users/davidm/Documents/maya/2013-x64/scripts\userSetup.py", line 1, in <module>
    import ePy
  File "G:\Maya\Maya_Modules\Achi\ePy\__init__.py", line 9, in <module>
    import ePy.eInternal as eInternal
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\__init__.py", line 12, in <module>
    import PythonModuleInstaller
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\PythonModuleInstaller.py", line 11, in <module>
    import eLogging as _eLogging
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\eLogging.py", line 7, in <module>
    import pymel.tools.loggingControl as loggingControl
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\tools\loggingControl.py", line 1, in <module>
    import pymel.all as pymel
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\all.py", line 30, in <module>
    from core.nodetypes import *
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\util\utilitytypes.py", line 623, in __get__
    self.newobj = self.creator(*self.args, **self.kwargs)
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\internal\factories.py", line 2723, in addPyNodeCallback
    PyNodeType = MetaMayaNodeWrapper(pyNodeTypeName, (ParentPyNode,), {'__melnode__':mayaType})
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\internal\factories.py", line 2637, in __new__
    PyNodeType = super(MetaMayaNodeWrapper, cls).__new__(cls, classname, bases, classdict)
  File "G:\Maya\Maya_Modules\Achi\ePy\eInternal\pymel\pymel\internal\factories.py", line 2500, in __new__
    func = getattr(pmcmds,melCmdName)
AttributeError: 'module' object has no attribute 'cgfxShader'

Original issue reported on code.google.com by squis...@gmail.com on 30 Sep 2011 at 3:57

GoogleCodeExporter commented 9 years ago
should be resolved by newest caches - update out to 
cf27bdcaf809a84ff5b9298b7141e6f8bd27ad0a or later

(the 2012 + 2013 caches were fixed in 0048666b4d85f64b52d99510029e294680acbfb0)

Original comment by elron...@gmail.com on 12 Oct 2011 at 8:13