diff options
author | Brendon Murphy <meta.androcto1@gmail.com> | 2012-03-31 12:47:31 +0400 |
---|---|---|
committer | Brendon Murphy <meta.androcto1@gmail.com> | 2012-03-31 12:47:31 +0400 |
commit | fe38642953ad07adca168d1fcb3950aeff4e7325 (patch) | |
tree | fb4cd384b6fa81fecfea794401ac568cddb560d7 /space_view3d_materials_utils.py | |
parent | eaf3dbcb2ce8c03b0085fd3cef9a74e4c091f504 (diff) |
fix for api
Diffstat (limited to 'space_view3d_materials_utils.py')
-rw-r--r-- | space_view3d_materials_utils.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/space_view3d_materials_utils.py b/space_view3d_materials_utils.py index 59a285b3..5baf7e5d 100644 --- a/space_view3d_materials_utils.py +++ b/space_view3d_materials_utils.py @@ -43,7 +43,7 @@ This script has several functions and operators... grouped for convenience 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 @@ This script has several functions and operators... grouped for convenience 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 replace_material(m1, m2, all_objects=False): 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 @@ def select_material_by_name(find_mat_name): 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 @@ def select_material_by_name(find_mat_name): 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 @@ def select_material_by_name(find_mat_name): # 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 select_material_by_name(find_mat_name): 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 @@ def mat_to_texface(): 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 @@ def cleanmatslots(): 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 @@ def cleanmatslots(): # 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 @@ def assign_mat(matname="Default"): 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 @@ def assign_mat(matname="Default"): #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 @@ def texface_to_mat(): 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 @@ class VIEW3D_MT_master_material(bpy.types.Menu): 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", |