[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3813] contrib/py/scripts/addons/ space_view3d_paint_bprojection.py: Set BPlane transparency only if BProjection material exists.

Gaia Clary gaia.clary at machinimatrix.org
Thu Oct 4 11:24:09 CEST 2012


Revision: 3813
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3813
Author:   gaiaclary
Date:     2012-10-04 09:24:09 +0000 (Thu, 04 Oct 2012)
Log Message:
-----------
Set BPlane transparency only if  BProjection material exists. Avoids breaking the UI when material renamed/removed (WIP)

Modified Paths:
--------------
    contrib/py/scripts/addons/space_view3d_paint_bprojection.py

Modified: contrib/py/scripts/addons/space_view3d_paint_bprojection.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-10-04 09:16:31 UTC (rev 3812)
+++ contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-10-04 09:24:09 UTC (rev 3813)
@@ -529,7 +529,12 @@
             if ob == bpy.data.objects[em.custom_active_object]:            
                 col = layout.column(align =True)
                 col.operator("object.removebprojectionplane", text="Remove BProjection plane")           
-                
+
+            try:
+                matBProjection = bpy.data.materials[BProjection_Material]
+            except:
+                matBProjection = None
+            
             box = layout.box()
 
             row = box.row()
@@ -578,9 +583,11 @@
                     else: 
                         row.prop(em,'custom_scaleuv',text='')
                         row.prop(em, "custom_linkscaleuv",text="",icon='UNLINKED')            
-                    row = box.column(align =True)
-                    row.prop(ob.material_slots['Material for BProjection'].material,'alpha', slider = True)
-                    row = box.column(align =True)
+                    
+                    if matBProjection:
+                        row = box.column(align =True)
+                        row.prop(matBProjection,'alpha', slider = True)
+                        row = box.column(align =True)
     
                 if ob == bpy.data.objects[em.custom_active_object]:    
                     for item in em.custom_props:



More information about the Bf-extensions-cvs mailing list