[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52962] trunk/blender/release/scripts/ modules/rna_xml.py: fix for sequence size mismatch when loading themes, addition of alpha channel caused themes not to load.

Campbell Barton ideasman42 at gmail.com
Thu Dec 13 10:46:27 CET 2012


Revision: 52962
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52962
Author:   campbellbarton
Date:     2012-12-13 09:46:24 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
fix for sequence size mismatch when loading themes, addition of alpha channel caused themes not to load.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/rna_xml.py

Modified: trunk/blender/release/scripts/modules/rna_xml.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_xml.py	2012-12-13 09:14:41 UTC (rev 52961)
+++ trunk/blender/release/scripts/modules/rna_xml.py	2012-12-13 09:46:24 UTC (rev 52962)
@@ -265,7 +265,15 @@
                     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




More information about the Bf-blender-cvs mailing list