Skip to content

Commit

Permalink
Merge pull request #8 from AndresMWeber/registration
Browse files Browse the repository at this point in the history
Registration
  • Loading branch information
AndresMWeber committed Mar 10, 2018
2 parents ab5c88f + 62c1a09 commit 4900320
Show file tree
Hide file tree
Showing 94 changed files with 3,489 additions and 1,927 deletions.
11 changes: 11 additions & 0 deletions .landscape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
doc-warnings: true
test-warnings: false
ignore-paths:
- docs
- tests
- anvil/plugins/maya
- anvil/plugins/standalone
python-targets:
- 2
pep8:
full: true
5 changes: 2 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
exclude .gitignore
exclude .coverage
exclude .circleci/config.yml
include README.rst
include setup.cfg
prune .cache
prune .circleci
prune .git
prune build
prune dist
recursive-exclude *.egg-info *
recursive-exclude tests
recursive-exclude tests *
39 changes: 21 additions & 18 deletions anvil/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
from six import iteritems
from six import itervalues
import config
import registration
import colors
import meta_data
import log
import version


class AnvilLog(log.LogMixin):
LOG = log.obtainLogger(__name__)


LOG = AnvilLog

import runtime
import plugins
import runtime
import utils
import objects
import grouping
import node_types
import sub_rig_templates
import rig_templates


class AnvilLog(log.LogMixin):
LOG = log.obtain_logger(__name__)


LOG = AnvilLog
LOG.info('Auto-Loaded DCC %s', runtime.dcc)
LOG.info('Loaded logger config file %s successfully, writing to: %s',
log.LogInitializer.CFG_FILE, log.LogInitializer.LOG_DIR)
LOG.info('Anvil environment has been set to %s', config.ENV)
Expand All @@ -30,15 +30,14 @@ class AnvilLog(log.LogMixin):


def check_for_encapsulation(dag_path):
for node_index, node_encapsulation in iteritems(EXISTING_ENCAPSULATIONS):
for node_encapsulation in itervalues(EXISTING_ENCAPSULATIONS):
if dag_path == node_encapsulation._dcc_id:
LOG.debug('Found previous encapsulation for %s: %r. Using instead.', dag_path, node_encapsulation)
return node_encapsulation
else:
return None
return None


def factory(dag_path):
def factory(dag_path, **kwargs):
if dag_path is None:
raise IOError('Tried to factory encapsulate None.')
if is_anvil(dag_path):
Expand All @@ -62,7 +61,7 @@ def factory(dag_path):
else:
encapsulation_class = objects.Transform

encapsulation = encapsulation_class(dag_path)
encapsulation = encapsulation_class(dag_path, **kwargs)
LOG.debug('Encapsulating %s with node type %s as %s', dag_path, encapsulation_class, encapsulation)
register_encapsulation(encapsulation)
return encapsulation
Expand All @@ -80,11 +79,15 @@ def is_anvil(node):
try:
if isinstance(node, node_types.REGISTERED_NODES.get(type(node).__name__)):
return True
except:
except TypeError:
pass
return False


def is_aset(node):
issubclass(type(node), node_types.NodeRelationshipSet)


def is_agrouping(node):
return issubclass(type(node), node_types.AbstractGrouping)

Expand All @@ -100,10 +103,10 @@ def is_aobject(node):
'version',
'node_types',
'runtime',
'node_types',
'objects',
'grouping',
'sub_rig_templates',
'rig_templates',
'utils',
'colors']
'colors',
'registration']
14 changes: 5 additions & 9 deletions anvil/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def as_rgb(self):
return tuple(self.as_list())

def as_rgb_normalized(self):
return tuple(component/255.0 for component in self.as_list())
return tuple(component / 255.0 for component in self.as_list())

def as_hsv(self):
return colorsys.rgb_to_hsv(*self.as_rgb_normalized())
Expand All @@ -46,9 +46,9 @@ def as_hex(self):
return '#{:02X}{:02X}{:02X}'.format(int(self.red), int(self.green), int(self.blue))

