diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-24 18:17:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-24 18:17:11 +0300 |
commit | 6f724c54bcbb9fc0408a6191a8031c278086416d (patch) | |
tree | efc6c4767a40ae5f7c971266fafda66401ec0ca3 /release/scripts/keyingsets | |
parent | b84bc45c7f947263a9ad0b3d4367bdf6c0ba8b4f (diff) |
replace exceptions with getattr() fallback
Diffstat (limited to 'release/scripts/keyingsets')
-rw-r--r-- | release/scripts/keyingsets/keyingsets_utils.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/keyingsets/keyingsets_utils.py index 810b23b9e4a..3d57130b6e5 100644 --- a/release/scripts/keyingsets/keyingsets_utils.py +++ b/release/scripts/keyingsets/keyingsets_utils.py @@ -57,14 +57,10 @@ def RKS_GEN_available(ksi, context, ks, data): # try to get the animation data associated with the closest # ID-block to the data (neither of which may exist/be easy to find) id_block = data.id_data - try: - adt = id_block.animation_data - except: - # there isn't any animation data available - return; - + adt = getattr(id_block, "animation_data", None) + # there must also be an active action... - if adt.action is None: + if adt is None or adt.action is None: return; # for each F-Curve, include an path to key it @@ -89,13 +85,10 @@ def get_transform_generators_base_info(data): else: # get the path to the ID-block path = data.path_to_id() - - try: - # try to use the name of the data element to group the F-Curve - grouping = data.name - except: - # fallback on the KeyingSet name - grouping = None; + + # try to use the name of the data element to group the F-Curve + # else fallback on the KeyingSet name + grouping = getattr(data, "name", None) # return the ID-block and the path return id_block, path, grouping |