From 15634fd22e28e95f9d2905a29d4cc34fdb613e7c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Dec 2012 09:46:24 +0000 Subject: [PATCH] fix for sequence size mismatch when loading themes, addition of alpha channel caused themes not to load. --- release/scripts/modules/rna_xml.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py index e21ccd08a35..08b60ebc6f8 100644 --- a/release/scripts/modules/rna_xml.py +++ b/release/scripts/modules/rna_xml.py @@ -265,7 +265,15 @@ def xml2rna(root_xml, tp_name = 'ARRAY' # print(" %s.%s (%s) --- %s" % (type(value).__name__, attr, tp_name, subvalue_type)) - setattr(value, attr, value_xml_coerce) + try: + setattr(value, attr, value_xml_coerce) + except ValueError: + # size mismatch + val = getattr(value, attr) + if len(val) < len(value_xml_coerce): + setattr(value, attr, value_xml_coerce[:len(val)]) + else: + setattr(value, attr, list(value_xml_coerce) + list(val)[len(value_xml_coerce):]) # --------------------------------------------------------------------- # Complex attributes