# Path: pdil/tool/fossil/_core/find.py
# def rootBone(nodes=None):
# def controllers(main=None):
# def mainGroup(nodePool=None, fromControl=None):
# def mainGroups():
# def rootMotion(main=None):
# def blueprintCards(skeletonBlueprint=None):
#     def order(obj):
# def cardJointBuildOrder():
# def cardHierarchy():
#     def gatherChildren(cards):
# 
# Path: pdil/tool/fossil/_core/ids.py
# def getIdSpec(obj):
# def readIdSpec(spec):
#     def __init__(cls, name, bases, clsdict):
#     def getSpec(cls, obj):
#     def readSpec(cls, data):
#     def baseSpec(cls, obj):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
# class RegisterSpec(type):
# class IdSpec(six.with_metaclass(RegisterSpec)):
# class SubControllerSpec(IdSpec):
# class RigControllerSpec(IdSpec):
# class CardSpec(IdSpec):
# class BPJointSpec(IdSpec):
# class JointSpec(IdSpec):
# class UnknownSpec(IdSpec):
# 
# Path: pdil/tool/fossil/_lib/tpose/tpcore.py
# def getRCard(card, validCards=None):
#     ''' Given a regular bp card, returns the reposeCard from the list of `validCards`
#     Use `getValidReposeCards()` for `validCards` (this is performance optimization).
#     '''
#     validCards = validCards if validCards else getValidReposeCards()
#     
#     for plug in card.message.listConnections(s=False, d=True, p=True):
#         if plug.attrName() == 'bpCard':
#             if plug.node() in validCards:
#                 return plug.node()
# 
# def getRJoint(bpj):
#     ''' Get repositioned joint from blueprint joint
#     '''
#     for plug in bpj.message.listConnections(s=False, d=True, p=True):
#         if plug.attrName() == 'bpj':
#             return plug.node()


from collections import OrderedDict
from copy import deepcopy
from pymel.core import dt, move, PyNode, rotate, xform
from ..._core import find
from ..._core import ids
from .tpcore import getRCard, getRJoint
import inspect
import math
import operator
import re
import pdil
        'call': <the function to apply, must be a registered `adjustCommands`>,
        'args': <list of strings, each will be parsed an converted to nodes>
    }
    
    An arg can be:
        'self': A reference to itself.
        'self.joint[#]': A reference to a specific joint.
        '<other>': A reference to another card by id.
        '<other>.joint[#]': A reference to another card's joint.
    
    '''
    cmd = adjustCommands[ adjust['call'] ]
    
    card = adjust['card']
    
    converted = []
    for arg in adjust['args']:
        if isinstance(arg, basestring):
            result = adjusterInputRE.match(arg).groupdict()
            
            #targetCard = card if result['self'] else util.FIND(None, cardId=result['id'])
            targetCard = card # if result['self'] else ids.readIdSpec( arg )
            jointIndex = int(result['joint']) if result['joint'] else None
            
            if jointIndex is None:
                converted.append( targetCard )
            else:
                converted.append( targetCard.joints[ jointIndex ] )

        elif isinstance(arg, dict):

# Path: pdil/tool/fossil/_core/find.py
# def rootBone(nodes=None):
# def controllers(main=None):
# def mainGroup(nodePool=None, fromControl=None):
# def mainGroups():
# def rootMotion(main=None):
# def blueprintCards(skeletonBlueprint=None):
#     def order(obj):
# def cardJointBuildOrder():
# def cardHierarchy():
#     def gatherChildren(cards):
# 
# Path: pdil/tool/fossil/_core/ids.py
# def getIdSpec(obj):
# def readIdSpec(spec):
#     def __init__(cls, name, bases, clsdict):
#     def getSpec(cls, obj):
#     def readSpec(cls, data):
#     def baseSpec(cls, obj):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
#     def getSpec(self, obj):
#     def readSpec(self, spec):
# class RegisterSpec(type):
# class IdSpec(six.with_metaclass(RegisterSpec)):
# class SubControllerSpec(IdSpec):
# class RigControllerSpec(IdSpec):
# class CardSpec(IdSpec):
# class BPJointSpec(IdSpec):
# class JointSpec(IdSpec):
# class UnknownSpec(IdSpec):
# 
# Path: pdil/tool/fossil/_lib/tpose/tpcore.py
# def getRCard(card, validCards=None):
#     ''' Given a regular bp card, returns the reposeCard from the list of `validCards`
#     Use `getValidReposeCards()` for `validCards` (this is performance optimization).
#     '''
#     validCards = validCards if validCards else getValidReposeCards()
#     
#     for plug in card.message.listConnections(s=False, d=True, p=True):
#         if plug.attrName() == 'bpCard':
#             if plug.node() in validCards:
#                 return plug.node()
# 
# def getRJoint(bpj):
#     ''' Get repositioned joint from blueprint joint
#     '''
#     for plug in bpj.message.listConnections(s=False, d=True, p=True):
#         if plug.attrName() == 'bpj':
#             return plug.node()


# Path: pdil/tool/fossil/_lib/tpose/adjusters.py
from collections import OrderedDict
from copy import deepcopy
from pymel.core import dt, move, PyNode, rotate, xform
from ..._core import find
from ..._core import ids
from .tpcore import getRCard, getRJoint
import inspect
import math
import operator
import re
import pdil

        'call': <the function to apply, must be a registered `adjustCommands`>,
        'args': <list of strings, each will be parsed an converted to nodes>
    }
    
    An arg can be:
        'self': A reference to itself.
        'self.joint[#]': A reference to a specific joint.
        '<other>': A reference to another card by id.
        '<other>.joint[#]': A reference to another card's joint.
    
    '''
    cmd = adjustCommands[ adjust['call'] ]
    
    card = adjust['card']
    
    converted = []
    for arg in adjust['args']:
        if isinstance(arg, basestring):
            result = adjusterInputRE.match(arg).groupdict()
            
            #targetCard = card if result['self'] else util.FIND(None, cardId=result['id'])
            targetCard = card # if result['self'] else ids.readIdSpec( arg )
            jointIndex = int(result['joint']) if result['joint'] else None
            
            if jointIndex is None:
                converted.append( targetCard )
            else:
                converted.append( targetCard.joints[ jointIndex ] )

        elif isinstance(arg, dict):

            converted.append( ids.readIdSpec( arg ) )