From 919541ffbeb34af259f2950c785d9cb7cc392f33 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Aug 2020 11:38:23 +1000 Subject: Cleanup: trailing space --- add_mesh_BoltFactory/Boltfactory.py | 8 +- add_mesh_BoltFactory/createMesh.py | 154 ++++++++++----------- io_coat3D/__init__.py | 58 ++++---- io_coat3D/tex.py | 30 ++-- io_coat3D/texVR.py | 24 ++-- oscurart_tools/__init__.py | 4 +- oscurart_tools/mesh/overlap_uvs.py | 32 ++--- oscurart_tools/mesh/print_uv_stats.py | 28 ++-- oscurart_tools/render/material_overrides.py | 56 ++++---- oscurart_tools/render/render_tokens.py | 10 +- .../operators/scene_create_from_selection.py | 10 +- .../scripts/BPSRender/bpsrender/__init__.py | 1 - 12 files changed, 207 insertions(+), 208 deletions(-) diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index acfe5886..244d9720 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -141,7 +141,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ('bf_Torx_T50', 'T50', 'T50'), ('bf_Torx_T55', 'T55', 'T55'), ] - + bf_Torx_Size_Type: EnumProperty( attr='bf_Torx_Size_Type', name='Torx Size', @@ -323,7 +323,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): description='Height of the 12 Point Nut', unit='LENGTH', ) - + bf_12_Point_Nut_Flat_Distance: FloatProperty( attr='bf_12_Point_Nut_Flat_Distance', name='12 Point Nut Flat Dist', default=3.0, @@ -400,8 +400,8 @@ class add_mesh_bolt(Operator, AddObjectHelper): col.prop(self, 'bf_Hex_Nut_Height') col.prop(self, 'bf_Hex_Nut_Flat_Distance') - - + + # Thread col.label(text='Thread') if self.bf_Model_Type == 'bf_Model_Bolt': diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py index 96284012..e19f15ba 100644 --- a/add_mesh_BoltFactory/createMesh.py +++ b/add_mesh_BoltFactory/createMesh.py @@ -291,14 +291,14 @@ def Fill_Fan_Face(OFFSET, NUM, FACE_DOWN=0): Ret = [] Face = [NUM-1,0,1] TempFace = [0, 0, 0] - A = 0 + A = 0 #B = 1 unsed C = 2 if NUM < 3: return None for _i in range(NUM - 2): TempFace[0] = Face[A] - TempFace[1] = Face[C] + TempFace[1] = Face[C] TempFace[2] = Face[C]+1 if FACE_DOWN: Ret.append([OFFSET + Face[2], OFFSET + Face[1], OFFSET + Face[0]]) @@ -429,18 +429,18 @@ def Torx_Fill(OFFSET, FLIP=0): Lookup = [[0,10,11], [0,11, 12], [0,12,1], - + [1, 12, 13], [1, 13, 14], [1, 14, 15], [1, 15, 2], - + [2, 15, 16], [2, 16, 17], [2, 17, 18], [2, 18, 19], [2, 19, 3], - + [3, 19, 20], [3, 20, 21], [3, 21, 22], @@ -448,8 +448,8 @@ def Torx_Fill(OFFSET, FLIP=0): [3, 23, 24], [3, 24, 25], [3, 25, 4], - - + + [4, 25, 26], [4, 26, 27], [4, 27, 28], @@ -457,25 +457,25 @@ def Torx_Fill(OFFSET, FLIP=0): [4, 29, 30], [4, 30, 31], [4, 31, 5], - + [5, 31, 32], [5, 32, 33], [5, 33, 34], [5, 34, 35], [5, 35, 36], [5, 36, 6], - + [6, 36, 37], [6, 37, 38], [6, 38, 39], [6, 39, 7], - + [7, 39, 40], [7, 40, 41], [7, 41, 42], [7, 42, 43], [7, 43, 8], - + [8, 43, 44], [8, 44, 45], [8, 45, 46], @@ -505,40 +505,40 @@ def Create_Torx_Bit(Point_Distance, HEIGHT): OUTTER_RADIUS = POINT_RADIUS * 1.05 POINT_1_Y = POINT_RADIUS * 0.816592592592593 - POINT_2_X = POINT_RADIUS * 0.511111111111111 - POINT_2_Y = POINT_RADIUS * 0.885274074074074 - POINT_3_X = POINT_RADIUS * 0.7072 - POINT_3_Y = POINT_RADIUS * 0.408296296296296 - POINT_4_X = POINT_RADIUS * 1.02222222222222 - SMALL_RADIUS = POINT_RADIUS * 0.183407407407407 - BIG_RADIUS = POINT_RADIUS * 0.333333333333333 + POINT_2_X = POINT_RADIUS * 0.511111111111111 + POINT_2_Y = POINT_RADIUS * 0.885274074074074 + POINT_3_X = POINT_RADIUS * 0.7072 + POINT_3_Y = POINT_RADIUS * 0.408296296296296 + POINT_4_X = POINT_RADIUS * 1.02222222222222 + SMALL_RADIUS = POINT_RADIUS * 0.183407407407407 + BIG_RADIUS = POINT_RADIUS * 0.333333333333333 # Values for T40 # POINT_1_Y = 2.756 # POINT_2_X = 1.725 -# POINT_2_Y = 2.9878 +# POINT_2_Y = 2.9878 # POINT_3_X = 2.3868 # POINT_3_Y = 1.378 # POINT_4_X = 3.45 -# +# # SMALL_RADIUS = 0.619 # BIG_RADIUS = 1.125 def Do_Curve(Curve_Height): - for i in range(0, 90, 10): + for i in range(0, 90, 10): x = sin(radians(i)) * SMALL_RADIUS y = cos(radians(i)) * SMALL_RADIUS verts.append([x, POINT_1_Y + y, Curve_Height]) - - for i in range(260, 150, -10): + + for i in range(260, 150, -10): x = sin(radians(i)) * BIG_RADIUS y = cos(radians(i)) * BIG_RADIUS verts.append([POINT_2_X + x, POINT_2_Y + y, Curve_Height]) - + for i in range(340, 150 + 360, 10): x = sin(radians(i%360)) * SMALL_RADIUS y = cos(radians(i%360)) * SMALL_RADIUS verts.append([POINT_3_X + x, POINT_3_Y + y, Curve_Height]) - - for i in range(320, 260, -10): + + for i in range(320, 260, -10): x = sin(radians(i)) * BIG_RADIUS y = cos(radians(i)) * BIG_RADIUS verts.append([POINT_4_X + x, y, Curve_Height]) @@ -553,19 +553,19 @@ def Create_Torx_Bit(Point_Distance, HEIGHT): FaceStart_Top_Curve= len(verts) Do_Curve(0) faces.extend(Torx_Fill(FaceStart_Outside, 0)) - + FaceStart_Bottom_Curve= len(verts) Do_Curve(0 - HEIGHT) - + faces.extend(Build_Face_List_Quads(FaceStart_Top_Curve,42 ,1 , True)) - + verts.append([0,0,0 - HEIGHT]) # add center point for fill Fan faces.extend(Fill_Fan_Face(FaceStart_Bottom_Curve, 44)) - + M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'x') verts.extend(M_Verts) faces.extend(M_Faces) - + M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'y') verts.extend(M_Verts) faces.extend(M_Faces) @@ -1078,12 +1078,12 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): FLANGE_HEIGHT = (1.89/8.0)*HEIGHT FLAT_HEIGHT = (4.18/8.0)*HEIGHT # FLANGE_DIA = (13.27/8.0)*FLAT - + FLANGE_RADIUS = FLANGE_DIA * 0.5 - FLANGE_TAPPER_HEIGHT = HEIGHT - FLANGE_HEIGHT - FLAT_HEIGHT - + FLANGE_TAPPER_HEIGHT = HEIGHT - FLANGE_HEIGHT - FLAT_HEIGHT + # HOLE_DIA = 0.0 - + verts = [] faces = [] HOLE_RADIUS = HOLE_DIA / 2 @@ -1098,7 +1098,7 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): verts.append([0.0, 0.0, 0.0]) -# print("HOLE_RADIUS" + str(HOLE_RADIUS)) +# print("HOLE_RADIUS" + str(HOLE_RADIUS)) # print("TopBevelRadius" + str(TopBevelRadius)) FaceStart = len(verts) @@ -1123,15 +1123,15 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): x = sin(radians(20)) * HOLE_RADIUS y = cos(radians(20)) * HOLE_RADIUS verts.append([x, y, 0.0]) - + x = sin(radians(25)) * HOLE_RADIUS y = cos(radians(25)) * HOLE_RADIUS verts.append([x, y, 0.0]) - + x = sin(radians(30)) * HOLE_RADIUS y = cos(radians(30)) * HOLE_RADIUS verts.append([x, y, 0.0]) - + Row += 1 @@ -1156,17 +1156,17 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): y = cos(radians(15)) * TopBevelRadius vec4 = Vector([x, y, 0.0]) verts.append([x, y, 0.0]) - + x = sin(radians(20)) * TopBevelRadius y = cos(radians(20)) * TopBevelRadius vec5 = Vector([x, y, 0.0]) verts.append([x, y, 0.0]) - + x = sin(radians(25)) * TopBevelRadius y = cos(radians(25)) * TopBevelRadius vec6 = Vector([x, y, 0.0]) verts.append([x, y, 0.0]) - + x = sin(radians(30)) * TopBevelRadius y = cos(radians(30)) * TopBevelRadius vec7 = Vector([x, y, 0.0]) @@ -1176,11 +1176,11 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): #45Deg bevel on the top - + #First we work out how far up the Y axis the vert is v_origin = Vector([0.0,0.0,0.0]) # center of the model - v_15Deg_Point = Vector([tan(radians(15)) * Half_Flat,Half_Flat,0.0]) #Is a know point to work back from - + v_15Deg_Point = Vector([tan(radians(15)) * Half_Flat,Half_Flat,0.0]) #Is a know point to work back from + x = tan(radians(0)) * Half_Flat Point_Distance =(tan(radians(30)) * v_15Deg_Point.x)+Half_Flat dvec = vec1 - Vector([x, Point_Distance, 0.0]) @@ -1188,18 +1188,18 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): v_0_Deg_Top_Point = Vector([x, Point_Distance, -dvec.length]) v_0_Deg_Point = Vector([x, Point_Distance,0.0]) - + v_5Deg_Line = Vector([tan(radians(5)) * Half_Flat, Half_Flat, 0.0]) v_5Deg_Line.length *= 2 # extende out the line on a 5 deg angle #We cross 2 lines. One from the origin to the 0 Deg point #and the second is from the orign extended out past the first line - # This gives the cross point of the + # This gives the cross point of the v_Cross = geometry.intersect_line_line_2d(v_0_Deg_Point,v_15Deg_Point,v_origin,v_5Deg_Line) dvec = vec2 - Vector([v_Cross.x,v_Cross.y,0.0]) verts.append([v_Cross.x,v_Cross.y,-dvec.length]) v_5_Deg_Top_Point = Vector([v_Cross.x,v_Cross.y,-dvec.length]) - + v_10Deg_Line = Vector([tan(radians(10)) * Half_Flat, Half_Flat, 0.0]) v_10Deg_Line.length *= 2 # extende out the line @@ -1207,14 +1207,14 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): dvec = vec3 - Vector([v_Cross.x,v_Cross.y,0.0]) verts.append([v_Cross.x,v_Cross.y,-dvec.length]) v_10_Deg_Top_Point = Vector([v_Cross.x,v_Cross.y,-dvec.length]) - - #The remain points are stright forward because y is all the same y height (Half_Flat) + + #The remain points are stright forward because y is all the same y height (Half_Flat) x = tan(radians(15)) * Half_Flat dvec = vec4 - Vector([x, Half_Flat, 0.0]) Lowest_Point = -dvec.length verts.append([x, Half_Flat, -dvec.length]) v_15_Deg_Top_Point = Vector([x, Half_Flat, -dvec.length]) - + x = tan(radians(20)) * Half_Flat dvec = vec5 - Vector([x, Half_Flat, 0.0]) Lowest_Point = -dvec.length @@ -1234,43 +1234,43 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): v_30_Deg_Top_Point = Vector([x, Half_Flat, -dvec.length]) Row += 1 - + #Down Bits # print ("Point_Distance") # print (Point_Distance) - + Flange_Adjacent = FLANGE_RADIUS - Point_Distance if (Flange_Adjacent == 0.0): Flange_Adjacent = 0.000001 - Flange_Opposite = FLANGE_TAPPER_HEIGHT - + Flange_Opposite = FLANGE_TAPPER_HEIGHT + # print ("Flange_Opposite") # print (Flange_Opposite) # print ("Flange_Adjacent") # print (Flange_Adjacent) - + FLANGE_ANGLE_RAD = atan(Flange_Opposite/Flange_Adjacent ) # FLANGE_ANGLE_RAD = radians(45) # print("FLANGE_ANGLE_RAD") -# print (degrees (FLANGE_ANGLE_RAD)) - - +# print (degrees (FLANGE_ANGLE_RAD)) + + v_Extended_Flange_Edge = Vector([0.0,0.0,-HEIGHT + FLANGE_HEIGHT + (tan(FLANGE_ANGLE_RAD)* FLANGE_RADIUS) ]) # print("v_Extended_Flange_Edge") -# print (v_Extended_Flange_Edge) +# print (v_Extended_Flange_Edge) #0deg v_Flange_Edge = Vector([sin(radians(0)) * FLANGE_RADIUS,cos(radians(0)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_0_Deg_Top_Point,Vector([v_0_Deg_Top_Point.x,v_0_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) verts.append(v_Cross[0]) - + #5deg v_Flange_Edge = Vector([sin(radians(5)) * FLANGE_RADIUS,cos(radians(5)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_5_Deg_Top_Point,Vector([v_5_Deg_Top_Point.x,v_5_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) verts.append(v_Cross[0]) - + #10deg v_Flange_Edge = Vector([sin(radians(10)) * FLANGE_RADIUS,cos(radians(10)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_10_Deg_Top_Point,Vector([v_10_Deg_Top_Point.x,v_10_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) @@ -1286,13 +1286,13 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): v_Flange_Edge = Vector([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_20_Deg_Top_Point,Vector([v_20_Deg_Top_Point.x,v_20_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) verts.append(v_Cross[0]) - + #25deg v_Flange_Edge = Vector([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_25_Deg_Top_Point,Vector([v_25_Deg_Top_Point.x,v_25_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) verts.append(v_Cross[0]) - - + + #30deg v_Flange_Edge = Vector([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ]) v_Cross = geometry.intersect_line_line(v_30_Deg_Top_Point,Vector([v_30_Deg_Top_Point.x,v_30_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge) @@ -1309,7 +1309,7 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): verts.append([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT]) verts.append([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT]) verts.append([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT]) - + Row += 1 verts.append([sin(radians(0)) * FLANGE_RADIUS,cos(radians(0)) * FLANGE_RADIUS,-HEIGHT]) @@ -1319,10 +1319,10 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): verts.append([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT]) verts.append([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT]) verts.append([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT]) - + Row += 1 - + verts.append([sin(radians(0)) * SHANK_RADIUS,cos(radians(0)) * SHANK_RADIUS,-HEIGHT]) verts.append([sin(radians(0)) * SHANK_RADIUS,cos(radians(0)) * SHANK_RADIUS,-HEIGHT]) verts.append([sin(radians(10)) * SHANK_RADIUS,cos(radians(10)) * SHANK_RADIUS,-HEIGHT]) @@ -1330,7 +1330,7 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): verts.append([sin(radians(20)) * SHANK_RADIUS,cos(radians(20)) * SHANK_RADIUS,-HEIGHT]) verts.append([sin(radians(20)) * SHANK_RADIUS,cos(radians(20)) * SHANK_RADIUS,-HEIGHT]) verts.append([sin(radians(30)) * SHANK_RADIUS,cos(radians(30)) * SHANK_RADIUS,-HEIGHT]) - + Row += 1 @@ -1344,8 +1344,8 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): def Create_12_Point_Head(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA): #TODO add under head radius return Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA) - - + + # #################################################################### # Create External Thread @@ -2288,13 +2288,13 @@ def Nut_Mesh(props, context): Face_Start = len(verts) - - + + if props.bf_Nut_Type == 'bf_Nut_12Pnt': Nut_Height = props.bf_12_Point_Nut_Height else: Nut_Height = props.bf_Hex_Nut_Height - + Thread_Verts, Thread_Faces, New_Nut_Height = Create_Internal_Thread( props.bf_Minor_Dia, props.bf_Major_Dia, props.bf_Pitch, Nut_Height, @@ -2305,7 +2305,7 @@ def Nut_Mesh(props, context): faces.extend(Copy_Faces(Thread_Faces, Face_Start)) Face_Start = len(verts) - + if props.bf_Nut_Type == 'bf_Nut_12Pnt': Head_Verts, Head_Faces, Lock_Nut_Rad = add_12_Point_Nut( props.bf_12_Point_Nut_Flat_Distance, @@ -2397,13 +2397,13 @@ def Bolt_Mesh(props, context): props.bf_Hex_Head_Flat_Distance, Bit_Dia, props.bf_Shank_Dia, props.bf_Hex_Head_Height ) - + elif props.bf_Head_Type == 'bf_Head_12Pnt': Head_Verts, Head_Faces, Head_Height = Create_12_Point_Head( props.bf_12_Point_Head_Flat_Distance, Bit_Dia, props.bf_Shank_Dia, props.bf_12_Point_Head_Height, #Limit the size of the Flange to avoid calculation error - max(props.bf_12_Point_Head_Flange_Dia,props.bf_12_Point_Head_Flat_Distance) + max(props.bf_12_Point_Head_Flange_Dia,props.bf_12_Point_Head_Flat_Distance) ) elif props.bf_Head_Type == 'bf_Head_Cap': Head_Verts, Head_Faces, Head_Height = Create_Cap_Head( diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index 5d74a960..77318c74 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -139,7 +139,7 @@ def set_exchange_folder(): file.write("%s"%(coat3D.exchangedir)) file.close() exchange = coat3D.exchangedir - + else: exchange = source @@ -292,10 +292,10 @@ def updatemesh(objekti, proxy, texturelist): if(udim_textures): udim = proxy.data.uv_layers[index].name udim_index = int(udim[2:]) - 1 - + objekti.data.uv_layers[0].data[indi].uv[0] = proxy.data.uv_layers[index].data[indi].uv[0] objekti.data.uv_layers[0].data[indi].uv[1] = proxy.data.uv_layers[index].data[indi].uv[1] - + index = index + 1 # Mesh Copy @@ -312,11 +312,11 @@ class SCENE_OT_getback(bpy.types.Operator): bl_options = {'UNDO'} def invoke(self, context, event): - + global global_exchange_folder global initial_settings path_ex = '' - + if(initial_settings): global_exchange_folder = set_exchange_folder() initial_settings = False @@ -326,29 +326,29 @@ class SCENE_OT_getback(bpy.types.Operator): BlenderFolder = Blender_folder ExportFolder = Export_folder - + Blender_folder += ('%sexport.txt' % (os.sep)) Export_folder += ('%sexport.txt' % (os.sep)) - + if (bpy.app.background == False): if os.path.isfile(Export_folder): print('BLENDER -> 3DC -> BLENDER WORKFLLOW') - DeleteExtra3DC() + DeleteExtra3DC() workflow1(ExportFolder) removeFile(Export_folder) - removeFile(Blender_folder) - - - + removeFile(Blender_folder) + + + elif os.path.isfile(Blender_folder): print('3DC -> BLENDER WORKFLLOW') - DeleteExtra3DC() + DeleteExtra3DC() workflow2(BlenderFolder) removeFile(Blender_folder) - - + + return {'FINISHED'} @@ -576,7 +576,7 @@ class SCENE_OT_export(bpy.types.Operator): def invoke(self, context, event): bpy.ops.export_applink.pilgway_3d_coat() - + return {'FINISHED'} def execute(self, context): @@ -823,12 +823,12 @@ class SCENE_OT_export(bpy.types.Operator): if(node.name.startswith('3DC_') == True): material.material.node_tree.nodes.remove(node) - + for ind, mat_list in enumerate(mod_mat_list): if(mat_list == '__' + objekti.name): for ind, mat in enumerate(mod_mat_list[mat_list]): objekti.material_slots[mod_mat_list[mat_list][ind][0]].material = mod_mat_list[mat_list][ind][1] - + bpy.context.scene.render.engine = active_render return {'FINISHED'} @@ -855,7 +855,7 @@ def DeleteExtra3DC(): bpy.data.images.remove(del_img) bpy.data.materials.remove(material) - + image_del_list = [] for image in bpy.data.images: if (image.name.startswith('3DC')): @@ -934,7 +934,7 @@ def new_ref_function(new_applink_address, nimi): def blender_3DC_blender(texturelist): - + coat3D = bpy.context.scene.coat3D old_materials = bpy.data.materials.keys() @@ -1086,7 +1086,7 @@ def blender_3DC_blender(texturelist): #delete_materials_from_end(keep_materials_count, obj_proxy) - + updatemesh(objekti,obj_proxy, texturelist) bpy.context.view_layer.objects.active = objekti @@ -1213,7 +1213,7 @@ def blender_3DC(texturelist, new_applink_address): old_materials = bpy.data.materials.keys() old_objects = bpy.data.objects.keys() - + bpy.ops.import_scene.fbx(filepath=new_applink_address, global_scale = 1, axis_forward='-Z', axis_up='Y') new_materials = bpy.data.materials.keys() @@ -1288,7 +1288,7 @@ def blender_3DC(texturelist, new_applink_address): os.remove(Blender_export) if (os.path.isfile(Blender_folder2)): os.remove(Blender_folder2) - + for material in bpy.data.materials: if material.use_nodes == True: for node in material.node_tree.nodes: @@ -1309,9 +1309,9 @@ def workflow1(ExportFolder): for image in bpy.data.images: if(image.filepath == texturepath[3] and image.users == 0): bpy.data.images.remove(image) - + path3b_now = coat3D.exchangedir - + path3b_now += ('last_saved_3b_file.txt') new_applink_address = 'False' new_object = False @@ -1335,7 +1335,7 @@ def workflow1(ExportFolder): new_ref_object = True nimi = scene_objects.name - + exportfile = coat3D.exchangedir @@ -1368,9 +1368,9 @@ def workflow2(BlenderFolder): kokeilu = coat3D.exchangedir Blender_export = os.path.join(kokeilu, 'Blender') - + path3b_now = coat3D.exchangedir - + path3b_now += ('last_saved_3b_file.txt') Blender_export += ('%sexport.txt'%(os.sep)) new_applink_address = 'False' @@ -2058,7 +2058,7 @@ def register(): bpy.types.Object.coat3D = PointerProperty(type=ObjectCoat3D) bpy.types.Scene.coat3D = PointerProperty(type=SceneCoat3D) bpy.types.Mesh.coat3D = PointerProperty(type=MeshCoat3D) - bpy.types.Material.coat3D = PointerProperty(type=MaterialCoat3D) + bpy.types.Material.coat3D = PointerProperty(type=MaterialCoat3D) kc = bpy.context.window_manager.keyconfigs.addon diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 3a48ab8f..21fa92b3 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -128,22 +128,22 @@ def updatetextures(objekti): # Update 3DC textures def testi(objekti, texture_info, index_mat_name, uv_MODE_mat, mat_index): if uv_MODE_mat == 'UV': - + uv_set_founded = False for uvset in objekti.data.uv_layers: - + if(uvset.name == texture_info): uv_set_founded = True - + break - + if(uv_set_founded): for uv_poly in objekti.data.uv_layers[texture_info].id_data.polygons: if(mat_index == uv_poly.material_index): return True else: return False - + elif uv_MODE_mat == 'MAT': return (texture_info == index_mat_name) @@ -168,17 +168,17 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r if(udim_textures == False): for slot_index, texture_info in enumerate(texturelist): - uv_MODE_mat = 'MAT' + uv_MODE_mat = 'MAT' for index, layer in enumerate(objekti.data.uv_layers): if(layer.name == texturelist[slot_index][0]): uv_MODE_mat = 'UV' break - + if(testi(objekti, texturelist[slot_index][0], index_mat.name, uv_MODE_mat, ind)) : if texture_info[2] == 'color' or texture_info[2] == 'diffuse': if(index_mat.material.coat3D_diffuse): - + texcoat['color'].append(texture_info[3]) create_nodes = True else: @@ -241,7 +241,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r os.remove(texture_info[3]) create_group_node = True - + else: for texture_info in texturelist: @@ -516,21 +516,21 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, load_image = True for image in bpy.data.images: - + if(texcoat[type['name']][0] == image.filepath): load_image = False node.image = image - + break if (load_image): print('load_image', texcoat[type['name']][0]) - + node.image = bpy.data.images.load(texcoat[type['name']][0]) if(udim_textures): node.image.source = 'TILED' - + if node.image and type['colorspace'] == 'noncolor': node.image.colorspace_settings.is_data = True @@ -589,7 +589,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, if(material.name == '3DC_Emission'): main_material.links.new(applink_tree.outputs[type['input']], material.inputs[0]) break - + uv_node.location = node.location uv_node.location[0] -= 300 uv_node.location[1] -= 200 @@ -688,7 +688,7 @@ def matlab(objekti,mat_list,texturelist,is_new): ''' Check if bind textures with UVs or Materials ''' if(texturelist != []): - + udim_textures = False if texturelist[0][0].startswith('100') and len(texturelist[0][0]) == 4: udim_textures = True diff --git a/io_coat3D/texVR.py b/io_coat3D/texVR.py index 9f0e65ec..520b3084 100644 --- a/io_coat3D/texVR.py +++ b/io_coat3D/texVR.py @@ -173,19 +173,19 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r if(udim_textures == False): for slot_index, texture_info in enumerate(texturelist): - uv_MODE_mat = 'MAT' + uv_MODE_mat = 'MAT' for index, layer in enumerate(objekti.data.uv_layers): if(layer.name == texturelist[slot_index][0]): uv_MODE_mat = 'UV' break - + print('aaa') print(texture_info[0]) print(index_mat) if(texture_info[0] == index_mat.name): if texture_info[2] == 'color' or texture_info[2] == 'diffuse': if(index_mat.material.coat3D_diffuse): - + texcoat['color'].append(texture_info[3]) create_nodes = True else: @@ -248,7 +248,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r os.remove(texture_info[3]) create_group_node = True - + else: for texture_info in texturelist: @@ -282,7 +282,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r texcoat['alpha'].append([texture_info[0], texture_info[3]]) create_nodes = True create_group_node = True - + if(create_nodes): coat3D = bpy.context.scene.coat3D path3b_n = coat3D.exchangedir @@ -311,7 +311,7 @@ def createnodes(active_mat,texcoat, create_group_node, tile_list, objekti, ind, if(coatMat.use_nodes == False): coatMat.use_nodes = True - + act_material = coatMat.node_tree main_material = coatMat.node_tree applink_group_node = False @@ -596,7 +596,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, else: node = act_material.nodes.new('ShaderNodeTexImage') uv_node = act_material.nodes.new('ShaderNodeUVMap') - + uv_node.uv_map = objekti.data.uv_layers[0].name act_material.links.new(uv_node.outputs[0], node.inputs[0]) uv_node.use_custom_color = True @@ -646,7 +646,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, if (load_image): node.image = bpy.data.images.load(texcoat[type['name']][0]) - + if node.image and type['colorspace'] == 'noncolor': node.image.colorspace_settings.is_data = True @@ -788,7 +788,7 @@ def createExtraNodes(act_material, node, type, notegroup): curvenode.location = -900, -1250 rampnode.location = -600, -1200 huenode.location = -300, -1200 - + if(type['name'] == 'color'): node_vertex = act_material.nodes.new('ShaderNodeVertexColor') node_mixRGB = act_material.nodes.new('ShaderNodeMixRGB') @@ -804,12 +804,12 @@ def createExtraNodes(act_material, node, type, notegroup): node_vertex.location = -337, 525 node_mixRGB.location = 0, 425 - + act_material.links.new(node_vertex.outputs[0], node_mixRGB.inputs[1]) act_material.links.new(huenode.outputs[0], node_mixRGB.inputs[2]) act_material.links.new(node_vertex.outputs[1], notegroup.inputs[8]) act_material.links.new(node_mixRGB.outputs[0], node_vectormath.inputs[0]) - + return node_vectormath return huenode @@ -829,7 +829,7 @@ def matlab(objekti,mat_list,texturelist,is_new): ''' Check if bind textures with UVs or Materials ''' if(texturelist != []): - + udim_textures = False if texturelist[0][0].startswith('100'): udim_textures = True diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py index 0d340cc8..f630b456 100644 --- a/oscurart_tools/__init__.py +++ b/oscurart_tools/__init__.py @@ -76,7 +76,7 @@ class VIEW3D_MT_edit_mesh_oscurarttools(Menu): layout.operator("mesh.uv_island_copy") layout.operator("mesh.uv_island_paste") layout.operator("mesh.select_doubles") - layout.operator("mesh.print_uv_stats") + layout.operator("mesh.print_uv_stats") layout.separator() layout.operator("image.reload_images_osc") layout.operator("file.save_incremental_backup") @@ -124,7 +124,7 @@ class VIEW3D_MT_object_oscurarttools(Menu): layout.operator("object.search_and_select_osc") layout.operator("object.shape_key_to_objects_osc") layout.operator("mesh.apply_linked_meshes") - layout.operator("mesh.print_uv_stats") + layout.operator("mesh.print_uv_stats") layout.separator() layout.operator("image.reload_images_osc") layout.operator("file.save_incremental_backup") diff --git a/oscurart_tools/mesh/overlap_uvs.py b/oscurart_tools/mesh/overlap_uvs.py index c5bbab05..8b2a893c 100644 --- a/oscurart_tools/mesh/overlap_uvs.py +++ b/oscurart_tools/mesh/overlap_uvs.py @@ -27,8 +27,8 @@ from bpy.props import ( FloatProperty, EnumProperty, ) - - + + import bmesh # -------------------------- OVERLAP UV ISLANDS @@ -37,7 +37,7 @@ def defCopyUvsIsland(self, context): global islandSet islandSet = {} islandSet["Loop"] = [] - + bpy.context.scene.tool_settings.use_uv_select_sync = True bpy.ops.uv.select_linked() bm = bmesh.from_edit_mesh(bpy.context.object.data) @@ -45,39 +45,39 @@ def defCopyUvsIsland(self, context): faceSel = 0 for face in bm.faces: if face.select: - faceSel +=1 + faceSel +=1 for loop in face.loops: - islandSet["Loop"].append(loop[uv_lay].uv.copy()) + islandSet["Loop"].append(loop[uv_lay].uv.copy()) islandSet["Size"] = faceSel def defPasteUvsIsland(self, uvOffset, rotateUv,context): bm = bmesh.from_edit_mesh(bpy.context.object.data) - bpy.context.scene.tool_settings.use_uv_select_sync = True + bpy.context.scene.tool_settings.use_uv_select_sync = True pickedFaces = [face for face in bm.faces if face.select] for face in pickedFaces: bpy.ops.mesh.select_all(action="DESELECT") face.select=True bmesh.update_edit_mesh(bpy.context.object.data) bpy.ops.uv.select_linked() - uv_lay = bm.loops.layers.uv.active + uv_lay = bm.loops.layers.uv.active faceSel = 0 for face in bm.faces: if face.select: - faceSel +=1 - i = 0 - if faceSel == islandSet["Size"]: + faceSel +=1 + i = 0 + if faceSel == islandSet["Size"]: for face in bm.faces: - if face.select: + if face.select: for loop in face.loops: loop[uv_lay].uv = islandSet["Loop"][i] if uvOffset == False else islandSet["Loop"][i]+Vector((1,0)) - i += 1 + i += 1 else: - print("the island have a different size of geometry") - + print("the island have a different size of geometry") + if rotateUv: bpy.ops.object.mode_set(mode="EDIT") bmesh.ops.reverse_uvs(bm, faces=[f for f in bm.faces if f.select]) - bmesh.ops.rotate_uvs(bm, faces=[f for f in bm.faces if f.select]) + bmesh.ops.rotate_uvs(bm, faces=[f for f in bm.faces if f.select]) class CopyUvIsland(Operator): """Copy Uv Island""" @@ -110,7 +110,7 @@ class PasteUvIsland(Operator): name="Rotate Uv Corner", default=False ) - + @classmethod def poll(cls, context): return (context.active_object is not None and diff --git a/oscurart_tools/mesh/print_uv_stats.py b/oscurart_tools/mesh/print_uv_stats.py index 7488456d..6cc673a9 100644 --- a/oscurart_tools/mesh/print_uv_stats.py +++ b/oscurart_tools/mesh/print_uv_stats.py @@ -70,14 +70,14 @@ def calcMeshArea(ob): polyArea = 0 for poly in ob.data.polygons: polyArea += poly.area - ta = "UvGain: %s%s || " % (round(totalArea * 100),"%") + ta = "UvGain: %s%s || " % (round(totalArea * 100),"%") ma = "MeshArea: %s || " % (polyArea) pg = "PixelsGain: %s || " % (round(totalArea * (pixels[0] * pixels[1]))) pl = "PixelsLost: %s || " % ((pixels[0]*pixels[1]) - round(totalArea * (pixels[0] * pixels[1]))) - tx = "Texel: %s pix/meter" % (round(sqrt(totalArea * pixels[0] * pixels[1] / polyArea))) - GlobLog = ta+ma+pg+pl+tx + tx = "Texel: %s pix/meter" % (round(sqrt(totalArea * pixels[0] * pixels[1] / polyArea))) + GlobLog = ta+ma+pg+pl+tx + - class uvStats(bpy.types.Operator): @@ -90,7 +90,7 @@ class uvStats(bpy.types.Operator): def poll(cls, context): return context.active_object is not None - def execute(self, context): + def execute(self, context): if round( bpy.context.object.scale.x, 2) == 1 and round( @@ -101,25 +101,25 @@ class uvStats(bpy.types.Operator): if setImageRes(bpy.context.object): makeTessellate(bpy.context.object) calcArea() - calcMeshArea(bpy.context.object) + calcMeshArea(bpy.context.object) else: print("Warning: Non Uniform Scale Object") - + copyOb = bpy.context.object.copy() copyMe = bpy.context.object.data.copy() bpy.context.scene.collection.objects.link(copyOb) copyOb.data = copyMe bpy.ops.object.select_all(action="DESELECT") copyOb.select_set(1) - bpy.ops.object.transform_apply() - + bpy.ops.object.transform_apply() + if setImageRes(copyOb): makeTessellate(copyOb) calcArea() calcMeshArea(copyOb) - + bpy.data.objects.remove(copyOb) - bpy.data.meshes.remove(copyMe) - - self.report({'INFO'}, GlobLog) - return {'FINISHED'} \ No newline at end of file + bpy.data.meshes.remove(copyMe) + + self.report({'INFO'}, GlobLog) + return {'FINISHED'} diff --git a/oscurart_tools/render/material_overrides.py b/oscurart_tools/render/material_overrides.py index db200572..d8aade82 100644 --- a/oscurart_tools/render/material_overrides.py +++ b/oscurart_tools/render/material_overrides.py @@ -11,13 +11,13 @@ def ApplyOverrides(dummy): global obDict for override in bpy.context.scene.ovlist: - + # set collections clean name - collClean = override.colloverride + collClean = override.colloverride obClean = override.oboverride - - - + + + if collClean != None: for ob in collClean.all_objects: if ob.type == "MESH": #si es un mesh @@ -28,22 +28,22 @@ def ApplyOverrides(dummy): for iob in ob.instance_collection.all_objects: if iob.type == "MESH": if not iob.hide_viewport and not iob.hide_render: - obDict.append([iob,[mat for mat in iob.data.materials]]) + obDict.append([iob,[mat for mat in iob.data.materials]]) else: - obDict.append([obClean,[mat for mat in obClean.data.materials]]) - - + obDict.append([obClean,[mat for mat in obClean.data.materials]]) + + for override in bpy.context.scene.ovlist: - + # set collections clean name - collClean = override.colloverride - # set material clean name - matClean = override.matoverride - # set objeto clean name - obClean = override.oboverride - + collClean = override.colloverride + # set material clean name + matClean = override.matoverride + # set objeto clean name + obClean = override.oboverride + print(matClean) - + if collClean != None: for ob in collClean.all_objects: if ob.type == "MESH": @@ -56,12 +56,12 @@ def ApplyOverrides(dummy): if iob.type == "MESH": if not iob.hide_viewport and not iob.hide_render: for i,mat in enumerate(iob.data.materials): - iob.data.materials[i] = matClean + iob.data.materials[i] = matClean else: if obClean.type == "MESH": - if not obClean.hide_viewport and not obClean.hide_render: - for i,mat in enumerate(obClean.data.materials): - obClean.data.materials[i] = matClean + if not obClean.hide_viewport and not obClean.hide_render: + for i,mat in enumerate(obClean.data.materials): + obClean.data.materials[i] = matClean @persistent @@ -79,22 +79,22 @@ def RestoreOverrides(dummy): -class OscOverridesProp(bpy.types.PropertyGroup): +class OscOverridesProp(bpy.types.PropertyGroup): colloverride: bpy.props.PointerProperty( name="Collection Override", type=bpy.types.Collection, description="All objects in this collection will be override", - ) + ) oboverride: bpy.props.PointerProperty( name="Object Override", type=bpy.types.Object, description="Only this object will be override.", - ) + ) matoverride: bpy.props.PointerProperty( name="Material Override", type=bpy.types.Material, description="Material for override objects", - ) + ) bpy.utils.register_class(OscOverridesProp) bpy.types.Scene.ovlist = bpy.props.CollectionProperty(type=OscOverridesProp) @@ -118,9 +118,9 @@ class OVERRIDES_PT_OscOverridesGUI(bpy.types.Panel): col.operator("render.overrides_transfer") for i, m in enumerate(bpy.context.scene.ovlist): colrow = col.row(align=1) - colrow.prop(m, "colloverride", text="") - colrow.prop(m, "oboverride", text="") - colrow.prop(m, "matoverride", text="") + colrow.prop(m, "colloverride", text="") + colrow.prop(m, "oboverride", text="") + colrow.prop(m, "matoverride", text="") if i != len(bpy.context.scene.ovlist) - 1: pa = colrow.operator( "ovlist.move_down", diff --git a/oscurart_tools/render/render_tokens.py b/oscurart_tools/render/render_tokens.py index 724cc843..69c79ad8 100644 --- a/oscurart_tools/render/render_tokens.py +++ b/oscurart_tools/render/render_tokens.py @@ -33,16 +33,16 @@ def replaceTokens (dummy): "$Camera": "NoCamera" if bpy.context.scene.camera == None else bpy.context.scene.camera.name} renpath = bpy.context.scene.render.filepath - + nodeDict = [] #compositor nodes if bpy.context.scene.use_nodes: for node in bpy.context.scene.node_tree.nodes: if node.type == "OUTPUT_FILE": - nodeDict.append([node,node.base_path]) + nodeDict.append([node,node.base_path]) node.base_path = node.base_path.replace("$Scene",tokens["$Scene"]).replace("$File",tokens["$File"]).replace("$ViewLayer",tokens["$ViewLayer"]).replace("$Camera",tokens["$Camera"]) - - + + bpy.context.scene.render.filepath = renpath.replace("$Scene",tokens["$Scene"]).replace("$File",tokens["$File"]).replace("$ViewLayer",tokens["$ViewLayer"]).replace("$Camera",tokens["$Camera"]) print(bpy.context.scene.render.filepath) @@ -52,7 +52,7 @@ def replaceTokens (dummy): def restoreTokens (dummy): global renpath bpy.context.scene.render.filepath = renpath - + #restore nodes for node in nodeDict: node[0].base_path = node[1] diff --git a/power_sequencer/operators/scene_create_from_selection.py b/power_sequencer/operators/scene_create_from_selection.py index 57c6a6df..b615dae9 100644 --- a/power_sequencer/operators/scene_create_from_selection.py +++ b/power_sequencer/operators/scene_create_from_selection.py @@ -53,7 +53,7 @@ class POWER_SEQUENCER_OT_scene_create_from_selection(bpy.types.Operator): def execute(self, context): start_scene_name = context.scene.name - + if len(context.selected_sequences) != 0: selection = context.selected_sequences[:] selection_start_frame = min( @@ -63,11 +63,11 @@ class POWER_SEQUENCER_OT_scene_create_from_selection(bpy.types.Operator): # Create new scene for the scene strip bpy.ops.scene.new(type="FULL_COPY") - + context.window.scene.name = context.selected_sequences[0].name new_scene_name = context.window.scene.name - - + + ###after full copy also unselected strips are in the sequencer... Delete those strips bpy.ops.sequencer.select_all(action="INVERT") bpy.ops.power_sequencer.delete_direct() @@ -80,7 +80,7 @@ class POWER_SEQUENCER_OT_scene_create_from_selection(bpy.types.Operator): bpy.ops.sequencer.select_all() bpy.ops.power_sequencer.preview_to_selection() - # Back to start scene + # Back to start scene bpy.context.window.scene = bpy.data.scenes[start_scene_name] bpy.ops.power_sequencer.delete_direct() diff --git a/power_sequencer/scripts/BPSRender/bpsrender/__init__.py b/power_sequencer/scripts/BPSRender/bpsrender/__init__.py index 35a40273..f14cfb6a 100644 --- a/power_sequencer/scripts/BPSRender/bpsrender/__init__.py +++ b/power_sequencer/scripts/BPSRender/bpsrender/__init__.py @@ -14,4 +14,3 @@ # You should have received a copy of the GNU General Public License along with Power Sequencer. If # not, see . # - -- cgit v1.2.3