[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1799] trunk/py/scripts/addons/ space_view3d_materials_utils.py: Indentation fix: if assigning a material already on the object to a selection of faces in edit mode the script would do nothing

michael williamson michaelw at cowtoolsmedia.co.uk
Sat Apr 9 10:05:21 CEST 2011


Revision: 1799
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1799
Author:   michaelw
Date:     2011-04-09 08:05:20 +0000 (Sat, 09 Apr 2011)
Log Message:
-----------
Indentation fix: if assigning a material already on the object to a selection of faces in edit mode the script would do nothing

Modified Paths:
--------------
    trunk/py/scripts/addons/space_view3d_materials_utils.py

Modified: trunk/py/scripts/addons/space_view3d_materials_utils.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_materials_utils.py	2011-04-09 02:14:58 UTC (rev 1798)
+++ trunk/py/scripts/addons/space_view3d_materials_utils.py	2011-04-09 08:05:20 UTC (rev 1799)
@@ -391,16 +391,16 @@
                 ob.data.materials.append(target)    
                 
             #now assign the material:
-                me =ob.data
-                if allfaces:
-                    for f in me.faces:
+            me =ob.data
+            if allfaces:
+                for f in me.faces:
+                    f.material_index = index
+            elif allfaces == False:
+                for f in me.faces:
+                    if f.select:
                         f.material_index = index
-                elif allfaces == False:
-                    for f in me.faces:
-                        if f.select:
-                            f.material_index = index
-                me.update()
-            
+            me.update()
+        
 
 
     #restore the active object
@@ -702,11 +702,11 @@
 
     kc = bpy.data.window_managers[0].keyconfigs.default
     km = kc.keymaps["3D View"]
-    for kmi in km.keymap_items:
+    for kmi in km.items:
         if kmi.idname == 'wm.call_menu':
             if kmi.properties.name ==  "VIEW3D_MT_master_material":
-                km.keymap_items.remove(kmi)
+                km.items.remove(kmi)
                 break
 
 if __name__ == "__main__":
-    register()
+    register()
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list