hi,
i have a problem in pymel 0.9.

i try to create a class who inherits of the pm.nodetypes.Transform
class.

in pymel 0.7 i do :
class CharacterNode (pm.nodetypes.Transform):
    '''
    Character node class.

    Character is a special node because it don't use unknown node but
a transform node.
    it is the root of the hierarchy and don't have proxy node

    Attribute :
    _pantin
    _nodeType = type of the node
    proxy_grp = link to the proxy_grp transform node.
    character_name = name of the caracter
    master_input

    param :
    characterName = name of the caracter
    '''

    def __new__ (cls,nodeName,create=False,*args,**kwargs):
        """
        Provides the ability to create the node when creating a class.

            >>> n = PantinNode("arm",create=True)
            >>> n.__repr__()
            # Result: PantinNode('arm')
        """
        if create:
            nodeName = pm.createNode
('transform',n=nodeName,skipSelect=1)
            nodeName.addAttr('_pantin',at='message')
        return pm.nodetypes.Transform.__new__(cls,nodeName)

    def __init__ (self,*args,**kwargs):
        if kwargs['create'] :

            self.addNodeType('Character')

            self.addAttr ('characterName',dataType="string")
            self.characterName.set(kwargs['characterName'])

            self.addAttr
('master_input',at='message',multi=True,indexMatters=False)
            self.addAttr ('proxy_grp',at='message')
            self.addAttr ('ctrl_grp',at='message')
            self.addAttr ('skeleton_grp',at='message')

            utils.lockAndHideAttr(self, all=True)

but it pymel 0.9 that rise a error :
TypeError: Determined type is Transform, which is not a subclass of
desired type CharacterNode

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to