From 5027ccba53daff62acb356afc55fa8f1f7718ab0 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Wed, 18 Aug 2010 03:42:53 +0000 Subject: [PATCH] updates for changes in blenders api --- add_mesh_BoltFactory/createMesh.py | 4 +- io_export_directx_x.py | 30 ++++++------- io_export_unreal_psk_psa.py | 36 +++++++-------- io_import_scene_mhx.py | 8 ++-- io_import_scene_unreal_psk.py | 6 +-- io_mesh_raw/export_raw.py | 4 +- io_mesh_raw/import_raw.py | 4 +- io_mesh_stl/blender_utils.py | 10 ++--- mesh_surface_sketch.py | 70 +++++++++++++++--------------- object_cloud_gen.py | 2 +- object_fracture/fracture_ops.py | 20 ++++----- render_povray/render.py | 8 ++-- space_view3d_panel_measure.py | 26 +++++------ space_view3d_spacebar_menu.py | 32 +++++++------- 14 files changed, 130 insertions(+), 130 deletions(-) diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py index 278d4ee2e..86c1b40d4 100644 --- a/add_mesh_BoltFactory/createMesh.py +++ b/add_mesh_BoltFactory/createMesh.py @@ -2035,8 +2035,8 @@ def Create_New_Mesh(props, context, align_matrix): mesh = bpy.data.meshes.new(sMeshName) mesh.add_geometry((len(verts)), 0, int(len(faces))) - mesh.verts.foreach_set("co", unpack_list(verts)) - mesh.faces.foreach_set("verts_raw", unpack_face_list(faces)) + mesh.vertices.foreach_set("co", unpack_list(verts)) + mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces)) scene = context.scene diff --git a/io_export_directx_x.py b/io_export_directx_x.py index bf4551232..6019941d5 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -176,7 +176,7 @@ def GetObjectChildren(Parent): def GetMeshVertexCount(Mesh): VertexCount = 0 for Face in Mesh.faces: - VertexCount += len(Face.verts) + VertexCount += len(Face.vertices) return VertexCount #Returns the file path of first image texture from Material. @@ -359,11 +359,11 @@ def WriteMeshVertices(Config, Mesh): Config.File.write("{}{};\n".format(" " * Config.Whitespace, VertexCount)) for Face in Mesh.faces: - Vertices = list(Face.verts) + Vertices = list(Face.vertices) if Config.CoordinateSystem == 1: Vertices = Vertices[::-1] - for Vertex in [Mesh.verts[Vertex] for Vertex in Vertices]: + for Vertex in [Mesh.vertices[Vertex] for Vertex in Vertices]: Position = Config.SystemMatrix * Vertex.co Config.File.write("{}{:9f};{:9f};{:9f};".format(" " * Config.Whitespace, Position[0], Position[1], Position[2])) Index += 1 @@ -376,8 +376,8 @@ def WriteMeshVertices(Config, Mesh): Config.File.write("{}{};\n".format(" " * Config.Whitespace, len(Mesh.faces))) for Face in Mesh.faces: - Config.File.write("{}{};".format(" " * Config.Whitespace, len(Face.verts))) - for Vertex in Face.verts: + Config.File.write("{}{};".format(" " * Config.Whitespace, len(Face.vertices))) + for Vertex in Face.vertices: Config.File.write("{};".format(Index)) Index += 1 if Index == VertexCount: @@ -395,11 +395,11 @@ def WriteMeshNormals(Config, Mesh): Config.File.write("{}{};\n".format(" " * Config.Whitespace, VertexCount)) for Face in Mesh.faces: - Vertices = list(Face.verts) + Vertices = list(Face.vertices) if Config.CoordinateSystem == 1: Vertices = Vertices[::-1] - for Vertex in [Mesh.verts[Vertex] for Vertex in Vertices]: + for Vertex in [Mesh.vertices[Vertex] for Vertex in Vertices]: if Face.smooth: Normal = Config.SystemMatrix * Vertex.normal else: @@ -417,8 +417,8 @@ def WriteMeshNormals(Config, Mesh): Config.File.write("{}{};\n".format(" " * Config.Whitespace, len(Mesh.faces))) for Face in Mesh.faces: - Config.File.write("{}{};".format(" " * Config.Whitespace, len(Face.verts))) - for Vertex in Face.verts: + Config.File.write("{}{};".format(" " * Config.Whitespace, len(Face.vertices))) + for Vertex in Face.vertices: Config.File.write("{};".format(Index)) Index += 1 if Index == VertexCount: @@ -535,7 +535,7 @@ def WriteMeshSkinWeights(Config, Object, Mesh): #Maps bones to a list of vertices they affect VertexGroups = {} - for Vertex in Mesh.verts: + for Vertex in Mesh.vertices: #BoneInfluences contains the bones of the armature that affect the current vertex BoneInfluences = [PoseBones[Object.vertex_groups[Group.group].name] for Group in Vertex.groups if Object.vertex_groups[Group.group].name in PoseBones] if len(BoneInfluences) > MaxInfluences: @@ -558,7 +558,7 @@ def WriteMeshSkinWeights(Config, Object, Mesh): VertexCount = 0 VertexIndexes = [Vertex.index for Vertex in VertexGroups[Bone]] for Face in Mesh.faces: - for Vertex in Face.verts: + for Vertex in Face.vertices: if Vertex in VertexIndexes: VertexCount += 1 @@ -570,21 +570,21 @@ def WriteMeshSkinWeights(Config, Object, Mesh): Index = 0 WrittenIndexes = 0 for Face in Mesh.faces: - FaceVertices = list(Face.verts) + FaceVertices = list(Face.vertices) if Config.CoordinateSystem == 1: FaceVertices = FaceVertices[::-1] for Vertex in FaceVertices: if Vertex in VertexIndexes: Config.File.write("{}{}".format(" " * Config.Whitespace, Index)) - GroupIndexes = {Object.vertex_groups[Group.group].name: Index for Index, Group in enumerate(Mesh.verts[Vertex].groups) if Object.vertex_groups[Group.group].name in PoseBones} + GroupIndexes = {Object.vertex_groups[Group.group].name: Index for Index, Group in enumerate(Mesh.vertices[Vertex].groups) if Object.vertex_groups[Group.group].name in PoseBones} WeightTotal = 0.0 - for Weight in [Group.weight for Group in Mesh.verts[Vertex].groups if Object.vertex_groups[Group.group].name in PoseBones]: + for Weight in [Group.weight for Group in Mesh.vertices[Vertex].groups if Object.vertex_groups[Group.group].name in PoseBones]: WeightTotal += Weight if WeightTotal: - VertexWeights.append(Mesh.verts[Vertex].groups[GroupIndexes[Bone.name]].weight / WeightTotal) + VertexWeights.append(Mesh.vertices[Vertex].groups[GroupIndexes[Bone.name]].weight / WeightTotal) else: VertexWeights.append(0.0) diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py index 3bc73a82a..8b6160841 100644 --- a/io_export_unreal_psk_psa.py +++ b/io_export_unreal_psk_psa.py @@ -592,13 +592,13 @@ def make_namedbonebinary(name, parent_index, child_count, orientation_quat, posi #The face has to be triangle not a line def is_1d_face(blender_face,mesh): #ID Vertex of id point - v0 = blender_face.verts[0] - v1 = blender_face.verts[1] - v2 = blender_face.verts[2] + v0 = blender_face.vertices[0] + v1 = blender_face.vertices[1] + v2 = blender_face.vertices[2] - return (mesh.verts[v0].co == mesh.verts[v1].co or \ - mesh.verts[v1].co == mesh.verts[v2].co or \ - mesh.verts[v2].co == mesh.verts[v0].co) + return (mesh.vertices[v0].co == mesh.vertices[v1].co or \ + mesh.vertices[v1].co == mesh.vertices[v2].co or \ + mesh.vertices[v2].co == mesh.vertices[v0].co) return False ################################################## @@ -615,7 +615,7 @@ def triangulateNMesh(object): bpy.ops.object.mode_set(mode='OBJECT') print("Checking mesh if needs to convert quad to Tri...") for face in object.data.faces: - if (len(face.verts) > 3): + if (len(face.vertices) > 3): bneedtri = True break @@ -703,12 +703,12 @@ def parse_meshes(blender_meshes, psk_file): #print ' -- Dumping UVs -- ' #print current_face.uv_textures - if len(current_face.verts) != 3: - raise RuntimeError("Non-triangular face (%i)" % len(current_face.verts)) + if len(current_face.vertices) != 3: + raise RuntimeError("Non-triangular face (%i)" % len(current_face.vertices)) #No Triangulate Yet - # if len(current_face.verts) != 3: - # raise RuntimeError("Non-triangular face (%i)" % len(current_face.verts)) + # if len(current_face.vertices) != 3: + # raise RuntimeError("Non-triangular face (%i)" % len(current_face.vertices)) # #TODO: add two fake faces made of triangles? #RG - apparently blender sometimes has problems when you do quad to triangle @@ -745,8 +745,8 @@ def parse_meshes(blender_meshes, psk_file): #print("DATA face uv: ",len(faceUV.uv), " >> ",(faceUV.uv[0][0])) for i in range(3): - vert_index = current_face.verts[i] - vert = current_mesh.verts[vert_index] + vert_index = current_face.vertices[i] + vert = current_mesh.vertices[vert_index] uv = [] #assumes 3 UVs Per face (for now). if (has_UV): @@ -844,10 +844,10 @@ def parse_meshes(blender_meshes, psk_file): elif (dot < 0): (tri.WedgeIndex0, tri.WedgeIndex1, tri.WedgeIndex2) = wedge_list else: - dindex0 = current_face.verts[0]; - dindex1 = current_face.verts[1]; - dindex2 = current_face.verts[2]; - raise RuntimeError("normal vector coplanar with face! points:", current_mesh.verts[dindex0].co, current_mesh.verts[dindex1].co, current_mesh.verts[dindex2].co) + dindex0 = current_face.vertices[0]; + dindex1 = current_face.vertices[1]; + dindex2 = current_face.vertices[2]; + raise RuntimeError("normal vector coplanar with face! points:", current_mesh.vertices[dindex0].co, current_mesh.vertices[dindex1].co, current_mesh.vertices[dindex2].co) tri.MatIndex = object_material_index #print(tri) @@ -880,7 +880,7 @@ def parse_meshes(blender_meshes, psk_file): for bonegroup in bonedata: #print("bone gourp build:",bonegroup.bone) vert_list = [] - for current_vert in current_mesh.verts: + for current_vert in current_mesh.vertices: #print("INDEX V:",current_vert.index) vert_index = current_vert.index for vgroup in current_vert.groups:#vertex groupd id diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py index 1c75a493f..cf0c178e9 100644 --- a/io_import_scene_mhx.py +++ b/io_import_scene_mhx.py @@ -1105,13 +1105,13 @@ def parseMesh (args, tokens): if faces: #x = me.from_pydata(verts, [], faces) me.add_geometry(len(verts), 0, len(faces)) - me.verts.foreach_set("co", unpackList(verts)) - me.faces.foreach_set("verts_raw", unpackList(faces)) + me.vertices.foreach_set("co", unpackList(verts)) + me.faces.foreach_set("vertices_raw", unpackList(faces)) else: #x = me.from_pydata(verts, edges, []) me.add_geometry(len(verts), len(edges), 0) - me.verts.foreach_set("co", unpackList(verts)) - me.edges.foreach_set("verts", unpackList(edges)) + me.vertices.foreach_set("co", unpackList(verts)) + me.edges.foreach_set("vertices", unpackList(edges)) #print(x) me.update() #print(me) diff --git a/io_import_scene_unreal_psk.py b/io_import_scene_unreal_psk.py index 47145e1f5..e1080d411 100644 --- a/io_import_scene_unreal_psk.py +++ b/io_import_scene_unreal_psk.py @@ -183,7 +183,7 @@ def pskimport(infile): indata = unpack('3f',pskfile.read(12)) #print(indata[0],indata[1],indata[2]) verts.extend([(indata[0],indata[1],indata[2])]) - #Tmsh.verts.append(NMesh.Vert(indata[0],indata[1],indata[2])) + #Tmsh.vertices.append(NMesh.Vert(indata[0],indata[1],indata[2])) #================================================================================================== # UV @@ -486,9 +486,9 @@ def pskimport(infile): #================================================================================================== print("vertex:",len(verts),"faces:",len(faces)) me_ob.add_geometry(len(verts), 0, int(len(faces)/4)) - me_ob.verts.foreach_set("co", unpack_list(verts)) + me_ob.vertices.foreach_set("co", unpack_list(verts)) - me_ob.faces.foreach_set("verts_raw", faces) + me_ob.faces.foreach_set("vertices_raw", faces) me_ob.faces.foreach_set("smooth", [False] * len(me_ob.faces)) me_ob.update() diff --git a/io_mesh_raw/export_raw.py b/io_mesh_raw/export_raw.py index 323f84f6c..ac5933f6f 100644 --- a/io_mesh_raw/export_raw.py +++ b/io_mesh_raw/export_raw.py @@ -49,8 +49,8 @@ def faceToTriangles(face): def faceValues(face, mesh, matrix): fv = [] - for verti in face.verts_raw: - fv.append(matrix * mesh.verts[verti].co) + for verti in face.vertices_raw: + fv.append(matrix * mesh.vertices[verti].co) return fv diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py index 6a9b3eb73..e8a7a4a75 100644 --- a/io_mesh_raw/import_raw.py +++ b/io_mesh_raw/import_raw.py @@ -91,8 +91,8 @@ def readMesh(filename, objName): mesh = bpy.data.meshes.new(objName) mesh.add_geometry(int(len(verts)), 0, int(len(faces))) - mesh.verts.foreach_set("co", unpack_list(verts)) - mesh.faces.foreach_set("verts_raw", unpack_face_list(faces)) + mesh.vertices.foreach_set("co", unpack_list(verts)) + mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces)) return mesh diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py index 4bf9e8fc1..5b3bdd771 100644 --- a/io_mesh_stl/blender_utils.py +++ b/io_mesh_stl/blender_utils.py @@ -40,11 +40,11 @@ def faces_from_mesh(ob, apply_modifier=False, triangulate=True): From a list of faces, return the face triangulated if needed. ''' for face in mesh.faces: - if triangulate and len(face.verts) == 4: - yield face.verts[:3] - yield face.verts[2:] + [face.verts[0]] + if triangulate and len(face.vertices) == 4: + yield face.vertices[:3] + yield face.vertices[2:] + [face.vertices[0]] else: - yield list(face.verts) + yield list(face.vertices) - return ([tuple(ob.matrix_world * mesh.verts[index].co) + return ([tuple(ob.matrix_world * mesh.vertices[index].co) for index in indexes] for indexes in iter_face_index()) diff --git a/mesh_surface_sketch.py b/mesh_surface_sketch.py index 1d5a7de84..5dee99da7 100644 --- a/mesh_surface_sketch.py +++ b/mesh_surface_sketch.py @@ -76,20 +76,20 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): def get_ordered_verts(self, ob, all_selected_edges_idx, all_selected_verts_idx, first_vert_idx, middle_vertex_idx): # Order selected vertexes. verts_ordered = [] - verts_ordered.append(self.main_object.data.verts[first_vert_idx]) + verts_ordered.append(self.main_object.data.vertices[first_vert_idx]) prev_v = first_vert_idx prev_ed = None finish_while = False while True: edges_non_matched = 0 for i in all_selected_edges_idx: - if ob.data.edges[i] != prev_ed and ob.data.edges[i].verts[0] == prev_v and ob.data.edges[i].verts[1] in all_selected_verts_idx: - verts_ordered.append(self.main_object.data.verts[ob.data.edges[i].verts[1]]) - prev_v = ob.data.edges[i].verts[1] + if ob.data.edges[i] != prev_ed and ob.data.edges[i].vertices[0] == prev_v and ob.data.edges[i].vertices[1] in all_selected_verts_idx: + verts_ordered.append(self.main_object.data.vertices[ob.data.edges[i].vertices[1]]) + prev_v = ob.data.edges[i].vertices[1] prev_ed = ob.data.edges[i] - elif ob.data.edges[i] != prev_ed and ob.data.edges[i].verts[1] == prev_v and ob.data.edges[i].verts[0] in all_selected_verts_idx: - verts_ordered.append(self.main_object.data.verts[ob.data.edges[i].verts[0]]) - prev_v = ob.data.edges[i].verts[0] + elif ob.data.edges[i] != prev_ed and ob.data.edges[i].vertices[1] == prev_v and ob.data.edges[i].vertices[0] in all_selected_verts_idx: + verts_ordered.append(self.main_object.data.vertices[ob.data.edges[i].vertices[0]]) + prev_v = ob.data.edges[i].vertices[0] prev_ed = ob.data.edges[i] else: edges_non_matched += 1 @@ -101,7 +101,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): break if middle_vertex_idx != None: - verts_ordered.append(self.main_object.data.verts[middle_vertex_idx]) + verts_ordered.append(self.main_object.data.vertices[middle_vertex_idx]) verts_ordered.reverse() return verts_ordered @@ -176,14 +176,14 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): all_selected_edges_idx.append(ed.index) # Selected vertexes. - if not ed.verts[0] in all_selected_verts: - all_selected_verts.append(self.main_object.data.verts[ed.verts[0]]) - if not ed.verts[1] in all_selected_verts: - all_selected_verts.append(self.main_object.data.verts[ed.verts[1]]) + if not ed.vertices[0] in all_selected_verts: + all_selected_verts.append(self.main_object.data.vertices[ed.vertices[0]]) + if not ed.vertices[1] in all_selected_verts: + all_selected_verts.append(self.main_object.data.vertices[ed.vertices[1]]) # All verts (both from each edge) to determine later which are at the tips (those not repeated twice). - all_verts_idx.append(ed.verts[0]) - all_verts_idx.append(ed.verts[1]) + all_verts_idx.append(ed.vertices[0]) + all_verts_idx.append(ed.vertices[1]) #### Identify the tips and "middle-vertex" that separates U from V, if there is one. @@ -194,7 +194,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): edges_connected_to_tips = [] for ed in self.main_object.data.edges: - if (ed.verts[0] in all_chains_tips_idx or ed.verts[1] in all_chains_tips_idx) and not (ed.verts[0] in all_verts_idx and ed.verts[1] in all_verts_idx): + if (ed.vertices[0] in all_chains_tips_idx or ed.vertices[1] in all_chains_tips_idx) and not (ed.vertices[0] in all_verts_idx and ed.vertices[1] in all_verts_idx): edges_connected_to_tips.append(ed) middle_vertex_idx = None @@ -202,12 +202,12 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): for ed_tips in edges_connected_to_tips: for ed_tips_b in edges_connected_to_tips: if (ed_tips != ed_tips_b): - if ed_tips.verts[0] in all_verts_idx and (((ed_tips.verts[1] == ed_tips_b.verts[0]) or ed_tips.verts[1] == ed_tips_b.verts[1])): - middle_vertex_idx = ed_tips.verts[1] - tips_to_discard_idx.append(ed_tips.verts[0]) - elif ed_tips.verts[1] in all_verts_idx and (((ed_tips.verts[0] == ed_tips_b.verts[0]) or ed_tips.verts[0] == ed_tips_b.verts[1])): - middle_vertex_idx = ed_tips.verts[0] - tips_to_discard_idx.append(ed_tips.verts[1]) + if ed_tips.vertices[0] in all_verts_idx and (((ed_tips.vertices[1] == ed_tips_b.vertices[0]) or ed_tips.vertices[1] == ed_tips_b.vertices[1])): + middle_vertex_idx = ed_tips.vertices[1] + tips_to_discard_idx.append(ed_tips.vertices[0]) + elif ed_tips.vertices[1] in all_verts_idx and (((ed_tips.vertices[0] == ed_tips_b.vertices[0]) or ed_tips.vertices[0] == ed_tips_b.vertices[1])): + middle_vertex_idx = ed_tips.vertices[0] + tips_to_discard_idx.append(ed_tips.vertices[1]) #### List with pairs of verts that belong to the tips of each selection chain (row). @@ -316,11 +316,11 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): points_B = [] points_first_stroke_tips = [] - points_A.append(self.main_object.data.verts[verts_tips_parsed_idx[0]].co) - points_A.append(self.main_object.data.verts[middle_vertex_idx].co) + points_A.append(self.main_object.data.vertices[verts_tips_parsed_idx[0]].co) + points_A.append(self.main_object.data.vertices[middle_vertex_idx].co) - points_B.append(self.main_object.data.verts[verts_tips_parsed_idx[1]].co) - points_B.append(self.main_object.data.verts[middle_vertex_idx].co) + points_B.append(self.main_object.data.vertices[verts_tips_parsed_idx[1]].co) + points_B.append(self.main_object.data.vertices[middle_vertex_idx].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[0].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[len(ob_gp_strokes.data.splines[0].bezier_points) - 1].co) @@ -345,7 +345,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(first_sketched_point_first_stroke_co, self.main_object.data.verts[verts_tips_same_chain_idx[i][v_idx]].co) + dist = self.pts_distance(first_sketched_point_first_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -361,7 +361,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(last_sketched_point_first_stroke_co, self.main_object.data.verts[verts_tips_same_chain_idx[i][v_idx]].co) + dist = self.pts_distance(last_sketched_point_first_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -373,7 +373,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(first_sketched_point_last_stroke_co, self.main_object.data.verts[verts_tips_same_chain_idx[i][v_idx]].co) + dist = self.pts_distance(first_sketched_point_last_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -387,7 +387,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): # Determine if the single selection will be treated as U or as V. edges_sum = 0 for i in all_selected_edges_idx: - edges_sum += self.pts_distance(self.main_object.data.verts[self.main_object.data.edges[i].verts[0]].co, self.main_object.data.verts[self.main_object.data.edges[i].verts[1]].co) + edges_sum += self.pts_distance(self.main_object.data.vertices[self.main_object.data.edges[i].vertices[0]].co, self.main_object.data.vertices[self.main_object.data.edges[i].vertices[1]].co) average_edge_length = edges_sum / len(all_selected_edges_idx) @@ -412,8 +412,8 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): selection_U_exists = True selection_V_exists = False - points_tips.append(self.main_object.data.verts[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][0]].co) - points_tips.append(self.main_object.data.verts[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][1]].co) + points_tips.append(self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][0]].co) + points_tips.append(self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][1]].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[0].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[len(ob_gp_strokes.data.splines[0].bezier_points) - 1].co) @@ -563,20 +563,20 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): if selection_U_exists: ob_ctrl_pts.data.add_geometry(1,0,0) - last_v = ob_ctrl_pts.data.verts[len(ob_ctrl_pts.data.verts) - 1] + last_v = ob_ctrl_pts.data.vertices[len(ob_ctrl_pts.data.vertices) - 1] last_v.co = verts_ordered_U[i].co vert_num_in_spline += 1 for sp in sketched_splines_parsed: ob_ctrl_pts.data.add_geometry(1,0,0) - v = ob_ctrl_pts.data.verts[len(ob_ctrl_pts.data.verts) - 1] + v = ob_ctrl_pts.data.vertices[len(ob_ctrl_pts.data.vertices) - 1] v.co = sp[i] if vert_num_in_spline > 1: ob_ctrl_pts.data.add_geometry(0,1,0) - ob_ctrl_pts.data.edges[len(ob_ctrl_pts.data.edges) - 1].verts[0] = len(ob_ctrl_pts.data.verts) - 2 - ob_ctrl_pts.data.edges[len(ob_ctrl_pts.data.edges) - 1].verts[1] = len(ob_ctrl_pts.data.verts) - 1 + ob_ctrl_pts.data.edges[len(ob_ctrl_pts.data.edges) - 1].vertices[0] = len(ob_ctrl_pts.data.vertices) - 2 + ob_ctrl_pts.data.edges[len(ob_ctrl_pts.data.edges) - 1].vertices[1] = len(ob_ctrl_pts.data.vertices) - 1 last_v = v diff --git a/object_cloud_gen.py b/object_cloud_gen.py index 666ddb6bc..8e9da71b4 100644 --- a/object_cloud_gen.py +++ b/object_cloud_gen.py @@ -64,7 +64,7 @@ def makeObjectIntoBoundBox(object, sizeDifference): bpy.ops.object.mode_set(mode='EDIT') mesh = object.data - verts = mesh.verts + verts = mesh.vertices #Set the max and min verts to the first vertex on the list maxVert = [verts[0].co[0], verts[0].co[1], verts[0].co[2]] diff --git a/object_fracture/fracture_ops.py b/object_fracture/fracture_ops.py index b2aa84420..d4d8c4610 100644 --- a/object_fracture/fracture_ops.py +++ b/object_fracture/fracture_ops.py @@ -38,7 +38,7 @@ def create_cutter(context, crack_type, scale, roughness): False, False, False, False, False, False, False, False)) - for v in context.scene.objects.active.data.verts: + for v in context.scene.objects.active.data.vertices: v.co[0] += 1 v.co[0] *= scale v.co[1] *= scale @@ -79,14 +79,14 @@ def create_cutter(context, crack_type, scale, roughness): bpy.ops.uv.smart_project(angle_limit=66, island_margin=0) bpy.ops.object.editmode_toggle() - for v in context.scene.objects.active.data.verts: + for v in context.scene.objects.active.data.vertices: v.co[0] += 1 v.co[0] *= scale v.co[1] *= scale v.co[2] *= scale if crack_type == 'SPHERE_ROUGH': - for v in context.scene.objects.active.data.verts: + for v in context.scene.objects.active.data.vertices: v.co[0] += roughness * scale * 0.2 * (random.random() - 0.5) v.co[1] += roughness * scale * 0.1 * (random.random() - 0.5) v.co[2] += roughness * scale * 0.1 * (random.random() - 0.5) @@ -124,7 +124,7 @@ def getIslands(shard): fgroups = [] vgi = [] - for v in sm.verts: + for v in sm.vertices: vgi.append(-1) gindex = 0 @@ -137,10 +137,10 @@ def getIslands(shard): while len(gproc) > 0: i = gproc.pop(0) for f in sm.faces: - #if i in f.verts: - for v in f.verts: + #if i in f.vertices: + for v in f.vertices: if v == i: - for v1 in f.verts: + for v1 in f.vertices: if vgi[v1] == -1: vgi[v1] = gindex vgroups[gindex].append(v1) @@ -170,11 +170,11 @@ def getIslands(shard): bpy.ops.mesh.select_all(action='DESELECT') bpy.ops.object.editmode_toggle() - for x in range(len(sm.verts) - 1, -1, -1): + for x in range(len(sm.vertices) - 1, -1, -1): if vgi[x] != gi: #print('getIslands: selecting') #print('getIslands: ' + str(x)) - a.data.verts[x].select = True + a.data.vertices[x].select = True print(bpy.context.scene.objects.active.name) @@ -212,7 +212,7 @@ def boolop(ob, cutter, op): nmesh = a.create_mesh(sce, apply_modifiers=True, settings='PREVIEW') - if len(nmesh.verts) > 0: + if len(nmesh.vertices) > 0: a.modifiers.remove(a.modifiers['Boolean']) bpy.ops.object.duplicate(linked=False, mode=1) diff --git a/render_povray/render.py b/render_povray/render.py index c52607408..066a73c94 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -299,17 +299,17 @@ def write_pov(filename, scene=None, info_callback=None): except: vcol_layer = None - faces_verts = [f.verts for f in me.faces] + faces_verts = [f.vertices for f in me.faces] faces_normals = [tuple(f.normal) for f in me.faces] - verts_normals = [tuple(v.normal) for v in me.verts] + verts_normals = [tuple(v.normal) for v in me.vertices] # quads incur an extra face quadCount = len([f for f in faces_verts if len(f) == 4]) file.write('mesh2 {\n') file.write('\tvertex_vectors {\n') - file.write('\t\t%s' % (len(me.verts))) # vert count - for v in me.verts: + file.write('\t\t%s' % (len(me.vertices))) # vert count + for v in me.vertices: file.write(',\n\t\t<%.6f, %.6f, %.6f>' % tuple(v.co)) # vert count file.write('\n }\n') diff --git a/space_view3d_panel_measure.py b/space_view3d_panel_measure.py index 6a5553e41..61bf81534 100644 --- a/space_view3d_panel_measure.py +++ b/space_view3d_panel_measure.py @@ -220,7 +220,7 @@ def getMeasurePoints(context): # Get the selected vertices. # @todo: Better (more efficient) way to do this? - verts_selected = [v for v in mesh.verts if v.select == 1] + verts_selected = [v for v in mesh.vertices if v.select == 1] if len(verts_selected) == 0: # Nothing selected. @@ -324,17 +324,17 @@ def faceAreaGlobal(face, obj): mat = obj.matrix_world - if len(face.verts) == 4: + if len(face.vertices) == 4: # Quad # Get vertex indices - v1, v2, v3, v4 = face.verts + v1, v2, v3, v4 = face.vertices # Get vertex data - v1 = obj.data.verts[v1] - v2 = obj.data.verts[v2] - v3 = obj.data.verts[v3] - v4 = obj.data.verts[v4] + v1 = obj.data.vertices[v1] + v2 = obj.data.vertices[v2] + v3 = obj.data.vertices[v3] + v4 = obj.data.vertices[v4] # Apply transform matrix to vertex coordinates. v1 = v1.co * mat @@ -356,16 +356,16 @@ def faceAreaGlobal(face, obj): area += n.length / 2.0 - elif len(face.verts) == 3: + elif len(face.vertices) == 3: # Triangle # Get vertex indices - v1, v2, v3 = face.verts + v1, v2, v3 = face.vertices # Get vertex data - v1 = obj.data.verts[v1] - v2 = obj.data.verts[v2] - v3 = obj.data.verts[v3] + v1 = obj.data.vertices[v1] + v2 = obj.data.vertices[v2] + v3 = obj.data.vertices[v3] # Apply transform matrix to vertex coordinates. v1 = v1.co * mat @@ -756,7 +756,7 @@ class VIEW3D_PT_measure(bpy.types.Panel): # Get the selected vertices. # @todo: Better (more efficient) way to do this? - verts_selected = [v for v in mesh.verts if v.select == 1] + verts_selected = [v for v in mesh.vertices if v.select == 1] if len(verts_selected) == 0: # Nothing selected. diff --git a/space_view3d_spacebar_menu.py b/space_view3d_spacebar_menu.py index a130f9a41..f34aaa455 100644 --- a/space_view3d_spacebar_menu.py +++ b/space_view3d_spacebar_menu.py @@ -200,8 +200,8 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() # Proportional block - layout.prop_menu_enum(settings, "proportional_editing", icon= "PROP_CON") - layout.prop_menu_enum(settings, "proportional_editing_falloff", icon= "SMOOTHCURVE") + layout.prop_menu_enum(settings, "proportional_edit", icon= "PROP_CON") + layout.prop_menu_enum(settings, "proportional_edit_falloff", icon= "SMOOTHCURVE") layout.separator() # Edit Control Points @@ -253,8 +253,8 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() # Proportional block - layout.prop_menu_enum(settings, "proportional_editing", icon= "PROP_CON") - layout.prop_menu_enum(settings, "proportional_editing_falloff", icon= "SMOOTHCURVE") + layout.prop_menu_enum(settings, "proportional_edit", icon= "PROP_CON") + layout.prop_menu_enum(settings, "proportional_edit_falloff", icon= "SMOOTHCURVE") # Edit Curve Specials layout.menu("VIEW3D_MT_EditCurveSpecials", @@ -300,8 +300,8 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() # Proportional block - layout.prop_menu_enum(settings, "proportional_editing", icon= "PROP_CON") - layout.prop_menu_enum(settings, "proportional_editing_falloff", icon= "SMOOTHCURVE") + layout.prop_menu_enum(settings, "proportional_edit", icon= "PROP_CON") + layout.prop_menu_enum(settings, "proportional_edit_falloff", icon= "SMOOTHCURVE") # Cursor block layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR') @@ -342,8 +342,8 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() # Proportional block - layout.prop_menu_enum(settings, "proportional_editing", icon= "PROP_CON") - layout.prop_menu_enum(settings, "proportional_editing_falloff", icon= "SMOOTHCURVE") + layout.prop_menu_enum(settings, "proportional_edit", icon= "PROP_CON") + layout.prop_menu_enum(settings, "proportional_edit_falloff", icon= "SMOOTHCURVE") # Cursor block layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR') @@ -388,8 +388,8 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() # Proportional block - layout.prop_menu_enum(settings, "proportional_editing", icon= "PROP_CON") - layout.prop_menu_enum(settings, "proportional_editing_falloff", icon= "SMOOTHCURVE") + layout.prop_menu_enum(settings, "proportional_edit", icon= "PROP_CON") + layout.prop_menu_enum(settings, "proportional_edit_falloff", icon= "SMOOTHCURVE") # Cursor block layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR') @@ -880,7 +880,7 @@ class VIEW3D_MT_SelectEditMenu(bpy.types.Menu): layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES' layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS' - if context.scene.tool_settings.mesh_selection_mode[2] == False: + if context.scene.tool_settings.mesh_select_mode[2] == False: layout.operator("mesh.select_non_manifold", text="Non Manifold") layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER' layout.operator("mesh.select_similar", text="Similar") @@ -1082,19 +1082,19 @@ class VIEW3D_MT_edit_TK(bpy.types.Menu): prop = layout.operator("wm.context_set_value", text="Select By Vertex", icon='VERTEXSEL') prop.value = "(True, False, False)" - prop.data_path = "tool_settings.mesh_selection_mode" + prop.data_path = "tool_settings.mesh_select_mode" layout.menu("VIEW3D_MT_edit_mesh_vertices", icon='VERTEXSEL') prop = layout.operator("wm.context_set_value", text="Select By Edge", icon='EDGESEL') prop.value = "(False, True, False)" - prop.data_path = "tool_settings.mesh_selection_mode" + prop.data_path = "tool_settings.mesh_select_mode" layout.menu("VIEW3D_MT_edit_mesh_edges", icon='EDGESEL') prop = layout.operator("wm.context_set_value", text="Select By Face", icon='FACESEL') prop.value = "(False, False, True)" - prop.data_path = "tool_settings.mesh_selection_mode" + prop.data_path = "tool_settings.mesh_select_mode" layout.menu("VIEW3D_MT_edit_mesh_faces", icon='FACESEL') layout.separator() @@ -1366,7 +1366,7 @@ def edgeIntersect(context, operator): edges = []; mesh = obj.data - verts = mesh.verts + verts = mesh.vertices is_editmode = (obj.mode == 'EDIT') if is_editmode: @@ -1383,7 +1383,7 @@ def edgeIntersect(context, operator): operator.report({'ERROR'}, "Operator requires exactly 2 edges to be selected.") return - line = LineLineIntersect(verts[edges[0].verts[0]].co, verts[edges[0].verts[1]].co, verts[edges[1].verts[0]].co, verts[edges[1].verts[1]].co) + line = LineLineIntersect(verts[edges[0].vertices[0]].co, verts[edges[0].vertices[1]].co, verts[edges[1].vertices[0]].co, verts[edges[1].vertices[1]].co) if (line == None): operator.report({'ERROR'}, "Selected edges are parallel.") -- GitLab