# 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
    adjustCommands[name] = func
    return func


def getCardParent(rJoint):
    ''' Returns the parent reposeCard, skipping the auto-created 'transform#' that Maya adds.
    
    When ancestors are scaled, they can create intermediate transforms that need
    to be ignored.
    '''
    p = rJoint.getParent()
    if p.hasAttr('bpCard'):
        return p
    else:
        return p.getParent()


@registerAdjuster
def armAlign(shoulderCard, angle=2.0):
    ''' Rotates the lead joint to point down the +X axis, and the other joints
    to be almost straight, with a slight bend pointing behind, -Z.

    angle: In degrees, how much it is bent from +X axis

    MUST have a parent joint to rotate properly
    ASSUMES elbow already points backwards
    ASSUMES 3 joint humaniod arm
    '''
    shoulderJoint = shoulderCard.joints[0]
    

# 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

    adjustCommands[name] = func
    return func


def getCardParent(rJoint):
    ''' Returns the parent reposeCard, skipping the auto-created 'transform#' that Maya adds.
    
    When ancestors are scaled, they can create intermediate transforms that need
    to be ignored.
    '''
    p = rJoint.getParent()
    if p.hasAttr('bpCard'):
        return p
    else:
        return p.getParent()


@registerAdjuster
def armAlign(shoulderCard, angle=2.0):
    ''' Rotates the lead joint to point down the +X axis, and the other joints
    to be almost straight, with a slight bend pointing behind, -Z.

    angle: In degrees, how much it is bent from +X axis

    MUST have a parent joint to rotate properly
    ASSUMES elbow already points backwards
    ASSUMES 3 joint humaniod arm
    '''
    shoulderJoint = shoulderCard.joints[0]
    

    shoulderRepose = getRJoint(shoulderJoint)