Skip to content

Commit

Permalink
Fixed default root hierarchy id being incorrect.
Browse files Browse the repository at this point in the history
Fixed blend attrs...had overridden default attributes by accident instead of merging with hand.
Also had referred to blend attr as blend instead of the correct ikfk_blend

Added proper traceback to file save wrapper and also added proper saving as finally instead of in two places.

Fixed positioning of waffle.io badge.
  • Loading branch information
AndresMWeber committed Mar 17, 2018
1 parent ca58a04 commit 96ee3dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@
<img src="https://api.codacy.com/project/badge/Grade/ef864a0c79984322b7809d64e3f036c8"
alt="Codacy Rating" />
</a>
<!-- Waffle.io -->
<a href="https://waffle.io/AndresMWeber/Anvil">
<img src="https://badge.waffle.io/AndresMWeber/Anvil.svg?columns=all"
alt="Waffle.io - Columns and their card count" />
</a>
</div>

[![Waffle.io - Columns and their card count](https://badge.waffle.io/AndresMWeber/Anvil.svg?columns=all)](https://waffle.io/AndresMWeber/Anvil)


Introduction
=============
Expand Down
5 changes: 3 additions & 2 deletions anvil/grouping/sub_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ class SubRig(base.AbstractGrouping):
def build(self, parent=None, **kwargs):
super(SubRig, self).build(**kwargs)
if self.root is None:
root_id = '%s_%s' % (cfg.GROUP_TYPE, 'top')
self.build_node(Transform,
hierarchy_id='%s_%s' % (cfg.GROUP_TYPE, 'top'),
hierarchy_id=root_id,
meta_data=self.meta_data,
name_tokens=self.name_tokens + {cfg.RIG_TYPE: cfg.SUB_RIG_TYPE, cfg.TYPE: cfg.GROUP_TYPE},
**self.build_kwargs)
self.root = self.hierarchy[cfg.NODE_TYPE][cfg.DEFAULT][-1]
self.root = self.hierarchy[cfg.NODE_TYPE][root_id]

for main_group_type in self.SUB_GROUPS:
hierarchy_id = '%s_%s' % (cfg.GROUP_TYPE, main_group_type)
Expand Down
6 changes: 3 additions & 3 deletions anvil/sub_rig_templates/hand.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
class Hand(SubRigTemplate):
BUILT_IN_NAME_TOKENS = SubRigTemplate.BUILT_IN_NAME_TOKENS.merge({"name": "hand"}, new=True)
DEFAULT_NAMES = ["thumb", "index", "middle", "ring", "pinky"]
BUILT_IN_ATTRIBUTES = {
BUILT_IN_ATTRIBUTES = SubRigTemplate.BUILT_IN_ATTRIBUTES.merge({
"curl_bias": at.PM_1_KWARGS,
"curl": at.PM_10_KWARGS,
"spread": at.PM_10_KWARGS,
"fist": at.PM_10_KWARGS,
"cup": at.PM_10_KWARGS,
cfg.IKFK_BLEND: at.ZERO_TO_ONE_KWARGS,
}
})

def __init__(self, has_fk=True, has_ik=True, has_thumb=True, **kwargs):
""" General class for a hand.
Expand Down Expand Up @@ -71,7 +71,7 @@ def build_digit(self, index, **kwargs):

if self.has_fk and self.has_ik:
blend_chain = self.build_blend_chain(source_chains=[fk_chain, ik_chain],
blend_attr=self.root.blend,
blend_attr=self.root.ikfk_blend,
parent=self.group_joints,
**kwargs)
self.register_node(blend_chain, hierarchy_id='%s_chain_%s' % (cfg.BLEND, index))
Expand Down
15 changes: 9 additions & 6 deletions tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from six import iteritems, string_types
from functools import wraps
from datetime import datetime
import traceback

os.environ['ANVIL_MODE'] = 'TEST'
os.environ['A_SAVE_PREFIX'] = 'test_results'
Expand Down Expand Up @@ -116,7 +117,7 @@ def save_test_file(instance, save_file, func):
path = os.path.join(*[f for f in [save_path, filename] if f])
rt.dcc.scene.fileop(rename=path)
rt.dcc.scene.fileop(save=True, type='mayaBinary')
print('Saving test result file for test %s in path %s' % (instance.__class__.__name__, path))
print('Saving test result file for test %s.%s to file:\n\t%s' % (instance.__class__.__name__, func.__name__, path))


def auto_save_result(func):
Expand All @@ -125,12 +126,14 @@ def wrapped(self, *args, **kwargs):
save_file = os.environ.get('A_SAVE_PREFIX', None)
try:
func_return = func(self, *args, **kwargs)
except Exception as e:
save_test_file(self, save_file, func)
raise e

if save_file:
save_test_file(self, save_file, func)
except Exception:
traceback.print_exc()
raise

finally:
if save_file:
save_test_file(self, save_file, func)

return func_return

Expand Down

0 comments on commit 96ee3dd

Please sign in to comment.