diff --git a/io_export_directx_x.py b/io_export_directx_x.py index 056111b262463a1d1d546831ed4de57dffbc88de..76a60d4252c415da560e37c28ed782442e085162 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -107,11 +107,11 @@ def ExportDirectX(Config): print("Generating Object list for export... (Root parents only)") if Config.ExportMode == 1: Config.ExportList = [Object for Object in Config.context.scene.objects - if Object.type in ("ARMATURE", "EMPTY", "MESH") + if Object.type in {'ARMATURE', 'EMPTY', 'MESH'} and Object.parent is None] else: ExportList = [Object for Object in Config.context.selected_objects - if Object.type in ("ARMATURE", "EMPTY", "MESH")] + if Object.type in {'ARMATURE', 'EMPTY', 'MESH'}] Config.ExportList = [Object for Object in ExportList if Object.parent not in ExportList] if Config.Verbose: @@ -184,7 +184,7 @@ def ExportDirectX(Config): def GetObjectChildren(Parent): return [Object for Object in Parent.children - if Object.type in ("ARMATURE", "EMPTY", "MESH")] + if Object.type in {'ARMATURE', 'EMPTY', 'MESH'}] #Returns the vertex count of Mesh, counting each vertex for every face. def GetMeshVertexCount(Mesh): diff --git a/io_import_scene_dxf.py b/io_import_scene_dxf.py index 0c7abd20d8a323f9380cc76a946ec5ad8ad61b2c..72bc967ed9119536984b4a5a5619c309e2e22250 100644 --- a/io_import_scene_dxf.py +++ b/io_import_scene_dxf.py @@ -2247,7 +2247,7 @@ def buildGeometry(entities): f_faces = [] f_vn = 0 for ent in entities: - if ent.drawtype in ('Mesh','Curve'): + if ent.drawtype in {'Mesh', 'Curve'}: (verts, edges, faces, vn) = ent.build() if not toggle & T_DrawOne: drawGeometry(verts, edges, faces) diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py index 6d4326e479f4df4828ec84cc20647814c48b68ef..e2e730b666f36fc8e7ebafec51441d883a193457 100644 --- a/io_mesh_ply/import_ply.py +++ b/io_mesh_ply/import_ply.py @@ -235,7 +235,7 @@ def load_ply(filepath): if -1 in colindices: colindices = None else: # if not a float assume uchar - colmultiply = [1.0 if el.properties[i].numeric_type in ('f', 'd') else (1.0 / 256.0) for i in colindices] + colmultiply = [1.0 if el.properties[i].numeric_type in {'f', 'd'} else (1.0 / 256.0) for i in colindices] elif el.name == b'face': findex = el.index(b'vertex_indices') diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index 209fc4041af1063a510072627aa573c93d942e52..f39fe0e5e6e906e50d802a204dd22cd8a0a263b7 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -214,7 +214,7 @@ def skip_to_end(file, skip_chunk): def add_texture_to_material(image, texture, material, mapto): #print('assigning %s to %s' % (texture, material)) - if mapto not in ("COLOR", "SPECULARITY", "ALPHA", "NORMAL"): + if mapto not in {'COLOR', 'SPECULARITY', 'ALPHA', 'NORMAL'}: print('/tError: Cannot map to "%s"\n\tassuming diffuse color. modify material "%s" later.' % (mapto, material.name)) mapto = "COLOR" diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index 67422691bc659dd138c4a6a7c701e41cebc403a2..90555e100022437029a72278852d7c0a274a474b 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -972,7 +972,7 @@ def save_single(operator, scene, filepath="", if light_type > 2: light_type = 1 # hemi and area lights become directional - if light.type in ('HEMI', ): + if light.type == 'HEMI': do_light = not (light.use_diffuse or light.use_specular) do_shadow = False else: diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py index f1635f1786d292e514d2c61a452c191ea1d851b6..8d61d43dfceb8c40cd3ae6a199f21c5e36302ec5 100644 --- a/io_scene_x3d/export_x3d.py +++ b/io_scene_x3d/export_x3d.py @@ -1254,7 +1254,7 @@ def export(file, if obj_type == 'CAMERA': writeViewpoint(ident, obj, obj_matrix, scene) - elif obj_type in ('MESH', 'CURVE', 'SURF', 'FONT'): + elif obj_type in {'MESH', 'CURVE', 'SURF', 'FONT'}: if (obj_type != 'MESH') or (use_apply_modifiers and obj.is_modified(scene, 'PREVIEW')): try: me = obj.to_mesh(scene, use_apply_modifiers, 'PREVIEW') diff --git a/object_grease_scatter.py b/object_grease_scatter.py index 139ca7a8e2526e328e1e9013f0b128883fd4f419..8746a12cc54e7a2c8ff8526d9bb2e8cfb79ddcb2 100644 --- a/object_grease_scatter.py +++ b/object_grease_scatter.py @@ -26,13 +26,14 @@ bl_info = { "version": (0, 1), "blender": (2, 5, 8), "api": 36079, - "location": "File > Export > Cameras & Markers (.py)", - "description": "Export Cameras & Markers (.py)", + "location": "3D View, Toolbar", + "description": ("Scatter a group of objects onto the active mesh using " + "the grease pencil lines"), "warning": "", - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\ - "Scripts/Object/Grease_Scatter", - "tracker_url": "https://projects.blender.org/tracker/index.php?"\ - "func=detail&aid=TODO", + "wiki_url": ("http://wiki.blender.org/index.php/Extensions:2.5/Py/" + "Scripts/Object/Grease_Scatter"), + "tracker_url": ("https://projects.blender.org/tracker/index.php?" + "func=detail&aid=TODO"), "support": 'OFFICIAL', "category": "Object"} @@ -115,20 +116,19 @@ def _main(self, DENSITY=1.0, SCALE=0.6, RAND_LOC=0.8, RAND_ALIGN=0.75): scene.objects.link(obj_new) ray = o.ray_cast + closest_point = o.closest_point_on_mesh #ray = C.scene.ray_cast DEBUG = False def fix_point(p): - for d in dirs: - # print(p) - hit, no, ind = ray(p, p + d) - if ind != -1: - if DEBUG: - return [p, no, None] - else: - # print("good", hit, no) - return [hit, no, None] + hit, no, ind = closest_point(p) + if ind != -1: + if DEBUG: + return [p, no, None] + else: + # print("good", hit, no) + return [hit, no, None] # worry! print("bad!", p, BAD_NORMAL) @@ -373,11 +373,11 @@ class Scatter(bpy.types.Operator): pass _main(self, - DENSITY=self.properties.density, - SCALE=self.properties.scale, - RAND_LOC=self.properties.rand_loc, - RAND_ALIGN=self.properties.rand_align - ) + DENSITY=self.properties.density, + SCALE=self.properties.scale, + RAND_LOC=self.properties.rand_loc, + RAND_ALIGN=self.properties.rand_align, + ) return {'FINISHED'} def invoke(self, context, event): diff --git a/render_povray/render.py b/render_povray/render.py index 6cdc2193740919fa2b95ee50a8309e550cf91998..6260a07716203a075562b3281415edd10277ab8c 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -645,7 +645,7 @@ def write_pov(filename, scene=None, info_callback=None): # Sun shouldn't be attenuated. Hemi and area lights have no falloff attribute so they # are put to type 2 attenuation a little higher above. - if lamp.type not in ('SUN', 'AREA', 'HEMI'): + if lamp.type not in {'SUN', 'AREA', 'HEMI'}: tabWrite("fade_distance %.6f\n" % (lamp.distance / 5.0)) if lamp.falloff_type == 'INVERSE_SQUARE': tabWrite("fade_power %d\n" % 2) # Use blenders lamp quad equivalent @@ -682,7 +682,7 @@ def write_pov(filename, scene=None, info_callback=None): meta = ob.data # important because no elements will break parsing. - elements = [elem for elem in meta.elements if elem.type in ('BALL', 'ELLIPSOID')] + elements = [elem for elem in meta.elements if elem.type in {'BALL', 'ELLIPSOID'}] if elements: tabWrite("blob {\n") @@ -839,7 +839,7 @@ def write_pov(filename, scene=None, info_callback=None): # XXX I moved all those checks here, as there is no need to compute names # for object we won’t export here! - if ob.type in ('LAMP', 'CAMERA', 'EMPTY', 'META', 'ARMATURE', 'LATTICE'): + if ob.type in {'LAMP', 'CAMERA', 'EMPTY', 'META', 'ARMATURE', 'LATTICE'}: continue try: diff --git a/render_renderfarmfi.py b/render_renderfarmfi.py index 01656c591d46ed5ef405ecf5fd75918222739d96..862aa1071faad44c307a05df39e2b13785f4f46b 100644 --- a/render_renderfarmfi.py +++ b/render_renderfarmfi.py @@ -565,7 +565,7 @@ def checkStatus(ore): if ore.hash=='' and (ore.username=='' or ore.password==''): bpy.errors.append('missing_creds') - if '' in (ore.title, ore.longdesc, ore.shortdesc): + if '' in {ore.title, ore.longdesc, ore.shortdesc}: bpy.errors.append('missing_desc') setStatus('username', ore.hash=='' and ore.username=='') @@ -604,7 +604,7 @@ def xmlSessionsToOreSessions(sessions, queue): s = completed[sid]['title'] # t = completed[sid]['timestamps'] # UNUSED sinfo = OreSession(sid, s) - if queue in ('completed', 'active'): + if queue in {'completed', 'active'}: sinfo.frames = completed[sid]['framesRendered'] sinfo.startframe = completed[sid]['startFrame'] sinfo.endframe = completed[sid]['endFrame'] diff --git a/rigify/__init__.py b/rigify/__init__.py index c7b02d6c1054794f5fd7e2d68cf99431660f5753..4884abac5334f9ef59a93465a0a2f12e4fa9f65b 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -56,7 +56,7 @@ def get_rig_list(path): for f in files: is_dir = os.path.isdir(os.path.join(SEARCH_DIR_ABS, f)) # Whether the file is a directory - if f[0] in (".", "_"): + if f[0] in {".", "_"}: pass elif f.count(".") >= 2 or (is_dir and "." in f): print("Warning: %r, filename contains a '.', skipping" % os.path.join(SEARCH_DIR_ABS, f)) diff --git a/rigify/ui.py b/rigify/ui.py index 7551ce86da3f54fc8d64ef6789832d1ade257787..741d6dab310d33c9c5d770c8ed9125b1944aab4c 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -46,7 +46,7 @@ class DATA_PT_rigify_buttons(bpy.types.Panel): obj = context.object id_store = C.window_manager - if obj.mode in ('POSE', 'OBJECT'): + if obj.mode in {'POSE', 'OBJECT'}: row = layout.row() row.operator("pose.rigify_generate", text="Generate") elif obj.mode == 'EDIT': diff --git a/space_view3d_copy_attributes.py b/space_view3d_copy_attributes.py index a6ffc08bd09d75ee1dec31938763e7b24b555f54..307b9b70263f5e89e35a08c0b3886012eb288ced 100644 --- a/space_view3d_copy_attributes.py +++ b/space_view3d_copy_attributes.py @@ -743,7 +743,7 @@ class MESH_OT_CopyFaceSettings(bpy.types.Operator): to_face.use_twoside = from_face.use_twoside elif mode == 'TRANSP': to_face.blend_type = from_face.blend_type - elif mode in ('UV', 'IMAGE'): + elif mode in {'UV', 'IMAGE'}: attr = mode.lower() setattr(to_face, attr, getattr(from_face, attr)) return _end({'FINISHED'}) diff --git a/space_view3d_math_vis/utils.py b/space_view3d_math_vis/utils.py index 08a2427f1ff4a622ac22b2bbb383812daf05a6c0..4fbc724ef86ea708ab32eddea08acc9bcd5330ad 100644 --- a/space_view3d_math_vis/utils.py +++ b/space_view3d_math_vis/utils.py @@ -52,7 +52,7 @@ def console_math_data(): data_quat[key] = var elif var_type is Euler: data_euler[key] = var - elif var_type in (list, tuple): + elif var_type in {list, tuple}: if var: ok = True for item in var: diff --git a/space_view3d_spacebar_menu.py b/space_view3d_spacebar_menu.py index 33a029cc2582c96f9a66a31548474c213015582a..4583e4228dafeaee21779b5dccafedeca5407406 100644 --- a/space_view3d_spacebar_menu.py +++ b/space_view3d_spacebar_menu.py @@ -698,7 +698,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu): layout.separator() - if arm.draw_type in ('BBONE', 'ENVELOPE'): + if arm.draw_type in {'BBONE', 'ENVELOPE'}: layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'