Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration #8

Merged
merged 54 commits into from
Mar 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9780d96
Explicitly excluded tests dir and fixed MANIFEST
AndresMWeber Feb 2, 2018
7f0490e
Started to rework Hand and inherited methods to be less restrictive.
AndresMWeber Feb 2, 2018
ab6b6f0
More work on hand and all over.
AndresMWeber Feb 3, 2018
f9414de
More work on hands.
AndresMWeber Feb 6, 2018
c3e4def
Reworked the build_ik and build_fk methods and moved them all to SubR…
AndresMWeber Feb 7, 2018
d649229
Added a new .ma file for the skeleton hand.
AndresMWeber Feb 7, 2018
c208ec3
Added a new .ma file for the skeleton hand.
AndresMWeber Feb 7, 2018
aa1e556
Fixed parenting in AbstractGrouping to work with the built in parent …
AndresMWeber Feb 8, 2018
f01b131
Forgot to add the parent constraint to the FK chain joints.
AndresMWeber Feb 8, 2018
48f238a
Removed the is_built check until we need that functionality. For now…
AndresMWeber Feb 8, 2018
49c9278
Removed setattr override for MetaData as I can't work out a good way …
AndresMWeber Feb 8, 2018
942c976
Added Transform.duplicate so I don't have to access the DCC all the t…
AndresMWeber Feb 8, 2018
0c96a14
Forgot duplicate returns a list.
AndresMWeber Feb 8, 2018
9751758
Fixed build_ik...the start joint was actually never being respected f…
AndresMWeber Feb 8, 2018
c7d77e8
Still can't figure out why leg_ik isn't setting.
AndresMWeber Feb 9, 2018
ddbae84
Reworked HierarchyChain.insert_buffer quite a bit as it was not funct…
AndresMWeber Feb 9, 2018
d09198b
Fixed node registration a bit more so it properly cast the dag_node t…
AndresMWeber Feb 10, 2018
2b65295
Changed insert_buffer's kwarg from collocate to beneath for easier un…
AndresMWeber Feb 16, 2018
33fc7fc
Refactored insert_buffer to insert_and_build_buffer to be more specific.
AndresMWeber Feb 16, 2018
3081fac
Accidentally removed finding the actual target index from HierarchyCh…
AndresMWeber Feb 16, 2018
3617f0c
Fixing the tests
AndresMWeber Feb 16, 2018
c692c84
Removed the new inserted node from the get_children call since we can…
AndresMWeber Feb 17, 2018
1ff7014
Added .landscape.yml
AndresMWeber Feb 17, 2018
86a9e66
Fixed a ton of code smell from landscape.io check:
AndresMWeber Feb 17, 2018
9f15bce
Removed error checking in register from sub rig on Rig as we should e…
AndresMWeber Feb 17, 2018
ca2597e
removed mistaken print.
AndresMWeber Feb 17, 2018
71ae3e1
Fixed for base case of no sub rig dict input.
AndresMWeber Feb 17, 2018
e197551
Added linter ignore lines for common PEP8 argument about unused imports.
AndresMWeber Feb 17, 2018
86dc287
Merge pull request #6 from AndresMWeber/foot
AndresMWeber Feb 18, 2018
5446978
Refactored traversal to relationships as it has more to do with node …
AndresMWeber Feb 19, 2018
1d8e150
Refactored traversal to relationships as it has more to do with node …
AndresMWeber Feb 21, 2018
14533ee
Started reworking the HierarchyChain and relationships.py classes in …
AndresMWeber Feb 21, 2018
d480e45
All tests are passing, continuing with registration logic.
AndresMWeber Feb 21, 2018
4b6c4e4
Added insert and add_buffer from the foot branch.
AndresMWeber Feb 21, 2018
def4e0e
Removed Bunch implementation as it was failing due to displaying data…
AndresMWeber Feb 21, 2018
10b4be5
Merge remote-tracking branch 'origin/dev-biped' into fix-registration
AndresMWeber Feb 21, 2018
d8ef4ee
Added Control._fix_child_name_tokens until I get the build/__init__ c…
AndresMWeber Feb 22, 2018
6394143
Slowly converting to the new hierarchy dot notation.
AndresMWeber Feb 23, 2018
52142ac
Just trying to conform to the new hierarchy setup still.
AndresMWeber Feb 23, 2018
286fb3a
Added anvil.utils.generic.gen_flatten_dict_depth_two for quickly flat…
AndresMWeber Feb 23, 2018
361664e
More fitting into new registration methodology.
AndresMWeber Feb 23, 2018
1befe4f
Fixing errors based on CircleCI build 224
AndresMWeber Feb 23, 2018
75c449c
Fixing the build calls so that the created objects get parented in Hand.
AndresMWeber Feb 24, 2018
5d88c1f
Modified the _cascading_function to permit for the new hierarchy arra…
AndresMWeber Feb 25, 2018
3c01e4b
Added skip_register flag to skip registration if we are doing a chain…
AndresMWeber Feb 25, 2018
2974d26
Removed skip_register from signature as that was causing mistakes in …
AndresMWeber Feb 25, 2018
8abec3c
Added #noqa to the __init__ of objects/groupings to ignore custom __a…
AndresMWeber Feb 25, 2018
0c3b964
Realized I needed to intercept skip_register from the kwargs and pop …
AndresMWeber Feb 25, 2018
2cd3b8e
Added skip_report as well and ironinig out the implementation to figu…
AndresMWeber Feb 26, 2018
9b3dfe3
Moved registration to registration.py at the top level.
AndresMWeber Mar 5, 2018
191184a
Fixed manual_id kwarg to be recognized by generate_report in register…
AndresMWeber Mar 5, 2018
43a30ed
Added __repr__ for relationships classes.
AndresMWeber Mar 9, 2018
bc0650c
Added auto_save_result wrapper to save results from test cases to che…
AndresMWeber Mar 9, 2018
62c1a09
Fixed parenting for controls and added an override_root kwarg so we c…
AndresMWeber Mar 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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