@classmethod
def from_hex(cls, hex):
hex = hex.lstrip('#')
return cls(*tuple(int(hex[i:i + 2], 16) for i in (0, 2, 4)))
def from_hex(cls, hexadecimal):
hexadecimal = hexadecimal.lstrip('#')
return cls(*tuple(int(hexadecimal[i:i + 2], 16) for i in (0, 2, 4)))

@classmethod
def from_hsv(cls, hsv):
Expand Down Expand Up @@ -78,11 +78,7 @@ def __add__(self, other):
return self


def get_closest_color(r, g, b):
pass


# Color Contants
# Color Constants
ALICEBLUE = RGB(240, 248, 255)
ANTIQUEWHITE = RGB(250, 235, 215)
ANTIQUEWHITE1 = RGB(255, 239, 219)
Expand Down
13 changes: 10 additions & 3 deletions anvil/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
GROUP_TYPE = 'group'
TRANSFORM_TYPE = 'transform'
ADD_SUB_TYPE = 'plusMinusAverage'
MULT_DIV_TYPE = 'multiplyDivide'
SET_TYPE = 'set'
ANVIL_TYPE = 'ANVIL_TYPE'
ID_TYPE = 'hierarchy_id'

# NAME METADATA
LEFT = 'left'
Expand All @@ -39,7 +43,7 @@
# RIG CONCEPTS
SUB_RIG_TOKEN = 'sub'
NAME_TOKENS = 'name_tokens'
META_DATA= 'meta_data'
META_DATA = 'meta_data'
UNIVERSAL = 'universal'
TOP_GROUP = 'group_top'
UNIVERSAL_CONTROL = '%s_%s' % (CONTROL_TYPE, UNIVERSAL)
Expand All @@ -59,7 +63,7 @@
OFFSET_GROUP = 'offset_group'
CONNECTION_GROUP = 'connection_group'
QUERY = 'query'

BUFFER = 'buffer'

# DATA TYPES
ATTRIBUTE_TYPE = 'attributeType'
Expand Down Expand Up @@ -100,7 +104,8 @@
IK_EFFECTOR = 'ik_effector'
FK = 'fk'
IKFK_BLEND = 'ikfk_blend'
BLENDER = 'blendColors'
BLEND_NODE = 'blendColors'
CHOICE_NODE = 'choice'
POLE_VECTOR = 'pole_vector'
BLEND = 'blend'
WORLD_SPACE = 'worldSpace'
Expand Down Expand Up @@ -158,6 +163,8 @@
DEFAULT_FK_SHAPE = CUBE
DEFAULT_DIGIT_FK_SHAPE = PYRAMID_PIN
DEFAULT_PV_SHAPE = TRIANGLE
SKIP_REGISTER = 'skip_register'
SKIP_REPORT = 'skip_report'

# PATHS
BASE_DIR = os.path.dirname(os.path.abspath(anvil.__file__))
Expand Down
8 changes: 8 additions & 0 deletions anvil/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AnvilError(Exception):
"""Base class for exceptions in this module."""
pass


class APIError(AnvilError):
pass

22 changes: 15 additions & 7 deletions anvil/grouping/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import base
import control
import sub_rig
import rig
import traversal
import base # noqa
import control # noqa
import sub_rig # noqa
import rig # noqa
import relationships # noqa

from base import AbstractGrouping
from control import Control
from sub_rig import SubRig
from rig import Rig
from traversal import HierarchyChain
from relationships import NodeRelationshipSet
from relationships import LinearHierarchyNodeSet
from relationships import NonLinearHierarchyNodeSet

__all__ = ['Control', 'SubRig', 'Rig', 'AbstractGrouping', 'HierarchyChain']
__all__ = ['Control',
'SubRig',
'Rig',
'AbstractGrouping',
'NodeRelationshipSet',
'LinearHierarchyNodeSet',
'NonLinearHierarchyNodeSet']
Loading

0 comments on commit 4900320

Please sign in to comment.