[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3191] trunk/py/scripts/addons/ space_view3d_materials_utils.py: fix for api

Brendon Murphy meta.androcto1 at gmail.com
Sat Mar 31 10:47:51 CEST 2012


Revision: 3191
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3191
Author:   meta-androcto
Date:     2012-03-31 08:47:31 +0000 (Sat, 31 Mar 2012)
Log Message:
-----------
fix for api

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	2012-03-30 02:33:55 UTC (rev 3190)
+++ trunk/py/scripts/addons/space_view3d_materials_utils.py	2012-03-31 08:47:31 UTC (rev 3191)
@@ -43,7 +43,7 @@
     additional "new" entry the chosen material will be assigned to all the
     selected objects in object mode.
 
-    in edit mode the selected faces get the selected material applied.
+    in edit mode the selected polygons get the selected material applied.
 
     if the user chose "new" the new material can be renamed using the
     "last operator" section of the toolbox.
@@ -58,12 +58,12 @@
     objects without the material will be removed from selection.
 
     in edit mode:  the menu offers only the materials attached to the current
-    object. It will select the faces that use the material and deselect those
+    object. It will select the polygons that use the material and deselect those
     that do not.
 
 * clean material slots
     for all selected objects any empty material slots or material slots with
-    materials that are not used by the mesh faces will be removed.
+    materials that are not used by the mesh polygons will be removed.
 
 * Any un-used materials and slots will be removed
 """
@@ -109,7 +109,7 @@
 
 def select_material_by_name(find_mat_name):
     #in object mode selects all objects with material find_mat_name
-    #in edit mode selects all faces with material find_mat_name
+    #in edit mode selects all polygons with material find_mat_name
 
     find_mat = bpy.data.materials.get(find_mat_name)
 
@@ -121,7 +121,7 @@
 
     scn = bpy.context.scene
 
-    #set selection mode to faces
+    #set selection mode to polygons
     scn.tool_settings.mesh_select_mode = False, False, True
 
     actob = bpy.context.active_object
@@ -149,7 +149,7 @@
                 ob.select = False
 
     else:
-        #it's editmode, so select the faces
+        #it's editmode, so select the polygons
         ob = actob
         ms = ob.material_slots.values()
 
@@ -163,7 +163,7 @@
                 # found = True  # UNUSED
             i += 1
         me = ob.data
-        for f in me.faces:
+        for f in me.polygons:
             if f.material_index in slot_indeces:
                 f.select = True
             else:
@@ -174,7 +174,7 @@
 
 
 def mat_to_texface():
-    # assigns the first image in each material to the faces in the active
+    # assigns the first image in each material to the polygons in the active
     # uvlayer for all selected objects
 
     #check for editmode
@@ -225,7 +225,7 @@
             for t in  me.uv_textures:
                 if t.active:
                     uvtex = t.data.values()
-                    for f in me.faces:
+                    for f in me.polygons:
                         #check that material had an image!
                         if images[f.material_index] != None:
                             uvtex[f.index].image = images[f.material_index]
@@ -276,11 +276,11 @@
         if ob.type == 'MESH':
             mats = ob.material_slots.keys()
 
-            #check the faces on the mesh to build a list of used materials
+            #check the polygons on the mesh to build a list of used materials
             usedMatIndex = []  # we'll store used materials indices here
             faceMats = []
             me = ob.data
-            for f in me.faces:
+            for f in me.polygons:
                 #get the material index for this face...
                 faceindex = f.material_index
 
@@ -311,7 +311,7 @@
 
             # restore face indices:
             i = 0
-            for f in me.faces:
+            for f in me.polygons:
                 matindex = mnames.index(faceMats[i])
                 f.material_index = matindex
                 i += 1
@@ -334,12 +334,12 @@
     if not found:
         target = bpy.data.materials.new(matname)
 
-    # if objectmode then set all faces
+    # if objectmode then set all polygons
     editmode = False
-    allfaces = True
+    allpolygons = True
     if actob.mode == 'EDIT':
         editmode = True
-        allfaces = False
+        allpolygons = False
         bpy.ops.object.mode_set()
 
     objs = bpy.context.selected_editable_objects
@@ -384,11 +384,11 @@
 
             #now assign the material:
             me = ob.data
-            if allfaces:
-                for f in me.faces:
+            if allpolygons:
+                for f in me.polygons:
                     f.material_index = index
-            elif allfaces == False:
-                for f in me.faces:
+            elif allpolygons == False:
+                for f in me.polygons:
                     if f.select:
                         f.material_index = index
             me.update()
@@ -476,7 +476,7 @@
         i = 0
         for f in faceindex:
             if f != None:
-                me.faces[i].material_index = f
+                me.polygons[i].material_index = f
             i += 1
     if editmode:
         bpy.ops.object.mode_set(mode='EDIT')
@@ -634,10 +634,10 @@
                         icon='CANCEL')
         layout.operator("view3d.material_to_texface",
                         text='Material to Texface',
-                        icon='FACESEL_HLT')
+                        icon='polygonsEL_HLT')
         layout.operator("view3d.texface_to_material",
                         text="Texface to Material",
-                        icon='FACESEL_HLT')
+                        icon='polygonsEL_HLT')
 
         layout.separator()
         layout.operator("view3d.replace_material",



More information about the Bf-extensions-cvs mailing list